From be2c78914f28ef3957ce4f1219cf075a8ad69ce6 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Fri, 14 Aug 2026 00:07:12 +0530 Subject: [PATCH] Keep ABHA modals open when patient already linked --- app/Views/partials/abha_mobile_modal.php | 6 ++++++ app/Views/partials/abha_qr_modal.php | 6 ++++++ app/Views/partials/abha_verify_modal.php | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/app/Views/partials/abha_mobile_modal.php b/app/Views/partials/abha_mobile_modal.php index d637e7c..d33e643 100644 --- a/app/Views/partials/abha_mobile_modal.php +++ b/app/Views/partials/abha_mobile_modal.php @@ -255,6 +255,12 @@ window.AbhaMobileModal = (function () { $('#abhaMobileCompareBtn').on('click', function () { if (!verifiedProfile) return; var profile = verifiedProfile; + // Already linked: nothing else opens, so keep this window up for the operator to close. + if (profile.need_confirmation === false && Number(profile.patient_id || 0) > 0) { + alertBox('success', 'This ABHA is already linked to HMS patient ' + escapeHtml(profile.p_code || '') + '. The page behind has been updated. Close this window when you are done.'); + if (typeof onVerified === 'function') onVerified(profile); + return; + } $('#abhaMobileModal').one('hidden.bs.modal', function () { if (typeof onVerified === 'function') onVerified(profile); }); diff --git a/app/Views/partials/abha_qr_modal.php b/app/Views/partials/abha_qr_modal.php index 7d5c0fe..7f173e0 100644 --- a/app/Views/partials/abha_qr_modal.php +++ b/app/Views/partials/abha_qr_modal.php @@ -172,6 +172,12 @@ window.AbhaQrModal = (function () { $('#abhaQrContinueBtn').on('click', function () { if (!scannedProfile) return; var profile = scannedProfile; + // Already linked: nothing else opens, so keep this window up for the operator to close. + if (profile.need_confirmation === false && Number(profile.patient_id || 0) > 0) { + alertBox('success', 'This ABHA is already linked to HMS patient ' + escapeHtml(profile.p_code || '') + '. The page behind has been updated. Close this window when you are done.'); + if (typeof onResolved === 'function') onResolved(profile); + return; + } $('#abhaQrModal').one('hidden.bs.modal', function () { if (typeof onResolved === 'function') onResolved(profile); }); diff --git a/app/Views/partials/abha_verify_modal.php b/app/Views/partials/abha_verify_modal.php index 3f24c34..929dcb5 100644 --- a/app/Views/partials/abha_verify_modal.php +++ b/app/Views/partials/abha_verify_modal.php @@ -262,6 +262,12 @@ window.AbhaVerifyModal = (function () { $('#abhaVerifyCompareBtn').on('click', function () { if (!verifiedProfile) return; var profile = verifiedProfile; + // Already linked: nothing else opens, so keep this window up for the operator to close. + if (profile.need_confirmation === false && Number(profile.patient_id || 0) > 0) { + alertBox('success', 'This ABHA is already linked to HMS patient ' + escapeHtml(profile.p_code || '') + '. The page behind has been updated. Close this window when you are done.'); + if (typeof onVerified === 'function') onVerified(profile); + return; + } $('#abhaVerifyModal').one('hidden.bs.modal', function () { if (typeof onVerified === 'function') onVerified(profile); });