From 344edde0fb3647ad6cc6473ddc055070fde60b42 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" <74361521+FatihKoz@users.noreply.github.com> Date: Tue, 6 Apr 2021 01:00:50 +0300 Subject: [PATCH] Alphanumeric Callsign For Flights (#1124) * Alphanumeric Callsign For Flights PR adds ability to define alphanumeric callsigns to flights, display them and use them during SimBrief OFP generation (if pilot ident as callsign option is not enabled) Translations for en/es/it/pt-br added. * Change db table name * Change db column name, fix rules * Change db column name * Another db column name change * Just another one more * Last one from anumeric_callsign to callsign Co-authored-by: Nabeel S --- ...5245_flights_add_alphanumeric_callsign.php | 30 +++++++++++++++++++ app/Models/Flight.php | 3 ++ resources/lang/en/flights.php | 1 + resources/lang/es/flights.php | 1 + resources/lang/it/flights.php | 1 + resources/lang/pt-br/flights.php | 1 + .../views/admin/flights/fields.blade.php | 15 +++++++--- .../layouts/default/flights/show.blade.php | 18 +++++++---- .../default/flights/simbrief_form.blade.php | 2 ++ .../layouts/default/flights/table.blade.php | 8 ++++- 10 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 app/Database/migrations/2021_04_05_055245_flights_add_alphanumeric_callsign.php diff --git a/app/Database/migrations/2021_04_05_055245_flights_add_alphanumeric_callsign.php b/app/Database/migrations/2021_04_05_055245_flights_add_alphanumeric_callsign.php new file mode 100644 index 00000000..0b8af69f --- /dev/null +++ b/app/Database/migrations/2021_04_05_055245_flights_add_alphanumeric_callsign.php @@ -0,0 +1,30 @@ +string('callsign', 4) + ->nullable() + ->after('flight_number'); + }); + } + + public function down() + { + Schema::table('flights', function (Blueprint $table) { + $table->dropColumn('callsign'); + }); + } +} diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 94371226..621f1079 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -15,6 +15,7 @@ use Illuminate\Support\Collection; * @property Airline airline * @property int airline_id * @property mixed flight_number + * @property mixed callsign * @property mixed route_code * @property int route_leg * @property bool has_bid @@ -60,6 +61,7 @@ class Flight extends Model 'id', 'airline_id', 'flight_number', + 'callsign', 'route_code', 'route_leg', 'dpt_airport_id', @@ -104,6 +106,7 @@ class Flight extends Model public static $rules = [ 'airline_id' => 'required|exists:airlines,id', 'flight_number' => 'required', + 'callsign' => 'string|max:4|nullable', 'route_code' => 'nullable', 'route_leg' => 'nullable', 'dpt_airport_id' => 'required|exists:airports,id', diff --git a/resources/lang/en/flights.php b/resources/lang/en/flights.php index 92fb7236..2c9227d2 100644 --- a/resources/lang/en/flights.php +++ b/resources/lang/en/flights.php @@ -5,6 +5,7 @@ return [ 'flighttime' => 'Flight Time', 'flighttype' => 'Flight Type', 'flighthours' => 'Flight Hours', + 'callsign' => 'Callsign', 'route' => 'Route', 'mybid' => 'My Bids', 'search' => 'Search', diff --git a/resources/lang/es/flights.php b/resources/lang/es/flights.php index 792eaf66..b24c3b9e 100644 --- a/resources/lang/es/flights.php +++ b/resources/lang/es/flights.php @@ -5,6 +5,7 @@ return [ 'flighttime' => 'Tiempo de vuelo', 'flighttype' => 'Tipo de vuelo', 'flighthours' => 'Horas de vuelo', + 'callsign' => 'Indicativo', 'route' => 'Ruta', 'mybid' => 'Mis reservas', 'search' => 'Buscar', diff --git a/resources/lang/it/flights.php b/resources/lang/it/flights.php index 986e6377..5bf1cfa5 100644 --- a/resources/lang/it/flights.php +++ b/resources/lang/it/flights.php @@ -5,6 +5,7 @@ return [ 'flighttime' => 'Tempo di Volo', 'flighttype' => 'Tipo di Volo', 'flighthours' => 'Ore di Volo', + 'callsign' => 'Nominativo', 'route' => 'Rotta', 'mybid' => 'Mie Prenotazioni', 'addremovebid' => 'Aggiungi/Rimuovi Prenotazione', diff --git a/resources/lang/pt-br/flights.php b/resources/lang/pt-br/flights.php index a38a0a8d..d6778cdf 100755 --- a/resources/lang/pt-br/flights.php +++ b/resources/lang/pt-br/flights.php @@ -5,6 +5,7 @@ return [ 'flighttime' => 'Tempo do Voo', 'flighttype' => 'Tipo de Voo', 'flighthours' => 'Horas de Voo', + 'callsign' => 'Indicativo', 'route' => 'Rota', 'mybid' => 'Minhas Reservas', 'search' => 'Procurar', diff --git a/resources/views/admin/flights/fields.blade.php b/resources/views/admin/flights/fields.blade.php index a5e9c2cb..40fccb65 100644 --- a/resources/views/admin/flights/fields.blade.php +++ b/resources/views/admin/flights/fields.blade.php @@ -29,15 +29,22 @@ - -
+ +
+ {{ Form::label('callsign', 'Callsign:') }} + {{ Form::text('callsign', null, ['class'=>'form-control', 'placeholder'=>'optional', 'maxlength' => 4]) }} +

{{ $errors->first('callsign') }}

+
+ + +
{{ Form::label('level', 'Flight Type:') }} * {{ Form::select('flight_type', $flight_types, null, ['class' => 'form-control select2']) }}

{{ $errors->first('flight_type') }}

- -
+ +
{{ Form::label('flight_time', 'Flight Time (hours & minutes)') }}
diff --git a/resources/views/layouts/default/flights/show.blade.php b/resources/views/layouts/default/flights/show.blade.php index 62674f0d..02a0ca1c 100644 --- a/resources/views/layouts/default/flights/show.blade.php +++ b/resources/views/layouts/default/flights/show.blade.php @@ -43,12 +43,18 @@ @endif - - - @lang('flights.route') - {{ $flight->route }} - - + @if(filled($flight->route)) + + @lang('flights.route') + {{ $flight->route }} + + @endif + @if(filled($flight->callsign)) + + @lang('flights.callsign') + {{ $flight->airline->icao }} {{ $flight->callsign }} + + @endif @if(filled($flight->notes)) {{ trans_choice('common.note', 2) }} diff --git a/resources/views/layouts/default/flights/simbrief_form.blade.php b/resources/views/layouts/default/flights/simbrief_form.blade.php index b0c170ef..e54aa361 100644 --- a/resources/views/layouts/default/flights/simbrief_form.blade.php +++ b/resources/views/layouts/default/flights/simbrief_form.blade.php @@ -143,6 +143,8 @@ @if(setting('simbrief.callsign', true)) + @else + @endif @if(setting('simbrief.name_private', true)) diff --git a/resources/views/layouts/default/flights/table.blade.php b/resources/views/layouts/default/flights/table.blade.php index e4544861..c0f7162e 100644 --- a/resources/views/layouts/default/flights/table.blade.php +++ b/resources/views/layouts/default/flights/table.blade.php @@ -51,14 +51,20 @@ ])}}">{{$flight->arr_airport_id}}) @if($flight->arr_time), {{ $flight->arr_time }}@endif
+ @if(filled($flight->callsign)) + {{ strtoupper(__('flights.callsign')) }}  + {{ $flight->airline->icao }} {{ $flight->callsign }} +
+ @endif @if($flight->distance) {{ strtoupper(__('common.distance')) }}  {{ $flight->distance }} {{ setting('units.distance') }} +
@endif -
@if($flight->level) {{ strtoupper(__('flights.level')) }}  {{ $flight->level }} {{ setting('units.altitude') }} +
@endif