diff --git a/.gitignore b/.gitignore index a33f3da..db391e3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ Thumbs.db # Dependencies (if any in future) node_modules/ vendor/ +!plugins/vendor/ # Uploads foto/ diff --git a/home/admin.php b/home/admin.php index fb725c5..da6bf24 100644 --- a/home/admin.php +++ b/home/admin.php @@ -304,52 +304,105 @@ - \ No newline at end of file diff --git a/home/kaur.php b/home/kaur.php index fb725c5..f9e5b29 100644 --- a/home/kaur.php +++ b/home/kaur.php @@ -304,52 +304,77 @@ - \ No newline at end of file diff --git a/index.php b/index.php index f0af36c..6fd02a5 100644 --- a/index.php +++ b/index.php @@ -35,7 +35,7 @@ - + @@ -44,9 +44,9 @@ - + - + @@ -483,7 +483,7 @@ ?>
Logout @@ -724,16 +724,18 @@ + + - + - + - + @@ -799,32 +801,47 @@ $('#imageModal').modal('show'); } - 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?', - 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 confirmLogout(element, event) { + try { + console.log('Logout function called for element:', element); + + // Always prevent default behavior + if (event) { + event.preventDefault(); + event.stopPropagation(); } + + // Prevent multiple clicks + if (element.getAttribute('data-logging-out') === 'true') { + console.log('Already logging out, ignoring'); + return false; + } + + // Mark as logging out + element.setAttribute('data-logging-out', 'true'); + + var logoutUrl = element.href; + console.log('Logout URL:', logoutUrl); + + // Debug SweetAlert2 availability + console.log('Swal exists:', typeof Swal, 'Swal.fire:', Swal && Swal.fire); + + // Use simple confirm for now to ensure it works + if (confirm('Apakah Anda yakin akan keluar dari sistem?')) { + console.log('User confirmed logout, redirecting...'); + window.location.href = logoutUrl; + } else { + console.log('User cancelled logout'); + element.removeAttribute('data-logging-out'); + } + + } catch (error) { + console.error('Logout error:', error); + // As last resort, go directly to logout + window.location.href = element.href; } + + return false; } function zoomIn() { @@ -882,10 +899,39 @@ (delta > 0) ? zoomIn() : zoomOut(); } } + + // Handle logout link clicks + $(document).ready(function() { + console.log('Document ready, attaching logout handler'); + $(document).on('click', '.logout-link', function(event) { + console.log('Logout link clicked'); + event.preventDefault(); + event.stopPropagation(); + + var element = this; + var logoutUrl = element.href; + + // Prevent multiple clicks + if ($(element).attr('data-logging-out') === 'true') { + console.log('Already logging out'); + return false; + } + $(element).attr('data-logging-out', 'true'); + + // Show confirmation + if (confirm('Apakah Anda yakin akan keluar dari sistem?')) { + console.log('User confirmed logout'); + window.location.href = logoutUrl; + } else { + console.log('User cancelled logout'); + $(element).removeAttr('data-logging-out'); + } + + return false; + }); + }); - -