{% extends 'layout.twig' %}
     
{% block body %}
<section class="contenu">
    <h1>{{ 'Commande' | trad }}</h1>

    {{ ariane() }}

    <form method="post" class="form-default"
        action="{{ path('Commande.TermPaie.update',{commandeId: commande.NO_CDE}) }}"
        onsubmit="return ajaxSubmit(event);"
        data-onsuccess="arianePop"
    >
        <div class="bs-row">
            <h2>
                {{ strBuild(
                    'Saisie de l’avancement des termes de paiement de la commande @1@ du fournisseur @2@ (@3@)' | trad,
                    [
                        commande.NO_CDE,
                        commande.fourniss.RS,
                        commande.fourniss.CODE,
                    ]
                ) }}
            </h2>
            <div class="bs-col text-right">
                {{ arianeAnnuler() }}
                <button class="button principal" type="submit">
                    {{- 'Enregistrer' | trad -}}
                </button>
            </div>
        </div>
    

{#_____________________________________________________________________________
Main table #}
<table class="table mt-base container-half">
    <thead class="thead-dark">
        <tr>
        </tr>
    </thead>
    <tbody>
    {% for termPaie in commande.listTermPaie %}
        <trstyle="cursor: pointer" id="term{{loop.index}}">
            <td class="loupe">{{ termPaie.LIBELLE | trad }}</td>
        </trstyle=>
        <tr class="detail_ligne" id="term{{loop.index}}detail">
            <td class="pl-large" colspan="1">
                {% for condPaie in termPaie.listCondPaie %}
                    {% if condPaie.Evenement.HAPLUS | boolSql %}
                        <div class="bs-row flex-y-center">
                            <div style="width: 40%">
                                {{ condPaie.LIB_EVT }}
                            </div>
                            <div class="bs-col">
                                {{ condPaie.EVT_OK ? 'Oui' | trad : 'Non' | trad }}
                            </div>
                        </div>
                    {% else %}
                        {{ inputAdvance('SWITCH', {
                            titre: condPaie.LIB_EVT,
                            name: 'termPaie['~ condPaie.NUM_TP ~ '][' ~ condPaie.NOL_TP ~'][EVT_OK]',
                            value: condPaie.EVT_OK,
                        }) }}
                    {% endif %}
                {% else %}
                <span class="text-muted">{{ 'Vide' | trad }}</span>
                {% endfor %}
            </td>
        </tr>
        {% endfor %}			
    </tbody>
</table>
{#____________________________________________________________________________#}

    </form>
</section>
{% endblock %}