Compare commits

...

2 Commits

Author SHA1 Message Date
dredgy 9631e7949d Save user flights 2026-04-05 18:52:24 +10:00
dredgy d0fe6d78d3 Save user flights 2026-04-05 18:49:02 +10:00
5 changed files with 63 additions and 5 deletions
@@ -83,7 +83,7 @@ class FlightImportController extends Controller
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id']) ->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id'])
->map(fn($a) => [ ->map(fn($a) => [
'value' => $a->id, 'value' => $a->id,
'title' => "{$a->name} ({$a->iata_code}/{$a->icao_code})", 'title' => "{$a->municipality} / {$a->name} ({$a->iata_code}/{$a->icao_code})",
'country_code' => strtolower($a?->region->country->code ?? ''), 'country_code' => strtolower($a?->region->country->code ?? ''),
]) ])
->values() ->values()
@@ -129,7 +129,7 @@ class FlightImportController extends Controller
{ {
$user = Auth::user(); $user = Auth::user();
$flightToReconcile = ImportedFlight::where('user_id', $user->id)->orderBy('id')->first(); $flightToReconcile = ImportedFlight::where('user_id', $user->id)->orderBy('date', 'asc')->first();
if (!$flightToReconcile) { if (!$flightToReconcile) {
return null; return null;
+1 -1
View File
@@ -66,7 +66,7 @@ class SearchController extends Controller
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id']) ->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id'])
->map(fn($a) => [ ->map(fn($a) => [
'value' => $a->id, 'value' => $a->id,
'title' => "{$a->name} ({$a->iata_code}/{$a->icao_code})", 'title' => "{$a->municipality} / {$a->name} ({$a->iata_code}/{$a->icao_code})",
'country_code' => strtolower($a->region->country->code), 'country_code' => strtolower($a->region->country->code),
]) ])
->values(); ->values();
+1 -2
View File
@@ -14,8 +14,7 @@ class Airline extends Model
'ICAO_code', 'ICAO_code',
'name', 'name',
'internal_name', 'internal_name',
'country_code', 'country_id',
'country_name',
'active', 'active',
'logo', 'logo',
]; ];
@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::table('airlines')
->where('internal_name', 'gol-airlines')
->update([
'ICAO_code' => 'GLO',
'active' => true,
]);
DB::table('airlines')
->where('internal_name', 'jetgo')
->update([
'logo' => 'JG_1.png',
'active' => false,
]);
DB::table('airlines')
->where('internal_name', 'turpial')
->update([
'logo' => 'T9.png',
'IATA_code' => 'T9',
]);
}
public function down(): void
{
DB::table('airlines')
->where('internal_name', 'gol-airlines')
->update([
'ICAO_code' => '',
'active' => false,
]);
DB::table('airlines')
->where('internal_name', 'jetgo')
->update([
'logo' => 'JG.png',
'active' => true,
]);
DB::table('airlines')
->where('internal_name', 'turpial')
->update([
'logo' => '',
'IATA_code' => '',
]);
}
};
+4
View File
@@ -34,6 +34,10 @@ Route::domain(config('app.domain'))->group(
Route::get('/reconcile', function () { Route::get('/reconcile', function () {
$flight = new FlightImportController()->reconcile(request()); $flight = new FlightImportController()->reconcile(request());
if (!$flight) {
return to_route('import.fr24');
}
return Inertia::render('ReconcileFlight', [ return Inertia::render('ReconcileFlight', [
'flight' => $flight, 'flight' => $flight,
'key' => $flight['imported_flight_id'], 'key' => $flight['imported_flight_id'],