diff --git a/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php b/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php index 28c7c992..822f51ff 100644 --- a/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php +++ b/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php @@ -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) { diff --git a/app/Http/Controllers/Admin/PirepFieldController.php b/app/Http/Controllers/Admin/PirepFieldController.php index 0bc77aeb..7238e867 100644 --- a/app/Http/Controllers/Admin/PirepFieldController.php +++ b/app/Http/Controllers/Admin/PirepFieldController.php @@ -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) { diff --git a/app/Models/PirepField.php b/app/Models/PirepField.php index 41f82d3c..4e844b19 100644 --- a/app/Models/PirepField.php +++ b/app/Models/PirepField.php @@ -10,31 +10,19 @@ namespace App\Models; class PirepField extends BaseModel { public $table = 'pirep_fields'; + public $timestamps = false; - public $fillable - = [ - 'name', - 'required', - ]; + public $fillable = [ + 'name', + 'required', + ]; - /** - * The attributes that should be casted to native types. - * - * @var array - */ - protected $casts - = [ - 'name' => 'string', - 'required' => 'integer', - ]; + protected $casts = [ + 'name' => 'string', + 'required' => 'boolean', + ]; - /** - * Validation rules - * - * @var array - */ - public static $rules - = [ - 'name' => 'required', - ]; + public static $rules = [ + 'name' => 'required', + ]; } diff --git a/resources/views/admin/airports/table.blade.php b/resources/views/admin/airports/table.blade.php index 4587cd55..b12ca410 100644 --- a/resources/views/admin/airports/table.blade.php +++ b/resources/views/admin/airports/table.blade.php @@ -17,7 +17,7 @@ {!! $airport->name !!} {!! $airport->location !!} - @if($airport->hub == 1) + @if($airport->hub === true) Hub @endif diff --git a/resources/views/admin/pirep_fields/edit.blade.php b/resources/views/admin/pirep_fields/edit.blade.php deleted file mode 100644 index 0c85b333..00000000 --- a/resources/views/admin/pirep_fields/edit.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@extends('admin.app') - -@section('content') -
-

Edit "{!! $field->name !!}"

-
-
- @include('admin.flash.message') -
-
-
- {!! Form::model($field, ['route' => ['admin.pirepfields.update', $field->id], 'method' => 'patch']) !!} - @include('admin.pirep_fields.fields') - {!! Form::close() !!} -
-
-
-
-@endsection diff --git a/resources/views/admin/pirep_fields/fields.blade.php b/resources/views/admin/pirep_fields/fields.blade.php deleted file mode 100644 index f9a8d2c4..00000000 --- a/resources/views/admin/pirep_fields/fields.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - -
- {!! Form::label('name', 'Name:') !!} - {!! Form::text('name', null, ['class' => 'form-control']) !!} -
- - -
- {!! Form::label('required', 'Required:') !!} - {!! Form::text('required', null, ['class' => 'form-control']) !!} -
- - -
- {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!} - Cancel -
diff --git a/resources/views/admin/pirep_fields/index.blade.php b/resources/views/admin/pirep_fields/index.blade.php deleted file mode 100644 index ce7746a5..00000000 --- a/resources/views/admin/pirep_fields/index.blade.php +++ /dev/null @@ -1,23 +0,0 @@ -@extends('admin.app') - -@section('content') -
-

PIREP Fields

-

- Add New -

-
-
-
- - @include('flash::message') - -
-
-
- @include('admin.pirep_fields.table') -
-
-
-@endsection - diff --git a/resources/views/admin/pirep_fields/table.blade.php b/resources/views/admin/pirep_fields/table.blade.php deleted file mode 100644 index 79601345..00000000 --- a/resources/views/admin/pirep_fields/table.blade.php +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - @foreach($fields as $field) - - - - - - @endforeach - -
NameRequired
{!! $field->name !!}{!! $field->required !!} - {!! Form::open(['route' => ['admin.pirepfields.destroy', $field->id], 'method' => 'delete']) !!} -
- {{-- - --}} - {!! Form::button('', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!} -
- {!! Form::close() !!} -
diff --git a/resources/views/admin/pirep_fields/create.blade.php b/resources/views/admin/pirepfields/create.blade.php similarity index 76% rename from resources/views/admin/pirep_fields/create.blade.php rename to resources/views/admin/pirepfields/create.blade.php index b238786c..ce1a9fa2 100644 --- a/resources/views/admin/pirep_fields/create.blade.php +++ b/resources/views/admin/pirepfields/create.blade.php @@ -1,11 +1,11 @@ @extends('admin.app') -@section('title', 'Add PIREP Field') +@section('title', 'Adding Field') @section('content')
@include('admin.flash.message') {!! Form::open(['route' => 'admin.pirepfields.store']) !!} - @include('admin.pirep_fields.fields') + @include('admin.pirepfields.fields') {!! Form::close() !!}
diff --git a/resources/views/admin/pirepfields/edit.blade.php b/resources/views/admin/pirepfields/edit.blade.php new file mode 100644 index 00000000..3e8b1308 --- /dev/null +++ b/resources/views/admin/pirepfields/edit.blade.php @@ -0,0 +1,12 @@ +@extends('admin.app') +@section('title', 'Editing ' . $field->name) +@section('content') +
+
+ @include('admin.flash.message') + {!! Form::model($field, ['route' => ['admin.pirepfields.update', $field->id], 'method' => 'patch']) !!} + @include('admin.pirepfields.fields') + {!! Form::close() !!} +
+
+@endsection diff --git a/resources/views/admin/pirepfields/fields.blade.php b/resources/views/admin/pirepfields/fields.blade.php new file mode 100644 index 00000000..359d1219 --- /dev/null +++ b/resources/views/admin/pirepfields/fields.blade.php @@ -0,0 +1,20 @@ +
+
+ {!! Form::label('name', 'Name:') !!}  * + {!! Form::text('name', null, ['class' => 'form-control']) !!} +
+ + +
+ {!! Form::label('required', 'Required:') !!} + {!! Form::hidden('required', 0) !!} + {!! Form::checkbox('required', null) !!} +
+
+
+ +
+ {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!} + Cancel +
+
diff --git a/resources/views/admin/pirepfields/index.blade.php b/resources/views/admin/pirepfields/index.blade.php new file mode 100644 index 00000000..e6082920 --- /dev/null +++ b/resources/views/admin/pirepfields/index.blade.php @@ -0,0 +1,15 @@ +@extends('admin.app') +@section('title', 'PIREP Fields') +@section('actions') +
  • Add + Field
  • +@endsection +@section('content') +
    +
    + @include('admin.flash.message') + @include('admin.pirepfields.table') +
    +
    +@endsection + diff --git a/resources/views/admin/pirep_fields/show.blade.php b/resources/views/admin/pirepfields/show.blade.php similarity index 88% rename from resources/views/admin/pirep_fields/show.blade.php rename to resources/views/admin/pirepfields/show.blade.php index a33643df..7daf86a1 100644 --- a/resources/views/admin/pirep_fields/show.blade.php +++ b/resources/views/admin/pirepfields/show.blade.php @@ -8,7 +8,7 @@
    - @include('admin.pirep_fields.show_fields') + @include('admin.pirepfields.show_fields') Back
    diff --git a/resources/views/admin/pirep_fields/show_fields.blade.php b/resources/views/admin/pirepfields/show_fields.blade.php similarity index 100% rename from resources/views/admin/pirep_fields/show_fields.blade.php rename to resources/views/admin/pirepfields/show_fields.blade.php diff --git a/resources/views/admin/pirepfields/table.blade.php b/resources/views/admin/pirepfields/table.blade.php new file mode 100644 index 00000000..9e36302c --- /dev/null +++ b/resources/views/admin/pirepfields/table.blade.php @@ -0,0 +1,31 @@ +
    + + + + + + + + @foreach($fields as $field) + + + + + + @endforeach + +
    NameRequired
    {!! $field->name !!} + @if($field->required === true) + Hub + @endif + + {!! Form::open(['route' => ['admin.pirepfields.destroy', $field->id], 'method' => 'delete']) !!} + + + + {!! Form::button('', + ['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon', + 'onclick' => "return confirm('Are you sure?')"]) !!} + {!! Form::close() !!} +
    diff --git a/resources/views/admin/pireps/index.blade.php b/resources/views/admin/pireps/index.blade.php index 60962757..86accec5 100644 --- a/resources/views/admin/pireps/index.blade.php +++ b/resources/views/admin/pireps/index.blade.php @@ -2,12 +2,12 @@ @section('title', 'Pilot Reports') @section('actions') +
  • PIREP Fields
  • Pending
  • View All
  • @endsection @section('content') @include('admin.pireps.table') -
    {{ $pireps->links('admin.pagination.default') }} diff --git a/resources/views/admin/subfleets/index.blade.php b/resources/views/admin/subfleets/index.blade.php index a14b78a2..aa94abf1 100644 --- a/resources/views/admin/subfleets/index.blade.php +++ b/resources/views/admin/subfleets/index.blade.php @@ -8,8 +8,10 @@ @endsection @section('content') -
    - @include('flash::message') - @include('admin.subfleets.table') +
    +
    + @include('admin.flash.message') + @include('admin.subfleets.table') +
    @endsection diff --git a/resources/views/layouts/default/pireps/fields.blade.php b/resources/views/layouts/default/pireps/fields.blade.php index 85e30195..dba49541 100644 --- a/resources/views/layouts/default/pireps/fields.blade.php +++ b/resources/views/layouts/default/pireps/fields.blade.php @@ -87,8 +87,7 @@ --> {!! Form::text('field_'.$field->id, null, [ - 'class' => 'form-control', - 'required' => $field->required, + 'class' => 'form-control' ]) !!}