Skip to content

Commit

Permalink
Add MTOW and ZFW to aircraft editor #775
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Sep 3, 2020
1 parent e99c22b commit f2c79d8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 10 deletions.
33 changes: 33 additions & 0 deletions app/Database/migrations/2020_09_03_141152_aircraft_add_mtow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
* Add a `mtow` column for the max takeoff weight
*/
class AircraftAddMtow extends Migration
{
public function up()
{
Schema::table('aircraft', function (Blueprint $table) {
$table->unsignedDecimal('mtow')
->nullable()
->default(0.0)
->after('hex_code');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('aircraft', function (Blueprint $table) {
$table->dropColumn('mtow');
});
}
}
4 changes: 4 additions & 0 deletions app/Models/Aircraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Aircraft extends Model
'registration',
'hex_code',
'flight_time',
'mtow',
'zfw',
'status',
'state',
Expand All @@ -49,6 +50,7 @@ class Aircraft extends Model
*/
protected $casts = [
'subfleet_id' => 'integer',
'mtow' => 'float',
'zfw' => 'float',
'flight_time' => 'float',
'state' => 'integer',
Expand All @@ -62,6 +64,8 @@ class Aircraft extends Model
'name' => 'required',
'status' => 'required',
'registration' => 'required',
'mtow' => 'nullable|number',
'zfw' => 'nullable|number',
];

/**
Expand Down
32 changes: 22 additions & 10 deletions resources/views/admin/aircraft/fields.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,23 @@
<div class="col-12">
<div class="form-container">
<h6>
<span style="float:right">
View list of
<a href="https://en.wikipedia.org/wiki/List_of_ICAO_aircraft_type_designators"
target="_blank">
IATA and ICAO Type Designators
</a>
</span>
<i class="fas fa-plane"></i>
&nbsp;Aircraft Information

<span style="float:right">
View list of
<a href="https://en.wikipedia.org/wiki/List_of_ICAO_aircraft_type_designators"
target="_blank">IATA and ICAO Type Designators</a>
</span>
<i class="fas fa-plane"></i>&nbsp;Aircraft Information
</h6>
<div class="form-container-body">

<div class="row">
<div class="form-group col-sm-12">
{{ 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-3">
{{ Form::label('iata', 'IATA:') }}
Expand All @@ -75,6 +73,20 @@
<p class="text-danger">{{ $errors->first('registration') }}</p>
</div>
</div>

<div class="row">
<div class="form-group col-sm-6">
{{ Form::label('mtow', 'Max Takeoff Weight (MTOW):') }}
{{ Form::text('mtow', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('mtow') }}</p>
</div>
<div class="form-group col-sm-6">
{{ Form::label('zfw', 'Zero Fuel Weight (ZFW):') }}
{{ Form::text('zfw', null, ['class' => 'form-control']) }}
<p class="text-danger">{{ $errors->first('zfw') }}</p>
</div>
</div>

</div>
</div>
</div>
Expand Down

0 comments on commit f2c79d8

Please sign in to comment.