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

{% block title %}Liste des thématiques{% endblock %}

{% block main %}
    {#<div class="row plr-16 ptb-24">#}
        {#<div class="col-xs-12 p-0">#}
            {#<div class="bloc-base p-16">#}

                {#{% for flashMessage in app.session.flashbag.get('error') %}#}
                    {#<div class="alert alert-danger">#}
                        {#Erreur :  {{ flashMessage }}#}
                    {#</div>#}
                {#{% endfor %}#}

                {#{% for flashMessage in app.session.flashbag.get('success') %}#}
                    {#<div class="alert alert-success">#}
                        {#Succès : {{ flashMessage }}#}
                    {#</div>#}
                {#{% endfor %}#}
    {% if not entete is null and not entete.texte==''%}
        <div class="col-xs-12 p-0">
            <div class="bloc-base p-16">
                {{ entete.texte|raw }}
            </div>
        </div>
    {% endif %}
                <div class="bloc-title mb-16">
                    <h2 class="align-middle">Thématiques</h2>
                </div>
                <div class="row m-0">
                    <div class="col-xs-12 plr-16 pt-48 pb-16 background-white">
                        {% if is_granted('ROLE_PREVIOUS_ADMIN') %}
                            <a   class="button-rond-md align-middle position-absolute z-3 top-back16 right-16" style="background-color: gray" title="Non accessible en consultation"><i class="fas fa-plus" style="color: white;"></i></a>
                        {% else %}
                            <a  href="{{ path('thematique_new') }}" class="button-rond-md align-middle position-absolute z-3 top-back16 right-16"><i class="fas fa-plus"></i></a>
                        {% endif %}
                        <div class="table-responsive">
                            <table id="myTable" class="display">
                                <thead class="background-orange">
                                <tr>
                                    <th class="plr-8 ptb-16">Code</th>
                                    <th class="plr-8 ptb-16">Intitule</th>
                                    <th class="plr-8 ptb-16">Agence</th>
                                    <th class="plr-8 ptb-16">Visible</th>
                                    <th class="plr-8 ptb-16">Actions</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for thematique in thematiques %}
                                    <tr>
                                        <td class="plr-8 ptb-24">{{ thematique.code }}</td>
                                        <td class="plr-8 ptb-24">{{ thematique.intitule }}</td>
                                        <td class="plr-8 ptb-24">{{ agence.libelle }}</td>
                                        <td class="plr-8 ptb-24">{% if thematique.visible %}Oui{% else %}Non{% endif %}</td>
                                        <td class="plr-8 ptb-24">
                                            {% if is_granted('ROLE_PREVIOUS_ADMIN') %}
                                                <a class="button-rond-xs align-middle" style="background-color: gray" title="Non accessible en consultation"> <i class="fas fa-edit" style="color: white" ></i></a>
                                            {% else %}
                                                <a href="{{ path('thematique_edit', { 'code': thematique.code }) }}" title="Modifier thématique" class="button-rond-xs align-middle"><i class="fas fa-edit"></i></a>
                                            {% endif %}
                                        </td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            {#</div>#}
        {#</div>#}
    {#</div>#}
{% endblock %}
