{{-- ══════════════════════════════════════════ PAGE HEADER & TOOLBAR ══════════════════════════════════════════ --}}
{{-- Title row --}}

{{ __('hotel::modules.reservation.reservations') }}

{{-- Filter toolbar --}}
{{-- Search --}}
{{-- Date filter --}} {{-- Status filter --}} @foreach($statuses as $status) @endforeach
{{-- ══════════════════════════════════════════ TABLE ══════════════════════════════════════════ --}} @php $statusCfg = [ 'tentative' => ['dot' => 'bg-amber-400', 'badge' => 'bg-amber-50 text-amber-700 ring-amber-200 dark:bg-amber-900/30 dark:text-amber-300 dark:ring-amber-700'], 'confirmed' => ['dot' => 'bg-blue-500', 'badge' => 'bg-blue-50 text-blue-700 ring-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:ring-blue-700'], 'checked_in' => ['dot' => 'bg-emerald-500', 'badge' => 'bg-emerald-50 text-emerald-700 ring-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-300 dark:ring-emerald-700'], 'checked_out' => ['dot' => 'bg-slate-400', 'badge' => 'bg-slate-50 text-slate-600 ring-slate-200 dark:bg-slate-700/40 dark:text-slate-300 dark:ring-slate-600'], 'cancelled' => ['dot' => 'bg-rose-500', 'badge' => 'bg-rose-50 text-rose-700 ring-rose-200 dark:bg-rose-900/30 dark:text-rose-300 dark:ring-rose-700'], 'no_show' => ['dot' => 'bg-orange-400', 'badge' => 'bg-orange-50 text-orange-700 ring-orange-200 dark:bg-orange-900/30 dark:text-orange-300 dark:ring-orange-700'], ]; @endphp
@forelse ($reservations as $reservation) @php $sc = $statusCfg[$reservation->status->value] ?? ['dot' => 'bg-gray-400', 'badge' => 'bg-gray-100 text-gray-600 ring-gray-200']; $initials = collect(explode(' ', $reservation->primaryGuest->full_name))->map(fn($w) => strtoupper($w[0] ?? ''))->take(2)->join(''); @endphp {{-- Reservation # --}} {{-- Guest --}} {{-- Check-in --}} {{-- Check-out --}} {{-- Rooms --}} {{-- Amount --}} {{-- Status --}} {{-- Actions --}} @if((int)($openActionReservationId ?? 0) === (int)$reservation->id) @endif @empty @endforelse
{{ __('hotel::modules.reservation.reservationNumber') }} {{ __('hotel::modules.reservation.guest') }} {{ __('hotel::modules.reservation.checkIn') }} {{ __('hotel::modules.reservation.checkOut') }} {{ __('hotel::modules.reservation.rooms') }} {{ __('hotel::modules.reservation.amount') }} {{ __('hotel::modules.reservation.status') }} {{ __('hotel::modules.reservation.action') }}
{{ $reservation->reservation_number }}
{{ $initials }} {{ $reservation->primaryGuest->full_name }}
{{ $reservation->check_in_date->format('M d, Y') }}
{{ $reservation->check_out_date->format('M d, Y') }}
{{ $reservation->rooms_count }} {{ currency_format($reservation->total_amount) }} {{ $reservation->status->label() }} @php $canViewReservation = user_can('Update Hotel Reservation'); $canEditReservation = user_can('Update Hotel Reservation') && in_array($reservation->status->value, ['tentative', 'confirmed']); $canCancelReservation = user_can('Cancel Hotel Reservation') && in_array($reservation->status->value, ['tentative', 'confirmed']); @endphp @if($canViewReservation || $canEditReservation || $canCancelReservation) @endif
@php $receiptUrl = route('hotel.reservations.receipt', $reservation); $stayIdForFolio = $reservation->stays->first()?->id; $canCheckOut = (bool) $stayIdForFolio && user_can('Check Out Hotel Guest'); @endphp

{{ __('hotel::modules.reservation.noReservationsFound') }}

{{ $reservations->links() }}
{{-- ══════════════════════════════════════════ MODALS ══════════════════════════════════════════ --}} {{-- View / Detail Reservation --}} @if($activeReservation ?? null) @php $titleStatusCfg = [ 'confirmed' => 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-300', 'tentative' => 'bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300', 'checked_in' => 'bg-sky-100 text-sky-800 dark:bg-sky-900/40 dark:text-sky-300', 'checked_out' => 'bg-slate-100 text-slate-700 dark:bg-slate-700 dark:text-slate-300', 'cancelled' => 'bg-rose-100 text-rose-800 dark:bg-rose-900/40 dark:text-rose-300', 'no_show' => 'bg-orange-100 text-orange-800 dark:bg-orange-900/40 dark:text-orange-300', ]; $titleStatusStyle = $titleStatusCfg[$activeReservation->status->value] ?? 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300'; @endphp {{ $activeReservation->reservation_number }} {{ $activeReservation->status->label() }} @endif @if ($showEditReservationModal && $activeReservation)
{{-- ══ Reservation banner ══ --}} @php $nights = $activeReservation->check_in_date->diffInDays($activeReservation->check_out_date); @endphp {{-- ══ SECTION 1: Guest ══ --}}
{{ __('hotel::modules.reservation.guest') }}
{{ collect(explode(' ', $activeReservation->primaryGuest?->full_name ?? ''))->map(fn($w) => strtoupper($w[0] ?? ''))->take(2)->join('') }}

{{ $activeReservation->primaryGuest?->full_name }}

@if($activeReservation->primaryGuest?->phone) {{ $activeReservation->primaryGuest->phone }} @endif @if($activeReservation->primaryGuest?->email) {{ $activeReservation->primaryGuest->email }} @endif
{{-- ══ SECTION 2: Stay Details ══ --}}
{{ __('hotel::modules.checkIn.stayDetails') }}
{{ __('hotel::modules.reservation.checkIn') }} {{ $activeReservation->check_in_date->format('D, M d, Y') }} @if($activeReservation->check_in_time) · {{ \Carbon\Carbon::parse($activeReservation->check_in_time)->format('H:i') }} @endif
{{ __('hotel::modules.reservation.checkOut') }} {{ $activeReservation->check_out_date->format('D, M d, Y') }} @if($activeReservation->check_out_time) · {{ \Carbon\Carbon::parse($activeReservation->check_out_time)->format('H:i') }} @endif
@if($activeReservation->ratePlan)
{{ __('hotel::modules.reservation.ratePlanLabel') }} {{ $activeReservation->ratePlan->name }}
@endif
{{-- ══ SECTION 3: Rooms & Pricing ══ --}}
{{ __('hotel::modules.reservation.rooms') }}
@foreach($activeReservation->reservationRooms as $rr)
{{ $rr->quantity }} {{ $rr->roomType?->name }}
{{ currency_format($rr->rate) }} / {{ __('hotel::modules.reservation.night') }} {{ currency_format($rr->total_amount) }}
@endforeach
{{ __('hotel::modules.reservation.totalStay') }} {{ currency_format($activeReservation->total_amount) }}
{{-- ══ Amount Summary ══ --}} @php $roomsTotal = (float) ($activeReservation->reservationRooms->sum('total_amount') ?? 0); $extrasTotal = (float) ($activeReservation->reservationExtras->sum('total_amount') ?? 0); $grossSubtotal = $roomsTotal + $extrasTotal; $netAfterDiscount = (float) ($activeReservation->subtotal_before_tax ?? 0); $discountAmount = max(0, $grossSubtotal - $netAfterDiscount); $taxAmountSummary = (float) ($activeReservation->tax_amount ?? 0); $totalAmountSummary = (float) ($activeReservation->total_amount ?? 0); $advancePaidSummary = (float) ($activeReservation->advance_paid ?? 0); $securityDepositReservationSummary = (float) ($activeReservation->security_deposit ?? 0); $folioPaymentsSummary = $activeReservation->stays->flatMap(fn($s) => $s->folio ? $s->folio->folioPayments : collect()); $advanceInPaymentsSummary = (float) $folioPaymentsSummary ->filter(fn($p) => ($p->payment_method ?? null) === 'advance') ->sum('amount'); $securityInPaymentsSummary = (float) $folioPaymentsSummary ->filter(fn($p) => ($p->payment_method ?? null) === 'security_deposit') ->sum('amount'); $otherPaymentsSummary = (float) $folioPaymentsSummary ->filter(fn($p) => ! in_array($p->payment_method ?? null, ['advance', 'security_deposit'], true)) ->sum('amount'); $effectiveAdvancePaidSummary = $advanceInPaymentsSummary > 0 ? $advanceInPaymentsSummary : $advancePaidSummary; $effectiveSecurityDepositSummary = $securityInPaymentsSummary > 0 ? $securityInPaymentsSummary : $securityDepositReservationSummary; $totalPaidSummary = (float) ($effectiveAdvancePaidSummary + $effectiveSecurityDepositSummary + $otherPaymentsSummary); $balanceDueSummary = max(0, $totalAmountSummary - $totalPaidSummary); @endphp
{{ __('hotel::modules.reservation.bookingSummary') }}
{{ __('hotel::modules.reservation.roomsPrice') }} {{ currency_format($roomsTotal) }}
@if($extrasTotal > 0)
{{ __('hotel::modules.reservation.extrasPrice') }} {{ currency_format($extrasTotal) }}
@endif
{{ __('hotel::modules.reservation.discount') }} - {{ currency_format($discountAmount) }}
{{ __('hotel::modules.reservation.subtotal') }} {{ currency_format($netAfterDiscount) }}
@php $modalTaxLines = $activeReservation->invoiceTaxes(); @endphp @if($modalTaxLines->isNotEmpty()) @foreach($modalTaxLines as $line)
{{ $line['tax']->name ?? __('hotel::modules.reservation.bookingTax') }} @if($line['tax']->rate !== null && (float) $line['tax']->rate != 0) ({{ $line['tax']->rate }}%) @endif {{ currency_format($line['amount']) }}
@endforeach @else
{{ __('hotel::modules.reservation.bookingTax') }} {{ currency_format($taxAmountSummary) }}
@endif
{{ __('hotel::modules.reservation.total') }} {{ currency_format($totalAmountSummary) }}
{{ __('hotel::modules.reservation.advancePaid') }} {{ currency_format($effectiveAdvancePaidSummary) }}
{{ __('hotel::modules.reservation.securityDeposit') }} {{ currency_format($effectiveSecurityDepositSummary) }}
@if($otherPaymentsSummary > 0)
{{ __('hotel::modules.reservation.totalPaid') }} {{ currency_format($totalPaidSummary) }}
@endif
{{ __('hotel::modules.reservation.balanceDue') }} {{ currency_format($balanceDueSummary) }}
{{-- ══ Special Requests ══ --}} @if($activeReservation->special_requests)
{{ __('hotel::modules.reservation.specialRequestsLabel') }}

{{ $activeReservation->special_requests }}

@endif
{{ __('hotel::modules.reservation.downloadInvoice') }}
@endif
{{ __('app.close') }}
{{-- Cancel Confirmation --}} @if ($activeReservation) {{ __('hotel::modules.reservation.cancelReservation') }} {{ __('hotel::modules.reservation.cancelReservationMessage', ['number' => $activeReservation->reservation_number]) }} {{ __('app.cancel') }} {{ __('hotel::modules.reservation.confirm') }} @endif