Add "Notes" to Airports (#1467)
* Notes for Airports Adds capability of having notes/remarks for airports, includes * New database field * Airport Model change * CSV Import/Export capability for notes * Admin Airports list page change * Admin Airports edit page change * Default Template Airport show page change * Update Airport Tests * Add the new field to source csv * Check if the import works * Update AirportFactory.php Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
This commit is contained in:
parent
ccebc69be2
commit
ef38d39ec4
@ -63,6 +63,7 @@ class AirportFactory extends Factory
|
|||||||
'lat' => $this->faker->latitude,
|
'lat' => $this->faker->latitude,
|
||||||
'lon' => $this->faker->longitude,
|
'lon' => $this->faker->longitude,
|
||||||
'hub' => false,
|
'hub' => false,
|
||||||
|
'notes' => null,
|
||||||
'ground_handling_cost' => $this->faker->randomFloat(2, 0, 500),
|
'ground_handling_cost' => $this->faker->randomFloat(2, 0, 500),
|
||||||
'fuel_100ll_cost' => $this->faker->randomFloat(2, 1, 10),
|
'fuel_100ll_cost' => $this->faker->randomFloat(2, 1, 10),
|
||||||
'fuel_jeta_cost' => $this->faker->randomFloat(2, 1, 10),
|
'fuel_jeta_cost' => $this->faker->randomFloat(2, 1, 10),
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Contracts\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class() extends Migration {
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('airports', function (Blueprint $table) {
|
||||||
|
$table->mediumText('notes')->nullable()->after('hub');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -19,6 +19,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
* @property string location
|
* @property string location
|
||||||
* @property string country
|
* @property string country
|
||||||
* @property string timezone
|
* @property string timezone
|
||||||
|
* @property string notes
|
||||||
* @property float ground_handling_cost
|
* @property float ground_handling_cost
|
||||||
* @property float fuel_100ll_cost
|
* @property float fuel_100ll_cost
|
||||||
* @property float fuel_jeta_cost
|
* @property float fuel_jeta_cost
|
||||||
@ -56,6 +57,7 @@ class Airport extends Model
|
|||||||
'fuel_100ll_cost',
|
'fuel_100ll_cost',
|
||||||
'fuel_jeta_cost',
|
'fuel_jeta_cost',
|
||||||
'fuel_mogas_cost',
|
'fuel_mogas_cost',
|
||||||
|
'notes',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -81,8 +83,7 @@ class Airport extends Model
|
|||||||
'ground_handling_cost' => 'nullable|numeric',
|
'ground_handling_cost' => 'nullable|numeric',
|
||||||
'fuel_100ll_cost' => 'nullable|numeric',
|
'fuel_100ll_cost' => 'nullable|numeric',
|
||||||
'fuel_jeta_cost' => 'nullable|numeric',
|
'fuel_jeta_cost' => 'nullable|numeric',
|
||||||
|
'fuel_mogas_cost' => 'nullable|numeric',
|
||||||
'fuel_mogas_cost' => 'nullable|numeric',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,7 @@ class AirportImporter extends ImportExport
|
|||||||
'fuel_100ll_cost' => 'nullable|numeric',
|
'fuel_100ll_cost' => 'nullable|numeric',
|
||||||
'fuel_jeta_cost' => 'nullable|numeric',
|
'fuel_jeta_cost' => 'nullable|numeric',
|
||||||
'fuel_mogas_cost' => 'nullable|numeric',
|
'fuel_mogas_cost' => 'nullable|numeric',
|
||||||
|
'notes' => 'nullable',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +100,13 @@
|
|||||||
This is the cost per {{ config('phpvms.internal_units.fuel') }}
|
This is the cost per {{ config('phpvms.internal_units.fuel') }}
|
||||||
@endcomponent
|
@endcomponent
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
{{ Form::label('notes', 'Remarks / Notes:') }}
|
||||||
|
{{ Form::textarea('notes', null, ['id' => 'editor', 'class' => 'editor', 'style' => 'padding: 5px']) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -119,3 +125,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@section('scripts')
|
||||||
|
@parent
|
||||||
|
<script src="{{ public_asset('assets/vendor/ckeditor4/ckeditor.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () { CKEDITOR.replace('editor'); });
|
||||||
|
</script>
|
||||||
|
@endsection
|
@ -4,7 +4,8 @@
|
|||||||
<th>ICAO</th>
|
<th>ICAO</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>Hub</th>
|
<th style="text-align: center;">Hub</th>
|
||||||
|
<th style="text-align: center;">Notes</th>
|
||||||
<th style="text-align: center;">GH Cost</th>
|
<th style="text-align: center;">GH Cost</th>
|
||||||
<th style="text-align: center;">JetA</th>
|
<th style="text-align: center;">JetA</th>
|
||||||
<th style="text-align: center;">100LL</th>
|
<th style="text-align: center;">100LL</th>
|
||||||
@ -22,6 +23,11 @@
|
|||||||
<span class="label label-success">Hub</span>
|
<span class="label label-success">Hub</span>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
@if(filled($airport->notes))
|
||||||
|
<span class="label label-info" title="{{ $airport->notes }}">Notes</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
{{ $airport->ground_handling_cost }}
|
{{ $airport->ground_handling_cost }}
|
||||||
</td>
|
</td>
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
{{-- Show the airspace map in the other column --}}
|
{{-- Show the airspace map in the other column --}}
|
||||||
<div class="col-7">
|
<div class="col-7">
|
||||||
{{ Widget::AirspaceMap([
|
{{ Widget::AirspaceMap(['width' => '100%', 'height' => '400px', 'lat' => $airport->lat, 'lon' => $airport->lon]) }}
|
||||||
'width' => '100%',
|
@if(filled($airport->notes))
|
||||||
'height' => '400px',
|
<hr>
|
||||||
'lat' => $airport->lat,
|
{!! $airport->notes !!}
|
||||||
'lon' => $airport->lon,
|
@endif
|
||||||
]) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -670,6 +670,7 @@ class ImporterTest extends TestCase
|
|||||||
$this->assertEquals('-97.6699', $airport->lon);
|
$this->assertEquals('-97.6699', $airport->lon);
|
||||||
$this->assertEquals(0.0, $airport->ground_handling_cost);
|
$this->assertEquals(0.0, $airport->ground_handling_cost);
|
||||||
$this->assertEquals(setting('airports.default_jet_a_fuel_cost'), $airport->fuel_jeta_cost);
|
$this->assertEquals(setting('airports.default_jet_a_fuel_cost'), $airport->fuel_jeta_cost);
|
||||||
|
$this->assertEquals('Test Note', $airport->notes);
|
||||||
|
|
||||||
// See if it imported
|
// See if it imported
|
||||||
$airport = Airport::where([
|
$airport = Airport::where([
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost
|
icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost,notes
|
||||||
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699,0,,,
|
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699,0,,,,"Test Note"
|
||||||
KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,1,30.1945,-97.6699,,,0.9,
|
KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,1,30.1945,-97.6699,,,0.9,,
|
||||||
KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd,150,,0.8,
|
KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd,150,,0.8,,"Busy Airport"
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost
|
icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost,notes
|
||||||
EGLL,LHR,"London Heathrow","London, England",,Europe/London,,51.4775,-0.4614,500,0,0,0
|
EGLL,LHR,"London Heathrow","London, England",,Europe/London,,51.4775,-0.4614,500,0,0,0,
|
||||||
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA","United States",America/Chicago,1,30.1945,-97.6699,0,0,0,0
|
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA","United States",America/Chicago,1,30.1945,-97.6699,0,0,0,0,"Test Note"
|
||||||
KJFK,JFK,"John F Kennedy","New York, New York, USA","United States",America/New_York,1,40.6399,-73.7787,250,0,0,0
|
KJFK,JFK,"John F Kennedy","New York, New York, USA","United States",America/New_York,1,40.6399,-73.7787,250,0,0,0,"Busy Airport"
|
||||||
KPAE,PAE,"Snohomish County (Paine Field) Airport",Everett,"United States",America/Los_Angeles,,47.9063,-122.282,0,0,0,0
|
KPAE,PAE,"Snohomish County (Paine Field) Airport",Everett,"United States",America/Los_Angeles,,47.9063,-122.282,0,0,0,0,
|
||||||
KSEA,SEA,"Seattle Tacoma International Airport",Seattle,"United States",America/Los_Angeles,,47.449,-122.309,0,0,0,0
|
KSEA,SEA,"Seattle Tacoma International Airport",Seattle,"United States",America/Los_Angeles,,47.449,-122.309,0,0,0,0,
|
||||||
LEMD,MAD,"Adolfo Suárez Madrid–Barajas Airport",Madrid,Spain,Europe/Madrid,,40.4719,-3.5626,,0,0,0
|
LEMD,MAD,"Adolfo Suárez Madrid–Barajas Airport",Madrid,Spain,Europe/Madrid,,40.4719,-3.5626,,0,0,0,
|
||||||
MKJP,KIN,"Norman Manley International Airport","Kingston, Jamaica",,America/Jamaica,,17.9357,-76.7875,50,0,0,0
|
MKJP,KIN,"Norman Manley International Airport","Kingston, Jamaica",,America/Jamaica,,17.9357,-76.7875,50,0,0,0,
|
||||||
MWCR,GCM,"Owen Roberts International Airport",Georgetown,Cayman,America/Cayman,,19.2928,-81.3577,50,0,0,0
|
MWCR,GCM,"Owen Roberts International Airport",Georgetown,Cayman,America/Cayman,,19.2928,-81.3577,50,0,0,0,
|
||||||
OMDB,DXB,"Dubai International Airport","Dubai, UAE",,Asia/Dubai,,25.2528,55.3644,50,0,0,0
|
OMDB,DXB,"Dubai International Airport","Dubai, UAE",,Asia/Dubai,,25.2528,55.3644,50,0,0,0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user