Track hours on aircraft #73
This commit is contained in:
parent
fe4f39a5dc
commit
e3bce1cd69
@ -19,6 +19,7 @@ class CreateAircraftsTable extends Migration
|
||||
$table->string('name', 50);
|
||||
$table->string('registration', 10)->nullable();
|
||||
$table->string('tail_number', 10)->nullable();
|
||||
$table->unsignedBigInteger('flight_time')->default(0);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->unsignedTinyInteger('state')->default(AircraftState::PARKED);
|
||||
$table->timestamps();
|
||||
|
@ -268,6 +268,7 @@ class PIREPService extends BaseService
|
||||
Log::info('PIREP ' . $pirep->id . ' state change to ACCEPTED');
|
||||
|
||||
# Update the aircraft
|
||||
$pirep->aircraft->flight_time += $pirep->flight_time;
|
||||
$pirep->aircraft->airport_id = $pirep->arr_airport_id;
|
||||
$pirep->aircraft->landing_time = $pirep->updated_at;
|
||||
$pirep->aircraft->save();
|
||||
@ -300,6 +301,9 @@ class PIREPService extends BaseService
|
||||
$pirep->save();
|
||||
$pirep->refresh();
|
||||
|
||||
$pirep->aircraft->flight_time -= $pirep->flight_time;
|
||||
$pirep->aircraft->save();
|
||||
|
||||
Log::info('PIREP ' . $pirep->id . ' state change to REJECTED');
|
||||
|
||||
event(new PirepRejected($pirep));
|
||||
|
@ -2,8 +2,9 @@
|
||||
<thead>
|
||||
<th>Subfleet</th>
|
||||
<th>Name</th>
|
||||
<th style="text-align: center;">ICAO</th>
|
||||
{{--<th style="text-align: center;">ICAO</th>--}}
|
||||
<th style="text-align: center;">Registration</th>
|
||||
<th style="text-align: center;">Hours</th>
|
||||
<th style="text-align: center;">Active</th>
|
||||
<th style="text-align: right;"></th>
|
||||
</thead>
|
||||
@ -21,7 +22,10 @@
|
||||
</td>
|
||||
<td><a href="{!! route('admin.aircraft.edit', [$ac->id]) !!}">{!! $ac->name !!}</a></td>
|
||||
<td style="text-align: center;">{!! $ac->icao !!}</td>
|
||||
<td style="text-align: center;">{!! $ac->registration !!}</td>
|
||||
{{--<td style="text-align: center;">{!! $ac->registration !!}</td>--}}
|
||||
<td style="text-align: center;">
|
||||
{!! Utils::minutesToTimeString($ac->flight_hours) !!}
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
@if($ac->active == GenericState::ACTIVE)
|
||||
<span class="label label-success">{!! GenericState::label($ac->active); !!}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user