{% block body %}
    <form method="post" name="form_oxaproc" id="form_oxaproc" class="bs-row py-base form-default gutter-x-base">
        {% include '@Evaluation/Campaign/Tabs/Raters/_common_navbar.twig' with {
            associationsTab: 'actif',
        } %}
        <div class="bs-col clearfix" id="divParam">
            {% if droits.HA_CEVALCM and campaign.STATUT == 'P' %}
                <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 class="divParam clearfix bg_form padding15 mb-base" id="URL">
                <div class="single">
                    <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_CEVALCM and campaign.STATUT == 'P' %}
                                                    <a class="ajouter_blanc_v2  white-tooltip" style="float: right;" 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 %}
                                            </th>
                                        </thead>
                                        <tbody>
                            {% endif %}
                                            {% if association.VAL_OBJ != '' %}
                                                <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 class="parametrage">
                                                        {% if droits.HA_CEVALCM %}
                                                            {{ menuContextuel('association' ~ loop.index, false, association.menuContextuel, 6) }}
                                                        {% endif %}
                                                    </td>
                                                </tr>
                                            {% elseif association.VAL_OBJ == '' %}
                                                <tr>
                                                    <td colspan="4">
                                                        {{ 'Une question est liée à cet élément d\'association, pensez à ajouter au moins une valeur !' | trad }}
                                                    </td>
                                                </tr>
                                            {% endif %}
                            {% if associations[key + 1].TYPE_OBJ !=  association.TYPE_OBJ  %}
                                        </tbody>
                                    </table>
                                </div>
                            {% endif %}
                        {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    </form>


{% endblock %}
