From 05a6d1da0e5a915661f01f787188b1c2d761306b Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 19 May 2026 12:45:56 +1000 Subject: [PATCH] Added Notifications --- .../Controllers/FlightImportController.php | 7 +++--- .../2026_05_19_020525_reason_fix.php | 25 +++++++++++++++++++ resources/js/Pages/ReconcileFlight.vue | 16 +++++++----- 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 database/migrations/2026_05_19_020525_reason_fix.php diff --git a/app/Http/Controllers/FlightImportController.php b/app/Http/Controllers/FlightImportController.php index b0c37d5..316a1f1 100644 --- a/app/Http/Controllers/FlightImportController.php +++ b/app/Http/Controllers/FlightImportController.php @@ -154,10 +154,9 @@ class FlightImportController extends Controller 'duration' => $this->formatTime($flightToReconcile->duration), 'registration' => $flightToReconcile->registration ?? '', 'note' => $flightToReconcile->note ?? '', - 'seat_number' => $flightToReconcile->seat_number ?? '', - 'flight_class' => $flightToReconcile->flight_class ?? '', - 'seat_type' => $flightToReconcile->seat_type ?? '', - 'flight_reason' => $flightToReconcile->flight_reason ?? '', + 'flight_class' => $flightToReconcile->flight_class !== null ? (int) $flightToReconcile->flight_class : null, + 'seat_type' => $flightToReconcile->seat_type !== null ? (int) $flightToReconcile->seat_type : null, + 'flight_reason' => $flightToReconcile->flight_reason !== null ? (int) $flightToReconcile->flight_reason : null, 'airline_options' => $this->getPossibleAirlines($flightToReconcile->airline ?? ''), 'to_options' => $this->getPossibleAirports($flightToReconcile->to ?? ''), 'from_options' => $this->getPossibleAirports($flightToReconcile->from ?? ''), diff --git a/database/migrations/2026_05_19_020525_reason_fix.php b/database/migrations/2026_05_19_020525_reason_fix.php new file mode 100644 index 0000000..a2437df --- /dev/null +++ b/database/migrations/2026_05_19_020525_reason_fix.php @@ -0,0 +1,25 @@ +delete(); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +}; diff --git a/resources/js/Pages/ReconcileFlight.vue b/resources/js/Pages/ReconcileFlight.vue index e1a2ede..7a39b5c 100644 --- a/resources/js/Pages/ReconcileFlight.vue +++ b/resources/js/Pages/ReconcileFlight.vue @@ -47,9 +47,9 @@ const form = useForm({ aircraft: flight.aircraft_options[0] ?? null, registration: flight.registration, seat_number: flight.seat_number, - seat_type: flight.seat_types[flight.seat_type], - flight_class: flight.flight_classes[flight.flight_class], - flight_reason: flight.flight_reasons[flight.flight_reason], + seat_type: flight.seat_types.find(s => s.value === flight.seat_type)?.value ?? null, + flight_class: flight.flight_classes.find(c => c.value === flight.flight_class)?.value ?? null, + flight_reason: flight.flight_reasons.find(r => r.value === flight.flight_reason)?.value ?? null, note: flight.note, }); @@ -74,6 +74,7 @@ const submitForm = useForm({ }); function submit() { + submitForm.imported_flight_id = form.imported_flight_id; submitForm.date = form.date; submitForm.flight_number = form.flight_number; @@ -86,14 +87,17 @@ function submit() { submitForm.aircraft_id = form.aircraft?.value ?? null; submitForm.registration = form.registration; submitForm.seat_number = form.seat_number; - submitForm.seat_type_id = form.seat_type?.value ?? null; - submitForm.flight_class_id = form.flight_class?.value ?? null; - submitForm.flight_reason_id = form.flight_reason?.value ?? null; + submitForm.seat_type_id = form.seat_type; + submitForm.flight_class_id = form.flight_class; + submitForm.flight_reason_id = form.flight_reason; submitForm.note = form.note; submitForm.post(route('import.save')); } +import { watch } from 'vue' +watch(() => form.flight_reason, (val) => console.log('flight_reason changed:', val)) +