{{-- resources/views/productcard.blade.php --}} @extends('layouts.master') @section('title', $activeMid->name ?? 'Products') @section('content')
{{-- LEFT: Sidebar (25%) --}} {{-- RIGHT: Main area (75%) --}}

@if ($activeTop && $activeMid) {{ $activeTop->name }} / {{ $activeMid->name }} @elseif ($activeTop) {{ $activeTop->name }} @elseif ($activeMid) {{ $activeMid->name }} @else Products @endif

@if (!empty($activeMid->description))
{{ $activeMid->description }}
@endif
{{-- Products grid: show initial 4 cards (server-side). We'll provide Load more to fetch additional via AJAX. --}}
@if ($activeMid && $activeMid->products->count()) @foreach ($activeMid->products->all() as $product) {{-- compute image url + highlight flag inside loop so variables are defined --}} @php // Use the controller-normalized public URL (single source of truth) $imgUrl = $product->main_image_url ?? asset('assets/img/placeholder.png'); $title = $product->product_name ?? ($product->name ?? 'Product'); $isHighlighted = $activeMid && ($product->mid_category_id ?? ($product->mid_category?->id ?? null)) == $activeMid->id; @endphp
{{-- clickable image with modal preview --}}
{{ e($title) }} @if (!empty($product->badge))
{{ $product->badge }}
@endif

{{ $title }}

{{-- @if (!empty($product->short_description))

{{ \Illuminate\Support\Str::limit(strip_tags($product->short_description), 90) }}

@endif --}}
@endforeach @else
No products found in this category.
@endif
{{-- Image preview modal --}} @push('styles') @endpush @push('scripts') @endpush
@endsection