{% include '@kohinos/block/demo_shortcut.html.twig' %}

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

		{# 
		// @TODO : Ajouter des raccourcis en fonction des droits de l'utilisateur : 
			- ajout d'un adhérent (avec reception de la cotisation en comptoir par exemple)
			- ajout d'un prestataire (avec reception de la cotisation en comptoir par exemple)
		{% if app.user and is_granted('ROLE_ADMIN_ADHERENT_GERER_CREATE') %}
			<a href='{{ path('adherent_create') }}' class='btn btn-secondary'>Créer un nouvel adhérent</a>
		{% endif %} #}

		{% if app.user and is_granted('ROLE_ADMIN_SIEGE') %}

			{% include '@kohinos/block/admin_siege.html.twig' %}

		{# Rien à ajouter pour un rédacteur #}
		{# {% elseif app.user and is_granted('ROLE_REDACTEUR') %} #}

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

			{% include '@kohinos/block/soldes_siege.html.twig' %}
			{# {% include '@kohinos/block/soldegroupes.html.twig' %} #}

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

			{% include '@kohinos/block/admin_groupe.html.twig' %}
			
		{% elseif app.user and is_granted('ROLE_COMPTOIR') %}

			{% include '@kohinos/block/admin_comptoir.html.twig' %}
			{% if tav_env %}
				<a href='{{ path('adherent_create') }}' rel="noopener noreferrer" class='ml-2 text-center'><i class="fa fa-plus mr-2" aria-hidden="true"></i> Inscrire/modifier un habitant</a><br/><br/>
			{% endif %}

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

			{% include '@kohinos/groupe/block/infos.html.twig' %}

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

			{% include '@kohinos/block/soldes_siege.html.twig' %}

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

			{% include '@kohinos/block/admin_prestataire.html.twig' %}

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

			{% include '@kohinos/block/admin_caissier.html.twig' %}

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

			{% include '@kohinos/block/admin_adherent.html.twig' %}

		{% else %}
			{# User not loggued #}
		{% endif %}

		{# Valider les demandes d'achat de monnaie si on a le droit #}
		{% if app.user and is_granted('ROLE_VALIDE_ACHAT') %}
			{# @TODO : ajouter un raccourcis pour valider les demandes d'achat + un nombre #}
		{% endif %}

		{# Affichage de la carte des prestataires pour les adhérents #}
		{% if KOH_USE_WORDPRESS is defined and KOH_USE_WORDPRESS == 'false' and ((app.user and is_granted('ROLE_ADHERENT')) or not app.user) %}
			<div class='d-none d-md-block'>
				{% if tav_env == 1 %}
					{% include '@kohinos/presta/block/carte.html.twig' with {'title': 'Situer les points de vente'|trans}%}
					{% if presta_self_init_and_eval and not is_granted('ROLE_ADHERENT') %}
						<p>Vous êtes un point de vente et vous souhaitez rejoindre le projet ?
							<a href='{{ path('contact') }}' style="text-decoration: none;">
								<i class="fas fa-envelope"></i> Contactez-nous
							</a>
						</p>
					{% endif %}
				{% else %}
					{% include '@kohinos/presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%}
				{% endif %}
			</div>
		{% endif %}
		{% if app.user and is_granted('ROLE_ADMIN') %}
			<a href='http://wiki.kohinos.net/doku.php?id=doc:doc' target='_blank' rel="noopener noreferrer" class='ml-2 text-center'><i class="fa fa-book mr-2" aria-hidden="true"></i> Documentation utilisateur</a>
		{% endif %}
	{% endif %}
</div>