From e55c77131830a147b5bf0093f978df5e9d6ea2f5 Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 5 Apr 2026 16:40:19 +1000 Subject: [PATCH] Save user flights --- .../Controllers/FlightImportController.php | 12 +-- app/Http/Controllers/SearchController.php | 4 +- resources/js/Layouts/MainLayout.vue | 15 ++-- resources/js/Pages/Fr24Import.vue | 76 ++++++++++--------- resources/js/Pages/ReconcileFlight.vue | 12 ++- routes/web.php | 5 +- 6 files changed, 68 insertions(+), 56 deletions(-) diff --git a/app/Http/Controllers/FlightImportController.php b/app/Http/Controllers/FlightImportController.php index cc4b0ff..76dfda4 100644 --- a/app/Http/Controllers/FlightImportController.php +++ b/app/Http/Controllers/FlightImportController.php @@ -13,6 +13,7 @@ use App\Models\UserFlight; use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Inertia\Inertia; class FlightImportController extends Controller { @@ -168,7 +169,7 @@ class FlightImportController extends Controller $validated = $request->validate([ 'date' => 'required|date', 'imported_flight_id' => 'required|exists:imported_flights,id', - 'flight_number' => 'required|string', + 'flight_number' => 'nullable|string', 'from_id' => 'required|integer|exists:airports,id', 'to_id' => 'required|integer|exists:airports,id', 'dep_time' => 'nullable|date_format:H:i', @@ -238,15 +239,14 @@ class FlightImportController extends Controller 'aircraft_id' => $validated['aircraft_id'] ?? null, 'aircraft_registration' => $validated['registration'] ?? null, 'seat_number' => $validated['seat_number'] ?? null, - 'seat_type_id' => $validated['seat_type_id'] ?? null, - 'flight_class_id' => $validated['flight_class_id'] ?? null, - 'flight_reason_id' => $validated['flight_reason_id'] ?? null, + 'seat_type_id' => $validated['seat_type_id'] ?? 0, + 'flight_class_id' => $validated['flight_class_id'] ?? 0, + 'flight_reason_id' => $validated['flight_reason_id'] ?? 0, 'note' => $validated['note'] ?? null, ]); ImportedFlight::destroy($validated['imported_flight_id']); - - return redirect()->route('reconcile'); + return to_route('reconcile'); } diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 3edc6a5..af04fb3 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -18,7 +18,7 @@ class SearchController extends Controller ->orWhere('IATA_code', 'ilike', "%{$q}%") ->orWhere('ICAO_code', 'ilike', "%{$q}%"); }) - ->limit(15) + ->limit(50) ->get(['id', 'name', 'IATA_code', 'ICAO_code', 'logo']) ->map(fn($a) => [ 'value' => $a->id, @@ -33,7 +33,7 @@ class SearchController extends Controller return Aircraft::where('designator', 'ilike', "%{$q}%") ->orWhereRaw("CONCAT(manufacturer_code, ' ', model_full_name) ilike ?", ["%{$q}%"]) - ->limit(15) + ->limit(200) ->get(['id', 'manufacturer_code', 'model_full_name', 'designator']) ->map(fn($a) => [ 'value' => $a->id, diff --git a/resources/js/Layouts/MainLayout.vue b/resources/js/Layouts/MainLayout.vue index 5eaa878..553ed2b 100644 --- a/resources/js/Layouts/MainLayout.vue +++ b/resources/js/Layouts/MainLayout.vue @@ -1,11 +1,16 @@