
<!-- /.content-wrapper -->
  <footer class="main-footer">
    <span>Copyright &copy; <script>document.write(new Date().getFullYear());</script> <strong>andrian doni</strong>.</span>
    <div class="float-right d-none d-sm-inline-block" style="color:var(--text-muted);">v2.0</div>
  </footer>

  <aside class="control-sidebar control-sidebar-dark"></aside>
</div><!-- ./wrapper -->

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
<script>$.widget.bridge('uibutton', $.ui.button)</script>
<!-- Bootstrap 4 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- overlayScrollbars -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/overlayscrollbars/1.13.3/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App (for modal widgets) -->
<script src="https://cdn.jsdelivr.net/npm/adminlte@3.2/dist/js/adminlte.min.js"></script>
<!-- SweetAlert2 -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

<script type="text/javascript">
$(document).ready(function(){
  $(document).on('show.bs.modal', function() {
    document.documentElement.classList.add('modal-active');
  });
  $(document).on('hidden.bs.modal', function() {
    if (!$('.modal.show').length) {
      document.documentElement.classList.remove('modal-active');
    }
  });

  // Global SweetAlert Toast
  const Toast = Swal.mixin({
    toast: true,
    position: 'top-end',
    showConfirmButton: false,
    timer: 3000,
    timerProgressBar: true,
    background: 'var(--surface)',
    color: 'var(--text-main)',
    didOpen: (toast) => {
      toast.addEventListener('mouseenter', Swal.stopTimer)
      toast.addEventListener('mouseleave', Swal.resumeTimer)
    }
  });

  const urlParams = new URLSearchParams(window.location.search);
  const msg = urlParams.get('msg');
  if (msg) {
    if (msg === 'login_success') {
      Toast.fire({ icon: 'success', title: 'Berhasil masuk ke sistem' });
    } else if (msg === 'tambah_sukses') {
      Toast.fire({ icon: 'success', title: 'Data berhasil ditambahkan' });
    } else if (msg === 'edit_sukses') {
      Toast.fire({ icon: 'success', title: 'Data berhasil diperbarui' });
    } else if (msg === 'hapus_sukses') {
      Toast.fire({ icon: 'success', title: 'Data berhasil dihapus' });
    } else if (msg === 'gagal') {
      Toast.fire({ icon: 'error', title: 'Operasi gagal, periksa kembali data Anda' });
    } else if (msg === 'pembayaran_sukses') {
      Toast.fire({ icon: 'success', title: 'Pembayaran berhasil disimpan' });
    }
    
    // clean url
    window.history.replaceState(null, null, window.location.pathname + "?m=" + urlParams.get('m') + (urlParams.get('s') ? "&s=" + urlParams.get('s') : ""));
  }

});
</script>
</body>
</html>


