{% extends "postorius/base.html" %}
{% load i18n %}
{% load nav_helpers %}
{% load pagination %}

{% block head_title %}
{{ page_title }} | {{ list.fqdn_listname }} - {{ block.super }}
{% endblock %}

{% block content %}

    {% list_nav 'list_subscription_requests' page_title page_subtitle %}

    {% if paginated_requests.paginator.count > 0 %}
        <div class="table-responsive">
            <table class="table table-bordered table-striped">
                <thead>
                    <tr>
                        <th>{% trans 'E-Mail Address' %}</th>
                        <th>{% trans 'Actions' %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for request in paginated_requests.object_list %}
                    <tr>
                      <td>
                          {% if request.display_name %}
                              "{{ request.display_name }}" &lt;{{ request.email }}&gt;
                          {% else %}
                              {{ request.email }}
                          {% endif %}
                      </td>
                      <td>
                        <form method="POST" action="{% url 'handle_subscription_request' list.list_id request.token %}">
                          {% csrf_token %}
                            <input type="submit" name='discard' class="btn btn-xs btn-danger" value="{% trans 'Discard' %}">
                            <a href="{% url 'list_bans' list.list_id %}?email={{ request.email }}" class="btn btn-xs btn-danger">{% trans 'Ban' %}</a>
                        </form>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% paginator paginated_requests %}
    {% else %}
        <p>{% trans 'There are currently no subscription requests for this list.' %}</p>
    {% endif %}
{% endblock %}
