{% extends 'data_entry.html.twig' %}

{% block title %}Admin | ArCOA{% endblock %}

{% block rightpanel %}
<div class="container" style="max-width: 50vw">
    <h1 class="is-size-1 mt-0 has-text-centered">Administration</h1>

    <div class="container mt-4">
       <h2 class="has-text-centered is-size-3 mb-5">Manage users</h2>
       <table class="table is-striped is-hoverable is-fullwidth">
            <tr><th></th><th>User name</th><th>Role</th><th>First name</th><th>Last name</th><th>Email</th><th>Actions</th></tr>
            {% for user in users %}
            <tr {% if user.id == app.user.id %}class="is-selected"{% endif %} data-user-id="{{ user.id }}">
                <td>{{ loop.index }}</td>
                <td>{{ user.username }}</td>
                <td>
                    {% for role in user.roles %}
                        {% if role != 'ROLE_USER' %}
                            {{ role|replace({"ROLE_": ""})|lower() }}
                        {% endif %}
                    {% endfor %}
                </td>
                <td>{{ user.firstname }}</td>
                <td>{{ user.lastname }}</td>
                <td>{{ user.email }}</td>
                <td>Actions</td></tr>
            {% endfor %}
       </table> 
    </div>
</div>

{% endblock %}