2023-12-15 09:20:16 +00:00
|
|
|
// Initialize KTMenu
|
|
|
|
KTMenu.init();
|
|
|
|
|
|
|
|
// Add click event listener to delete buttons
|
|
|
|
document.querySelectorAll('[data-kt-action="delete_row"]').forEach(function (element) {
|
|
|
|
element.addEventListener('click', function () {
|
|
|
|
Swal.fire({
|
|
|
|
text: 'Are you sure you want to remove?',
|
|
|
|
icon: 'warning',
|
|
|
|
buttonsStyling: false,
|
|
|
|
showCancelButton: true,
|
2023-12-19 01:50:12 +00:00
|
|
|
confirmButtonText: 'Yes, delete it!',
|
|
|
|
cancelButtonText: 'Cancel',
|
2023-12-15 09:20:16 +00:00
|
|
|
customClass: {
|
2023-12-19 01:50:12 +00:00
|
|
|
confirmButton: 'btn btn-primary',
|
|
|
|
cancelButton: 'btn btn-danger',
|
2023-12-15 09:20:16 +00:00
|
|
|
}
|
|
|
|
}).then((result) => {
|
|
|
|
if (result.isConfirmed) {
|
|
|
|
Livewire.dispatch('delete', { id : this.getAttribute('data-kt-id') });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add click event listener to update buttons
|
|
|
|
document.querySelectorAll('[data-kt-action="update_row"]').forEach(function (element) {
|
|
|
|
element.addEventListener('click', function () {
|
|
|
|
Livewire.dispatch('update', { id : this.getAttribute('data-kt-id') });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Listen for 'success' event emitted by Livewire
|
|
|
|
Livewire.on('success', (message) => {
|
|
|
|
// Reload the users-table datatable
|
|
|
|
LaravelDataTables['detail_pembayaran-table'].ajax.reload();
|
|
|
|
});
|