@extends('layouts.app') @section('title', 'Passenger Details') @section('content') @php $isFingerprintOnlyViewer = auth()->user()->branch_id && auth()->user()->branch_id === ($passenger->booking?->fingerprint_branch_id) && auth()->user()->branch_id !== ($passenger->booking?->booking_branch_id); $canViewFinancialSection = auth()->user()->roles->pluck('name')->intersect(['Super Admin', 'Co Admin', 'Auditor'])->isNotEmpty(); $canViewVisaSection = auth()->user()->roles->pluck('name')->intersect(['Super Admin', 'Co Admin', 'Visa Admin', 'Visa Staff'])->isNotEmpty(); $canDeleteDocument = auth()->user()->roles->pluck('name')->intersect(['Super Admin', 'Co Admin'])->isNotEmpty() || (auth()->user()->hasRole('Fingerprint Admin') && auth()->user()->branch_id && (auth()->user()->branch_id === ($passenger->booking?->fingerprint_branch_id) || auth()->user()->branch_id === ($passenger->booking?->booking_branch_id))); @endphp

{{ trim($passenger->first_name . ' ' . $passenger->last_name) }}

Invoice: {{ $passenger->booking?->invoice?->id ?? '-' }}

@php $canEditPassenger = !$isFingerprintOnlyViewer && (auth()->user()->hasRole('Super Admin') || auth()->user()->hasRole('Co Admin') || auth()->user()->branch_id || $passenger->booking->user_id === auth()->id()); @endphp @if($canEditPassenger) Edit @endif

Basic Information

Full Name

{{ trim($passenger->first_name . ' ' . $passenger->last_name) ?: '-' }}

Passport No.

{{ $passenger->passport_no ?? '-' }}

Passport Expiry

{{ $passenger->passport_expiry?->format('d M Y') ?? '-' }}

Date of Birth

{{ $passenger->date_of_birth?->format('d M Y') ?? '-' }}

Passenger Type

{{ ucfirst($passenger->passenger_type?->value ?? '-') }}

Mobile No.

{{ $passenger->mobile_no ?? '-' }}

Service Information

Package

{{ $passenger->booking?->package?->package_name ?? '-' }}

Service Required

{{ match($passenger->service_required?->value) { 'all' => 'Visa + Ticket', 'visa_only' => 'Visa Only', 'ticket_only' => 'Ticket Only', default => '-' } }}

Status

{{ $passenger->status?->name ?? '-' }}

Fingerprint Location

{{ match($passenger->booking?->fingerprint_location?->value) { 'home' => 'Home', 'office' => 'Office', default => '-' } }}

Travel Details

Route

{{ $routeDisplay ?? '-' }}

Airline

{{ $passenger->ticketFare?->airline?->name ?? '-' }}

Class

{{ $passenger->ticketFare?->airlineClass?->class?->name ?? '-' }}

Flight Date Range

@if($passenger->flight_date_from && $passenger->flight_date_to) {{ $passenger->flight_date_from->format('d M Y') }} → {{ $passenger->flight_date_to->format('d M Y') }} @else - @endif

PNR

{{ $passenger->latestIssuedTicket?->pnr ?? '-' }}

Ticket Number

{{ $passenger->latestIssuedTicket?->ticket_number ?? '-' }}

Address (BD)

{{ $passenger->address ?? '-' }}

@if($canViewFinancialSection)

Financial Details

Ticket Fare (SAR)

@currency($ticketFare, 2, $rate)

Visa Price (SAR)

@currency($visaCost, 2, $rate)

Fingerprint Charge (SAR)

@currency($fingerprintCost, 2, $rate)

Due (SAR)

@currency($due, 2, $rate)

Paid (SAR)

@currency($paid, 2, $rate)

@endif

Documents

@if($passenger->documents->count() > 0) @endif

Max 5 MB per file, 20 MB total. Allowed: PDF, JPG, PNG

@forelse($passenger->documents as $doc)
{{ $doc->display_name }}
@if($canDeleteDocument) @endif
@empty

No documents uploaded

@endforelse
@if($canViewVisaSection) {{-- Visa Submission History --}}

Visa Submission History

@php $vsStatus = $passenger->visaSubmission?->status?->value; @endphp
@forelse($historyRows as $row) @php $date = $row['date'] instanceof \Carbon\Carbon ? $row['date']->format('d M Y') : $row['date']; @endphp @empty @endforelse
Date Agent Agent Cost Add. Cost Agent Commission Status Cancellation Fee
{{ $date }} {{ $row['agent'] }} @if($row['agent_cost'])SAR {{ number_format($row['agent_cost'], 2) }}@else N/A @endif @if($row['add_cost'])SAR {{ number_format($row['add_cost'], 2) }}@else N/A @endif @if($row['agent_commission'])SAR {{ number_format($row['agent_commission'], 2) }}@else N/A @endif @switch($row['status']) @case('submitted') Submitted @break @case('issued') Issued @break @case('cancelled') Cancelled @break @default {{ ucfirst($row['status'] ?? 'Pending') }} @endswitch @if($row['cancellation_fee'])SAR {{ number_format($row['cancellation_fee'], 2) }}@else - @endif
No visa submission found
@endif
@if($canViewVisaSection) @endif @php $visaSubData = $passenger->visaSubmission ? [ 'id' => $passenger->visaSubmission->id, 'visa_agent' => $passenger->visaSubmission->visaAgent ? ['id' => $passenger->visaSubmission->visaAgent->id, 'name' => $passenger->visaSubmission->visaAgent->name] : null, 'net_visa_cost' => (float)($passenger->visaSubmission->net_visa_cost ?? 0), 'additional_cost' => (float)($passenger->visaSubmission->additional_cost ?? 0), 'final_cost' => (float)($passenger->visaSubmission->final_cost ?? 0), 'status' => $passenger->visaSubmission->status?->value, ] : null; $visaSellingPriceValue = (float)( $passenger->visaSubmission?->visaSellingPrice?->selling_price ?? $passenger->booking?->package?->visaSellingPrice?->selling_price ?? 0 ); @endphp @endsection