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

{% block body %}
<div id="genetableau">
	<center>
	<div>
		<form method="POST" id='formulaireListeSociete'>
			<input type="hidden" name="divCode" value="{{ post.divCode }}" />
			<input type="hidden" name="divLibelle" value="{{ post.divLibelle }}" />
			<table class="table" id="tableau">
				<thead class="thead-dark">
					<tr>
						<th>{{ triTable('CODE_STE',  infoPagination.filter.tri_CODE_STE, 'Code' | trad, 'genetableau', path('Ajax.liste.societe'), 'formulaireListeSociete') }}</th>
						<th>{{ triTable('RAIS_SOC',  infoPagination.filter.tri_RAIS_SOC, 'Raison Sociale' | trad,'genetableau', path('Ajax.liste.societe'), 'formulaireListeSociete') }}</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<th>{{ filterTable('CODE_STE', infoPagination.filter.filter_CODE_STE, '', 'genetableau', path('Ajax.liste.societe'), 'formulaireListeSociete') }}</th>
						<th>{{ filterTable('RAIS_SOC', infoPagination.filter.filter_RAIS_SOC, '', 'genetableau', path('Ajax.liste.societe'), 'formulaireListeSociete') }}</th>
					</tr>
					{% for societe in societes %}
					
					<tr onclick="{{ attrJs('changeCodeLibelleSoc', [
						post.divCode,
						societe.CODE_STE, 
						post.divLibelle,
						societe.RAIS_SOC~' ('~societe.CODE_STE~')',
						societe.ca_modenum is defined ? 
							{ca_modenum: societe.ca_modenum} : {}
					]) }}">
						<td id ="{{societe.CODE_STE}}">{{ societe.CODE_STE   | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
						<td>{{ societe.RAIS_SOC  | convert_encoding('UTF-8', 'ISO-8859-1') }}
					
						</td>
	
					</tr>
				{% endfor %}
				</tbody>
			</table>
			
		</form>
		
	{{ paginations(path('Ajax.liste.societe'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, 'modal-body') }}
	</div>
	</center>
<script>
function changeCodeLibelleSoc(inputId, codeValue, divLibelle, libelleValue, mapAttr)
{
	let target = document.getElementById(inputId);
	for(k in mapAttr) {
		target.setAttribute('data-'+k, mapAttr[ k ]);
	}
	
	changeCodeLibelle(inputId, codeValue, divLibelle, libelleValue);
	desactivePopup();
}
</script>
</div>

{% endblock %}