{% extends 'generic/_base.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% comment %}
Blocks:
  - title:    Page title
  - tabs:     Page tabs
  - content:  Primary page content

Context:
  - form:              The bulk edit form class
  - parent_obj:        The parent object
  - table:             A table of objects being removed
  - obj_type_plural:   The plural form of the object type
  - return_url:        The URL to which the user is redirected after submitting the form
{% endcomment %}

{% block title %}
  {% trans "Remove" %} {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?
{% endblock %}

{% block tabs %}
  <ul class="nav nav-tabs">
    <li class="nav-item" role="presentation">
      <button class="nav-link active" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
        {% trans "Bulk Remove" %}
      </button>
    </li>
  </ul>
{% endblock tabs %}

{% block content %}
  <div class="tab-pane show active" role="tabpanel">
    <div class="alert alert-danger bg-danger-subtle" role="alert">
      <div class="d-flex">
        <div>
          <i class="mdi mdi-alert-octagon p-2"></i>
        </div>
        <div>
          <h4 class="alert-title">{% trans "Confirm Bulk Removal" %}</h4>
          {% blocktrans trimmed with count=table.rows|length %}
            The following operation will remove {{ count }} {{ obj_type_plural }} from {{ parent_obj }}. Please
            carefully review the {{ obj_type_plural }} to be removed and confirm below.
          {% endblocktrans %}
        </div>
      </div>
    </div>
    <div class="container-fluid px-0">
      <div class="card">
        <div class="table-responsive">
          {% render_table table 'inc/table.html' %}
        </div>
      </div>
      <form action="." method="post" class="form">
        {% csrf_token %}
        {% for field in form.hidden_fields %}
          {{ field }}
        {% endfor %}
        <div class="text-end">
          <a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
          <button type="submit" name="_confirm" class="btn btn-danger">
            {% blocktrans trimmed with count=table.rows|length %}
              Remove these {{ count }} {{ obj_type_plural }}
            {% endblocktrans %}
          </button>
        </div>
      </form>
    </div>
  </div>
{% endblock content %}
