// 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, confirmButtonText: 'Yes, delete it!', cancelButtonText: 'Cancel', customClass: { confirmButton: 'btn btn-primary', cancelButton: 'btn btn-danger', } }).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') }); }); });