@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->model : ""}}
--}}کد : {{isset($product) ? $product->vendor_code : ""}}
{{ number_format($displayPrice) }} ریال
عیار : {{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