menu.html.twig 5.63 KB
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
	<span class="navbar-toggler-icon"></span>
</button>

{% if menuItems is not defined %}
	{% set menuItems = getMenuItemsFromAlias('main') %}
{% endif %}

<div class="collapse navbar-collapse" id="navbarSupportedContent">
	<ul class="navbar-nav ml-auto">
Damien Moulard committed
11
		{% if app.user is null and ((KOH_USE_WORDPRESS is defined and KOH_USE_PAYZEN == 'true') or (KOH_USE_HELLOASSO  is defined and KOH_USE_HELLOASSO == 'true')) and not tav_env %}
Julien Jorry committed
12

Julien Jorry committed
13
			<li class="nav-item dropdownmenu-item has-child dropdown" role="menuitem">
Julien Jorry committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
                <a href="#" id="navbarDropdown1" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link parent dropdown-toggle ">{{ 'Adhérer'|trans }}</a>
            	<div class="dropdown-menu" aria-labelledby="navbarDropdown1">
					<a href="/adherer" class="dropdown-item ">{{ 'Adhérer à la MLC'|trans }}</a>
            	</div>
            </li>
        {% endif %}
        {% if KOH_USE_WORDPRESS is not defined %}
        	{% set KOH_USE_WORDPRESS = true %}
        {% endif %}
        {% if KOH_USE_WORDPRESS == 'false' and menuItems is not null and menuItems|length > 0 %}
			{% import '@kohinos/common/menu_tree_macro.html.twig' as tree %}
			{% set currentPath = app.request.requestUri %}
			{{ tree.menu(menuItems, currentPath) }}
		{% endif %}
		{# MENU UTILISATEUR AYANT ACCES A L'ADMIN CONNECTE #}
        {% if app.user and is_granted('ROLE_ADMIN') %}
Julien Jorry committed
30
			<li class="nav-item" role="menuitem">
Julien Jorry committed
31 32 33 34 35 36 37
				<a href="{{ path('sonata_admin_dashboard') }}" class="nav-link" data-toggle="tooltip" data-placement="bottom" title="{{ 'Administration'|trans }}">
					<i class="fas fa-cog text-primary"></i>{% if KOH_USE_WORDPRESS != 'false' %}<span class='ml-1 text-primary'>Administration</span>{% endif %}
				</a>
			</li>
		{% endif %}
		{% set printBugReport = KOH_BUG_REPORT|default('') %}
        {% if app.user and (is_granted('ROLE_ADMIN') and printBugReport == 'ROLE_ADMIN') or (is_granted('ROLE_USER') and printBugReport == 'ROLE_USER') %}
Julien Jorry committed
38
			<li class="nav-item" role="menuitem">
39
				<a class='nav-link text-warning' href='{{ path('bugreport') }}' target='_blank' rel="noopener noreferrer" data-toggle="tooltip" data-placement="bottom" title="{{ 'Reporter un bug'|trans }}">
Julien Jorry committed
40 41 42 43 44 45
					<i class="fas fa-bug"></i>
				</a>
			</li>
		{% endif %}
		{# MENU UTILISATEUR CONNECTE #}
		{% if app.user %}
Julien Jorry committed
46
			<li class="nav-item dropdown" role="menuitem">
Julien Jorry committed
47 48 49 50
				<a href="#" id="navbarDropdownUC" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link parent dropdown-toggle" alt='{{ app.user.name }}'>
					<span style="{# font-size: 1em; color: grey; #}">
						<i class="fas fa-user"></i>
						<span class='ml-1'>
51
						{% if app.session.has('_groupId') and app.session.get('_groupId').name != 'ROLE_USER' %}
Julien Jorry committed
52 53 54
							{% set groupeUser = app.session.get('_groupId') %}
								{{groupeUser.name}}
						{% elseif app.user.groups|length > 0 %}
55 56 57 58 59
							{% if app.user.groups[0].name != 'ROLE_USER' %}
								{{app.user.groups[0].name}}
							{% else %}
								{{app.user.name}}
							{% endif %}
Julien Jorry committed
60
						{% elseif app.user.roles|length > 0 %}
61 62 63 64 65
							{% if app.user.roles[0] != 'ROLE_USER' %}
								{{app.user.roles[0]}}
							{% else %}
								{{app.user.name}}
							{% endif %}
Julien Jorry committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
						{% else %}
							{{app.user.name}}
						{% endif %}
						{% if getCurrentGroupe() != null %}
							- {{ getCurrentGroupe() }}
						{% endif %}
						{% if getCurrentComptoir() != null %}
							- {{ getCurrentComptoir() }}
						{% endif %}
						{% if getCurrentPrestataire() != null %}
							- {{ getCurrentPrestataire() }}
						{% endif %}
						</span>
					</span>
				</a>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownUC">
                	{# COMPTE ou ECOMPTE  : @TODO : mettre plutôt dans le header en visible tout le temps ? #}
                	{% if app.user and is_granted('ROLE_ADHERENT') %}
84 85 86 87 88 89 90
                		<b class="dropdown-item bg-primary text-white">
							{% if app.user.adherent.emlcAccount %}
								Ecompte : {{app.user.adherent.emlcAccount.balance }}
							{% else %}
								Aucun compte emlc existant.
							{% endif %}
						</b>
Julien Jorry committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
                	{% elseif app.user and is_granted('ROLE_PRESTATAIRE') and getCurrentPrestataire() != null %}
                		<b class="dropdown-item bg-primary text-white"> Ecompte : {{getCurrentPrestataire().emlcAccount.balance }}</b>
                	{% elseif getCurrentGroupe() != null %}
                		<b class="dropdown-item bg-primary text-white"> Compte : {{getCurrentGroupe().mlcAccount.balance }}</b>
                	{% elseif getCurrentComptoir() != null %}
                		<b class="dropdown-item bg-primary text-white"> Compte : {{getCurrentComptoir().mlcAccount.balance }}</b>
                	{% endif %}
                	{% if app.user %}
                		<a href="{{path('myaccount')}}" class="dropdown-item">{{ 'Mon compte'|trans }}</a>
                	{% endif %}
                	{% if app.user.possiblegroups|length > 1 %}
                    	<a href="#" class="viewChoiceGroup dropdown-item">{{ 'Choix du rôle'|trans }}</a>
                    {% endif %}
                    {% if is_granted('ROLE_PREVIOUS_ADMIN') %}
					    <a href="{{path('index')}}?_switch_user=_exit" class="dropdown-item">{{ 'RETOUR SUPER ADMIN'|trans }}</a>
					{% endif %}
                    <a href="{{ path('fos_user_security_logout') }}" class="dropdown-item">{{ 'Déconnexion'|trans }}</a>
                </div>
			</li>
		{% endif %}
	</ul>
</div>