{% extends '@ajax-layout/layout.twig' %}

{% block body %}
<div id="genetableau">
	<center>
	<div>
		<form method="POST" id='formulaireListeDA'>
			<input type="hidden" name="divCode" value="{{ post.divCode }}" />
			<input type="hidden" name="divLibelle" value="{{ post.divLibelle }}" />	
			<input type="hidden" name="filter_egal_CODE_STE" value="{{ post.filter_egal_CODE_STE }}" />	
			<input type="hidden" name="codeIsNoPo" value="{{ post.codeIsNoPo }}"/>
					
    			<table class="table" id="tableau">
    				<thead class="thead-dark">
        				<tr>
        					<th>{{ triTable('NO_DA',  infoPagination.filter.tri_NO_DA, 'DA' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					{% if ligne %}
            					<th>{{ triTable('NO_PO',  infoPagination.filter.tri_NO_PO, 'Ligne' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					{% endif %}
        					<th>{{ triTable('NO_DEM',  infoPagination.filter.tri_NO_DEM, 'Demandeur' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ triTable('FOU',  infoPagination.filter.tri_FOU, 'Fournisseur' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ triTable('CTR_LIV',  infoPagination.filter.tri_CTR_LIV, 'Ctr. livraison' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ triTable('DTE_VAL',  infoPagination.filter.tri_DTE_VAL, 'Date' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ triTable('TOTAL_DA',  infoPagination.filter.tri_TOTAL_DA, 'Total HT' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ triTable('TOTAL_DA_TTC',  infoPagination.filter.tri_TOTAL_DA_TTC, 'Total TTC' | trad, 'genetableau', path(path), 'formulaireListeDA') }}</th>
        				</tr>
        			</thead>
        			<tbody>
        				<tr>
        					<th>{{ filterTable('NO_DA', infoPagination.filter.filter_NO_DA, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					{% if ligne %}
            					<th>{{ filterTable('NO_PO', infoPagination.filter.filter_NO_PO, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					{% endif %}
        					<th>{{ filterTable('NO_DEM', infoPagination.filter.filter_NO_DEM, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ filterTable('FOU', infoPagination.filter.filter_FOU, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ filterTable('CTR_LIV', infoPagination.filter.filter_CTR_LIV, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ filterTable('DTE_VAL', infoPagination.filter.filter_DTE_VAL, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ filterTable('TOTAL_DA', infoPagination.filter.filter_TOTAL_DA, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        					<th>{{ filterTable('TOTAL_DA_TTC', infoPagination.filter.filter_TOTAL_DA_TTC, '', 'genetableau', path(path), 'formulaireListeDA') }}</th>
        				</tr>
        				{% for DA in entity %}
        				
        				{% if ligne %}
        					{% if post.codeIsNoPo %}
        						<tr onclick='changeCodeLibelle("{{ post.divCode }}","{{ DA.NO_PO }}", "{{ post.divLibelle }}", "{{ DA.NO_DA | convert_encoding('UTF-8', 'ISO-8859-1') }}");desactivePopup ()'>
        					{% else %}
            					<tr onclick='changeCodeLibelle("{{ post.divCode }}","{{ DA.NO_DA }}", "{{ post.divLibelle }}", "{{ DA.NO_PO | convert_encoding('UTF-8', 'ISO-8859-1') }}");desactivePopup ()'>
        					{% endif %}
    					{% else %}
            				<tr onclick='changeCodeLibelle("{{ post.divCode }}","{{ DA.NO_DA }}", "{{ post.divLibelle }}", "{{ DA.NO_DA~' ('~DA.NO_DA~')'  | convert_encoding('UTF-8', 'ISO-8859-1') }}");desactivePopup ()'>
        				{% endif %}
        					<td>{{ DA.NO_DA   | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
        					{% if ligne %}
            					<td>{{ DA.NO_PO   | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
        					{% endif %}
        					<td>{{ DA.NO_DEM  | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
        					<td>{{ DA.FOU  | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
        					<td>{{ DA.CTR_LIV  | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
        					<td>{{ DA.DTE_VAL  | dateTrad }}</td>
        					<td>{{ DA.TOTAL_DA  | prix }}</td>
        					<td>{{ DA.TOTAL_DA_TTC  | prix }}</td>
        				</tr>
        				{% endfor %}
        			</tbody>
    			</table>
			
		</form>
		
	</div>
	{{ paginations(path(path),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, 'modal-body') }}

	</center>
	</div>
{% endblock %}