@php $price = $booking->receivable_price ?? 0; $tax = $booking->tax_amount ?? 0; // ── Booking items (for nights/room meta) ───────────────────────── $items = collect( is_array($booking->booking_items) ? $booking->booking_items : json_decode($booking->booking_items ?? '[]', true) ); $nights = (!empty($booking->checkin) && !empty($booking->checkout)) ? \Carbon\Carbon::parse($booking->checkin)->diffInDays(\Carbon\Carbon::parse($booking->checkout)) : 1; $firstItemRoom = collect($items->first()['rooms'] ?? [])->first(); $roomDescription = $firstItemRoom['description'] ?? ($firstItemRoom['room_type'] ?? ''); $boardingDetails = $items->first()['boarding_details'] ?? []; $roomCount = $items->sum(fn($i) => count($i['rooms'] ?? [])); // ── Passenger details from booking->passenger_details ──────────── // Structure: [{ rooms: [{ paxes: [{title,name,surname,type,age?}] }] }] $passengerData = is_array($booking->passenger_details) ? $booking->passenger_details : json_decode($booking->passenger_details ?? '[]', true); // Flatten all paxes, tagging each with their room number $allPaxes = []; foreach ($passengerData as $pdItem) { $roomIndex = 1; foreach ($pdItem['rooms'] ?? [] as $room) { foreach ($room['paxes'] ?? [] as $pax) { $allPaxes[] = array_merge($pax, ['room_no' => $roomIndex]); } $roomIndex++; } } $allPaxesCollection = collect($allPaxes); $totalAdults = $allPaxesCollection->where('type', 'AD')->count(); $totalChildren = $allPaxesCollection->where('type', 'CH')->count(); // ── Status color ───────────────────────────────────────────────── $statusLower = strtolower($booking->status ?? ''); $statusColor = match($statusLower) { 'confirmed' => '#27ae60', 'cancelled' => '#eb5757', 'pending' => '#f2994a', default => '#27ae60', }; $booked_by = trim($booking->user->name ?? 'Agent'); $booked_email = trim($booking->user->email ?? 'Agent'); if ($booking->agency_id && $booking->agency) { $booked_by = trim($booking->agency->agency_name); $booked_email = trim($booking->agency->agency_email); } @endphp
{{-- ══════════════════════════════════════════════ HEADER ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ BOOKING CONFIRMATION BANNER Booked By (left) | BOOKING CONFIRMATION + ID + Date (right) ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ SECTION 1 — BOOKING DETAILS ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ SECTION 2 — PASSENGER DETAILS TABLE Columns: # | Full Name | Type | Age | Room ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ SECTION 3 — PRICE BREAKUP TABLE Columns: Description | Amount ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ NOTES ══════════════════════════════════════════════ --}} {{-- ══════════════════════════════════════════════ FOOTER ══════════════════════════════════════════════ --}}
@php $logoPath = public_path('uploads/site/' . $mailConfig->logo); $logoBase64 = file_exists($logoPath) ? 'data:image/' . pathinfo($logoPath, PATHINFO_EXTENSION) . ';base64,' . base64_encode(file_get_contents($logoPath)) : ''; @endphp Logo
أجياد الدولية للسفر والسياحة
AJYAD INTERNATIONAL TRAVEL & TOURISM
C.R.1161992  ·  P.O Box 202, Postal Code 101, City Center
Tel: 24511355 / 98583083  ·  Email: op@ajyadintl.com
Booked By
{{ $booked_by }}
{{ $booked_email }}
RECEIPT
Booking ID {{ $booking->booking_id }}
Booking Date {{ \Carbon\Carbon::parse($booking->booking_date)->format('d-m-Y') }}
✓ {{ ucfirst($booking->status) }}
Booking Details
@if(!empty($roomDescription)) @endif @if(!empty($boardingDetails)) @endif
Check-in {{ \Carbon\Carbon::parse($booking->checkin)->format('d-m-Y H:i') }}
Check-out {{ \Carbon\Carbon::parse($booking->checkout)->format('d-m-Y H:i') }}
Guests {{ $totalAdults }} Adult{{ $totalAdults != 1 ? 's' : '' }}@if($totalChildren > 0), {{ $totalChildren }} Child{{ $totalChildren != 1 ? 'ren' : '' }}@endif
Reservation {{ $roomCount }} Room{{ $roomCount != 1 ? 's' : '' }}  ·  {{ $nights }} Night{{ $nights != 1 ? 's' : '' }}
Room Type {{ $roomDescription }}
Meal Plan {{ implode(', ', $boardingDetails) }}
Passenger Details
{{-- Header --}} @foreach($allPaxes as $idx => $pax) @endforeach
# Full Name Type Age Room
{{ $idx + 1 }} {{ trim(($pax['title'] ?? '') . ' ' . ($pax['name'] ?? '') . ' ' . ($pax['surname'] ?? '')) }} @if(($pax['type'] ?? '') === 'AD') Adult @else Child @endif {{ !empty($pax['age']) ? $pax['age'] . ' yrs' : '—' }} Room {{ $pax['room_no'] }}
Price Breakup
{{-- Header --}} {{-- Base price (price minus tax) --}} {{-- Subtotal --}} {{-- Tax --}} @if($tax > 0) @endif {{-- Total --}}
Description Amount ({{ $booking->currency }})
Hotel Charges {{ number_format($price - $tax, 2) }}
Subtotal {{ number_format($price - $tax, 2) }}
Tax {{ number_format($tax, 2) }}
Total {{ $booking->currency }} {{ number_format($price, 2) }}
@if($tax > 0)

*Prices exclusive of applicable taxes

@endif
{{ $booking->hotel_name }} @if(!empty($booking->city_name)), {{ $booking->city_name }}@endif
@if(!empty($booking->hotel_address))
{{ $booking->hotel_address }}
@endif

Thank you for choosing {{ $mailConfig->title ?? config('app.name') }}. We look forward to welcoming you :)
Please carry a valid photo ID at check-in.

@if(!empty($mailConfig->phone)){{ $mailConfig->phone }}  ·  @endif © {{ date('Y') }} {{ $mailConfig->title ?? config('app.name') }}. This is a system-generated booking confirmation.