{% import "macro/table.html" as table %}
<table class="ui attached table groups">
    <thead>
        <tr>
            <th></th>
            <th>{% trans %}Name{% endtrans %}</th>
            <th>{% trans %}Description{% endtrans %}</th>
            <th>{% trans %}Number of members{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
        {% for group in table_form.items_slice %}
            <tr>
                <td>
                    <a href="{{ url_for('groups.group', groupname=group.display_name) }}">
                        <i class="users circular black inverted icon"></i>
                    </a>
                </td>
                <td><a href="{{ url_for('groups.group', groupname=group.display_name) }}">{{ group.display_name }}</a></td>
                <td>{% if group.description %}{{ group.description[0] }}{% endif %}</td>
                <td>{{ group.member|len }}</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 criterias?{% 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>
