{% extends '@MauticCore/Default/content.html.twig' %}

{% block headerTitle 'Delete Pipeline' %}

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Delete {{ pipeline.getName() }}</strong></div>
        <div class="panel-body">
            {% if errorMessage %}
                <div class="alert alert-danger">{{ errorMessage }}</div>
            {% endif %}

            {% if not canDelete %}
                {% if pipelineCount <= 1 %}
                    <p class="mb-md">You cannot delete the last remaining pipeline.</p>
                {% else %}
                    <p class="mb-md">
                        This pipeline still has <strong>{{ dealCount }}</strong> deal{{ dealCount == 1 ? '' : 's' }}.
                        Move or close them before deleting this pipeline.
                    </p>
                {% endif %}
            {% else %}
                <p class="mb-md">
                    This removes the pipeline and its stage configuration. Existing deals must be moved out first.
                </p>

                <form method="post">
                    <input type="hidden" name="_token" value="{{ csrf_token('dealflow_pipeline_delete_' ~ pipeline.getId()) }}">
                    <div class="btn-group">
                        <button class="btn btn-danger" type="submit">Delete Pipeline</button>
                        <a class="btn btn-default" href="{{ cancelUrl }}">Cancel</a>
                    </div>
                </form>
            {% endif %}
        </div>
    </div>
{% endblock %}
