{{ moduleHeader('user', 'Group membership'|trans, '', true, true, false, true) }}
<h3>
    <span class="fas fa-users"></span>
    {% trans %}Group membership{% endtrans %} ({{ group.name }})
</h3>
<table class="table table-bordered">
    <colgroup>
        <col id="cName" />
        <col id="cDescription" />
        <col id="cType" />
        <col id="cState" />
        <col id="cMembers" />
        <col id="cMaximum" />
        <col id="cFunctions" />
    </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">{% trans %}Members{% endtrans %}</th>
        <th id="hMaximum" scope="col">{% trans %}Maximum membership{% endtrans %}</th>
        <th id="hFunctions" scope="col">{% trans %}Functions{% endtrans %}</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td headers="hName">{{ group.name }}</td>
        <td headers="hDescription">{{ group.description }}</td>
        <td headers="hType">{{ groupTypes[group.gtype] }}</td>
        <td headers="hState">{{ states[group.state] }}</td>
        <td headers="hMembers">{{ group.users.count }}</td>
        <td headers="hMaximum">{{ (group.nbumax == false or group.nbumax == 0) ? 'Unlimited'|trans : group.nbumax }}</td>
        <td headers="hFunctions" 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>
    </tbody>
</table>
<br />
<table class="table table-bordered table-striped">
    <colgroup>
        <col id="cUserName" />
        <col id="cStatus" />
    </colgroup>
    <thead>
        <tr>
            <th id="hUserName" scope="col">{% trans %}User name{% endtrans %}</th>
            <th id="hStatus" scope="col">{% trans %}Status{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
        {% for user in group.users %}
            <tr>
                <td headers="hUserName">{{ user.uid|profileLinkByUserId }}</td>
                <td headers="hStatus"><span class="badge {% if user.uid in usersOnline %}badge-success">{% trans %}Online{% endtrans %}{% else %}badge-danger">{% trans %}Offline{% endtrans %}{% endif %}</span></td>
            </tr>
        {% else %}
            <tr class="table-info"><td colspan="2" class="text-center">{% trans %}No users found.{% endtrans %}</td></tr>
        {% endfor %}
    </tbody>
</table>
{#{ include(paginator.template) }#}
{{ moduleFooter() }}
