Add more airlines and fix edit bugs
This commit is contained in:
@@ -137,12 +137,12 @@ class FlightController extends Controller
|
||||
'flight_class' => $flight->flightClass->toArray(),
|
||||
'flight_reason' => $flight->flightReason->toArray(),
|
||||
'airline_options' => $flight->airline
|
||||
? [['value' => $flight->airline->id, 'title' => $flight->airline->name]]
|
||||
? [['value' => $flight->airline->id, 'title' => $flight->airline->displayName()]]
|
||||
: [],
|
||||
'from_options' => [['value' => $flight->departureAirport->id, 'title' => $flight->departureAirport->name, 'country_code' => strtolower($flight->departureAirport->region->country->code)]],
|
||||
'to_options' => [['value' => $flight->arrivalAirport->id, 'title' => $flight->arrivalAirport->name, 'country_code' => strtolower($flight->arrivalAirport->region->country->code)]],
|
||||
'from_options' => [['value' => $flight->departureAirport->id, 'title' => $flight->departureAirport->displayName(), 'country_code' => strtolower($flight->departureAirport->region->country->code)]],
|
||||
'to_options' => [['value' => $flight->arrivalAirport->id, 'title' => $flight->arrivalAirport->displayName(), 'country_code' => strtolower($flight->arrivalAirport->region->country->code)]],
|
||||
'aircraft_options' => $flight->aircraft
|
||||
? [['value' => $flight->aircraft->id, 'title' => $flight->aircraft->name]]
|
||||
? [['value' => $flight->aircraft->id, 'title' => $flight->aircraft->displayName()]]
|
||||
: [],
|
||||
];
|
||||
return Inertia::render('AddFlight', [
|
||||
|
||||
@@ -55,9 +55,9 @@ class FlightImportController extends Controller
|
||||
->orderBy('model_full_name')
|
||||
->limit(10)
|
||||
->get(['id', 'manufacturer_code', 'model_full_name', 'designator'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->manufacturer_code} {$a->model_full_name} ({$a->designator})",
|
||||
->map(fn($aircraft) => [
|
||||
'value' => $aircraft->id,
|
||||
'title' => $aircraft->displayName(),
|
||||
])
|
||||
->values()
|
||||
->toArray();
|
||||
@@ -92,10 +92,10 @@ class FlightImportController extends Controller
|
||||
->limit(10)
|
||||
->orderBy('id')
|
||||
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->municipality} / {$a->name} ({$a->iata_code}/{$a->icao_code})",
|
||||
'country_code' => strtolower($a?->region->country->code ?? ''),
|
||||
->map(fn($airport) => [
|
||||
'value' => $airport->id,
|
||||
'title' => $airport->displayName(),
|
||||
'country_code' => strtolower($airport?->region->country->code ?? ''),
|
||||
])
|
||||
->values()
|
||||
->toArray();
|
||||
@@ -129,9 +129,9 @@ class FlightImportController extends Controller
|
||||
->orderByDesc('active')
|
||||
->limit(10)
|
||||
->get(['id', 'name', 'IATA_code', 'ICAO_code'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->name} ({$a->IATA_code}/{$a->ICAO_code})",
|
||||
->map(fn($airline) => [
|
||||
'value' => $airline->id,
|
||||
'title' => $airline->displayName(),
|
||||
])
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
@@ -27,9 +27,9 @@ class SearchController extends Controller
|
||||
})
|
||||
->limit(50)
|
||||
->get(['id', 'name', 'IATA_code', 'ICAO_code', 'logo'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->name} ({$a->IATA_code}/{$a->ICAO_code})",
|
||||
->map(fn($airline) => [
|
||||
'value' => $airline->id,
|
||||
'title' => $airline->displayName(),
|
||||
])
|
||||
->values();
|
||||
}
|
||||
@@ -45,9 +45,9 @@ class SearchController extends Controller
|
||||
->limit(200)
|
||||
->orderBy('id', 'asc')
|
||||
->get(['id', 'manufacturer_code', 'model_full_name', 'designator'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->manufacturer_code} {$a->model_full_name} ({$a->designator})",
|
||||
->map(fn($aircraft) => [
|
||||
'value' => $aircraft->id,
|
||||
'title' => $aircraft->displayName(),
|
||||
])
|
||||
->values();
|
||||
}
|
||||
@@ -74,10 +74,10 @@ class SearchController extends Controller
|
||||
", [$q, $q]))
|
||||
->limit(15)
|
||||
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id'])
|
||||
->map(fn($a) => [
|
||||
'value' => $a->id,
|
||||
'title' => "{$a->municipality} / {$a->name} ({$a->iata_code}/{$a->icao_code})",
|
||||
'country_code' => strtolower($a->region->country->code),
|
||||
->map(fn($airport) => [
|
||||
'value' => $airport->id,
|
||||
'title' => $airport->displayName(),
|
||||
'country_code' => strtolower($airport->region->country->code),
|
||||
])
|
||||
->values();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user