<!-- Modal -->
<div class="modal fade" id="roleGroupeModal" tabindex="-1" role="dialog" aria-labelledby="roleGroupeModalTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="roleGroupeModalLongTitle">{{ 'Choix du rôle'|trans }}</h5>
      </div>
      <div class="modal-body">
        <div class='row'>
          {% if app.user %}
            {% for group in app.user.possiblegroups %}
              {% for role in group.roles %}
                {% if role == 'ROLE_PRESTATAIRE' %}
                  {% for presta in app.user.prestataires %}
                    <div class='col-6 text-center p-2'>
                      <a role="button" class="btn btn-default btn-secondary" href='{{path('presta_choice', {'prestaid' : presta.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{presta}} </a>
                    </div>
                  {% endfor %}
                {% elseif role == 'ROLE_CAISSIER' %}
                  {% for presta in app.user.caissiers %}
                    <div class='col-6 text-center p-2'>
                      <a role="button" class="btn btn-default btn-secondary" href='{{path('presta_choice', {'prestaid' : presta.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{presta}} </a>
                    </div>
                  {% endfor %}
                {% elseif role == 'ROLE_COMPTOIR' %}
                  {% for comptoir in app.user.comptoirsgeres %}
                    <div class='col-6 text-center p-2'>
                      <a role="button" class="btn btn-default btn-secondary" href='{{path('comptoir_choice', {'cptid' : comptoir.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{comptoir}} </a>
                    </div>
                  {% endfor %}
                {% elseif role == 'ROLE_CONTACT' or role == 'ROLE_GESTION_GROUPE' %}
                  {% for groupe in app.user.groupesgeres %}
                    <div class='col-6 text-center p-2'>
                      <a role="button" class="btn btn-default btn-secondary" href='{{path('groupe_choice', {'grpid' : groupe.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{groupe}} </a>
                    </div>
                  {% endfor %}
                {% elseif role == 'ROLE_ADHERENT' or role == 'ROLE_ADMIN_SIEGE' or role == 'ROLE_REDACTEUR' or role == 'ROLE_CONTROLEUR' or role == 'ROLE_SUPER_ADMIN' %}
                  <div class='col-6 text-center p-2'>
                    <a role="button" class="btn btn-default btn-secondary" href='{{path('usergroup_choice', {'id': group.id})}}'>{{ group.name|trans }}</a>
                  </div>
                {% elseif role == 'ROLE_TRESORIER' %}
                  {# TRESORIER GLOBAL #}
                  {% if app.user.groupesgeres|length <= 0 %}
                    <div class='col-6 text-center p-2'>
                      <a role="button" class="btn btn-default btn-secondary" href='{{path('usergroup_choice', {'id': group.id})}}'>{{ group.name|trans }}</a>
                    </div>
                  {% else %}
                    {# TRESORIER DE GROUPE LOCAL #}
                    {% for groupe in app.user.groupesgeres %}
                      <div class='col-6 text-center p-2'>
                        <a role="button" class="btn btn-default btn-secondary" href='{{path('groupe_choice', {'grpid' : groupe.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{groupe}} </a>
                      </div>
                    {% endfor %}
                  {% endif %}
                {% endif %}
              {% endfor %}
            {% endfor %}
          {% endif %}
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'Annuler'|trans }}</button>
      </div>
    </div>
  </div>
</div>