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

{% block body %}
    <div id="genetableau">
        <center>
            <div>
                {% set formName = "formLots" %}
                <p id="hidden_title" class="d-none">
                    {{ strBuild('Liste des lots pour l\'article @1@ - @2@' | trad, [stockArticle.CODE_ART, stockArticle.DESIGN]) }}
                </p>
                <form method="POST" id='{{ formName }}'>
                    <input type="hidden" name="filter_egal_SLO#point#SITE" value="{{ post['filter_egal_SLO#point#SITE'] }}" />
                    <input type="hidden" name="filter_egal_SLO#point#CODE_ART" value="{{ post['filter_egal_SLO#point#CODE_ART'] }}" />
                    <div class="row">
                        <div class="colonne2">
                            <p class="informations">
                                <span class="champs_label">{{ 'Site' | trad }}</span>
                                <span class="resultat">{{ siteStock.DESIGN ~ ' (' ~ siteStock.SITE ~ ')' }}</span>
                            </p>
                        </div>
                        <div class="colonne3">
                            <p class="informations">
                                <span class="champs_label">{{ 'Article' | trad }}</span>
                                <span class="resultat">{{ stockArticle.DESIGN ~ ' (' ~ stockArticle.CODE_ART ~ ')'  }}</span>
                            </p>
                        </div>
                    </div>
                    <br>
                    <table class="table" id="tableau">
                        <thead class="thead-dark">
                            <tr>
                                <th>
                                    {{ triTable('NO_LOT',  infoPagination.filter.tri_NO_LOT, 'N° de lot' | trad, 'genetableau', path('Stock.LotLocal.liste'), formName) }}
                                </th>
                                <th>
                                    {{ triTable('QTE_LOC',  infoPagination.filter.tri_QTE_LOC, 'Quantité' | trad, 'genetableau', path('Stock.LotLocal.liste'), formName) }}
                                </th>
                                <th>
                                    {{ triTable('QTE_INDIS',  infoPagination.filter.tri_QTE_INDIS, 'Quantité indisponible' | trad, 'genetableau', path('Stock.LotLocal.liste'), formName) }}
                                </th>
                                <th>
                                    {{ triTable('PRIX',  infoPagination.filter.tri_PRIX, 'Prix d\'Entrée' | trad, 'genetableau', path('Stock.LotLocal.liste'), formName) }}
                                </th>
                                <th>
                                    {{ triTable('DTE_PEREM',  infoPagination.filter.tri_DTE_PEREM, 'Périmé le' | trad, 'genetableau', path('Stock.LotLocal.liste'), formName) }}
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th>{{ filterTable('egal_SLO#point#NO_LOT', infoPagination.filter['filter_egal_SLO#point#NO_LOT'], '', 'genetableau', path('Stock.LotLocal.liste'), formName) }}</th>
                                <th>{{ filterTable('montant_SLO#point#QTE_LOC', infoPagination.filter['filter_montant_SLO#point#QTE_LOC'], '', 'genetableau', path('Stock.LotLocal.liste'), formName) }}</th>
                                <th>{{ filterTable('montant_SLO#point#QTE_INDIS', infoPagination.filter['filter_montant_SLO#point#QTE_INDIS'], '', 'genetableau', path('Stock.LotLocal.liste'), formName) }}</th>
                                <th>{{ filterTable('montant_SGO#point#PRIX', infoPagination.filter['filter_montant_SGO#point#PRIX'], '', 'genetableau', path('Stock.LotLocal.liste'), formName) }}</th>
                                <th>{{ filterTable('date_SGO#point#DTE_PEREM', infoPagination.filter['filter_date_SGO#point#DTE_PEREM'], '', 'genetableau', path('Stock.LotLocal.liste'), formName, 'datepicker') }}</th>
                            </tr>
                        {% for lotLocal in lotsLocaux %}
                            <tr>
                                <td>{{ lotLocal.NO_LOT }}</td>
                                <td class="text-right">{{ lotLocal.QTE_LOC | qte ~ ' ' ~ lotLocal.UNITE_STK }}</td>
                                <td class="text-right">{{ lotLocal.QTE_INDIS | qte ~ ' ' ~ lotLocal.UNITE_STK }}</td>
                                <td class="text-right">{{ lotLocal.PRIX | prix ~ ' ' ~ lotLocal.DEVISE }}</td>
                                <td>{{ lotLocal.DTE_PEREM | dateTrad }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    {{ paginations(path('Stock.LotLocal.liste'), infoPagination.nombreDePage, infoPagination.page, infoPagination.post, 'genetableau') }}
                </form>
            </div>
        </center>
    </div>
{% endblock %}