{% extends '@DemandeAchat/DemandeAchat/_layoutDetail.twig' %}

{% block da_detail_content %}
<form method="post" name="filtre_demandeAchat" id="filtre_demandeAchat">
    {% if listeLigne %}
        <table class="table table-hover">
            <thead class="thead-dark">
                <tr>
                    <th scope="col" width='5%'>{{ triTable('NO_PO',  infoPagination.filter.tri_NO_PO, 'Ligne' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='8%'>{{ triTable('ACD',  infoPagination.filter.tri_ACD, 'Accord-cadre' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='8%'>{{ triTable('FOU',  infoPagination.filter.tri_FOU, 'Fournisseur' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col">{{ triTable('CODE_ART',  infoPagination.filter.tri_CODE_ART, 'Article' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col">{{ triTable('DES_SOMM',  infoPagination.filter.tri_DES_SOMM, 'Désignation article' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col">{{ 'Désignation complémentaire' | trad}}</th>
                    <th scope="col" width='6%' class="align-right">{{ triTable('QTE_DEM',  infoPagination.filter.tri_QTE_DEM, 'Quantité' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='6%'>{{ triTable('UNITE',  infoPagination.filter.tri_UNITE, 'Unité' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='10%' class="align-right">{{ triTable('PU',  infoPagination.filter.tri_PU, 'Prix unitaire' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='6%' class="align-right">{{ triTable('TX_REMISE',  infoPagination.filter.tri_TX_REMISE, 'Remise' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='10%' class="align-right">{{ triTable('BUDGET',  infoPagination.filter.tri_BUDGET, 'Budget' | trad, '', '', 'filtre_demandeAchat') }}</th>
                    <th scope="col" width='10%' class="align-center">{{ triTable('DTELIVSOU',  infoPagination.filter.tri_DTELIVSOU, 'Date Livraison' | trad, '', '', 'filtre_demandeAchat') }}</th>
                </tr>
            </thead>
            <tbody>
                {% for ligne in listeLigne  %}
                    <tr id="Ligne{{ loop.index }}">
                        <td class="toggleSlide" onclick="toggleSlide('{{ path('DemandeAchat.ArticleDemandeAchat.detailArticle', {idDA : ligne.NO_DA, idLigne : ligne.NO_PO}) }}' , 'Ligne{{ loop.index }}detail');">{{ ligne.NO_PO }}</td>
                        <td>{{ ligne.libelleAcd }} {% if ligne.ACD | trim %}({{ ligne.ACD }}) {% endif %}</td>
                        <td>{{ ligne.libelleFou }} {% if ligne.CODE_FOU | trim %}({{ ligne.CODE_FOU }}) {% endif %}</td>
                        <td>{% if param.DA_AFF_CODE_ART %}{{ ligne.CODE_ART }}{% endif %}</td>
                        <td>{{ ligne.DES_SOMM }}</td>
                        <td class="white-tooltip">{{ shortLibelle(ligne.DES_COMPL) }}</td>
                        <td class="montant">{{ ligne.QTE_DEM }}</td>
                        <td>{{ ligne.UNITE }}</td>
                        <td class="montant">{{ ligne.PU | prixUnitaire ~ ' ' ~ ligne.DEVISE }}</td>
                        <td class="montant">{{ ligne.TX_REMISE | tva }} %</td>
                        <td class="montant">{{ ligne.BUDGET | prix }}</td>
                        <td class="align-center">
                            {% if ligne.PLANNING > 1 %}
								<button type="button" class="principal button" 
									onclick="ajaxPopupV2('{{ path(
										'DemandeAchat.GestionDemandeAchat.popupPlanning',
										{da: numDA, line: ligne.NO_PO}
									) }}', 'test', '{{ 'Planning' | trad }}');"
								>{{ 'Voir planning' | trad }}</button>
							{% else %}
								{{ ligne.DTELIVSOU | dateTrad }}
							{% endif %}
                        </td>
                    </tr>
                    <tr id="Ligne{{ loop.index }}detail" class="detail_ligne hide_detail">
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}    
</form>
{% endblock %}