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

U4X-740: Adding an edit feature to the current regimen on the care panel #261

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 @@ -8,6 +8,7 @@ import { ProgramData } from '../types/index';
import { usePatient } from '@openmrs/esm-framework';
import { configSchema } from '../config-schema';
import { ProgramEnrollmentProps } from '../hooks/useCarePrograms';
import RegimenButton from '../regimen-editor/regimen-button.component';

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

<span className={styles.value}>{programData.currentRegimen}</span>
<span>
<RegimenButton />
</span>
</div>
<div className={styles.content}>
<p className={styles.label}>{t('whoStage', 'WHO Stage')}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
? data?.HIV?.lastEncDetails?.regimenShortDisplay
: t('neverOnArvRegimen', 'Never on ARVs')}
<span>
<RegimenButton
{/* <RegimenButton
patientUuid={patientUuid}
category={programName}
onRegimen={
Expand All @@ -88,7 +88,7 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
: ''
}
lastRegimenEncounter={regimenEncounter}
/>
/> */}
</span>
</p>
</div>
Expand Down Expand Up @@ -147,12 +147,6 @@ const ProgramSummary: React.FC<ProgramSummaryProps> = ({ patientUuid, programNam
? data?.TB?.lastTbEncounter?.regimenShortDisplay
: t('neverOnTbRegimen', 'Never on TB regimen')}
</span>
<RegimenButton
patientUuid={patientUuid}
category={programName}
onRegimen={data?.TB?.lastTbEncounter ? data?.TB?.lastTbEncounter?.regimenShortDisplay : ''}
lastRegimenEncounter={regimenEncounter}
/>
</p>
</div>
<div className={styles.content}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
import React from 'react';
import { Link } from '@carbon/react';

import { useTranslation } from 'react-i18next';
import { RegimenType } from '../types';
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
import { launchPatientWorkspace, useLaunchWorkspaceRequiringVisit } from '@openmrs/esm-patient-common-lib';
import { Link } from '@carbon/react';
import styles from './standard-regimen.scss';

interface RegimenButtonProps {
patientUuid: string;
category: string;
onRegimen: string;
lastRegimenEncounter: {
uuid: string;
startDate: string;
endDate: string;
event: string;
const RegimenButton: React.FC = () => {
const { t } = useTranslation();
const launchFormsWorkspace = useLaunchWorkspaceRequiringVisit('patient-form-entry-workspace');

const launchPatientWorkspaceCb = () => {
launchFormsWorkspace();
};
}

const RegimenButton: React.FC<RegimenButtonProps> = ({ category, patientUuid, onRegimen, lastRegimenEncounter }) => {
const { t } = useTranslation();
return (
<Link
className={styles.linkName}
onClick={() =>
launchPatientWorkspace('patient-regimen-workspace', {
category: RegimenType[category],
patientUuid: patientUuid,
onRegimen: onRegimen,
lastRegimenEncounter: lastRegimenEncounter,
})
}
>
{t('editRegimen', 'Edit')}
</Link>
<>
<Link
className={styles.linkName}
onClick={() =>
launchPatientWorkspace('patient-form-entry-workspace', {
formInfo: {
formUuid: '53a3850c-855a-11eb-8dcd-0242ac130003',
},
workspaceTitle: 'Clinical Form',
})
}
>
{t('editRegimen', 'Change Regimen')}
</Link>
</>
);
};

Expand Down
1 change: 0 additions & 1 deletion packages/esm-ugandaemr-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Patient Chart
export const clinicalViewsDividerMeta = {
name: 'clinical-views-divider',
Expand Down
Loading