{% extends 'admin/_base_admin.html.twig' %}

{% set menu_user =true %}

{% block title %}Gestion utilisateur{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="bgc-white bd bdrs-3 p-20 mB-20"><h4 class="c-grey-900 mB-20">Liste des utilisateurs</h4>
                <table id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th>Nom</th>
                        <th>Etablissement</th>
                        <th>Date d'entrer</th>
                        {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <th>Nom</th>
                        <th>Etablissement</th>
                        <th>Date d'entrer</th>
                        {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </tfoot>
                    <tbody>
                    {% for user in users %}
                        {% if user.deletedAt == null %}
                            <tr>
                                <td>{{ user.nom }}</td>
                                <td>{{ user.etsName }}</td>
                                <td>{{ user.dateCreate|date('Y-m-d') }}</td>
                                {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                                    <td>
                                        <a class="btn btn-outline-danger btn-sm" title="Supprimer"
                                           href="{{ path('user_delete', {'id': user.id}) }}">
                                            <i class="ti-trash"></i>
                                        </a>
                                    </td>
                                {% endif %}
                            </tr>
                        {% endif %}
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}