{# List school section #}

{% extends 'admin/_base_admin.html.twig' %}
{% set menu_section = true %}
{% block title %}Etudiant{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="bgc-white bd bdrs-3 p-20 mB-20">
                <div class="row">
                    <div class="col-md-6">
                        <h4 class="c-grey-900 mB-20">Liste des étudiants</h4>
                    </div>
                    <div class="col-md-6 text-right">
                        <a href="{{ path('student_manage',{"classe":classe.id}) }}" class="btn btn-primary">Nouveau</a>
                    </div>
                </div>
                <table id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th>Nom</th>
                        <th>Prénom</th>
                        <th>Photo</th>
                        {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <th>Nom</th>
                        <th>Prénom</th>
                        <th>Photo</th>
                        {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </tfoot>
                    <tbody>
                    {% for student in students %}
                        <tr>
                            <td>{{ student.user.username }}</td>
                            <td>{{ student.user.prenom }}</td>
                            <td>
                                <img src="{{ asset('/uploads/phototechzara/'~student.user.photo) }}"
                                     class="w-3r h-3r bdrs-50p" alt="">
                            </td>
                            {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_DIRECTION') %}
                                <td>
                                    <a class="btn btn-outline-success btn-sm" title="Modifier"
                                       href="{{ path('student_manage',{'classe':classe.id,'id': student.id}) }}">
                                        <i class="ti-pencil"></i>
                                    </a>
                                    <a class="btn btn-outline-primary btn-sm" title="Details"
                                       href="{{ path('etudiant_details',{'id': student.id}) }}">
                                        <i class="ti-eye"></i>
                                    </a>
                                    <li class="nav-item dropdown btn btn-outline-primary btn-sm">
                                        <a class="dropdown-toggle"
                                           href="#" id="navbarDropdownMenuLink"
                                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <i class="ti-list-ol"></i>
                                        </a>
                                        {{ render(controller('App\\Controller\\Session\\SessionController::renderTemplate',{"user":student})) }}
                                    </li>
                                    <a class="btn btn-outline-danger btn-sm" title="Supprimer"
                                       href="{{ path('student_remove',{'id': student.id}) }}">
                                        <i class="ti-trash"></i>
                                    </a>
                                    <a class="btn btn-outline-secondary btn-sm" title="Historique"
                                       href="{{ path('history_user',{'id': student.user.id}) }}">
                                        <i class="ti-bookmark-alt"></i>
                                    </a>
                                </td>
                            {% endif %}
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}