<header class="header">
<div class="container mt-5 hidden flex-col gap-y-6 lg:flex">
<div class="flex-between">
<div class="relative z-20">
<form action="{{ path('app_shop_site_products') }}" method="get"
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">
<svg class="size-6 p-1.5 flex-center text-gray-100 bg-blue-600 rounded-full w-9 h-9">
<use href="#search"/>
</svg>
<input name="s" placeholder="جستجو در {{ getSettings('general_info_siteName') }}..." type="text">
<button type="submit">جستجو</button>
</form>
</div>
<a href="{{ path('app_shop_site_index') }}" class="flex flex-col text-center ml-20">
<span class="font-MorabbaMedium text-4xl flex items-center text-center m-auto">
{% set title = getSettings('general_info_siteName') %}
{% set parts = title|split(' ') %}
<span class="text-blue-500">
{{ parts|slice(0, parts|length - 1)|join(' ') }}
</span> {{ parts|last }}
</span>
</a>
<div class="flex items-center gap-x-3">
{% if app.user %}
<button class="group relative flex-center py-2 px-4 app-border rounded-full app-hover delay-75">
<a href="{{ path('shop_customer_panel_dashboard') }}" class="flex items-center gap-x-1">
<svg class="size-5">
<use href="#user"/>
</svg>
<p>حساب کاربری</p>
</a>
<div
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">
<a href="{{ path('app_shop_user_order_orders_index') }}"
class="flex items-center gap-x-2 hover:bg-blue-500 hover:text-gray-100">
<svg class="h-5 w-5">
<use href="#user"></use>
</svg>
سفارشات من
</a>
<a href="{{ path('app_shop_auth_profile') }}"
class="flex items-center gap-x-2 hover:bg-blue-500 hover:text-gray-100">
<svg class="h-5 w-5">
<use href="#cog"></use>
</svg>
اطلاعات کاربری
</a>
<a href="{{ path('customer_panel_logout') }}"
class="flex items-center gap-x-2 hover:bg-red-500 dark:hover:bg-red-500 hover:text-gray-100">
<svg class="h-5 w-5">
<use href="#arrow-left-end"></use>
</svg>
خروج از حساب
</a>
</div>
</button>
{% else %}
<button class=" flex-center py-2 px-4 app-border rounded-full app-hover">
<a href="{{ path('customer_panel_login') }}" class="flex items-center gap-x-2">
<p>ورود | ثبتنام</p>
<svg class="size-5">
<use href="#arrow-left-end"/>
</svg>
</a>
</button>
{% endif %}
<button class="toggle-theme flex-center p-2 app-border rounded-full app-hover">
<svg class="inline-block dark:hidden size-6">
<use href="#moon"/>
</svg>
<svg class="hidden dark:inline size-6">
<use href="#sun"/>
</svg>
</button>
<button class="flex-center p-2 bg-blue-600 text-gray-100 rounded-full open-cart relative">
<svg class="size-6">
<use href="#shopping-bag"/>
</svg>
<span class="absolute -top-1 -right-1 flex h-4 w-4">
{% set cart = getUserCartItems() %}
{% if cart['order'] is defined and cart['order'] is not null %}
{% set cartLength = cart['order'].orderItems|length %}
{% else %}
{% set cartLength = 0 %}
{% endif %}
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-600 opacity-75"></span>
<span class="relative inline-flex rounded-full h-4 w-4 bg-red-500 text-xs pt-1 flex-center text-white">{{ cartLength }}</span>
</span>
</button>
<div class="cart ">
<div
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">
<h2 class="font-DanaMedium text-lg">سبد خرید <span class="text-sm text-gray-400 font-Dana">
({{ cartLength }}
مورد)</span></h2>
<svg class="size-5 cursor-pointer close-cart mb-.5">
<use href="#x-mark"/>
</svg>
</div>
<div class="flex flex-col divide-y-2 divide-gray-200 dark:divide-gray-600 my-4">
{% if cart['order'] is defined and cart['order'] is not null %}
{% for item in cart['order'].orderItems %}
<div class="grid grid-cols-12 gap-x-2 w-full py-4 cursor-pointer">
<div class="col-span-4 w-24 h-20">
{% if item.product.imageUrl is defined and item.product.imageUrl is not null %}
<img class="rounded-lg" src="{{ item.product.imageUrl }}" alt="">
{% elseif item.product.productImages[0] is defined %}
<img class="rounded-lg" src="{{ item.product.productImages[0].imageUrl }}"
alt="">
{% endif %}
</div>
<div class="col-span-8 flex flex-col justify-between">
<h2 class="font-DanaMedium line-clamp-2">
{{ item.product.name }}
</h2>
<div class="flex items-center justify-between gap-x-2 mt-2">
<button
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">
{{ item.quantity }} x
</button>
{# <p class="text-lg text-blue-500 dark:text-blue-400 font-DanaMedium">1,130,000 #}
{# <span class="font-Dana text-sm">تومان</span> #}
{# </p> #}
</div>
</div>
</div>
{% endfor %}
{% else %}
سبد خرید خالی می باشد
{% endif %}
</div>
{% if cartLength > 0 %}
<div class="w-[90%] fixed bottom-2 flex items-center justify-between border-t-2 border-gray-200 dark:border-gray-600 pt-4">
<div>
<p class="text-gray-500 dark:text-gray-300 text-sm">مبلغ قابل پرداخت :</p>
<p class="text-lg text-blue-500 dark:text-blue-400 font-DanaDemiBold">{{ cart.total|number_format }}
<span class="font-Dana text-sm">تومان</span>
</p>
</div>
<a href="{{ path('app_shop_site_cart') }}"
class="py-2 px-4 bg-blue-600 flex-center hover:bg-blue-700 transition-all rounded-lg text-gray-200">
ثبت سفارش
</a>
</div>
{% endif %}
</div>
</div>
</div>
<div class="relative flex-between h-16 bg-gray-900 dark:bg-gray-800 rounded-full text-gray-200 px-10">
{% set menu = get_menu_data('headerMenu') %}
{% if menu['items'] is defined %}
<ul class="flex items-center gap-x-8 m-auto">
{% for item in menu['items'] %}
{% if item['children'] is defined and item['children']|length > 0 %}
<li class="menu-item group">
<a href="{{ item['link'] }}" class="menu-item_link cursor-pointer">
{{ item['title'] }}
</a>
<ul class="solid-menu">
{% for children in item['children'] %}
<li>
<a href="{{ children['link'] }}">{{ children['title'] }}</a>
</li>
{% endfor %}
</ul>
</li>
{% else %}
<li class="menu-item">
<a href="{{ item['link'] }}">{{ item['title'] }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</div>
</div>
<div class="flex justify-center lg:hidden">
<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">
<button class="open-menu-mobile flex-center p-2 app-border rounded-full">
<svg class=" size-6">
<use href="#bars"/>
</svg>
</button>
<div class="mobile-menu z-50 flex flex-col">
<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%} ">
<a href="{{ path('app_shop_site_index') }}" class="text-xl font-MorabbaMedium">
{% set title = getSettings('general_info_siteName') %}
{% set parts = title|split(' ') %}
<span class="text-blue-500">
{{ parts|slice(0, parts|length - 1)|join(' ') }}
</span> {{ parts|last }}
</a>
<button class="close-menu-mobile">
<svg class="size-5 text-gray-500 dark:text-gray-200">
<use href="#x-mark"/>
</svg>
</button>
</div>
{% set menu = get_menu_data('headerMenu') %}
{% if menu['items'] is defined %}
<ul class="flex flex-col gap-y-2 text-gray-800 dark:text-gray-100 mt-4">
{% for item in menu['items'] %}
<li class="mobile-menu-item">
<a href="{{ item['link'] }}">{{ item['title'] }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<a href="{{ path('app_shop_site_index') }}" class="flex flex-col text-center">
<span class="font-MorabbaMedium text-3xl flex items-center">
{% set title = getSettings('general_info_siteName') %}
{% set parts = title|split(' ') %}
<span class="text-blue-500">
{{ parts|slice(0, parts|length - 1)|join(' ') }}
</span> {{ parts|last }}
</span>
</a>
<button class="toggle-theme flex-center p-2 app-border rounded-full ">
<svg class="inline-block dark:hidden size-6">
<use href="#moon"/>
</svg>
<svg class="hidden dark:inline size-6">
<use href="#sun"/>
</svg>
</button>
</nav>
<button class="open-mobile_search-modal">
<svg class=" size-6">
<use href="#search"/>
</svg>
<p>جستجو در
{% set title = getSettings('general_info_siteName') %}
{% set parts = title|split(' ') %}
<span class="text-blue-500">
{{ parts|slice(0, parts|length - 1)|join(' ') }}
</span> {{ parts|last }}
</p>
</button>
<div class="mobile_search-modal">
<div class="w-full flex items-center gap-x-2">
<form action="{{ path('app_shop_site_products') }}" method="get"
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">
<svg class="size-6">
<use href="#search"/>
</svg>
<input name="s" type="text" placeholder="جستجو در همه کالاها">
<button type="submit">جستجو</button>
</form>
<svg class="size-6 close-mobile_search-modal">
<use href="#x-mark"/>
</svg>
</div>
</div>
<ul class="bottom-navbar">
<li {% if app.request.attributes.get('_route') == 'app_shop_site_index' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
<svg class="size-5">
<use href="#home"/>
</svg>
<a href="{{ path('app_shop_site_index') }}">خانه</a>
</li>
<li {% if app.request.attributes.get('_route') == 'app_shop_site_products' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
<svg class="size-5">
<use href="#squares"/>
</svg>
<a href="{{ path('app_shop_site_products') }}">فروشگاه</a>
</li>
<li {% if app.request.attributes.get('_route') == 'cart_checkout' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
<svg class="size-5">
<use href="#shopping-bag"/>
</svg>
<a href="{{ path('cart_checkout') }}">سبد خرید</a>
</li>
<li {% if app.request.attributes.get('_route') == 'customer_panel_user_handler' %} class="dark:text-sky-400 text-blue-500 font-DanaMedium" {% endif %}>
<svg class="size-5">
<use href="#user"/>
</svg>
<a href="{{ path('customer_panel_user_handler') }}">حساب من</a>
</li>
</ul>
</div>
</header>