<!--
SPDX-FileCopyrightText: 2017-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% extends "orga/mails/base.html" %}

{% load i18n %}
{% load render_table from django_tables2 %}

{% block mail_content %}
    <h2>
        <span>
            {{ page_obj.paginator.count }}
            {% blocktranslate trimmed count count=page_obj.paginator.count %}
                pending mail
            {% plural %}
                pending mails
            {% endblocktranslate %}
        </span>
    </h2>
    <div class="filter-group">
        <div>
            {% include "common/includes/search_form.html" with omit_wrapper=True %}
        </div>
        <div class="d-flex flex-column align-items-end">
            <div>
                {% if page_obj.has_other_pages %}
                    <a href="{{ request.event.orga_urls.send_outbox }}?pks={% for mail in mails %}{{ mail.pk }}{% if not forloop.last %},{% endif %}{% endfor %}" class="btn btn-outline-success mr-2">{% translate "Send all on this page" %}
                    </a>
                {% endif %}
                <a href="{{ request.event.orga_urls.send_outbox }}?{{ request.GET.urlencode }}" class="btn btn-success mr-2">
                    {% translate "Send all" %}
                </a>
                <a href="{{ request.event.orga_urls.purge_outbox }}?{{ request.GET.urlencode }}" class="btn btn-danger">
                    {% translate "Discard all" %}
                </a>
            </div>
            <div>
                {% if is_filtered %}
                    <div class="text-right text-muted mt-2">
                        <i class="fa fa-filter"></i>
                        {% translate "The current filters will be used when sending/discarding emails." %}
                    </div>
                {% endif %}
            </div>
        </div>
    </div>
    {% render_table table %}

{% endblock mail_content %}
