Skip to content

Commit ea07ed4

Browse files
authored
U4X-740: Adding an edit feature to the current regimen on the care panel (#261)
U4X-740: Adding an edit feature to the current regimen on the care panel (#261)
1 parent 65853ad commit ea07ed4

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

packages/esm-care-panel-app/src/program-enrollment/program-enrollment-hiv.component.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ProgramData } from '../types/index';
88
import { usePatient } from '@openmrs/esm-framework';
99
import { configSchema } from '../config-schema';
1010
import { ProgramEnrollmentProps } from '../hooks/useCarePrograms';
11+
import RegimenButton from '../regimen-editor/regimen-button.component';
1112

1213
const ProgramEnrollment: React.FC<ProgramEnrollmentProps> = ({ enrollments = [], patientUuid }) => {
1314
const { t } = useTranslation();
@@ -134,6 +135,9 @@ const ProgramEnrollment: React.FC<ProgramEnrollmentProps> = ({ enrollments = [],
134135
<p className={styles.label}>{t('currentRegimen', 'Current Regimen')}</p>
135136

136137
<span className={styles.value}>{programData.currentRegimen}</span>
138+
<span>
139+
<RegimenButton />
140+
</span>
137141
</div>
138142
<div className={styles.content}>
139143
<p className={styles.label}>{t('whoStage', 'WHO Stage')}</p>

packages/esm-care-panel-app/src/program-summary/program-summary.component.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
7979
? data?.HIV?.lastEncDetails?.regimenShortDisplay
8080
: t('neverOnArvRegimen', 'Never on ARVs')}
8181
<span>
82-
<RegimenButton
82+
{/* <RegimenButton
8383
patientUuid={patientUuid}
8484
category={programName}
8585
onRegimen={
@@ -88,7 +88,7 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
8888
: ''
8989
}
9090
lastRegimenEncounter={regimenEncounter}
91-
/>
91+
/> */}
9292
</span>
9393
</p>
9494
</div>
@@ -147,12 +147,6 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
147147
? data?.TB?.lastTbEncounter?.regimenShortDisplay
148148
: t('neverOnTbRegimen', 'Never on TB regimen')}
149149
</span>
150-
<RegimenButton
151-
patientUuid={patientUuid}
152-
category={programName}
153-
onRegimen={data?.TB?.lastTbEncounter ? data?.TB?.lastTbEncounter?.regimenShortDisplay : ''}
154-
lastRegimenEncounter={regimenEncounter}
155-
/>
156150
</p>
157151
</div>
158152
<div className={styles.content}>

packages/esm-care-panel-app/src/regimen-editor/regimen-button.component.tsx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
11
import React from 'react';
2-
import { Link } from '@carbon/react';
3-
42
import { useTranslation } from 'react-i18next';
5-
import { RegimenType } from '../types';
6-
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
3+
import { launchPatientWorkspace, useLaunchWorkspaceRequiringVisit } from '@openmrs/esm-patient-common-lib';
4+
import { Link } from '@carbon/react';
75
import styles from './standard-regimen.scss';
86

9-
interface RegimenButtonProps {
10-
patientUuid: string;
11-
category: string;
12-
onRegimen: string;
13-
lastRegimenEncounter: {
14-
uuid: string;
15-
startDate: string;
16-
endDate: string;
17-
event: string;
7+
const RegimenButton: React.FC = () => {
8+
const { t } = useTranslation();
9+
const launchFormsWorkspace = useLaunchWorkspaceRequiringVisit('patient-form-entry-workspace');
10+
11+
const launchPatientWorkspaceCb = () => {
12+
launchFormsWorkspace();
1813
};
19-
}
2014

21-
const RegimenButton: React.FC<RegimenButtonProps> = ({ category, patientUuid, onRegimen, lastRegimenEncounter }) => {
22-
const { t } = useTranslation();
2315
return (
24-
<Link
25-
className={styles.linkName}
26-
onClick={() =>
27-
launchPatientWorkspace('patient-regimen-workspace', {
28-
category: RegimenType[category],
29-
patientUuid: patientUuid,
30-
onRegimen: onRegimen,
31-
lastRegimenEncounter: lastRegimenEncounter,
32-
})
33-
}
34-
>
35-
{t('editRegimen', 'Edit')}
36-
</Link>
16+
<>
17+
<Link
18+
className={styles.linkName}
19+
onClick={() =>
20+
launchPatientWorkspace('patient-form-entry-workspace', {
21+
formInfo: {
22+
formUuid: '53a3850c-855a-11eb-8dcd-0242ac130003',
23+
},
24+
workspaceTitle: 'Clinical Form',
25+
})
26+
}
27+
>
28+
{t('editRegimen', 'Change Regimen')}
29+
</Link>
30+
</>
3731
);
3832
};
3933

packages/esm-ugandaemr-app/src/dashboard.meta.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// Patient Chart
32
export const clinicalViewsDividerMeta = {
43
name: 'clinical-views-divider',

0 commit comments

Comments
 (0)