@digihmis/esm-home-app 1.0.0

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 (114) hide show
  1. package/README.md +5 -0
  2. package/dist/117.js +1 -0
  3. package/dist/117.js.map +1 -0
  4. package/dist/132.js +1 -0
  5. package/dist/132.js.map +1 -0
  6. package/dist/137.js +1 -0
  7. package/dist/137.js.map +1 -0
  8. package/dist/150.js +1 -0
  9. package/dist/150.js.map +1 -0
  10. package/dist/152.js +1 -0
  11. package/dist/152.js.map +1 -0
  12. package/dist/209.js +1 -0
  13. package/dist/209.js.map +1 -0
  14. package/dist/248.js +1 -0
  15. package/dist/248.js.map +1 -0
  16. package/dist/252.js +12 -0
  17. package/dist/252.js.map +1 -0
  18. package/dist/317.js +1 -0
  19. package/dist/317.js.map +1 -0
  20. package/dist/349.js +1 -0
  21. package/dist/349.js.map +1 -0
  22. package/dist/371.js +1 -0
  23. package/dist/371.js.map +1 -0
  24. package/dist/378.js +1 -0
  25. package/dist/378.js.map +1 -0
  26. package/dist/442.js +1 -0
  27. package/dist/442.js.map +1 -0
  28. package/dist/45.js +1 -0
  29. package/dist/45.js.map +1 -0
  30. package/dist/466.js +1 -0
  31. package/dist/466.js.map +1 -0
  32. package/dist/49.js +1 -0
  33. package/dist/49.js.map +1 -0
  34. package/dist/508.js +1 -0
  35. package/dist/508.js.map +1 -0
  36. package/dist/567.js +1 -0
  37. package/dist/567.js.map +1 -0
  38. package/dist/60.js +1 -0
  39. package/dist/60.js.map +1 -0
  40. package/dist/61.js +1 -0
  41. package/dist/61.js.map +1 -0
  42. package/dist/689.js +1 -0
  43. package/dist/689.js.map +1 -0
  44. package/dist/712.js +1 -0
  45. package/dist/712.js.map +1 -0
  46. package/dist/720.js +1 -0
  47. package/dist/720.js.map +1 -0
  48. package/dist/742.js +1 -0
  49. package/dist/742.js.map +1 -0
  50. package/dist/771.js +1 -0
  51. package/dist/771.js.map +1 -0
  52. package/dist/806.js +1 -0
  53. package/dist/806.js.map +1 -0
  54. package/dist/912.js +1 -0
  55. package/dist/912.js.map +1 -0
  56. package/dist/913.js +1 -0
  57. package/dist/913.js.map +1 -0
  58. package/dist/940.js +1 -0
  59. package/dist/940.js.map +1 -0
  60. package/dist/987.js +15 -0
  61. package/dist/987.js.map +1 -0
  62. package/dist/digihmis-esm-home-app.js +6 -0
  63. package/dist/digihmis-esm-home-app.js.buildmanifest.json +896 -0
  64. package/dist/digihmis-esm-home-app.js.map +1 -0
  65. package/dist/main.js +6 -0
  66. package/dist/main.js.map +1 -0
  67. package/dist/routes.json +1 -0
  68. package/jest.config.js +26 -0
  69. package/package.json +51 -0
  70. package/rspack.config.js +1 -0
  71. package/src/config-schema.ts +358 -0
  72. package/src/dashboards/administration-dashboard/administration-dashboard.component.tsx +68 -0
  73. package/src/dashboards/billing-dashboard/billing-dashboard.component.tsx +71 -0
  74. package/src/dashboards/outpatient-dashboard/outpatient-dashboard.component.tsx +71 -0
  75. package/src/dashboards/registration-dashboard/registration-dashboard.component.tsx +58 -0
  76. package/src/dashboards/triage-dashboard/triage-dashboard.component.tsx +72 -0
  77. package/src/declarations.d.ts +6 -0
  78. package/src/generic-clock-in-modal/clock-in.scss +41 -0
  79. package/src/generic-clock-in-modal/generic-clock-in.modal.tsx +295 -0
  80. package/src/generic-clock-in-modal/generic-clock-in.resource.ts +107 -0
  81. package/src/generic-clock-in-modal/type/index.ts +45 -0
  82. package/src/generic-clock-in-modal/util/session-cache.ts +48 -0
  83. package/src/generic-dashboard/generic-dashboard-view.component.tsx +23 -0
  84. package/src/generic-dashboard/generic-dashboard-view.scss +5 -0
  85. package/src/generic-dashboard/generic-dashboard.scss +32 -0
  86. package/src/home-grid-dashboard/home-grid-dashboard.component.tsx +33 -0
  87. package/src/home-grid-dashboard/home-grid-dashboard.scss +56 -0
  88. package/src/index.ts +31 -0
  89. package/src/module-card/module-card-utils.component.tsx +175 -0
  90. package/src/module-card/module-card.component.tsx +48 -0
  91. package/src/module-card/module-card.scss +103 -0
  92. package/src/provider-banner/page-header.extension.tsx +86 -0
  93. package/src/provider-banner/page-header.scss +48 -0
  94. package/src/root.component.tsx +43 -0
  95. package/src/root.scss +15 -0
  96. package/src/routes.json +74 -0
  97. package/src/setup-tests.ts +1 -0
  98. package/src/side-nav/generic-side-nav.component.tsx +17 -0
  99. package/src/type/index.ts +5 -0
  100. package/src/welcome-back-banner/welcome-back-banner.component.tsx +112 -0
  101. package/src/welcome-back-banner/welcome-back-banner.resource.ts +29 -0
  102. package/src/welcome-back-banner/welcome-back-banner.scss +123 -0
  103. package/translations/am.json +33 -0
  104. package/translations/ar.json +33 -0
  105. package/translations/en.json +33 -0
  106. package/translations/es.json +33 -0
  107. package/translations/fr.json +33 -0
  108. package/translations/he.json +33 -0
  109. package/translations/km.json +33 -0
  110. package/translations/pt.json +33 -0
  111. package/translations/sw.json +33 -0
  112. package/translations/vi.json +33 -0
  113. package/translations/zh.json +33 -0
  114. package/tsconfig.json +5 -0
@@ -0,0 +1,358 @@
1
+ import { ConfigSchema, Type, validators } from '@openmrs/esm-framework';
2
+
3
+ export const configSchema: ConfigSchema = {
4
+ excludeLinks: {
5
+ _type: Type.Array,
6
+ _elements: {
7
+ _type: Type.String,
8
+ _description: 'Label for the link to hide',
9
+ },
10
+ _default: [],
11
+ _description: 'Array of links to hide in the esm home app',
12
+ },
13
+ administrationIcon: {
14
+ src: {
15
+ _type: Type.String,
16
+ _default: '/openmrs/spa/administration.svg',
17
+ _description:
18
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
19
+ _validators: [validators.isUrl],
20
+ },
21
+ alt: {
22
+ _type: Type.String,
23
+ _default: 'Logo',
24
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
25
+ },
26
+ },
27
+ appointmentsIcon: {
28
+ src: {
29
+ _type: Type.String,
30
+ _default: '/openmrs/spa/appointments.svg',
31
+ _description:
32
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
33
+ _validators: [validators.isUrl],
34
+ },
35
+ alt: {
36
+ _type: Type.String,
37
+ _default: 'Logo',
38
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
39
+ },
40
+ },
41
+ billingIcon: {
42
+ src: {
43
+ _type: Type.String,
44
+ _default: '/openmrs/spa/billing.svg',
45
+ _description:
46
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
47
+ _validators: [validators.isUrl],
48
+ },
49
+ alt: {
50
+ _type: Type.String,
51
+ _default: 'Logo',
52
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
53
+ },
54
+ },
55
+
56
+ dentalIcon: {
57
+ src: {
58
+ _type: Type.String,
59
+ _default: '/openmrs/spa/denal.svg',
60
+ _description:
61
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
62
+ _validators: [validators.isUrl],
63
+ },
64
+ alt: {
65
+ _type: Type.String,
66
+ _default: 'Logo',
67
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
68
+ },
69
+ },
70
+ homeIcon: {
71
+ src: {
72
+ _type: Type.String,
73
+ _default: '/openmrs/spa/home.svg',
74
+ _description:
75
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
76
+ _validators: [validators.isUrl],
77
+ },
78
+ alt: {
79
+ _type: Type.String,
80
+ _default: 'Logo',
81
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
82
+ },
83
+ },
84
+ inpatientIcon: {
85
+ src: {
86
+ _type: Type.String,
87
+ _default: '/openmrs/spa/Inpatient.svg',
88
+ _description:
89
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
90
+ _validators: [validators.isUrl],
91
+ },
92
+ alt: {
93
+ _type: Type.String,
94
+ _default: 'Logo',
95
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
96
+ },
97
+ },
98
+ inventoryIcon: {
99
+ src: {
100
+ _type: Type.String,
101
+ _default: '/openmrs/spa/inventory.svg',
102
+ _description:
103
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
104
+ _validators: [validators.isUrl],
105
+ },
106
+ alt: {
107
+ _type: Type.String,
108
+ _default: 'Logo',
109
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
110
+ },
111
+ },
112
+ laboratoryIcon: {
113
+ src: {
114
+ _type: Type.String,
115
+ _default: '/openmrs/spa/labs.svg',
116
+ _description:
117
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
118
+ _validators: [validators.isUrl],
119
+ },
120
+ alt: {
121
+ _type: Type.String,
122
+ _default: 'Logo',
123
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
124
+ },
125
+ },
126
+ mchIcon: {
127
+ src: {
128
+ _type: Type.String,
129
+ _default: '/openmrs/spa/mch.svg',
130
+ _description:
131
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
132
+ _validators: [validators.isUrl],
133
+ },
134
+ alt: {
135
+ _type: Type.String,
136
+ _default: 'Logo',
137
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
138
+ },
139
+ },
140
+ outpatientIcon: {
141
+ src: {
142
+ _type: Type.String,
143
+ _default: '/openmrs/spa/outpatient.svg',
144
+ _description:
145
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
146
+ _validators: [validators.isUrl],
147
+ },
148
+ alt: {
149
+ _type: Type.String,
150
+ _default: 'Logo',
151
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
152
+ },
153
+ },
154
+ pharmacyIcon: {
155
+ src: {
156
+ _type: Type.String,
157
+ _default: '/openmrs/spa/pharmacy.svg',
158
+ _description:
159
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
160
+ _validators: [validators.isUrl],
161
+ },
162
+ alt: {
163
+ _type: Type.String,
164
+ _default: 'Logo',
165
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
166
+ },
167
+ },
168
+ proceduresIcon: {
169
+ src: {
170
+ _type: Type.String,
171
+ _default: '/openmrs/spa/procedure.svg',
172
+ _description:
173
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
174
+ _validators: [validators.isUrl],
175
+ },
176
+ alt: {
177
+ _type: Type.String,
178
+ _default: 'Logo',
179
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
180
+ },
181
+ },
182
+ radiologyIcon: {
183
+ src: {
184
+ _type: Type.String,
185
+ _default: '/openmrs/spa/radiology.svg',
186
+ _description:
187
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
188
+ _validators: [validators.isUrl],
189
+ },
190
+ alt: {
191
+ _type: Type.String,
192
+ _default: 'Logo',
193
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
194
+ },
195
+ },
196
+ referralIcon: {
197
+ src: {
198
+ _type: Type.String,
199
+ _default: '/openmrs/spa/referral.svg',
200
+ _description:
201
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
202
+ _validators: [validators.isUrl],
203
+ },
204
+ alt: {
205
+ _type: Type.String,
206
+ _default: 'Logo',
207
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
208
+ },
209
+ },
210
+ registrationIcon: {
211
+ src: {
212
+ _type: Type.String,
213
+ _default: '/openmrs/spa/registration.svg',
214
+ _description:
215
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
216
+ _validators: [validators.isUrl],
217
+ },
218
+ alt: {
219
+ _type: Type.String,
220
+ _default: 'Logo',
221
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
222
+ },
223
+ },
224
+ specialClinicIcon: {
225
+ src: {
226
+ _type: Type.String,
227
+ _default: '/openmrs/spa/special_clinic.svg',
228
+ _description:
229
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
230
+ _validators: [validators.isUrl],
231
+ },
232
+ alt: {
233
+ _type: Type.String,
234
+ _default: 'Logo',
235
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
236
+ },
237
+ },
238
+ staffManagementIcon: {
239
+ src: {
240
+ _type: Type.String,
241
+ _default: '/openmrs/spa/staff_management.svg',
242
+ _description:
243
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
244
+ _validators: [validators.isUrl],
245
+ },
246
+ alt: {
247
+ _type: Type.String,
248
+ _default: 'Logo',
249
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
250
+ },
251
+ },
252
+ triageIcon: {
253
+ src: {
254
+ _type: Type.String,
255
+ _default: '/openmrs/spa/triage_1.svg',
256
+ _description:
257
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
258
+ _validators: [validators.isUrl],
259
+ },
260
+ alt: {
261
+ _type: Type.String,
262
+ _default: 'Logo',
263
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
264
+ },
265
+ },
266
+ reportsIcon: {
267
+ src: {
268
+ _type: Type.String,
269
+ _default: '/openmrs/spa/reports.svg',
270
+ _description:
271
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
272
+ _validators: [validators.isUrl],
273
+ },
274
+ alt: {
275
+ _type: Type.String,
276
+ _default: 'Logo',
277
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
278
+ },
279
+ },
280
+ facilityDashboardIcon: {
281
+ src: {
282
+ _type: Type.String,
283
+ _default: '/openmrs/spa/facility_analysis.svg',
284
+ _description:
285
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
286
+ _validators: [validators.isUrl],
287
+ },
288
+ alt: {
289
+ _type: Type.String,
290
+ _default: 'Logo',
291
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
292
+ },
293
+ },
294
+ legacyUIIcon: {
295
+ src: {
296
+ _type: Type.String,
297
+ _default: '/openmrs/spa/logo.svg',
298
+ _description:
299
+ 'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
300
+ _validators: [validators.isUrl],
301
+ },
302
+ alt: {
303
+ _type: Type.String,
304
+ _default: 'Logo',
305
+ _description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
306
+ },
307
+ },
308
+ leftNavMode: {
309
+ _type: Type.String,
310
+ _description: 'Sets the left nav mode for the home app.',
311
+ _validators: [validators.oneOf(['normal', 'collapsed', 'hidden'])],
312
+ _default: 'normal',
313
+ },
314
+ triageQueueUuid: {
315
+ _type: Type.String,
316
+ _description: 'The UUID of the triage queue to use for clock-in.',
317
+ _default: 'd692a223-e140-11ee-bad2-0242ac120002',
318
+ },
319
+ outpatientQueueUuid: {
320
+ _type: Type.String,
321
+ _description: 'The UUID of the outpatient queue to use for clock-in.',
322
+ _default: '13b5ce7a-cc47-434f-94d7-c7533f1d4b58',
323
+ },
324
+ specialClinicQueueUuid: {
325
+ _type: Type.String,
326
+ _description: 'The UUID of the special clinic queue to use for clock-in.',
327
+ _default: '3fa2f4c9-dbc6-47b5-897e-ae17c007760e',
328
+ },
329
+ };
330
+
331
+ export type ConfigObject = {
332
+ excludeLinks: Array<string>;
333
+ administrationIcon: { src: string; alt: string };
334
+ appointmentsIcon: { src: string; alt: string };
335
+ billingIcon: { src: string; alt: string };
336
+ dentalIcon: { src: string; alt: string };
337
+ homeIcon: { src: string; alt: string };
338
+ inpatientIcon: { src: string; alt: string };
339
+ inventoryIcon: { src: string; alt: string };
340
+ laboratoryIcon: { src: string; alt: string };
341
+ mchIcon: { src: string; alt: string };
342
+ outpatientIcon: { src: string; alt: string };
343
+ pharmacyIcon: { src: string; alt: string };
344
+ proceduresIcon: { src: string; alt: string };
345
+ radiologyIcon: { src: string; alt: string };
346
+ referralIcon: { src: string; alt: string };
347
+ registrationIcon: { src: string; alt: string };
348
+ specialClinicIcon: { src: string; alt: string };
349
+ staffManagementIcon: { src: string; alt: string };
350
+ triageIcon: { src: string; alt: string };
351
+ reportsIcon: { src: string; alt: string };
352
+ facilityDashboardIcon: { src: string; alt: string };
353
+ legacyUIIcon: { src: string; alt: string };
354
+ leftNavMode: 'normal' | 'collapsed' | 'hidden';
355
+ triageQueueUuid: string;
356
+ outpatientQueueUuid: string;
357
+ specialClinicQueueUuid: string;
358
+ };
@@ -0,0 +1,68 @@
1
+ import React, { useEffect } from 'react';
2
+ import {
3
+ ExtensionSlot,
4
+ WorkspaceContainer,
5
+ useLayoutType,
6
+ isDesktop,
7
+ useConfig,
8
+ useLeftNav,
9
+ useExtensionStore,
10
+ } from '@openmrs/esm-framework';
11
+ import classNames from 'classnames';
12
+ import styles from '../../generic-dashboard/generic-dashboard.scss';
13
+ import { ConfigObject } from '../../config-schema';
14
+ import { useParams, useNavigate, useLocation } from 'react-router-dom';
15
+ import { DashboardConfig } from '../../type';
16
+ import DashboardView from '../../generic-dashboard/generic-dashboard-view.component';
17
+
18
+ export default function AdministrationDashboard() {
19
+ const extensionStore = useExtensionStore();
20
+ const params = useParams();
21
+ const navigate = useNavigate();
22
+ const location = useLocation();
23
+ const layout = useLayoutType();
24
+ const { leftNavMode } = useConfig<ConfigObject>();
25
+
26
+ useLeftNav({
27
+ name: 'administration-dashboard-slot',
28
+ basePath: `${window.spaBase}/home/administration`,
29
+ mode: leftNavMode,
30
+ });
31
+
32
+ const ungroupedDashboards =
33
+ extensionStore.slots['administration-dashboard-slot']?.assignedExtensions
34
+ .map((e) => e.meta)
35
+ .filter((e) => Object.keys(e).length) || [];
36
+ const dashboards = ungroupedDashboards as Array<DashboardConfig>;
37
+
38
+ const dashboardParam = params?.dashboard || params?.['*'];
39
+ const activeDashboard = dashboards.find((dashboard) => dashboard.name === dashboardParam) || dashboards[0];
40
+
41
+ useEffect(() => {
42
+ const basePaths = ['/home/administration', '/home/administration/'];
43
+ if (basePaths.includes(location.pathname)) {
44
+ if (dashboards.length > 0 && dashboards[0]?.name) {
45
+ navigate(`/home/administration/${dashboards[0].name}`, { replace: true });
46
+ }
47
+ }
48
+ }, [location.pathname, dashboards, navigate]);
49
+
50
+ return (
51
+ <div className={styles.homePageWrapper}>
52
+ <section
53
+ className={classNames([
54
+ isDesktop(layout) ? styles.dashboardContainer : styles.dashboardContainerTablet,
55
+ leftNavMode === 'normal' ? styles.hasLeftNav : '',
56
+ ])}>
57
+ {isDesktop(layout) && <ExtensionSlot name="administration-sidebar-slot" />}
58
+ {activeDashboard && (
59
+ <DashboardView
60
+ title={activeDashboard?.title || activeDashboard?.name}
61
+ dashboardSlot={activeDashboard?.slot}
62
+ />
63
+ )}
64
+ </section>
65
+ <WorkspaceContainer overlay contextKey="home/administration" />
66
+ </div>
67
+ );
68
+ }
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import {
3
+ ExtensionSlot,
4
+ WorkspaceContainer,
5
+ useLayoutType,
6
+ isDesktop,
7
+ useConfig,
8
+ useLeftNav,
9
+ useExtensionStore,
10
+ } from '@openmrs/esm-framework';
11
+ import classNames from 'classnames';
12
+ import styles from '../../generic-dashboard/generic-dashboard.scss';
13
+ import { ConfigObject } from '../../config-schema';
14
+ import { useParams, useLocation } from 'react-router-dom';
15
+ import { DashboardConfig } from '../../type';
16
+ import DashboardView from '../../generic-dashboard/generic-dashboard-view.component';
17
+
18
+ export default function BillingDashboard() {
19
+ const extensionStore = useExtensionStore();
20
+ const params = useParams();
21
+ const location = useLocation();
22
+ const layout = useLayoutType();
23
+ const { leftNavMode } = useConfig<ConfigObject>();
24
+
25
+ const isFileRoute = location.pathname.includes('/bill');
26
+ const { patientUuid } = params;
27
+
28
+ useLeftNav({
29
+ name: 'billing-dashboard-slot',
30
+ basePath: `${window.spaBase}/home/billing`,
31
+ mode: leftNavMode,
32
+ });
33
+
34
+ const ungroupedDashboards =
35
+ extensionStore.slots['billing-dashboard-slot']?.assignedExtensions
36
+ .map((e) => e.meta)
37
+ .filter((e) => Object.keys(e).length) || [];
38
+
39
+ const dashboards = ungroupedDashboards as Array<DashboardConfig>;
40
+
41
+ const matchedDashboard = dashboards.find((dashboard) => dashboard.name === params?.dashboard);
42
+ const activeDashboard = matchedDashboard || dashboards[0];
43
+
44
+ return (
45
+ <div className={styles.homePageWrapper}>
46
+ <section
47
+ className={classNames([
48
+ isDesktop(layout) ? styles.dashboardContainer : styles.dashboardContainerTablet,
49
+ leftNavMode === 'normal' ? styles.hasLeftNav : '',
50
+ ])}>
51
+ {isDesktop(layout) && <ExtensionSlot name="billing-sidebar-slot" />}
52
+
53
+ {isFileRoute && patientUuid ? (
54
+ <DashboardView
55
+ title={activeDashboard?.title || activeDashboard?.name}
56
+ dashboardSlot="patient-bill-dashboard-slot"
57
+ state={{ patientUuid }}
58
+ />
59
+ ) : (
60
+ activeDashboard && (
61
+ <DashboardView
62
+ title={activeDashboard?.title || activeDashboard?.name}
63
+ dashboardSlot={activeDashboard?.slot}
64
+ />
65
+ )
66
+ )}
67
+ </section>
68
+ <WorkspaceContainer overlay contextKey="home/billing" />
69
+ </div>
70
+ );
71
+ }
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import {
3
+ ExtensionSlot,
4
+ WorkspaceContainer,
5
+ useLayoutType,
6
+ isDesktop,
7
+ useConfig,
8
+ useLeftNav,
9
+ useExtensionStore,
10
+ } from '@openmrs/esm-framework';
11
+ import classNames from 'classnames';
12
+ import styles from '../../generic-dashboard/generic-dashboard.scss';
13
+ import { ConfigObject } from '../../config-schema';
14
+ import { useParams, useLocation } from 'react-router-dom';
15
+ import { DashboardConfig } from '../../type';
16
+ import DashboardView from '../../generic-dashboard/generic-dashboard-view.component';
17
+
18
+ export default function OutpatientDashboard() {
19
+ const extensionStore = useExtensionStore();
20
+ const params = useParams();
21
+ const location = useLocation();
22
+ const layout = useLayoutType();
23
+ const { leftNavMode } = useConfig<ConfigObject>();
24
+
25
+ const isFileRoute = location.pathname.includes('/file');
26
+ const { patientUuid } = params;
27
+
28
+ useLeftNav({
29
+ name: 'outpatient-dashboard-slot',
30
+ basePath: `${window.spaBase}/home/outpatient`,
31
+ mode: leftNavMode,
32
+ });
33
+
34
+ const ungroupedDashboards =
35
+ extensionStore.slots['outpatient-dashboard-slot']?.assignedExtensions
36
+ .map((e) => e.meta)
37
+ .filter((e) => Object.keys(e).length) || [];
38
+
39
+ const dashboards = ungroupedDashboards as Array<DashboardConfig>;
40
+
41
+ const matchedDashboard = dashboards.find((dashboard) => dashboard.name === params?.dashboard);
42
+ const activeDashboard = matchedDashboard || dashboards[0];
43
+
44
+ return (
45
+ <div className={styles.homePageWrapper}>
46
+ <section
47
+ className={classNames([
48
+ isDesktop(layout) ? styles.dashboardContainer : styles.dashboardContainerTablet,
49
+ leftNavMode === 'normal' ? styles.hasLeftNav : '',
50
+ ])}>
51
+ {isDesktop(layout) && <ExtensionSlot name="outpatient-sidebar-slot" />}
52
+
53
+ {isFileRoute && patientUuid ? (
54
+ <DashboardView
55
+ title={activeDashboard?.title || activeDashboard?.name}
56
+ dashboardSlot="outpatient-file-dashboard-slot"
57
+ state={{ patientUuid }}
58
+ />
59
+ ) : (
60
+ activeDashboard && (
61
+ <DashboardView
62
+ title={activeDashboard?.title || activeDashboard?.name}
63
+ dashboardSlot={activeDashboard?.slot}
64
+ />
65
+ )
66
+ )}
67
+ </section>
68
+ <WorkspaceContainer overlay contextKey="home/outpatient" />
69
+ </div>
70
+ );
71
+ }
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import {
3
+ ExtensionSlot,
4
+ WorkspaceContainer,
5
+ useLayoutType,
6
+ isDesktop,
7
+ useConfig,
8
+ useLeftNav,
9
+ useExtensionStore,
10
+ } from '@openmrs/esm-framework';
11
+ import classNames from 'classnames';
12
+ import { useLocation, useParams } from 'react-router-dom';
13
+ import styles from '../../generic-dashboard/generic-dashboard.scss';
14
+ import { ConfigObject } from '../../config-schema';
15
+
16
+ export default function RegistrationDashboard() {
17
+ const location = useLocation();
18
+ const layout = useLayoutType();
19
+ const { leftNavMode } = useConfig<ConfigObject>();
20
+ // const extensionStore = useExtensionStore();
21
+
22
+ useLeftNav({
23
+ name: 'registration-dashboard-slot',
24
+ basePath: `${window.spaBase}home/registration`,
25
+ mode: leftNavMode,
26
+ });
27
+
28
+ // const ungroupedDashboards =
29
+ // extensionStore.slots['registration-dashboard-slot']?.assignedExtensions
30
+ // .map((e) => e.meta)
31
+ // .filter((e) => Object.keys(e).length) || [];
32
+ // const dashboards = ungroupedDashboards as Array<DashboardConfig>;
33
+
34
+ const isPatientRegistrationRoute = location.pathname.includes('/patient-registration');
35
+ return (
36
+ <div className={styles.homePageWrapper}>
37
+ <section
38
+ className={classNames([
39
+ isDesktop(layout) ? styles.dashboardContainer : styles.dashboardContainerTablet,
40
+ leftNavMode === 'normal' ? styles.hasLeftNav : '',
41
+ ])}>
42
+ {isDesktop(layout) && <ExtensionSlot name="registration-sidebar-slot" />}
43
+ <div>
44
+ {isPatientRegistrationRoute ? (
45
+ <div>
46
+ <ExtensionSlot name="registration-form-slot" />
47
+ </div>
48
+ ) : (
49
+ <div>
50
+ <ExtensionSlot name="search-dashboard-slot" />
51
+ </div>
52
+ )}
53
+ </div>
54
+ </section>
55
+ <WorkspaceContainer overlay contextKey="home/registration" />
56
+ </div>
57
+ );
58
+ }
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import {
3
+ ExtensionSlot,
4
+ WorkspaceContainer,
5
+ useLayoutType,
6
+ isDesktop,
7
+ useConfig,
8
+ useLeftNav,
9
+ useExtensionStore,
10
+ } from '@openmrs/esm-framework';
11
+ import classNames from 'classnames';
12
+ import styles from '../../generic-dashboard/generic-dashboard.scss';
13
+ import { ConfigObject } from '../../config-schema';
14
+ import { useParams, useLocation } from 'react-router-dom';
15
+ import { DashboardConfig } from '../../type';
16
+ import DashboardView from '../../generic-dashboard/generic-dashboard-view.component';
17
+
18
+ export default function TriageDashboard() {
19
+ const extensionStore = useExtensionStore();
20
+ const params = useParams();
21
+ const location = useLocation();
22
+ const layout = useLayoutType();
23
+ const { leftNavMode } = useConfig<ConfigObject>();
24
+
25
+ // Check if we're on the vitals route
26
+ const isVitalsRoute = location.pathname.includes('/vitals');
27
+ const { patientUuid } = params;
28
+
29
+ useLeftNav({
30
+ name: 'triage-dashboard-slot',
31
+ basePath: `${window.spaBase}/home/triage`,
32
+ mode: leftNavMode,
33
+ });
34
+
35
+ const ungroupedDashboards =
36
+ extensionStore.slots['triage-dashboard-slot']?.assignedExtensions
37
+ .map((e) => e.meta)
38
+ .filter((e) => Object.keys(e).length) || [];
39
+
40
+ const dashboards = ungroupedDashboards as Array<DashboardConfig>;
41
+
42
+ const matchedDashboard = dashboards.find((dashboard) => dashboard.name === params?.dashboard);
43
+ const activeDashboard = matchedDashboard || dashboards[0];
44
+
45
+ return (
46
+ <div className={styles.homePageWrapper}>
47
+ <section
48
+ className={classNames([
49
+ isDesktop(layout) ? styles.dashboardContainer : styles.dashboardContainerTablet,
50
+ leftNavMode === 'normal' ? styles.hasLeftNav : '',
51
+ ])}>
52
+ {isDesktop(layout) && <ExtensionSlot name="triage-sidebar-slot" />}
53
+
54
+ {isVitalsRoute && patientUuid ? (
55
+ <DashboardView
56
+ title={activeDashboard?.title || activeDashboard?.name}
57
+ dashboardSlot="triage-vitals-dashboard-slot"
58
+ state={{ patientUuid }}
59
+ />
60
+ ) : (
61
+ activeDashboard && (
62
+ <DashboardView
63
+ title={activeDashboard?.title || activeDashboard?.name}
64
+ dashboardSlot={activeDashboard?.slot}
65
+ />
66
+ )
67
+ )}
68
+ </section>
69
+ <WorkspaceContainer overlay contextKey="home/triage" />
70
+ </div>
71
+ );
72
+ }