Add SweetAlert2 availability check and fallback to standard confirm dialog for logout

This commit is contained in:
2026-01-22 16:17:14 +08:00
parent 8269494306
commit 3b10745f49

View File

@@ -802,6 +802,9 @@
function confirmLogout(event) {
event.preventDefault();
var logoutUrl = event.currentTarget.href;
// Check if SweetAlert2 is available
if (typeof Swal !== 'undefined' && Swal.fire) {
Swal.fire({
title: 'Konfirmasi Logout',
text: 'Apakah Anda yakin akan keluar dari sistem?',
@@ -816,6 +819,12 @@
window.location.href = logoutUrl;
}
});
} else {
// Fallback to standard confirm dialog
if (confirm('Apakah Anda yakin akan keluar dari sistem?')) {
window.location.href = logoutUrl;
}
}
}
function zoomIn() {