2018-01-04 05:27:56 +08:00
|
|
|
@section('scripts')
|
2020-02-02 02:05:56 +08:00
|
|
|
<script>
|
|
|
|
function setEditable() {
|
2018-03-10 00:24:22 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
const token = $('meta[name="csrf-token"]').attr('content');
|
|
|
|
const api_key = $('meta[name="api-key"]').attr('content');
|
2018-04-23 23:36:11 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
@if(isset($rank))
|
|
|
|
$('#subfleets-table a').editable({
|
2018-02-27 09:14:10 +08:00
|
|
|
type: 'text',
|
|
|
|
mode: 'inline',
|
|
|
|
emptytext: 'inherited',
|
2018-03-13 06:58:12 +08:00
|
|
|
url: '{{ url('/admin/ranks/'.$rank->id.'/subfleets') }}',
|
2018-02-27 09:14:10 +08:00
|
|
|
title: 'Enter override value',
|
2018-04-23 23:36:11 +08:00
|
|
|
ajaxOptions: {
|
2020-02-02 02:05:56 +08:00
|
|
|
type: 'put',
|
|
|
|
headers: {
|
|
|
|
'x-api-key': api_key,
|
|
|
|
'X-CSRF-TOKEN': token,
|
|
|
|
}
|
2018-04-23 23:36:11 +08:00
|
|
|
},
|
2018-02-27 09:14:10 +08:00
|
|
|
params: function (params) {
|
2020-02-02 02:05:56 +08:00
|
|
|
return {
|
|
|
|
subfleet_id: params.pk,
|
|
|
|
name: params.name,
|
|
|
|
value: params.value
|
|
|
|
}
|
2018-02-27 09:14:10 +08:00
|
|
|
}
|
2020-02-02 02:05:56 +08:00
|
|
|
});
|
|
|
|
@endif
|
|
|
|
}
|
2018-02-27 09:14:10 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$(document).ready(function () {
|
2018-02-27 09:14:10 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
setEditable();
|
2018-01-04 05:27:56 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$(document).on('submit', 'form.pjax_form', function (event) {
|
2018-01-04 05:27:56 +08:00
|
|
|
event.preventDefault();
|
|
|
|
$.pjax.submit(event, '#rank_subfleet_wrapper', {push: false});
|
2020-02-02 02:05:56 +08:00
|
|
|
});
|
2018-01-04 05:27:56 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$(document).on('pjax:complete', function () {
|
2018-04-07 06:10:45 +08:00
|
|
|
initPlugins();
|
2018-02-27 09:14:10 +08:00
|
|
|
setEditable();
|
2020-02-02 02:05:56 +08:00
|
|
|
});
|
2018-01-04 05:27:56 +08:00
|
|
|
});
|
2020-02-02 02:05:56 +08:00
|
|
|
</script>
|
2018-01-04 05:27:56 +08:00
|
|
|
@endsection
|