@props([ 'product', 'showCountdown' => false, ]) @php $countdownEndIso = null; if ($showCountdown && isset($product)) { $discountModel = null; if ($product->relationLoaded('discount')) { $loadedDiscount = $product->getRelation('discount'); if ($loadedDiscount && $loadedDiscount->type === 'amazing' && \Illuminate\Support\Carbon::parse($loadedDiscount->end_time)->greaterThan(now())) { $discountModel = $loadedDiscount; } } if (!$discountModel) { $discountModel = $product->discount() ->where('type', 'amazing') ->where('start_time', '<=', now()) ->where('end_time', '>', now()) ->latest('end_time') ->first(); } if (!$discountModel) { $items = $product->relationLoaded('productItem') ? $product->getRelation('productItem') : $product->productItem() ->whereHas('discount', function ($query) { $query->where('type', 'amazing') ->where('start_time', '<=', now()) ->where('end_time', '>', now()); }) ->with(['discount' => function ($query) { $query->where('type', 'amazing') ->where('start_time', '<=', now()) ->where('end_time', '>', now()); }]) ->get(); foreach ($items as $item) { $itemDiscount = null; if ($item->relationLoaded('discount')) { $loadedItemDiscount = $item->getRelation('discount'); if ($loadedItemDiscount && $loadedItemDiscount->type === 'amazing' && \Illuminate\Support\Carbon::parse($loadedItemDiscount->end_time)->greaterThan(now())) { $itemDiscount = $loadedItemDiscount; } } else { $itemDiscount = $item->discount() ->where('type', 'amazing') ->where('start_time', '<=', now()) ->where('end_time', '>', now()) ->latest('end_time') ->first(); } if ($itemDiscount) { $discountModel = $itemDiscount; break; } } } if ($discountModel) { $discountEnd = \Illuminate\Support\Carbon::parse($discountModel->end_time); if ($discountEnd->greaterThan(now())) { $countdownEndIso = $discountEnd->toIso8601String(); } } } @endphp @include('components.front.countdown.assets')
{{--
--}} {{-- --}} {{--
--}}

{{ isset($product) ? $product->title : '' }}

{{--

مدل : {{isset($product) ? $product->model : ""}}

--}}

کد : {{isset($product) ? $product->vendor_code : ""}}

@if($product->status == 0) توقف تولید @else @php $displayPrice = $product->product_price; $displayFinalPrice = $product->final_price; $displayHasDiscount = $product->has_discount; $displayDiscountPercent = $product->discount_percent; if ($product->productItem()->available()->count() > 0) { $firstItem = $product->productItem()->available()->first(); $displayPrice = $firstItem->price; $displayFinalPrice = $firstItem->final_price; $displayHasDiscount = $firstItem->has_discount; $displayDiscountPercent = $firstItem->discount_percent ?? 0; } @endphp @if($displayPrice == 0) به زودی ... @else @if($displayHasDiscount) {{ number_format($displayFinalPrice) }} ریال {{ $displayDiscountPercent }}%

{{ number_format($displayPrice) }} ریال

@else {{ number_format($displayPrice) }} ریال @endif @endif @endif
@if($showCountdown && $countdownEndIso)
00 روز
00 ساعت
00 دقیقه
00 ثانیه
@endif @if($product->category->title !== 'کارت هدیه')

عیار : {{isset($product) && $product->karat? $product->karat->title : "" }}

@php $productItems = $product->productItem ?? collect(); // جلوگیری از null // فقط آیتم‌هایی که is_sold == 0 هستند $productItems = $productItems->where('is_sold', 0); // مرتب‌سازی بر اساس وزن $productItems = $productItems->sortBy('weight')->values(); $itemCount = $productItems->count(); @endphp @if($itemCount > 1) @php $firstWeight = (float) $productItems->first()->weight; $lastWeight = (float) $productItems->last()->weight; @endphp @if($firstWeight === $lastWeight)

وزن {{ $firstWeight }}

@else

از وزن {{ $firstWeight }} تا {{ $lastWeight }}

@endif @elseif($itemCount === 1)

وزن {{ (float) $productItems->first()->weight }}

@else

وزن {{ (float) $product->default_weight }}

@endif

مناسب : @if(isset($product)) @foreach($product->productUsage as $key => $proUsage) {{$proUsage->title}} {{$key !== count($product->productUsage) -1 ? ',' : ''}} @endforeach @endif

@endif