{# UNIQUEMENT POUR LES TESTS => fixture de dev #}
{% if app.environment == 'dev' and isDevFixture() and (is_granted('ROLE_ADMIN') or is_granted('ROLE_PREVIOUS_ADMIN')) %}
	{% set routeName = routeName|default('index') %}
	{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
		<div class='w-100 text-center mb-2'>
			<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=_exit'>
				{{ 'RETOUR SUPER ADMIN'|trans }}
			</a>
		</div>
	{% elseif app.user and is_granted('ROLE_SUPER_ADMIN') %}
		<div class='mb-2 group text-center'>
			{% if isDevFixture('user_prestataire') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path('index', [], true)}}?_switch_user=user_prestataire'>
					{{ 'PRESTATAIRE'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_adherent') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path('index', [], true)}}?_switch_user=user_adherent'>
					{{ 'ADHERENT'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_adminsiege') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_adminsiege'>
					{{ 'ADMIN SIEGE'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_comptoir') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_comptoir'>
					{{ 'COMPTOIR'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_gestiongroupe') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_gestiongroupe'>
					{{ 'GESTION GROUPE'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_contact') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_contact'>
					{{ 'CONTACT'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_tresorier') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_tresorier'>
					{{ 'TRESORIER'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_controleur') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_controleur'>
					{{ 'CONTROLEUR'|trans }}
				</a>
			{% endif %}
			{% if isDevFixture('user_redacteur') %}
				<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_redacteur'>
					{{ 'REDACTEUR'|trans }}
				</a>
			{% endif %}
		</div>
	{% endif %}
{% endif %}

{# ACTIONS PRINCIPALES POUR CHAQUE UTILISATEUR CONNECTE #}
<div id="accordion">
	{% if not app.request.session.has('_choixGroup') %}
		{% if app.user and is_granted('ROLE_ADMIN_SIEGE') %}

			{% set siege = getSiege() %}
			{% set compte = siege.getCompte() %}
			{% set compteNanti = siege.getCompteNantie() %}
			{% set ecompteNanti = siege.getECompte() %}
			{% set soldelabel = 'Billets au siège'|trans %}
			{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti, 'soldelabel': 'Billets nantis'} %}
			{% include 'block/solde.html.twig' with {'compte': ecompteNanti, 'soldelabel': 'Monnaie numérique distribuée'} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti + ecompteNanti, 'soldelabel': 'Monnaie nantie'} %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}
			{% include 'siege/block/solde_edit.html.twig' %}
			{% include 'siege/block/transfert_siegegroupe.html.twig' %}
			{% include 'siege/block/transfert_groupesiege.html.twig' %}

		{% elseif app.user and is_granted('ROLE_REDACTEUR') %}

			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}

		{% elseif app.user and is_granted('ROLE_TRESORIER') %}

			{% set siege = getSiege() %}
			{% set compte = siege.getCompte() %}
			{% set compteNanti = siege.getCompteNantie() %}
			{% set ecompteNanti = siege.getECompte() %}
			{% set soldelabel = 'Billets au siège'|trans %}
			{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti, 'soldelabel': 'Billets nantis'} %}
			{% include 'block/solde.html.twig' with {'compte': ecompteNanti, 'soldelabel': 'Monnaie numérique distribuée'} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti + ecompteNanti, 'soldelabel': 'Monnaie nantie'} %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}
			{# {% include 'block/soldegroupes.html.twig' %} #}

		{% elseif app.user and is_granted('ROLE_CONTROLEUR') %}

			{% set siege = getSiege() %}
			{% set compte = siege.getCompte() %}
			{% set compteNanti = siege.getCompteNantie() %}
			{% set ecompteNanti = siege.getECompte() %}
			{% set soldelabel = 'Billets au siège'|trans %}
			{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti, 'soldelabel': 'Billets nantis'} %}
			{% include 'block/solde.html.twig' with {'compte': ecompteNanti, 'soldelabel': 'Monnaie numérique distribuée'} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti + ecompteNanti, 'soldelabel': 'Monnaie nantie'} %}
			{% include 'block/userinfos.html.twig' %}

		{% elseif app.user and is_granted('ROLE_GESTION_GROUPE') %}

			{% if getCurrentGroupe() != null %}
				{% set compte = getCurrentGroupe().compte %}
				{% set soldelabel = 'Solde du groupe'|trans %}
				{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% endif %}
			{% include 'groupe/block/infos.html.twig' %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}
			{% include 'block/transactions.html.twig' %}
			{% include 'groupe/block/transaction_comptoir.html.twig' %}
			{% include 'groupe/block/retourgroupe.html.twig' %}

		{% elseif app.user and is_granted('ROLE_COMPTOIR') %}

			{% if getCurrentComptoir() != null %}
				{% set compte = getCurrentComptoir().compte %}
				{% set soldelabel = 'Solde du comptoir "'|trans ~ getCurrentComptoir() ~ '"' %}
				{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% endif %}
			{% include 'comptoir/block/infos.html.twig' %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}
			{% include 'block/transactions.html.twig' %}
			{% include 'comptoir/block/vente_adherent.html.twig' %}
			{% include 'comptoir/block/vente_prestataire.html.twig' %}
			{% include 'comptoir/block/retrait_prestataire.html.twig' %}
			{% include 'comptoir/block/retrait_adherent.html.twig' %}
			{% include 'comptoir/block/reconversion.html.twig' %}

		{% elseif app.user and is_granted('ROLE_CONTACT') %}

			{% include 'groupe/block/infos.html.twig' %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}

		{% elseif app.user and is_granted('ROLE_SUPER_ADMIN') %}

			{% set siege = getSiege() %}
			{% set compte = siege.getCompte() %}
			{% set compteNanti = siege.getCompteNantie() %}
			{% set ecompteNanti = siege.getECompte() %}
			{% set soldelabel = 'Billets au siège'|trans %}
			{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti, 'soldelabel': 'Billets nantis'} %}
			{% include 'block/solde.html.twig' with {'compte': ecompteNanti, 'soldelabel': 'Monnaie numérique distribuée'} %}
			{% include 'block/solde.html.twig' with {'compte': compteNanti + ecompteNanti, 'soldelabel': 'Monnaie nantie'} %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}

		{% elseif app.user and is_granted('ROLE_PRESTATAIRE') and getCurrentPrestataire() != null %}

			{% set esoldelabel = 'Solde e-mlc'|trans %}
			{% include 'block/solde.html.twig' with {'compte': getCurrentPrestataire().ecompte, 'soldelabel': esoldelabel} %}
			{% if getCurrentPrestataire().mlc == false %}
				{% include 'presta/block/infos.html.twig' %}
			{% endif %}
			{% include 'block/userinfos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}
			{% include 'block/transactions.html.twig' %}
			{% if getCurrentPrestataire().mlc == false %}
				{% include 'block/cotisations.html.twig' %}
				{% include 'groupepresta/block/inscription.html.twig' %}
			{% endif %}
			{% if isPayzenEnabled() %}
				{% include 'presta/block/achat_monnaie.html.twig' %}
			{% endif %}
			{% include 'presta/block/transaction_presta.html.twig' %}
			{% include 'presta/block/transaction_adherent.html.twig' %}
			{% if getCurrentPrestataire().mlc == false and getCurrentPrestataire().ecompte > 0 %}
				{% include 'presta/block/reconversion.html.twig' %}
			{% endif %}

		{% elseif app.user and is_granted('ROLE_ADHERENT') and app.user.adherent %}

			{% set esoldelabel = 'Solde e-mlc'|trans %}
			{% include 'block/solde.html.twig' with {'compte': app.user.adherent.ecompte, 'soldelabel': esoldelabel} %}
			{% if isPayzenEnabled() %}
				{% include 'adherent/block/achat_monnaie.html.twig' %}
			{% endif %}
			{% include 'adherent/block/transaction_presta.html.twig' %}
			{% include 'adherent/block/transaction_adherent.html.twig' %}
			{% include 'block/transactions.html.twig' %}
			{% include 'block/cotisations.html.twig' %}
			{% include 'adherent/block/infos.html.twig' %}
			{% include 'block/userpassword.html.twig' %}

		{% else %}
			{% if KOH_USE_WORDPRESS is defined and KOH_USE_WORDPRESS == 'false' %}
				{% include 'presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%}
			{% endif %}
		{% endif %}
	{% endif %}
</div>
