2017-07-03 04:11:27 +08:00
|
|
|
@section('scripts')
|
|
|
|
<script>
|
2017-12-31 04:25:50 +08:00
|
|
|
function setEditable() {
|
2017-07-03 04:11:27 +08:00
|
|
|
$('#aircraft_fares a').editable({
|
|
|
|
type: 'text',
|
|
|
|
mode: 'inline',
|
2018-02-27 09:14:10 +08:00
|
|
|
emptytext: 'inherited',
|
2018-03-13 06:58:12 +08:00
|
|
|
url: '{{ url('/admin/subfleets/'.$subfleet->id.'/fares') }}',
|
2017-07-03 04:11:27 +08:00
|
|
|
title: 'Enter override value',
|
2017-12-31 04:25:50 +08:00
|
|
|
ajaxOptions: {'type': 'put'},
|
|
|
|
params: function (params) {
|
2017-07-03 04:11:27 +08:00
|
|
|
return {
|
|
|
|
fare_id: params.pk,
|
|
|
|
name: params.name,
|
|
|
|
value: params.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2018-02-27 09:14:10 +08:00
|
|
|
|
|
|
|
$('#subfleet_ranks a').editable({
|
|
|
|
type: 'text',
|
|
|
|
mode: 'inline',
|
|
|
|
emptytext: 'inherited',
|
2018-03-13 06:58:12 +08:00
|
|
|
url: '{{ url('/admin/subfleets/'.$subfleet->id.'/ranks') }}',
|
2018-02-27 09:14:10 +08:00
|
|
|
title: 'Enter override value',
|
|
|
|
ajaxOptions: {'type': 'put'},
|
|
|
|
params: function (params) {
|
|
|
|
return {
|
|
|
|
rank_id: params.pk,
|
|
|
|
name: params.name,
|
|
|
|
value: params.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2018-03-06 02:21:38 +08:00
|
|
|
|
2018-03-06 11:24:49 +08:00
|
|
|
$('#subfleet-expenses a.text').editable({
|
|
|
|
emptytext: '0',
|
2018-03-13 06:58:12 +08:00
|
|
|
url: '{{ url('/admin/subfleets/'.$subfleet->id.'/expenses') }}',
|
2018-03-06 11:24:49 +08:00
|
|
|
title: 'Enter override value',
|
|
|
|
ajaxOptions: {'type': 'put'},
|
|
|
|
params: function (params) {
|
|
|
|
return {
|
|
|
|
expense_id: params.pk,
|
|
|
|
name: params.name,
|
|
|
|
value: params.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#subfleet-expenses a.dropdown').editable({
|
|
|
|
type: 'select',
|
2018-03-06 02:21:38 +08:00
|
|
|
emptytext: '0',
|
2018-03-13 06:58:12 +08:00
|
|
|
source: {{ json_encode(list_to_editable(\App\Models\Enums\ExpenseType::select())) }},
|
|
|
|
url: '{{ url('/admin/subfleets/'.$subfleet->id.'/expenses') }}',
|
2018-03-06 02:21:38 +08:00
|
|
|
title: 'Enter override value',
|
|
|
|
ajaxOptions: {'type': 'put'},
|
|
|
|
params: function (params) {
|
2018-03-06 11:24:49 +08:00
|
|
|
console.log(params);
|
2018-03-06 02:21:38 +08:00
|
|
|
return {
|
|
|
|
expense_id: params.pk,
|
|
|
|
name: params.name,
|
|
|
|
value: params.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2017-12-31 04:25:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
setEditable();
|
2017-07-03 04:11:27 +08:00
|
|
|
|
|
|
|
$(document).on('submit', 'form.rm_fare', function(event) {
|
|
|
|
event.preventDefault();
|
2017-12-31 03:39:56 +08:00
|
|
|
console.log(event);
|
2017-07-03 04:11:27 +08:00
|
|
|
$.pjax.submit(event, '#aircraft_fares_wrapper', {push: false});
|
2017-12-31 04:25:50 +08:00
|
|
|
setEditable();
|
2017-07-03 04:11:27 +08:00
|
|
|
});
|
2017-11-23 01:52:02 +08:00
|
|
|
|
2018-02-21 11:53:50 +08:00
|
|
|
$(document).on('submit', 'form.modify_rank', function (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
console.log(event);
|
|
|
|
$.pjax.submit(event, '#subfleet_ranks_wrapper', {push: false});
|
|
|
|
});
|
|
|
|
|
2018-03-06 02:21:38 +08:00
|
|
|
$(document).on('submit', 'form.modify_expense', function (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
console.log(event);
|
|
|
|
$.pjax.submit(event, '#subfleet-expenses-wrapper', {push: false});
|
|
|
|
});
|
|
|
|
|
2017-11-23 01:52:02 +08:00
|
|
|
$(document).on('pjax:complete', function() {
|
|
|
|
$(".select2").select2();
|
2017-12-31 04:25:50 +08:00
|
|
|
setEditable();
|
2017-11-23 01:52:02 +08:00
|
|
|
});
|
2017-07-03 04:11:27 +08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endsection
|