Cleanup Simbrief Briefing pages

This commit is contained in:
Nabeel Shahzad
2021-01-17 21:52:22 -05:00
parent c4dee07b7f
commit bd8e13e78f
6 changed files with 466 additions and 429 deletions

View File

@@ -57,16 +57,13 @@ class SimBriefController
return redirect(route('frontend.flights.index')); return redirect(route('frontend.flights.index'));
} }
if (!$aircraft_id) {
flash()->error('Aircraft not selected ! Please select an Aircraft to Proceed ...');
}
$apiKey = setting('simbrief.api_key'); $apiKey = setting('simbrief.api_key');
if (empty($apiKey)) { if (empty($apiKey)) {
flash()->error('Invalid SimBrief API key!'); flash()->error('Invalid SimBrief API key!');
return redirect(route('frontend.flights.index')); return redirect(route('frontend.flights.index'));
} }
// Check if a Simbrief profile already exists
$simbrief = SimBrief::select('id')->where([ $simbrief = SimBrief::select('id')->where([
'flight_id' => $flight_id, 'flight_id' => $flight_id,
'user_id' => $user->id, 'user_id' => $user->id,
@@ -76,6 +73,7 @@ class SimBriefController
return redirect(route('frontend.simbrief.briefing', [$simbrief->id])); return redirect(route('frontend.simbrief.briefing', [$simbrief->id]));
} }
// Simbrief Profile doesn't exist; prompt the user to create a new one
$aircraft = Aircraft::select('registration', 'name', 'icao', 'iata', 'subfleet_id') $aircraft = Aircraft::select('registration', 'name', 'icao', 'iata', 'subfleet_id')
->where('id', $aircraft_id) ->where('id', $aircraft_id)
->get(); ->get();
@@ -92,11 +90,22 @@ class SimBriefController
$pax_weight = 208; $pax_weight = 208;
} }
// No aircraft selected, show that form
if (!$aircraft_id) {
return view('flights.simbrief_aircraft', [
'flight' => $flight,
'aircraft' => $aircraft,
'subfleets' => $subfleets,
'pax_weight' => $pax_weight,
]);
}
// Show the main simbrief form
return view('flights.simbrief_form', [ return view('flights.simbrief_form', [
'flight' => $flight, 'flight' => $flight,
'aircraft' => $aircraft, 'aircraft' => $aircraft,
'subfleets' => $subfleets, 'subfleets' => $subfleets,
'pax_weight' => $pax_weight, // TODO: Replace with a setting 'pax_weight' => $pax_weight,
]); ]);
} }
@@ -136,21 +145,30 @@ class SimBriefController
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* *
* @throws \Exception
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/ */
public function remove(Request $request) public function generate_new(Request $request)
{ {
$sb_pack = SimBrief::find($request->id); $simbrief = SimBrief::find($request->id);
if ($sb_pack) {
if (!$sb_pack->pirep_id) { // Invalid Simbrief ID/profile, go back to the main flight index
$sb_pack->delete(); if (!$simbrief) {
} else { return redirect(route('frontend.flights.index'));
$sb_pack->flight_id = null;
$sb_pack->save();
}
} }
return redirect(route('frontend.flights.index')); // Cleanup the current Simbrief entry and redirect to the new generation form
// If there isn't a PIREP ID, then delete the entry, otherwise, remove the flight
$flight_id = $simbrief->flight_id;
if (!$simbrief->pirep_id) {
$simbrief->delete();
} else {
$simbrief->flight_id = null;
$simbrief->save();
}
return redirect(route('frontend.simbrief.generate').'?flight_id='.$flight_id);
} }
/** /**

View File

@@ -147,7 +147,7 @@ class RouteServiceProvider extends ServiceProvider
Route::get('simbrief/{id}', 'SimBriefController@briefing')->name('simbrief.briefing'); Route::get('simbrief/{id}', 'SimBriefController@briefing')->name('simbrief.briefing');
Route::get('simbrief/{id}/prefile', 'SimBriefController@prefile')->name('simbrief.prefile'); Route::get('simbrief/{id}/prefile', 'SimBriefController@prefile')->name('simbrief.prefile');
Route::get('simbrief/{id}/cancel', 'SimBriefController@cancel')->name('simbrief.cancel'); Route::get('simbrief/{id}/cancel', 'SimBriefController@cancel')->name('simbrief.cancel');
Route::get('simbrief/{id}/remove', 'SimBriefController@remove')->name('simbrief.remove'); Route::get('simbrief/{id}/generate_new', 'SimBriefController@generate_new')->name('simbrief.generate_new');
}); });
Route::group([ Route::group([

View File

@@ -10,7 +10,7 @@
<div class="mt-1"> <div class="mt-1">
<div class="form-group"> <div class="form-group">
<p>@lang('common.airline')</p> <p>@lang('common.airline')</p>
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control form-control-sm select2']) }} {{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
</div> </div>
</div> </div>

View File

@@ -0,0 +1,47 @@
@extends('app')
@section('title', 'SimBrief Flight Planning')
@section('content')
<div class="row">
<div class="col-md-12">
<h2>Select Aircraft for Flight</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<select id="aircraftselection" class="form-control select2" onchange="checkacselection()">
<option value="ZZZZZ">Please Select An Aircraft</option>
@foreach($subfleets as $subfleet)
@foreach($subfleet->aircraft as $ac)
<option value="{{ $ac->id }}">[ {{ $ac->icao }} ] {{ $ac->registration }}</option>
@endforeach
@endforeach
</select>
</div>
<div class="col-md-12 text-right">
<a id="generate_link" style="visibility: hidden"
href="{{ route('frontend.simbrief.generate') }}?flight_id={{ $flight->id }}"
class="btn btn-primary">Proceed To Flight Planning</a>
</div>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
// Simple Aircraft Selection With Dropdown Change
// Also keep Generate button hidden until a valid AC selection
const $oldlink = document.getElementById("generate_link").href;
function checkacselection() {
if (document.getElementById("aircraftselection").value === "ZZZZZ") {
document.getElementById('generate_link').style.visibility = 'hidden';
} else {
document.getElementById('generate_link').style.visibility = 'visible';
}
const selectedac = document.getElementById("aircraftselection").value;
const newlink = "&aircraft_id=".concat(selectedac);
document.getElementById("generate_link").href = $oldlink.concat(newlink);
}
</script>
@endsection

View File

@@ -10,14 +10,14 @@
<div class="col-sm-3"> <div class="col-sm-3">
@if (empty($simbrief->pirep_id)) @if (empty($simbrief->pirep_id))
<a class="btn btn-outline-info pull-right btn-lg" <a class="btn btn-outline-info pull-right btn-lg"
style="margin-top: -10px;margin-bottom: 5px" style="margin-top: -10px; margin-bottom: 5px"
href="{{ url(route('frontend.simbrief.prefile', [$simbrief->id])) }}">Prefile PIREP</a> href="{{ url(route('frontend.simbrief.prefile', [$simbrief->id])) }}">Prefile PIREP</a>
@endif @endif
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<a class="btn btn-primary pull-right btn-lg" <a class="btn btn-primary pull-right btn-lg"
style="margin-top: -10px;margin-bottom: 5px" style="margin-top: -10px; margin-bottom: 5px"
href="{{ url(route('frontend.simbrief.remove', [$simbrief->id])) }}">Generate New OFP</a> href="{{ url(route('frontend.simbrief.generate_new', [$simbrief->id])) }}">Generate New OFP</a>
</div> </div>
</div> </div>

View File

@@ -2,365 +2,337 @@
@section('title', 'SimBrief Flight Planning') @section('title', 'SimBrief Flight Planning')
@section('content') @section('content')
@php
$loadmin = $flight->load_factor - $flight->load_factor_variance;
$loadmax = $flight->load_factor + $flight->load_factor_variance;
if($loadmin < 1) { $loadmin = 1; }
if($loadmax > 100) { $loadmax = 100; }
@endphp
@if(empty(request()->get('aircraft_id'))) @foreach($aircraft as $acdetails)
<div class="row">
<div class="col-md-12">
<h2>Aircraft Selection</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<select id="aircraftselection" class="form-control select2" onchange="checkacselection()">
<option value="ZZZZZ">Please Select An Aircraft</option>
@foreach($subfleets as $subfleet)
@foreach($subfleet->aircraft as $ac)
<option value="{{ $ac->id }}">[ {{ $ac->icao }} ] {{ $ac->registration }}</option>
@endforeach
@endforeach
</select>
</div>
<div class="col-md-6">
<a id="mylink" style="visibility: hidden"
href="{{ route('frontend.simbrief.generate') }}?flight_id={{ $flight->id }}" class="btn btn-primary">Proceed
To Flight Planning</a>
</div>
</div>
@else
@php @php
$loadmin = $flight->load_factor - $flight->load_factor_variance; $simbrieftype = $acdetails->icao ;
$loadmax = $flight->load_factor + $flight->load_factor_variance; $subflid = $acdetails->subfleet_id ;
if($loadmin < 1) { $loadmin = 1; } if($acdetails->icao === 'A20N') { $simbrieftype = 'A320'; }
if($loadmax > 100) { $loadmax = 100; } if($acdetails->icao === 'A21N') { $simbrieftype = 'A321'; }
if($acdetails->icao === 'B77L') { $simbrieftype = 'B77F'; }
if($acdetails->icao === 'B773') { $simbrieftype = 'B77W'; }
if($acdetails->icao === 'E35L') { $simbrieftype = 'E135'; }
@endphp @endphp
@endforeach
@foreach($aircraft as $acdetails) <form id="sbapiform">
@php <div class="row">
$simbrieftype = $acdetails->icao ; <h2>Create Simbrief Briefing</h2>
$subflid = $acdetails->subfleet_id ; <div class="card">
if($acdetails->icao === 'A20N') { $simbrieftype = 'A320'; } <div class="col-md-12">
if($acdetails->icao === 'A21N') { $simbrieftype = 'A321'; } <div class="row">
if($acdetails->icao === 'B77L') { $simbrieftype = 'B77F'; } <div class="col-8">
if($acdetails->icao === 'B773') { $simbrieftype = 'B77W'; } <div class="form-container">
if($acdetails->icao === 'E35L') { $simbrieftype = 'E135'; } <div class="form-container-body">
@endphp <h6><i class="fas fa-info-circle"></i>&nbsp;Aircraft Details</h6>
@endforeach <div class="row">
<div class="col-sm-4">
<form id="sbapiform"> <label for="type">Type</label>
<div class="row"> <input type="text" class="form-control" value="{{ $acdetails->icao }}" maxlength="4" disabled/>
<div class="card"> <input type="hidden" id="type" name="type" class="form-control" value="{{ $simbrieftype }}"
<div class="col-md-12"> maxlength="4"/>
<h2>Create Flight Briefing Package</h2> </div>
<div class="row"> <div class="col-sm-4">
<div class="col-8"> <label for="reg">Registration</label>
<div class="form-container"> <input type="text" class="form-control" value="{{ $acdetails->registration }}" maxlength="6"
<div class="form-container-body"> disabled/>
<h6><i class="fas fa-info-circle"></i>&nbsp;Aircraft Details</h6> <input type="hidden" id="reg" name="reg" value="{{ $acdetails->registration }}"/>
<div class="row">
<div class="col-sm-4">
<label for="type">Type</label>
<input type="text" class="form-control" value="{{ $acdetails->icao }}" maxlength="4" disabled/>
<input type="hidden" id="type" name="type" class="form-control" value="{{ $simbrieftype }}"
maxlength="4"/>
</div>
<div class="col-sm-4">
<label for="reg">Registration</label>
<input type="text" class="form-control" value="{{ $acdetails->registration }}" maxlength="6"
disabled/>
<input type="hidden" id="reg" name="reg" value="{{ $acdetails->registration }}"/>
</div>
</div> </div>
<br>
</div> </div>
<br>
</div>
<div class="form-container-body"> <div class="form-container-body">
<h6><i class="fas fa-info-circle"></i>&nbsp;@lang('pireps.flightinformations') for <h6><i class="fas fa-info-circle"></i>&nbsp;@lang('pireps.flightinformations') for
<b>{{ $flight->airline->icao }} {{ $flight->flight_number }}</b></h6> <b>{{ $flight->airline->icao }} {{ $flight->flight_number }}</b></h6>
<div class="row"> <div class="row">
<div class="col-sm-4"> <div class="col-sm-4">
<label for="dorig">Departure Airport</label> <label for="dorig">Departure Airport</label>
<input id="dorig" type="text" class="form-control" maxlength="4" <input id="dorig" type="text" class="form-control" maxlength="4"
value="{{ $flight->dpt_airport_id }}" disabled/> value="{{ $flight->dpt_airport_id }}" disabled/>
<input id="orig" name="orig" type="hidden" maxlength="4" value="{{ $flight->dpt_airport_id }}"/> <input id="orig" name="orig" type="hidden" maxlength="4" value="{{ $flight->dpt_airport_id }}"/>
</div>
<div class="col-sm-4">
<label for="ddest">Arrival Airport</label>
<input id="ddest" type="text" class="form-control" maxlength="4"
value="{{ $flight->arr_airport_id }}" disabled/>
<input id="dest" name="dest" type="hidden" maxlength="4" value="{{ $flight->arr_airport_id }}"/>
</div>
<div class="col-sm-4">
<label for="altn">Alternate Airport</label>
<input id="altn" name="altn" type="text" class="form-control" maxlength="4"
value="{{ $flight->alt_airport_id ?? 'AUTO' }}"/>
</div>
</div> </div>
<br> <div class="col-sm-4">
<div class="row"> <label for="ddest">Arrival Airport</label>
<div class="col-sm-8"> <input id="ddest" type="text" class="form-control" maxlength="4"
<label for="route">Preferred Company Route</label> value="{{ $flight->arr_airport_id }}" disabled/>
<input id="route" name="route" type="text" class="form-control" placeholder="" maxlength="1000" <input id="dest" name="dest" type="hidden" maxlength="4" value="{{ $flight->arr_airport_id }}"/>
value="{{ $flight->route }}"/>
</div>
<div class="col-sm-4">
<label for="fl">Preferred Flight Level</label>
<input id="fl" name="fl" type="text" class="form-control" placeholder="" maxlength="5"
value="{{ $flight->level }}"/>
</div>
</div> </div>
<br> <div class="col-sm-4">
<div class="row"> <label for="altn">Alternate Airport</label>
<div class="col-sm-4"> <input id="altn" name="altn" type="text" class="form-control" maxlength="4"
<label for="std">Scheduled Departure Time (UTC)</label> value="{{ $flight->alt_airport_id ?? 'AUTO' }}"/>
<input id="std" type="text" class="form-control" placeholder="" maxlength="4"
value="{{ $flight->dpt_time }}" disabled/>
</div>
<div class="col-sm-4">
<label for="etd">Estimated Departure Time (UTC)</label>
<input id="etd" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
</div>
<div class="col-sm-4">
<label for="dof">Date Of Flight (UTC)</label>
<input id="dof" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
</div>
</div> </div>
<br>
</div> </div>
<br>
<div class="row">
<div class="col-sm-8">
<label for="route">Preferred Company Route</label>
<input id="route" name="route" type="text" class="form-control" placeholder="" maxlength="1000"
value="{{ $flight->route }}"/>
</div>
<div class="col-sm-4">
<label for="fl">Preferred Flight Level</label>
<input id="fl" name="fl" type="text" class="form-control" placeholder="" maxlength="5"
value="{{ $flight->level }}"/>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-4">
<label for="std">Scheduled Departure Time (UTC)</label>
<input id="std" type="text" class="form-control" placeholder="" maxlength="4"
value="{{ $flight->dpt_time }}" disabled/>
</div>
<div class="col-sm-4">
<label for="etd">Estimated Departure Time (UTC)</label>
<input id="etd" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
</div>
<div class="col-sm-4">
<label for="dof">Date Of Flight (UTC)</label>
<input id="dof" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
</div>
</div>
<br>
</div>
<div class="form-container-body"> <div class="form-container-body">
@foreach($subfleets as $subfleet) @foreach($subfleets as $subfleet)
@if($subfleet->id == $subflid) @if($subfleet->id == $subflid)
<h6><i class="fas fa-info-circle"></i>&nbsp;Configuration And Load Information For <h6><i class="fas fa-info-circle"></i>&nbsp;Configuration And Load Information For
<b>{{ $subfleet->name }} ; {{ $acdetails->registration }}</b></h6> <b>{{ $subfleet->name }} ; {{ $acdetails->registration }}</b></h6>
{{-- Generate Load Figures --}} {{-- Generate Load Figures --}}
<div class="row"> <div class="row">
{{-- Create and send some data to the $loadarray for MANUALRMK generation --}} {{-- Create and send some data to the $loadarray for MANUALRMK generation --}}
@php $loadarray = [] ; @endphp @php $loadarray = [] ; @endphp
@foreach($subfleet->fares as $fare) @foreach($subfleet->fares as $fare)
@if($fare->capacity > 0) @if($fare->capacity > 0)
@php @php
$randomloadperfare = ceil(($fare->capacity * (rand($loadmin, $loadmax))) /100); $randomloadperfare = ceil(($fare->capacity * (rand($loadmin, $loadmax))) /100);
$loadarray[] = ['SeatType' => $fare->code]; $loadarray[] = ['SeatType' => $fare->code];
$loadarray[] = ['SeatLoad' => $randomloadperfare]; $loadarray[] = ['SeatLoad' => $randomloadperfare];
@endphp @endphp
<div class="col-sm-4">
<label for="LoadFare{{ $fare->id }}">{{ $fare->name }} Load [
Max: {{ number_format($fare->capacity) }} ]</label>
<input id="LoadFare{{ $fare->id }}" type="text" class="form-control"
value="{{ number_format($randomloadperfare) }} @if($randomloadperfare > '900') {{ setting('units.weight') }} @endif"
disabled/>
</div>
@endif
@endforeach
@php
$loadcollection = collect($loadarray) ;
$totalgenload = $loadcollection->sum('SeatLoad') ;
@endphp
</div>
@if($totalgenload > 0 && $totalgenload < 900)
<input type="hidden" name="acdata" value="{'paxwgt':{{ $pax_weight }}}">
<br>
<div class="row">
<div class="col-sm-4"> <div class="col-sm-4">
@if(setting('units.weight') === 'kg') <label for="LoadFare{{ $fare->id }}">{{ $fare->name }} Load [
@php $estimatedpayload = number_format(round(($pax_weight * $totalgenload) / 2.2)) ; @endphp Max: {{ number_format($fare->capacity) }} ]</label>
@else <input id="LoadFare{{ $fare->id }}" type="text" class="form-control"
@php $estimatedpayload = number_format(round($pax_weight * $totalgenload)) ; @endphp value="{{ number_format($randomloadperfare) }} @if($randomloadperfare > '900') {{ setting('units.weight') }} @endif"
@endif disabled/>
<label for="EstimatedLoad">Estimated Payload For {{ $totalgenload }} Pax</label>
<input id="EstimatedLoad" type="text" class="form-control"
value="{{ $estimatedpayload }} {{ setting('units.weight') }}" disabled/>
</div> </div>
@endif
@endforeach
@php
$loadcollection = collect($loadarray) ;
$totalgenload = $loadcollection->sum('SeatLoad') ;
@endphp
</div>
@if($totalgenload > 0 && $totalgenload < 900)
<input type="hidden" name="acdata" value="{'paxwgt':{{ $pax_weight }}}">
<br>
<div class="row">
<div class="col-sm-4">
@if(setting('units.weight') === 'kg')
@php $estimatedpayload = number_format(round(($pax_weight * $totalgenload) / 2.2)) ; @endphp
@else
@php $estimatedpayload = number_format(round($pax_weight * $totalgenload)) ; @endphp
@endif
<label for="EstimatedLoad">Estimated Payload For {{ $totalgenload }} Pax</label>
<input id="EstimatedLoad" type="text" class="form-control"
value="{{ $estimatedpayload }} {{ setting('units.weight') }}" disabled/>
</div> </div>
<input type="hidden" id="pax" name="pax" class="form-control" value="{{ $totalgenload }}"/> </div>
@elseif($totalgenload > 900) <input type="hidden" id="pax" name="pax" class="form-control" value="{{ $totalgenload }}"/>
<input type='hidden' id="pax" name='pax' value='0' maxlength='3'> @elseif($totalgenload > 900)
<input type='hidden' id="cargo" name='cargo' value="{{ $totalgenload }}" maxlength='7'> <input type='hidden' id="pax" name='pax' value='0' maxlength='3'>
@endif <input type='hidden' id="cargo" name='cargo' value="{{ $totalgenload }}" maxlength='7'>
@endif @endif
@endforeach @endif
</div> @endforeach
</div> </div>
</div> </div>
{{-- </div>
Here we generate the MANUALRMK which is sent to SimBrief and displayed in the generated {{--
ofp as Dispatch Remarks. $loadarray is created and filled with data during random load Here we generate the MANUALRMK which is sent to SimBrief and displayed in the generated
generation, it holds each fare's code and the generated load then we are imploding that ofp as Dispatch Remarks. $loadarray is created and filled with data during random load
array to get the fare codes and load counts. generation, it holds each fare's code and the generated load then we are imploding that
array to get the fare codes and load counts.
Returned string will be like Load Distribution Y 132 C 12 F 4 Returned string will be like Load Distribution Y 132 C 12 F 4
--}} --}}
@if($totalgenload > 0) @if($totalgenload > 0)
@php @php
$loaddisttxt = "Load Distribution "; $loaddisttxt = "Load Distribution ";
$loaddist = implode(' ', array_map( $loaddist = implode(' ', array_map(
function ($v, $k) { function ($v, $k) {
if(is_array($v)){ if(is_array($v)){
return implode('&'.' '.':', $v); return implode('&'.' '.':', $v);
}else{ }else{
return $k.':'.$v; return $k.':'.$v;
} }
}, },
$loadarray, array_keys($loadarray) $loadarray, array_keys($loadarray)
)); ));
@endphp @endphp
<input type="hidden" name="manualrmk" value="{{ $loaddisttxt }}{{ $loaddist }}"> <input type="hidden" name="manualrmk" value="{{ $loaddisttxt }}{{ $loaddist }}">
@endif @endif
<input type="hidden" name="airline" value="{{ $flight->airline->icao }}"> <input type="hidden" name="airline" value="{{ $flight->airline->icao }}">
<input type="hidden" name="fltnum" value="{{ $flight->flight_number }}"> <input type="hidden" name="fltnum" value="{{ $flight->flight_number }}">
<input type="hidden" id="steh" name="steh" maxlength="2"> <input type="hidden" id="steh" name="steh" maxlength="2">
<input type="hidden" id="stem" name="stem" maxlength="2"> <input type="hidden" id="stem" name="stem" maxlength="2">
<input type="hidden" id="date" name="date" maxlength="9"> <input type="hidden" id="date" name="date" maxlength="9">
<input type="hidden" id="deph" name="deph" maxlength="2"> <input type="hidden" id="deph" name="deph" maxlength="2">
<input type="hidden" id="depm" name="depm" maxlength="2"> <input type="hidden" id="depm" name="depm" maxlength="2">
<input type="hidden" name="selcal" value="BK-FS"> <input type="hidden" name="selcal" value="BK-FS">
<input type="hidden" name="planformat" value="lido"> <input type="hidden" name="planformat" value="lido">
<input type="hidden" name="omit_sids" value="0"> <input type="hidden" name="omit_sids" value="0">
<input type="hidden" name="omit_stars" value="0"> <input type="hidden" name="omit_stars" value="0">
<input type="hidden" name="cruise" value="CI"> <input type="hidden" name="cruise" value="CI">
<input type="hidden" name="civalue" value="AUTO"> <input type="hidden" name="civalue" value="AUTO">
<div class="col-4"> <div class="col-4">
<div class="form-container"> <div class="form-container">
<div class="form-container-body"> <div class="form-container-body">
<h6><i class="fas fa-info-circle"></i>&nbsp;Planning Options</h6> <h6><i class="fas fa-info-circle"></i>&nbsp;Planning Options</h6>
<table class="table table-hover table-striped"> <table class="table table-hover table-striped">
<tr> <tr>
<td>Cont Fuel:</td> <td>Cont Fuel:</td>
<td> <td>
<select name="contpct" class="form-control"> <select name="contpct" class="form-control">
<option value="auto">AUTO</option> <option value="auto">AUTO</option>
<option value="0">0 PCT</option> <option value="0">0 PCT</option>
<option value="0.02">2 PCT</option> <option value="0.02">2 PCT</option>
<option value="0.03">3 PCT</option> <option value="0.03">3 PCT</option>
<option value="0.05" selected>5 PCT</option> <option value="0.05" selected>5 PCT</option>
<option value="0.1">10 PCT</option> <option value="0.1">10 PCT</option>
<option value="0.15">15 PCT</option> <option value="0.15">15 PCT</option>
<option value="0.2">20 PCT</option> <option value="0.2">20 PCT</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Reserve Fuel:</td> <td>Reserve Fuel:</td>
<td> <td>
<select name="resvrule" class="form-control"> <select name="resvrule" class="form-control">
<option value="auto">AUTO</option> <option value="auto">AUTO</option>
<option value="0">0 MIN</option> <option value="0">0 MIN</option>
<option value="15">15 MIN</option> <option value="15">15 MIN</option>
<option value="30" selected>30 MIN</option> <option value="30" selected>30 MIN</option>
<option value="45">45 MIN</option> <option value="45">45 MIN</option>
<option value="60">60 MIN</option> <option value="60">60 MIN</option>
<option value="75">75 MIN</option> <option value="75">75 MIN</option>
<option value="90">90 MIN</option> <option value="90">90 MIN</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>SID/STAR Type:</td> <td>SID/STAR Type:</td>
<td> <td>
<select name="find_sidstar" class="form-control"> <select name="find_sidstar" class="form-control">
<option value="C">Conventional</option> <option value="C">Conventional</option>
<option value="R" selected>RNAV</option> <option value="R" selected>RNAV</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Plan Stepclimbs:</td> <td>Plan Stepclimbs:</td>
<td> <td>
<select id="stepclimbs" name="stepclimbs" class="form-control" onchange="DisableFL()"> <select id="stepclimbs" name="stepclimbs" class="form-control" onchange="DisableFL()">
<option value="0" selected>Disabled</option> <option value="0" selected>Disabled</option>
<option value="1">Enabled</option> <option value="1">Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>ETOPS Planning:</td> <td>ETOPS Planning:</td>
<td> <td>
<select name="etops" class="form-control"> <select name="etops" class="form-control">
<option value="0" selected>Disabled</option> <option value="0" selected>Disabled</option>
<option value="1">Enabled</option> <option value="1">Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<br> <br>
<div class="form-container-body"> <div class="form-container-body">
<h6><i class="fas fa-info-circle"></i>&nbsp;@lang('stisla.briefingoptions')</h6> <h6><i class="fas fa-info-circle"></i>&nbsp;@lang('stisla.briefingoptions')</h6>
<table class="table table-hover table-striped"> <table class="table table-hover table-striped">
<tr> <tr>
<td>Units:</td> <td>Units:</td>
<td> <td>
<select id="kgslbs" name="units" class="form-control"> <select id="kgslbs" name="units" class="form-control">
@if(setting('units.weight') === 'kg') @if(setting('units.weight') === 'kg')
<option value="KGS" selected>KGS</option> <option value="KGS" selected>KGS</option>
<option value="LBS">LBS</option> <option value="LBS">LBS</option>
@else @else
<option value="KGS">KGS</option> <option value="KGS">KGS</option>
<option value="LBS" selected>LBS</option> <option value="LBS" selected>LBS</option>
@endif @endif
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Detailed Navlog:</td> <td>Detailed Navlog:</td>
<td> <td>
<select name="navlog" class="form-control"> <select name="navlog" class="form-control">
<option value="0">Disabled</option> <option value="0">Disabled</option>
<option value="1" selected>Enabled</option> <option value="1" selected>Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Runway Analysis:</td> <td>Runway Analysis:</td>
<td> <td>
<select name="tlr" class="form-control"> <select name="tlr" class="form-control">
<option value="0">Disabled</option> <option value="0">Disabled</option>
<option value="1" selected>Enabled</option> <option value="1" selected>Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Include NOTAMS:</td> <td>Include NOTAMS:</td>
<td> <td>
<select name="notams" class="form-control"> <select name="notams" class="form-control">
<option value="0">Disabled</option> <option value="0">Disabled</option>
<option value="1" selected>Enabled</option> <option value="1" selected>Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>FIR NOTAMS:</td> <td>FIR NOTAMS:</td>
<td> <td>
<select name="firnot" class="form-control"> <select name="firnot" class="form-control">
<option value="0" selected>Disabled</option> <option value="0" selected>Disabled</option>
<option value="1">Enabled</option> <option value="1">Enabled</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Flight Maps:</td> <td>Flight Maps:</td>
<td> <td>
<select name="maps" class="form-control"> <select name="maps" class="form-control">
<option value="detail" selected>Detailed</option> <option value="detail" selected>Detailed</option>
<option value="simple">Simple</option> <option value="simple">Simple</option>
<option value="none">None</option> <option value="none">None</option>
</select> </select>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<br> <br>
<div class="form-container-body"> <div class="form-container-body">
<div class="float-right"> <div class="float-right">
<div class="form-group"> <div class="form-group">
<input type="button" <input type="button"
onclick="simbriefsubmit('{{ $flight->id }}', '{{ url(route('frontend.simbrief.briefing', [''])) }}');" onclick="simbriefsubmit('{{ $flight->id }}', '{{ url(route('frontend.simbrief.briefing', [''])) }}');"
class="btn btn-primary" value="Generate"> class="btn btn-primary" value="Generate">
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -369,83 +341,83 @@
</div> </div>
</div> </div>
</div> </div>
</form> </div>
@endif </form>
@endsection @endsection
@section('scripts') @section('scripts')
<script src="{{public_asset('/assets/global/js/simbrief.apiv1.js')}}"></script> <script src="{{public_asset('/assets/global/js/simbrief.apiv1.js')}}"></script>
<script type="text/javascript"> <script type="text/javascript">
// ****** // ******
// Disable Submitting a fixed flight level for Stepclimb option to work // Disable Submitting a fixed flight level for Stepclimb option to work
// Script is related to Plan Step Climbs selection // Script is related to Plan Step Climbs selection
function DisableFL() { function DisableFL() {
let climb = document.getElementById("stepclimbs").value; let climb = document.getElementById("stepclimbs").value;
if (climb === "0") { if (climb === "0") {
document.getElementById("fl").disabled = false document.getElementById("fl").disabled = false
}
if (climb === "1") {
document.getElementById("fl").disabled = true
}
}
</script>
<script type="text/javascript">
// ******
// Get current UTC time, add 45 minutes to it and format according to Simbrief API
// Script also rounds the minutes to nearest 5 to avoid a Departure time like 1538 ;)
// If you need to reduce the margin of 45 mins, change value below
let d = new Date();
const months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
d.setMinutes(d.getMinutes() + 45); // Change the value here
let deph = ("0" + d.getUTCHours(d)).slice(-2);
let depm = d.getUTCMinutes(d);
if (depm < 55) {
depm = Math.ceil(depm / 5) * 5;
} }
if (depm > 55) { if (climb === "1") {
depm = Math.floor(depm / 5) * 5; document.getElementById("fl").disabled = true
} }
}
</script>
<script type="text/javascript">
// ******
// Get current UTC time, add 45 minutes to it and format according to Simbrief API
// Script also rounds the minutes to nearest 5 to avoid a Departure time like 1538 ;)
// If you need to reduce the margin of 45 mins, change value below
let d = new Date();
const months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
d.setMinutes(d.getMinutes() + 45); // Change the value here
let deph = ("0" + d.getUTCHours(d)).slice(-2);
let depm = d.getUTCMinutes(d);
if (depm < 55) {
depm = Math.ceil(depm / 5) * 5;
}
depm = ("0" + depm).slice(-2); if (depm > 55) {
dept = deph + depm; depm = Math.floor(depm / 5) * 5;
let dof = ("0" + d.getUTCDate()).slice(-2) + months[d.getUTCMonth()] + d.getUTCFullYear(); }
document.getElementById("dof").setAttribute('value', dof); depm = ("0" + depm).slice(-2);
document.getElementById("etd").setAttribute('value', dept); dept = deph + depm;
document.getElementById("date").setAttribute('value', dof); // Sent to Simbrief let dof = ("0" + d.getUTCDate()).slice(-2) + months[d.getUTCMonth()] + d.getUTCFullYear();
document.getElementById("deph").setAttribute('value', deph); // Sent to SimBrief
document.getElementById("depm").setAttribute('value', depm); // Sent to SimBrief
</script>
<script type="text/javascript">
// ******
// Calculate the Scheduled Enroute Time for Simbrief API
// Your PHPVMS flight_time value must be from BLOCK to BLOCK
// Including departure and arrival taxi times
// If this value is not correctly calculated and configured
// Simbrief CI (Cost Index) calculation will not provide realistic results
let num = {{ $flight->flight_time }};
let hours = (num / 60);
let rhours = Math.floor(hours);
let minutes = (hours - rhours) * 60;
let rminutes = Math.round(minutes);
document.getElementById("steh").setAttribute('value', rhours.toString()); // Sent to Simbrief
document.getElementById("stem").setAttribute('value', rminutes.toString()); // Sent to Simbrief
</script>
<script type="text/javascript">
// *** Simple Aircraft Selection With Dropdown Change
// *** Also keep Generate button hidden until a valid AC selection
const $oldlink = document.getElementById("mylink").href;
function checkacselection() { document.getElementById("dof").setAttribute('value', dof);
if (document.getElementById("aircraftselection").value === "ZZZZZ") { document.getElementById("etd").setAttribute('value', dept);
document.getElementById('mylink').style.visibility = 'hidden'; document.getElementById("date").setAttribute('value', dof); // Sent to Simbrief
} else { document.getElementById("deph").setAttribute('value', deph); // Sent to SimBrief
document.getElementById('mylink').style.visibility = 'visible'; document.getElementById("depm").setAttribute('value', depm); // Sent to SimBrief
} </script>
var $selectedac = document.getElementById("aircraftselection").value; <script type="text/javascript">
var $newlink = "&aircraft_id=".concat($selectedac); // ******
document.getElementById("mylink").href = $oldlink.concat($newlink); // Calculate the Scheduled Enroute Time for Simbrief API
// Your PHPVMS flight_time value must be from BLOCK to BLOCK
// Including departure and arrival taxi times
// If this value is not correctly calculated and configured
// Simbrief CI (Cost Index) calculation will not provide realistic results
let num = {{ $flight->flight_time }};
let hours = (num / 60);
let rhours = Math.floor(hours);
let minutes = (hours - rhours) * 60;
let rminutes = Math.round(minutes);
document.getElementById("steh").setAttribute('value', rhours.toString()); // Sent to Simbrief
document.getElementById("stem").setAttribute('value', rminutes.toString()); // Sent to Simbrief
</script>
<script type="text/javascript">
// *** Simple Aircraft Selection With Dropdown Change
// *** Also keep Generate button hidden until a valid AC selection
const $oldlink = document.getElementById("mylink").href;
function checkacselection() {
if (document.getElementById("aircraftselection").value === "ZZZZZ") {
document.getElementById('mylink').style.visibility = 'hidden';
} else {
document.getElementById('mylink').style.visibility = 'visible';
} }
</script> var $selectedac = document.getElementById("aircraftselection").value;
var $newlink = "&aircraft_id=".concat($selectedac);
document.getElementById("mylink").href = $oldlink.concat($newlink);
}
</script>
@endsection @endsection