Field and error message cleanup
This commit is contained in:
parent
d93e461266
commit
11c724649c
@ -72,7 +72,7 @@ class FlightController extends BaseController
|
||||
return view('admin.flights.create', [
|
||||
'flight' => null,
|
||||
'airlines' => $this->airlineRepo->selectBoxList(),
|
||||
'airports' => $this->airportRepo->selectBoxList(),
|
||||
'airports' => $this->airportRepo->selectBoxList(true, false),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class PirepFieldController extends BaseController
|
||||
$this->pirepFieldRepo->pushCriteria(new RequestCriteria($request));
|
||||
$fields = $this->pirepFieldRepo->all();
|
||||
|
||||
return view('admin.pirepFields.index', [
|
||||
return view('admin.pirepfields.index', [
|
||||
'fields' => $fields,
|
||||
]);
|
||||
}
|
||||
@ -43,7 +43,7 @@ class PirepFieldController extends BaseController
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.pirepFields.create');
|
||||
return view('admin.pirepfields.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ class PirepFieldController extends BaseController
|
||||
$field = $this->pirepFieldRepo->create($input);
|
||||
|
||||
Flash::success('PirepField saved successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,10 +76,10 @@ class PirepFieldController extends BaseController
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
return view('admin.pirepFields.show', [
|
||||
return view('admin.pirepfields.show', [
|
||||
'field' => $field,
|
||||
]);
|
||||
}
|
||||
@ -97,10 +97,10 @@ class PirepFieldController extends BaseController
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
return view('admin.pirepFields.edit', [
|
||||
return view('admin.pirepfields.edit', [
|
||||
'field' => $field,
|
||||
]);
|
||||
}
|
||||
@ -119,13 +119,13 @@ class PirepFieldController extends BaseController
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
$field = $this->pirepFieldRepo->update($request->all(), $id);
|
||||
|
||||
Flash::success('PirepField updated successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,12 +141,12 @@ class PirepFieldController extends BaseController
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
|
||||
$this->pirepFieldRepo->delete($id);
|
||||
|
||||
Flash::success('PirepField deleted successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
return redirect(route('admin.pirepfields.index'));
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ use App\Models\Traits\HashId;
|
||||
class Acars extends BaseModel
|
||||
{
|
||||
use HashId;
|
||||
public $incrementing = false;
|
||||
|
||||
public $table = 'acars';
|
||||
public $incrementing = false;
|
||||
|
||||
public $fillable = [
|
||||
'pirep_id',
|
||||
@ -37,6 +37,10 @@ class Acars extends BaseModel
|
||||
'fuel_flow' => 'float',
|
||||
];
|
||||
|
||||
public static $rules = [
|
||||
'pirep_id' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* FKs
|
||||
*/
|
||||
|
@ -6,8 +6,6 @@ class Aircraft extends BaseModel
|
||||
{
|
||||
public $table = 'aircraft';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
public $fillable = [
|
||||
'subfleet_id',
|
||||
'airport_id',
|
||||
|
@ -34,9 +34,11 @@ class Airline extends BaseModel
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'iata' => 'required|max:5',
|
||||
'icao' => 'required|max:5',
|
||||
'name' => 'required',
|
||||
'country' => 'nullable',
|
||||
'iata' => 'nullable|max:5',
|
||||
'icao' => 'required|max:5',
|
||||
'logo' => 'nullable',
|
||||
'name' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -46,4 +48,21 @@ class Airline extends BaseModel
|
||||
return $this->icao;
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
/**
|
||||
* IATA and ICAO should be in all caps
|
||||
*/
|
||||
static::creating(function (Airline $model) {
|
||||
if (!empty($model->iata)) {
|
||||
$model->iata = strtoupper($model->iata);
|
||||
}
|
||||
|
||||
if (!empty($model->icao)) {
|
||||
$model->icao = strtoupper($model->icao);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -38,14 +38,12 @@ class Airport extends BaseModel
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'icao' => 'required',
|
||||
'name' => 'required',
|
||||
'lat' => 'required',
|
||||
'lon' => 'required',
|
||||
'icao' => 'required',
|
||||
'name' => 'required',
|
||||
'lat' => 'required',
|
||||
'lon' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -35,5 +35,4 @@ class Setting extends BaseModel
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<!-- Name Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
|
@ -1,40 +1,45 @@
|
||||
<div class="row">
|
||||
<!-- Code Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('icao', 'Code:') !!}
|
||||
{!! Form::text('icao', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
<!-- Code Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('icao', 'Code:') !!} <span class="required">*</span>
|
||||
{!! Form::text('icao', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('iata', 'IATA:') !!}
|
||||
{!! Form::text('iata', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('logo', 'Logo URL:') !!}
|
||||
{!! Form::text('logo', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Active Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
<label class="checkbox-inline">
|
||||
{!! Form::hidden('active', 0, false) !!}
|
||||
{!! Form::checkbox('active', 1, null) !!}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.airlines.index') !!}" class="btn btn-default">Cancel</a>
|
||||
<!-- Name Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('iata', 'IATA:') !!}
|
||||
{!! Form::text('iata', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('logo', 'Logo URL:') !!}
|
||||
{!! Form::text('logo', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Active Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
<label class="checkbox-inline">
|
||||
{!! Form::hidden('active', 0, false) !!}
|
||||
{!! Form::checkbox('active', 1, null) !!}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.airlines.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,36 +3,47 @@
|
||||
<!-- Icao Field -->
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('icao', 'ICAO:') !!}
|
||||
{!! Form::label('icao', 'ICAO:') !!} <span class="required">*</span>
|
||||
<a href="#" class="airport_data_lookup">Lookup</a>
|
||||
{!! Form::text('icao', null, [
|
||||
'id' => 'airport_icao', 'class' => 'form-control',
|
||||
'rv-value' => 'airport.icao'
|
||||
'id' => 'airport_icao', 'class' => 'form-control'
|
||||
]) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('iata', 'IATA:') !!}
|
||||
{!! Form::text('iata', null, ['class' => 'form-control', 'rv-value' => 'airport.iata']) !!}
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::text('name', null, ['class' => 'form-control', 'rv-value' => 'airport.name']) !!}
|
||||
{!! Form::label('lat', 'Latitude:') !!} <span class="required">*</span>
|
||||
{!! Form::number('lat', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lat']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('lon', 'Longitude:') !!} <span class="required">*</span>
|
||||
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lon']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('iata', 'IATA:') !!}
|
||||
{!! Form::text('iata', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('location', 'Location:') !!}
|
||||
{!! Form::text('location', null, ['class' => 'form-control', 'rv-value' => 'airport.city']) !!}
|
||||
{!! Form::text('location', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('country', 'Country:') !!}
|
||||
{!! Form::text('country', null, ['class' => 'form-control', 'rv-value' => 'airport.country']) !!}
|
||||
{!! Form::text('country', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
@ -42,27 +53,14 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('lat', 'Latitude:') !!}
|
||||
{!! Form::number('lat', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lat']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('lon', 'Longitude:') !!}
|
||||
{!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001', 'rv-value' => 'airport.lon']) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('hub', 'Hub:') !!}
|
||||
{!! Form::hidden('hub', 0) !!}
|
||||
{!! Form::checkbox('hub', null) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="pull-right">
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="text-right">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.airports.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('code', 'Code:') !!}
|
||||
{!! Form::label('code', 'Code:') !!} <span class="required">*</span>
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
How this fare class will show up on a ticket
|
||||
@ -19,7 +19,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
<div class="callout callout-info">
|
||||
<i class="icon fa fa-info"> </i>
|
||||
The fare class name, E.g, "Economy" or "First"
|
||||
@ -33,7 +33,7 @@
|
||||
<i class="icon fa fa-info"> </i>
|
||||
This is the price of a ticket for a passenger
|
||||
</div>
|
||||
{!! Form::text('price', null, ['class' => 'form-control']) !!}
|
||||
{!! Form::text('price', null, ['class' => 'form-control', 'placeholder' => 0]) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
@ -42,7 +42,7 @@
|
||||
<i class="icon fa fa-info"> </i>
|
||||
The operating cost
|
||||
</div>
|
||||
{!! Form::text('cost', null, ['class' => 'form-control']) !!}
|
||||
{!! Form::text('cost', null, ['class' => 'form-control', 'placeholder' => 0]) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
@ -51,7 +51,7 @@
|
||||
<i class="icon fa fa-info"> </i>
|
||||
The number of seats available in this class.
|
||||
</div>
|
||||
{!! Form::text('capacity', null, ['class' => 'form-control']) !!}
|
||||
{!! Form::text('capacity', null, ['class' => 'form-control', 'placeholder' => 0]) !!}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-6">
|
||||
|
@ -1,36 +1,26 @@
|
||||
<!-- Airline Id Field -->
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-5">
|
||||
{!! Form::label('airline_id', 'Airline:') !!}
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('airline_id', 'Airline:') !!} <span class="required">*</span>
|
||||
{!! Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('airline_id') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Flight Number Field -->
|
||||
<div class="form-group col-sm-5">
|
||||
{!! Form::label('flight_number', 'Flight Number:') !!}
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('flight_number', 'Flight Number:') !!} <span class="required">*</span>
|
||||
{!! Form::text('flight_number', null, ['class' => 'form-control']) !!}
|
||||
<p class="text-danger">{{ $errors->first('flight_number') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Active Field -->
|
||||
<div class="form-group col-sm-2">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
@if($flight!==null)
|
||||
{!! Form::checkbox('active', $flight->active, ['class' => 'form-control icheck']) !!}
|
||||
@else
|
||||
{!! Form::checkbox('active', null, ['class' => 'form-control icheck']) !!}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Route Code Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('route_code', 'Route Code:') !!}
|
||||
{!! Form::text('route_code', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Route Leg Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
<div class="form-group col-sm-3">
|
||||
{!! Form::label('route_leg', 'Route Leg:') !!}
|
||||
{!! Form::text('route_leg', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
@ -43,14 +33,16 @@ SAME ROW
|
||||
<div class="row">
|
||||
<!-- Dpt Airport Id Field -->
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('dpt_airport_id', 'Departure Airport:') !!}
|
||||
{!! Form::label('dpt_airport_id', 'Departure Airport:') !!} <span class="required">*</span>
|
||||
{!! Form::select('dpt_airport_id', $airports, null , ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('dpt_airport_id') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Arr Airport Id Field -->
|
||||
<div class="form-group col-sm-4">
|
||||
{!! Form::label('arr_airport_id', 'Arrival Airport:') !!}
|
||||
{!! Form::label('arr_airport_id', 'Arrival Airport:') !!} <span class="required">*</span>
|
||||
{!! Form::select('arr_airport_id', $airports, null , ['class' => 'form-control select2']) !!}
|
||||
<p class="text-danger">{{ $errors->first('arr_airport_id') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Alt Airport Id Field -->
|
||||
@ -60,45 +52,49 @@ SAME ROW
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
END SAME ROW
|
||||
-->
|
||||
|
||||
<!-- Dpt Time Field -->
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('dpt_time', 'Departure Time:') !!}
|
||||
{!! Form::text('dpt_time', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('dpt_time', 'Departure Time:') !!}
|
||||
{!! Form::text('dpt_time', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Arr Time Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('arr_time', 'Arrival Time:') !!}
|
||||
{!! Form::text('arr_time', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
<!-- Arr Time Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('arr_time', 'Arrival Time:') !!}
|
||||
{!! Form::text('arr_time', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Route Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('route', 'Route:') !!}
|
||||
{!! Form::text('route', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
<!-- Route Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('route', 'Route:') !!}
|
||||
{!! Form::textarea('route', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Notes Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('notes', 'Notes:') !!}
|
||||
{!! Form::text('notes', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
<!-- Notes Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('notes', 'Notes:') !!}
|
||||
{!! Form::textarea('notes', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row pull-right">
|
||||
<div class="form-group col-sm-12 form-inline">
|
||||
<!-- Active Field -->
|
||||
<div class="col-sm-4">
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
@if($flight!==null)
|
||||
{!! Form::checkbox('active', $flight->active, ['class' => 'form-control icheck']) !!}
|
||||
@else
|
||||
{!! Form::checkbox('active', null, ['class' => 'form-control icheck']) !!}
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="text-right">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.flights.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user