@if (isset($flightData) && !empty($flightData)) @php $airline = $flightData['airline'] ?? 'unknown'; $isEmirate = $airline === 'emirate'; $isFlyJinnah = $airline === 'flyjinnah'; $isAirblue = $airline === 'airblue'; $isPIA = $airline === 'pia'; $logo = $flightData['airline'] ?? 'default'; // Handle Airblue flights array structure if ($isAirblue && isset($flightData['flights']) && is_array($flightData['flights'])) { $flights = $flightData['flights']; $totalPrice = 0; $totalBase = 0; $totalTax = 0; $totalFees = 0; foreach ($flights as $flightItem) { if (isset($flightItem['bundle'])) { $totalPrice += (float) ($flightItem['bundle']['total_price'] ?? 0); $totalBase += (float) ($flightItem['bundle']['base_price'] ?? 0); $totalTax += (float) ($flightItem['bundle']['taxes'] ?? 0); $totalFees += (float) ($flightItem['bundle']['fees'] ?? 0); } } } else { // Original structure for flyjinnah and emirates $departure = $flightData['departure'] ?? null; $originCode = $departure['departure']['code'] ?? ''; $destinationCode = $departure['arrival']['code'] ?? ''; $depTime = $departure['departure']['time'] ?? ''; $arrTime = $departure['arrival']['time'] ?? ''; $depTimeDiff = $departure['duration'] ?? ''; $depDate = $departure['departure']['date'] ?? ''; $stopCount = count($departure['segments'] ?? []) - 1; $hasReturn = isset($flightData['return']); if ($hasReturn) { $return = $flightData['return']; $returnOriginCode = $return['departure']['code'] ?? ''; $returnDestinationCode = $return['arrival']['code'] ?? ''; $returnDepTime = $return['departure']['time'] ?? ''; $returnArrTime = $return['arrival']['time'] ?? ''; $returnTimeDiff = $return['duration'] ?? ''; $returnStopCount = count($return['segments'] ?? []) - 1; } $outboundBundle = $flightData['firstBundle'] ?? null; $returnBundle = $flightData['returnBundle'] ?? null; // For PIA, extract price from the total_price_pkr field if ($isPIA) { $totalPrice = (float) ($flightData['total_price_pkr'] ?? 0); $totalBase = $totalPrice; // PIA doesn't provide separate breakdown $totalTax = 0; $totalFees = 0; } else { $totalPrice = ($outboundBundle['total_price'] ?? 0) + ($returnBundle['total_price'] ?? 0); $totalBase = ($outboundBundle['base_price'] ?? 0) + ($returnBundle['base_price'] ?? 0); $totalTax = ($outboundBundle['taxes'] ?? 0) + ($returnBundle['taxes'] ?? 0); $totalFees = ($outboundBundle['fees'] ?? 0) + ($returnBundle['fees'] ?? 0); } } @endphp {{-- ==================== FLIGHT ITINERARY ==================== --}}

Your Bookings

@if ($isAirblue && isset($flights) && count($flights) > 2)
  • Multi-City Flight

  • {{--

    {{ count($flights) }} {{ Str::plural('Leg', count($flights)) }}

    --}}
@else
  • Departing

  • {{ $depDate ?? '' }}

@endif
{{ strtoupper($logo) }}
@if ($isAirblue && isset($flights)) {{-- Airblue Multi-City Flights --}} @foreach ($flights as $index => $flightItem) @php $flight = $flightItem['departure'] ?? null; if (!$flight) { continue; } $originCode = $flight['departure']['code'] ?? ''; $destinationCode = $flight['arrival']['code'] ?? ''; $depTime = $flight['departure']['time'] ?? ''; $arrTime = $flight['arrival']['time'] ?? ''; $depTimeDiff = $flight['duration'] ?? ''; $depDate = $flight['departure']['date'] ?? ''; $stopCount = count($flight['segments'] ?? []) - 1; $legNumber = $index + 1; @endphp
{{-- Leg {{ $legNumber }} --}} {{ $depDate }}
  • {{ $depTime }}

  • {{ $depTimeDiff }}

  • {{ $arrTime }}

  • {{ $originCode }}

  • {{ $stopCount > 0 ? $stopCount . ' ' . Str::plural('Stop', $stopCount) : 'Nonstop' }}

  • {{ $destinationCode }}

@endforeach @else {{-- Original Structure for FlyJinnah and Emirates --}} {{-- Outbound Flight --}} @if (isset($departure))
  • {{ $depTime }}

  • {{ $depTimeDiff }}

  • {{ $arrTime }}

  • {{ $originCode }}

  • {{ $stopCount > 0 ? $stopCount . ' ' . Str::plural('Stop', $stopCount) : 'Nonstop' }}

  • {{ $destinationCode }}

@endif {{-- Return Flight --}} @if (isset($hasReturn) && $hasReturn)
  • {{ $returnDepTime }}

  • {{ $returnTimeDiff }}

  • {{ $returnArrTime }}

  • {{ $returnOriginCode }}

  • {{ $returnStopCount > 0 ? $returnStopCount . ' ' . Str::plural('Stop', $returnStopCount) : 'Nonstop' }}

  • {{ $returnDestinationCode }}

@endif @endif
{{-- ==================== PRICE SUMMARY ==================== --}}

Price Summary

@if ($isEmirate) {{-- Emirates Special Handling --}} @if (!empty($flightData['flightDetails']['bundle']['offerItem'] ?? [])) @foreach ($flightData['flightDetails']['bundle']['offerItem'] as $offer)

{{ $offer['fareDetail']['passengers'] ?? 'Passenger' }}

PKR {{ number_format($offer['totalPrice']['amount'] ?? 0) }}

@endforeach @else

Flight Fare

PKR {{ number_format($flightData['flightDetails']['bundle']['totalPrice']['amount'] ?? 0) }}

@endif

Taxes & Fees

PKR {{ $tax ?? 0 }}

@elseif ($isFlyJinnah) {{-- FlyJinnah --}}

Flight {{ isset($flightData['isDirectBooking']) && !$flightData['isDirectBooking'] ? 'with Bundle' : 'Price' }}

{{ $totalFare['TotalFare']['@attributes']['CurrencyCode'] ?? 'PKR' }} {{ $totalFare['TotalFare']['@attributes']['Amount'] ?? 0 }}

Tax

PKR {{ $tax ?? 0 }}

@elseif ($isPIA) {{-- PIA --}}

Flight Fare ({{ $flightData['paxCount']['adt'] ?? 1 }} {{ ($flightData['paxCount']['adt'] ?? 1) > 1 ? 'Adults' : 'Adult' }})

PKR {{ number_format((float) ($flightData['total_price_pkr'] ?? 0)) }}

@if (($flightData['paxCount']['chd'] ?? 0) > 0)

Children ({{ $flightData['paxCount']['chd'] }})

Included

@endif @if (($flightData['paxCount']['inf'] ?? 0) > 0)

Infants ({{ $flightData['paxCount']['inf'] }})

Included

@endif

Outbound Bundle: {{ strtoupper($flightData['outbound_bundle'] ?? 'N/A') }}

@if (isset($flightData['inbound_bundle']))

Inbound Bundle: {{ strtoupper($flightData['inbound_bundle']) }}

@endif
@else {{-- All Other Airlines (Airblue, SereneAir, etc.) --}} @if ($isAirblue && isset($flights)) {{-- Airblue Multi-City Flights --}} @foreach ($flights as $index => $flightItem) @php $bundle = $flightItem['bundle'] ?? null; if (!$bundle) { continue; } $flight = $flightItem['departure'] ?? null; $originCode = $flight['departure']['code'] ?? ''; $destinationCode = $flight['arrival']['code'] ?? ''; $routeLabel = $originCode && $destinationCode ? "{$originCode}-{$destinationCode}" : 'Flight'; @endphp
{{ $bundle['bundle_name'] ?? 'Standard' }} ({{ $routeLabel }}) PKR {{ number_format((float) ($bundle['total_price'] ?? 0)) }}
@endforeach
Base FarePKR {{ number_format($totalBase) }}
TaxesPKR {{ number_format($totalTax) }}
Fees & ChargesPKR {{ number_format($totalFees) }}
@else {{-- Original Structure for Other Airlines --}}
{{ $outboundBundle['bundle_name'] ?? 'Standard' }} ({{ isset($hasReturn) && $hasReturn ? 'Outbound' : 'Flight' }}) PKR {{ number_format($outboundBundle['total_price'] ?? 0) }}
@if (isset($returnBundle) && $returnBundle)
{{ $returnBundle['bundle_name'] ?? 'Standard' }} (Return) PKR {{ number_format($returnBundle['total_price'] ?? 0) }}
@endif
Base FarePKR {{ number_format($totalBase) }}
TaxesPKR {{ number_format($totalTax) }}
Fees & ChargesPKR {{ number_format($totalFees) }}
@endif @endif {{-- Total Price --}}

Total price you pay

PKR {{ number_format( $isEmirate ? ($flightData['flightDetails']['bundle']['totalPrice']['amount'] ?? 0) + ($tax ?? 0) : ($isFlyJinnah ? ($totalFare['TotalFare']['@attributes']['Amount'] ?? 0) + ($tax ?? 0) : $totalPrice + ($tax ?? 0)), ) }}

{{-- ==================== PENALTIES (Only for Emirates + All Others, excluding PIA and FlyJinnah) ==================== --}} @if ($isEmirate || (!$isEmirate && !$isFlyJinnah && !$isPIA))

Penalties

Show details

@endif @endif