@extends('backend.partials.master') @section('title') {{ ___('label.flight_allocation') }} @endsection @section('maincontent')
{{ ___('label.allocated') }}

{{ $allocated }}

{{ ___('label.pending_allocation') }}

{{ $pending }}

{{ ___('label.hajj_pilgrims') }}

{{ $pilgrims->count() }}

{{-- Flights are set up once, here, and then picked from the table below. The seat list comes from the flight's own seat map, so nobody types a seat that does not exist or one that is already somebody else's. --}} @if(hasPermission('hajj_create'))

{{ ___('label.add_flight') }}

@csrf
@error('flight_no') {{ $message }} @enderror
@error('return_date') {{ $message }} @enderror
@error('seat_letters') {{ $message }} @enderror
@if($flights->count())
@foreach($flights as $flight) @php $booked = $flight->pilgrims()->count(); @endphp @endforeach
{{ ___('label.flight_no') }} {{ ___('label.airline') }} {{ ___('label.departure') }} {{ ___('label.return') }} {{ ___('label.seats') }} {{ ___('label.action') }}
{{ $flight->flight_no }} {{ $flight->airline ?: '—' }} {{ $flight->departure_date?->translatedFormat('d M Y') ?: '—' }} {{ $flight->return_date?->translatedFormat('d M Y') ?: '—' }} {{ $booked }} / {{ $flight->seatCount() }} @if(hasPermission('hajj_delete') && $booked === 0) @else — @endif
@endif
@endif {{-- Inputs point at forms rendered after the table; a
wrapping elements is invalid markup and gets hoisted out by the browser. --}} @forelse($pilgrims as $p) @php $fid = 'flight-alloc-' . $p->id; @endphp {{ $p->pilgrim_no }} {{ $p->name }} {{ $p->group_name ?: '—' }} @if(hasPermission('hajj_update') && $flights->count()) {{-- Rendered for the pilgrim's current flight; the script below rebuilds it whenever the flight changes. --}} @else {{ $p->flight_no ?: '—' }} {{ $p->departure_date?->translatedFormat('d M Y') ?: '—' }} {{ $p->return_date?->translatedFormat('d M Y') ?: '—' }} {{ $p->seat_no ?: '—' }} @if(hasPermission('hajj_update')){{ ___('label.add_a_flight_first') }}@else—@endif @endif @empty {{ ___('alert.no_data_available') }} @endforelse @if(hasPermission('hajj_update')) @foreach($pilgrims as $p) @csrf @method('PUT')
@endforeach @endif
@endsection @push('scripts') @endpush