#21 basic listings/model configs

This commit is contained in:
Nabeel Shahzad 2017-07-02 21:25:48 -05:00
parent ddc2ed4d89
commit 9b6f9e9586
6 changed files with 52 additions and 21 deletions

View File

@ -67,6 +67,10 @@ class Pirep extends Model
/**
* Foreign Keys
*/
public function aircraft()
{
return $this->belongsTo('App\Models\Aircraft', 'aircraft_id');
}
public function arr_airport()
{

View File

@ -52,6 +52,11 @@ class User extends Authenticatable
'password', 'remember_token',
];
public function pilot_id()
{
return $this->airline->code . str_pad($this->id, 3, '0', STR_PAD_LEFT);
}
/**
* Foreign Keys
*/

View File

@ -111,6 +111,7 @@ return [
'Yaml' => Symfony\Component\Yaml\Yaml::class,
'Geotools' => Toin0u\Geotools\Facade\Geotools::class,
'Setting' => anlutro\LaravelSettings\Facade::class,
'Utils' => App\Facades\Utils::class,
],
];

View File

@ -40,7 +40,7 @@ return [
'api_version' => 'v1',
'options' => [
'softDelete' => true,
'softDelete' => false,
'tables_searchable_default' => false,
],
@ -54,7 +54,7 @@ return [
'add_on' => [
'swagger' => false,
'swagger' => true,
'tests' => true,
'datatables' => false,
'menu' => [

View File

@ -108,14 +108,6 @@ fares:
price: 800
capacity: 5
flights:
- id: 1
airline_id: 1
flight_number: 100
dpt_airport_id: 1
arr_airport_id: 2
route: KAUS KJFK
subfleets:
- id: 1
airline_id: 1
@ -152,3 +144,22 @@ subfleet_fare:
subfleet_flight:
- subfleet_id: 1
flight_id: 1
flights:
- id: 1
airline_id: 1
flight_number: 100
dpt_airport_id: 1
arr_airport_id: 2
route: KAUS KJFK
pireps:
- user_id: 1
flight_id: 1
aircraft_id: 1
dpt_airport_id: 1
arr_airport_id: 2
flight_time: 21600 # 6 hours
level: 320
status: -1
notes: just a pilot report

View File

@ -1,26 +1,30 @@
<table class="table table-responsive" id="pireps-table">
<thead>
<th>User Id</th>
<th>Flight Id</th>
<th>Aircraft Id</th>
<th>Pilot</th>
<th>Flight</th>
<th>Aircraft</th>
<th>Flight Time</th>
<th>Level</th>
<th>Route</th>
<th>Notes</th>
<th>Raw Data</th>
<th colspan="3">Action</th>
</thead>
<tbody>
@foreach($pireps as $pirep)
<tr>
<td>{!! $pirep->user_id !!}</td>
<td>{!! $pirep->flight_id !!}</td>
<td>{!! $pirep->aircraft_id !!}</td>
<td>{!! $pirep->flight_time !!}</td>
<td>{!! $pirep->user->name !!}</td>
<td>
@if($pirep->flight)
<a href="{!! route('admin.flights.show', ['id' => $pirep->flight_id]) !!}">
{!! $pirep->flight->airline->code !!}{!! $pirep->flight->flight_number !!}
</a>
@else
-
@endif
</td>
<td>{!! $pirep->aircraft->registration !!} ({!! $pirep->aircraft->name !!})</td>
<td>{!! Utils::secondsToTime($pirep->flight_time) !!}</td>
<td>{!! $pirep->level !!}</td>
<td>{!! $pirep->route !!}</td>
<td>{!! $pirep->notes !!}</td>
<td>{!! $pirep->raw_data !!}</td>
<td>
{!! Form::open(['route' => ['admin.pireps.destroy', $pirep->id], 'method' => 'delete']) !!}
<div class='btn-group'>
@ -31,6 +35,12 @@
{!! Form::close() !!}
</td>
</tr>
@if($pirep->notes)
<tr>
<td>&nbsp;</td>
<td colspan="8"><strong>Notes:</strong> {!! $pirep->notes !!}</td>
</tr>
@endif
@endforeach
</tbody>
</table>