SimBrief integration enhancements (#1045)
* SimBrief Integration Update * Added SimBrief Type field to subfleets, can be used to assign simbrief airframes to subfleets and fix non existing or wrong types. If not used simbrief form will use aircraft's icao type code * Added Passenger and Baggage weights to settings * Added setting for using PhpVms Pilot/User Ident as simbrief atc callsign * SimBrief form code cleaned up a bit and improved. Now form supports both cargo and passenger fares to be used at the same time. Generated passenger baggage weight will be reduced from aircraft's cargo capacity and remaining amount will be used for random cargo generation. Also multiple cargo fares or any mix is possible now (like only cargo, only passenger, multiple cargo and passenger fares) * StyleFix (SimBrief Controller) * Fix Callsign Setting Check * Code Cleanup Reduced loops and removed if's in loops, getting fares from aircraft instead of flight/subfleets. No need to go through getReconciledFaresForFlight anymore. Aircraft provides all fare info we need. Removed unnecessary html elements, added some comments. * Update Simbrief Controller Fixed setting checks. Removed non used $subfleet and from main form and $aircraft from aircraft selection form blade. Added/fixed comments. * StyleFix for Controller
This commit is contained in:
parent
a4c431d39f
commit
e3b4a0ed2e
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Contracts\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a SimBrief Type to subfleet
|
||||||
|
*/
|
||||||
|
class AddSbtypeToSubfleets extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('subfleets', function (Blueprint $table) {
|
||||||
|
$table->string('simbrief_type', 20)
|
||||||
|
->nullable()
|
||||||
|
->after('type');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -200,6 +200,41 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: number
|
type: number
|
||||||
description: 'Days after how long to remove unused briefs'
|
description: 'Days after how long to remove unused briefs'
|
||||||
|
- key: simbrief.noncharter_pax_weight
|
||||||
|
name: 'SimBrief Passenger Weight for Non-Charter (Scheduled etc) Flights'
|
||||||
|
group: simbrief
|
||||||
|
value: 185
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger weight for Non-Charter flights excluding baggage (lbs)'
|
||||||
|
- key: simbrief.noncharter_baggage_weight
|
||||||
|
name: 'SimBrief Baggage Weight per Pax for Non-Charter (Scheduled etc) Flights'
|
||||||
|
group: simbrief
|
||||||
|
value: 35
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger baggage weight for Non-Charter flights (lbs)'
|
||||||
|
- key: simbrief.charter_pax_weight
|
||||||
|
name: 'SimBrief Passenger Weight for Charter Flights'
|
||||||
|
group: simbrief
|
||||||
|
value: 168
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger weight for Charter flights excluding baggage (lbs)'
|
||||||
|
- key: simbrief.charter_baggage_weight
|
||||||
|
name: 'SimBrief Baggage Weight per Pax for Charter Flights'
|
||||||
|
group: simbrief
|
||||||
|
value: 28
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger baggage weight for Charter flights (lbs)'
|
||||||
|
- key: simbrief.callsign
|
||||||
|
name: 'SimBrief ATC Callsign'
|
||||||
|
group: simbrief
|
||||||
|
value: false
|
||||||
|
options: ''
|
||||||
|
type: boolean
|
||||||
|
description: 'Use pilot ident as SimBrief ATC Callsign'
|
||||||
- key: pireps.duplicate_check_time
|
- key: pireps.duplicate_check_time
|
||||||
name: 'PIREP duplicate time check'
|
name: 'PIREP duplicate time check'
|
||||||
group: pireps
|
group: pireps
|
||||||
|
@ -50,7 +50,7 @@ class SimBriefController
|
|||||||
$flight_id = $request->input('flight_id');
|
$flight_id = $request->input('flight_id');
|
||||||
$aircraft_id = $request->input('aircraft_id');
|
$aircraft_id = $request->input('aircraft_id');
|
||||||
$flight = $this->flightRepo->with(['subfleets'])->find($flight_id);
|
$flight = $this->flightRepo->with(['subfleets'])->find($flight_id);
|
||||||
$flight = $this->fareSvc->getReconciledFaresForFlight($flight);
|
// $flight = $this->fareSvc->getReconciledFaresForFlight($flight);
|
||||||
|
|
||||||
if (!$flight) {
|
if (!$flight) {
|
||||||
flash()->error('Unknown flight');
|
flash()->error('Unknown flight');
|
||||||
@ -63,6 +63,21 @@ class SimBriefController
|
|||||||
return redirect(route('frontend.flights.index'));
|
return redirect(route('frontend.flights.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no subfleets defined for flight get them from user
|
||||||
|
if ($flight->subfleets->count() > 0) {
|
||||||
|
$subfleets = $flight->subfleets;
|
||||||
|
} else {
|
||||||
|
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
// No aircraft selected, show selection form
|
||||||
|
if (!$aircraft_id) {
|
||||||
|
return view('flights.simbrief_aircraft', [
|
||||||
|
'flight' => $flight,
|
||||||
|
'subfleets' => $subfleets,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a Simbrief profile already exists
|
// 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,
|
||||||
@ -73,34 +88,20 @@ 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
|
// SimBrief profile does not exists and everything else is ok
|
||||||
$aircraft = Aircraft::select('registration', 'name', 'icao', 'iata', 'subfleet_id')
|
// Select aircraft which will be used for calculations and details
|
||||||
->where('id', $aircraft_id)
|
$aircraft = Aircraft::where('id', $aircraft_id)->first();
|
||||||
->get();
|
|
||||||
|
|
||||||
if ($flight->subfleets->count() > 0) {
|
|
||||||
$subfleets = $flight->subfleets;
|
|
||||||
} else {
|
|
||||||
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Get passenger and baggage weights with failsafe defaults
|
||||||
if ($flight->flight_type === FlightType::CHARTER_PAX_ONLY) {
|
if ($flight->flight_type === FlightType::CHARTER_PAX_ONLY) {
|
||||||
$pax_weight = 197;
|
$pax_weight = setting('simbrief.charter_pax_weight', 168);
|
||||||
|
$bag_weight = setting('simbrief.charter_baggage_weight', 28);
|
||||||
} else {
|
} else {
|
||||||
$pax_weight = 208;
|
$pax_weight = setting('simbrief.noncharter_pax_weight', 185);
|
||||||
|
$bag_weight = setting('simbrief.noncharter_baggage_weight', 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No aircraft selected, show that form
|
// Get the load factors with failsafe for loadmax if nothing is defined
|
||||||
if (!$aircraft_id) {
|
|
||||||
return view('flights.simbrief_aircraft', [
|
|
||||||
'flight' => $flight,
|
|
||||||
'aircraft' => $aircraft,
|
|
||||||
'subfleets' => $subfleets,
|
|
||||||
'pax_weight' => $pax_weight,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the correct load factors
|
|
||||||
$lfactor = $flight->load_factor ?? setting('flights.default_load_factor');
|
$lfactor = $flight->load_factor ?? setting('flights.default_load_factor');
|
||||||
$lfactorv = $flight->load_factor_variance ?? setting('flights.load_factor_variance');
|
$lfactorv = $flight->load_factor_variance ?? setting('flights.load_factor_variance');
|
||||||
|
|
||||||
@ -110,8 +111,6 @@ class SimBriefController
|
|||||||
$loadmax = $lfactor + $lfactorv;
|
$loadmax = $lfactor + $lfactorv;
|
||||||
$loadmax = $loadmax > 100 ? 100 : $loadmax;
|
$loadmax = $loadmax > 100 ? 100 : $loadmax;
|
||||||
|
|
||||||
// Failsafe for admins not defining load values for their flights
|
|
||||||
// and also leave the general settings empty, set loadmax to 100
|
|
||||||
if ($loadmax === 0) {
|
if ($loadmax === 0) {
|
||||||
$loadmax = 100;
|
$loadmax = 100;
|
||||||
}
|
}
|
||||||
@ -120,8 +119,8 @@ class SimBriefController
|
|||||||
return view('flights.simbrief_form', [
|
return view('flights.simbrief_form', [
|
||||||
'flight' => $flight,
|
'flight' => $flight,
|
||||||
'aircraft' => $aircraft,
|
'aircraft' => $aircraft,
|
||||||
'subfleets' => $subfleets,
|
|
||||||
'pax_weight' => $pax_weight,
|
'pax_weight' => $pax_weight,
|
||||||
|
'bag_weight' => $bag_weight,
|
||||||
'loadmin' => $loadmin,
|
'loadmin' => $loadmin,
|
||||||
'loadmax' => $loadmax,
|
'loadmax' => $loadmax,
|
||||||
]);
|
]);
|
||||||
|
@ -10,6 +10,7 @@ use App\Models\Traits\FilesTrait;
|
|||||||
/**
|
/**
|
||||||
* @property int id
|
* @property int id
|
||||||
* @property string type
|
* @property string type
|
||||||
|
* @property string simbrief_type
|
||||||
* @property string name
|
* @property string name
|
||||||
* @property int airline_id
|
* @property int airline_id
|
||||||
* @property int hub_id
|
* @property int hub_id
|
||||||
@ -29,6 +30,7 @@ class Subfleet extends Model
|
|||||||
'airline_id',
|
'airline_id',
|
||||||
'hub_id',
|
'hub_id',
|
||||||
'type',
|
'type',
|
||||||
|
'simbrief_type',
|
||||||
'name',
|
'name',
|
||||||
'fuel_type',
|
'fuel_type',
|
||||||
'cost_block_hour',
|
'cost_block_hour',
|
||||||
|
@ -24,13 +24,19 @@
|
|||||||
<p class="text-danger">{{ $errors->first('hub_id') }}</p>
|
<p class="text-danger">{{ $errors->first('hub_id') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-3">
|
<div class="form-group col-sm-2">
|
||||||
{{ Form::label('type', 'Type:') }}
|
{{ Form::label('type', 'Type:') }}
|
||||||
{{ Form::text('type', null, ['class' => 'form-control']) }}
|
{{ Form::text('type', null, ['class' => 'form-control']) }}
|
||||||
<p class="text-danger">{{ $errors->first('type') }}</p>
|
<p class="text-danger">{{ $errors->first('type') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-sm-3">
|
<div class="form-group col-sm-2">
|
||||||
|
{{ Form::label('simbrief_type', 'SimBrief Type:') }}
|
||||||
|
{{ Form::text('simbrief_type', null, ['class' => 'form-control']) }}
|
||||||
|
<p class="text-danger">{{ $errors->first('simbrief_type') }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-sm-2">
|
||||||
{{ Form::label('name', 'Name:') }}
|
{{ Form::label('name', 'Name:') }}
|
||||||
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
||||||
<p class="text-danger">{{ $errors->first('name') }}</p>
|
<p class="text-danger">{{ $errors->first('name') }}</p>
|
||||||
|
@ -2,17 +2,6 @@
|
|||||||
@section('title', 'SimBrief Flight Planning')
|
@section('title', 'SimBrief Flight Planning')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@foreach($aircraft as $acdetails)
|
|
||||||
@php
|
|
||||||
$simbrieftype = $acdetails->icao ;
|
|
||||||
$subflid = $acdetails->subfleet_id ;
|
|
||||||
if($acdetails->icao === 'A20N') { $simbrieftype = 'A320'; }
|
|
||||||
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
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
<form id="sbapiform">
|
<form id="sbapiform">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -22,144 +11,169 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<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> Aircraft Details</h6>
|
<h6><i class="fas fa-info-circle"></i> Aircraft Details</h6>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="type">Type</label>
|
<label for="type">Type</label>
|
||||||
<input type="text" class="form-control" value="{{ $acdetails->icao }}" maxlength="4" disabled/>
|
<input type="text" class="form-control" value="{{ $aircraft->icao }}" maxlength="4" disabled>
|
||||||
<input type="hidden" id="type" name="type" class="form-control" value="{{ $simbrieftype }}"
|
<input type="hidden" name="type" value="{{ $aircraft->subfleet->simbrief_type ?? $aircraft->icao }}">
|
||||||
maxlength="4"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="reg">Registration</label>
|
<label for="reg">Registration</label>
|
||||||
<input type="text" class="form-control" value="{{ $acdetails->registration }}" maxlength="6"
|
<input type="text" class="form-control" value="{{ $aircraft->registration }}" maxlength="6" disabled>
|
||||||
disabled/>
|
<input type="hidden" name="reg" value="{{ $aircraft->registration }}">
|
||||||
<input type="hidden" id="reg" name="reg" value="{{ $acdetails->registration }}"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-container-body">
|
<div class="form-container-body">
|
||||||
<h6><i class="fas fa-info-circle"></i> @lang('pireps.flightinformations') for
|
<h6><i class="fas fa-info-circle"></i> @lang('pireps.flightinformations') For
|
||||||
<b>{{ $flight->airline->icao }} {{ $flight->flight_number }}</b></h6>
|
<b>{{ $flight->airline->icao }}{{ $flight->flight_number }} ({{ \App\Models\Enums\FlightType::label($flight->flight_type) }})</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 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>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="ddest">Arrival Airport</label>
|
<label for="ddest">Arrival Airport</label>
|
||||||
<input id="ddest" type="text" class="form-control" maxlength="4"
|
<input id="ddest" type="text" class="form-control" maxlength="4" value="{{ $flight->arr_airport_id }}" disabled>
|
||||||
value="{{ $flight->arr_airport_id }}" disabled/>
|
<input name="dest" type="hidden" maxlength="4" value="{{ $flight->arr_airport_id }}">
|
||||||
<input id="dest" name="dest" type="hidden" maxlength="4" value="{{ $flight->arr_airport_id }}"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="altn">Alternate Airport</label>
|
<label for="altn">Alternate Airport</label>
|
||||||
<input id="altn" name="altn" type="text" class="form-control" maxlength="4"
|
<input name="altn" type="text" class="form-control" maxlength="4" value="{{ $flight->alt_airport_id ?? 'AUTO' }}">
|
||||||
value="{{ $flight->alt_airport_id ?? 'AUTO' }}"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<label for="route">Preferred Company Route</label>
|
<label for="route">Preferred Company Route</label>
|
||||||
<input id="route" name="route" type="text" class="form-control" placeholder="" maxlength="1000"
|
<input name="route" type="text" class="form-control" value="{{ $flight->route }}">
|
||||||
value="{{ $flight->route }}"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="fl">Preferred Flight Level</label>
|
<label for="fl">Preferred Flight Level</label>
|
||||||
<input id="fl" name="fl" type="text" class="form-control" placeholder="" maxlength="5"
|
<input id="fl" name="fl" type="text" class="form-control" maxlength="5" value="{{ $flight->level }}">
|
||||||
value="{{ $flight->level }}"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
@if($flight->dpt_time)
|
||||||
<label for="std">Scheduled Departure Time (UTC)</label>
|
<label for="std">Scheduled Departure Time (UTC)</label>
|
||||||
<input id="std" type="text" class="form-control" placeholder="" maxlength="4"
|
<input id="std" type="text" class="form-control" maxlength="4" value="{{ $flight->dpt_time }}" disabled>
|
||||||
value="{{ $flight->dpt_time }}" disabled/>
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="etd">Estimated Departure Time (UTC)</label>
|
<label for="etd">Estimated Departure Time (UTC)</label>
|
||||||
<input id="etd" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
|
<input id="etd" type="text" class="form-control" maxlength="4" disabled>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<label for="dof">Date Of Flight (UTC)</label>
|
<label for="dof">Date Of Flight (UTC)</label>
|
||||||
<input id="dof" type="text" class="form-control" placeholder="" maxlength="4" disabled/>
|
<input id="dof" type="text" class="form-control" maxlength="4" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-container-body">
|
<div class="form-container-body">
|
||||||
@foreach($subfleets as $subfleet)
|
|
||||||
@if($subfleet->id == $subflid)
|
|
||||||
<h6><i class="fas fa-info-circle"></i> Configuration And Load Information For
|
<h6><i class="fas fa-info-circle"></i> Configuration And Load Information For
|
||||||
<b>{{ $subfleet->name }} ; {{ $acdetails->registration }}</b></h6>
|
<b>{{ $aircraft->registration }} ({{ $aircraft->subfleet->name }})</b></h6>
|
||||||
{{-- Generate Load Figures --}}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{-- Create and send some data to the $loadarray for MANUALRMK generation --}}
|
|
||||||
@php $loadarray = [] ; @endphp
|
@php $loadarray = [] ; @endphp
|
||||||
@foreach($subfleet->fares as $fare)
|
{{-- Generate Load Figures For Pax Fares --}}
|
||||||
@if($fare->capacity > 0)
|
@foreach($aircraft->subfleet->fares->where('type', 0) as $fare)
|
||||||
@php
|
@php
|
||||||
$randomloadperfare = ceil(($fare->capacity * (rand($loadmin, $loadmax))) /100);
|
$randompaxperfare = floor(($fare->pivot->capacity * rand($loadmin, $loadmax)) /100);
|
||||||
$loadarray[] = ['SeatType' => $fare->code];
|
$loadarray[] = ['LoadType' => $fare->code];
|
||||||
$loadarray[] = ['SeatLoad' => $randomloadperfare];
|
$loadarray[] = ['LoadFigure' => $randompaxperfare];
|
||||||
@endphp
|
@endphp
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-3">
|
||||||
<label for="LoadFare{{ $fare->id }}">{{ $fare->name }} Load [
|
<label for="LoadFare{{ $fare->id }}">{{ $fare->name }} [Max: {{ number_format($fare->pivot->capacity) }}]</label>
|
||||||
Max: {{ number_format($fare->capacity) }} ]</label>
|
<input id="LoadFare{{ $fare->id }}" type="text" class="form-control" value="{{ number_format($randompaxperfare) }}" disabled>
|
||||||
<input id="LoadFare{{ $fare->id }}" type="text" class="form-control"
|
</div>
|
||||||
value="{{ number_format($randomloadperfare) }} @if($randomloadperfare > '900') {{ setting('units.weight') }} @endif"
|
@endforeach
|
||||||
disabled/>
|
{{-- Calculate weights for Pax Loads Before moving to Cargo Fares --}}
|
||||||
|
@php
|
||||||
|
$paxcollection = collect($loadarray);
|
||||||
|
$tpaxfig = $paxcollection->sum('LoadFigure');
|
||||||
|
|
||||||
|
if(setting('units.weight') === 'kg') {
|
||||||
|
$tpaxload = round(($pax_weight * $tpaxfig) / 2.205);
|
||||||
|
$tbagload = round(($bag_weight * $tpaxfig) / 2.205);
|
||||||
|
} else {
|
||||||
|
$tpaxload = round($pax_weight * $tpaxfig);
|
||||||
|
$tbagload = round($bag_weight * $tpaxfig);
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
{{-- Generate Load Figures For Cargo Fares --}}
|
||||||
|
@foreach($aircraft->subfleet->fares->where('type', 1) as $fare)
|
||||||
|
@php
|
||||||
|
$randomcargoperfare = ceil((($fare->pivot->capacity - $tbagload) * rand($loadmin, $loadmax)) /100);
|
||||||
|
$loadarray[] = ['LoadType' => $fare->code];
|
||||||
|
$loadarray[] = ['CargoFigure' => $randomcargoperfare];
|
||||||
|
@endphp
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="LoadFare{{ $fare->id }}">{{ $fare->name }} [Max: {{ number_format($fare->pivot->capacity - $tbagload) }} {{ setting('units.weight') }}]</label>
|
||||||
|
<input id="LoadFare{{ $fare->id }}" type="text" class="form-control" value="{{ number_format($randomcargoperfare) }}" disabled>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
@endforeach
|
@endforeach
|
||||||
@php
|
@php
|
||||||
$loadcollection = collect($loadarray);
|
$loadcollection = collect($loadarray);
|
||||||
$totalgenload = $loadcollection->sum('SeatLoad') ;
|
$tcargoload = $loadcollection->sum('CargoFigure');
|
||||||
|
$tpayload = $tpaxload + $tbagload + $tcargoload;
|
||||||
@endphp
|
@endphp
|
||||||
</div>
|
</div>
|
||||||
|
@if(isset($tpayload) && $tpayload > 0)
|
||||||
@if($totalgenload > 0 && $totalgenload < 900)
|
{{-- Display The Weights Generated --}}
|
||||||
<input type="hidden" name="acdata" value="{'paxwgt':{{ $pax_weight }}}">
|
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
@if($tpaxload)
|
||||||
@if(setting('units.weight') === 'kg')
|
<div class="col-sm-3">
|
||||||
@php $estimatedpayload = number_format(round(($pax_weight * $totalgenload) / 2.2)) ; @endphp
|
<label for="tdPaxLoad">Pax Weight</label>
|
||||||
@else
|
<input id="tdPaxLoad" type="text" class="form-control" value="{{ number_format($tpaxload) }} {{ setting('units.weight') }}" disabled>
|
||||||
@php $estimatedpayload = number_format(round($pax_weight * $totalgenload)) ; @endphp
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="tBagLoad">Baggage Weight</label>
|
||||||
|
<input id="tBagLoad" type="text" class="form-control" value="{{ number_format($tbagload) }} {{ setting('units.weight') }}" disabled>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<label for="EstimatedLoad">Estimated Payload For {{ $totalgenload }} Pax</label>
|
@if($tpaxload && $tcargoload)
|
||||||
<input id="EstimatedLoad" type="text" class="form-control"
|
<div class="col-sm-3">
|
||||||
value="{{ $estimatedpayload }} {{ setting('units.weight') }}" disabled/>
|
<label for="tCargoload">Cargo Weight</label>
|
||||||
|
<input id="tCargoload" type="text" class="form-control" value="{{ number_format($tcargoload) }} {{ setting('units.weight') }}" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<input type="hidden" id="pax" name="pax" class="form-control" value="{{ $totalgenload }}"/>
|
|
||||||
@elseif($totalgenload > 900)
|
|
||||||
<input type='hidden' id="pax" name='pax' value='0' maxlength='3'>
|
|
||||||
<input type='hidden' id="cargo" name='cargo' value="{{ $totalgenload }}" maxlength='7'>
|
|
||||||
@endif
|
@endif
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="tPayload">Total Payload</label>
|
||||||
|
<input id="tPayload" type="text" class="form-control" value="{{ number_format($tpayload) }} {{ setting('units.weight') }}" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@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
|
|
||||||
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
|
{{-- Prepare Form Fields For SimBrief --}}
|
||||||
|
<input type="hidden" name="acdata" value="{'paxwgt':{{ round($pax_weight + $bag_weight) }}}">
|
||||||
|
@if($tpaxfig)
|
||||||
|
<input type="hidden" name="pax" value="{{ $tpaxfig }}">
|
||||||
|
@elseif(!$tpaxfig && $tcargoload)
|
||||||
|
<input type="hidden" name="pax" value="0">
|
||||||
|
@endif
|
||||||
|
@if($tcargoload)
|
||||||
|
<input type='hidden' name='cargo' value="{{ number_format(($tcargoload / 1000),1) }}">
|
||||||
|
@endif
|
||||||
|
{{--
|
||||||
|
Generate the MANUALRMK which is sent to SimBrief and displayed as Dispatch Remark.
|
||||||
|
$loadarray is created and filled with data during random load generation,
|
||||||
|
it holds each fare's code and the generated load.
|
||||||
|
Returned string will be "FixedText eachFareCode eachFareLoad"
|
||||||
|
Example Remark ; Load Distribution Y 132 J 12 F 4 C 2800
|
||||||
--}}
|
--}}
|
||||||
@if($totalgenload > 0)
|
@if(isset($tpayload) && $tpayload > 0)
|
||||||
@php
|
@php
|
||||||
$loaddisttxt = "Load Distribution ";
|
$loaddisttxt = "Load Distribution ";
|
||||||
$loaddist = implode(' ', array_map(
|
$loaddist = implode(' ', array_map(
|
||||||
@ -177,6 +191,9 @@
|
|||||||
@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 }}">
|
||||||
|
@if(setting('simbrief.callsign', false))
|
||||||
|
<input type="hidden" name="callsign" value="{{ Auth::user()->ident }}">
|
||||||
|
@endif
|
||||||
<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">
|
||||||
@ -188,24 +205,34 @@
|
|||||||
<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">
|
||||||
|
{{-- For more info about form fields and their details check SimBrief Forum / API Support --}}
|
||||||
|
</div>
|
||||||
<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> Planning Options</h6>
|
<h6><i class="fas fa-info-circle"></i> Planning Options</h6>
|
||||||
<table class="table table-hover table-striped">
|
<table class="table table-sm 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="0">None</option>
|
||||||
<option value="auto">AUTO</option>
|
<option value="auto">AUTO</option>
|
||||||
<option value="0">0 PCT</option>
|
<option value="easa">EASA</option>
|
||||||
<option value="0.02">2 PCT</option>
|
<option value="0.03/5">3% or 05 MIN</option>
|
||||||
<option value="0.03">3 PCT</option>
|
<option value="0.03/10">3% or 10 MIN</option>
|
||||||
<option value="0.05" selected>5 PCT</option>
|
<option value="0.03/15">3% or 15 MIN</option>
|
||||||
<option value="0.1">10 PCT</option>
|
<option value="0.05/5" selected>5% or 05 MIN</option>
|
||||||
<option value="0.15">15 PCT</option>
|
<option value="0.05/10">5% or 10 MIN</option>
|
||||||
<option value="0.2">20 PCT</option>
|
<option value="0.05/15">5% or 15 MIN</option>
|
||||||
|
<option value="0.03">3%</option>
|
||||||
|
<option value="0.05">5%</option>
|
||||||
|
<option value="0.1">10%</option>
|
||||||
|
<option value="0.15">15%</option>
|
||||||
|
<option value="3">03 MIN</option>
|
||||||
|
<option value="5">05 MIN</option>
|
||||||
|
<option value="10">10 MIN</option>
|
||||||
|
<option value="15">15 MIN</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -255,8 +282,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="form-container-body">
|
<div class="form-container-body">
|
||||||
<h6><i class="fas fa-info-circle"></i> @lang('stisla.briefingoptions')</h6>
|
<h6><i class="fas fa-info-circle"></i> Briefing Options</h6>
|
||||||
<table class="table table-hover table-striped">
|
<table class="table table-sm table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Units:</td>
|
<td>Units:</td>
|
||||||
<td>
|
<td>
|
||||||
@ -373,7 +400,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
depm = ("0" + depm).slice(-2);
|
depm = ("0" + depm).slice(-2);
|
||||||
dept = deph + depm;
|
dept = deph + ":" + depm;
|
||||||
let dof = ("0" + d.getUTCDate()).slice(-2) + months[d.getUTCMonth()] + d.getUTCFullYear();
|
let dof = ("0" + d.getUTCDate()).slice(-2) + months[d.getUTCMonth()] + d.getUTCFullYear();
|
||||||
|
|
||||||
document.getElementById("dof").setAttribute('value', dof);
|
document.getElementById("dof").setAttribute('value', dof);
|
||||||
@ -397,20 +424,4 @@
|
|||||||
document.getElementById("steh").setAttribute('value', rhours.toString()); // Sent to Simbrief
|
document.getElementById("steh").setAttribute('value', rhours.toString()); // Sent to Simbrief
|
||||||
document.getElementById("stem").setAttribute('value', rminutes.toString()); // Sent to Simbrief
|
document.getElementById("stem").setAttribute('value', rminutes.toString()); // Sent to Simbrief
|
||||||
</script>
|
</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';
|
|
||||||
}
|
|
||||||
var $selectedac = document.getElementById("aircraftselection").value;
|
|
||||||
var $newlink = "&aircraft_id=".concat($selectedac);
|
|
||||||
document.getElementById("mylink").href = $oldlink.concat($newlink);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
Reference in New Issue
Block a user