Add ground_handling_cost to airport #134

This commit is contained in:
Nabeel Shahzad 2018-02-23 15:48:50 -06:00
parent b8b4fe7a8a
commit 4142d5d28a
6 changed files with 60 additions and 74 deletions

View File

@ -25,8 +25,9 @@ $factory->define(App\Models\Airport::class, function (Faker $faker) {
'timezone' => $faker->timezone,
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'fuel_100ll_cost' => $faker->randomFloat(2),
'fuel_jeta_cost' => $faker->randomFloat(2),
'fuel_mogas_cost' => $faker->randomFloat(2),
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
'fuel_100ll_cost' => $faker->randomFloat(2, 0, 100),
'fuel_jeta_cost' => $faker->randomFloat(2, 0, 100),
'fuel_mogas_cost' => $faker->randomFloat(2, 0, 100),
];
});

View File

@ -16,6 +16,7 @@ class CreateAirportsTable extends Migration
$table->string('country', 64)->nullable();
$table->string('timezone', 64)->nullable();
$table->boolean('hub')->default(false);
$table->unsignedDecimal('ground_handling_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_100ll_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_jeta_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_mogas_cost')->nullable()->default(0);

View File

@ -115,6 +115,7 @@ airports:
lat: 30.1945278
lon: -97.6698889
hub: 1
ground_handling_cost: 100
- id: KJFK
iata: JFK
icao: KJFK
@ -125,51 +126,7 @@ airports:
lat: 40.6399257
lon: -73.7786950
hub: 1
- id: KBWI
iata: BWI
icao: KBWI
name: Baltimore/Washington International Thurgood Marshall Airport
location: Baltimore, MD
country: United States
timezone: America/New_York
lat: 39.1754
lon: -76.6683
- id: KIAH
iata: IAH
icao: KIAH
name: George Bush Intercontinental Houston Airport
location: Houston, TX
country: United States
timezone: America/Chicago
lat: 29.9844
lon: -95.3414
- id: KORD
iata: ORD
icao: KORD
name: Chicago O'Hare International Airport
location: Chicago, IL
country: United States
timezone: America/Chicago
lat: 41.9786
lon: -87.9048
- id: KDFW
iata: DFW
icao: KDFW
name: Dallas Fort Worth International Airport
location: Dallas, TX
country: United States
timezone: America/Chicago
lat: 32.8968
lon: -97.038
- id: EFHK
iata: HEL
icao: EFHK
name: Helsinki Vantaa Airport
location: Helsinki
country: Finland
timezone: Europe/Helsinki
lat: 60.3172
lon: 24.9633
ground_handling_cost: 250
- id: EGLL
iata: LHR
icao: EGLL
@ -178,6 +135,7 @@ airports:
timezone: Europe/London
lat: 51.4775
lon: -0.4614
ground_handling_cost: 500
- id: LGRP
iata: RHO
icao: LGRP
@ -187,6 +145,7 @@ airports:
timezone: Europe/Athens
lat: 36.4054
lon: 28.0862
ground_handling_cost: 50
#
aircraft:
- id: 1

View File

@ -27,6 +27,7 @@ class Airport extends BaseModel
'lon',
'hub',
'timezone',
'ground_handling_cost',
'fuel_100ll_cost',
'fuel_jeta_cost',
'fuel_mogas_cost',
@ -36,6 +37,7 @@ class Airport extends BaseModel
'lat' => 'float',
'lon' => 'float',
'hub' => 'boolean',
'ground_handling_cost' => 'float',
'fuel_100ll_cost' => 'float',
'fuel_jeta_cost' => 'float',
'fuel_mogas_cost' => 'float',
@ -45,12 +47,13 @@ class Airport extends BaseModel
* Validation rules
*/
public static $rules = [
'icao' => 'required',
'iata' => 'nullable',
'name' => 'required',
'location' => 'nullable',
'lat' => 'required|numeric',
'lon' => 'required|numeric',
'icao' => 'required',
'iata' => 'nullable',
'name' => 'required',
'location' => 'nullable',
'lat' => 'required|numeric',
'lon' => 'required|numeric',
'ground_handling_cost' => 'nullable|numeric',
];
/**

View File

@ -12,20 +12,26 @@
</div>
<div class="form-group col-sm-6">
{!! Form::label('iata', 'IATA:') !!}
{!! Form::text('iata', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('iata') }}</p>
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
{!! Form::label('name', 'Name:') !!}&nbsp;<span class="required">*</span>
{!! Form::text('name', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('name') }}</p>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('lat', 'Latitude:') !!}&nbsp;<span class="required">*</span>
{!! Form::number('lat', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lat']) !!}
<p class="text-danger">{{ $errors->first('lat') }}</p>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('lon', 'Longitude:') !!}&nbsp;<span class="required">*</span>
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lon']) !!}
<p class="text-danger">{{ $errors->first('lon') }}</p>
@ -33,33 +39,45 @@
</div>
<div class="row">
<div class="form-group col-sm-6">
{!! Form::label('iata', 'IATA:') !!}
{!! Form::text('iata', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('iata') }}</p>
</div>
<div class="form-group col-sm-6">
{!! Form::label('location', 'Location:') !!}
{!! Form::text('location', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('location') }}</p>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('country', 'Country:') !!}
{!! Form::text('country', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('country') }}</p>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
{!! Form::label('location', 'Location:') !!}
{!! Form::text('location', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('location') }}</p>
</div>
<div class="form-group col-sm-4">
{!! Form::label('timezone', 'Timezone:') !!}
{!! Form::select('timezone', $timezones, null, ['id' => 'timezone', 'class' => 'select2']); !!}
<p class="text-danger">{{ $errors->first('timezone') }}</p>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
{!! Form::label('ground_handling_cost', 'Ground Handling Cost:') !!}
@component('admin.components.info')
This is the base rate per-flight. A multiplier for this rate can be
set in the subfleet, so you can modulate those costs from there.
@endcomponent
{!! Form::number('ground_handling_cost', null, ['class' => 'form-control']) !!}
<p class="text-danger">{{ $errors->first('ground_handling_cost') }}</p>
</div>
<div class="form-group col-md-6">
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
{!! Form::label('hub', 'Hub:') !!}

View File

@ -5,6 +5,7 @@
<th>Name</th>
<th>Location</th>
<th>Hub</th>
<th style="text-align: center;">GH Cost</th>
<th style="text-align: center;">100LL</th>
<th style="text-align: center;">JetA</th>
<th style="text-align: center;">MOGAS</th>
@ -21,6 +22,9 @@
<span class="label label-success">Hub</span>
@endif
</td>
<td style="text-align: center;">
{!! $airport->ground_handling_cost !!}
</td>
<td style="text-align: center;">
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_100ll_cost">{!! $airport->fuel_100ll_cost !!}</a>
</td>