{% import "macro/table.html" as table %}
<table class="ui bottom 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 class="collapsing">
                    <a href="{{ url_for('core.groups.group', group=group) }}">
                        <i class="users circular black inverted icon"></i>
                    </a>
                </td>
                <td><a href="{{ url_for('core.groups.group', group=group) }}">{{ group.display_name }}</a></td>
                <td>{% if group.description %}{{ group.description }}{% endif %}</td>
                <td>{{ group.members|len|numberformat }}</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>
