{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix"  id="demandeAchats">
    
        <h1>
        	{{ 'Liste DA' | trad }}

        	{{ Button('Impression' | trad, false, '', '', '') }}
        	{# {{ Button('Impression', false, '', 'ajaxPopup(\''~path('Commande.GestionCommande.popupExport')~'\', \'Export commande\', \'\', \'\', \'\', \'modal_export \')', '') }} #}
    	</h1>
    	
    	{{ ariane() }}
    	
    	<div class="tab-content padding-Vert15">
    		<form method="post" name="filtre_demandeAchat" id="filtre_demandeAchat">
                                               
                <table class="table table-hover">
                  	<thead class="thead-dark">
                        <tr>
                            <th scope="col" width='4%'>{{ triTable('NO_DA',  infoPagination.filter.tri_NO_DA, 'Numéro' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col" width='4%'>{{ triTable('NO_PO',  infoPagination.filter.tri_NO_PO, 'Ligne' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col" width='13%'>{{ triTable('CODE_FOU',  infoPagination.filter.tri_CODE_FOU, 'Fournisseur' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col" width='13%'>{{ triTable('CODE_ART',  infoPagination.filter.CODE_ART, 'Article' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col">{{ triTable('DES_SOMM',  infoPagination.filter.DES_SOMM, 'Désignation' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col" width='7%'>{{ triTable('QTE_COMM',  infoPagination.filter.tri_QTE_COMM, 'Quantité' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th scope="col" width='4%'>{{ triTable('UNITE',  infoPagination.filter.tri_UNITE, 'Unité' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th class="align-right" scope="col" width='10%'>{{ triTable('PU',  infoPagination.filter.tri_PU, 'PU' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th class="align-right" scope="col" width='5%'>{{ triTable('TX_REMISE',  infoPagination.filter.tri_TX_REMISE, 'Remise' | trad, '', '', 'filtre_demandeAchat') }}</th>
                            <th class="align-center" scope="col" width='10%'>{{ triTable('DTELIVSOU',  infoPagination.filter.tri_DTELIVSOU, 'Délais' | trad, '', '', 'filtre_demandeAchat') }}</th>
							{% if typeListe == 'acommander' %}
							<th scope="col" width='13%'>{{ triTable('ACHETEUR',  infoPagination.filter.tri_ACHETEUR, 'Affectée à' | trad, '', '', 'filtre_demandeAchat') }}</th>
							{% else %}								
							<th scope="col" width='5%'>{{ triTable('TRAITEE',  infoPagination.filter.tri_TRAITEE, 'Traitée ?' | trad, '', '', 'filtre_demandeAchat') }}</th>
							{% endif %}
							<th scope="col" width="40px">{{ 'Actions' | trad }}</th>
                        </tr>
                  	</thead>
                    <tbody>
                        <tr class="recherche">
                        	<td>{{ filterTable('NO_DA', infoPagination.filter.filter_NO_DA, '', '', '', 'filtre_demandeAchat', '', '') }}</td>
                        	<td>{{ filterTable('NO_PO', infoPagination.filter.filter_NO_PO, '', '', '', 'filtre_demandeAchat', '', '') }}</td>
                        	<td>{{ filterTable('CODE_FOU', infoPagination.filter.filter_CODE_FOU, '', '', '', 'filtre_demandeAchat', '', '') }}</td>
                        	<td>{{ filterTable('CODE_ART', infoPagination.filter['filter_CODE_ART'], '', 'filtre_demandeAchat', '', '') }}</td>
                        	<td>{{ filterTable('DES_SOMM', infoPagination.filter['filter_DES_SOMM'], '', 'filtre_demandeAchat', '', '') }}</td>
                        	<td>{{ filterTable('QTE_COMM', infoPagination.filter.filter_QTE_COMM, '', '', '','filtre_demandeAchat') }}</td>
                        	<td>{{ filterTable('UNITE', infoPagination.filter.filter_UNITE, '', '', '','filtre_demandeAchat') }}</td>
                        	<td>{{ filterTable('PU', infoPagination.filter.filter_PU, '', '', '', 'filtre_demandeAchat', '','') }}</td>
                        	<td>{{ filterTable('TX_REMISE', infoPagination.filter.filter_TX_REMISE, '', '', '', 'filtre_demandeAchat', '','') }}</td>
                        	<td>{{ filterTable('DTELIVSOU', infoPagination.filter.filter_date_DTELIVSOU, '', '', '', 'filtre_demandeAchat', 'date','') }}</td>
							{% if typeListe == 'acommander' %}
							<td>{{ zoomFilter('ACHETEUR', infoPagination.filter['filter_ACHETEUR'], '', 'filtre_demandeAchat', path('Ajax.liste.acheteur'),'Liste des acheteurs' | trad, '','','','','','Hastutil') }}</td>
							{% else %}
							<td>{{ filterSelect('TRAITEE', infoPagination.filter.filter_TRAITEE, listeTRAITEE, 'filtre_commande', '','') }}</td>
							{% endif %}
                        	<td></td>
                        </tr>
					{% for ligneDA in listeLigneDA %}
                    	<tr id="demandeAchat{{ loop.index }}">
                    		<td>{{ ligneDA.NO_DA  }}</td>
							<td class="toggleSlide" onclick="toggleSlide('{{ path('DemandeAchat.Liste.detailListeLigne', {idDA : ligneDA.NO_DA, noPO : ligneDA.NO_PO}) }}' , 'demandeAchat{{ loop.index }}detail');">{{ ligneDA.NO_PO }}</td>
                    		<td>{{ ligneDA.RS }} {% if ligneDA.CODE_FOU | trim %}({{ ligneDA.CODE_FOU }}){% endif %}</td>
                    		<td>{{ ligneDA.CODE_ART }}</td>
                    		<td>{{ ligneDA.DES_SOMM }}</td>
                    		<td class="montant">{{ ligneDA.QTE_DEM }}</td>
                    		<td>{{ ligneDA.UNITE }}</td>
                    		<td class="align-right">{{ ligneDA.PU }}</td>
                    		<td class="align-right">{{ ligneDA.TX_REMISE }} %</td>
                    		<td class="align-center">{{ ligneDA.DTELIVSOU | dateTrad }}</td>
							{% if typeListe == 'acommander' %}
							<td>{{ ligneDA.NOMACHETEUR }} {% if ligneDA.ACHETEUR | trim %}({{ ligneDA.ACHETEUR }}){% endif %}</td>
							{% else %}								
							<td>{{ ligneDA.TRAITEE | boolTrad }}</td>
							{% endif %}
							<td class="parametrage">
								<span class="parametre ferme"></span>
								<ul {% if loop.index <6 %}class="ss_parametres"{% else %}class="ss_parametres"{% endif %}>
									{{ liAl (path('DemandeAchat.ArticleDemandeAchat.article', {'idDA' : ligneDA.NO_DA, 'MODULE' : 'ListeDA' }), '', 'visualiser', 'Visualiser' | trad ) }}
									{{ liAl ('', '', 'imprimer', 'Imprimer' | trad ) }}
								</ul>
							</td>
                    	</tr>
                    	<tr id="demandeAchat{{ loop.index }}detail" class="detail_ligne hide_detail">							
                    	</tr>
                    {% endfor %}
                    </tbody>
                </table>
				
				{{ paginations(path('DemandeAchat.Liste.listeLigne', {'typeListe': typeListe}),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, '') }} 
				
    		</form>
        </div>
    </div>

{% endblock %}