public/themes/karen/modules/header.html.twig line 1

Open in your IDE?
  1. <header class="header">
  2.     <div class="container mt-5 hidden flex-col gap-y-6 lg:flex">
  3.         <div class="flex-between">
  4.             <div class="relative z-20">
  5.                 <form action="{{ path('app_shop_site_products') }}" method="get"
  6.                       class="search-btn-open flex gap-x-2 app-border bg-gray-50 dark:bg-gray-700 p-1 rounded-full cursor-pointer ring-blue-400 w-84 transition-all">
  7.                     <svg class="size-6 p-1.5 flex-center text-gray-100 bg-blue-600 rounded-full w-9 h-9">
  8.                         <use href="#search"/>
  9.                     </svg>
  10.                     <input name="s" placeholder="جستجو در {{ getSettings('general_info_siteName') }}..." type="text">
  11.                     <button type="submit">جستجو</button>
  12.                 </form>
  13.             </div>
  14.             <a href="{{ path('app_shop_site_index') }}" class="flex flex-col text-center ml-20">
  15.                     <span class="font-MorabbaMedium text-4xl flex items-center text-center m-auto">
  16.                         {% set title = getSettings('general_info_siteName') %}
  17.                         {% set parts = title|split(' ') %}
  18.                         <span class="text-blue-500">
  19.                             {{ parts|slice(0, parts|length - 1)|join(' ') }}
  20.                         </span>  {{ parts|last }}
  21.                     </span>
  22.             </a>
  23.             <div class="flex items-center gap-x-3">
  24.                 {% if app.user %}
  25.                     <button class="group relative flex-center py-2 px-4 app-border rounded-full app-hover delay-75">
  26.                         <a href="{{ path('shop_customer_panel_dashboard') }}" class="flex items-center gap-x-1">
  27.                             <svg class="size-5">
  28.                                 <use href="#user"/>
  29.                             </svg>
  30.                             <p>حساب کاربری</p>
  31.                         </a>
  32.                         <div
  33.                                 class="absolute dark:border-none border border-gray-100 w-52 p-2 bg-white text-gray-900 dark:text-gray-100 flex flex-col gap-y-3 opacity-0 invisible group-hover:opacity-100 group-hover:visible group-hover:top-12 transition-all delay-100 dark:bg-gray-700 top-20 rounded-lg text-base shadow child:transition-all duration-300 child:py-1.5 child:px-2 z-30 child:rounded-lg child:w-full">
  34.                             <a href="{{ path('app_shop_user_order_orders_index') }}"
  35.                                class="flex items-center gap-x-2  hover:bg-blue-500 hover:text-gray-100">
  36.                                 <svg class="h-5 w-5">
  37.                                     <use href="#user"></use>
  38.                                 </svg>
  39.                                 سفارشات من
  40.                             </a>
  41.                             <a href="{{ path('app_shop_auth_profile') }}"
  42.                                class="flex items-center gap-x-2  hover:bg-blue-500 hover:text-gray-100">
  43.                                 <svg class="h-5 w-5">
  44.                                     <use href="#cog"></use>
  45.                                 </svg>
  46.                                 اطلاعات کاربری
  47.                             </a>
  48.                             <a href="{{ path('customer_panel_logout') }}"
  49.                                class="flex items-center gap-x-2  hover:bg-red-500 dark:hover:bg-red-500 hover:text-gray-100">
  50.                                 <svg class="h-5 w-5">
  51.                                     <use href="#arrow-left-end"></use>
  52.                                 </svg>
  53.                                 خروج از حساب
  54.                             </a>
  55.                         </div>
  56.                     </button>
  57.                 {% else %}
  58.                     <button class=" flex-center py-2 px-4  app-border rounded-full app-hover">
  59.                         <a href="{{ path('customer_panel_login') }}" class="flex items-center gap-x-2">
  60.                             <p>ورود | ثبت‌نام</p>
  61.                             <svg class="size-5">
  62.                                 <use href="#arrow-left-end"/>
  63.                             </svg>
  64.                         </a>
  65.                     </button>
  66.                 {% endif %}
  67.                 <button class="toggle-theme flex-center p-2 app-border rounded-full app-hover">
  68.                     <svg class="inline-block dark:hidden size-6">
  69.                         <use href="#moon"/>
  70.                     </svg>
  71.                     <svg class="hidden dark:inline size-6">
  72.                         <use href="#sun"/>
  73.                     </svg>
  74.                 </button>
  75.                 <button class="flex-center p-2 bg-blue-600 text-gray-100 rounded-full open-cart relative">
  76.                     <svg class="size-6">
  77.                         <use href="#shopping-bag"/>
  78.                     </svg>
  79.                     <span class="absolute -top-1 -right-1 flex h-4 w-4">
  80.                                 {% set cart = getUserCartItems() %}
  81.                         {% if cart['order'] is defined and cart['order'] is not null %}
  82.                             {% set cartLength = cart['order'].orderItems|length %}
  83.                         {% else %}
  84.                             {% set cartLength = 0 %}
  85.                         {% endif %}
  86.                             <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-600 opacity-75"></span>
  87.                             <span class="relative inline-flex rounded-full h-4 w-4 bg-red-500 text-xs pt-1 flex-center text-white">{{ cartLength }}</span>
  88.                         </span>
  89.                 </button>
  90.                 <div class="cart ">
  91.                     <div
  92.                             class="flex items-center justify-between pb-2 border-b-2 border-gray-200 dark:border-gray-600 text-gray-800 dark:text-gray-300">
  93.                         <h2 class="font-DanaMedium text-lg">سبد خرید <span class="text-sm text-gray-400 font-Dana">
  94.                                     ({{ cartLength }}
  95.                                     مورد)</span></h2>
  96.                         <svg class="size-5 cursor-pointer close-cart mb-.5">
  97.                             <use href="#x-mark"/>
  98.                         </svg>
  99.                     </div>
  100.                     <div class="flex flex-col divide-y-2 divide-gray-200 dark:divide-gray-600 my-4">
  101.                         {% if cart['order'] is defined and cart['order'] is not null %}
  102.                             {% for item in cart['order'].orderItems %}
  103.                                 <div class="grid grid-cols-12 gap-x-2 w-full py-4 cursor-pointer">
  104.                                     <div class="col-span-4 w-24 h-20">
  105.                                         {% if item.product.imageUrl is defined and item.product.imageUrl is not null %}
  106.                                             <img class="rounded-lg" src="{{ item.product.imageUrl }}" alt="">
  107.                                         {% elseif item.product.productImages[0] is defined %}
  108.                                             <img class="rounded-lg" src="{{ item.product.productImages[0].imageUrl }}"
  109.                                                  alt="">
  110.                                         {% endif %}
  111.                                     </div>
  112.                                     <div class="col-span-8 flex flex-col justify-between">
  113.                                         <h2 class="font-DanaMedium line-clamp-2">
  114.                                             {{ item.product.name }}
  115.                                         </h2>
  116.                                         <div class="flex items-center justify-between gap-x-2 mt-2">
  117.                                             <button
  118.                                                     class="w-20 flex items-center justify-between gap-x-1 rounded-lg border border-gray-200 dark:border-white/20 py-1 px-2">
  119.                                                 {{ item.quantity }} x
  120.                                             </button>
  121.                                             {#                                    <p class="text-lg text-blue-500 dark:text-blue-400 font-DanaMedium">1,130,000 #}
  122.                                             {#                                        <span class="font-Dana text-sm">تومان</span> #}
  123.                                             {#                                    </p> #}
  124.                                         </div>
  125.                                     </div>
  126.                                 </div>
  127.                             {% endfor %}
  128.                         {% else %}
  129.                             سبد خرید خالی می باشد
  130.                         {% endif %}
  131.                     </div>
  132.                     {% if cartLength > 0 %}
  133.                         <div class="w-[90%] fixed bottom-2 flex items-center justify-between border-t-2 border-gray-200 dark:border-gray-600 pt-4">
  134.                             <div>
  135.                                 <p class="text-gray-500 dark:text-gray-300 text-sm">مبلغ قابل پرداخت :</p>
  136.                                 <p class="text-lg text-blue-500 dark:text-blue-400 font-DanaDemiBold">{{ cart.total|number_format }}
  137.                                     <span class="font-Dana text-sm">تومان</span>
  138.                                 </p>
  139.                             </div>
  140.                             <a href="{{ path('app_shop_site_cart') }}"
  141.                                class="py-2 px-4 bg-blue-600 flex-center hover:bg-blue-700 transition-all rounded-lg text-gray-200">
  142.                                 ثبت سفارش
  143.                             </a>
  144.                         </div>
  145.                     {% endif %}
  146.                 </div>
  147.             </div>
  148.         </div>
  149.         <div class="relative flex-between h-16 bg-gray-900 dark:bg-gray-800 rounded-full text-gray-200 px-10">
  150.             {% set menu = get_menu_data('headerMenu') %}
  151.             {% if menu['items'] is defined %}
  152.                 <ul class="flex items-center gap-x-8 m-auto">
  153.                     {% for item in menu['items'] %}
  154.                         {% if item['children'] is defined and item['children']|length > 0 %}
  155.                             <li class="menu-item group">
  156.                                 <a href="{{ item['link'] }}" class="menu-item_link cursor-pointer">
  157.                                     {{ item['title'] }}
  158.                                 </a>
  159.                                 <ul class="solid-menu">
  160.                                     {% for children in item['children'] %}
  161.                                         <li>
  162.                                             <a href="{{ children['link'] }}">{{ children['title'] }}</a>
  163.                                         </li>
  164.                                     {% endfor %}
  165.                                 </ul>
  166.                             </li>
  167.                         {% else %}
  168.                             <li class="menu-item">
  169.                                 <a href="{{ item['link'] }}">{{ item['title'] }}</a>
  170.                             </li>
  171.                         {% endif %}
  172.                     {% endfor %}
  173.                 </ul>
  174.             {% endif %}
  175.         </div>
  176.     </div>
  177.     <div class="flex justify-center lg:hidden">
  178.         <nav class="absolute top-0 inset-x-0 w-full h-16 px-4 shadow-sm dark:bg-gray-800 flex items-center justify-between">
  179.             <button class="open-menu-mobile flex-center p-2 app-border rounded-full">
  180.                 <svg class=" size-6">
  181.                     <use href="#bars"/>
  182.                 </svg>
  183.             </button>
  184.             <div class="mobile-menu z-50 flex flex-col">
  185.                 <div class="flex w-full items-center justify-between border-b-normal pb-4  {% if app.user is defined and app.user is not null and app.user.hasRole('ROLE_SHOP_ADMIN') %}  mt-10 {% endif%} ">
  186.                     <a href="{{ path('app_shop_site_index') }}" class="text-xl font-MorabbaMedium">
  187.                         {% set title = getSettings('general_info_siteName') %}
  188.                         {% set parts = title|split(' ') %}
  189.                         <span class="text-blue-500">
  190.                             {{ parts|slice(0, parts|length - 1)|join(' ') }}
  191.                         </span> {{ parts|last }}
  192.                     </a>
  193.                     <button class="close-menu-mobile">
  194.                         <svg class="size-5 text-gray-500 dark:text-gray-200">
  195.                             <use href="#x-mark"/>
  196.                         </svg>
  197.                     </button>
  198.                 </div>
  199.                 {% set menu = get_menu_data('headerMenu') %}
  200.                 {% if menu['items'] is defined %}
  201.                     <ul class="flex flex-col gap-y-2 text-gray-800 dark:text-gray-100 mt-4">
  202.                         {% for item in menu['items'] %}
  203.                             <li class="mobile-menu-item">
  204.                                 <a href="{{ item['link'] }}">{{ item['title'] }}</a>
  205.                             </li>
  206.                         {% endfor %}
  207.                     </ul>
  208.                 {% endif %}
  209.             </div>
  210.             <a href="{{ path('app_shop_site_index') }}" class="flex flex-col text-center">
  211.                     <span class="font-MorabbaMedium text-3xl flex items-center">
  212.                  {% set title = getSettings('general_info_siteName') %}
  213.                         {% set parts = title|split(' ') %}
  214.                         <span class="text-blue-500">
  215.                             {{ parts|slice(0, parts|length - 1)|join(' ') }}
  216.                         </span>  {{ parts|last }}
  217.                     </span>
  218.             </a>
  219.             <button class="toggle-theme flex-center p-2 app-border rounded-full ">
  220.                 <svg class="inline-block dark:hidden size-6">
  221.                     <use href="#moon"/>
  222.                 </svg>
  223.                 <svg class="hidden dark:inline size-6">
  224.                     <use href="#sun"/>
  225.                 </svg>
  226.             </button>
  227.         </nav>
  228.         <button class="open-mobile_search-modal">
  229.             <svg class=" size-6">
  230.                 <use href="#search"/>
  231.             </svg>
  232.             <p>جستجو در
  233.                 {% set title = getSettings('general_info_siteName') %}
  234.                 {% set parts = title|split(' ') %}
  235.                 <span class="text-blue-500">
  236.                             {{ parts|slice(0, parts|length - 1)|join(' ') }}
  237.                         </span> {{ parts|last }}
  238.             </p>
  239.         </button>
  240.         <div class="mobile_search-modal">
  241.             <div class="w-full flex items-center gap-x-2">
  242.                 <form action="{{ path('app_shop_site_products') }}" method="get"
  243.                       class="w-full flex items-center gap-x-1 bg-gray-200 dark:bg-gray-800 text-gray-500 py-2 px-4 rounded-3xl">
  244.                     <svg class="size-6">
  245.                         <use href="#search"/>
  246.                     </svg>
  247.                     <input name="s" type="text" placeholder="جستجو در همه کالاها">
  248.                     <button type="submit">جستجو</button>
  249.                 </form>
  250.                 <svg class="size-6 close-mobile_search-modal">
  251.                     <use href="#x-mark"/>
  252.                 </svg>
  253.             </div>
  254.         </div>
  255.         <ul class="bottom-navbar">
  256.             <li {% if app.request.attributes.get('_route') == 'app_shop_site_index' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
  257.                 <svg class="size-5">
  258.                     <use href="#home"/>
  259.                 </svg>
  260.                 <a href="{{ path('app_shop_site_index') }}">خانه</a>
  261.             </li>
  262.             <li {% if app.request.attributes.get('_route') == 'app_shop_site_products' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
  263.                 <svg class="size-5">
  264.                     <use href="#squares"/>
  265.                 </svg>
  266.                 <a href="{{ path('app_shop_site_products') }}">فروشگاه</a>
  267.             </li>
  268.             <li {% if app.request.attributes.get('_route') == 'cart_checkout' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
  269.                 <svg class="size-5">
  270.                     <use href="#shopping-bag"/>
  271.                 </svg>
  272.                 <a href="{{ path('cart_checkout') }}">سبد خرید</a>
  273.             </li>
  274.             <li {% if app.request.attributes.get('_route') == 'customer_panel_user_handler' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
  275.                 <svg class="size-5">
  276.                     <use href="#user"/>
  277.                 </svg>
  278.                 <a href="{{ path('customer_panel_user_handler') }}">حساب من</a>
  279.             </li>
  280.         </ul>
  281.     </div>
  282. </header>