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 @@
-
-
flight map
-
diff --git a/resources/views/layouts/default/pireps/show.blade.php b/resources/views/layouts/default/pireps/show.blade.php index dc9566d2..5ccbcd71 100644 --- a/resources/views/layouts/default/pireps/show.blade.php +++ b/resources/views/layouts/default/pireps/show.blade.php @@ -2,82 +2,126 @@ @section('title', 'PIREP '.$pirep->ident) @section('content') -
-
-

{{$pirep->airline->code}}{{ $pirep->ident }}
- Arrived {{$pirep->created_at->diffForHumans()}}

-
- -
-

- @if(filled($pirep->dpt_airport->iata)) - {{ $pirep->dpt_airport->iata }} - @endif - {{ $pirep->dpt_airport->location }} -

-

- - {{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }}) -
- {{ $pirep->created_at->toDayDateTimeString() }} -

-
-
- -
-
+
+
+

+

{{$pirep->airline->code}}{{ $pirep->ident }}

+

Arrived {{$pirep->created_at->diffForHumans()}}

+

+ +
+
+
+ {{-- + DEPARTURE INFO + --}} +
+

+ {{$pirep->dpt_airport->location}} +

+

+ + {{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }}) +
+ @if($pirep->block_off_time->toDayDateTimeString()) + {{ $pirep->block_off_time->toDayDateTimeString() }} + @endif +

+
+ + {{-- + ARRIVAL INFO + --}} +
+

+ {{$pirep->arr_airport->location}} +

+

+ + {{ $pirep->arr_airport->full_name }} ({{ $pirep->arr_airport_id }}) +
+ @if($pirep->block_on_time) + {{ $pirep->block_on_time->toDayDateTimeString() }} + @endif +

+
+
+ +
+
+
+
+ {{ Utils::minutesToTimeString($pirep->flight_time) }} +
+
+
+
+ +
+
+ @include('pireps.map') +
+
+
+ + {{-- + + SIDEBAR + + --}} + +
+
flight info
- + + - - + + + {{----}} + {{----}} + {{----}} + {{----}} - - - - -
StatusStatus - @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 @@
-
-
- {{-- - Show the fields that have been entered - --}} + @if(count($pirep->fields) > 0 || count($pirep->fares) > 0) +
+ @endif @if(count($pirep->fields) > 0)
fields
@@ -125,11 +167,14 @@ @endif + @if(count($pirep->fares) > 0) +
+ @endif + {{-- Show the fares that have been entered --}} @if(count($pirep->fares) > 0) -
fares
@@ -153,8 +198,6 @@
- @include('pireps.map') - @if(count($pirep->acars_logs) > 0)