diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ec5e7ee..1df18ee 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -767,7 +767,7 @@ $routes->post('AbdmGateway/share_ipd_discharge_bundle', 'AbdmGateway::shareIpdDi $routes->post('AbdmGateway/share_diagnosis_report_bundle', 'AbdmGateway::shareDiagnosisReportBundle', ['filter' => $abdmPermFilter]); $routes->post('AbdmGateway/shareDiagnosisReportBundle', 'AbdmGateway::shareDiagnosisReportBundle', ['filter' => $abdmPermFilter]); $routes->get('AbdmGateway/diagnosis_report_fhir_preview', 'AbdmGateway::diagnosisReportFhirPreview', ['filter' => $abdmPermFilter]); -$routes->get('AbdmGateway/ipd_discharge_fhir_preview', 'AbdmGateway::ipdDischargeFhirPreview', ['filter' => $abdmPermFilter]); +$routes->match(['GET', 'POST'], 'AbdmGateway/ipd_discharge_fhir_preview', 'AbdmGateway::ipdDischargeFhirPreview', ['filter' => $abdmPermFilter]); $routes->get('AbdmGateway/immunization_fhir_preview', 'AbdmGateway::immunizationFhirPreview', ['filter' => $abdmPermFilter]); $routes->post('AbdmGateway/share_immunization_bundle', 'AbdmGateway::shareImmunizationBundle', ['filter' => $abdmPermFilter]); $routes->post('AbdmGateway/share_wellness_bundle', 'AbdmGateway::shareWellnessBundle', ['filter' => $abdmPermFilter]); diff --git a/app/Views/abdm/task_board.php b/app/Views/abdm/task_board.php index 0674361..2163c5f 100644 --- a/app/Views/abdm/task_board.php +++ b/app/Views/abdm/task_board.php @@ -2700,7 +2700,16 @@ _fhirLiveComplaints = Array.isArray(parsed.live_complaints) ? parsed.live_complaints : []; _fhirLiveDiagnoses = Array.isArray(parsed.live_diagnoses) ? parsed.live_diagnoses : []; if (fhirModalJson) fhirModalJson.textContent = JSON.stringify(parsed, null, 2); - if (fhirFormView) fhirFormView.innerHTML = hasFhir ? renderFhirBundleForm(bundle, _fhirLiveComplaints, _fhirLiveDiagnoses) : '

No FHIR bundle generated yet.

'; + if (fhirFormView) { + if (hasFhir) { + fhirFormView.innerHTML = renderFhirBundleForm(bundle, _fhirLiveComplaints, _fhirLiveDiagnoses); + } else if (!res.ok) { + var errMsg = (parsed && (parsed.message || parsed.error || parsed.error_text)) ? (parsed.message || parsed.error || parsed.error_text) : (parsed && parsed.raw ? parsed.raw : ('HTTP ' + res.status + ' error.')); + fhirFormView.innerHTML = '
Error (' + res.status + '): ' + hesc(errMsg) + '
'; + } else { + fhirFormView.innerHTML = '

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; }