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',
|
|
|
|
emptytext: 'default',
|
|
|
|
url: '/admin/subfleets/{!! $subfleet->id !!}/fares',
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
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
|
|
|
|
|
|
|
$(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
|