{% extends 'layout.twig' %}

{% block body %}
	<div class="contenu clearfix"  id="fournisseurs">
	<h1>
    	{{ 'Fournisseurs' | trad }}
    </h1>
    {{ ariane() }}
    
    <div id="detail_fournisseur" class="clearfix titre_div">
        <h2>
            {{ 'Fournisseur :' | trad }} {{ libelle_fournisseur??libelle }} ({{ code_fournisseur??id }})
            {% if listeAttestations | length %}
            	{{ ButtonExport(path('Fournisseur.AttestationsFournisseur.exportAttestations', {id:code_fournisseur }), 'filtre_attestations', path('Ajax.Erreur.popupInformation') , path('Ajax.Outil.appelAsync')) }}
        	{% endif %}
        	{{ Button('Ajouter une attestation' | trad , true,path('Fournisseur.CreationAttestationsFournisseur.CreationAttestations', {id: code_fournisseur}), '', '','','ajout') }}
        </h2>
        
            {{ arianeSub() }}
                <div id="attestations" class="tab-pane pad-15 fade in active clearfix">
					<form method="post" name="filtre_attestations" id="filtre_attestations">
						<table class="table table-hover">
                        	<thead class="thead-dark">
                            	<tr>
                                	<th scope="col" width="80px">{{ triTable('NOATTEST',  infoPagination.filter.tri_NOATTEST, 'N°', '', '', 'formulaireGeneral') }}</th>
                                    <th scope="col" >{{ triTable('COD_SOC',  infoPagination.filter.tri_COD_SOC, 'Société' | trad, '', '', 'formulaireGeneral') }}</th>
                                    <th scope="col">{{ triTable('NODECADM',  infoPagination.filter.tri_NODECADM, 'Décision Administrative' | trad, '', '', 'formulaireGeneral') }}</th>
                                    <th scope="col" width="110px">{{ triTable('DTEACHAT',  infoPagination.filter.tri_DTEACHAT, 'Date de création' | trad, '', '', 'formulaireGeneral') }}</th>
                                    <th scope="col" >{{ triTable('TYPE_OPE',  infoPagination.filter.tri_TYPE_OPE, 'Type d\'opération' | trad, '', '', 'formulaireGeneral') }}</th>
                                    <th scope="col" width="5%" class="align-center">{{ 'Actions' | trad }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="recherche">
                                	<td>{{ filterTable('CODE', infoPagination.filter.filter_CODE, '', 'attestations', '', 'filtre_attestations', '') }}</td>
                                	<td>{{ zoomFilter("SOCIETE", infoPagination.filter.filter_SOCIETE, "", "", path('Ajax.liste.societe'),'Societe', '', '','','','','Societe') }}</td>
                                	<td>{{ filterTable('DA', infoPagination.filter.filter_DA, '', 'attestations', '', 'filtre_attestations', '') }}</td>
                                	<td>{{ filterTable("DTE_CTE", infoPagination.filter.filter_date_DTE_CTE, "", "attestations", "", "filtre_attestations", "date") }}</td>
                                	<td>{{ filterSelect('TYPE_OPE', infoPagination.filter.filter_TYPE_OPE, listeTypeOpe) }}</td>
                                	<td></td>
                                </tr>
                                {% for attestation in listeAttestations %}
                                    <tr id="attestation{{ attestation.NOATTEST }}">
                                    	<td class="loupe">{{ attestation.NOATTEST }}</td>
                                    	<td>{{ attestation.RAIS_SOC }} ({{ attestation.COD_SOC }})</td>
                                    	<td>{{ attestation.NODECADM }}</td>
                                    	<td>{{ attestation.DTEACHAT |dateTrad }}</td>
                                    	<td>
                                    		{% if attestation.TYP_OPE == 'E' %}
                                    			Exportation
                                            {% elseif attestation.TYP_OPE == "I" %}
                                				Intracommunautaire          
                                			{% elseif attestation.TYP_OPE == "C" %}
                                				Comptoir de vente          
                                			{% elseif attestation.TYP_OPE == "D" %}
                                				Distance        
                                			{% elseif attestation.TYP_OPE == "M" %}
                                				Montage      
                            				{% endif %}
                                    	</td>
                                    	<td class="parametrage" >
                                            {{ menuContextuel('attestation' ~ attestation.NOATTEST, false, attestation.menuContextuel, 6) }}
                                        </td>
                                    </tr>
                                    <tr id="attestation{{ attestation.NOATTEST }}detail" class="detail_ligne hide_detail">
                                    	<td colspan="6">
                                    		<h3>{{ 'Détail attestation' | trad }}</h3>
                                    		<div class="colonne3">
                                    			<div class="informations">
                                    				<p>
                                    					<span class="champs_label">{{ 'N° de Commande' | trad }}</span>
                                    					<span class="resultat">{{ attestation.NO_CDE }}</span>
                                    				</p>
                                    				<p>
                                    					<span class="champs_label">{{ 'N° de Facture' | trad }}</span>
                                    					<span class="resultat">{{ attestation.NO_FACT }}</span>
                                    				</p>
                                    				<p>
                                    					<span class="champs_label">{{ 'Montant' | trad }}</span>
                                    					<span class="resultat">{{ attestation.MTDEVSTO }}</span>
                                    				</p>
                                    			</div>
                                    		</div>
                                    		<div class="colonne3">
                                    			<div class="informations">
                                    				<p>
                                    					<span class="champs_label">{{ 'Réf. commande' | trad }}</span>
                                    					<span class="resultat">{{ attestation.REF_CDE }}</span>
                                    				</p>
                                    				<p>
                                    					<span class="champs_label">{{ 'Réf. facture' | trad }}</span>
                                    					<span class="resultat">{{ attestation.REF_FFOU }}</span>
                                    				</p>
                                    				<p>
                                    					<span class="champs_label">{{ 'TVA' | trad }}</span>
                                    					<span class="resultat">{{ attestation.MT_TVAST |number_format(2, '.', ' ') }}</span>
                                    				</p>
                                    			</div>
                                    		</div>
                                    		<div class="colonne3 last">
                                    			<div class="informations">
                                    				<p>
                                    					<span class="champs_label">{{ 'Date attestation' | trad }}</span>
                                    					<span class="resultat">{{ attestation.DTE_ATT | dateTrad }}</span>
                                    				</p>
                                    			</div>
                                    		</div>
                                    		<div class="full">
                                    			<div class="informations">
                                    				<p>
                                    					<span class="champs_label">{{ 'Description' | trad }}</span>
                                    					<span class="resultat">{{ attestation.DESCRIPT }}</span>
                                    				</p>
                                    			</div>
                                    		</div>
                                    	</td>
                                    </tr>
                                {% endfor %}
                             </tbody>
                          </table>
                          {{ paginations(path('Fournisseur.AttestationsFournisseur.Attestations', {id : code_fournisseur}),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, '') }}
                      </form>
					</div>
				</div>
			</div>
{% endblock %}