<div class="container mt-5">
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>Nickname</th>
            <th>Name</th>
            <th>Surname</th>
            <th>Mail</th>
            <th>Group</th>
            <th>Role</th>
            <th>Extra Time</th>
            {% if action is defined %}
                <th>Action</th>
            {% endif %}
        </tr>
        </thead>
        <tbody>
        {% if users is defined %}
            {% for row in users %}
                <tr>
                    <td>{{ row.id }}</td>
                    <td>{{ row.nickname }}</td>
                    <td>{{ row.name }}</td>
                    <td>{{ row.surname }}</td>
                    <td>{{ row.email }}</td>
                    <td>{{ row.group }}</td>
                    <td>{{ row.roles|join(', ') }}</td>
                    <td>{{ row.extraTime ? 'yes' : 'no' }}</td>
                    {% if action is defined %}
                        <td>
                            {% if action == 'removeUserFromGroup' %}
                                <a href="{{ base }}/admin/{{ userID }}/removeUserFromGroup?userToRemove={{ row.id }}&selectedGroup={{ selectedGroup }}" class="btn btn-danger">Delete from group</a>
                            {% elseif action == 'addUserToGroup' %}
                                <a href="{{ base }}/admin/{{ userID }}/addUserToGroup?userToAdd={{ row.id }}&groupID={{ selectedGroup }}" class="btn btn-success">Add to group</a>
                            {% elseif action == 'removeUser' %}
                                <a href="{{ base }}/admin/{{ userID }}/removeUser?userToRemove={{ row.id }}" class="btn btn-warning">Delete</a>
                            {% endif %}
                        </td>
                    {% endif %}
                </tr>
            {% endfor %}
        {% endif %}
        </tbody>
    </table>
</div>
