diff --git a/app/Views/abdm/opd_queue.php b/app/Views/abdm/opd_queue.php index 9a2f837..a1025e1 100644 --- a/app/Views/abdm/opd_queue.php +++ b/app/Views/abdm/opd_queue.php @@ -226,6 +226,37 @@ const el = document.getElementById('abdmOpdRegisterModal'); return !!(el && el.classList.contains('show')); } + function cleanupBootstrapModalState() { + document.querySelectorAll('.modal.show').forEach(modalEl => { + const instance = bootstrap.Modal.getInstance(modalEl); + if (instance) instance.hide(); + modalEl.classList.remove('show'); + modalEl.setAttribute('aria-hidden', 'true'); + modalEl.removeAttribute('aria-modal'); + modalEl.removeAttribute('role'); + modalEl.style.display = 'none'; + }); + document.querySelectorAll('.modal-backdrop').forEach(backdrop => backdrop.remove()); + document.body.classList.remove('modal-open'); + document.body.style.removeProperty('padding-right'); + } + function closeProcessModal(onClosed) { + const modalEl = document.getElementById('abdmQueueModalProcess'); + if (!modalEl || !modalEl.classList.contains('show')) { + if (typeof onClosed === 'function') onClosed(); + return; + } + const cleanup = function () { + cleanupBootstrapModalState(); + }; + const finish = function () { + modalEl.removeEventListener('hidden.bs.modal', finish); + cleanup(); + if (typeof onClosed === 'function') onClosed(); + }; + modalEl.addEventListener('hidden.bs.modal', finish); + bootstrap.Modal.getOrCreateInstance(modalEl).hide(); + } function executeInjectedScripts(containerId) { const container = document.getElementById(containerId); if (!container) { @@ -754,8 +785,8 @@ ${r.saved_data ? `