{{-- Shared Flight Booking form fields. Wrapped by create.blade.php and edit.blade.php. Expects: $item (null on create), $customers, $bookings, $statuses, $cities. --}} @php $app = $item ?? null; $flightDate = old('flight_date', $app && $app->flight_date ? $app->flight_date->format('Y-m-d') : ''); // Existing route strings may be "DAC→DXB", "DAC -> DXB" or "Dhaka -> Dubai"; // split them back and match each side by code or city name, so the // From/To pickers prefill on edit. $routeParts = $app && $app->route ? preg_split('/\s*(?:→|->|—|–|-)\s*/', trim($app->route), 2) : []; $fromValue = old('from', ''); $toValue = old('to', ''); foreach ([0 => 'fromValue', 1 => 'toValue'] as $idx => $target) { $part = $routeParts[$idx] ?? ''; if ($$target === '' && $part !== '') { $match = $cities->first(fn ($c) => strcasecmp((string) $c->city, $part) === 0 || (string) $c->code === $part); $$target = $match ? $match->city : ''; } } @endphp
{{ ___('label.main_booking_hint') }} @error('booking_id') {{ $message }} @enderror @error('customer_id') {{ $message }} @enderror
{{ ___('label.passenger_name_hint') }} @error('passenger_name') {{ $message }} @enderror
@error('pnr') {{ $message }} @enderror
@error('airline') {{ $message }} @enderror
@error('route') {{ $message }} @enderror
@error('route') {{ $message }} @enderror
{{-- The composed route (e.g. "DAC -> DXB") is what the DB stores; the From/To selects above are just a friendlier way to pick it. --}}
@error('flight_date') {{ $message }} @enderror
@error('ticket_no') {{ $message }} @enderror
@error('fare') {{ $message }} @enderror
@error('status') {{ $message }} @enderror
{{ ___('label.cancel') }}
@push('scripts') @endpush