#32 Cleanup of subfleet edit and linked from the aircraft screen

This commit is contained in:
Nabeel Shahzad 2017-07-02 15:11:27 -05:00
parent 9dc880d7d3
commit ddc2ed4d89
7 changed files with 55 additions and 34 deletions

View File

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

View File

@ -127,8 +127,10 @@ class SubfleetController extends BaseController
return redirect(route('admin.subfleets.index')); return redirect(route('admin.subfleets.index'));
} }
$avail_fares = $this->getAvailFares($subfleet);
return view('admin.subfleets.edit', [ return view('admin.subfleets.edit', [
'airlines' => Airline::all()->pluck('name', 'id'), 'airlines' => Airline::all()->pluck('name', 'id'),
'avail_fares' => $avail_fares,
'subfleet' => $subfleet, 'subfleet' => $subfleet,
]); ]);
} }

View File

@ -11,7 +11,9 @@
<tr> <tr>
<td> <td>
@if($ac->subfleet_id) @if($ac->subfleet_id)
<a href="{!! route('admin.subfleets.edit', [$ac->subfleet_id]) !!}">
{!! $ac->subfleet->name !!} {!! $ac->subfleet->name !!}
</a>
@else @else
- -
@endif @endif

View File

@ -17,5 +17,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box box-primary">
<div class="box-body">
<div class="row">
<div class="col-xs-12">
<h3>fares</h3>
<div class="box-body">
<div class="callout callout-info">
<i class="icon fa fa-info">&nbsp;&nbsp;</i>
Fares assigned to the current subfleet. These can be overridden,
otherwise, the value used is the default, which comes from the fare.
</div>
@include('admin.subfleets.fares')
</div>
</div>
</div>
</div>
</div>
</div> </div>
@endsection @endsection
@include('admin.subfleets.script')

View File

@ -1,23 +1,25 @@
<!-- Airline Id Field --> <!-- Airline Id Field -->
<div class="form-group col-sm-6"> <div class="form-group col-sm-4">
{!! Form::label('airline_id', 'Airline Id:') !!} {!! Form::label('airline_id', 'Airline Id:') !!}
{!! Form::select('airline_id', $airlines, null , ['class' => 'form-control']) !!} {!! Form::select('airline_id', $airlines, null , ['class' => 'form-control']) !!}
</div> </div>
<!-- Name Field --> <!-- Name Field -->
<div class="form-group col-sm-6"> <div class="form-group col-sm-4">
{!! Form::label('name', 'Name:') !!} {!! Form::label('name', 'Name:') !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!} {!! Form::text('name', null, ['class' => 'form-control']) !!}
</div> </div>
<!-- Type Field --> <!-- Type Field -->
<div class="form-group col-sm-6"> <div class="form-group col-sm-4">
{!! Form::label('type', 'Type:') !!} {!! Form::label('type', 'Type:') !!}
{!! Form::text('type', null, ['class' => 'form-control']) !!} {!! Form::text('type', null, ['class' => 'form-control']) !!}
</div> </div>
<!-- Submit Field --> <!-- Submit Field -->
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<div class="pull-right">
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!} {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
<a href="{!! route('admin.subfleets.index') !!}" class="btn btn-default">Cancel</a> <a href="{!! route('admin.subfleets.index') !!}" class="btn btn-default">Cancel</a>
</div>
</div> </div>

View File

@ -0,0 +1,27 @@
@section('scripts')
<script>
$(document).ready(function() {
$(".ac-fare-dropdown").select2();
$('#aircraft_fares a').editable({
type: 'text',
mode: 'inline',
emptytext: 'default',
url: '/admin/subfleets/{!! $subfleet->id !!}/fares',
title: 'Enter override value',
ajaxOptions: { 'type': 'put'},
params: function(params) {
return {
fare_id: params.pk,
name: params.name,
value: params.value
}
}
});
$(document).on('submit', 'form.rm_fare', function(event) {
event.preventDefault();
$.pjax.submit(event, '#aircraft_fares_wrapper', {push: false});
});
});
</script>
@endsection

View File

@ -31,30 +31,4 @@
</div> </div>
</div> </div>
@endsection @endsection
@section('scripts') @include('admin.subfleets.script')
<script>
$(document).ready(function() {
$(".ac-fare-dropdown").select2();
$('#aircraft_fares a').editable({
type: 'text',
mode: 'inline',
emptytext: 'default',
url: '/admin/subfleets/{!! $subfleet->id !!}/fares',
title: 'Enter override value',
ajaxOptions: { 'type': 'put'},
params: function(params) {
return {
fare_id: params.pk,
name: params.name,
value: params.value
}
}
});
$(document).on('submit', 'form.rm_fare', function(event) {
event.preventDefault();
$.pjax.submit(event, '#aircraft_fares_wrapper', {push: false});
});
});
</script>
@endsection