{% extends 'layout.twig' %}

{% block body %}
    <div class="contenu clearfix"  id="articles">
        <H1>{{ 'Articles' | trad }}</H1>

        {{ ariane() }}

        {% set formFilterName = "filtres_smouveme"  %}
        <div class="tab-content" id="tab-content">
            <form method="post" name="{{ formFilterName }}" id="{{ formFilterName }}">
                <h3 class="mb-base">
                    {{ strBuild('Visualisation des mouvements de l\'article N° @1@' | trad, [codeArt]) }}
                </h3>
                <div class="tab-content">
                    <div class="tab-pane active in clearfix">
                        <div id='refreshTable'>
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th scope="col" width="90px">
                                        {{ triTable('NO_MVT', post.tri_NO_MVT, 'N° de mouvements' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('SITE', post.tri_SITE, 'Site' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('TYPE_MVT', post.tri_TYPE_MVT, 'Type' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('TYPE_ENT', post.tri_TYPE_ENT, 'Entité' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="90px">
                                        {{ triTable('NO_ENT', post.tri_NO_ENT, 'N°Entité' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('DTE_MVT', post.tri_DTE_MVT,'Date de mouvement' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('TIERS', post.tri_TIERS, 'Tiers' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('QTE_MVT', post.tri_QTE_MVT, 'Quantité' | trad, '', '', formFilterName) }}
                                    </th>
                                    {% if is_prix_visible() %}
                                        <th scope="col" width="150px">
                                            {{ triTable('PU', post.tri_PU, 'Prix unitaire' | trad, '', '', formFilterName) }}
                                        </th>
                                    {% endif %}
                                    <th scope="col" width="90px">
                                        {{ triTable('SECTIMP', post.tri_SECTIMP, 'Section d\'imputation' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('CODE_COMP', post.tri_CODE_COMP, 'Code complémentaire' | trad, '', '', formFilterName) }}
                                    </th>
                                    <th scope="col" width="150px">
                                        {{ triTable('SSCPTEANA', post.tri_SSCPTEANA, 'Sous compte d\'analyse' | trad, '', '', formFilterName) }}
                                    </th>
                                    {% if is_cg_active() %}
                                        <th scope="col" width="150px">
                                            {{ triTable('CODGES', post.tri_CODGES, 'Code gestion' | trad, '', '', formFilterName) }}
                                        </th>
                                    {% endif %}
                                </tr>
                                </thead>
                                <tbody>
                                {% for mouvement in mouvements %}
                                    <tr id="smouveme{{ mouvement.NO_MVT }}" class="{% if loop.index is divisible by(2) %}even{% else %}odd{% endif %}">
                                        <td class="text-right">{{ mouvement.NO_MVT }}</td>
                                        <td>{{ mouvement.SITE }}</td>
                                        <td>{{ listeChoixTypesMvt[mouvement.TYPE_MVT] }}</td>
                                        <td>{{ listeChoixTypeEntete[mouvement.TYPE_ENT] }}</td>
                                        <td class="text-right">{{ mouvement.NO_ENT }}</td>
                                        <td>{{ mouvement.DTE_MVT | dateTrad }}</td>
                                        <td>{{ mouvement.TIERS | visualise }}</td>
                                        <td class="text-right">
                                            {{ mouvement.QTE_MVT | qte ~ ' ' ~ mouvement.UNITE_STK  }}
                                        </td>
                                        {% if is_prix_visible() %}
                                            <td class="text-right">
                                                {{ (mouvement.PU | prixUnitaire) ~ ' ' ~ mouvement.DEVISE }}
                                            </td>
                                        {% endif %}
                                        <td>{{ (mouvement.SI_LIBELLE ~ ' (' ~ mouvement.SECTIMP ~ ')') | visualise }}</td>
                                        <td>{{ (mouvement.CDC_LIBELLE ~ ' (' ~ mouvement.CODE_COMP ~ ')') | visualise }}</td>
                                        <td>{{ (mouvement.SCA_LIBELLE ~ ' (' ~ mouvement.SSCPTEANA ~ ')') | visualise }}</td>
                                        {% if is_cg_active() %}
                                            <td>{{ (mouvement.CGE_LIBELLE ~ ' (' ~ mouvement.CODGES ~ ')') | visualise }}</td>
                                        {% endif %}
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                            {{ paginations(
                                path('Stock.StockArticle.mouvements', { codeArt: codeArt }),
                                infoPagination.nombreDePage,
                                infoPagination.page,
                                infoPagination.post
                            ) }}
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
{% endblock %}