@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) { $variantItems = $product->relationLoaded('variants') ? $product->getRelation('variants') : $product->variants()->with('discount')->get(); foreach ($variantItems as $variant) { $variantDiscount = $variant->relationLoaded('discount') ? $variant->getRelation('discount') : $variant->discount() ->where('type', 'amazing') ->where('start_time', '<=', now()) ->where('end_time', '>', now()) ->latest('end_time') ->first(); if ($variantDiscount && $variantDiscount->type === 'amazing' && \Illuminate\Support\Carbon::parse($variantDiscount->end_time)->greaterThan(now())) { $discountModel = $variantDiscount; 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; $sellableVariants = $product->sellableVariants(); if ($sellableVariants->count() > 0) { $firstItem = $sellableVariants->first(); $displayPrice = $firstItem->cached_product_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->sellableVariants(); $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