diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index 9f10837b..1196b54a 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -32,6 +32,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; * @property Carbon block_on_time * @property integer block_time * @property integer flight_time In minutes + * @property integer planned_flight_time * @property User user * @property Flight|null flight * @property Collection fields @@ -212,6 +213,23 @@ class Pirep extends Model } } + /** + * Return the flight progress in a percent. + */ + public function getProgressPercentAttribute() + { + $upper_bound = $this->flight_time; + if($this->planned_flight_time) { + $upper_bound = $this->planned_flight_time; + } + + if(!$upper_bound) { + $upper_bound = 1; + } + + return round(($this->flight_time / $upper_bound) * 100, 0); + } + /** * Look up the flight, based on the PIREP flight info * @return Flight|null diff --git a/resources/views/layouts/default/pireps/map.blade.php b/resources/views/layouts/default/pireps/map.blade.php index 47940945..ed447677 100644 --- a/resources/views/layouts/default/pireps/map.blade.php +++ b/resources/views/layouts/default/pireps/map.blade.php @@ -1,7 +1,4 @@
-
- {{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }})
-
- {{ $pirep->created_at->toDayDateTimeString() }}
-
+
Arrived {{$pirep->created_at->diffForHumans()}}
+ + +
+
+ {{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }})
+
+ @if($pirep->block_off_time->toDayDateTimeString())
+ {{ $pirep->block_off_time->toDayDateTimeString() }}
+ @endif
+
+
+ {{ $pirep->arr_airport->full_name }} ({{ $pirep->arr_airport_id }})
+
+ @if($pirep->block_on_time)
+ {{ $pirep->block_on_time->toDayDateTimeString() }}
+ @endif
+
| Status | +Status |
- @if($pirep->state === PirepState::PENDING)
-
- @elseif($pirep->state === PirepState::ACCEPTED)
-
- @elseif($pirep->state === PirepState::REJECTED)
-
- @else
-
- @endif
-
- {{ PirepState::label($pirep->state) }}
-
-
- source: {{ PirepSource::label($pirep->source) }}
-
+ @php
+ if($pirep->state === PirepState::PENDING)
+ $badge = 'warning';
+ elseif ($pirep->state === PirepState::ACCEPTED)
+ $badge = 'success';
+ elseif ($pirep->state === PirepState::REJECTED)
+ $badge = 'danger';
+ else
+ $badge = 'info';
+ @endphp
+
+ {{ PirepState::label($pirep->state) }}
+
|
|
| Departure/Arrival | -- {{ $pirep->dpt_airport->name }} - ({{$pirep->dpt_airport->icao}}) - to - {{ $pirep->arr_airport->name }} - ({{$pirep->arr_airport->icao}}) - | +Source | +{{ PirepSource::label($pirep->source) }} |
| Departure/Arrival | --}} + {{----}} + {{--{{ $pirep->dpt_airport->name }}--}} + {{--({{$pirep->dpt_airport->icao}})--}} + {{--to--}} + {{--{{ $pirep->arr_airport->name }}--}} + {{--({{$pirep->arr_airport->icao}})--}} + {{-- | --}} + {{--||
| Flight Type | {{ \App\Models\Enums\FlightType::label($pirep->flight_type) }} | ||
| Flight Time | -- {{ Utils::minutesToTimeString($pirep->flight_time) }} - | -||
| Filed Route | @@ -100,12 +144,10 @@ |