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
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 Airline airline
* @property int airline_id * @property int airline_id
* @property mixed flight_number * @property mixed flight_number
* @property mixed callsign
* @property mixed route_code * @property mixed route_code
* @property int route_leg * @property int route_leg
* @property bool has_bid * @property bool has_bid
@@ -60,6 +61,7 @@ class Flight extends Model
'id', 'id',
'airline_id', 'airline_id',
'flight_number', 'flight_number',
'callsign',
'route_code', 'route_code',
'route_leg', 'route_leg',
'dpt_airport_id', 'dpt_airport_id',
@@ -104,6 +106,7 @@ class Flight extends Model
public static $rules = [ public static $rules = [
'airline_id' => 'required|exists:airlines,id', 'airline_id' => 'required|exists:airlines,id',
'flight_number' => 'required', 'flight_number' => 'required',
'callsign' => 'string|max:4|nullable',
'route_code' => 'nullable', 'route_code' => 'nullable',
'route_leg' => 'nullable', 'route_leg' => 'nullable',
'dpt_airport_id' => 'required|exists:airports,id', 'dpt_airport_id' => 'required|exists:airports,id',

View File

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

View File

@@ -5,6 +5,7 @@ return [
'flighttime' => 'Tiempo de vuelo', 'flighttime' => 'Tiempo de vuelo',
'flighttype' => 'Tipo de vuelo', 'flighttype' => 'Tipo de vuelo',
'flighthours' => 'Horas de vuelo', 'flighthours' => 'Horas de vuelo',
'callsign' => 'Indicativo',
'route' => 'Ruta', 'route' => 'Ruta',
'mybid' => 'Mis reservas', 'mybid' => 'Mis reservas',
'search' => 'Buscar', 'search' => 'Buscar',

View File

@@ -5,6 +5,7 @@ return [
'flighttime' => 'Tempo di Volo', 'flighttime' => 'Tempo di Volo',
'flighttype' => 'Tipo di Volo', 'flighttype' => 'Tipo di Volo',
'flighthours' => 'Ore di Volo', 'flighthours' => 'Ore di Volo',
'callsign' => 'Nominativo',
'route' => 'Rotta', 'route' => 'Rotta',
'mybid' => 'Mie Prenotazioni', 'mybid' => 'Mie Prenotazioni',
'addremovebid' => 'Aggiungi/Rimuovi Prenotazione', 'addremovebid' => 'Aggiungi/Rimuovi Prenotazione',

View File

@@ -5,6 +5,7 @@ return [
'flighttime' => 'Tempo do Voo', 'flighttime' => 'Tempo do Voo',
'flighttype' => 'Tipo de Voo', 'flighttype' => 'Tipo de Voo',
'flighthours' => 'Horas de Voo', 'flighthours' => 'Horas de Voo',
'callsign' => 'Indicativo',
'route' => 'Rota', 'route' => 'Rota',
'mybid' => 'Minhas Reservas', 'mybid' => 'Minhas Reservas',
'search' => 'Procurar', 'search' => 'Procurar',

View File

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

View File

@@ -43,12 +43,18 @@
</td> </td>
</tr> </tr>
@endif @endif
@if(filled($flight->route))
<tr> <tr>
<td>@lang('flights.route')</td> <td>@lang('flights.route')</td>
<td>{{ $flight->route }}</td> <td>{{ $flight->route }}</td>
</tr> </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)) @if(filled($flight->notes))
<tr> <tr>
<td>{{ trans_choice('common.note', 2) }}</td> <td>{{ trans_choice('common.note', 2) }}</td>

View File

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

View File

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