Add SweetAlert2 availability check and fallback to standard confirm dialog for logout
This commit is contained in:
33
index.php
33
index.php
@@ -802,20 +802,29 @@
|
||||
function confirmLogout(event) {
|
||||
event.preventDefault();
|
||||
var logoutUrl = event.currentTarget.href;
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Logout',
|
||||
text: 'Apakah Anda yakin akan keluar dari sistem?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Keluar',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
// Check if SweetAlert2 is available
|
||||
if (typeof Swal !== 'undefined' && Swal.fire) {
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Logout',
|
||||
text: 'Apakah Anda yakin akan keluar dari sistem?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Keluar',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user