{# List school year #}

{% extends 'admin/_base_admin.html.twig' %}
{% block title %}Session{% 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 sessions</h4>
                    </div>
                    <div class="col-md-6 text-right">
                        <a href="{{ path('session_manage') }}" 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 sessions</th>
                        {% if is_granted('ROLE_ADMIN') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <th>Nom</th>
                        {% if is_granted('ROLE_ADMIN') %}
                            <th>Action</th>
                        {% endif %}
                    </tr>
                    </tfoot>
                    <tbody>
                    {% for session in sessions %}
                        <tr>
                            <td>{{ session.name }}</td>
                            {% if is_granted('ROLE_ADMIN') %}
                                <td>
                                    <a class="btn btn-outline-success btn-sm" title="Modifier"
                                       href="{{ path('session_manage',{'id': session.id}) }}">
                                        <i class="ti-pencil"></i>
                                    </a>
                                    <a class="btn btn-outline-danger btn-sm" title="Supprimer"
                                       href="{{ path('session_delete',{'id':session.id}) }}">
                                        <i class="ti-trash"></i>
                                    </a>
                                </td>
                            {% endif %}
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}