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

{% block body %}
    <div id="genetableau">
        {% set path = path('Ajax.liste.magasiniers') %}
        {% set formName = "formulaireListeMagasinier" %}
        <form method="POST" id="{{ formName }}" class="form-default">
            <input type="hidden" name="divCode" value="{{ post.divCode }}" />
            <input type="hidden" name="divLibelle" value="{{ post.divLibelle }}" />
            <table class="table" id="tableau">
                <thead class="thead-dark">
                    <tr>
                        <th>{{ triTable('CODE',  infoPagination.filter.tri_CODE, 'Code' | trad, 'genetableau', path, formName) }}</th>
                        <th>{{ triTable('NOM',  infoPagination.filter.tri_NOM, 'Nom' | trad, 'genetableau', path, formName) }}</th>
                        <th>{{ triTable('RAIS_SOC',  infoPagination.filter.tri_RAIS_SOC, 'Raison sociale' | trad, 'genetableau', path, formName) }}</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <th>{{ filterTable('egal_HA#point#CODE', post['filter_egal_HA#point#CODE'], '', 'genetableau', path, formName,'','','',false) }}</th>
                    <th>{{ filterTable('HA#point#NOM', post['filter_HA#point#NOM'], '', 'genetableau', path, formName,'','','',false) }}</th>
                    <th>{{ filterTable('SOC#point#RAIS_SOC', post['filter_SOC#point#RAIS_SOC'], '', 'genetableau', path, formName,'','','',false) }}</th>
                </tr>

                {% for magasinier in magasiniers %}
                    <tr onclick="{{ attrJs('changeCodeLibelle', [ post.divCode, magasinier.CODE, post.divLibelle, magasinier.NOM ~ ' (' ~ magasinier.CODE ~ ')']) }};desactivePopup()">
                        <td>{{ magasinier.CODE   | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
                        <td>{{ magasinier.NOM  | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
                        <td>{{ magasinier.RAIS_SOC }} ({{ magasinier.CTR_ADR }})</td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
            {{ paginations(
                path,
                infoPagination.nombreDePage,
                infoPagination.page,
                infoPagination.post,
                'modal-body'
            ) }}
        </form>
    </div>
{% endblock %}