{% extends getThemeDir('base.html.twig') %}
{% block body %}
<div class="container">
{% if order %}
<section class="flex flex-col lg:flex-row justify-between items-start gap-4 child:rounded-lg child:bg-white child:dark:bg-gray-800 child:shadow child:p-4 mt-5">
<div class="w-full lg:w-3/4 flex flex-col gap-y-8 ">
<div class="flex items-center justify-between">
<span class="flex items-center gap-x-2">
<h2 class="font-DanaMedium text-xl">سبد خرید</h2>
<p class="text-gray-400">(2 کالا)</p>
</span>
</div>
<div class="w-full flex flex-col gap-y-4 child:p-2 lg:child:p-4 ">
{% for item in order.orderItems %}
<div class="w-full flex justify-between relative border-b-2 border-gray-200 dark:border-white/20 ">
<div class="flex flex-col sm:flex-row items-center gap-6">
<div class="flex w-fit flex-col">
{% if item.product.productImages|length > 0 %}
<img src="{{ item.product.productImages[0].imageUrl }}" class="w-36" alt="">
{% else %}
<img src="/default.jpg" alt="">
{% endif %}
</div>
<div class="flex flex-col gap-y-4">
<h2 class="font-DanaMedium line-clamp-1">
{{ item.product.name }}
</h2>
<ul class="space-y-3 child:text-sm text-gray-400 child:flex child:items-center child:gap-x-1.5">
{% for attr in item.orderItemAttributes %}
<li>
<svg class="w-5 h-5">
<use href="#shield"></use>
</svg>
<p class="mt-1">
{{ attr.attributeName }}: {{ attr.attributeValue }}
</p>
</li>
{% endfor %}
</ul>
<span class="flex items-center gap-x-1 text-gray-700 dark:text-gray-300 font-DanaMedium mt-4">
<p class="font-DanaMedium text-xl">{{ (item.calculatePrice() * item.quantity)|number_format }}</p>
<p class="text-lg">تومان</p>
</span>
<span
class="absolute bottom-3 left-0 text-blue-500 flex sm:hidden items-center gap-x-1 text-sm cursor-pointer">
<a href="{{ path('cart_remove_item' , {'id' : item.id}) }}" class="flex sm:hidden">حذف</a>
<svg class="w-4 h-4">
<use href="#chevron-left"></use>
</svg>
</span>
<svg class=" flex sm:hidden absolute top-0 left-0 w-5 h-5">
<use href="#close"></use>
</svg>
</div>
</div>
<a href="{{ path('cart_remove_item' , {'id' : item.id}) }}" class="hidden sm:flex items-end justify-between flex-col">
<svg class="w-5 h-5 cursor-pointer">
<use href="#x-mark"></use>
</svg>
</a>
</div>
{% endfor %}
</div>
</div>
<!-- PRICE BOX -->
<div class="w-full lg:w-1/4 lg:sticky top-5 flex flex-col gap-y-4">
<!-- PRICE -->
<ul class="child:flex child:items-center child:justify-between space-y-8">
<li>
<p>قیمت کالاها({{ order.orderItems|length }})</p>
<p class="flex gap-x-1 text-gray-600 dark:text-gray-300 ">{{ total|number_format}} <span class="hidden xl:flex">تومان</span></p>
</li>
{% if getSettings('accounting_tax_enabled') %}
<li>
<p>مالیات </p>
<p class="font-DanaMedium text-gray-700 dark:text-gray-200"> {{ getSettings('accounting_tax_amount') }}
درصد</p>
</li>
{% endif %}
<li class="border-t-2 border-dashed border-gray-400 pt-8">
<p> مبلغ نهایی :</p>
<p>{{ total|number_format}} تومان</p>
</li>
</ul>
<a href="{{ path('cart_checkout') }}"
class="w-full mt-4 flex items-center gap-x-1 justify-center bg-blue-500 text-white hover:bg-blue-600 transition-all rounded-lg shadow py-2">
تایید و تکمیل سفارش
<svg class="w-5 h-5">
<use href="#shopping-bag"></use>
</svg>
</a>
</div>
</section>
{% else %}
<section class="flex flex-col items-center justify-center gap-y-3 mt-5">
<img class="max-w-60" src="{{ url('app_cdn_path' , {'path' : 'base-assets/themes/karen/images/svg/empty-cart.svg'})|replaceUrl('http://', 'https://') }}" alt="">
<h1 class="font-DanaDemiBold text-gray-700 dark:text-gray-300 text-2xl mt-2">
سبد خرید شما خالی است!
</h1>
<a class="flex items-center justify-center w-fit text-sky-500" href="{{ path('app_shop_site_products') }}">
مشاهده فروشگاه
<svg class="size-4 mb-0.5">
<use href="#chevron-left"></use>
</svg>
</a>
</section>
{% endif %}
</div>
{% endblock %}