phpvms/resources/views/layouts/default/flights/simbrief_aircraft.blade.php

50 lines
1.8 KiB
PHP
Raw Normal View History

2021-01-18 10:52:22 +08:00
@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)
@if(setting('pireps.only_aircraft_at_dpt_airport') && $flight->dpt_airport_id == $ac->airport_id || !setting('pireps.only_aircraft_at_dpt_airport')
2021-01-18 10:52:22 +08:00
<option value="{{ $ac->id }}">[ {{ $ac->icao }} ] {{ $ac->registration }}</option>
@endif
2021-01-18 10:52:22 +08:00
@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