{% block body %}
	{% if droits.HA_MQUESCM %}
		<div class="clearfix">
			<a class="button white-tooltip principal" style="margin: 15px !important;float:right;" href="{{ path('Evaluation.Association.new', {mode: mode, id: id}) }}">{{ 'Ajouter' | trad }}</a>
		</div>
	{% endif %}
	<div id="divRefresh" class="clearfix" style="display:flex;flex-flow: wrap;">
		{% set count = 0 %}
		{% for key, association in associations %}
			{% if associations[key - 1].TYPE_OBJ !=  association.TYPE_OBJ  %}
				{% set count = count + 1 %}
				<div class="clearfix" style="width:49%;{% if count is even %} margin-left:2%;{% endif %}">
					<h4>{{ association.TYPE_LABEL }}</h4>
					<table class="table table-hover">
						<thead class="thead-dark">
							<th scope="col" width="25%">{{ 'Code' | trad }}</th>
							<th scope="col">{{ 'Libellé' | trad }}</th>
							{% if association.CODE_STE %}
								<th>{{ 'Société' | trad }}</th>
							{% endif %}
							<th scope="col">
								{% if droits.HA_MQUESCM %}
									{% if association.CODE_STE %}
										<a class="ajouter_blanc_v2  white-tooltip" style="float:right;font-weight:normal;" href="{{ path('Evaluation.Association.new', {mode: mode, id: id, type: association.TYPE_OBJ, company: association.CODE_STE }) }}">
											<span class="infos_tooltip left">
												{{ 'Ajouter un élément d\'association' | trad }}
											</span>
										</a>
									{% else %}
									<a class="ajouter_blanc_v2  white-tooltip" style="float:right;font-weight:normal;" 
                                        href="{{ path('Evaluation.Association.new', {mode: mode, id: id, type: association.TYPE_OBJ }) }}">
										<span class="infos_tooltip left">
											{{ 'Ajouter un élément d\'association' | trad }}
										</span>
									</a>
									{% endif %}
								{% endif %}
							</th>
						</thead>
						<tbody>
			{% endif %}
							<tr id="association{{ loop.index }}">
								<td>{{ association.VAL_OBJ }}</td>
								<td>{{ association.VAL_LABEL }}</td>
								{% if association.CODE_STE %}
									<td>{{ association.RAIS_SOC ~ '(' ~ association.CODE_STE ~ ')' }}</td>
								{% endif %}
								<td>
									{% if droits.HA_MQUESCM %}
                                        {{ hover_action('association'~ loop.index, 'menu_contextuel_v2' , 'roueDenteActive(this);', 'float: right;') }}
                                        <ul class="ss_parametres">
											{% if association.CODE_STE %}
                                            <li><a class="edit" href="{{ path('Evaluation.Association.edit', {mode: mode, id: id, type: association.TYPE_OBJ, value: association.VAL_OBJ, company: association.CODE_STE }) }}">{{ 'Modifier' | trad }}</a></li>
                                            <li><a class="delete" onClick="popupConfirmation('{{ path('Ajax.Erreur.popupConfirmationGestion') }}', 'reload', '{{ path('Evaluation.Association.delete', {mode: mode, id: id, type: association.TYPE_OBJ, value: association.VAL_OBJ, company: association.CODE_STE }) }}', '{{ strBuild(deleteMessage | trad, [association.VAL_LABEL]) |e('js') |raw }}', 'divRefresh', '', '', '', '', '', '', '', '', '', '{{ 'Suppression filtre' | trad }}')">{{ 'Supprimer' | trad }}</a></li>
											{% else %}
                                            <li><a class="edit" href="{{ path('Evaluation.Association.edit', {mode: mode, id: id, type: association.TYPE_OBJ, value: association.VAL_OBJ }) }}">{{ 'Modifier' | trad }}</a></li>
                                            <li><a class="delete" onClick="popupConfirmation('{{ path('Ajax.Erreur.popupConfirmationGestion') }}', 'reload', '{{ path('Evaluation.Association.delete', {mode: mode, id: id, type: association.TYPE_OBJ, value: association.VAL_OBJ }) }}', '{{ strBuild(deleteMessage | trad, [association.VAL_LABEL]) |e('js') |raw }}', 'divRefresh', '', '', '', '', '', '', '', '', '', '{{ 'Suppression filtre' | trad }}')">{{ 'Supprimer' | trad }}</a></li>
											{% endif %}
                                        </ul>
									{% endif %}
								</td>
							</tr>
			{% if associations[key + 1].TYPE_OBJ !=  association.TYPE_OBJ  %}
						</tbody>
					</table>
				</div>
			{% endif %}
		{% endfor %}
	</div>

{% endblock %}
