{% set datas = {
user_account: {
0:{
label: 'header.profil'|trans,
url: path('client_account', {'type': 'profil'})
},
1:{
label: 'header.vehicules'|trans,
url: path('client_account', {'type': 'vehicle'})
},
2:{
label: 'header.history'|trans,
url: path('client_account', {'type': 'history'})
},
3:{
label: 'header.appointment'|trans,
url: path('client_account', {'type': 'appointment'})
},
4:{
label: 'header.disconnect'|trans,
url: path('app_logout')
},
}
} %}
<!-- If menu in BO is empty or does not exist -->
<header>
{% if menus is not defined %}
Default header
{% else %}
<div class="pre-header bg-blue-very-light w-100">
<div class="container-pre-header container d-flex">
<div class="phone">
{#
<a href="tel:003521234567" class="blue">(+352) 12 34 56-7</a>
#}
</div>
<div class="langs-socials d-flex">
<div class="social ml-3 d-flex">
<a href="https://www.facebook.com/profile.php?id=100086901712295" target="_blank" class="mr-2 d-flex align-items-center">
<img src="{{ asset('img/icons/icon_facebook.svg') }}" class="fb" alt="Facebook">
</a>
<a href="https://www.youtube.com/channel/UCMcNGTFNplHlMaRy86m3bMw" target="_blank" class="mr-2 d-flex align-items-center">
<img src="{{ asset('img/icons/icon_youtube.svg') }}" class="youtube" alt="Youtube">
</a>
{#
<a href="" class="mr-2 ml-2 d-flex align-items-center linkedin"><img src="{{ asset('img/icons/linkedin.svg') }}" alt="linkedin"></a>
<a href="" class="ml-2 d-flex align-items-center instagram"><img src="{{ asset('img/icons/instagram.svg') }}" alt="instagram"></a>
#}
</div>
<div class="langs">
{% if slug != 'testing' %}
{% for code, slug in page.slugs %}
<a href="/{{ code }}/{{ slug }}"
class="ml-2 mr-2 blue text-uppercase {% if locale == code %}langs-bold{% endif %}">{{ code }}</a>
{% if not loop.last %}
|
{% endif %}
{% endfor %}
{% endif %}
</div>
{% if is_granted('ROLE_USER') == false %}
<a href=" {{ path('client_auth') }}" class="headerlogin">{{ 'header.login'|trans }}</a>
{% else %}
<div class="headerlogin logged">
<a href="{{ datas.user_account.0.url }}" class="user">{{ app.user.username }}</a>
<ul class="dropdown">
{% for item in datas.user_account %}
<li class="item">
<a href="{{ item.url }}" class="link">{{ item.label }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</div>
</div>
{% set locale = app.request.locale %}
<nav class="navbar navbar-expand-lg navbar-dark bg-white position-relative" id="menu">
<div class="w-100 header-menu">
<div class="container-pre-header container d-flex pr-5 position-relative">
<div class="logo">
<a href="/{% if locale == 'de' %}de/home{% endif %}"><img src="{{ asset('img/carfit_logo.svg') }}" alt="Carfit logo"></a>
</div>
<div class="menu no-responsive">
<ul class="navbar-nav">
{% for menu in menus %}
{% set pageMenu = twig_service.getPageById(menu.id) %}
{% if pageMenu and pageMenu.slugs[locale] is defined and pageMenu.active %}
{% set label = pageMenu.slug|trans %}
{% set hide = '' %}
{% set appointment = app.session.get('appointment') %}
{% if pageMenu.slug == 'create-appointment' %} {# hide the btn in the appointment context #}
{% if app.request.get('_route') == 'appointment_index'
or ( app.request.get('_route') == 'client_auth' and app.request.get('rdv') == true)
or ( app.request.get('_route') == 'appointment_profil')
or ( app.request.get('_route') == 'registration_profil')
%}
{% set hide = 'hide' %}
{% elseif app.session.has('appointment') and appointment.garage|default %}
{% set label = 'continue-appointment'|trans %} {# show the btn with label 'continue' if the process has been already began #}
{% endif %}
{% endif %}
<li class="nav-item {% if pageMenu.slugs[locale] == slug %}active{% endif %} mr-4 {{ hide }}">
<a class="nav-link blue-dark"
href="{{ path('front_index_page', {'slug': pageMenu.slugs[locale]}) }}">
{{ label }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{#<div id="burgerMenu" class="responsive">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>#}
<div class="burgerBtn" id="burgerBtn">
<div class="lineup"></div>
<div class="linecntr"></div>
<div class="linedn"></div>
</div>
{#<div id="crossMenu" class="responsive">
<img src="{{ asset('img/icons/cross.svg') }}">
</div>
<div class="chat bg-blue-very-light d-flex justify-content-center align-items-center position-absolute">
<img src="{{ asset('img/icons/chat.svg') }}" alt="chat">
</div>
#}
</div>
</div>
</nav>
{% endif %}
</header>