33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import Swal from "sweetalert2";
|
|
import trans from "../../modules/trans";
|
|
const datasDelete = document.querySelectorAll("#dataDelete");
|
|
|
|
if (datasDelete) {
|
|
datasDelete.forEach((dataDelete) => {
|
|
dataDelete.addEventListener("submit", (e) => {
|
|
const self = e.target as HTMLFormElement;
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
title: trans.methods.__("Supprimer cette information ?"),
|
|
text: trans.methods.__("Attention cette action est irréversible, cette information sera complètement retiré des bases"),
|
|
color: getComputedStyle(document.body).getPropertyValue("--bs-body-color"),
|
|
icon: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonText:trans.methods.__("Je comprends le danger et suis conscient de ce que je fait"),
|
|
cancelButtonText: trans.methods.__("Annuler"),
|
|
reverseButtons: true,
|
|
// * Bootstrap Styling
|
|
customClass: {
|
|
confirmButton: "btn btn-primary mx-1",
|
|
cancelButton: "btn btn-danger mx-1",
|
|
},
|
|
buttonsStyling: false,
|
|
background: getComputedStyle(document.body).getPropertyValue("--bs-body-bg"),
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
self?.submit();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|