{% import "macro/table.html" as table %}
<table class="ui bottom attached table tokens">
    <thead>
        <tr>
            <th>{% trans %}Token{% endtrans %}</th>
            <th>{% trans %}Client{% endtrans %}</th>
            <th>{% trans %}Subject{% endtrans %}</th>
            <th>{% trans %}Created{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
        {% for token in table_form.items_slice %}
            <tr>
                <td>
                    <a href="{{ url_for('oidc.tokens.view', token=token) }}">
                        {{ token.token_id }}
                    </a>
                </td>
                <td>
                    <a href="{{ url_for('oidc.clients.edit', client=token.client) }}">
                        {{ token.client.client_name }}
                    </a>
                </td>
                <td>
                    {% if token.subject %}
                        <a href="{{ url_for("core.account.profile_edition", edited_user=token.subject) }}">
                            {{ token.subject.user_name }}
                        </a>
                    {% else %}
                        <a href="{{ url_for('oidc.clients.edit', client=token.client) }}">
                            {{ token.client.client_name }}
                        </a>
                    {% endif %}
                </td>
                <td>{{ token.issue_date }}</td>
            </tr>
        {% else %}
            <tr>
                <td colspan="4">
                    <div class="ui icon message">
                        <i class="exclamation icon"></i>
                        <div class="content">
                            {% if request.headers.get("Hx-Request") %}
                                <div class="header">
                                    {% trans %}No item matches your request{% endtrans %}
                                </div>
                                <p>{% trans %}Maybe try with different criteria?{% endtrans %}</p>
                            {% else %}
                                <div class="header">
                                    {% trans %}There is nothing here{% endtrans %}
                                </div>
                            {% endif %}
                        </div>
                    </div>
                </td>
            </tr>
        {% endfor %}
    </tbody>
    <tfoot>
        <tr>
            <th colspan="4">
                {{ table.pagination(table_form) }}
            </th>
        </tr>
    </tfoot>
</table>
