@extends('layouts.app') @section('title', 'Reservations') @section('page_title', 'Reservations') @section('page_subtitle', 'Manage all hotel reservations') @section('nav_reservations', 'bg-teal-50 text-teal-700 font-semibold') @section('content') @if (session('success'))

{{ session('success') }}

@endif @if (session('error'))

{{ session('error') }}

@endif {{-- ===== STAT CARDS ===== --}}

Arrivals Today

{{ $stats['arrivals_today'] }}

Check-ins due

Departures Today

{{ $stats['departures_today'] }}

Check-outs due

In-House

{{ $stats['in_house'] }}

Currently staying

Available Rooms

{{ $stats['available_rooms'] }}

of {{ $stats['total_rooms'] }} total

Occupancy Rate

{{ $stats['occupancy_rate'] }}%

{{ now()->format('F j, Y') }}

{{-- END STAT CARDS --}} {{-- ===== TABLE CARD ===== --}}
{{-- Toolbar --}}
{{-- preserve sort/dir across filter submissions --}} @if(request('sort'))@endif @if(request('dir'))@endif
{{-- Row 1: title + new button --}}
@if($trashed)

Trash

{{ count($reservations) }} @else

All Reservations

{{ count($reservations) }}{{ $hasFilters ? ' filtered' : '' }} @endif
@if(!$trashed && $trashedCount > 0) Trash ({{ $trashedCount }}) @endif @if(!$trashed) New Reservation @endif
{{-- Row 2: filters --}}
{{-- Search --}}
{{-- Status (hidden in trash view) --}} @if(!$trashed) @endif {{-- Pass trashed flag through filter form --}} @if($trashed)@endif {{-- Source --}} {{-- Check-in range --}}
Check-in
@if($hasFilters) Clear @endif
{{-- Active filter pills --}} @if($hasFilters)
Filters: @if($search !== '') "{{ $search }}" @endif @if($status !== '') {{ str_replace('_',' ', ucfirst($status)) }} @endif @if($source !== '') {{ $source }} @endif @if($from !== '') From {{ \Carbon\Carbon::parse($from)->format('M j, Y') }} @endif @if($to !== '') To {{ \Carbon\Carbon::parse($to)->format('M j, Y') }} @endif
@endif
{{-- Table --}}
@foreach ($reservations as $res) @endforeach
@php $bnDir = ($sort === 'booking_no' && $dir === 'asc') ? 'desc' : 'asc'; @endphp Booking # @if ($sort === 'booking_no') @if ($dir === 'asc') @else @endif @else @endif Guest Room @php $ciDir = ($sort === 'check_in' && $dir === 'asc') ? 'desc' : 'asc'; @endphp Check-in @if ($sort === 'check_in') @if ($dir === 'asc') @else @endif @else @endif @php $coDir = ($sort === 'check_out' && $dir === 'asc') ? 'desc' : 'asc'; @endphp Check-out @if ($sort === 'check_out') @if ($dir === 'asc') @else @endif @else @endif Status Deposit Amount Actions
@if($trashed) {{ $res['booking_no'] }} @else {{ $res['booking_no'] }} @endif @if ($res['group_id']) @endif
{{ strtoupper(substr($res['guest_name'], 0, 1)) }}{{ strtoupper(substr(explode(' ', $res['guest_name'])[1] ?? 'X', 0, 1)) }}

{{ $res['guest_name'] }}

{{ $res['pax'] }} pax

Room {{ $res['room_no'] }}

{{ $res['room_type'] }}

{{ \Carbon\Carbon::parse($res['check_in'])->format('M j, Y') }}

@if ($res['check_in'] === now()->format('Y-m-d') && $res['status'] === 'confirmed')

Today

@endif

{{ \Carbon\Carbon::parse($res['check_out'])->format('M j, Y') }}

@if ($res['check_out'] === now()->format('Y-m-d') && $res['status'] === 'checked_in')

Due Today

@endif
@php $badges = [ 'pending' => 'bg-amber-50 text-amber-700 border-[0.5px] border-amber-200', 'confirmed' => 'bg-teal-50 text-teal-700 border-[0.5px] border-teal-200', 'checked_in' => 'bg-green-50 text-green-700 border-[0.5px] border-green-200', 'checked_out' => 'bg-gray-50 text-gray-500 border-[0.5px] border-gray-200', 'cancelled' => 'bg-red-50 text-red-600 border-[0.5px] border-red-200', 'no_show' => 'bg-orange-50 text-orange-600 border-[0.5px] border-orange-200', ]; $labels = [ 'pending' => 'Pending', 'confirmed' => 'Confirmed', 'checked_in' => 'Checked In', 'checked_out' => 'Checked Out', 'cancelled' => 'Cancelled', 'no_show' => 'No Show', ]; @endphp @if ($res['status'] === 'checked_in') @endif {{ $labels[$res['status']] ?? $res['status'] }} @if ($res['deposit_paid']) ₱{{ number_format($res['deposit_amount'], 0) }} @else @endif

₱{{ number_format($res['amount'], 2) }}

₱{{ number_format($res['rate'], 0) }}/night

@if($trashed) {{-- Trash actions: Restore + Permanent Delete --}}
@csrf
@if(auth()->user()->isAdmin())
@csrf @method('DELETE')
@endif
@else {{-- Normal actions --}}
@if (in_array($res['status'], ['confirmed', 'pending']))
@csrf
@endif @if ($res['status'] === 'checked_in')
@csrf
@endif
@if ($res['status'] === 'pending')
@csrf
@endif @if ($res['status'] === 'checked_out')
@csrf
@endif @if ($res['status'] === 'checked_in')
@csrf
@endif @if (in_array($res['status'], ['cancelled', 'no_show']))
@csrf
@endif @if (in_array($res['status'], ['checked_out', 'checked_in', 'cancelled', 'no_show']))
@endif @if (in_array($res['status'], ['confirmed', 'pending']))
@csrf
@endif @if (in_array($res['status'], ['pending', 'confirmed', 'checked_in']))
@csrf
@endif
@csrf @method('DELETE')
@endif
{{-- Table Footer --}}

{{ $reservations->total() }} {{ $hasFilters ? 'matching' : 'total' }} reservation{{ $reservations->total() !== 1 ? 's' : '' }} @if($hasFilters) — show all @endif

{{ $reservations->links() }}
@endsection