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 <nabeelio@users.noreply.github.com>
This commit is contained in:
B.Fatih KOZ 2021-04-06 01:00:50 +03:00 committed by GitHub
parent 7502c053bf
commit 344edde0fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 69 additions and 11 deletions

View File

@ -0,0 +1,30 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `anumeric_callsign` column for Alphanumeric Callsign to be assigned for a flight
* Exp DLH78BF, THY8EA, OGE1978
* According to FAA and EASA, callsigns must be maximum 7 chars in which first 3 chars is
* airline ICAO code remaining rest can be used freely according to airline's choices
*/
class FlightsAddAlphanumericCallsign extends Migration
{
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->string('callsign', 4)
->nullable()
->after('flight_number');
});
}
public function down()
{
Schema::table('flights', function (Blueprint $table) {
$table->dropColumn('callsign');
});
}
}

View File

@ -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',

View File

@ -5,6 +5,7 @@ return [
'flighttime' => 'Flight Time',
'flighttype' => 'Flight Type',
'flighthours' => 'Flight Hours',
'callsign' => 'Callsign',
'route' => 'Route',
'mybid' => 'My Bids',
'search' => 'Search',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -29,15 +29,22 @@
</div>
<!-- Route Code Field -->
<div class="form-group col-sm-3">
<!-- Callsign Field -->
<div class="form-group input-group-sm col-sm-2">
{{ Form::label('callsign', 'Callsign:') }}
{{ Form::text('callsign', null, ['class'=>'form-control', 'placeholder'=>'optional', 'maxlength' => 4]) }}
<p class="text-danger">{{ $errors->first('callsign') }}</p>
</div>
<!-- Flight Type Field -->
<div class="form-group col-sm-2">
{{ Form::label('level', 'Flight Type:') }}&nbsp;<span class="required">*</span>
{{ Form::select('flight_type', $flight_types, null, ['class' => 'form-control select2']) }}
<p class="text-danger">{{ $errors->first('flight_type') }}</p>
</div>
<!-- Route Leg Field -->
<div class="form-group col-sm-3">
<!-- Flight Time Field -->
<div class="form-group col-sm-2">
{{ Form::label('flight_time', 'Flight Time (hours & minutes)') }}
<div class="input-group input-group-sm mb3">

View File

@ -43,12 +43,18 @@
</td>
</tr>
@endif
<tr>
<td>@lang('flights.route')</td>
<td>{{ $flight->route }}</td>
</tr>
@if(filled($flight->route))
<tr>
<td>@lang('flights.route')</td>
<td>{{ $flight->route }}</td>
</tr>
@endif
@if(filled($flight->callsign))
<tr>
<td>@lang('flights.callsign')</td>
<td>{{ $flight->airline->icao }} {{ $flight->callsign }}</td>
</tr>
@endif
@if(filled($flight->notes))
<tr>
<td>{{ trans_choice('common.note', 2) }}</td>

View File

@ -143,6 +143,8 @@
<input type="hidden" name="fltnum" value="{{ $flight->flight_number }}">
@if(setting('simbrief.callsign', true))
<input type="hidden" name="callsign" value="{{ $user->ident }}">
@else
<input type="hidden" name="callsign" value="{{ $flight->airline->icao }}{{ $flight->callsign ?? $flight->flight_number }}">
@endif
@if(setting('simbrief.name_private', true))
<input type="hidden" name="cpt" value="{{ $user->name_private }}">

View File

@ -51,14 +51,20 @@
])}}">{{$flight->arr_airport_id}}</a>)
@if($flight->arr_time), {{ $flight->arr_time }}@endif
<br/>
@if(filled($flight->callsign))
<span class="title">{{ strtoupper(__('flights.callsign')) }}&nbsp;</span>
{{ $flight->airline->icao }} {{ $flight->callsign }}
<br/>
@endif
@if($flight->distance)
<span class="title">{{ strtoupper(__('common.distance')) }}&nbsp;</span>
{{ $flight->distance }} {{ setting('units.distance') }}
<br/>
@endif
<br/>
@if($flight->level)
<span class="title">{{ strtoupper(__('flights.level')) }}&nbsp;</span>
{{ $flight->level }} {{ setting('units.altitude') }}
<br/>
@endif
</div>
<div class="col-sm-5">