menu.html.twig 5.1 KB
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<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">
		{% if app.user is null and isPayzenEnabled() %}

			<li class="nav-item dropdownmenu-item has-child dropdown" role="menu-item">
                <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') %}
			<li class="nav-item" role="menu-item">
				<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') %}
			<li class="nav-item" role="menu-item">
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
					<i class="fas fa-bug"></i>
				</a>
			</li>
		{% endif %}
		{# MENU UTILISATEUR CONNECTE #}
		{% if app.user %}
			<li class="nav-item dropdown" role="menu-item">
				<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'>
						{% if app.session.has('_groupId') %}
							{% set groupeUser = app.session.get('_groupId') %}
								{{groupeUser.name}}
						{% elseif app.user.groups|length > 0 %}
							{{app.user.groups[0].name}}
						{% elseif app.user.roles|length > 0 %}
							{{app.user.roles[0]}}
						{% 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') %}
                		<b class="dropdown-item bg-primary text-white"> Ecompte : {{app.user.adherent.emlcAccount.balance }}</b>
                	{% 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>