@php use App\Support\DocumentBrand; $settings = $businessSettings ?? []; ['brand' => $brand, 'brandDark' => $brandDark] = DocumentBrand::colors($settings); $logoPath = DocumentBrand::logoPath($settings['business_logo'] ?? null); $hotel = $hotelBooking->hotel; $customer = $hotelBooking->customer; $checkIn = $hotelBooking->check_in_date; $checkOut = $hotelBooking->check_out_date; $nights = $checkIn && $checkOut ? max($checkIn->diffInDays($checkOut), 1) : null; $voucherNo = 'HV-'.str_pad((string) $hotelBooking->id, 5, '0', STR_PAD_LEFT); $status = (string) $hotelBooking->reservation_status; [$pillClass, $pillText] = match ($status) { 'confirmed', 'checked_in', 'checked_out', 'completed' => ['pill-paid', strtoupper(str_replace('_', ' ', $status))], 'cancelled', 'no_show' => ['pill-due', strtoupper(str_replace('_', ' ', $status))], default => ['pill-part', strtoupper(str_replace('_', ' ', $status ?: 'pending'))], }; // The list is stored as names, or as rows with a name key, depending on the // form that wrote it; both read the same here. $guests = collect($hotelBooking->guest_list ?? []) ->map(fn ($g) => is_array($g) ? ($g['name'] ?? null) : $g) ->filter() ->values(); @endphp Hotel voucher {{ $voucherNo }} @include('documents._styles', ['brand' => $brand, 'brandDark' => $brandDark])
 
{{-- Masthead ------------------------------------------------------------ --}}
@if ($logoPath) @endif @if (!empty($settings['business_name']))

{{ $settings['business_name'] }}

@endif @if (!empty($settings['business_address']))

{{ $settings['business_address'] }}

@endif @if (!empty($settings['business_phone']))

{{ $settings['business_phone'] }}

@endif @if (!empty($settings['business_email']))

{{ $settings['business_email'] }}

@endif

HOTEL VOUCHER

{{ $voucherNo }} · issued {{ now()->format('d M Y') }}

{{ $pillText }}

{{-- Guest / hotel panels --------------------------------------------------- --}}

GUEST

{{ $customer?->full_name ?: ($guests->first() ?: 'Guest') }}

@if ($customer?->email)

{{ $customer->email }}

@endif @if ($customer?->phone)

{{ $customer->phone }}

@endif

@if ($guests->isNotEmpty()){{ $guests->count() }} {{ \Illuminate\Support\Str::plural('guest', $guests->count()) }} · @endif{{ (int) $hotelBooking->number_of_rooms }} {{ \Illuminate\Support\Str::plural('room', (int) $hotelBooking->number_of_rooms) }}

HOTEL

{{ $hotel?->name ?: '—' }}

@if ($hotel?->star_rating)

{{ str_repeat('★', (int) $hotel->star_rating) }} {{ (int) $hotel->star_rating }}-star

@endif @if ($hotel?->country?->name)

{{ $hotel->country->name }}

@endif @if ($hotelBooking->roomType?->name)

Room category: {{ $hotelBooking->roomType->name }}

@endif
{{-- Stay summary: the three numbers a front desk looks for ---------------- --}}
CHECK-IN CHECK-OUT NIGHTS ROOMS ROOM TYPE
{{ $checkIn?->format('D, d M Y') ?: '—' }} {{ $checkOut?->format('D, d M Y') ?: '—' }} {{ $nights ?? '—' }} {{ (int) $hotelBooking->number_of_rooms }} {{ $hotelBooking->roomType?->name ?: '—' }}
{{-- Guests ----------------------------------------------------------------- --}}

GUEST LIST

@forelse ($guests as $i => $name) @empty @endforelse
# NAME
{{ $i + 1 }} {{ $name }}
No guest names were recorded on this booking.
{{-- Instructions ------------------------------------------------------------ --}}
Please present this voucher at check-in. The reservation is held in the guest's name shown above under reference {{ $voucherNo }}. Standard check-in and check-out times of the hotel apply unless otherwise agreed. @if (!empty($settings['business_phone'])) For any assistance during the stay, contact {{ $settings['business_phone'] }}. @endif
{{ $settings['business_name'] ?? 'Thank you for booking with us' }} @if (!empty($settings['business_email'])) · {{ $settings['business_email'] }} @endif @if (!empty($settings['business_phone'])) · {{ $settings['business_phone'] }} @endif
This voucher was generated electronically and is valid without a signature. Please quote {{ $voucherNo }} in any correspondence.