{% extends '@ajax-layout/layout.twig' %}

{% block body %}
    <div id="genetableau">
        <center>
            <div>
                <form method="POST" id='formulaireListeDaModels'>
                    <input type="hidden" name="divCode" value="{{ post.divCode }}" />
                    <input type="hidden" name="divLibelle" value="{{ post.divLibelle }}" />
                    <input type="hidden" name="filter_egal_COD_TAB" value="{{ post.filter_egal_COD_TAB }}" />
                    <table class="table" id="tableau">
                        <thead class="thead-dark">
                        <tr>
                            <th>
                                {{ triTable(
                                    'COD_MDLE',
                                    infoPagination.filter.tri_COD_MDLE,
                                    'Code' | trad,
                                    'genetableau',
                                    path('Ajax.liste.daModels'),
                                    'formulaireListeDaModels'
                                ) }}
                            </th>
                            <th>
                                {{ triTable(
                                    'LIBELLE',
                                    infoPagination.filter.tri_LIBELLE,
                                    'Libellé' | trad,
                                    'genetableau',
                                    path('Ajax.liste.daModels'),
                                    'formulaireListeDaModels'
                                ) }}
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>
                                {{ filterTable(
                                    'COD_MDLE',
                                    infoPagination.filter.filter_egal_COD_MDLE,
                                    '', 'genetableau',
                                    path('Ajax.liste.daModels'),
                                    'formulaireListeDaModels'
                                ) }}
                            </th>
                            <th>
                                {{ filterTable(
                                    'LIBELLE',
                                    infoPagination.filter.filter_egal_LIBELLE, '', 'genetableau',
                                    path('Ajax.liste.daModels'),
                                    'formulaireListeDaModels'
                                ) }}
                            </th>
                        </tr>
                        {% for daModel in liste %}
                            <tr onclick='changeCodeLibelle("{{ post.divCode }}","{{ daModel.COD_MDLE }}", "{{ post.divLibelle }}", "{{ daModel.LIBELLE~' ('~daModel.COD_MDLE~')' }}"); desactivePopup()'>
                                <td id ="{{ daModel.COD_MDLE }}">{{ daModel.COD_MDLE }}</td>
                                <td>{{ daModel.LIBELLE }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>

                </form>
                {{ paginations(
                    path('Ajax.liste.daModels'),
                    infoPagination.nombreDePage,
                    infoPagination.page,
                    infoPagination.post,
                    'genetableau'
                ) }}
            </div>
        </center>
    </div>
{% endblock %}