firstcommit
This commit is contained in:
23
resources/js/backend/sweetAlertDelete.js
Normal file
23
resources/js/backend/sweetAlertDelete.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
document.querySelectorAll('.deleteBtn').forEach(function (button) {
|
||||
button.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var formId = e.target.closest('form').id;
|
||||
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: 'You won\'t be able to revert this!',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
document.getElementById(formId).submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user