{% block body %}
<td colspan="12">
    <h5>{{ 'Détail Entête' | trad }}</h5>
    <div class="colonne3">
        <div class="informations">
            <p>
                <span class="champs_label">{{ 'Chiffrage/Exécution' | trad }}</span>
                <span class="resultat">{{ typeChiffExec[detailDA.CHIF_EXEC] }}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'Centre de Livraison' | trad }}</span>
                <span class="resultat">
                    {%- if detailDA.CTR_LIV is not empty -%}
                        {{ detailDA.LIB_CTR_LIV }} ({{ detailDA.CTR_LIV }})
                    {%- endif -%}
                </span>
            </p>
            <p>
                <span class="champs_label">{{ 'Centre Emetteur' | trad }}</span>
                <span class="resultat">
                    {%- if detailDA.DAENT_CENTRE_EMETTEUR is not empty -%}
                        {{ detailDA.LIB_CTR_EMETT }} ({{ detailDA.DAENT_CENTRE_EMETTEUR }})
                    {%- endif -%}
                </span>
            </p>
            <p>
                <span class="champs_label">{{ 'Accord-cadre' | trad }}</span>
                <span class="resultat">{{ detailDA.LIBELLE_ACD }} {% if detailDA.ACD | trim %}({{ detailDA.ACD }}) {% endif %}</span>
            </p>
        </div>
    </div>
    <div class="colonne3">
        <div class="informations">
            <p>
                <span class="champs_label">{{ 'Section d\'imputation' | trad }}</span>
                <span class="resultat">{{ detailDA.SI_LABEL }} {% if detailDA.SECTIMP | trim %}({{ detailDA.SECTIMP }}) {% endif %}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'Code gestion' | trad }}</span>
                <span class="resultat">{{ detailDA.LIBGES }} {% if detailDA.CODGES | trim %}({{ detailDA.CODGES }}) {% endif %}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'Code complémentaire' | trad }}</span>
                <span class="resultat">{{ detailDA.CDC_LABEL }} {% if detailDA.CODECOMP | trim %}({{ detailDA.CODECOMP }}) {% endif %}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'Sous compte d\'analyse' | trad }}</span>
                <span class="resultat">{{ detailDA.SCA_LABEL }} {% if detailDA.SSCPTEANA | trim %}({{ detailDA.SSCPTEANA }}) {% endif %}</span>
            </p>
        </div>
    </div>
    <div class="colonne3 last">
        <div class="informations">                                					
            <p>
                <span class="champs_label">{{ 'Total TTC' | trad }}</span>
                <span class="resultat">{{ detailDA.TOTAL_DA_TTC | prix ~' '~ detailDA.DEVISE }}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'Type' | trad }}</span>
                <span class="resultat">{{ detailDA.TYP_DOC_LABEL}} {% if detailDA.TYP_DOC %}({{ detailDA.TYP_DOC }}){% endif %}</span>
            </p>
            <p>
                <span class="champs_label">{{ 'ZL DA' | trad }}</span>
                <span class="resultat">{{ detailDA.ZONELIB }}</span>
            </p>
            {% if droits.ACTIVATION_BPA and detailDA.SUIVI_BPA | boolSql %}
                <p>
                    <span class="champs_label">{{ 'Dossier complet' | trad }}</span>
                    <span class="resultat">{{ detailDA.DOSACHCOMPLET | boolTrad }}</span>
                </p>
                <p>
                    <span class="champs_label">{{ 'Commentaire du suivi achat' | trad }}</span>
                    <span class="resultat">{{ detailDA.LIB_DOSACHCOMPLET }}</span>
                </p>
            {% endif %}
        </div>
    </div>

	{% if CSExist('DA_ENTET') %}
	<div class="clearfix">
		{{ VisualisationCS('DA_ENTET', str_pad(detailDA.NO_DA, 9, 0, STR_PAD_LEFT)) }}
	</div>
	{% endif %}


    {% if listeLigneDemandeAchat %}
        <h5>{{ 'Lignes de la demande d\'achat' | trad }}</h5>
        <table class="table table-hover" id="tableauDa{{ detailDA.NO_DA }}">
            <thead>
                <tr>
                    <th width='110px'>{{ 'N° de ligne' | trad }}</th>
                    <th>{{ 'Article' | trad }}</th>
                    <th></th>
                    <th class="align-right">{{ 'Quantité' | trad }}</th>
                    <th class="align-left">{{ 'Unité' | trad }}</th>
                    <th class="align-right">{{ 'Prix Unitaire' | trad }}</th>
                    <th class="align-right">{{ 'Remise' | trad }}</th>
                    <th class="align-left">{{ 'Date Livraison' | trad }}</th>
                </tr>
            </thead>
            <tbody>
                {% for ligneDA in listeLigneDemandeAchat %}
                    <tr id="ligne_demandeAchat{{ ligneDA.NO_PO }}{{  detailDA.NO_DA }}">
                        <td class="align-right">{{ ligneDA.NO_PO }}</td>
                        <td {% if ligneDA.DESIGNCOMP | trim %}class="white-tooltip"{% endif %}>
                            <span class="infos_tooltip top-right">
                                {{ ligneDA.DESIGNCOMP }}
                            </span>
                            {{ ligneDA.DES_SOMM }} {% if (ligneDA.CODE_ART | trim and droits.DA_AFF_CODE_ART) %}({{ ligneDA.CODE_ART }}) {% endif %}
                        </td>
                        <td class="ss_detail" 
                            onclick="toggleSlide('{{ path('DemandeAchat.GestionDemandeAchat.detailLigne', {idDA:  detailDA.NO_DA, idLigne:ligneDA.NO_PO}) }}' , 'ligne_demandeAchat{{ ligneDA.NO_PO}}{{  detailDA.NO_DA }}detail', '','', 'tableauDa{{  detailDA.NO_DA }}');">
                        </td>
                        <td class="align-right">{{ qteByUnite(ligneDA.QTE_DEM, ligneDA.UNITE) }}</td>
                        <td class="align-left">{{ ligneDA.UNITE }}</td>
                        <td class="montant">{{ ligneDA.PU | prixUnitaire }} {{ detailDA.DEVISE }}</td>
                        <td class="montant">{{ ligneDA.TX_REMISE | tva }} {{ '%' }}</td>
                        <td>
							{% if ligneDA.PLANNING > 1 %}
								<button type="button" class="principal button" 
									onclick="ajaxPopupV2('{{ path(
										'DemandeAchat.GestionDemandeAchat.popupPlanning',
										{da: ligneDA.NO_DA, line: ligneDA.NO_PO}
									) }}', 'test', '{{ 'Planning' | trad }}');"
								>{{ 'Voir planning' | trad }}</button>
							{% else %}
								{{ ligneDA.DTELIVSOU | dateTrad }}
							{% endif %}
						</td>
                    </tr>                        				
                    <tr id="ligne_demandeAchat{{ ligneDA.NO_PO }}{{  detailDA.NO_DA }}detail" class="view-details hide_detail" >

                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}
    </td>
{% endblock %}