{{-- ═══════════════════════════════════════════════════════ STYLES ═══════════════════════════════════════════════════════════ --}} {{-- Loading Overlay --}}
{{-- ─── Search & Filter Toolbar ─────────────────────────── --}}
@if(!empty($groups))
@foreach($groups as $group) @endforeach
@endif
{{-- Results count --}}

@if($search) {{ __('Results for') }} "{{ $search }}" @else {{ count($meals) }} {{ __('meals available') }} @endif

{{-- ─── Meals Grid ───────────────────────────────────────── --}}
@forelse($meals as $meal) @php $mealImg = $meal['image_url'] ?? ''; $mealImgUrl = str_starts_with($mealImg, 'http') ? $mealImg : ($mealImg ? asset($mealImg) : asset('assets/images/meal-' . ($loop->iteration % 3 === 0 ? 3 : $loop->iteration % 3) . '.png')); $fallback = asset('assets/images/meal-' . ($loop->iteration % 3 === 0 ? 3 : $loop->iteration % 3) . '.png'); $effectivePrice = ($meal['offer_price'] ?? 0) > 0 && $meal['offer_price'] < $meal['price'] ? $meal['offer_price'] : $meal['price']; $hasOffer = ($meal['offer_price'] ?? 0) > 0 && $meal['offer_price'] < $meal['price']; $category = $meal['categories'][0] ?? null; $cartQty = $cartItems['plan_' . $meal['id']]['quantity'] ?? 0; $discount = $hasOffer ? round((1 - $meal['offer_price'] / $meal['price']) * 100) : 0; // Data passed to the Alpine modal $modalData = [ 'id' => $meal['id'], 'name' => $meal['name'], 'description' => $meal['description'] ?? '', 'image' => $mealImgUrl, 'fallback' => $fallback, 'price' => $effectivePrice, 'original_price' => $meal['price'], 'has_offer' => $hasOffer, 'discount' => $discount, 'cat_name' => $category['name'] ?? null, 'cat_icon' => $category['icon'] ?? null, 'tag_name' => $meal['tag_name'] ?? '', 'rate' => $meal['rate'] ?? 0, 'calories' => $meal['calories'] ?? null, 'protein' => $meal['protein'] ?? null, 'carbs' => $meal['carbs'] ?? null, 'fat' => $meal['fat'] ?? null, ]; @endphp
{{-- Image with hover "View" overlay --}}
{{ $meal['name'] }} @if($category) @if(!empty($category['icon'])) @endif {{ $category['name'] }} @endif @if(($meal['rate'] ?? 0) > 0) {{ number_format($meal['rate'], 1) }} @endif
{{-- Card Body --}}
@if(!empty($meal['tag_name'])) {{ $meal['tag_name'] }} @endif

{{ $meal['name'] }}

@empty

{{ $search ? __('No results for') . ' "' . $search . '"' : __('No meals found') }}

{{ $search ? __('Try a different search term or clear filters.') : __('Try adjusting your filters.') }}

@endforelse
{{-- ─── Pagination ───────────────────────────────────────── --}} @if($lastPage > 1)
@for($i = 1; $i <= $lastPage; $i++) @endfor
@endif {{-- ═══════════════════════════════════════════════════════ PRODUCT DETAIL MODAL (Alpine.js — no server round-trip) ═══════════════════════════════════════════════════════════ --}}
{{-- ─── Alpine component ─────────────────────────────────── --}}