Refactoring of PIREP submission and field code #146

This commit is contained in:
Nabeel Shahzad
2018-01-23 15:48:30 -06:00
parent 341424ad7e
commit f9efa81bb4
19 changed files with 191 additions and 147 deletions

View File

@@ -1,4 +1,12 @@
<div class="content table-responsive table-full-width">
<div class="header">
<p class="category">
<i class="icon fa fa-info">&nbsp;&nbsp;</i>
PIREP fields are only shown for manual PIREPs.
</p>
</div>
<table class="table table-hover table-responsive" id="pirepFields-table">
<thead>
<th>Name</th>

View File

@@ -13,7 +13,7 @@
<td>
<a class="inline" href="#" data-pk="{!! $field->id !!}" data-name="{!! $field->name !!}">{!! $field->value !!}</a>
</td>
<td>{!! $field->source !!}</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',

View File

@@ -5,7 +5,7 @@
<div class="col-sm-2 text-center">
<h5>
<a class="text-c"
href="{!! route('admin.pireps.show', [$pirep->id]) !!}">
href="{!! route('admin.pireps.edit', [$pirep->id]) !!}">
{!! $pirep->ident !!}
</a>
</h5>

View File

@@ -12,6 +12,7 @@
<div class="input-group form-group">
{!! Form::select('airline_id', $airlines, null, ['class' => 'custom-select select2']) !!}
</div>
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
</td>
</tr>
@@ -23,6 +24,9 @@
{!! Form::text('route_code', null, ['placeholder' => 'Code (optional)', 'class' => 'form-control']) !!}
{!! Form::text('route_leg', null, ['placeholder' => 'Leg (optional)', 'class' => 'form-control']) !!}
</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>
@@ -32,6 +36,7 @@
<div class="input-group form-group">
{!! Form::select('aircraft_id', $aircraft, null, ['class' => 'custom-select select2']) !!}
</div>
<p class="text-danger">{{ $errors->first('aircraft_id') }}</p>
</td>
</tr>
@@ -41,6 +46,7 @@
<div class="input-group form-group">
{!! Form::select('dpt_airport_id', $airports, null, ['class' => 'custom-select select2']) !!}
</div>
<p class="text-danger">{{ $errors->first('dpt_airport_id') }}</p>
</td>
</tr>
@@ -50,6 +56,7 @@
<div class="input-group form-group">
{!! Form::select('arr_airport_id', $airports, null, ['class' => 'custom-select select2']) !!}
</div>
<p class="text-danger">{{ $errors->first('arr_airport_id') }}</p>
</td>
</tr>
@@ -60,46 +67,50 @@
{!! Form::number('hours', null, ['class' => 'form-control', 'placeholder' => 'hours']) !!}
{!! Form::number('minutes', null, ['class' => 'form-control', 'placeholder' => 'minutes']) !!}
</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
<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>
{{--
Write out the custom fields, and label if they're required
--}}
@foreach($pirepfields as $field)
<tr>
<td>
{!! $field->name !!}
<span class="label label-danger">required</span>
</td>
<td>
<div class="input-group form-group">
<!--<span class="input-group-addon">
<i class="now-ui-icons users_single-02"></i>
</span>-->
{!! Form::text('field_'.$field->id, null, [
'class' => 'form-control'
]) !!}
</div>
</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>
</tbody>

View File

@@ -4,12 +4,7 @@
<div class="col-sm-2 text-center">
<h5>
<a class="text-c" href="{!! route('frontend.pireps.show', [$pirep->id]) !!}">
{!! $pirep->airline->code !!}
@if($pirep->flight_id)
{!! $pirep->flight->flight_number !!}
@else
{!! $pirep->flight_number !!}
@endif
{!! $pirep->ident !!}
</a>
</h5>
<div>

View File

@@ -77,16 +77,14 @@
<h3 class="description">fields</h3>
<table class="table">
<thead>
<th>Name</th>
<th>Value</th>
<th>Source</th>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
@foreach($pirep->fields as $field)
<tr>
<td>{!! $field->name !!}</td>
<td>{!! $field->value !!}</td>
<td>{!! $field->source !!}</td>
</tr>
@endforeach
</tbody>