{{-- Reusable Product Card — exact UI match Usage: @include('front.partials.product-card', ['product' => $product]) --}} @php $sizeOrder = ['XS', 'S', 'M', 'L', 'XL']; $inStock = $product->variants->where('in_stock', true); $allColors = $inStock->whereNotNull('color_code')->unique('color_code')->take(7); $allSizes = $inStock->whereIn('size', $sizeOrder) ->unique('size') ->sortBy(fn($v) => array_search($v->size, $sizeOrder)) ->values(); $minPrice = $inStock->min('price'); $maxPrice = $inStock->max('price'); @endphp
{{-- ── Image + Hover Actions ── --}}
{{-- Hover Buttons --}}
{{-- ── Product Content ── --}}
{{-- Title --}}
{{ $product->title }}
{{-- Sizes --}} @if($allSizes->count() > 0)
@foreach($allSizes as $variant)
@endforeach
@endif {{-- Color Swatches — color click pe image AJAX se change hogi --}} @if($allColors->count() > 0)
@foreach($allColors as $color)
@endforeach
@endif {{-- Price --}}
@if($minPrice && $maxPrice) @if($minPrice == $maxPrice) ${{ number_format($minPrice, 2) }} @else ${{ number_format($minPrice, 2) }} – ${{ number_format($maxPrice, 2) }} @endif @else — @endif
{{-- Buttons --}}