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

{% block body %}
    <div id="genetableau">
        <center>
            <div>
                {% set formName = "formStockArticles" %}
                <form method="POST" id='{{ formName }}'>
                    <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_ART',  infoPagination.filter.tri_CODE_ART, 'Code article' | trad, 'genetableau', path('Ajax.liste.stockArticles'), formName) }}</th>
                            <th>{{ triTable('DESIGN',  infoPagination.filter.tri_DESIGN, 'Libellé' | trad,'genetableau', path('Ajax.liste.stockArticles'), formName) }}</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>{{ filterTable('CODE_ART', infoPagination.filter.filter_CODE_ART, '', 'genetableau', path('Ajax.liste.stockArticles'), formName) }}</th>
                            <th>{{ filterTable('DESIGN', infoPagination.filter.filter_DESIGN, '', 'genetableau', path('Ajax.liste.stockArticles'), formName) }}</th>
                        </tr>
                        {% for stockArticle in stockArticles %}
                            <tr onclick="{{ attrJs('changeCodeLibelle', [ post.divCode, stockArticle.CODE_ART, post.divLibelle, stockArticle.DESIGN ~ ' (' ~ stockArticle.CODE_ART ~ ')']) }}; desactivePopup()">
                                <td>{{ stockArticle.CODE_ART }}</td>
                                <td>{{ stockArticle.DESIGN }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>

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