{{ moduleHeader('user', 'Groups'|trans, '', true, true, false, true) }}
<h3>
    <span class="fas fa-list"></span>
    {% trans %}Groups list{% endtrans %}
</h3>
<table id="grouplist" class="table table-bordered table-striped">
    <colgroup>
        <col id="cName" />
        <col id="cDescription" />
        <col id="cType" />
        <col id="cState" />
        <col id="cMembers" />
        <col id="cMaximum" />
        <col id="cActions" />
    </colgroup>
    <thead>
        <tr>
            <th id="hName" scope="col">{% trans %}Name{% endtrans %}</th>
            <th id="hDescription" scope="col">{% trans %}Description{% endtrans %}</th>
            <th id="hType" scope="col">{% trans %}Type{% endtrans %}</th>
            <th id="hState" scope="col">{% trans %}State{% endtrans %}</th>
            <th id="hMembers" scope="col" class="text-center">{% trans %}Members{% endtrans %}</th>
            <th id="hMaximum" scope="col" class="text-center">{% trans %}Maximum membership{% endtrans %}</th>
            <th id="hActions" scope="col">{% trans %}Actions{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
    {% for group in paginator.results|filter(g => hasPermission('ZikulaGroupsModule::', g.gid ~ '::', 'ACCESS_OVERVIEW')) %}
        <tr id="group_{{ group.gid }}">
            <td headers="hName" id="groupname_{{ group.gid }}">
                {{ group.name }}
            </td>
            <td headers="hDescription" id="groupdescription_{{ group.gid }}">
                {{ group.description }}&nbsp;
            </td>
            <td headers="hType" id="groupgtype_{{ group.gid }}" class="zikulagroupsmodule-edit ">
                <span>{{ groupTypes[group.gtype] }}</span>
            </td>
            <td headers="hState" id="groupstate_{{ group.gid }}">
                {{ states[group.state] }}
            </td>
            <td headers="hMembers" id="groupnbuser_{{ group.gid }}" class="text-center">
                {{ group.users.count }}
            </td>
            <td headers="hMaximum" id="groupnbumax_{{ group.gid }}" class="text-center">
                {{ (group.nbumax == false or group.nbumax == 0) ? 'Unlimited'|trans : group.nbumax }}
            </td>
            <td headers="hActions" id="groupaction_{{ group.gid }}" class="actions">
                {% set rowActions = knp_menu_get('zikulaGroupsUserMenu', [], {group: group}) %}
                {{ knp_menu_render(rowActions, {template: '@ZikulaMenuModule/Override/actions.html.twig'}) }}
            </td>
        </tr>
    {% else %}
        <tr class="table-info"><td colspan="7" class="text-center">{% trans %}There are currently no groups that can be joined.{% endtrans %}</td></tr>
    {% endfor %}
    </tbody>
</table>
{{ include(paginator.template) }}
{{ moduleFooter() }}
