{%  extends 'template-admin.html.twig' %}

{% block title %} {{ parent() }}{% endblock %}

{% block stylesheets %} {{ parent() }}{% endblock %}
{% block javascripts %} {{ parent() }}{% endblock %}

{% block body %}
    <div class="container-fluid py-4">
        <div class="row">
            <div class="col-12">
                <div class="card mb-4">
                    <div class="card-header pb-0">
                        <h6 class="text-uppercase">Lista de usuário do sistema</h6>
                    </div>
                    <div class="card-body px-0 pt-0 pb-2">
                        <div class="table-responsive p-0">
                            <table class="table align-items-center mb-0">
                                <thead>
                                <tr>
                                    <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7"><i class="fa fa-user-circle"></i> Nome do usuário</th>
                                    <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2"><i class="fa fa-edit"></i> Função</th>
                                    <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7"><i class="fa fa-edit"></i> Estado</th>
                                    <th class="text-secondary opacity-7"></th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for usuario in usuarios %}
                                <tr>
                                    <td>
                                        <div class="d-flex px-2 py-1">
                                            <div>
                                                {#<i class="ni ni-single-02" style="padding: 20px;"></i>#}
                                                <img src="{{ asset('assets/img/team-2.jpg') }}" style="width: 190px; height: 190px;" class="avatar avatar-sm me-3" alt="user1">
                                            </div>
                                            <div class="d-flex flex-column justify-content-center">
                                                <h6 class="mb-0 text-sm">{{ usuario.nome }}</h6>
                                                <p class="text-xs text-secondary mb-0">{{ usuario.email }}</p>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        {% for role in usuario.roles %}
                                            {% if role == "ROLE_ADMIN" %}
                                                {% set name="Administrador" %}
                                                {% set color="danger" %}
                                            {% elseif role == "ROLE_MEDICO_ADMIN"%}
                                                {% set name="Médico" %}
                                                {% set color="info" %}
                                            {% elseif role == "ROLE_SECRE_ADMIN"%}
                                                {% set name="Secretário" %}
                                                {% set color="warning" %}
                                            {% else %}
                                                {% set name="Técnico" %}
                                                {% set color="dark" %}
                                            {% endif %}
                                            <span class="badge bg-{{ color }} text-xs font-weight-bold mb-0">{{ name }}</span>
                                        {% endfor %}
                                        <p class="text-xs text-secondary mb-0">Do sistema</p>

                                    </td>
                                    <td class="align-middle text-center text-sm">
                                        {% if usuario.isAtivo == true %}
                                          <span class="badge badge-sm bg-success">Ativo</span>
                                        {% else %}
                                            <span class="badge badge-sm bg-danger">Não ativo</span>
                                        {% endif %}
                                    </td>
                                    {#<td class="align-middle text-center">
                                        <span class="text-secondary text-xs font-weight-bold">23/04/18</span>
                                    </td>#}
                                    <td class="align-middle">
                                        <a href="{{ path('app_admin_usuarios_edit',{id:usuario.id}) }}" class="btn btn-warning shadow-none" >
                                            <i class="fa fa-edit"></i>
                                        </a>
                                    </td>
                                </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    <!-- Modal -->


{% endblock %}