Reorganized PIREP page
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h5>flight map</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="box-body">
|
||||
<div id="map" style="width: 100%; height: 800px"></div>
|
||||
|
||||
@@ -2,82 +2,126 @@
|
||||
@section('title', 'PIREP '.$pirep->ident)
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>{{$pirep->airline->code}}{{ $pirep->ident }}<br />
|
||||
<small>Arrived {{$pirep->created_at->diffForHumans()}}</small></h3>
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-left">
|
||||
<h4>
|
||||
@if(filled($pirep->dpt_airport->iata))
|
||||
{{ $pirep->dpt_airport->iata }}
|
||||
@endif
|
||||
<small>{{ $pirep->dpt_airport->location }}</small>
|
||||
</h4>
|
||||
<p>
|
||||
<a href="{{route('frontend.airports.show', ['id' => $pirep->dpt_airport_id])}}">
|
||||
{{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }})</a>
|
||||
<br />
|
||||
{{ $pirep->created_at->toDayDateTimeString() }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p>
|
||||
<h2 style="margin-bottom: 5px;">{{$pirep->airline->code}}{{ $pirep->ident }}</h2>
|
||||
<p>Arrived {{$pirep->created_at->diffForHumans()}}</p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{--
|
||||
DEPARTURE INFO
|
||||
--}}
|
||||
<div class="col-6 text-left">
|
||||
<h4>
|
||||
{{$pirep->dpt_airport->location}}
|
||||
</h4>
|
||||
<p>
|
||||
<a href="{{route('frontend.airports.show', ['id' => $pirep->dpt_airport_id])}}">
|
||||
{{ $pirep->dpt_airport->full_name }} ({{ $pirep->dpt_airport_id }})</a>
|
||||
<br/>
|
||||
@if($pirep->block_off_time->toDayDateTimeString())
|
||||
{{ $pirep->block_off_time->toDayDateTimeString() }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{--
|
||||
ARRIVAL INFO
|
||||
--}}
|
||||
<div class="col-6 text-right">
|
||||
<h4>
|
||||
{{$pirep->arr_airport->location}}
|
||||
</h4>
|
||||
<p>
|
||||
<a href="{{route('frontend.airports.show', ['id' => $pirep->arr_airport_id])}}">
|
||||
{{ $pirep->arr_airport->full_name }} ({{ $pirep->arr_airport_id }})</a>
|
||||
<br/>
|
||||
@if($pirep->block_on_time)
|
||||
{{ $pirep->block_on_time->toDayDateTimeString() }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="progress" style="margin: 20px 0;">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar"
|
||||
aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width: {{$pirep->progress_percent}}%">
|
||||
{{ Utils::minutesToTimeString($pirep->flight_time) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('pireps.map')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--
|
||||
|
||||
SIDEBAR
|
||||
|
||||
--}}
|
||||
|
||||
<div class="col-4">
|
||||
|
||||
<h5>flight info</h5>
|
||||
<table class="table table-hover table-condensed">
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td width="30%">Status</td>
|
||||
<td>
|
||||
@if($pirep->state === PirepState::PENDING)
|
||||
<div class="badge badge-warning">
|
||||
@elseif($pirep->state === PirepState::ACCEPTED)
|
||||
<div class="badge badge-success">
|
||||
@elseif($pirep->state === PirepState::REJECTED)
|
||||
<div class="badge badge-danger">
|
||||
@else
|
||||
<div class="badge badge-info">
|
||||
@endif
|
||||
|
||||
{{ PirepState::label($pirep->state) }}</div>
|
||||
|
||||
<span class="description" style="padding-left: 20px;">
|
||||
source: {{ PirepSource::label($pirep->source) }}
|
||||
</span>
|
||||
@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
|
||||
<div class="badge badge-{{$badge}}">
|
||||
{{ PirepState::label($pirep->state) }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Departure/Arrival</td>
|
||||
<td>
|
||||
{{ $pirep->dpt_airport->name }}
|
||||
(<a href="{{route('frontend.airports.show', [
|
||||
'id' => $pirep->dpt_airport->icao
|
||||
])}}">{{$pirep->dpt_airport->icao}}</a>)
|
||||
<span class="description">to</span>
|
||||
{{ $pirep->arr_airport->name }}
|
||||
(<a href="{{route('frontend.airports.show', [
|
||||
'id' => $pirep->arr_airport->icao
|
||||
])}}">{{$pirep->arr_airport->icao}}</a>)
|
||||
</td>
|
||||
<td>Source</td>
|
||||
<td>{{ PirepSource::label($pirep->source) }}</td>
|
||||
</tr>
|
||||
{{--<tr>--}}
|
||||
{{--<td>Departure/Arrival</td>--}}
|
||||
{{--<td>--}}
|
||||
{{--{{ $pirep->dpt_airport->name }}--}}
|
||||
{{--(<a href="{{route('frontend.airports.show', [--}}
|
||||
{{--'id' => $pirep->dpt_airport->icao--}}
|
||||
{{--])}}">{{$pirep->dpt_airport->icao}}</a>)--}}
|
||||
{{--<span class="description">to</span>--}}
|
||||
{{--{{ $pirep->arr_airport->name }}--}}
|
||||
{{--(<a href="{{route('frontend.airports.show', [--}}
|
||||
{{--'id' => $pirep->arr_airport->icao--}}
|
||||
{{--])}}">{{$pirep->arr_airport->icao}}</a>)--}}
|
||||
{{--</td>--}}
|
||||
{{--</tr>--}}
|
||||
|
||||
<tr>
|
||||
<td>Flight Type</td>
|
||||
<td>{{ \App\Models\Enums\FlightType::label($pirep->flight_type) }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Flight Time</td>
|
||||
<td>
|
||||
{{ Utils::minutesToTimeString($pirep->flight_time) }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Filed Route</td>
|
||||
<td>
|
||||
@@ -100,12 +144,10 @@
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
{{--
|
||||
Show the fields that have been entered
|
||||
--}}
|
||||
@if(count($pirep->fields) > 0 || count($pirep->fares) > 0)
|
||||
<div class="separator"></div>
|
||||
@endif
|
||||
|
||||
@if(count($pirep->fields) > 0)
|
||||
<h5>fields</h5>
|
||||
@@ -125,11 +167,14 @@
|
||||
</table>
|
||||
@endif
|
||||
|
||||
@if(count($pirep->fares) > 0)
|
||||
<div class="separator"></div>
|
||||
@endif
|
||||
|
||||
{{--
|
||||
Show the fares that have been entered
|
||||
--}}
|
||||
@if(count($pirep->fares) > 0)
|
||||
<div class="separator"></div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5>fares</h5>
|
||||
@@ -153,8 +198,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('pireps.map')
|
||||
|
||||
@if(count($pirep->acars_logs) > 0)
|
||||
<div class="separator"></div>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user