@props(['product', 'showRating' => true]) @php $image = $product->images->sortBy('sort_order')->firstWhere('is_primary', true) ?? $product->images->sortBy('sort_order')->first(); $imageUrl = \App\Helpers\ImageHelper::urlOrPlaceholder($image->image_path ?? null); $price = $product->min_price ?? $product->base_price; $hasDiscount = $product->base_price > $price; $discountPct = $hasDiscount && $product->base_price > 0 ? round((($product->base_price - $price) / $product->base_price) * 100) : 0; $inStock = true; // You can add stock check logic here @endphp
{{ $product->name }} @if($discountPct > 0) {{ $discountPct }}% OFF @endif @if($product->is_featured) NEW @endif @if($inStock) In Stock @endif

{{ $product->name }}

@if($showRating && ($product->average_rating > 0 || ($product->ratings_count ?? 0) > 0))
@for($i = 1; $i <= 5; $i++) @endfor
{{ number_format($product->average_rating ?? 0, 1) }} ({{ $product->ratings_count ?? 0 }})
@endif
{{ $currency_symbol }}{{ number_format($price, 0) }} @if($hasDiscount) {{ $currency_symbol }}{{ number_format($product->base_price, 0) }} @endif
@csrf @if($product->variants && $product->variants->isNotEmpty()) @endif