Skip to content

Commit

Permalink
(feat) O3-4077: Ward patient card should launch the workspace group (#…
Browse files Browse the repository at this point in the history
…1398)

* Clicking on the ward patient card should launch workspace group

* Bump the framework version

---------

Co-authored-by: Usama Idriss Kakumba <[email protected]>
  • Loading branch information
vasharma05 and usamaidrsk authored Dec 16, 2024
1 parent 6c607b6 commit 89c73be
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 119 deletions.
17 changes: 12 additions & 5 deletions packages/esm-ward-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
"type": "ward-patient-notes",
"title": "inpatientNotesWorkspaceTitle",
"sidebarFamily": "ward-patient",
"hasOwnSidebar": true
"hasOwnSidebar": true,
"groups": ["ward-patient"]

},
{
"name": "admit-patient-form-workspace",
Expand All @@ -99,15 +101,18 @@
"title": "Ward patient",
"width": "extra-wide",
"hasOwnSidebar": true,
"sidebarFamily": "ward-patient"
"sidebarFamily": "ward-patient",
"groups": ["ward-patient"]
},
{
"name": "patient-transfer-swap-workspace",
"component": "patientTransferAndSwapWorkspace",
"title": "transfers",
"type": "transfer-swap-bed-form",
"hasOwnSidebar": true,
"sidebarFamily": "ward-patient"
"sidebarFamily": "ward-patient",
"groups": ["ward-patient"]

},
{
"name": "patient-transfer-request-workspace",
Expand All @@ -121,7 +126,8 @@
"title": "discharge",
"type": "ward-patient-discharge",
"hasOwnSidebar": true,
"sidebarFamily": "ward-patient"
"sidebarFamily": "ward-patient",
"groups": ["ward-patient"]
},
{
"name": "ward-patient-clinical-forms-workspace",
Expand All @@ -130,7 +136,8 @@
"type": "ward-patient-clinical-forms",
"hasOwnSidebar": true,
"sidebarFamily": "ward-patient",
"width": "wider"
"width": "wider",
"groups": ["ward-patient"]
},
{
"name": "cancel-admission-request-workspace",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getPatientName, launchWorkspace, useAppContext } from '@openmrs/esm-framework';
import { getPatientName, useAppContext, launchWorkspaceGroup } from '@openmrs/esm-framework';
import React, { type ReactNode } from 'react';
import { type WardViewContext, type WardPatient,type PatientWorkspaceAdditionalProps } from '../types';
import { type WardViewContext, type WardPatient } from '../types';
import styles from './ward-patient-card.scss';
import { getPatientChartStore } from '@openmrs/esm-patient-common-lib';

interface Props {
children: ReactNode;
Expand All @@ -18,11 +19,28 @@ const WardPatientCard: React.FC<Props> = ({ children, wardPatient }) => {
<button
className={styles.wardPatientCardButton}
onClick={() => {
launchWorkspace<PatientWorkspaceAdditionalProps>('ward-patient-workspace', {
wardPatient,
WardPatientHeader
launchWorkspaceGroup('ward-patient', {
state: {
wardPatient,
WardPatientHeader,
},
onWorkspaceGroupLaunch: () => {
const store = getPatientChartStore();
store.setState({
patientUuid: patient.uuid,
});
},
workspaceToLaunch: {
name: 'ward-patient-workspace',
},
workspaceGroupCleanup: () => {
const store = getPatientChartStore();
store.setState({
patientUuid: undefined,
});
},
});
}}>
}}>
{/* Name will not be displayed; just there for a11y */}
{getPatientName(patient.person)}
</button>
Expand Down
Loading

0 comments on commit 89c73be

Please sign in to comment.