specify fares, js to dynamically change fare form; get applicable fares for the flight/pirep #125
This commit is contained in:
@@ -28,13 +28,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h4>field values</h4>
|
||||
@include('admin.pireps.field_values')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h4>comments</h4>
|
||||
|
||||
29
resources/views/admin/pireps/fares.blade.php
Normal file
29
resources/views/admin/pireps/fares.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@if($aircraft)
|
||||
<table class="table table-hover table-responsive">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Count</th>
|
||||
</thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($aircraft->subfleet->fares as $fare)
|
||||
<tr>
|
||||
<td>{!! $fare->name !!} ({!! $fare->code !!})</td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->{'fare_'.$fare->id} !!}</p>
|
||||
{!! Form::hidden('fare_'.$fare->id) !!}
|
||||
@else
|
||||
{!! Form::number('fare_'.$fare->id, null, [
|
||||
'class' => 'form-control',
|
||||
'min' => 0,
|
||||
'readonly' => $read_only]) !!}
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
@@ -1,35 +1,30 @@
|
||||
<div id="pirep_field_values_wrapper">
|
||||
<table class="table table-responsive" id="flight-fields-table">
|
||||
<table class="table table-responsive table-hover" id="flight-fields-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
<th>Value</th>
|
||||
<th>Source</th>
|
||||
<th style="text-align: right;">Actions</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($pirep->fields as $field)
|
||||
<tr>
|
||||
<td>{!! $field->name !!}</td>
|
||||
<td>
|
||||
<a class="inline" href="#" data-pk="{!! $field->id !!}" data-name="{!! $field->name !!}">{!! $field->value !!}</a>
|
||||
{!! $field->name !!}
|
||||
@if($field->required === true)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{!! PirepSource::label($field->source) !!}</td>
|
||||
<td style="width: 10%; text-align: right;" class="form-inline">
|
||||
{!! Form::open(['url' => '/admin/pireps/'.$pirep->id.'/fields',
|
||||
'method' => 'delete',
|
||||
'class' => 'pjax_form pirep_fields'
|
||||
]) !!}
|
||||
{!! Form::hidden('field_id', $field->id) !!}
|
||||
<div class='btn-group'>
|
||||
{{--{!! Form::button('<i class="fa fa-times"></i>',
|
||||
['type' => 'submit',
|
||||
'class' => 'btn btn-danger btn-xs'])
|
||||
!!}--}}
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{!! Form::text($field->slug, null, [
|
||||
'class' => 'form-control'
|
||||
]) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
<p class="text-danger">{{ $errors->first($field->slug) }}</p>
|
||||
</td>
|
||||
<td>
|
||||
{!! PirepSource::label($field->source) !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,46 @@
|
||||
@if($read_only)
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@component('admin.components.info')
|
||||
Once a PIREP has been accepted/rejected, certain fields go into read-only mode.
|
||||
@endcomponent
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('flight_number', 'Flight Number/Route Code/Leg') !!}
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('flight_number', null, ['placeholder' => 'Flight Number', 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('flight_number') }}</p>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->ident !!}
|
||||
{!! Form::hidden('flight_number') !!}
|
||||
{!! Form::hidden('flight_code') !!}
|
||||
{!! Form::hidden('flight_leg') !!}
|
||||
</p>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('flight_number', null, [
|
||||
'placeholder' => 'Flight Number',
|
||||
'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('flight_number') }}</p>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('route_code', null, [
|
||||
'placeholder' => 'Code (optional)',
|
||||
'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('route_code') }}</p>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('route_leg', null, [
|
||||
'placeholder' => 'Leg (optional)',
|
||||
'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('route_leg') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('route_code', null, ['placeholder' => 'Code (optional)', 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('route_code') }}</p>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{!! Form::text('route_leg', null, ['placeholder' => 'Leg (optional)', 'class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('route_leg') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<p class="description">Filed Using:</span>
|
||||
<p class="description">Filed Via:</p>
|
||||
{!! PirepSource::label($pirep->source) !!}
|
||||
@if(filled($pirep->source_name))
|
||||
({!! $pirep->source_name !!})
|
||||
@@ -27,44 +50,82 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('airline_id', 'Airline') !!}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{!! Form::select('airline_id', $airlines, null, ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->airline->name !!}</p>
|
||||
{!! Form::hidden('airline_id') !!}
|
||||
@else
|
||||
{!! Form::select('airline_id', $airlines_list, null, [
|
||||
'class' => 'form-control select2',
|
||||
'readonly' => $read_only]) !!}
|
||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('aircraft_id', 'Aircraft:') !!}
|
||||
{!! Form::select('aircraft_id', $aircraft, null, ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('aircraft_id') }}</p>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->aircraft->name !!}</p>
|
||||
{!! Form::hidden('aircraft_id') !!}
|
||||
@else
|
||||
{!! Form::select('aircraft_id', $aircraft_list, null, [
|
||||
'id' => 'aircraft_select',
|
||||
'class' => 'form-control select2',
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
<p class="text-danger">{{ $errors->first('aircraft_id') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('dpt_airport_id', 'Departure Airport:') !!}
|
||||
{!! Form::select('dpt_airport_id', $airports, null, ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('dpt_airport_id') }}</p>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->dpt_airport->id !!} - {!! $pirep->dpt_airport->name !!}</p>
|
||||
{!! Form::hidden('dpt_airport_id') !!}
|
||||
@else
|
||||
{!! Form::select('dpt_airport_id', $airports_list, null, [
|
||||
'class' => 'form-control select2',
|
||||
'readonly' => $read_only]) !!}
|
||||
<p class="text-danger">{{ $errors->first('dpt_airport_id') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('arr_airport_id', 'Arrival Airport:') !!}
|
||||
{!! Form::select('arr_airport_id', $airports, null, ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('arr_airport_id') }}</p>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->arr_airport->id !!} - {!! $pirep->arr_airport->name !!}</p>
|
||||
{!! Form::hidden('arr_airport_id') !!}
|
||||
@else
|
||||
{!! Form::select('arr_airport_id', $airports_list, null, ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('arr_airport_id') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Flight Time Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('flight_time', 'Flight Time (hours & minutes):') !!}
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
{!! Form::number('hours', null, ['class' => 'form-control', 'placeholder' => 'hours', 'readonly' => $read_only]) !!}
|
||||
@if($read_only)
|
||||
<p>
|
||||
{!! $pirep->hours !!} hours, {!! $pirep->minutes !!} minutes
|
||||
{!! Form::hidden('hours') !!}
|
||||
{!! Form::hidden('minutes') !!}
|
||||
</p>
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
{!! Form::number('hours', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'hours',
|
||||
'readonly' => $read_only]) !!}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
{!! Form::number('minutes', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'minutes',
|
||||
'readonly' => $read_only]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('hours') }}</p>
|
||||
<p class="text-danger">{{ $errors->first('minutes') }}</p>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
{!! Form::number('minutes', null, ['class' => 'form-control', 'placeholder' => 'minutes', 'readonly' => $read_only]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('hours') }}</p>
|
||||
<p class="text-danger">{{ $errors->first('minutes') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Level Field -->
|
||||
@@ -72,7 +133,7 @@
|
||||
{!! Form::label('level', 'Flight Level:') !!}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{!! Form::text('level', null, ['class' => 'form-control']) !!}
|
||||
{!! Form::number('level', null, ['class' => 'form-control', 'min' => 0]) !!}
|
||||
<p class="text-danger">{{ $errors->first('level') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,6 +154,34 @@
|
||||
<p class="text-danger">{{ $errors->first('notes') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--
|
||||
FARES
|
||||
--}}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<hr>
|
||||
<h3>fares</h3>
|
||||
{{-- You don't want to change this ID unless you don't want the fares form to work :) --}}
|
||||
<div id="fares_container">
|
||||
@include('admin.pireps.fares')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--
|
||||
CUSTOM FIELDS
|
||||
--}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<hr>
|
||||
<h3>field values</h3>
|
||||
{{-- You don't want to change this ID unless you don't want the fares form to work :) --}}
|
||||
@include('admin.pireps.field_values')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
|
||||
@@ -17,6 +17,29 @@ const changeStatus = (values, fn) => {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
const select_id = "select#aircraft_select";
|
||||
const destContainer = $('#fares_container');
|
||||
|
||||
$(select_id).change((e) => {
|
||||
const aircraft_id = $(select_id + " option:selected").val();
|
||||
console.log('aircraft select change: ', aircraft_id);
|
||||
|
||||
$.ajax({
|
||||
url: "{!! url('/admin/pireps/fares') !!}?aircraft_id=" + aircraft_id,
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'x-api-key': '{!! Auth::user()->api_key !!}'
|
||||
},
|
||||
success: (data) => {
|
||||
console.log('returned new fares', data);
|
||||
destContainer.html(data);
|
||||
},
|
||||
error: () => {
|
||||
destContainer.html('');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.pjax_form', function (event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#pirep_comments_wrapper', {push: false});
|
||||
|
||||
10
resources/views/layouts/default/components/info.blade.php
Normal file
10
resources/views/layouts/default/components/info.blade.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<div>
|
||||
<p style="float:left; margin-right: 10px; margin-left: 2px;">
|
||||
<span style="font-size: 1.0em;">
|
||||
<i class="fas fa-info-circle" style="color: #067ec1"></i>
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
{{ $slot }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -1,10 +1,10 @@
|
||||
@extends("layouts.${SKIN_NAME}.app")
|
||||
@section('title', 'file pirep')
|
||||
@section('title', 'File Flight Report')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2 class="description">new pilot report</h2>
|
||||
<h2 class="description">New Flight Report</h2>
|
||||
@include('flash::message')
|
||||
{!! Form::open(['route' => 'frontend.pireps.store']) !!}
|
||||
|
||||
@@ -15,10 +15,4 @@
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@include("layouts.${SKIN_NAME}.pireps.scripts")
|
||||
|
||||
16
resources/views/layouts/default/pireps/edit.blade.php
Normal file
16
resources/views/layouts/default/pireps/edit.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@extends("layouts.${SKIN_NAME}.app")
|
||||
@section('title', 'Edit Flight Report')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2 class="description">Edit Flight Report</h2>
|
||||
@include('flash::message')
|
||||
{!! Form::model($pirep, ['route' => ['frontend.pireps.update', $pirep->id], 'method' => 'patch']) !!}
|
||||
|
||||
@include("layouts.${SKIN_NAME}.pireps.fields")
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include("layouts.${SKIN_NAME}.pireps.scripts")
|
||||
27
resources/views/layouts/default/pireps/fares.blade.php
Normal file
27
resources/views/layouts/default/pireps/fares.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
@if($aircraft)
|
||||
<h3 class="description">Fares</h3>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Count</th>
|
||||
</thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($aircraft->subfleet->fares as $fare)
|
||||
<tr>
|
||||
<td style="text-align: right;">{!! $fare->name !!} ({!! $fare->code !!})</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->{'fare_'.$fare->id} !!}</p>
|
||||
{!! Form::hidden('fare_'.$fare->id) !!}
|
||||
@else
|
||||
<div class="input-group form-group">
|
||||
{!! Form::number('fare_'.$fare->id, null, ['class' => 'form-control', 'min' => 0]) !!}
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
@@ -1,3 +1,22 @@
|
||||
{{--
|
||||
|
||||
NOTE ABOUT THIS VIEW
|
||||
|
||||
The fields that are marked "read-only", make sure the read-only status doesn't change!
|
||||
If you make those fields editable, after they're in a read-only state, it can have
|
||||
an impact on your stats and financials, and will require a recalculation of all the
|
||||
flight reports that have been filed. You've been warned!
|
||||
|
||||
--}}
|
||||
@if($read_only)
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@component("layouts.${SKIN_NAME}.components.info")
|
||||
Once a PIREP has been accepted/rejected, certain fields go into read-only mode.
|
||||
@endcomponent
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-full-width">
|
||||
@@ -5,122 +24,202 @@
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Airline</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>Airline</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->airline->name !!}</p>
|
||||
{!! Form::hidden('airline_id') !!}
|
||||
@else
|
||||
<div class="input-group form-group">
|
||||
{!! Form::select('airline_id', $airlines, null, ['class' => 'custom-select select2']) !!}
|
||||
{!! Form::select('airline_id', $airline_list, null, [
|
||||
'class' => 'custom-select select2',
|
||||
'readonly' => $read_only]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Flight Number/Code/Leg</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>Flight Number/Code/Leg</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->ident !!}
|
||||
{!! Form::hidden('flight_number') !!}
|
||||
{!! Form::hidden('flight_code') !!}
|
||||
{!! Form::hidden('flight_leg') !!}
|
||||
</p>
|
||||
@else
|
||||
<div class="input-group form-group" style="max-width: 400px;">
|
||||
{!! Form::text('flight_number', null, ['placeholder' => 'Flight Number', 'class' => 'form-control']) !!}
|
||||
{!! Form::text('route_code', null, ['placeholder' => 'Code (optional)', 'class' => 'form-control']) !!}
|
||||
{!! Form::text('route_leg', null, ['placeholder' => 'Leg (optional)', 'class' => 'form-control']) !!}
|
||||
{!! Form::text('flight_number', null, [
|
||||
'placeholder' => 'Flight Number',
|
||||
'class' => 'form-control',
|
||||
'readonly' => $read_only]) !!}
|
||||
|
||||
{!! Form::text('route_code', null, [
|
||||
'placeholder' => 'Code (optional)',
|
||||
'class' => 'form-control',
|
||||
'readonly' => $read_only]) !!}
|
||||
|
||||
{!! Form::text('route_leg', null, [
|
||||
'placeholder' => 'Leg (optional)',
|
||||
'class' => 'form-control',
|
||||
'readonly' => $read_only]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('flight_number') }}</p>
|
||||
<p class="text-danger">{{ $errors->first('route_code') }}</p>
|
||||
<p class="text-danger">{{ $errors->first('route_leg') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Aircraft</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>Aircraft</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->aircraft->name !!}</p>
|
||||
{!! Form::hidden('aircraft_id') !!}
|
||||
@else
|
||||
<div class="input-group form-group">
|
||||
{!! Form::select('aircraft_id', $aircraft, null, ['class' => 'custom-select select2']) !!}
|
||||
{{-- You probably don't want to change this ID if you want the fare select to work --}}
|
||||
{!! Form::select('aircraft_id', $aircraft_list, null, [
|
||||
'id' => 'aircraft_select',
|
||||
'class' => 'custom-select select2',
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('aircraft_id') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Origin Airport</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>Origin Airport</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->dpt_airport->id !!} - {!! $pirep->dpt_airport->name !!}</p>
|
||||
{!! Form::hidden('dpt_airport_id') !!}
|
||||
@else
|
||||
<div class="input-group form-group">
|
||||
{!! Form::select('dpt_airport_id', $airports, null, ['class' => 'custom-select select2']) !!}
|
||||
{!! Form::select('dpt_airport_id', $airport_list, null, [
|
||||
'class' => 'custom-select select2',
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('dpt_airport_id') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Arrival Airport</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td>Arrival Airport</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>{!! $pirep->arr_airport->id !!}
|
||||
- {!! $pirep->arr_airport->name !!}</p>
|
||||
{!! Form::hidden('arr_airport_id') !!}
|
||||
@else
|
||||
<div class="input-group form-group">
|
||||
{!! Form::select('arr_airport_id', $airports, null, ['class' => 'custom-select select2']) !!}
|
||||
{!! Form::select('arr_airport_id', $airport_list, null, [
|
||||
'class' => 'custom-select select2',
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('arr_airport_id') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="align-text-top">Flight Time</td>
|
||||
<td>
|
||||
<tr>
|
||||
<td class="align-text-top">Flight Time</td>
|
||||
<td>
|
||||
@if($read_only)
|
||||
<p>
|
||||
{!! $pirep->hours !!} hours, {!! $pirep->minutes !!} minutes
|
||||
{!! Form::hidden('hours') !!}
|
||||
{!! Form::hidden('minutes') !!}
|
||||
</p>
|
||||
@else
|
||||
<div class="input-group" style="max-width: 200px;">
|
||||
{!! Form::number('hours', null, ['class' => 'form-control', 'placeholder' => 'hours']) !!}
|
||||
{!! Form::number('minutes', null, ['class' => 'form-control', 'placeholder' => 'minutes']) !!}
|
||||
{!! Form::number('hours', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'hours',
|
||||
'min' => '0',
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
|
||||
{!! Form::number('minutes', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'minutes',
|
||||
'min' => 0,
|
||||
'readonly' => $read_only
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('hours') }}</p>
|
||||
<p class="text-danger">{{ $errors->first('minutes') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{--
|
||||
Write out the custom fields, and label if they're required
|
||||
--}}
|
||||
@foreach($pirep_fields as $field)
|
||||
<tr>
|
||||
<td>
|
||||
{!! $field->name !!}
|
||||
@if($field->required === true)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group form-group">
|
||||
{!! Form::text($field->slug, null, [
|
||||
'class' => 'form-control'
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first($field->slug) }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{--
|
||||
Write out the custom fields, and label if they're required
|
||||
--}}
|
||||
@foreach($pirep_fields as $field)
|
||||
<tr>
|
||||
<td class="align-text-top">Route</td>
|
||||
<td>
|
||||
{!! $field->name !!}
|
||||
@if($field->required === true)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group form-group">
|
||||
{!! Form::textarea('route', null, ['class' => 'form-control', 'placeholder' => 'Route']) !!}
|
||||
{!! Form::text($field->slug, null, [
|
||||
'class' => 'form-control'
|
||||
]) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('route') }}</p>
|
||||
<p class="text-danger">{{ $errors->first($field->slug) }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr>
|
||||
<td class="align-text-top"><p class="">Notes</p></td>
|
||||
<td>
|
||||
<div class="input-group form-group">
|
||||
{!! Form::textarea('notes', null, ['class' => 'form-control', 'placeholder' => 'Notes']) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('notes') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-text-top">Route</td>
|
||||
<td>
|
||||
<div class="input-group form-group">
|
||||
{!! Form::textarea('route', null, ['class' => 'form-control', 'placeholder' => 'Route']) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('route') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="align-text-top"><p class="">Notes</p></td>
|
||||
<td>
|
||||
<div class="input-group form-group">
|
||||
{!! Form::textarea('notes', null, ['class' => 'form-control', 'placeholder' => 'Notes']) !!}
|
||||
</div>
|
||||
<p class="text-danger">{{ $errors->first('notes') }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{-- You don't want to change this ID unless you don't want the fares form to work :) --}}
|
||||
<div id="fares_container" class="col-sm-12">
|
||||
@include("layouts.${SKIN_NAME}.pireps.fares")
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12">
|
||||
<div class="float-right">
|
||||
<div class="form-group">
|
||||
{!! Form::submit('Submit PIREP', ['class' => 'btn btn-primary']) !!}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{!! Form::submit('Save PIREP', ['class' => 'btn btn-primary']) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
function changeStatus(values) {
|
||||
var destContainer = '#pirep_' + values.pirep_id + '_container';
|
||||
$.ajax({
|
||||
url: '/admin/pireps/' + values.pirep_id + '/status',
|
||||
data: values,
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
$(destContainer).replaceWith(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//$(document).ready(function() {
|
||||
$(document).on('submit', 'form.pirep_submit_status', function (event) {
|
||||
console.log(event);
|
||||
|
||||
event.preventDefault();
|
||||
var values = {
|
||||
pirep_id: $(this).attr('pirep_id'),
|
||||
new_status: $(this).attr('new_status')
|
||||
};
|
||||
|
||||
console.log(values);
|
||||
console.log('Changing PIREP ' + values.pirep_id + ' to state ' + values.new_status);
|
||||
|
||||
//var destContainer = '#pirep_' + pirep_id + '_container';
|
||||
//$.pjax.submit(event, destContainer, { push: false, maxCacheLength: 0 });
|
||||
|
||||
changeStatus(values);
|
||||
});
|
||||
//});
|
||||
</script>
|
||||
@endsection
|
||||
28
resources/views/layouts/default/pireps/scripts.blade.php
Normal file
28
resources/views/layouts/default/pireps/scripts.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(() => {
|
||||
const select_id = "select#aircraft_select";
|
||||
const destContainer = $('#fares_container');
|
||||
|
||||
$(select_id).change((e) => {
|
||||
const aircraft_id = $(select_id + " option:selected").val();
|
||||
console.log('aircraft select change: ', aircraft_id);
|
||||
|
||||
$.ajax({
|
||||
url: "{!! url('/pireps/fares') !!}?aircraft_id=" + aircraft_id,
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'x-api-key': '{!! Auth::user()->api_key !!}'
|
||||
},
|
||||
success: (data) => {
|
||||
console.log('returned new fares', data);
|
||||
destContainer.html(data);
|
||||
},
|
||||
error: () => {
|
||||
destContainer.html('');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table">
|
||||
<table class="table table-hover">
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td>
|
||||
@@ -23,6 +23,7 @@
|
||||
@else
|
||||
<div class="badge badge-info">
|
||||
@endif
|
||||
|
||||
{!! PirepState::label($pirep->state) !!}</div>
|
||||
|
||||
<span class="description" style="padding-left: 20px;">
|
||||
@@ -71,11 +72,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--
|
||||
Show the fields that have been entered
|
||||
--}}
|
||||
|
||||
@if(count($pirep->fields) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 class="description">fields</h3>
|
||||
<table class="table">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
@@ -93,6 +98,32 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{--
|
||||
Show the fares that have been entered
|
||||
--}}
|
||||
|
||||
@if(count($pirep->fares) > 0)
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 class="description">fares</h3>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>Class</th>
|
||||
<th>Count</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($pirep->fares as $fare)
|
||||
<tr>
|
||||
<td>{!! $fare->fare->name !!} ({!! $fare->fare->code !!})</td>
|
||||
<td>{!! $fare->count !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include("layouts.${SKIN_NAME}.pireps.map")
|
||||
|
||||
@if(count($pirep->acars_logs) > 0)
|
||||
|
||||
Reference in New Issue
Block a user