murph-skeleton/assets/js/admin/modules/batch.js

24 lines
496 B
JavaScript
Raw Normal View History

2021-06-03 13:51:43 +02:00
const $ = require('jquery')
module.exports = () => {
2021-06-15 14:16:07 +02:00
$('th.crud-batch-column input').change((e) => {
$('td.crud-batch-column input').prop('checked', $(e.target).is(':checked'))
})
2021-06-03 13:51:43 +02:00
2021-06-15 14:16:07 +02:00
const form = $('#form-batch')
2021-06-03 13:51:43 +02:00
2021-06-15 14:16:07 +02:00
form.submit((e) => {
e.preventDefault()
2021-06-03 13:51:43 +02:00
2021-06-15 14:16:07 +02:00
const route = form.attr('action')
const datas = form.serialize()
2021-06-03 13:51:43 +02:00
2021-06-15 14:16:07 +02:00
form.addClass('is-loading')
2021-06-03 13:51:43 +02:00
2021-06-15 14:16:07 +02:00
$.post(route, datas)
.always(() => {
document.location.href = document.location.href
})
})
2021-06-03 13:51:43 +02:00
}