Add a ground_handling_multiplier to the subfleet table #134
This commit is contained in:
parent
4142d5d28a
commit
db94f5b405
@ -19,6 +19,7 @@ class CreateSubfleetTables extends Migration
|
|||||||
$table->string('name', 50);
|
$table->string('name', 50);
|
||||||
$table->string('type', 50);
|
$table->string('type', 50);
|
||||||
$table->unsignedTinyInteger('fuel_type')->nullable();
|
$table->unsignedTinyInteger('fuel_type')->nullable();
|
||||||
|
$table->unsignedDecimal('ground_handling_multiplier')->nullable()->default(100);
|
||||||
$table->unsignedDecimal('cargo_capacity')->nullable();
|
$table->unsignedDecimal('cargo_capacity')->nullable();
|
||||||
$table->unsignedDecimal('fuel_capacity')->nullable();
|
$table->unsignedDecimal('fuel_capacity')->nullable();
|
||||||
$table->unsignedDecimal('gross_weight')->nullable();
|
$table->unsignedDecimal('gross_weight')->nullable();
|
||||||
|
@ -183,10 +183,12 @@ subfleets:
|
|||||||
airline_id: 1
|
airline_id: 1
|
||||||
name: 747-400 Winglets
|
name: 747-400 Winglets
|
||||||
type: 744W
|
type: 744W
|
||||||
|
ground_handling_multiplier: 200
|
||||||
- id: 2
|
- id: 2
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
name: 777-200 LR
|
name: 777-200 LR
|
||||||
type: 772-LR
|
type: 772-LR
|
||||||
|
ground_handling_multiplier: 150
|
||||||
|
|
||||||
# add a few mods to aircraft and fares
|
# add a few mods to aircraft and fares
|
||||||
subfleet_fare:
|
subfleet_fare:
|
||||||
@ -248,8 +250,8 @@ flights:
|
|||||||
flight_number: 6028
|
flight_number: 6028
|
||||||
route_code: A
|
route_code: A
|
||||||
route_leg: 1
|
route_leg: 1
|
||||||
dpt_airport_id: KIAH
|
dpt_airport_id: EGLL
|
||||||
arr_airport_id: KAUS
|
arr_airport_id: KJFK
|
||||||
dpt_time: 9AM CST
|
dpt_time: 9AM CST
|
||||||
arr_time: 1030AM CST
|
arr_time: 1030AM CST
|
||||||
route: PITZZ4 MNURE WLEEE4
|
route: PITZZ4 MNURE WLEEE4
|
||||||
|
@ -9,13 +9,13 @@ namespace App\Models;
|
|||||||
class Subfleet extends BaseModel
|
class Subfleet extends BaseModel
|
||||||
{
|
{
|
||||||
public $table = 'subfleets';
|
public $table = 'subfleets';
|
||||||
protected $dates = ['deleted_at'];
|
|
||||||
|
|
||||||
public $fillable = [
|
public $fillable = [
|
||||||
'airline_id',
|
'airline_id',
|
||||||
'name',
|
'name',
|
||||||
'type',
|
'type',
|
||||||
'fuel_type',
|
'fuel_type',
|
||||||
|
'ground_handling_multiplier',
|
||||||
'cargo_capacity',
|
'cargo_capacity',
|
||||||
'fuel_capacity',
|
'fuel_capacity',
|
||||||
'gross_weight',
|
'gross_weight',
|
||||||
@ -27,16 +27,18 @@ class Subfleet extends BaseModel
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'airline_id' => 'integer',
|
'airline_id' => 'integer',
|
||||||
'fuel_type' => 'integer',
|
'fuel_type' => 'integer',
|
||||||
'cargo_capacity' => 'double',
|
'ground_handling_multiplier' => 'float',
|
||||||
'fuel_capacity' => 'double',
|
'cargo_capacity' => 'float',
|
||||||
'gross_weight' => 'double',
|
'fuel_capacity' => 'float',
|
||||||
|
'gross_weight' => 'float',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $rules = [
|
public static $rules = [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'type' => 'required',
|
'type' => 'required',
|
||||||
|
'ground_handling_multiplier' => 'nullable|numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,6 +53,10 @@ class Subfleet extends BaseModel
|
|||||||
if (filled($model->type)) {
|
if (filled($model->type)) {
|
||||||
$model->type = str_replace(' ', '_', $model->type);
|
$model->type = str_replace(' ', '_', $model->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!filled($model->ground_handling_multiplier)) {
|
||||||
|
$model->ground_handling_multiplier = 100;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static::updating(function ($model) {
|
static::updating(function ($model) {
|
||||||
|
@ -11,19 +11,35 @@
|
|||||||
{!! Form::text('type', null, ['class' => 'form-control']) !!}
|
{!! Form::text('type', null, ['class' => 'form-control']) !!}
|
||||||
<p class="text-danger">{{ $errors->first('type') }}</p>
|
<p class="text-danger">{{ $errors->first('type') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-4">
|
||||||
{!! Form::label('airline_id', 'Airline:') !!}
|
{!! Form::label('airline_id', 'Airline:') !!}
|
||||||
{!! Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) !!}
|
{!! Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) !!}
|
||||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-4">
|
||||||
{!! Form::label('fuel_type', 'Fuel Type:') !!}
|
{!! Form::label('fuel_type', 'Fuel Type:') !!}
|
||||||
{!! Form::select('fuel_type', $fuel_types, null , ['class' => 'form-control select2']) !!}
|
{!! Form::select('fuel_type', $fuel_types, null , ['class' => 'form-control select2']) !!}
|
||||||
<p class="text-danger">{{ $errors->first('fuel_type') }}</p>
|
<p class="text-danger">{{ $errors->first('fuel_type') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-4">
|
||||||
|
{!! Form::label('ground_handling_multiplier', 'Ground Handling Multiplier:') !!}
|
||||||
|
|
||||||
|
@component('admin.components.info')
|
||||||
|
This is the multiplier of the airport ground-handling cost to charge for
|
||||||
|
aircraft in this subfleet, as a percentage. Defaults to 100.
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
|
{!! Form::text('ground_handling_multiplier', null, ['class' => 'form-control']) !!}
|
||||||
|
<p class="text-danger">{{ $errors->first('ground_handling_multiplier') }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
<div class="form-group col-sm-12">
|
<div class="form-group col-sm-12">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{!! Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) !!}
|
{!! Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) !!}
|
||||||
|
Loading…
Reference in New Issue
Block a user