{% load i18n %}

<h4>Personal Access Tokens</h4>

<div>
    <a href="{% url 'create_token' %}">New Personal Access Token</a>
</div>

<div id="tokens-list">
    {% for token in object_list %}
        <div>
            <div>{% trans "Name" %}: {{  token.name }}</div>
            <div>{% trans "Description" %}: {{ token.description }}</div>
            <div>{%  trans "Last Used At" %}: {{ token.last_used_at|date }}</div>
            <div>{% trans "Revoked At" %}: {{ token.revoked_at|date }}</div>
            {% if not token.revoked_at %}
                <div><a href="{% url 'delete_token' token.id %}">Revoke</a></div>
            {% endif %}
        </div>
    {% empty %}
        <div>{% trans "Not tokens yet." %}</div>
    {% endfor %}
</div>

<div id="tokens-pagination">
    <div>
        {% if page_obj.has_previous %}
            <a href="?page=1">&laquo; {% trans "First" %}</a>
            <a href="?page={{ page_obj.previous_page_number }}">{% trans "Previous" %}</a>
        {% endif %}

        <span class="current">
            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
        </span>

        {% if page_obj.has_next %}
            <a href="?page={{ page_obj.next_page_number }}">{% trans "Next" %}</a>
            <a href="?page={{ page_obj.paginator.num_pages }}">{% trans "Last" %} &raquo;</a>
        {% endif %}
    </div>
</div>
