{% extends '@CpCreationVitiCore/admin/base.html.twig' %}

{% block content %}
    <div class="panel panel-default">
    <div class="panel-heading">
        Admins
        <div class="pull-right">
            <div class="btn-group">
                <a href="{{ path('admin_user_new') }}" type="button" class="btn btn-default btn-xs">
                    Ajouter un admin
                </a>
            </div>
        </div>
    </div>
    <table class="table table-striped">
        <thead>
        <tr>
            <th>#</th>
            <th>Identifiant</th>
            <th>Email</th>
            <th>Roles</th>
            <th>Action</th>
        </tr>
        </thead>
        <tbody>
        {% for item in items %}
        <tr>
            <td>{{ loop.index }}</td>
            <td>{{ item.username }}</td>
            <td>{{ item.email }}</td>
            <td>{% for role in item.roles %} <span class="label label-default">{{ role }}</span> {% endfor %}</td>
            <td>
                <a href="{{ path('admin_user_edit', { id: item.id}) }}" class="btn btn-info btn-xs"
                   data-title="Editer l'utilisateur"><i
                            class="fas fa-edit fa-2x" aria-hidden="true"></i></a>
                <a href="{{ path('admin_user_delete', { id: item.id }) }}"
                   class="confirm-deletable btn btn-danger btn-xs"
                   data-title="Supprimer l'admin {{ item.username }}"><i class="fa fa-2x fa-trash"
                                                                               aria-hidden="true"></i></a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}
