{% extends 'layout/admin_page.html' %}

{% block title %}
    {% trans %}Registration requests{% endtrans %}
{% endblock %}

{%- block content %}
    <table class="i-table-widget fixed-width">
        <thead>
            <tr>
                <th>{% trans %}Email Address{% endtrans %}</th>
                <th>{% trans %}First name{% endtrans %}</th>
                <th>{% trans %}Last name{% endtrans %}</th>
                <th>{% trans %}Affiliation{% endtrans %}</th>
                <th>{% trans %}Comment{% endtrans %}</th>
                <th></th>
            </tr>
        </thead>
        <tbody id="registration-requests">
            {%- for req in pending_requests %}
                <tr>
                    <td>{{ req.email }}</td>
                    <td>{{ req.user_data.first_name }}</td>
                    <td>{{ req.user_data.last_name }}</td>
                    <td>{{ req.user_data.affiliation }}</td>
                    <td>{{ req.comment }}</td>
                    <td>
                        <div class="flexrow">
                            <button class="i-button accept js-process-request"
                                    data-href="{{ url_for('.accept_registration_request', req) }}"
                                    data-method="POST">
                                {% trans %}Accept{% endtrans %}
                            </button>
                            <button class="i-button danger js-process-request"
                                    data-href="{{ url_for('.reject_registration_request', req) }}"
                                    data-method="POST">
                                {% trans %}Reject{% endtrans %}
                            </button>
                        </div>
                    </td>
                </tr>
            {%- endfor %}
            <tr class="js-no-requests" {% if pending_requests %}style="display: none;"{% endif %}>
                <td colspan="6">{% trans %}There are no pending requests{% endtrans %}</td>
            </tr>
        </tbody>
    </table>
    <script>
        setupRegistrationRequestList();
    </script>
{%- endblock %}
