Add the acars and manual payrates in the rank/subfleet forms

This commit is contained in:
Nabeel Shahzad
2018-02-26 19:14:10 -06:00
parent f6ec647eb6
commit cdd5fc749c
11 changed files with 95 additions and 20 deletions

View File

@@ -14,7 +14,8 @@
<div class="header">
<h3>subfleets</h3>
@component('admin.components.info')
These are the subfleets this rank is allowed to use
These are the subfleets this rank is allowed to use. The pay can be
set as a fixed amount, or a percentage of the rank's base payrate above
@endcomponent
</div>
<div class="row">

View File

@@ -15,4 +15,3 @@
</div>
</div>
@endsection
@include('admin.ranks.scripts')

View File

@@ -1,7 +1,26 @@
@section('scripts')
<script>
function setEditable() {
$('#subfleets-table a').editable({
type: 'text',
mode: 'inline',
emptytext: 'inherited',
url: '{!! url('/admin/ranks/'.$rank->id.'/subfleets') !!}',
title: 'Enter override value',
ajaxOptions: {'type': 'put'},
params: function (params) {
return {
subfleet_id: params.pk,
name: params.name,
value: params.value
}
}
});
}
$(document).ready(function () {
$(".select2").select2();
setEditable();
$(document).on('submit', 'form.pjax_form', function (event) {
event.preventDefault();
@@ -10,6 +29,7 @@ $(document).ready(function () {
$(document).on('pjax:complete', function () {
$(".select2").select2();
setEditable();
});
});
</script>

View File

@@ -3,15 +3,24 @@
<thead>
<th>Airline</th>
<th>Name</th>
<th>Type</th>
<th style="text-align: center;">ACARS Pay</th>
<th style="text-align: center;">Manual Pay</th>
<th style="text-align: center;">Actions</th>
</thead>
<tbody>
@foreach($rank->subfleets as $sf)
<tr>
<td>{!! $sf->airline->name !!}</td>
<td>{!! $sf->name !!}</td>
<td>{!! $sf->type !!}</td>
<td>{!! $sf->name !!} ({!! $sf->type !!})</td>
<td style="text-align: center;">
<a href="#" data-pk="{!! $sf->id !!}"
data-name="acars_pay">{!! $sf->pivot->acars_pay !!}</a>
</td>
<td style="text-align: center;">
<a href="#" data-pk="{!! $sf->id !!}"
data-name="manual_pay">{!! $sf->pivot->manual_pay !!}</a>
</td>
<td style="width: 10%; text-align: center;" class="form-inline">
{!! Form::open(['url' => '/admin/ranks/'.$rank->id.'/subfleets', 'method' => 'delete', 'class' => 'pjax_form']) !!}
{!! Form::hidden('subfleet_id', $sf->id) !!}