{% extends 'GestionBundle:Layout:baseAdmin.html.twig' %}


{% block content %}

    <nav class="navbar navbar-fixed-top navbar-dark bg-inverse">
        <a class="navbar-brand" href="{{path('admin_homepage')}}" style="margin-right: 100px">GPC : Espace Admin</a>
        <ul class="nav navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="{{path('composant_index')}}">Composant Logiciel<span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{path('produit_index')}}">Produit Logiciel</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{path('version_index')}}">Version Composant</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{path('version_produit_index')}}">Version Produit</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="{{path('admin_homepage_users')}}">Utilisateur</a>
            </li>
            <li class="nav-item">
                <a style="margin-left: 150px;" class="nav-link" href="{{ path('fos_user_security_logout') }}">Déconnexion</a>
            </li>
        </ul>
    </nav>

    <div class="container">
        <div class="starter-template">
            <div style="text-align: left; margin: 10px;">
                <a class="btn btn-primary" href="{{ path('fos_user_registration_register') }}">Ajouter</a>
            </div>
            <table class="table table-striped" style="text-align: left">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Nom d'utilisateur</th>
                        <th>Email</th>
                        <th>Nom et prénom</th>
                        <th>Tél</th>
                        <th>Activer</th>
                        <th>Rôle</th>
                        <th>Dernière connexion</th>
                    </tr>
                </thead>
                <tbody>
                    {% for entity in entities %}
                        <tr>
                            <td>{{ loop.index }}</td>
                            <td>{{ entity.username }}</td>
                            <td>{{ entity.email }}</td>
                            <td>{{ entity.nom|capitalize ~ ' ' ~ entity.prenom|upper }}</td>
                            <td>{{ entity.tel }}</td>
                            <td>
                                {% if entity.enabled %}
                                    Oui
                                {% else %}
                                    Non
                                {% endif %}
                            </td>
                            <td>{% if entity.roles[0] == 'ROLE_ADMIN' %}Admin{% else %}Responsable{% endif %}</td>
                            <td>{{ 'now'|date('d/m/Y à H:i:s') }}</td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>

    </div>

{% endblock content %}