{% extends 'layout.twig' %}

{% block body %}
    <div class="contenu clearfix"  id="sbe_entes">
        <h1>
            {{ 'Rubriques' | trad }}
            {% if hasCreateEditAccessRights %}
                <a href="{{ path('Stock.Rubrique.nouveauForm') }}" class="button principal ajout button_right last mr-0">
                    {{ 'Nouvelle' | trad }}
                </a>
            {% endif %}
        </h1>
        {{ ariane() }}
        <div class="tab-content" id="tab-content">
            {% set formName = "filtres_rubrique" %}
            <form method="post" name="{{ formName }}" id="{{ formName }}">
                <p></p>
                <div id='refreshTable'>
                    <table class="table table-hover">
                        <thead class="thead-dark" >
                        <tr>
                            <th scope="col" width="500px">
                                {{ triTable('CODE',post.tri_CODE,'Code' | trad, '', '', formName) }}
                            </th>
                            <th scope="col" width="500px">
                                {{ triTable('LIBELLE',post.tri_LIBELLE,'Libellé' | trad, '', '', formName) }}
                            </th>
                            {% if hasCreateEditAccessRights %}
                                <th scope="col" width="90px">{{ 'Actions' | trad }}</th>
                            {% endif %}
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="recherche">
                            <td>
                                {{ filterTable('egal_CODE', post.filter_egal_CODE, '', '', '',formName, '', 'Code' | trad) }}
                            </td>
                            <td>
                                {{ filterTable('LIBELLE', post.filter_LIBELLE, '', '', '',formName, '', 'Libellé' | trad) }}
                            </td>
                            {% if hasCreateEditAccessRights %}
                                <td></td>
                            {% endif %}
                        </tr>

                        {% for rubrique in rubriques %}
                            <tr id="srubcomp{{ rubrique.CODE }}" class="{% if loop.index is divisible by(2) %}even{% else %}odd{% endif %}">
                                <td>{{ rubrique.CODE | visualise }}</td>
                                <td>{{ rubrique.LIBELLE | visualise }}</td>
                                {% if hasCreateEditAccessRights %}
                                    <td>
                                        <a href="{{ path('Stock.Rubrique.modifierForm', { code: get_param_from_code(rubrique.CODE) }) }}">
                                            <span class="modifier_v2"></span>
                                        </a>
                                    </td>
                                {% endif %}
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    {{ paginations(
                        path('Stock.Rubrique.gestion'),
                        infoPagination.nombreDePage,
                        infoPagination.page,
                        infoPagination.post
                    ) }}
                </div>
            </form>
        </div>
    </div>
{% endblock %}