#23 cleaned up rank data and templates

This commit is contained in:
Nabeel Shahzad 2017-07-02 15:03:25 -05:00
parent 244d1ae7bd
commit 9dc880d7d3
6 changed files with 17 additions and 35 deletions

View File

@ -76,10 +76,11 @@ class RankController extends BaseController
$model = $this->rankRepository->create($input);
Flash::success('Ranking saved successfully.');
$ranks = $this->rankRepository->all();
return redirect(route('admin.ranks.edit', ['id' => $model->id]));
/*$ranks = $this->rankRepository->all();
return view('admin.ranks.table', [
'ranks' => $ranks,
]);
]);*/
}
/**

View File

@ -37,7 +37,7 @@ class Airline extends Model
* @var array
*/
public static $rules = [
'code' => 'required|max:3',
'code' => 'required|max:3|unique:airlines',
'name' => 'required',
];

View File

@ -35,7 +35,7 @@ class Airport extends Model
* @var array
*/
public static $rules = [
'icao' => 'required'
'icao' => 'required|unique:airports'
];
public function save(array $options = [])

View File

@ -40,7 +40,8 @@ class Rank extends Model
* @var array
*/
public static $rules = [
'name' => 'unique',
'name' => 'required|unique:ranks',
'hours' => 'required',
];
public function subfleets() {

View File

@ -1,6 +1,6 @@
<section class="content-header">
<h1>Rank</h1>
</section>
@extends('admin.app')
@section('content')
<section class="content-header"><h1>Rank</h1></section>
<div class="content">
@include('adminlte-templates::common.errors')
<div class="box box-primary">
@ -8,11 +8,10 @@
<div class="box-body">
<div class="row">
{!! Form::open(['route' => 'admin.ranks.store', 'class' => 'add_rank', 'method'=>'POST']) !!}
@include('admin.ranks.fields')
{!! Form::close() !!}
</div>
</div>
</div>
</div>
@endsection

View File

@ -15,37 +15,18 @@
<div class="clearfix"></div>
<div class="box box-primary">
<div class="box-body">
@include('admin.ranks.table')
@include('admin.ranks.table')
</div>
</div>
@include('admin.ranks.create')
</div>
@endsection
@section('scripts')
<script type="text/javascript">
$(document).ready(function () {
/*$(".ac-fare-dropdown").select2();
$('#aircraft_fares a').editable({
type: 'text',
mode: 'inline',
emptytext: 'default',
title: 'Enter override value',
ajaxOptions: {'type': 'put'},
params: function (params) {
return {
rank_id: params.pk,
name: params.name,
value: params.value
}
}
});*/
$(document).on('submit', 'form.add_rank', function (event) {
event.preventDefault();
$.pjax.submit(event, '#ranks_table_wrapper', {push: false});
});
$(document).ready(function () {
$(document).on('submit', 'form.add_rank', function (event) {
event.preventDefault();
$.pjax.submit(event, '#ranks_table_wrapper', {push: false});
});
});
</script>
@endsection