phpvms/resources/views/layouts/default/flights/simbrief_aircraft.blade.php
B.Fatih KOZ 65015cbce2
Move SimBrief aircraft selection to Controller (#1093)
* Move SimBrief aircraft selection to Controller

Instead of passing subfleets to blade (and doing two foreach loops and ifs to populate the dropdown), we are building a proper aircraft list here.

Did not removed $subfleets from data being passed to blade on purpose, it may be removed later on.

* Style Fix

* Update aircraft selection blade to use $aircrafts

* Order generated Aircrafts collection

First ICAO then Registration

* Add privatized name setting for simbrief

To prevent possible privacy issues according to latest regulations.

* Add privatized name to SimBrief form

It is controlled with a setting, if not enabled we will not pass any names to SimBrief via API (this will result users SimBrief membership name being used at the OFP as before)
2021-03-22 10:55:33 -04:00

46 lines
1.7 KiB
PHP

@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($aircrafts as $ac)
<option value="{{ $ac->id }}">[{{ $ac->icao }}] {{ $ac->registration }} @if($ac->registration != $ac->name)'{{ $ac->name }}'@endif</option>
@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