@php $company = \App\Models\CompanySetting::current(); $items = $catalog->items; $pages = $items->chunk(5); $isClearance = strtolower((string) ($catalog->permanent_key ?? '')) === 'clearance' || str_contains(strtolower((string) $catalog->title), 'clearance'); $accent = $isClearance ? '#be123c' : '#00a7bc'; $dark = $isClearance ? '#77162f' : '#101d33'; @endphp @foreach($pages as $pageIndex => $pageItems)
WiWU
{{ $isClearance ? 'CLEARANCE PRODUCT CATALOG' : 'MAIN PRODUCT CATALOG' }}
{{ number_format($items->count()) }} Products
{{ now()->format('d M Y') }}
Page {{ $pageIndex+1 }} / {{ $pages->count() }}
@foreach($pageItems as $item) @php $product = $item->product; $photo = $product?->effective_image ?: $item->image; $rawSpecs = trim((string)($item->specification ?: $product?->specification ?: '')); $specLines = array_values(array_filter(array_map('trim', preg_split('/[\r\n;|]+/u', $rawSpecs, -1, PREG_SPLIT_NO_EMPTY) ?: []))); @endphp
@if($photo && file_exists(public_path('storage/'.$photo))) @else No product image @endif
SKU: {{ $item->sku ?: '-' }}
Barcode: {{ $item->barcode ?: '-' }}
{{ strtoupper($product?->category?->name ?? 'WIWU ACCESSORIES') }}
{{ $item->name ?: $product?->name ?: 'Unnamed product' }}
{{ implode(' • ', array_slice($specLines, 0, 6)) }}
AED {{ number_format((float)($item->price ?? 0), 2) }}IN STOCK: {{ number_format((float)($item->qty ?? 0)) }} PCS
@endforeach
@endforeach