{% extends "administration/base.html" %}

{% load i18n %}
{% load utils %}

{% block content %}
<section class="pf-c-page__main-section pf-m-light">
    <div class="pf-c-content">
        <h1>
            <i class="pf-icon pf-icon-migration"></i>
            {% trans 'Invitations' %}
        </h1>
        <p>{% trans "Create Invitation Links to enroll Users, and optionally force a username or expire on a set date." %}
        </p>
    </div>
</section>
<section class="pf-c-page__main-section pf-m-no-padding-mobile">
    <div class="pf-c-card">
        <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-top">
            <div class="pf-c-toolbar__action-group">
                <a href="{% url 'passbook_admin:invitation-create' %}?back={{ request.get_full_path }}"
                    class="pf-c-button pf-m-primary" type="button">{% trans 'Create' %}</a>
            </div>
            {% include 'partials/pagination.html' %}
        </div>
        <table class="pf-c-table pf-m-compact pf-m-grid-xl" role="grid">
            <thead>
                <tr role="row">
                    <th role="columnheader" scope="col">{% trans 'Expiry' %}</th>
                    <th role="columnheader" scope="col">{% trans 'Link' %}</th>
                    <th role="cell"></th>
                </tr>
            </thead>
            <tbody role="rowgroup">
                {% for invitation in object_list %}
                <tr role="row">
                    <td role="cell">
                        <span>
                            {{ invitation.expiry }}
                        </span>
                    </td>
                    <td role="cell">
                        <span>
                            {{ invitation.Link }}
                        </span>
                    </td>
                    <td>
                        <a class="pf-c-button pf-m-danger" href="{% url 'passbook_admin:invitation-delete' pk=invitation.pk %}?back={{ request.get_full_path }}">{% trans 'Delete' %}</a>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
        <div class="pf-c-toolbar" id="page-layout-table-simple-toolbar-bottom">
            {% include 'partials/pagination.html' %}
        </div>
    </div>
</section>
{% endblock %}