allow marking of airport as hub and restrict to hubs at registration #86
This commit is contained in:
@@ -15,7 +15,7 @@ class CreateAirportsTable extends Migration
|
|||||||
$table->string('location', 100)->nullable();
|
$table->string('location', 100)->nullable();
|
||||||
$table->string('country', 64)->nullable();
|
$table->string('country', 64)->nullable();
|
||||||
$table->string('tz', 64)->nullable();
|
$table->string('tz', 64)->nullable();
|
||||||
$table->boolean('hub')->default(true);
|
$table->boolean('hub')->default(false);
|
||||||
$table->unsignedDecimal('fuel_100ll_cost', 19)->default(0);
|
$table->unsignedDecimal('fuel_100ll_cost', 19)->default(0);
|
||||||
$table->unsignedDecimal('fuel_jeta_cost', 19)->default(0);
|
$table->unsignedDecimal('fuel_jeta_cost', 19)->default(0);
|
||||||
$table->unsignedDecimal('fuel_mogas_cost', 19)->default(0);
|
$table->unsignedDecimal('fuel_mogas_cost', 19)->default(0);
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ airports:
|
|||||||
country: United States
|
country: United States
|
||||||
lat: 30.1945278
|
lat: 30.1945278
|
||||||
lon: -97.6698889
|
lon: -97.6698889
|
||||||
|
hub: 1
|
||||||
tz: America/Chicago
|
tz: America/Chicago
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ airports:
|
|||||||
country: United States
|
country: United States
|
||||||
lat: 30.1945278
|
lat: 30.1945278
|
||||||
lon: -97.6698889
|
lon: -97.6698889
|
||||||
|
hub: 1
|
||||||
tz: America/Chicago
|
tz: America/Chicago
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ airports:
|
|||||||
country: United States
|
country: United States
|
||||||
lat: 30.1945278
|
lat: 30.1945278
|
||||||
lon: -97.6698889
|
lon: -97.6698889
|
||||||
|
hub: 1
|
||||||
tz: America/Chicago
|
tz: America/Chicago
|
||||||
- id: KJFK
|
- id: KJFK
|
||||||
iata: JFK
|
iata: JFK
|
||||||
@@ -103,6 +104,7 @@ airports:
|
|||||||
country: United States
|
country: United States
|
||||||
lat: 40.6399257
|
lat: 40.6399257
|
||||||
lon: -73.7786950
|
lon: -73.7786950
|
||||||
|
hub: 1
|
||||||
tz: America/New_York
|
tz: America/New_York
|
||||||
- id: KBWI
|
- id: KBWI
|
||||||
iata: BWI
|
iata: BWI
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
public function showRegistrationForm()
|
public function showRegistrationForm()
|
||||||
{
|
{
|
||||||
$airports = $this->airportRepo->selectBoxList();
|
$airports = $this->airportRepo->selectBoxList(false, true);
|
||||||
$airlines = $this->airlineRepo->selectBoxList();
|
$airlines = $this->airlineRepo->selectBoxList();
|
||||||
|
|
||||||
return $this->view('auth.register', [
|
return $this->view('auth.register', [
|
||||||
|
|||||||
@@ -25,10 +25,16 @@ class AirportRepository extends BaseRepository implements CacheableInterface
|
|||||||
* Return the list of airports formatted for a select box
|
* Return the list of airports formatted for a select box
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function selectBoxList($add_blank=false): array
|
public function selectBoxList($add_blank=false, $only_hubs=false): array
|
||||||
{
|
{
|
||||||
$retval = [];
|
$retval = [];
|
||||||
$items = $this->orderBy('icao', 'asc')->all();
|
$where = [];
|
||||||
|
|
||||||
|
if($only_hubs) {
|
||||||
|
$where['hub'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = $this->orderBy('icao', 'asc')->findWhere($where);
|
||||||
|
|
||||||
if ($add_blank) {
|
if ($add_blank) {
|
||||||
$retval[''] = '';
|
$retval[''] = '';
|
||||||
|
|||||||
@@ -42,15 +42,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-4">
|
||||||
{!! Form::label('lat', 'Latitude:') !!}
|
{!! Form::label('lat', 'Latitude:') !!}
|
||||||
{!! Form::number('lat', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lat']) !!}
|
{!! Form::number('lat', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lat']) !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-4">
|
||||||
{!! Form::label('lon', 'Longitude:') !!}
|
{!! Form::label('lon', 'Longitude:') !!}
|
||||||
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lon']) !!}
|
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lon']) !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-4">
|
||||||
|
{!! Form::label('hub', 'Hub:') !!}
|
||||||
|
{!! Form::hidden('hub', 0) !!}
|
||||||
|
{!! Form::checkbox('hub', null) !!}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<th>ICAO</th>
|
<th>ICAO</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>Timezone</th>
|
<th>Hub</th>
|
||||||
<th style="text-align: center;">100LL</th>
|
<th style="text-align: center;">100LL</th>
|
||||||
<th style="text-align: center;">JetA</th>
|
<th style="text-align: center;">JetA</th>
|
||||||
<th style="text-align: center;">MOGAS</th>
|
<th style="text-align: center;">MOGAS</th>
|
||||||
@@ -16,7 +16,11 @@
|
|||||||
<td><a href="{!! route('admin.airports.edit', [$airport->id]) !!}">{!! $airport->icao !!}</a></td>
|
<td><a href="{!! route('admin.airports.edit', [$airport->id]) !!}">{!! $airport->icao !!}</a></td>
|
||||||
<td>{!! $airport->name !!}</td>
|
<td>{!! $airport->name !!}</td>
|
||||||
<td>{!! $airport->location !!}</td>
|
<td>{!! $airport->location !!}</td>
|
||||||
<td>{!! $airport->timezone !!}</td>
|
<td style="text-align: center;">
|
||||||
|
@if($airport->hub == 1)
|
||||||
|
<span class="label label-success">Hub</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_100ll_cost">{!! $airport->fuel_100ll_cost !!}</a>
|
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_100ll_cost">{!! $airport->fuel_100ll_cost !!}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<label for="home_airport" class="control-label">Home Airport</label>
|
<label for="home_airport" class="control-label">Home Airport</label>
|
||||||
<div class="input-group form-group-no-border{{ $errors->has('home_airport') ? ' has-danger' : '' }}">
|
<div class="input-group form-group-no-border{{ $errors->has('home_airport') ? ' has-danger' : '' }}">
|
||||||
{!! Form::select('home_airport_id', $airlines, null , ['class' => 'form-control select2']) !!}
|
{!! Form::select('home_airport_id', $airports, null , ['class' => 'form-control select2']) !!}
|
||||||
</div>
|
</div>
|
||||||
@if ($errors->has('home_airport_id'))
|
@if ($errors->has('home_airport_id'))
|
||||||
<p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
|
<p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user