Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SL-835 add link to O3 patient chart in ward app patient workspace #7

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { useActivePatientEnrollment } from '../hooks/useProgramEnrollment';
import O2IFrame from './o2-iframe.component';
import styles from './o2-pregnancy-infant-dashboard.scss';

/**
* Extension to display either the O2 pregnancy program or infant program dashboard,
Expand Down Expand Up @@ -48,17 +49,36 @@ const O2PregnancyInfantProgramDashboard: React.FC<{ patientUuid: string }> = ({
'.infant\\.dashboard\\.indicator a',
];

const o2PatientChartLink = (
<div className={styles.patientChartLinkContainer}>
<a href={`${window.openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}`}>
{t('fullPatientChart', 'Full patient chart')}
</a>
</div>
);

if (isLoading) {
return <InlineLoading />;
} else if (inInfantProgram) {
const src = `${window.openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&dashboard=${infantProgramUuid}`;
return <O2IFrame key={patientUuid} {...{ src, elementsToDisable, elementsToHide }} />;
return (
<>
{o2PatientChartLink}
<O2IFrame key={patientUuid} {...{ src, elementsToDisable, elementsToHide }} />
</>
);
} else if (inPregnancyProgram) {
const src = `${window.openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&dashboard=${pregnancyProgramUuid}`;
return <O2IFrame key={patientUuid} {...{ src, elementsToDisable, elementsToHide }} />;
return (
<>
{o2PatientChartLink}
<O2IFrame key={patientUuid} {...{ src, elementsToDisable, elementsToHide }} />
</>
);
} else {
return (
<div>
{o2PatientChartLink}
{t(
'patientNotEnrolledInInfantOrPregnancyProgram',
'Patient not enrolled in either Infant or Pregnancy Program',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use '@carbon/layout';

.patientChartLinkContainer {
padding: layout.$spacing-05;
}
1 change: 1 addition & 0 deletions packages/esm-commons-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"back": "Back",
"fullPatientChart": "Full patient chart",
"patientHasNoActiveVisit": "Patient has no active visit",
"patientNotEnrolledInInfantOrPregnancyProgram": "Patient not enrolled in either Infant or Pregnancy Program",
"patientVisitSummary": "Patient visit summary",
Expand Down
Loading