{% extends 'layout.twig' %}

{% block body %}
    <div class="contenu clearfix"  id="signature">
    
        <h1>
        	{{ titre }}
    	</h1>
    	
    	{{ ariane() }}
    	
    	<div class="tab-content padding-Vert15">
    		<form method="post" name=""filtre_delegation"" id="filtre_delegation">                 
                <table class="table table-hover">
                  	<thead class="thead-dark">
                        <tr>
							<th scope="col" width="10%">{{ 'Type délégation' | trad }}</th>
                            <th scope="col">{{ triTable('SIGNAT',  infoPagination.filter.tri_SIGNAT, 'Signataire' | trad, '', '', '"filtre_delegation"') }}</th>
                            <th scope="col" width="9%">{{ triTable('',  infoPagination.filter.tri_, 'Date délégation' | trad, '', '', '"filtre_delegation"') }}</th>
							{% if module == 'all' %}
								<th scope="col" width="130px" style="text-align: center;">{{ 'Commande' | trad }}</th>
								<th scope="col" width="130px" style="text-align: center;">{{ 'Demande d\'achat' | trad }}</th>
								<th scope="col" width="130px" style="text-align: center;">{{ 'Facture' | trad }}</th>
							{% else %}
								<th scope="col" width="8%">{{ triTable('',  infoPagination.filter.tri_, 'Nombre' | trad, '', '', '"filtre_delegation"') }}</th>                            
								<th scope="col" width="175px">{{ 'Actions' | trad }}</th>
							{% endif %}
                        </tr> 
                  	</thead>
                    <tbody>
                        <tr class="recherche">
                        	<td>{{ filterTable('TYPEDEL', infoPagination.filter.filter_TYPEDEL, '', '', '', '"filtre_delegation"', '', '') }}</td>
                        	<td>{{ zoomFilter('SIGNAT', infoPagination.filter['filter_SIGNAT'], '', '"filtre_delegation"', path('Ajax.liste.demandeur'),'Liste des demandeurs' | trad, '','','','','','Hastutil') }}</td>
                        	<td>{{ filterTable('DTE_DEB', infoPagination.filter.filter_DTE_DEB, '', '', '', '"filtre_delegation"', 'date', '') }}</td>
                        	{% if module == 'all' %}
								<td></td>
								<td></td>
								<td></td>
							{% else %}
								<td></td>
								<td></td>
							{% endif %}
                        </tr>
                    {% for delegation in listeDelegation %}
                    	<tr id="demandeAchat{{ loop.index }}">
                    		<td>{{ delegation.TYPEDEL}}</td>
                    		<td>{{ delegation.NOM }} {% if delegation.SIGNAT | trim %}({{ delegation.SIGNAT }}){% endif %}</td>
                    		<td>{{ delegation.DTE_DEB| dateTrad }}</td>
							{% if module == 'all' %}
								<td>
									<a class="redirectSign" href="{{ path('Signature.SignatureCde.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ delegation.nbSignCde }}</a>
								</td>
								<td>
									<a class="redirectSign" href="{{ path('Signature.SignatureDa.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ delegation.nbSignDa }}</a>
								</td>
								<td>
									<a class="redirectSign" href="{{ path('Signature.SignatureBap.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ delegation.nbSignFac }}</a>
								</td>
							{% elseif module == 'Fournisseur' %}
								<td>{{ delegation.nbSign }}</td>
								<td>
									<a style="cursor:pointer;" class="button principal " href="{{ path('GlobalApplication.Delegation.delegationFournisseur', {'type': 'Delegation', 'SIGNAT' : delegation.SIGNAT, 'DELEG' : delegation.DELEG}) }}">{{ 'Voir les fournisseurs' | trad }}</a>
								</td>
							{% else %}
								<td>{{ delegation.nbSign }}</td>
								<td>
									{%  if module=='Commande' and delegation.nbSign %}
										<a style="cursor:pointer;" class="button principal " href="{{ path('Signature.SignatureCde.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ 'voir les commandes' | trad }}</a>
									{%  elseif module=='demandeAchat' and delegation.nbSign %}
										<a style="cursor:pointer;" class="button principal " href="{{ path('Signature.SignatureDa.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ 'voir les demandes d\'achat' | trad }}</a>
									{%  elseif module=='facture' and delegation.nbSign %}
										<a style="cursor:pointer;" class="button principal " href="{{ path('Signature.SignatureBap.listeDoc', {signataire: delegation.SIGNAT}) }}">{{ 'voir les factures' | trad }}</a>
									{% elseif module=='Fournisseur' and delegation.nbSign %}
										<a style="cursor:pointer;" class="button principal " href="{{ path('GlobalApplication.Delegation.delegationFournisseur', {'type': 'Delegation', 'SIGNAT' : delegation.SIGNAT, 'DELEG' : delegation.DELEG}) }}">{{ 'Voir les fournisseurs' | trad }}</a>
									{% endif %}
								</td>
							{% endif %}
                    	</tr>
                    {% endfor %}
                    </tbody>
                </table>
				
				{{ paginations('',infoPagination.nombreDePage, infoPagination.page, infoPagination.post, '') }}
    		</form>
        </div>
    </div>

	<style>
		.redirectSign {
			background-color: var(--main-color-opac25);
			border: 1px solid var(--main-color-opac25);
			-moz-box-align: center;
			align-items: center;
			border: 1px solid var(--main-color-grey2);
			border-radius: 100px;
			-moz-box-sizing: border-box;
			box-sizing: border-box;
			color: var(--main-color-full);
			display: -moz-box;
			display: flex;
			height: 30px;
			line-height: 40px;
			margin: 5px 6px 0 0;
			padding: 0 14px 0 14px;
			justify-content: center;
		}
	</style>

{% endblock %}