@extends('layouts.user') @section('styles') @endsection @section('content')
{{-- Search — submit ke route yang sama dengan query param --}}
{{-- Filter Pills — link ke route dengan query param --}}
@php $pills = [ 'all' => [ 'icon' => '', 'label' => 'Semua', ], 'avail' => ['icon' => '', 'label' => 'Tersedia'], 'nearest' => [ 'icon' => '', 'label' => 'Terdekat', ], 'popular' => [ 'icon' => '', 'label' => 'Populer', ], 'cheapest' => [ 'icon' => '', 'label' => 'Termurah', ], ]; $currentFilter = request('filter', 'all'); $currentQ = request('q', ''); @endphp @foreach ($pills as $key => $pill) {!! $pill['icon'] !!} {{ $pill['label'] }} @endforeach
{{-- Results Header --}}
@if ($currentQ) Hasil "{{ $currentQ }}" @else Lokasi Parkir @endif {{ $lokasis->count() }} lokasi
{{-- Location Cards --}}
@forelse($lokasis as $lokasi) @php $status = $lokasi->status_slot; // avail | busy | full $statusMap = ['avail' => 'Tersedia', 'busy' => 'Hampir Penuh', 'full' => 'Penuh']; $slotText = $status === 'full' ? 'Penuh' : $lokasi->slot_tersedia . ' Slot Free'; $slotClass = $status === 'avail' ? 'has-slot' : ($status === 'busy' ? 'few-slot' : 'no-slot'); $harga = 'Rp ' . number_format($lokasi->harga_per_jam, 0, ',', '.') . '/jam'; @endphp {{-- Image --}}
@if ($lokasi->foto) {{ $lokasi->nama }} @else
🏬
@endif {{-- Status Badge --}}
{{ $statusMap[$status] }}
{{-- Jam operasional --}} @if ($lokasi->jam_buka && $lokasi->jam_tutup)
{{ \Carbon\Carbon::parse($lokasi->jam_buka)->format('H:i') }} - {{ \Carbon\Carbon::parse($lokasi->jam_tutup)->format('H:i') }}
@endif
{{ $lokasi->nama }}
{{ $lokasi->alamat }}
{{-- Tags: total slot & kode unik --}}
{{ $lokasi->total_slot_aktif }} slot total @if ($lokasi->kode_unik) # {{ $lokasi->kode_unik }} @endif
@empty
Lokasi tidak ditemukan
@if ($currentQ) Tidak ada hasil untuk "{{ $currentQ }}", coba kata kunci lain. @else Belum ada lokasi parkir yang tersedia. @endif
@endforelse
@endsection @section('scripts') @endsection