@openmrs/esm-ward-app 9.2.1-pre.7244 → 9.2.1-pre.7261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/dist/1741.js +1 -1
  3. package/dist/1741.js.map +1 -1
  4. package/dist/1987.js +1 -0
  5. package/dist/1987.js.map +1 -0
  6. package/dist/2216.js +1 -0
  7. package/dist/2216.js.map +1 -0
  8. package/dist/2728.js +1 -1
  9. package/dist/2728.js.map +1 -1
  10. package/dist/283.js +1 -1
  11. package/dist/283.js.map +1 -1
  12. package/dist/2948.js +1 -1
  13. package/dist/2948.js.map +1 -1
  14. package/dist/3365.js +1 -1
  15. package/dist/3365.js.map +1 -1
  16. package/dist/3413.js +1 -1
  17. package/dist/3413.js.map +1 -1
  18. package/dist/3673.js +1 -0
  19. package/dist/3673.js.map +1 -0
  20. package/dist/3982.js +1 -1
  21. package/dist/3982.js.map +1 -1
  22. package/dist/4189.js +1 -0
  23. package/dist/4189.js.map +1 -0
  24. package/dist/4300.js +1 -1
  25. package/dist/5603.js +1 -0
  26. package/dist/5603.js.map +1 -0
  27. package/dist/581.js +1 -1
  28. package/dist/581.js.map +1 -1
  29. package/dist/7179.js +1 -1
  30. package/dist/7179.js.map +1 -1
  31. package/dist/7512.js +1 -1
  32. package/dist/7512.js.map +1 -1
  33. package/dist/7661.js +1 -1
  34. package/dist/7661.js.map +1 -1
  35. package/dist/8501.js +1 -1
  36. package/dist/8501.js.map +1 -1
  37. package/dist/8522.js +1 -1
  38. package/dist/8522.js.map +1 -1
  39. package/dist/8610.js +1 -1
  40. package/dist/8610.js.map +1 -1
  41. package/dist/89.js +2 -1
  42. package/dist/89.js.map +1 -1
  43. package/dist/9117.js +1 -1
  44. package/dist/9117.js.map +1 -1
  45. package/dist/917.js +1 -0
  46. package/dist/917.js.map +1 -0
  47. package/dist/9756.js +1 -0
  48. package/dist/9756.js.map +1 -0
  49. package/dist/main.js +1 -1
  50. package/dist/main.js.map +1 -1
  51. package/dist/openmrs-esm-ward-app.js +1 -1
  52. package/dist/openmrs-esm-ward-app.js.buildmanifest.json +226 -177
  53. package/dist/openmrs-esm-ward-app.js.map +1 -1
  54. package/dist/routes.json +1 -1
  55. package/package.json +1 -1
  56. package/src/action-menu-buttons/clinical-forms-workspace-siderail.component.tsx +16 -24
  57. package/src/action-menu-buttons/discharge-workspace-siderail.component.tsx +6 -6
  58. package/src/action-menu-buttons/order-basket-action-button.component.tsx +31 -0
  59. package/src/action-menu-buttons/transfer-workspace-siderail.component.tsx +7 -18
  60. package/src/hooks/useEmrConfiguration.ts +19 -19
  61. package/src/index.ts +14 -16
  62. package/src/routes.json +127 -80
  63. package/src/types/index.ts +7 -3
  64. package/src/ward-patient-card/row-elements/ward-patient-pending-transfer.component.tsx +9 -4
  65. package/src/ward-patient-card/ward-patient-card.component.tsx +3 -11
  66. package/src/ward-view-header/admission-requests-bar.component.tsx +10 -6
  67. package/src/ward-view-header/admission-requests-bar.test.tsx +3 -3
  68. package/src/ward-workspace/admission-request-card/admission-request-card-actions.component.tsx +8 -6
  69. package/src/ward-workspace/admission-request-workspace/admission-requests-action-button.extension.tsx +6 -7
  70. package/src/ward-workspace/admission-request-workspace/admission-requests-empty-state.component.tsx +16 -29
  71. package/src/ward-workspace/admission-request-workspace/admission-requests-workspace.test.tsx +23 -8
  72. package/src/ward-workspace/admission-request-workspace/admission-requests.workspace.tsx +28 -28
  73. package/src/ward-workspace/admit-patient-button.component.tsx +3 -2
  74. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.test.tsx +17 -16
  75. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.workspace.tsx +72 -69
  76. package/src/ward-workspace/cancel-admission-request-workspace/cancel-admission-request.component.tsx +176 -0
  77. package/src/ward-workspace/cancel-admission-request-workspace/cancel-admission-request.test.tsx +11 -9
  78. package/src/ward-workspace/cancel-admission-request-workspace/cancel-admission-request.workspace.tsx +17 -167
  79. package/src/ward-workspace/cancel-admission-request-workspace/ward-patient-cancel-admission-request.workspace.tsx +16 -0
  80. package/src/ward-workspace/create-admission-encounter/create-admission-encounter-action-button.extension.tsx +23 -34
  81. package/src/ward-workspace/create-admission-encounter/create-admission-encounter.test.tsx +9 -4
  82. package/src/ward-workspace/create-admission-encounter/create-admission-encounter.workspace.tsx +39 -19
  83. package/src/ward-workspace/patient-details/ward-patient-action-button.component.tsx +17 -0
  84. package/src/ward-workspace/patient-details/ward-patient.workspace.tsx +27 -7
  85. package/src/ward-workspace/patient-discharge/patient-discharge.workspace.tsx +46 -40
  86. package/src/ward-workspace/patient-transfer-bed-swap/patient-admit-or-transfer-request-form.component.tsx +21 -13
  87. package/src/ward-workspace/patient-transfer-bed-swap/patient-bed-swap-form.component.tsx +10 -14
  88. package/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-swap.workspace.tsx +42 -24
  89. package/src/ward-workspace/patient-transfer-request-workspace/patient-transfer-request.workspace.tsx +22 -8
  90. package/src/ward-workspace/ward-patient-notes/notes-action-button.component.tsx +17 -0
  91. package/src/ward-workspace/ward-patient-notes/{form/notes-form.scss → notes.scss} +0 -1
  92. package/src/ward-workspace/ward-patient-notes/notes.test.tsx +134 -0
  93. package/src/ward-workspace/ward-patient-notes/notes.workspace.tsx +174 -13
  94. package/translations/en.json +3 -1
  95. package/dist/1663.js +0 -1
  96. package/dist/1663.js.map +0 -1
  97. package/dist/2557.js +0 -1
  98. package/dist/2557.js.map +0 -1
  99. package/dist/7232.js +0 -2
  100. package/dist/7232.js.map +0 -1
  101. package/dist/7886.js +0 -1
  102. package/dist/7886.js.map +0 -1
  103. package/dist/9045.js +0 -1
  104. package/dist/9045.js.map +0 -1
  105. package/src/ward-workspace/admission-request-workspace/admission-requests-context.ts +0 -20
  106. package/src/ward-workspace/patient-clinical-forms-workspace/patient-clinical-forms.workspace.tsx +0 -29
  107. package/src/ward-workspace/patient-details/ward-patient-action-button.extension.tsx +0 -18
  108. package/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx +0 -186
  109. package/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx +0 -116
  110. package/src/ward-workspace/ward-patient-notes/notes-action-button.extension.tsx +0 -18
  111. /package/dist/{7232.js.LICENSE.txt → 89.js.LICENSE.txt} +0 -0
package/src/routes.json CHANGED
@@ -40,41 +40,16 @@
40
40
  "name": "ward-patient-action-button",
41
41
  "slot": "action-menu-ward-patient-items-slot"
42
42
  },
43
- {
44
- "component": "wardPatientNotesActionButtonExtension",
45
- "name": "ward-inpatient-notes-form-action-button",
46
- "slot": "action-menu-ward-patient-items-slot"
47
- },
48
43
  {
49
44
  "component": "coloredObsTagCardRowExtension",
50
45
  "name": "colored-obs-tags-card-row",
51
46
  "slot": "ward-patient-card-slot"
52
47
  },
53
- {
54
- "name": "transfer-swap-patient-siderail-button",
55
- "slot": "action-menu-ward-patient-items-slot",
56
- "component": "patientTransferAndSwapWorkspaceSiderailIcon"
57
- },
58
48
  {
59
49
  "name": "patient-discharge-siderail-button",
60
50
  "slot": "action-menu-ward-patient-items-slot",
61
51
  "component": "patientDischargeWorkspaceSideRailIcon"
62
52
  },
63
- {
64
- "name": "clinical-forms-workspace-siderail-button",
65
- "component": "clinicalFormWorkspaceSideRailIcon",
66
- "slot": "action-menu-ward-patient-items-slot"
67
- },
68
- {
69
- "name": "admission-requests-workspace-siderail-button",
70
- "component": "admissionRequestsWorkspaceSideRailIcon",
71
- "slot": "action-menu-ward-patient-admission-requests-items-slot"
72
- },
73
- {
74
- "name": "create-admission-request-workspace-siderail-button",
75
- "component": "createAdmissionEncounterWorkspaceSideRailIcon",
76
- "slot": "action-menu-ward-patient-admission-requests-items-slot"
77
- },
78
53
  {
79
54
  "component": "defaultWardView",
80
55
  "name": "default-ward",
@@ -91,93 +66,165 @@
91
66
  "slot": "ward-workspace-patient-banner-slot"
92
67
  }
93
68
  ],
94
- "workspaces": [
69
+ "workspaces2": [
95
70
  {
96
71
  "name": "admission-requests-workspace",
97
72
  "component": "admissionRequestWorkspace",
98
- "title": "admissionRequests",
99
- "type": "pending-admission-requests",
100
- "width": "wider"
101
- },{
102
- "name": "create-admission-encounter-workspace",
103
- "component": "createAdmissionEncounterWorkspace",
104
- "title": "admitPatient",
105
- "type": "patient-search-workspace",
106
- "width": "wider"
73
+ "window": "pending-admissions"
107
74
  },
108
75
  {
109
- "name": "ward-patient-notes-workspace",
110
- "component": "wardPatientNotesWorkspace",
111
- "type": "ward-patient-notes",
112
- "title": "inpatientNotesWorkspaceTitle"
113
-
76
+ "name": "transfer-elsewhere-workspace",
77
+ "component": "patientTransferRequestWorkspace",
78
+ "window": "pending-admissions"
79
+ },
80
+ {
81
+ "name": "cancel-admission-request-workspace",
82
+ "component": "cancelAdmissionRequestWorkspace",
83
+ "window": "pending-admissions"
114
84
  },
115
85
  {
116
86
  "name": "admit-patient-form-workspace",
117
87
  "component": "admitPatientFormWorkspace",
118
- "title": "admissionRequests",
119
- "type": "admission-requests"
88
+ "window": "pending-admissions"
89
+ },
90
+
91
+ {
92
+ "name": "ward-app-patient-search-workspace",
93
+ "component": "@openmrs/esm-patient-search-app#patientSearchWorkspace2",
94
+ "window": "add-patient-to-ward"
95
+ },
96
+ {
97
+ "name": "ward-app-start-visit-workspace",
98
+ "component": "@openmrs/esm-patient-chart-app#exportedVisitForm",
99
+ "window": "add-patient-to-ward"
120
100
  },
101
+ {
102
+ "name": "create-admission-encounter-workspace",
103
+ "component": "createAdmissionEncounterWorkspace",
104
+ "window": "add-patient-to-ward"
105
+ },
106
+
107
+
121
108
  {
122
109
  "name": "ward-patient-workspace",
123
110
  "component": "wardPatientWorkspace",
124
- "type": "ward",
125
- "title": "Ward patient",
126
- "width": "extra-wide"
111
+ "window": "ward-patient"
127
112
  },
128
113
  {
129
- "name": "patient-transfer-swap-workspace",
130
- "component": "patientTransferAndSwapWorkspace",
131
- "title": "transfers",
132
- "type": "transfer-swap-bed-form"
114
+ "name": "ward-patient-vitals-workspace",
115
+ "component": "@openmrs/esm-patient-vitals-app#exportedVitalsBiometricsFormWorkspace",
116
+ "window": "ward-patient"
117
+ },
118
+
119
+ {
120
+ "name": "ward-patient-notes-workspace",
121
+ "component": "wardPatientNotesWorkspace",
122
+ "window": "ward-patient-notes"
133
123
 
134
124
  },
135
125
  {
136
- "name": "patient-transfer-request-workspace",
137
- "component": "patientTransferRequestWorkspace",
138
- "title": "transferRequest",
139
- "type": "transfer-request-form"
126
+ "name": "ward-patient-transfer-swap-workspace",
127
+ "component": "patientTransferAndSwapWorkspace",
128
+ "window": "ward-patient-transfer-swap"
140
129
  },
141
130
  {
142
131
  "name": "patient-discharge-workspace",
143
132
  "component": "patientDischargeWorkspace",
144
- "title": "discharge",
145
- "type": "ward-patient-discharge"
133
+ "window": "ward-patient-discharge"
146
134
  },
147
135
  {
148
136
  "name": "ward-patient-clinical-forms-workspace",
149
- "component": "patientClinicalFormsWorkspace",
150
- "title": "clinicalForms",
151
- "type": "ward-patient-clinical-forms",
137
+ "component": "@openmrs/esm-patient-forms-app#exportedClinicalFormsWorkspace",
138
+ "window": "ward-patient-clinical-forms"
139
+ },
140
+ {
141
+ "name": "ward-patient-form-entry-workspace",
142
+ "component": "@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace",
143
+ "window": "ward-patient-clinical-forms"
144
+ },
145
+ {
146
+ "name": "ward-patient-cancel-admission-request-workspace",
147
+ "component": "wardPatientCancelAdmissionRequestWorkspace",
148
+ "window": "ward-patient-cancel-admission-request"
149
+ },
150
+ {
151
+ "name": "ward-patient-order-basket-workspace",
152
+ "component": "@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace",
153
+ "window": "ward-patient-order-basket"
154
+ },
155
+ {
156
+ "name": "ward-patient-order-basket-add-drug-order-workspace",
157
+ "component": "@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace",
158
+ "window": "ward-patient-order-basket"
159
+ },
160
+ {
161
+ "name": "ward-patient-order-basket-add-lab-order-workspace",
162
+ "component": "@openmrs/esm-patient-tests-app#exportedAddLabOrderWorkspace",
163
+ "window": "ward-patient-order-basket"
164
+ },
165
+ {
166
+ "name": "ward-patient-order-basket-add-general-order-workspace",
167
+ "component": "@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace",
168
+ "window": "ward-patient-order-basket"
169
+ }
170
+ ],
171
+ "workspaceWindows2": [
172
+ {
173
+ "name": "pending-admissions",
174
+ "group": "ward-manage-admissions",
175
+ "icon": "admissionRequestsWorkspaceSideRailIcon",
152
176
  "width": "wider"
153
177
  },
154
178
  {
155
- "name": "cancel-admission-request-workspace",
156
- "component": "cancelAdmissionRequestWorkspace",
157
- "title": "cancelAdmissionRequest",
158
- "type": "cancel-admission-request"
179
+ "name": "add-patient-to-ward",
180
+ "group": "ward-manage-admissions",
181
+ "icon": "createAdmissionEncounterWorkspaceSideRailIcon"
182
+ },
183
+
184
+ {
185
+ "name": "ward-patient",
186
+ "group": "ward-patient",
187
+ "icon": "wardPatientActionButton",
188
+ "width": "wider"
189
+ },
190
+ {
191
+ "name": "ward-patient-notes",
192
+ "group": "ward-patient",
193
+ "icon": "wardPatientNotesActionButton"
194
+ },
195
+ {
196
+ "name": "ward-patient-transfer-swap",
197
+ "group": "ward-patient",
198
+ "icon": "patientTransferAndSwapWorkspaceSiderailIcon"
199
+ },
200
+ {
201
+ "name": "ward-patient-discharge",
202
+ "group": "ward-patient",
203
+ "icon": "patientDischargeWorkspaceSideRailIcon"
204
+ },
205
+ {
206
+ "name": "ward-patient-clinical-forms",
207
+ "group": "ward-patient",
208
+ "icon": "clinicalFormWorkspaceSideRailIcon"
209
+ },
210
+ {
211
+ "name": "ward-patient-order-basket",
212
+ "group": "ward-patient",
213
+ "icon": "orderBasketWorkspaceSideRailIcon"
214
+ },
215
+ {
216
+ "name": "ward-patient-cancel-admission-request",
217
+ "group": "ward-patient"
159
218
  }
160
219
  ],
161
- "workspaceGroups": [
220
+ "workspaceGroups2": [
221
+ {
222
+ "name": "ward-manage-admissions",
223
+ "overlay": true
224
+ },
162
225
  {
163
226
  "name": "ward-patient",
164
- "members": [
165
- "ward-patient-workspace",
166
- "ward-patient-notes-workspace",
167
- "patient-transfer-swap-workspace",
168
- "patient-discharge-workspace",
169
- "ward-patient-clinical-forms-workspace",
170
- "add-drug-order",
171
- "order-basket",
172
- "add-lab-order"
173
- ]
174
- },
175
- {
176
- "name": "ward-patient-admission-requests",
177
- "members": [
178
- "admission-requests-workspace",
179
- "create-admission-encounter-workspace"
180
- ]
227
+ "overlay": true
181
228
  }
182
229
  ]
183
230
  }
@@ -7,6 +7,7 @@ import type {
7
7
  Patient,
8
8
  Person,
9
9
  Visit,
10
+ Workspace2DefinitionProps,
10
11
  } from '@openmrs/esm-framework';
11
12
  import type React from 'react';
12
13
  import type { useWardPatientGrouping } from '../hooks/useWardPatientGrouping';
@@ -50,7 +51,7 @@ export type WardPatient = {
50
51
  inpatientRequest: InpatientRequest;
51
52
  };
52
53
 
53
- export interface WardPatientWorkspaceProps extends DefaultWorkspaceProps {
54
+ export interface WardPatientWorkspaceProps {
54
55
  wardPatient: WardPatient;
55
56
 
56
57
  /**
@@ -60,6 +61,11 @@ export interface WardPatientWorkspaceProps extends DefaultWorkspaceProps {
60
61
  relatedTransferPatients?: WardPatient[];
61
62
  }
62
63
 
64
+ /**
65
+ * props type of workspaces in the 'ward-patient` workspace group.
66
+ */
67
+ export type WardPatientWorkspaceDefinition = Workspace2DefinitionProps<{}, {}, { wardPatient: WardPatient }>;
68
+
63
69
  // server-side types defined in openmrs-module-bedmanagement:
64
70
 
65
71
  // note "AdmissionLocationResponse" isn't the clearest name, but it matches the endpoint; endpoint fetches bed information (including info about patients in those beds) for a location (as provided by the bed management module)
@@ -271,5 +277,3 @@ export interface MaternalWardViewContext {
271
277
  [key: number]: unknown;
272
278
  [key: symbol]: unknown;
273
279
  }
274
-
275
- export type PatientWorkspaceAdditionalProps = Omit<WardPatientWorkspaceProps, keyof DefaultWorkspaceProps>;
@@ -1,6 +1,6 @@
1
1
  import { IconButton } from '@carbon/react';
2
2
  import { Movement } from '@carbon/react/icons';
3
- import { CloseOutlineIcon, launchWorkspace } from '@openmrs/esm-framework';
3
+ import { CloseOutlineIcon, launchWorkspace, launchWorkspace2 } from '@openmrs/esm-framework';
4
4
  import React, { useMemo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { type WardPatient, type WardPatientWorkspaceProps } from '../../types';
@@ -28,9 +28,14 @@ const WardPatientPendingTransfer: React.FC<WardPatientTransferProps> = ({ wardPa
28
28
  }, [dispositionType, dispositionLocation, t]);
29
29
 
30
30
  const launchCancelAdmissionForm = () => {
31
- launchWorkspace<WardPatientWorkspaceProps>('cancel-admission-request-workspace', {
32
- wardPatient,
33
- });
31
+ launchWorkspace2(
32
+ 'ward-patient-cancel-admission-request-workspace',
33
+ {},
34
+ {},
35
+ {
36
+ wardPatient,
37
+ },
38
+ );
34
39
  };
35
40
 
36
41
  if (!(dispositionType === 'TRANSFER' || dispositionType === 'DISCHARGE')) return null;
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import { getPatientName, launchWorkspaceGroup } from '@openmrs/esm-framework';
2
+ import { getPatientName, launchWorkspace2 } from '@openmrs/esm-framework';
3
3
  import { type WardPatient } from '../types';
4
4
  import styles from './ward-patient-card.scss';
5
5
 
@@ -23,16 +23,8 @@ const WardPatientCard: React.FC<Props> = ({ children, wardPatient, relatedTransf
23
23
  <button
24
24
  className={styles.wardPatientCardButton}
25
25
  onClick={() => {
26
- launchWorkspaceGroup('ward-patient', {
27
- state: {
28
- wardPatient,
29
- patient,
30
- patientUuid: patient.uuid,
31
- relatedTransferPatients,
32
- },
33
- workspaceToLaunch: {
34
- name: 'ward-patient-workspace',
35
- },
26
+ launchWorkspace2('ward-patient-workspace', {}, {}, {
27
+ wardPatient
36
28
  });
37
29
  }}>
38
30
  {getPatientName(patient.person)}
@@ -3,7 +3,14 @@ import classNames from 'classnames';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Button, InlineNotification } from '@carbon/react';
5
5
  import { Movement } from '@carbon/react/icons';
6
- import { ArrowRightIcon, isDesktop, launchWorkspaceGroup, useAppContext, useLayoutType } from '@openmrs/esm-framework';
6
+ import {
7
+ ArrowRightIcon,
8
+ isDesktop,
9
+ launchWorkspace2,
10
+ launchWorkspaceGroup,
11
+ useAppContext,
12
+ useLayoutType,
13
+ } from '@openmrs/esm-framework';
7
14
  import { type WardViewContext } from '../types';
8
15
  import styles from './admission-requests.scss';
9
16
 
@@ -46,11 +53,8 @@ const AdmissionRequestsBar: React.FC<AdmissionRequestsBarProps> = ({ wardPending
46
53
  <Button
47
54
  className={styles.manageButton}
48
55
  onClick={() => {
49
- launchWorkspaceGroup('ward-patient-admission-requests', {
50
- state: { wardPendingPatients },
51
- workspaceToLaunch: {
52
- name: 'admission-requests-workspace',
53
- },
56
+ launchWorkspace2('admission-requests-workspace', {
57
+ wardPendingPatients,
54
58
  });
55
59
  }}
56
60
  renderIcon={ArrowRightIcon}
@@ -1,4 +1,4 @@
1
- import { launchWorkspaceGroup, useAppContext } from '@openmrs/esm-framework';
1
+ import { launchWorkspace2, launchWorkspaceGroup, useAppContext } from '@openmrs/esm-framework';
2
2
  import { screen } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import React from 'react';
@@ -8,14 +8,14 @@ import { type WardViewContext } from '../types';
8
8
  import AdmissionRequestsBar from './admission-requests-bar.component';
9
9
 
10
10
  jest.mocked(useAppContext<WardViewContext>).mockReturnValue(mockWardViewContext);
11
- const mockUseConfig = jest.mocked(launchWorkspaceGroup);
11
+ const mockLaunchWorkspace = jest.mocked(launchWorkspace2);
12
12
  describe('Admission Requests Button', () => {
13
13
  it('should launch workspace when clicked on manage button', async () => {
14
14
  const user = userEvent.setup();
15
15
  renderWithSwr(<AdmissionRequestsBar wardPendingPatients={[]} />);
16
16
 
17
17
  await user.click(screen.getByRole('button', { name: /manage/i }));
18
- expect(mockUseConfig).toHaveBeenCalled();
18
+ expect(mockLaunchWorkspace).toHaveBeenCalled();
19
19
  });
20
20
 
21
21
  it('should have one admission request', () => {
@@ -1,25 +1,24 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@carbon/react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { launchWorkspace, useLayoutType } from '@openmrs/esm-framework';
5
- import { useAdmissionRequestsWorkspaceContext } from '../admission-request-workspace/admission-requests-context';
4
+ import { closeWorkspaceGroup2, launchWorkspace2, useLayoutType, useWorkspace2Context } from '@openmrs/esm-framework';
6
5
  import type { WardPatientCardType, WardPatientWorkspaceProps } from '../../types';
7
6
  import AdmitPatientButton from '../admit-patient-button.component';
8
7
  import styles from './admission-request-card.scss';
9
8
 
10
9
  const AdmissionRequestCardActions: WardPatientCardType = ({ wardPatient }) => {
11
10
  const { t } = useTranslation();
12
- const { closeWorkspaceWithSavedChanges } = useAdmissionRequestsWorkspaceContext();
13
11
  const responsiveSize = useLayoutType() === 'tablet' ? 'lg' : 'md';
12
+ const { closeWorkspace } = useWorkspace2Context();
14
13
 
15
14
  const launchPatientTransferForm = () => {
16
- launchWorkspace<WardPatientWorkspaceProps>('patient-transfer-request-workspace', {
15
+ launchWorkspace2<WardPatientWorkspaceProps, {}, {}>('transfer-elsewhere-workspace', {
17
16
  wardPatient,
18
17
  });
19
18
  };
20
19
 
21
20
  const launchCancelAdmissionForm = () => {
22
- launchWorkspace<WardPatientWorkspaceProps>('cancel-admission-request-workspace', {
21
+ launchWorkspace2<WardPatientWorkspaceProps, {}, {}>('cancel-admission-request-workspace', {
23
22
  wardPatient,
24
23
  });
25
24
  };
@@ -37,7 +36,10 @@ const AdmissionRequestCardActions: WardPatientCardType = ({ wardPatient }) => {
37
36
  <AdmitPatientButton
38
37
  wardPatient={wardPatient}
39
38
  dispositionType={wardPatient.inpatientRequest.dispositionType}
40
- onAdmitPatientSuccess={() => closeWorkspaceWithSavedChanges()}
39
+ onAdmitPatientSuccess={async () => {
40
+ await closeWorkspace({ discardUnsavedChanges: true });
41
+ closeWorkspaceGroup2();
42
+ }}
41
43
  />
42
44
  </div>
43
45
  );
@@ -1,18 +1,17 @@
1
1
  import React from 'react';
2
+ import { ActionMenuButton2, UserAvatarIcon } from '@openmrs/esm-framework';
2
3
  import { useTranslation } from 'react-i18next';
3
- import { ActionMenuButton, launchWorkspace, UserAvatarIcon } from '@openmrs/esm-framework';
4
- import { type AdmissionRequestsWorkspaceContextProps } from './admission-requests-context';
5
4
 
6
5
  export default function AdmissionRequestsActionButton() {
7
6
  const { t } = useTranslation();
8
7
 
9
8
  return (
10
- <ActionMenuButton
11
- getIcon={(props) => <UserAvatarIcon {...props} />}
12
- handler={() => launchWorkspace<AdmissionRequestsWorkspaceContextProps>('admission-requests-workspace')}
13
- iconDescription={t('pendingAdmissions', 'Pending admissions')}
9
+ <ActionMenuButton2
10
+ icon={(props) => <UserAvatarIcon {...props} />}
14
11
  label={t('pendingAdmissions', 'Pending admissions')}
15
- type={'pending-admission-requests'}
12
+ workspaceToLaunch={{
13
+ workspaceName: 'admission-requests-workspace',
14
+ }}
16
15
  />
17
16
  );
18
17
  }
@@ -1,10 +1,9 @@
1
- import React, { useState } from 'react';
1
+ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Layer, Tile, Button } from '@carbon/react';
5
5
  import { Add } from '@carbon/react/icons';
6
- import { launchWorkspace, useLayoutType } from '@openmrs/esm-framework';
7
- import { type CreateAdmissionEncounterWorkspaceProps } from '../create-admission-encounter/create-admission-encounter.workspace';
6
+ import { launchWorkspace2, useLayoutType, type Workspace2DefinitionProps } from '@openmrs/esm-framework';
8
7
  import { EmptyDataIllustration } from './empty-data-illustration.component';
9
8
  import styles from './admission-requests-empty-state.scss';
10
9
 
@@ -12,36 +11,24 @@ const AdmissionRequestsEmptyState: React.FC = () => {
12
11
  const { t } = useTranslation();
13
12
  const isDesktop = useLayoutType() !== 'tablet';
14
13
 
15
- // TODO: this is an attempt to save the previous search term for the
16
- // "Back to patient search" button, but it doesn't work. See:
17
- // https://openmrs.atlassian.net/browse/O3-4300
18
- const [searchTerm, setSearchTerm] = useState<string>('');
19
-
20
- const launchSearchWorkspace = () => {
21
- // See PatientSearchWorkspaceProps in patient-search-app
22
- const workspaceProps = {
23
- initialQuery: searchTerm,
24
- nonNavigationSelectPatientAction: async (patientUuid: string) => {
25
- launchWorkspace<CreateAdmissionEncounterWorkspaceProps>('create-admission-encounter-workspace', {
26
- patientUuid,
27
- handleReturnToSearchList: launchSearchWorkspace,
28
- });
29
- },
30
- handleSearchTermUpdated: (value: string) => {
31
- setSearchTerm(value);
14
+ const handleAddPatient = () => {
15
+ launchWorkspace2('ward-app-patient-search-workspace', {
16
+ workspaceProps: {
17
+ workspaceTitle: t('addPatientToQueue', 'Add patient to queue'),
18
+ onPatientSelected(
19
+ patientUuid: string,
20
+ patient: fhir.Patient,
21
+ launchChildWorkspace: Workspace2DefinitionProps['launchChildWorkspace'],
22
+ closeWorkspace: Workspace2DefinitionProps['launchChildWorkspace'],
23
+ ) {
24
+ launchChildWorkspace('create-admission-encounter-workspace', {
25
+ selectedPatientUuid: patient.id,
26
+ });
27
+ },
32
28
  },
33
- };
34
-
35
- launchWorkspace('patient-search-workspace', {
36
- ...workspaceProps,
37
- workspaceTitle: t('addPatientToWard', 'Add patient to ward'),
38
29
  });
39
30
  };
40
31
 
41
- const handleAddPatient = () => {
42
- launchSearchWorkspace();
43
- };
44
-
45
32
  return (
46
33
  <Layer>
47
34
  <Tile className={classNames(styles.emptyStateTile, { [styles.desktopTile]: isDesktop })}>
@@ -1,25 +1,30 @@
1
1
  import React from 'react';
2
2
  import { screen } from '@testing-library/react';
3
- import { useAppContext } from '@openmrs/esm-framework';
3
+ import { useAppContext, useWorkspace2Context, type Workspace2DefinitionProps } from '@openmrs/esm-framework';
4
4
  import { renderWithSwr } from 'tools';
5
5
  import { mockWardViewContext } from '../../../mock';
6
- import { type AdmissionRequestsWorkspaceContextProps } from './admission-requests-context';
7
6
  import { type WardViewContext } from '../../types';
8
7
  import useEmrConfiguration from '../../hooks/useEmrConfiguration';
9
8
  import DefaultWardPendingPatients from '../../ward-view/default-ward/default-ward-pending-patients.component';
10
- import AdmissionRequestsWorkspace from './admission-requests.workspace';
9
+ import AdmissionRequestsWorkspace, { type AdmissionRequestsWorkspaceProps } from './admission-requests.workspace';
11
10
 
12
11
  jest.mocked(useAppContext<WardViewContext>).mockReturnValue(mockWardViewContext);
12
+ const mockUseWorkspace2Context = jest.mocked(useWorkspace2Context);
13
13
 
14
14
  jest.mock('../../hooks/useEmrConfiguration', () => jest.fn());
15
15
  const mockedUseEmrConfiguration = jest.mocked(useEmrConfiguration);
16
16
 
17
- const workspaceProps: AdmissionRequestsWorkspaceContextProps = {
17
+ const workspaceProps: Workspace2DefinitionProps<AdmissionRequestsWorkspaceProps> = {
18
18
  closeWorkspace: jest.fn(),
19
- promptBeforeClosing: jest.fn(),
20
- closeWorkspaceWithSavedChanges: jest.fn(),
21
- setTitle: jest.fn(),
22
- wardPendingPatients: <DefaultWardPendingPatients />,
19
+ launchChildWorkspace: jest.fn(),
20
+ workspaceProps: {
21
+ wardPendingPatients: <DefaultWardPendingPatients />,
22
+ },
23
+ windowProps: undefined,
24
+ groupProps: undefined,
25
+ workspaceName: '',
26
+ windowName: '',
27
+ isRootWorkspace: false,
23
28
  };
24
29
 
25
30
  describe('Admission Requests Workspace', () => {
@@ -43,6 +48,16 @@ describe('Admission Requests Workspace', () => {
43
48
  },
44
49
  mutateEmrConfiguration: jest.fn(),
45
50
  });
51
+ mockUseWorkspace2Context.mockReturnValue({
52
+ closeWorkspace: jest.fn(),
53
+ launchChildWorkspace: jest.fn(),
54
+ workspaceProps: undefined,
55
+ windowProps: undefined,
56
+ groupProps: undefined,
57
+ workspaceName: '',
58
+ windowName: '',
59
+ isRootWorkspace: false,
60
+ });
46
61
  });
47
62
 
48
63
  it('should render an admission request card', () => {