Skip to content

Commit

Permalink
#23 cleaned up rank data and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Jul 2, 2017
1 parent 244d1ae commit 9dc880d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 35 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/Admin/RankController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ public function store(CreateRankRequest $request)
$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,
]);
]);*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Airline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand Down
2 changes: 1 addition & 1 deletion app/Models/Airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Airport extends Model
* @var array
*/
public static $rules = [
'icao' => 'required'
'icao' => 'required|unique:airports'
];

public function save(array $options = [])
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class Rank extends Model
* @var array
*/
public static $rules = [
'name' => 'unique',
'name' => 'required|unique:ranks',
'hours' => 'required',
];

public function subfleets() {
Expand Down
9 changes: 4 additions & 5 deletions resources/views/admin/ranks/create.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<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">

<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
31 changes: 6 additions & 25 deletions resources/views/admin/ranks/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9dc880d

Please sign in to comment.