{% extends 'base.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}

{% block title %}Delete {{ total_objs_to_delete }} {{ obj_type_plural|bettertitle }}?{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-danger" id="confirm-bulk-deletion">
                <div class="panel-heading"><strong>Confirm Bulk Deletion</strong></div>
                <div class="panel-body">
                    <p><strong>Warning:</strong> The following operation will delete {{ total_objs_to_delete }} {{ obj_type_plural }}. {% if not delete_all %}Please carefully review the {{ obj_type_plural }} to be deleted and confirm below.{% endif %}</p>
                    {% block message_extra %}{% endblock %}
                </div>
            </div>
        </div>
    </div>

    {% if table %}
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="table-responsive">
                        {% render_table table 'inc/table.html' %}
                    </div>
                </div>
            </div>
        </div>
    {% endif %}

    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <form action="" method="post" class="form">

                {% csrf_token %}
                {% if delete_all %}
                    <input type="hidden" name="_all" value="true"  />
                {% endif %}
                {% for field in form.hidden_fields %}
                    {{ field }}
                {% endfor %}

                <div class="text-center">
                    <button type="submit" name="_confirm" class="btn btn-danger">Delete these {{ total_objs_to_delete }} {{ obj_type_plural }}</button>
                    <a href="{{ return_url }}" class="btn btn-default">Cancel</a>
                </div>
            </form>
        </div>
    </div>
{% endblock %}
