Fix up the PIREP field CRUD code
This commit is contained in:
parent
11c724649c
commit
6406f47aaa
@ -84,7 +84,6 @@ class CreatePirepTables extends Migration
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name', 50);
|
||||
$table->boolean('required')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('pirep_field_values', function (Blueprint $table) {
|
||||
|
@ -107,11 +107,6 @@ class PirepFieldController extends BaseController
|
||||
|
||||
/**
|
||||
* Update the specified PirepField in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdatePirepFieldRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdatePirepFieldRequest $request)
|
||||
{
|
||||
|
@ -10,31 +10,19 @@ namespace App\Models;
|
||||
class PirepField extends BaseModel
|
||||
{
|
||||
public $table = 'pirep_fields';
|
||||
public $timestamps = false;
|
||||
|
||||
public $fillable
|
||||
= [
|
||||
public $fillable = [
|
||||
'name',
|
||||
'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
protected $casts = [
|
||||
'name' => 'string',
|
||||
'required' => 'integer',
|
||||
'required' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules
|
||||
= [
|
||||
public static $rules = [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<td>{!! $airport->name !!}</td>
|
||||
<td>{!! $airport->location !!}</td>
|
||||
<td style="text-align: center;">
|
||||
@if($airport->hub == 1)
|
||||
@if($airport->hub === true)
|
||||
<span class="label label-success">Hub</span>
|
||||
@endif
|
||||
</td>
|
||||
|
@ -1,19 +0,0 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>Edit "{!! $field->name !!}"</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('admin.flash.message')
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::model($field, ['route' => ['admin.pirepfields.update', $field->id], 'method' => 'patch']) !!}
|
||||
@include('admin.pirep_fields.fields')
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -1,17 +0,0 @@
|
||||
<!-- Name Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Required Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('required', 'Required:') !!}
|
||||
{!! Form::text('required', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.pirepfields.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
@ -1,23 +0,0 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">PIREP Fields</h1>
|
||||
<h1 class="pull-right">
|
||||
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.pirepfields.create') !!}">Add New</a>
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
@include('admin.pirep_fields.table')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -1,24 +0,0 @@
|
||||
<table class="table table-hover table-responsive" id="pirepFields-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Required</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($fields as $field)
|
||||
<tr>
|
||||
<td>{!! $field->name !!}</td>
|
||||
<td>{!! $field->required !!}</td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.pirepfields.destroy', $field->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
{{--<a href="{!! route('admin.pirepfields.show', [$field->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.pirepfields.edit', [$field->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>--}}
|
||||
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
@ -1,11 +1,11 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Add PIREP Field')
|
||||
@section('title', 'Adding Field')
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.flash.message')
|
||||
{!! Form::open(['route' => 'admin.pirepfields.store']) !!}
|
||||
@include('admin.pirep_fields.fields')
|
||||
@include('admin.pirepfields.fields')
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
12
resources/views/admin/pirepfields/edit.blade.php
Normal file
12
resources/views/admin/pirepfields/edit.blade.php
Normal file
@ -0,0 +1,12 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'Editing ' . $field->name)
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.flash.message')
|
||||
{!! Form::model($field, ['route' => ['admin.pirepfields.update', $field->id], 'method' => 'patch']) !!}
|
||||
@include('admin.pirepfields.fields')
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
20
resources/views/admin/pirepfields/fields.blade.php
Normal file
20
resources/views/admin/pirepfields/fields.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('name', 'Name:') !!} <span class="required">*</span>
|
||||
{!! Form::text('name', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Required Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('required', 'Required:') !!}
|
||||
{!! Form::hidden('required', 0) !!}
|
||||
{!! Form::checkbox('required', null) !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Submit Field -->
|
||||
<div class="form-group col-sm-12">
|
||||
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
|
||||
<a href="{!! route('admin.pirepfields.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
||||
</div>
|
15
resources/views/admin/pirepfields/index.blade.php
Normal file
15
resources/views/admin/pirepfields/index.blade.php
Normal file
@ -0,0 +1,15 @@
|
||||
@extends('admin.app')
|
||||
@section('title', 'PIREP Fields')
|
||||
@section('actions')
|
||||
<li><a href="{!! route('admin.pirepfields.create') !!}"><i class="ti-plus"></i>Add
|
||||
Field</a></li>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.flash.message')
|
||||
@include('admin.pirepfields.table')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.pirep_fields.show_fields')
|
||||
@include('admin.pirepfields.show_fields')
|
||||
<a href="{!! route('admin.pirepfields.index') !!}" class="btn btn-default">Back</a>
|
||||
</div>
|
||||
</div>
|
31
resources/views/admin/pirepfields/table.blade.php
Normal file
31
resources/views/admin/pirepfields/table.blade.php
Normal file
@ -0,0 +1,31 @@
|
||||
<div class="content table-responsive table-full-width">
|
||||
<table class="table table-hover table-responsive" id="pirepFields-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Required</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($fields as $field)
|
||||
<tr>
|
||||
<td>{!! $field->name !!}</td>
|
||||
<td style="text-align: center;">
|
||||
@if($field->required === true)
|
||||
<span class="label label-success">Hub</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{!! Form::open(['route' => ['admin.pirepfields.destroy', $field->id], 'method' => 'delete']) !!}
|
||||
<a href="{!! route('admin.pirepfields.edit', [$field->id]) !!}"
|
||||
class='btn btn-sm btn-success btn-icon'>
|
||||
<i class="fa fa-pencil-square-o"></i></a>
|
||||
|
||||
{!! Form::button('<i class="fa fa-times"></i>',
|
||||
['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon',
|
||||
'onclick' => "return confirm('Are you sure?')"]) !!}
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
@ -2,12 +2,12 @@
|
||||
|
||||
@section('title', 'Pilot Reports')
|
||||
@section('actions')
|
||||
<li><a href="{!! route('admin.pirepfields.index') !!}"><i class="ti-menu-alt"></i>PIREP Fields</a></li>
|
||||
<li><a href="{!! route('admin.pireps.index') !!}?search=status:0"><i class="ti-plus"></i>Pending</a></li>
|
||||
<li><a href="{!! route('admin.pireps.index') !!}"><i class="ti-plus"></i>View All</a></li>
|
||||
@endsection
|
||||
@section('content')
|
||||
@include('admin.pireps.table')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
{{ $pireps->links('admin.pagination.default') }}
|
||||
|
@ -8,8 +8,10 @@
|
||||
</li>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="card">
|
||||
@include('flash::message')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.flash.message')
|
||||
@include('admin.subfleets.table')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -87,8 +87,7 @@
|
||||
<i class="now-ui-icons users_single-02"></i>
|
||||
</span>-->
|
||||
{!! Form::text('field_'.$field->id, null, [
|
||||
'class' => 'form-control',
|
||||
'required' => $field->required,
|
||||
'class' => 'form-control'
|
||||
]) !!}
|
||||
</div>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user