templates/home/blocks/header.html.twig line 1

Open in your IDE?
  1. {% set datas = {
  2.     user_account: {
  3.         0:{
  4.             label: 'header.profil'|trans,
  5.             url: path('client_account',  {'type': 'profil'})
  6.         },
  7.         1:{
  8.             label: 'header.vehicules'|trans,
  9.             url: path('client_account', {'type': 'vehicle'})
  10.         },
  11.         2:{
  12.             label: 'header.history'|trans,
  13.             url: path('client_account', {'type': 'history'})
  14.         },
  15.         3:{
  16.             label: 'header.appointment'|trans,
  17.             url: path('client_account', {'type': 'appointment'})
  18.         },
  19.         4:{
  20.             label: 'header.disconnect'|trans,
  21.             url: path('app_logout')
  22.         },
  23.     }
  24. } %}
  25. <!-- If menu in BO is empty or does not exist -->
  26. <header>
  27.     {% if menus is not defined %}
  28.         Default header
  29.     {% else %}
  30.         <div class="pre-header bg-blue-very-light w-100">
  31.             <div class="container-pre-header container d-flex">
  32.                 <div class="phone">
  33.                     {#
  34.                     <a href="tel:003521234567" class="blue">(+352) 12 34 56-7</a>
  35.                     #}
  36.                 </div>
  37.                 <div class="langs-socials d-flex">
  38.                     <div class="social ml-3 d-flex">
  39.                         <a href="https://www.facebook.com/profile.php?id=100086901712295" target="_blank" class="mr-2 d-flex align-items-center">
  40.                             <img src="{{ asset('img/icons/icon_facebook.svg') }}" class="fb" alt="Facebook">
  41.                         </a>
  42.                         <a href="https://www.youtube.com/channel/UCMcNGTFNplHlMaRy86m3bMw" target="_blank" class="mr-2 d-flex align-items-center">
  43.                             <img src="{{ asset('img/icons/icon_youtube.svg') }}" class="youtube" alt="Youtube">
  44.                         </a>
  45.                         {#
  46.                         <a href="" class="mr-2 ml-2 d-flex align-items-center linkedin"><img src="{{ asset('img/icons/linkedin.svg') }}" alt="linkedin"></a>
  47.                         <a href="" class="ml-2 d-flex align-items-center instagram"><img src="{{ asset('img/icons/instagram.svg') }}" alt="instagram"></a>
  48.                         #}
  49.                     </div>
  50.                     <div class="langs">
  51.                         {% if slug != 'testing' %}
  52.                             {% for code, slug in page.slugs %}
  53.                                 <a href="/{{ code }}/{{ slug }}"
  54.                                     class="ml-2 mr-2 blue text-uppercase {% if locale == code %}langs-bold{% endif %}">{{ code }}</a>
  55.                                 {% if not loop.last %}
  56.                                     |
  57.                                 {% endif %}
  58.                             {% endfor %}
  59.                         {% endif %}
  60.                     </div>
  61.                     {% if is_granted('ROLE_USER') == false %}
  62.                         <a href=" {{ path('client_auth') }}" class="headerlogin">{{ 'header.login'|trans }}</a>
  63.                     {% else %}
  64.                         <div class="headerlogin logged">
  65.                             <a href="{{ datas.user_account.0.url }}" class="user">{{ app.user.username }}</a>
  66.                             <ul class="dropdown">
  67.                                 {% for item in datas.user_account %}
  68.                                     <li class="item">
  69.                                         <a href="{{ item.url }}" class="link">{{ item.label }}</a>
  70.                                     </li>
  71.                                 {% endfor %}
  72.                             </ul>
  73.                         </div>
  74.                     {% endif %}
  75.                 </div>
  76.             </div>
  77.         </div>
  78.     {% set locale = app.request.locale %}
  79.         <nav class="navbar navbar-expand-lg navbar-dark bg-white position-relative" id="menu">
  80.             <div class="w-100 header-menu">
  81.                 <div class="container-pre-header container d-flex pr-5 position-relative">
  82.                     <div class="logo">
  83.                         <a href="/{% if locale == 'de' %}de/home{% endif %}"><img src="{{ asset('img/carfit_logo.svg') }}" alt="Carfit logo"></a>
  84.                     </div>
  85.                     <div class="menu no-responsive">
  86.                         <ul class="navbar-nav">
  87.                             {% for menu in menus %}
  88.                                 {% set pageMenu = twig_service.getPageById(menu.id) %}
  89.                                 {% if pageMenu and pageMenu.slugs[locale] is defined and pageMenu.active %}
  90.                                     {% set label = pageMenu.slug|trans  %}
  91.                                     {% set hide = ''  %}
  92.                                     {% set appointment = app.session.get('appointment')  %}
  93.                                     {% if pageMenu.slug == 'create-appointment' %} {# hide the btn in the appointment context   #}
  94.                                         {%  if app.request.get('_route') == 'appointment_index'
  95.                                             or ( app.request.get('_route') == 'client_auth' and app.request.get('rdv') == true)
  96.                                             or ( app.request.get('_route') == 'appointment_profil')
  97.                                             or ( app.request.get('_route') == 'registration_profil')
  98.                                         %}
  99.                                             {% set hide = 'hide' %}
  100.                                         {% elseif app.session.has('appointment') and appointment.garage|default  %}
  101.                                             {% set label = 'continue-appointment'|trans %} {# show the btn with label 'continue' if the process has been already began   #}
  102.                                         {% endif %}
  103.                                     {% endif %}
  104.                                     <li class="nav-item {% if pageMenu.slugs[locale] == slug %}active{% endif %} mr-4 {{ hide }}">
  105.                                         <a class="nav-link blue-dark"
  106.                                            href="{{ path('front_index_page', {'slug': pageMenu.slugs[locale]}) }}">
  107.                                             {{ label }}
  108.                                         </a>
  109.                                     </li>
  110.                                 {% endif %}
  111.                             {% endfor %}
  112.                         </ul>
  113.                     </div>
  114.                     {#<div id="burgerMenu" class="responsive">
  115.                         <div class="bar"></div>
  116.                         <div class="bar"></div>
  117.                         <div class="bar"></div>
  118.                     </div>#}
  119.                     <div class="burgerBtn" id="burgerBtn">
  120.                         <div class="lineup"></div>
  121.                         <div class="linecntr"></div>
  122.                         <div class="linedn"></div>
  123.                     </div>
  124.                     {#<div id="crossMenu" class="responsive">
  125.                         <img src="{{ asset('img/icons/cross.svg') }}">
  126.                     </div>
  127.                     
  128.                     <div class="chat bg-blue-very-light d-flex justify-content-center align-items-center position-absolute">
  129.                         <img src="{{ asset('img/icons/chat.svg') }}" alt="chat">
  130.                     </div>
  131.                     #}
  132.                 </div>
  133.             </div>
  134.         </nav>
  135.     {% endif %}
  136. </header>