{{-- ── Filter & Sort Toolbar ─────────────────────────────────────────── --}}
{{-- Search --}}
{{-- Category Filter --}} @if($categories->isNotEmpty()) @endif {{-- Sort --}} {{-- Result count --}} {{ $products->total() }} {{ Str::plural('product', $products->total()) }}
{{-- ── Product Grid ──────────────────────────────────────────────────── --}}
@if($products->isEmpty())

No products found.

@if($search) @endif
@else
@foreach($products as $product) @php $imageUrl = $product->getFirstMediaUrl('images', 'webp') ?: '/images/placeholder.jpg'; $price = (float) ($product->sale_price ?? $product->price); $oldPrice = $product->sale_price ? (float) $product->price : null; $inStock = $product->quantity > 0; $isFeatured = $product->is_featured; $discount = ($oldPrice && $oldPrice > $price) ? round((1 - $price / $oldPrice) * 100) : null; @endphp {{-- Image --}}
{{ $product->name }} {{-- Badges --}}
@if($discount) -{{ $discount }}% @endif @if($isFeatured) ⭐ Featured @endif
{{-- Out of stock overlay --}} @unless($inStock)
Out of Stock
@endunless
{{-- Info --}}

{{ $product->category?->name ?? '' }}

{{ $product->name }}

{{-- Price --}}
৳{{ number_format($price, 0) }} @if($oldPrice) ৳{{ number_format($oldPrice, 0) }} @endif
{{-- Stock indicator --}}
@if($inStock) In Stock @else Out of Stock @endif
@endforeach
{{-- Pagination --}} @if($products->hasPages())
{{ $products->links() }}
@endif @endif