custom/plugins/ShopWithMeUI/src/Resources/views/storefront/layout/header/header.html.twig line 1

Open in your IDE?
  1. {% block layout_header %}
  2.     {% set isoCode = page.header.activeLanguage.translationCode.code|lower|split('-') %}
  3.     
  4.     {% set flagCountry = isoCode[1] %}
  5.     {% set flagLanguage = isoCode[0] %}
  6.     {% set categories = page.extensions.swmUI.categories %}
  7.     {% set countNotViewNotification = page.extensions.swmUI.countNotViewNotification %}
  8.     {% set totalQuantityCart = page.extensions.swmUI.totalQuantityCart %}
  9.     {# {% if context.customer %}
  10.         {% set amityUserLoginData = amityLogin(context.customer) %}
  11.         {% set amityLock = false %}
  12.     {% else %}
  13.         {% set amityUserLoginData = amityLoginGuest() %}
  14.         {% set amityLock = true %}
  15.     {% endif %} #}
  16.     {% set redirectUrl = app.request.get('_route') %}
  17.     {% set redirectParams = app.request.attributes.get('_route_params') %}
  18.     {% set redirectParameters = redirectParams|json_encode %}
  19.     {% set noti = page.header.extensions.swmUIHeader.notificationCount %}
  20.     <div class="amity-client" data-econsor-amity="true" data-api-key="{{ amityUserLoginData.apiKey }}" data-user-id="{{ amityUserLoginData.users|first.userId }}" data-user-auth="{{ amityUserLoginData.auth }}" data-lock="{{ amityLock }}"></div>
  21.     <div id="swm-header" class="row align-items-center" 
  22.     data-path="{{ path('frontend.notification.list') }}" 
  23.     data-csrf="{{ sw_csrf('frontend.notification.list', {'mode': 'token'}) }}"
  24.     >
  25.         <section class="home_header_container_section position-relative width-full" style="margin: 0;">
  26.             <div id="home_header_container" class="d-flex justify-between items-center">
  27.                 <div class="banner_img home_header_center_logo">
  28.                     <a href="{{ seoUrl('frontend.home.page') }}">
  29.                         <img src="{{ asset('bundles/shopwithmeui/assets/imgs/shopwithme.png') }}" style="width: 131.38px"/>
  30.                     </a>
  31.                 </div>
  32.                 <div id="home_header_center_view" class="d-flex justify-center items-center mobile:d-none" style="gap:32px">
  33.                     <div id="home_header_show_products" class="home_header_center_view-item d-flex">
  34.                         <span class="typo-sub-text-3-pr">{{ "app.header.navigation.product"|trans|sw_sanitize }}</span>
  35.                         <img src="{{ asset('bundles/shopwithmeui/assets/imgs/chevron-down.png') }}"/>
  36.                         <div id="home_header_show_products__menu__layer">
  37.                             <div id="home_header_show_products__menu">
  38.                                 {% for category in categories %}
  39.                                     <a class="home_header_show_products__menu__item"{% if category.id == '4b9877842d644023a899643e1cd8548f' and flagCountry not in ['vn'] %} href="{{ seoUrl('frontend.shop4free') }}" {% else %} href="{{ seoUrl('frontend.current-deals', { category: category.id }) }}"{% endif %}>
  40.                                         <img class="home_header_show_products__menu__item__icon" src="{{ asset('bundles/shopwithmeui/assets/icons/category-' ~ category.id ~ '-icon.svg') }}"/>
  41.                                         {{ category.name }}
  42.                                     </a>
  43.                                 {% endfor %}
  44.                             </div>
  45.                         </div>
  46.                     </div>
  47.                     {% if flagCountry not in ['vn'] %}
  48.                     <a class="home_header_center_view-item" href="{{ seoUrl('frontend.shop4free') }}">
  49.                         <span class="typo-sub-text-3-pr">{{ "app.header.navigation.shop4free"|trans|sw_sanitize }}</span>
  50.                     </a>
  51.                     {% endif %}
  52.                     <a class="home_header_center_view-item" href="{{ seoUrl('frontend.ai.stream') }}">
  53.                         <span class="typo-sub-text-3-pr">{{ "app.header.navigation.aiStream"|trans|sw_sanitize }}</span>
  54.                     </a>
  55.                     <a class="home_header_center_view-item" href="{{ seoUrl('frontend.my.deals') }}">
  56.                         <span class="typo-sub-text-3-pr">{{"app.myDeals"|trans|sw_sanitize}}</span>
  57.                     </a>
  58.                 </div>
  59.                 <div class="home_header_right_view d-flex justify-center items-center" style="gap:16px">
  60.                 {% set isVnCustomer = context.customer is not null and context.customer.defaultShippingAddress.country.iso|upper == 'VN' %}
  61.                 {% if not (isVnCustomer and flagCountry|upper == 'VN') %}
  62.                     <div id="home_header_language" class="dzb-select">
  63.                         <div class="dzb-select__label-value d-flex items-center justify-center" style="gap:8px">
  64.                             <img src="{{ asset('bundles/shopwithmeui/assets/imgs/flag_' ~ flagCountry ~ '.png') }}" alt="English Flag" style="width: 20px;"/>
  65.                             <img src="{{ asset('bundles/shopwithmeui/assets/imgs/chevron-down.png') }}"/>
  66.                         </div>
  67.                         <div class="dzb-select__options">
  68.                             <form method="post" action="{{ path('frontend.checkout.switch-language') }}" class="w-100" data-form-auto-submit="true">
  69.                                 <div class="home_header_languge_container-content d-flex flex-col">
  70.                                     {% block layout_header_actions_language_widget_form_csrf %}
  71.                                         {{ sw_csrf('frontend.checkout.switch-language') }}
  72.                                     {% endblock %}
  73.                                     {% for language in page.header.languages %}
  74.                                         {% set isoCode = language.translationCode.code|lower|split('-') %}
  75.                                         {% set flagCountry = isoCode[1] %}
  76.                                         {% set flagLanguage = isoCode[0] %}
  77.                                         {% if flagCountry not in ['in', 'sk', 'cz'] %}
  78.                                             <button class="dzb-select__options__option swm-btn-no-style home_header_languge_container-item d-flex items-center justify-between border-radius-7" type="submit" name="languageId" value="{{ language.id }}" {% if language.id is same as(page.header.activeLanguage.id) %} disabled {% endif %}>
  79.                                                 <div class="home_header_languge_container-item-left d-flex items-center justify-start" style="gap: 8px">
  80.                                                     <img src="{{ asset('bundles/shopwithmeui/assets/imgs/flag_'~ flagCountry ~'.png') }}" alt="home_header_language_container-item-left-img" class="home_header_language_container-item-left-img">
  81.                                                     <div class="home_header_languge_container-item-left-title">
  82.                                                         <div class="home_header_languge_container-item-left-title-name typo-sub-text-4-smb">
  83.                                                             {{("app.header.language." ~ flagLanguage)|trans|sw_sanitize }}
  84.                                                         </div>
  85.                                                     </div>
  86.                                                 </div>
  87.                                             </button>
  88.                                         {% endif %}
  89.                                     {% endfor %}
  90.                                     <input name="redirectTo" type="hidden" value="{{ app.request.get('_route') }}"/>
  91.                                     {% for key, value in app.request.attributes.get('_route_params') %}
  92.                                         <input name="redirectParameters[{{ key }}]" type="hidden" value="{{ value }}">
  93.                                     {% endfor %}
  94.                                 </div>
  95.                             </form>
  96.                         </div>
  97.                     </div>
  98.                 {% endif %}
  99.                     <img id="home_header_search" class="cursor-pointer" src="{{ asset('bundles/shopwithmeui/assets/icons/ic_search.svg') }}"/>
  100.                     <a id="home_header_cart" href="{{ context.customer is not null ? seoUrl('frontend.checkout.cart.page') : seoUrl('frontend.account.login', { redirectTo: 'frontend.checkout.cart.page' }) }}">
  101.                         <img src="{{ asset('bundles/shopwithmeui/assets/icons/ic_cart.svg') }}"/>
  102.                         <div class="quantity_cart {% if totalQuantityCart == 0 %}d-none{% endif %}">{{ totalQuantityCart }}</div>
  103.                     </a>
  104.                     {% if context.customer is not null %}
  105.                         <div id="home_header_noti" class="position-relative">
  106.                             <img src="{{ asset('bundles/shopwithmeui/assets/icons/ic_bell.svg') }}"/>
  107.                             <!-- Noti red dot -->
  108.                             <div class="position-absolute home_header_noti_red-dot {% if countNotViewNotification <= 0 %}d-none{% endif %}"></div>
  109.                         </div>
  110.                         <div id="home_header_user" class="swm_ccs_none_mobile">
  111.                             <img src="{{ context.customer.extensions.avatar.url ?: asset('bundles/shopwithmeui/assets/imgs/no_avatar.jpeg') }}"/>
  112.                         </div>
  113.                     {% else %}
  114.                         <div class="home_header_center_view-item text-decoration-none">
  115.                             <a href="{{ seoUrl('frontend.account.login', { redirectTo: redirectUrl, redirectParameters: redirectParameters }) }}" class="mobile:d-none typo-sub-text-3 swm-btn swm-btn-shop4free-secondary swm_button_extra_for_small text-decoration-none">
  116.                                 <div class="d-flex items-center justify-between" style="gap: 4px">
  117.                                     <span class="button-title" style="font-size: 16px;">{{'app.header.navigation.loginSignup'|trans}}</span>
  118.                                     <svg width="18" height="18" viewbox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
  119.                                         <path d="M9 17C11.1217 17 13.1566 16.1571 14.6569 14.6569C16.1571 13.1566 17 11.1217 17 9C17 6.87827 16.1571 4.84344 14.6569 3.34315C13.1566 1.84285 11.1217 1 9 1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
  120.                                         <path d="M1 9H11M11 9L8 6M11 9L8 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  121.                                     </svg>
  122.                                 </div>
  123.                             </a>
  124.                             <a href="{{ seoUrl('frontend.account.login', { redirectTo: redirectUrl, redirectParameters: redirectParameters }) }}" class="mobile:d-block" style="display: none">
  125.                                 <svg width="18" height="18" viewbox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
  126.                                     <path d="M9 17C11.1217 17 13.1566 16.1571 14.6569 14.6569C16.1571 13.1566 17 11.1217 17 9C17 6.87827 16.1571 4.84344 14.6569 3.34315C13.1566 1.84285 11.1217 1 9 1" stroke="#000" stroke-width="1.5" stroke-linecap="round"/>
  127.                                     <path d="M1 9H11M11 9L8 6M11 9L8 12" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  128.                                 </svg>
  129.                             </a>
  130.                         </div>
  131.                     {% endif %}
  132.                 </div>
  133.                 <div id="home_header_notification_rl_container" class="position-absolute">
  134.                     <div class="d-flex justify-between align-center items-center">
  135.                         <div class="d-flex" style="gap: 12px;">
  136.                             <img src="{{ asset('bundles/shopwithmeui/assets/imgs/img_wheel.png') }}" width="50px" height="50px"/>
  137.                             <div class="d-flex" style="gap:4px">
  138.                                 <span class="swm_home_header_text_base color_green">
  139.                                     {{ "app.header.notification.titleSpin"|trans|sw_sanitize }}</span>
  140.                             </div>
  141.                         </div>
  142.                         <div class="d-flex flex-col">
  143.                             <div class="typo-sub-text-3 swm-btn swm-btn-shop4free-secondary">
  144.                                 <span id="swm_btn_next_step" class="signup__button text-body-m white-space-nowrap">
  145.                                     {{ "app.header.notification.spinNow"|trans|sw_sanitize }}
  146.                                 </span>
  147.                             </div>
  148.                         </div>
  149.                         <img id="home_header_notification_rl_icon_close" src="{{ asset('bundles/shopwithmeui/assets/icons/ic_close_circle.svg') }}"/>
  150.                     </div>
  151.                 </div>
  152.                 <div id="home_header_notification_container" class="position-absolute">
  153.                     <div class="d-flex justify-between flex-col width-full" style="gap: 18px">
  154.                         <div class="justify-between d-flex">
  155.                             <span class="home_header_title">
  156.                                 {{ "app.header.notification.title"|trans|sw_sanitize }}
  157.                             </span>
  158.                             <div class="items-center d-flex" style="gap:10px">
  159.                                 <img src="{{ asset('bundles/shopwithmeui/assets/icons/ic_double_check_green.svg') }}"/>
  160.                                 <span class="home_header_noti_read">
  161.                                     {{ "app.header.notification.markAsRead"|trans|sw_sanitize }}
  162.                                 </span>
  163.                             </div>
  164.                         </div>
  165.                         <div id="home_header_noti_option_container" class="d-flex items-center width-full">
  166.                             <div class="d-flex justify-center noti_option_each active" data-id="">
  167.                                 <span class="swm_home_header_text_base">
  168.                                     {{ "app.header.notification.viewAll"|trans|sw_sanitize }}
  169.                                 </span>
  170.                                 <div class="justify-center align-center d-flex noti_option_each_count_container active">
  171.                                     <span class="swm_home_header_text_base">
  172.                                         {{ noti.all }}
  173.                                     </span>
  174.                                 </div>
  175.                             </div>
  176.                             <div class="d-flex justify-center noti_option_each" data-id="like">
  177.                                 <span class="swm_home_header_text_base">
  178.                                     {{ "app.header.notification.activity"|trans|sw_sanitize }}
  179.                                 </span>
  180.                                 <div class="justify-center align-center d-flex noti_option_each_count_container">
  181.                                     <span class="swm_home_header_text_base">
  182.                                         {{ noti.like }}
  183.                                     </span>
  184.                                 </div>
  185.                                 </div>
  186.                                     <div class="d-flex justify-center noti_option_each" data-id="followers">
  187.                                         <span class="swm_home_header_text_base">
  188.                                             {{ "app.header.notification.followers"|trans|sw_sanitize }}
  189.                                         </span>
  190.                                     <div class="justify-center align-center d-flex noti_option_each_count_container">
  191.                                     <span class="swm_home_header_text_base">
  192.                                         {{ noti.followers }}
  193.                                     </span>
  194.                                 </div>
  195.                                 </div>
  196.                                     <div class="d-flex justify-center noti_option_each" data-id="invites">
  197.                                         <span class="swm_home_header_text_base">
  198.                                             {{ "app.header.notification.invites"|trans|sw_sanitize }}
  199.                                         </span>
  200.                                     <div class="justify-center align-center d-flex noti_option_each_count_container">
  201.                                     <span class="swm_home_header_text_base">
  202.                                         {{ noti.invites }}
  203.                                     </span>
  204.                                 </div>
  205.                             </div>
  206.                         </div>
  207.                         <div id="home_header_notification_container_list" class="width-full">
  208.                             {# {% sw_include '@Storefront/storefront/component/header/notification.html.twig' %} #}
  209.                         </div>
  210.                     </div>
  211.                 </div>
  212.                 <div id="home_header_search_container" class="position-absolute" data-path="{{ path('frontend.product.search') }}" data-csrf="{{ sw_csrf('frontend.product.search', {"mode": "token"}) }}">
  213.                     <div class="home_header_search_container-content position-relative" style="gap: 12px; max-width: 100%;">
  214.                         <input class="swm_search_form-input width-full " type="text" id="searchProduct" name="search" placeholder="{{ "app.header.search.searchProduct"|trans|sw_sanitize }}"/>
  215.                         <img src="{{ asset('bundles/shopwithmeui/assets/icons/ic_search.svg') }}" alt="Search" class="position-absolute home_header_search_container-content-icon swm_search_form-button">
  216.                         <div class="home_header_search_container-product d-flex flex-col" style="max-height: 50vh; overflow-y: auto;"></div>
  217.                     </div>
  218.                 </div>
  219.                 <div id="home_header_profile_container" class="position-absolute">
  220.                     <div class="home_header_profile_container-box-content d-flex flex-col">
  221.                         <a class="home_header_profile_container-content-profile text-decoration-none" href="{{ seoUrl('frontend.account.home.page') }}">
  222.                             <div class="home_header_profile_container-content position-relative d-flex items-center" style="gap: 12px;">
  223.                                 <div class="home_header_profile_container-content-img d-flex">
  224.                                     <img src="{{ context.customer.extensions.avatar.url ?: asset('bundles/shopwithmeui/assets/imgs/no_avatar.jpeg') }}" width="100%"/>
  225.                                 </div>
  226.                                 <div class="home_header_profile_container-item-left-title">
  227.                                     <div class="home_header_profile_container-item-left-title-name typo-sub-text-3-pr">
  228.                                         {{context.customer.firstName}}
  229.                                         {{context.customer.lastName}}
  230.                                     </div>
  231.                                 </div>
  232.                             </div>
  233.                         </a>
  234.                         <a id="logout_btn--header" href="{{ seoUrl('frontend.account.logout.page') }}" class="typo-sub-text-3 swm-btn swm-btn-shop4free-secondary swm_button_extra_for_small text-decoration-none">
  235.                             <div class="d-flex items-center justify-between" style="gap: 4px">
  236.                                 <span class="button-title" style="font-size: 16px;">{{ "app.logout"|trans|sw_sanitize }}</span>
  237.                                 <svg width="18" height="18" viewbox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
  238.                                     <path d="M9 17C11.1217 17 13.1566 16.1571 14.6569 14.6569C16.1571 13.1566 17 11.1217 17 9C17 6.87827 16.1571 4.84344 14.6569 3.34315C13.1566 1.84285 11.1217 1 9 1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
  239.                                     <path d="M1 9H11M11 9L8 6M11 9L8 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  240.                                 </svg>
  241.                             </div>
  242.                         </a>
  243.                     </div>
  244.                 </div>
  245.             </div>
  246.         </section>
  247.     </div>
  248. {% endblock %}