Simplify ABDM request flow for users
This commit is contained in:
parent
a15f5a0785
commit
49969cb9be
|
|
@ -324,8 +324,7 @@ if ($patientPhotoPath === '') {
|
|||
</div>
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="btnLoadAbdmDocs">Refresh Fetched Data</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnAutoAbdmFlow" <?= ($abhaIsVerified && $patientAbhaAddress !== '') ? '' : 'disabled' ?>>Start ABDM Sync</button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" id="btnNewAbdmConsent" <?= ($abhaIsVerified && $patientAbhaAddress !== '') ? '' : 'disabled' ?> style="display:none;">New Consent Request</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnAutoAbdmFlow" <?= ($abhaIsVerified && $patientAbhaAddress !== '') ? '' : 'disabled' ?>>Fetch Request</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -449,14 +448,7 @@ $(function() {
|
|||
}
|
||||
|
||||
function applyConsentButtonState() {
|
||||
var $newBtn = $('#btnNewAbdmConsent');
|
||||
var canUse = autoFlowNeedsFreshRequest;
|
||||
$newBtn.toggle(canUse);
|
||||
if (canUse) {
|
||||
$('#btnAutoAbdmFlow').text('Retry Sync');
|
||||
} else {
|
||||
$('#btnAutoAbdmFlow').text('Start ABDM Sync');
|
||||
}
|
||||
$('#btnAutoAbdmFlow').text(autoFlowTimer ? 'Fetching...' : 'Fetch Request');
|
||||
}
|
||||
|
||||
var zoom = 1;
|
||||
|
|
@ -765,15 +757,14 @@ $(function() {
|
|||
$('#abdmStatusBox').removeClass('text-danger').addClass('text-muted').text(info + (autoFlowRequestId ? (' | Request ID: ' + autoFlowRequestId) : ''));
|
||||
|
||||
if (resetRequestId) {
|
||||
autoFlowNeedsFreshRequest = true;
|
||||
autoFlowRequestId = '';
|
||||
stopAutoFlowLoop();
|
||||
$('#btnAutoAbdmFlow').prop('disabled', false);
|
||||
updateConsentBadge('FAILED', true);
|
||||
applyConsentButtonState();
|
||||
$('#abdmStatusBox').removeClass('text-danger').addClass('text-muted').text(
|
||||
'Previous consent request is stale/failed. Click "New Consent Request" to start a fresh request.'
|
||||
);
|
||||
updateConsentBadge('FAILED', false);
|
||||
$('#abdmStatusBox').removeClass('text-danger').addClass('text-muted').text('Previous consent request is stale/failed. HMS is starting a fresh request automatically.');
|
||||
if (autoFlowAttempts < autoFlowMaxAttempts) {
|
||||
autoFlowAttempts += 1;
|
||||
autoFlowTimer = setTimeout(runAutoFlowStep, 1200);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -784,7 +775,7 @@ $(function() {
|
|||
return;
|
||||
}
|
||||
|
||||
$('#btnAutoAbdmFlow').prop('disabled', false).text('One-Click Sync');
|
||||
$('#btnAutoAbdmFlow').prop('disabled', false);
|
||||
applyConsentButtonState();
|
||||
if (phase === 'COMPLETED') {
|
||||
loadAbdmDocs();
|
||||
|
|
@ -854,16 +845,6 @@ $(function() {
|
|||
runAutoFlowStep();
|
||||
});
|
||||
|
||||
$(document).off('click.abdmOpd', '#btnNewAbdmConsent').on('click.abdmOpd', '#btnNewAbdmConsent', function() {
|
||||
autoFlowNeedsFreshRequest = false;
|
||||
autoFlowRequestId = '';
|
||||
autoFlowAttempts = 0;
|
||||
stopAutoFlowLoop();
|
||||
updateConsentBadge('IDLE', false);
|
||||
applyConsentButtonState();
|
||||
$('#abdmStatusBox').removeClass('text-danger').addClass('text-muted').text('Fresh consent request context prepared. Click "Start ABDM Sync".');
|
||||
});
|
||||
|
||||
$(document).off('shown.bs.tab.abdmOpd', '[data-bs-target="#opd-abdm-tab"]').on('shown.bs.tab.abdmOpd', '[data-bs-target="#opd-abdm-tab"]', function() {
|
||||
if (!currentAbdmRows.length) {
|
||||
loadAbdmDocs();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ $canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
|||
tabindex="0"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="Completed: data fetched. Granted: approved. Pending: waiting patient action. Failed: previous request failed. Failed - New Required: click New Consent Request."
|
||||
title="Completed: data fetched. Granted: approved. Pending: waiting patient action. Failed: previous request failed. The system will restart automatically when needed."
|
||||
aria-label="Consent status help"
|
||||
>?</span>
|
||||
</div>
|
||||
|
|
@ -63,7 +63,6 @@ $canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
|||
<div class="d-flex gap-2 flex-wrap">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary" id="btnAyushmanLoadAbdmDocs" <?= $patientId > 0 ? '' : 'disabled' ?>>Load Fetched Data</button>
|
||||
<button type="button" class="btn btn-sm btn-success" id="btnAyushmanFetchAbdmM3" <?= $canUseM3 ? '' : 'disabled' ?>>Fetch From ABDM M3</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger" id="btnAyushmanNewConsent" <?= $canUseM3 ? '' : 'disabled' ?> style="display:none;">New Consent Request</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="load_form('<?= site_url('AbdmHiu') ?>','ABDM HIU M3')">Open M3 Console</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -185,8 +184,7 @@ $canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
|||
}
|
||||
|
||||
function applyConsentButtons() {
|
||||
$('#btnAyushmanNewConsent').toggle(needsFreshRequest);
|
||||
$('#btnAyushmanFetchAbdmM3').text(needsFreshRequest ? 'Retry ABDM M3 Sync' : 'Fetch From ABDM M3');
|
||||
$('#btnAyushmanFetchAbdmM3').text(pollTimer ? 'Fetching...' : 'Fetch From ABDM M3');
|
||||
}
|
||||
|
||||
function esc(value) {
|
||||
|
|
@ -346,13 +344,15 @@ $canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
|||
updateConsentBadge(phase, needsFreshRequest);
|
||||
|
||||
if (resetRequestId) {
|
||||
needsFreshRequest = true;
|
||||
currentRequestId = '';
|
||||
updateConsentBadge('FAILED', false);
|
||||
setStatus('Previous consent request is stale/failed. HMS is starting a fresh request automatically.', false);
|
||||
if (pollAttempts < maxPollAttempts) {
|
||||
pollAttempts += 1;
|
||||
pollTimer = setTimeout(runM3AutoFlow, 1200);
|
||||
return;
|
||||
}
|
||||
stopPolling();
|
||||
$('#btnAyushmanFetchAbdmM3').prop('disabled', false);
|
||||
updateConsentBadge('FAILED', true);
|
||||
applyConsentButtons();
|
||||
setStatus('Previous consent request is stale/failed. Click "New Consent Request" and run sync again.', false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -402,16 +402,6 @@ $canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
|||
runM3AutoFlow();
|
||||
});
|
||||
|
||||
$(document).off('click.ayushmanAbdm', '#btnAyushmanNewConsent').on('click.ayushmanAbdm', '#btnAyushmanNewConsent', function () {
|
||||
needsFreshRequest = false;
|
||||
currentRequestId = '';
|
||||
pollAttempts = 0;
|
||||
stopPolling();
|
||||
updateConsentBadge('IDLE', false);
|
||||
applyConsentButtons();
|
||||
setStatus('Fresh consent request context prepared. Click "Fetch From ABDM M3" to create a new request.', false);
|
||||
});
|
||||
|
||||
$('[data-bs-toggle="tooltip"]').tooltip();
|
||||
|
||||
applyConsentButtons();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user