\#21 PIREP scaffolding
This commit is contained in:
parent
43effce37c
commit
477b99de29
150
app/Http/Controllers/Admin/PirepController.php
Normal file
150
app/Http/Controllers/Admin/PirepController.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\CreatePirepRequest;
|
||||
use App\Http\Requests\UpdatePirepRequest;
|
||||
use App\Repositories\PirepRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class PirepController extends BaseController
|
||||
{
|
||||
private $pirepRepository;
|
||||
|
||||
public function __construct(PirepRepository $pirepRepo)
|
||||
{
|
||||
$this->pirepRepository = $pirepRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the Pirep.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->pirepRepository->pushCriteria(new RequestCriteria($request));
|
||||
$pireps = $this->pirepRepository->all();
|
||||
|
||||
return view('admin.pireps.index', [
|
||||
'pireps' => $pireps
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Pirep.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.pireps.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Pirep in storage.
|
||||
*
|
||||
* @param CreatePirepRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(CreatePirepRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
$pirep = $this->pirepRepository->create($input);
|
||||
|
||||
Flash::success('Pirep saved successfully.');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified Pirep.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$pirep = $this->pirepRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($pirep)) {
|
||||
Flash::error('Pirep not found');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
return view('admin.pireps.show', [
|
||||
'pirep' => $pirep,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified Pirep.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$pirep = $this->pirepRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($pirep)) {
|
||||
Flash::error('Pirep not found');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
return view('admin.pireps.edit', [
|
||||
'pirep' => $pirep,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified Pirep in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdatePirepRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdatePirepRequest $request)
|
||||
{
|
||||
$pirep = $this->pirepRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($pirep)) {
|
||||
Flash::error('Pirep not found');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
$pirep = $this->pirepRepository->update($request->all(), $id);
|
||||
|
||||
Flash::success('Pirep updated successfully.');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified Pirep from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$pirep = $this->pirepRepository->findWithoutFail($id);
|
||||
|
||||
if (empty($pirep)) {
|
||||
Flash::error('Pirep not found');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
|
||||
$this->pirepRepository->delete($id);
|
||||
|
||||
Flash::success('Pirep deleted successfully.');
|
||||
return redirect(route('admin.pireps.index'));
|
||||
}
|
||||
}
|
152
app/Http/Controllers/Admin/PirepFieldController.php
Normal file
152
app/Http/Controllers/Admin/PirepFieldController.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\CreatePirepFieldRequest;
|
||||
use App\Http\Requests\UpdatePirepFieldRequest;
|
||||
use App\Repositories\PirepFieldRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class PirepFieldController extends BaseController
|
||||
{
|
||||
/** @var PirepFieldRepository */
|
||||
private $pirepFieldRepo;
|
||||
|
||||
public function __construct(PirepFieldRepository $pirepFieldRepo)
|
||||
{
|
||||
$this->pirepFieldRepo = $pirepFieldRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the PirepField.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->pirepFieldRepo->pushCriteria(new RequestCriteria($request));
|
||||
$fields = $this->pirepFieldRepo->all();
|
||||
|
||||
return view('admin.pirepFields.index', [
|
||||
'fields' => $fields,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new PirepField.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.pirepFields.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created PirepField in storage.
|
||||
*
|
||||
* @param CreatePirepFieldRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store(CreatePirepFieldRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
|
||||
$field = $this->pirepFieldRepo->create($input);
|
||||
|
||||
Flash::success('PirepField saved successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified PirepField.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$field = $this->pirepFieldRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
return view('admin.pirepFields.show', [
|
||||
'field' => $field,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified PirepField.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$field = $this->pirepFieldRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
return view('admin.pirepFields.edit', [
|
||||
'field' => $field,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified PirepField in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdatePirepFieldRequest $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id, UpdatePirepFieldRequest $request)
|
||||
{
|
||||
$field = $this->pirepFieldRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
$field = $this->pirepFieldRepo->update($request->all(), $id);
|
||||
|
||||
Flash::success('PirepField updated successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified PirepField from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$field = $this->pirepFieldRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($field)) {
|
||||
Flash::error('PirepField not found');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
|
||||
$this->pirepFieldRepo->delete($id);
|
||||
|
||||
Flash::success('PirepField deleted successfully.');
|
||||
return redirect(route('admin.pirepFields.index'));
|
||||
}
|
||||
}
|
30
app/Http/Requests/CreatePirepFieldRequest.php
Normal file
30
app/Http/Requests/CreatePirepFieldRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\PirepField;
|
||||
|
||||
class CreatePirepFieldRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return PirepField::$rules;
|
||||
}
|
||||
}
|
30
app/Http/Requests/CreatePirepRequest.php
Normal file
30
app/Http/Requests/CreatePirepRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Pirep;
|
||||
|
||||
class CreatePirepRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Pirep::$rules;
|
||||
}
|
||||
}
|
30
app/Http/Requests/UpdatePirepFieldRequest.php
Normal file
30
app/Http/Requests/UpdatePirepFieldRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\PirepField;
|
||||
|
||||
class UpdatePirepFieldRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return PirepField::$rules;
|
||||
}
|
||||
}
|
30
app/Http/Requests/UpdatePirepRequest.php
Normal file
30
app/Http/Requests/UpdatePirepRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Pirep;
|
||||
|
||||
class UpdatePirepRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return Pirep::$rules;
|
||||
}
|
||||
}
|
91
app/Models/Pirep.php
Normal file
91
app/Models/Pirep.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Pirep
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Pirep extends Model
|
||||
{
|
||||
use Uuids;
|
||||
use SoftDeletes;
|
||||
|
||||
public $table = 'pireps';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
public $fillable
|
||||
= [
|
||||
'user_id',
|
||||
'flight_id',
|
||||
'aircraft_id',
|
||||
'flight_time',
|
||||
'route_code',
|
||||
'route_leg',
|
||||
'dpt_airport_id',
|
||||
'arr_airport_id',
|
||||
'level',
|
||||
'route',
|
||||
'notes',
|
||||
'status',
|
||||
'raw_data',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'user_id' => 'integer',
|
||||
'flight_id' => 'string',
|
||||
'aircraft_id' => 'integer',
|
||||
'flight_time' => 'integer',
|
||||
'level' => 'integer',
|
||||
'route' => 'string',
|
||||
'notes' => 'string',
|
||||
'raw_data' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules
|
||||
= [
|
||||
'dpt_airport_id' => 'required',
|
||||
'arr_airport_id' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Foreign Keys
|
||||
*/
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User', 'user_id');
|
||||
}
|
||||
|
||||
public function flight()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Flight', 'flight_id');
|
||||
}
|
||||
|
||||
public function dpt_airport()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airport', 'dpt_airport_id');
|
||||
}
|
||||
|
||||
public function arr_airport()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airport', 'arr_airport_id');
|
||||
}
|
||||
|
||||
}
|
42
app/Models/PirepField.php
Normal file
42
app/Models/PirepField.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
|
||||
/**
|
||||
* Class PirepField
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class PirepField extends Model
|
||||
{
|
||||
public $table = 'pirep_fields';
|
||||
|
||||
public $fillable
|
||||
= [
|
||||
'name',
|
||||
'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'name' => 'string',
|
||||
'required' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules
|
||||
= [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
45
app/Models/PirepFieldValues.php
Normal file
45
app/Models/PirepFieldValues.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Eloquent as Model;
|
||||
|
||||
/**
|
||||
* Class PirepField
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class PirepFieldValues extends Model
|
||||
{
|
||||
public $table = 'pirep_field_values';
|
||||
|
||||
public $fillable
|
||||
= [
|
||||
'pirep_id',
|
||||
'name',
|
||||
'value',
|
||||
'source',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
'source' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules
|
||||
= [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreatePirepsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pireps', function (Blueprint $table) {
|
||||
$table->uuid('id');
|
||||
$table->integer('user_id');
|
||||
$table->string('flight_id');
|
||||
$table->integer('aircraft_id');
|
||||
$table->text('route_code')->nullable();
|
||||
$table->text('route_leg')->nullable();
|
||||
$table->integer('dpt_airport_id')->unsigned();
|
||||
$table->integer('arr_airport_id')->unsigned();
|
||||
$table->integer('flight_time')->unsigned();
|
||||
$table->integer('level')->unsigned();
|
||||
$table->string('route')->nullable();
|
||||
$table->string('notes')->nullable();
|
||||
$table->tinyInteger('status');
|
||||
$table->string('raw_data')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->primary('id');
|
||||
$table->index('user_id');
|
||||
$table->index('flight_id');
|
||||
$table->index('dpt_airport_id');
|
||||
$table->index('arr_airport_id');
|
||||
});
|
||||
|
||||
Schema::create('pirep_fields', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->integer('required');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('pirep_field_values', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->uuid('pirep_id');
|
||||
$table->string('name');
|
||||
$table->string('value');
|
||||
$table->tinyInteger('source')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('pirep_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('pireps');
|
||||
Schema::drop('pirep_fields');
|
||||
Schema::drop('pirep_field_values');
|
||||
}
|
||||
}
|
20
resources/views/admin/pirep_fields/create.blade.php
Normal file
20
resources/views/admin/pirep_fields/create.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>Add PIREP Field</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::open(['route' => 'admin.pirepfields.store']) !!}
|
||||
@include('admin.pirep_fields.fields')
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
19
resources/views/admin/pirep_fields/edit.blade.php
Normal file
19
resources/views/admin/pirep_fields/edit.blade.php
Normal file
@ -0,0 +1,19 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>Edit "{!! $field->name !!}"</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<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
|
17
resources/views/admin/pirep_fields/fields.blade.php
Normal file
17
resources/views/admin/pirep_fields/fields.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
<!-- 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>
|
23
resources/views/admin/pirep_fields/index.blade.php
Normal file
23
resources/views/admin/pirep_fields/index.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@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
|
||||
|
17
resources/views/admin/pirep_fields/show.blade.php
Normal file
17
resources/views/admin/pirep_fields/show.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>{!! $pirepFields->name !!}</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.pirep_fields.show_fields')
|
||||
<a href="{!! route('admin.pirepfields.index') !!}" class="btn btn-default">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
30
resources/views/admin/pirep_fields/show_fields.blade.php
Normal file
30
resources/views/admin/pirep_fields/show_fields.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
<!-- Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('id', 'Id:') !!}
|
||||
<p>{!! $field->id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Name Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('name', 'Name:') !!}
|
||||
<p>{!! $field->name !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Required Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('required', 'Required:') !!}
|
||||
<p>{!! $field->required !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('created_at', 'Created At:') !!}
|
||||
<p>{!! $field->created_at !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||
<p>{!! $field->updated_at !!}</p>
|
||||
</div>
|
||||
|
24
resources/views/admin/pirep_fields/table.blade.php
Normal file
24
resources/views/admin/pirep_fields/table.blade.php
Normal file
@ -0,0 +1,24 @@
|
||||
<table class="table table-responsive" id="pirepFields-table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Required</th>
|
||||
<th colspan="3">Action</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>
|
24
resources/views/admin/pireps/create.blade.php
Normal file
24
resources/views/admin/pireps/create.blade.php
Normal file
@ -0,0 +1,24 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
$MODEL_NAME_HUMAN$
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::open(['route' => 'admin.pireps.store']) !!}
|
||||
|
||||
@include('admin.pireps.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
23
resources/views/admin/pireps/edit.blade.php
Normal file
23
resources/views/admin/pireps/edit.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
$MODEL_NAME_HUMAN$
|
||||
</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
@include('adminlte-templates::common.errors')
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
{!! Form::model($pirep, ['route' => ['admin.pireps.update', $pirep->id], 'method' => 'patch']) !!}
|
||||
|
||||
@include('admin.pireps.fields')
|
||||
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
47
resources/views/admin/pireps/fields.blade.php
Normal file
47
resources/views/admin/pireps/fields.blade.php
Normal file
@ -0,0 +1,47 @@
|
||||
<!-- Flight Id Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('flight_id', 'Flight ID:') !!}
|
||||
{!! Form::text('flight_id', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Aircraft Id Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('aircraft_id', 'Aircraft ID:') !!}
|
||||
{!! Form::text('aircraft_id', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Flight Time Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('flight_time', 'Flight Time:') !!}
|
||||
{!! Form::text('flight_time', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Level Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('level', 'Flight Level:') !!}
|
||||
{!! Form::text('level', null, ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
|
||||
<!-- Route Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('route', 'Route:') !!}
|
||||
{!! Form::text('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>
|
||||
|
||||
<!-- Raw Data Field -->
|
||||
<div class="form-group col-sm-6">
|
||||
{!! Form::label('raw_data', 'Raw Data:') !!}
|
||||
{!! Form::text('raw_data', 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.pireps.index') !!}" class="btn btn-default">Cancel</a>
|
||||
</div>
|
23
resources/views/admin/pireps/index.blade.php
Normal file
23
resources/views/admin/pireps/index.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">PIREPs</h1>
|
||||
<h1 class="pull-right">
|
||||
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('admin.pireps.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.pireps.table')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
17
resources/views/admin/pireps/show.blade.php
Normal file
17
resources/views/admin/pireps/show.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1>PIREP</h1>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row" style="padding-left: 20px">
|
||||
@include('admin.pireps.show_fields')
|
||||
<a href="{!! route('admin.pireps.index') !!}" class="btn btn-default">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
66
resources/views/admin/pireps/show_fields.blade.php
Normal file
66
resources/views/admin/pireps/show_fields.blade.php
Normal file
@ -0,0 +1,66 @@
|
||||
<!-- Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('id', 'Id:') !!}
|
||||
<p>{!! $pirep->id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- User Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('user_id', 'User Id:') !!}
|
||||
<p>{!! $pirep->user_id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Flight Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('flight_id', 'Flight Id:') !!}
|
||||
<p>{!! $pirep->flight_id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Aircraft Id Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('aircraft_id', 'Aircraft Id:') !!}
|
||||
<p>{!! $pirep->aircraft_id !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Flight Time Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('flight_time', 'Flight Time:') !!}
|
||||
<p>{!! $pirep->flight_time !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Level Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('level', 'Level:') !!}
|
||||
<p>{!! $pirep->level !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Route Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('route', 'Route:') !!}
|
||||
<p>{!! $pirep->route !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Notes Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('notes', 'Notes:') !!}
|
||||
<p>{!! $pirep->notes !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Raw Data Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('raw_data', 'Raw Data:') !!}
|
||||
<p>{!! $pirep->raw_data !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Created At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('created_at', 'Created At:') !!}
|
||||
<p>{!! $pirep->created_at !!}</p>
|
||||
</div>
|
||||
|
||||
<!-- Updated At Field -->
|
||||
<div class="form-group">
|
||||
{!! Form::label('updated_at', 'Updated At:') !!}
|
||||
<p>{!! $pirep->updated_at !!}</p>
|
||||
</div>
|
||||
|
36
resources/views/admin/pireps/table.blade.php
Normal file
36
resources/views/admin/pireps/table.blade.php
Normal file
@ -0,0 +1,36 @@
|
||||
<table class="table table-responsive" id="pireps-table">
|
||||
<thead>
|
||||
<th>User Id</th>
|
||||
<th>Flight Id</th>
|
||||
<th>Aircraft Id</th>
|
||||
<th>Flight Time</th>
|
||||
<th>Level</th>
|
||||
<th>Route</th>
|
||||
<th>Notes</th>
|
||||
<th>Raw Data</th>
|
||||
<th colspan="3">Action</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($pireps as $pirep)
|
||||
<tr>
|
||||
<td>{!! $pirep->user_id !!}</td>
|
||||
<td>{!! $pirep->flight_id !!}</td>
|
||||
<td>{!! $pirep->aircraft_id !!}</td>
|
||||
<td>{!! $pirep->flight_time !!}</td>
|
||||
<td>{!! $pirep->level !!}</td>
|
||||
<td>{!! $pirep->route !!}</td>
|
||||
<td>{!! $pirep->notes !!}</td>
|
||||
<td>{!! $pirep->raw_data !!}</td>
|
||||
<td>
|
||||
{!! Form::open(['route' => ['admin.pireps.destroy', $pirep->id], 'method' => 'delete']) !!}
|
||||
<div class='btn-group'>
|
||||
<a href="{!! route('admin.pireps.show', [$pirep->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
|
||||
<a href="{!! route('admin.pireps.edit', [$pirep->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>
|
@ -30,6 +30,10 @@ Route::group([
|
||||
Route::match(['get'], 'settings', 'SettingsController@index');
|
||||
Route::match(['post', 'put'], 'settings', 'SettingsController@update');
|
||||
|
||||
# pirep related routes
|
||||
Route::resource('pireps', 'PirepController');
|
||||
Route::resource('pirepfields', 'PirepFieldController');
|
||||
|
||||
# defaults
|
||||
Route::get('', ['uses' => 'DashboardController@index']);
|
||||
Route::get('/', ['uses' => 'DashboardController@index']);
|
||||
|
Loading…
Reference in New Issue
Block a user