Writeoff/Resources/views/pencatatan/detail_jaminan/_draw-scripts.js

47 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-12-15 06:41:12 +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 06:41:12 +00:00
customClass: {
2023-12-19 01:50:12 +00:00
confirmButton: 'btn btn-primary',
cancelButton: 'btn btn-danger',
2023-12-15 06:41:12 +00:00
}
}).then((result) => {
if (result.isConfirmed) {
2023-12-19 11:00:24 +00:00
Swal.fire({
text: 'Data Berhasil Di Hapus, Menunggu Approval',
icon: 'success',
buttonsStyling: false,
confirmButtonText: 'Ok, got it!',
customClass: {
confirmButton: 'btn btn-primary',
}
})
//Livewire.dispatch('delete', { id : this.getAttribute('data-kt-id') });
2023-12-15 06:41:12 +00:00
}
});
});
});
// 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_jaminan-table'].ajax.reload();
});