diff --git a/app/Views/abdm/task_board.php b/app/Views/abdm/task_board.php index 11dae00..d84089b 100644 --- a/app/Views/abdm/task_board.php +++ b/app/Views/abdm/task_board.php @@ -321,9 +321,20 @@
{}
+ No structured clinical data found in bundle.
'; + } + function fhirCodeQuality(bundle) { var entries = (bundle && bundle.entry) ? bundle.entry : []; var complaints = [], diagnoses = [], services = [], obs = [], meds = []; @@ -1004,10 +1176,14 @@ } function openFhirModal(url, title) { - if (fhirModalTitle) fhirModalTitle.textContent = title || 'FHIR Preview'; - if (fhirModalMeta) { fhirModalMeta.textContent = 'Loading...'; fhirModalMeta.className = 'px-3 py-2 small text-muted'; } - if (fhirModalQuality) { fhirModalQuality.innerHTML = ''; fhirModalQuality.style.display = 'none'; } - if (fhirModalJson) fhirModalJson.textContent = '{\n "loading": true\n}'; + if (fhirModalTitle) fhirModalTitle.textContent = title || 'FHIR Preview'; + if (fhirModalMeta) { fhirModalMeta.textContent = 'Loading...'; fhirModalMeta.className = 'flex-grow-1 small text-muted'; } + if (fhirModalQuality) { fhirModalQuality.innerHTML = ''; fhirModalQuality.style.display = 'none'; } + if (fhirFormView) fhirFormView.innerHTML = 'Loading...
'; + if (fhirModalJson) fhirModalJson.textContent = '{\n "loading": true\n}'; + // Reset to Form View tab + fhirTabForm.classList.add('active'); fhirTabJson.classList.remove('active'); + fhirFormView.style.display = ''; fhirModalJson.style.display = 'none'; if (fhirModalDataBadge) { fhirModalDataBadge.className = 'badge bg-warning text-dark'; fhirModalDataBadge.textContent = 'CHECKING'; } if (fhirModalHttpBadge) { fhirModalHttpBadge.className = 'badge bg-warning text-dark'; fhirModalHttpBadge.textContent = 'HTTP ...'; } fhirPreviewModal.show(); @@ -1019,8 +1195,9 @@ try { parsed = JSON.parse(res.body || '{}'); } catch (e) { parsed = { raw: res.body || '' }; } var bundle = (parsed && parsed.resourceType === 'Bundle') ? parsed : ((parsed && parsed.bundle) ? parsed.bundle : null); var hasFhir = bundle !== null; - if (fhirModalJson) fhirModalJson.textContent = JSON.stringify(parsed, null, 2); - if (fhirModalMeta) { fhirModalMeta.textContent = res.ok ? 'Loaded (' + res.status + ')' : 'Error (' + res.status + ')'; fhirModalMeta.className = 'px-3 py-2 small ' + (res.ok ? 'text-success' : 'text-danger'); } + if (fhirModalJson) fhirModalJson.textContent = JSON.stringify(parsed, null, 2); + if (fhirFormView) fhirFormView.innerHTML = hasFhir ? renderFhirBundleForm(bundle) : 'No FHIR bundle generated yet.
'; + if (fhirModalMeta) { fhirModalMeta.textContent = res.ok ? 'Loaded (' + res.status + ')' : 'Error (' + res.status + ')'; fhirModalMeta.className = 'flex-grow-1 small ' + (res.ok ? 'text-success' : 'text-danger'); } if (fhirModalDataBadge) { fhirModalDataBadge.className = 'badge ' + (hasFhir ? 'bg-success' : 'bg-danger'); fhirModalDataBadge.textContent = hasFhir ? 'HAS FHIR' : 'NOT GENERATED'; } if (fhirModalHttpBadge) { fhirModalHttpBadge.className = 'badge ' + (res.ok ? 'bg-success' : 'bg-danger'); fhirModalHttpBadge.textContent = 'HTTP ' + res.status; } if (fhirModalQuality && hasFhir) { @@ -1029,7 +1206,8 @@ } }) .catch(function (e) { - if (fhirModalMeta) { fhirModalMeta.textContent = 'Request failed: ' + e.message; fhirModalMeta.className = 'px-3 py-2 small text-danger'; } + if (fhirFormView) fhirFormView.innerHTML = 'Request failed: ' + hesc(e.message) + '
'; + if (fhirModalMeta) { fhirModalMeta.textContent = 'Request failed: ' + e.message; fhirModalMeta.className = 'flex-grow-1 small text-danger'; } if (fhirModalDataBadge) { fhirModalDataBadge.className = 'badge bg-danger'; fhirModalDataBadge.textContent = 'ERROR'; } if (fhirModalHttpBadge) { fhirModalHttpBadge.className = 'badge bg-danger'; fhirModalHttpBadge.textContent = 'HTTP ERR'; } });