@extends('layouts.storefront') @section('title', 'المنتجات — متجر الكتب') @section('breadcrumb')
@endsection @section('content') @php $currentSort = $filters['sort'] ?? 'latest'; $baseQuery = request()->except(['page']); $wowDelays = ['0.30s', '0.40s', '0.50s', '0.60s', '0.70s', '0.80s', '0.90s', '0.95s']; @endphp
@if ($shopTags->isNotEmpty()) {{-- Tags are the secondary way into a book, beside the category tree. Each chip keeps whatever the visitor already filtered on, and the active one drops the tag instead of stacking a second copy of the same filter. --}} @endif

عرض {{ $products->firstItem() ?? 0 }}–{{ $products->lastItem() ?? 0 }} من {{ $products->total() }} كتاب

@foreach ($baseQuery as $key => $value) @if ($key !== 'sort' && filled($value)) @endif @endforeach
@if ($products->isEmpty())

لا توجد نتائج

لم نعثر على كتب مطابقة لفلاترك. جرّب توسيع نطاق البحث أو مسح بعض الفلاتر.

مسح الفلاتر
@else
@foreach ($products as $book) @php $displayedFormat = $book->displayedFormat(); $prices = $book->formats ->map(fn ($format) => $format->discountedSellingPrice()) ->filter(fn ($price) => $price > 0) ->values(); $lowestPrice = $displayedFormat?->discountedSellingPrice(); $highestPrice = $prices->max(); $maxSellingPrice = (float) $book->formats->max('selling_price'); $hasDiscount = $lowestPrice !== null && $maxSellingPrice > 0 && $lowestPrice < $maxSellingPrice; $discountPercent = $hasDiscount ? (int) round((1 - $lowestPrice / $maxSellingPrice) * 100) : 0; $hasFormats = $book->formats->isNotEmpty(); $inStock = $book->formats->contains(fn ($format) => $format->isAvailable()); $authorNames = $book->authors->pluck('name')->take(2)->implode('، '); @endphp
غلاف {{ $book->title }}
    @if (! $hasFormats)
  • غير متاح
  • @elseif (! $inStock)
  • نفدت الكمية
  • @endif @if ($hasDiscount)
  • خصم
  • -{{ $discountPercent }}%
  • @endif
({{ number_format((float) $book->average_rating, 1) }})
    @if ($hasDiscount)
  • {{ number_format($maxSellingPrice, 2) }}
  • @endif
  • @if ($lowestPrice === null) — @elseif ($lowestPrice < $highestPrice) {{ $lowestPrice == $highestPrice ? '' : 'يبدأ من ' }}{{ number_format($lowestPrice, 2) }} ج.م @else {{ number_format($lowestPrice, 2) }} ج.م @endif
@if ($authorNames) By: {{ $authorNames }} @endif

{{ $book->title }}

@endforeach
{{ $products->links('vendor.pagination.storefront') }}
@endif
@endsection @push('scripts') @endpush