@kenyaemr/esm-icu-app 5.4.5-pre.1142

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 (268) hide show
  1. package/.turbo/turbo-build.log +6 -0
  2. package/dist/1072.js +1 -0
  3. package/dist/1072.js.map +1 -0
  4. package/dist/1148.js +1 -0
  5. package/dist/1148.js.map +1 -0
  6. package/dist/1156.js +1 -0
  7. package/dist/1156.js.map +1 -0
  8. package/dist/1278.js +1 -0
  9. package/dist/1278.js.map +1 -0
  10. package/dist/1442.js +1 -0
  11. package/dist/1442.js.map +1 -0
  12. package/dist/1466.js +1 -0
  13. package/dist/1466.js.map +1 -0
  14. package/dist/15.js +1 -0
  15. package/dist/15.js.map +1 -0
  16. package/dist/1568.js +1 -0
  17. package/dist/1568.js.map +1 -0
  18. package/dist/1620.js +1 -0
  19. package/dist/1620.js.map +1 -0
  20. package/dist/1668.js +1 -0
  21. package/dist/1668.js.map +1 -0
  22. package/dist/1789.js +1 -0
  23. package/dist/1789.js.map +1 -0
  24. package/dist/1831.js +1 -0
  25. package/dist/1831.js.map +1 -0
  26. package/dist/1844.js +1 -0
  27. package/dist/1844.js.map +1 -0
  28. package/dist/1946.js +1 -0
  29. package/dist/1946.js.map +1 -0
  30. package/dist/2007.js +1 -0
  31. package/dist/2007.js.map +1 -0
  32. package/dist/2115.js +1 -0
  33. package/dist/2115.js.map +1 -0
  34. package/dist/2152.js +1 -0
  35. package/dist/2152.js.map +1 -0
  36. package/dist/2202.js +1 -0
  37. package/dist/2202.js.map +1 -0
  38. package/dist/2231.js +1 -0
  39. package/dist/2231.js.map +1 -0
  40. package/dist/2394.js +1 -0
  41. package/dist/2394.js.map +1 -0
  42. package/dist/2507.js +1 -0
  43. package/dist/2507.js.map +1 -0
  44. package/dist/2516.js +1 -0
  45. package/dist/2516.js.map +1 -0
  46. package/dist/2534.js +1 -0
  47. package/dist/2534.js.map +1 -0
  48. package/dist/2537.js +1 -0
  49. package/dist/2537.js.map +1 -0
  50. package/dist/2556.js +1 -0
  51. package/dist/2556.js.map +1 -0
  52. package/dist/2648.js +1 -0
  53. package/dist/2648.js.map +1 -0
  54. package/dist/2795.js +1 -0
  55. package/dist/2795.js.map +1 -0
  56. package/dist/2842.js +1 -0
  57. package/dist/2842.js.map +1 -0
  58. package/dist/2916.js +1 -0
  59. package/dist/2916.js.map +1 -0
  60. package/dist/2924.js +1 -0
  61. package/dist/2924.js.map +1 -0
  62. package/dist/2947.js +1 -0
  63. package/dist/2947.js.map +1 -0
  64. package/dist/3032.js +1 -0
  65. package/dist/3032.js.map +1 -0
  66. package/dist/3137.js +1 -0
  67. package/dist/3137.js.map +1 -0
  68. package/dist/3285.js +1 -0
  69. package/dist/3285.js.map +1 -0
  70. package/dist/3335.js +1 -0
  71. package/dist/3335.js.map +1 -0
  72. package/dist/3378.js +1 -0
  73. package/dist/3378.js.map +1 -0
  74. package/dist/3381.js +1 -0
  75. package/dist/3381.js.map +1 -0
  76. package/dist/3504.js +1 -0
  77. package/dist/3504.js.map +1 -0
  78. package/dist/356.js +1 -0
  79. package/dist/356.js.map +1 -0
  80. package/dist/3569.js +1 -0
  81. package/dist/3569.js.map +1 -0
  82. package/dist/3723.js +1 -0
  83. package/dist/3723.js.map +1 -0
  84. package/dist/3745.js +1 -0
  85. package/dist/3745.js.map +1 -0
  86. package/dist/3747.js +1 -0
  87. package/dist/3747.js.map +1 -0
  88. package/dist/3802.js +1 -0
  89. package/dist/3802.js.map +1 -0
  90. package/dist/3813.js +1 -0
  91. package/dist/3813.js.map +1 -0
  92. package/dist/393.js +6 -0
  93. package/dist/393.js.map +1 -0
  94. package/dist/3953.js +1 -0
  95. package/dist/3953.js.map +1 -0
  96. package/dist/3989.js +1 -0
  97. package/dist/3989.js.map +1 -0
  98. package/dist/4178.js +1 -0
  99. package/dist/4178.js.map +1 -0
  100. package/dist/4487.js +11 -0
  101. package/dist/4487.js.map +1 -0
  102. package/dist/4588.js +1 -0
  103. package/dist/4588.js.map +1 -0
  104. package/dist/4612.js +1 -0
  105. package/dist/4612.js.map +1 -0
  106. package/dist/4637.js +1 -0
  107. package/dist/4637.js.map +1 -0
  108. package/dist/466.js +1 -0
  109. package/dist/466.js.map +1 -0
  110. package/dist/4817.js +1 -0
  111. package/dist/4817.js.map +1 -0
  112. package/dist/4818.js +1 -0
  113. package/dist/4818.js.map +1 -0
  114. package/dist/500.js +1 -0
  115. package/dist/500.js.map +1 -0
  116. package/dist/5086.js +1 -0
  117. package/dist/5086.js.map +1 -0
  118. package/dist/5117.js +1 -0
  119. package/dist/5117.js.map +1 -0
  120. package/dist/5361.js +1 -0
  121. package/dist/5361.js.map +1 -0
  122. package/dist/5366.js +1 -0
  123. package/dist/5366.js.map +1 -0
  124. package/dist/5598.js +1 -0
  125. package/dist/5598.js.map +1 -0
  126. package/dist/5676.js +1 -0
  127. package/dist/5676.js.map +1 -0
  128. package/dist/5731.js +5 -0
  129. package/dist/5731.js.map +1 -0
  130. package/dist/5792.js +1 -0
  131. package/dist/5792.js.map +1 -0
  132. package/dist/5825.js +1 -0
  133. package/dist/5825.js.map +1 -0
  134. package/dist/5932.js +1 -0
  135. package/dist/5932.js.map +1 -0
  136. package/dist/5941.js +1 -0
  137. package/dist/5941.js.map +1 -0
  138. package/dist/5967.js +1 -0
  139. package/dist/5967.js.map +1 -0
  140. package/dist/6104.js +1 -0
  141. package/dist/6104.js.map +1 -0
  142. package/dist/624.js +1 -0
  143. package/dist/624.js.map +1 -0
  144. package/dist/6259.js +1 -0
  145. package/dist/6259.js.map +1 -0
  146. package/dist/6288.js +1 -0
  147. package/dist/6288.js.map +1 -0
  148. package/dist/629.js +1 -0
  149. package/dist/629.js.map +1 -0
  150. package/dist/6337.js +1 -0
  151. package/dist/6337.js.map +1 -0
  152. package/dist/6427.js +1 -0
  153. package/dist/6427.js.map +1 -0
  154. package/dist/6478.js +7 -0
  155. package/dist/6478.js.map +1 -0
  156. package/dist/6508.js +1 -0
  157. package/dist/6508.js.map +1 -0
  158. package/dist/6567.js +1 -0
  159. package/dist/6567.js.map +1 -0
  160. package/dist/6634.js +1 -0
  161. package/dist/6634.js.map +1 -0
  162. package/dist/689.js +1 -0
  163. package/dist/689.js.map +1 -0
  164. package/dist/7022.js +1 -0
  165. package/dist/7022.js.map +1 -0
  166. package/dist/7085.js +1 -0
  167. package/dist/7085.js.map +1 -0
  168. package/dist/7209.js +1 -0
  169. package/dist/7209.js.map +1 -0
  170. package/dist/7235.js +1 -0
  171. package/dist/7235.js.map +1 -0
  172. package/dist/7360.js +1 -0
  173. package/dist/7360.js.map +1 -0
  174. package/dist/7453.js +1 -0
  175. package/dist/7453.js.map +1 -0
  176. package/dist/7454.js +1 -0
  177. package/dist/7454.js.map +1 -0
  178. package/dist/7478.js +1 -0
  179. package/dist/7478.js.map +1 -0
  180. package/dist/7782.js +1 -0
  181. package/dist/7782.js.map +1 -0
  182. package/dist/7887.js +1 -0
  183. package/dist/7887.js.map +1 -0
  184. package/dist/8028.js +1 -0
  185. package/dist/8028.js.map +1 -0
  186. package/dist/8196.js +1 -0
  187. package/dist/8196.js.map +1 -0
  188. package/dist/820.js +1 -0
  189. package/dist/820.js.map +1 -0
  190. package/dist/8458.js +1 -0
  191. package/dist/8458.js.map +1 -0
  192. package/dist/8472.js +1 -0
  193. package/dist/8472.js.map +1 -0
  194. package/dist/8607.js +1 -0
  195. package/dist/8607.js.map +1 -0
  196. package/dist/8762.js +1 -0
  197. package/dist/8762.js.map +1 -0
  198. package/dist/8924.js +1 -0
  199. package/dist/8924.js.map +1 -0
  200. package/dist/8990.js +1 -0
  201. package/dist/8990.js.map +1 -0
  202. package/dist/9060.js +1 -0
  203. package/dist/9060.js.map +1 -0
  204. package/dist/9061.js +1 -0
  205. package/dist/9061.js.map +1 -0
  206. package/dist/9087.js +1 -0
  207. package/dist/9087.js.map +1 -0
  208. package/dist/9425.js +1 -0
  209. package/dist/9520.js +1 -0
  210. package/dist/9520.js.map +1 -0
  211. package/dist/9547.js +1 -0
  212. package/dist/9547.js.map +1 -0
  213. package/dist/9612.js +1 -0
  214. package/dist/9612.js.map +1 -0
  215. package/dist/9771.js +1 -0
  216. package/dist/9771.js.map +1 -0
  217. package/dist/9774.js +1 -0
  218. package/dist/9774.js.map +1 -0
  219. package/dist/9806.js +1 -0
  220. package/dist/9806.js.map +1 -0
  221. package/dist/992.js +1 -0
  222. package/dist/992.js.map +1 -0
  223. package/dist/997.js +1 -0
  224. package/dist/997.js.map +1 -0
  225. package/dist/kenyaemr-esm-icu-app.js +3 -0
  226. package/dist/kenyaemr-esm-icu-app.js.buildmanifest.json +3063 -0
  227. package/dist/kenyaemr-esm-icu-app.js.map +1 -0
  228. package/dist/main.js +3 -0
  229. package/dist/main.js.map +1 -0
  230. package/dist/routes.json +1 -0
  231. package/package.json +49 -0
  232. package/rspack.config.js +1 -0
  233. package/src/components/bed-board/icu-bed-board.component.tsx +173 -0
  234. package/src/components/bed-board/icu-bed-board.scss +228 -0
  235. package/src/components/header/header.component.tsx +25 -0
  236. package/src/components/header/header.scss +24 -0
  237. package/src/components/patient-table/icu-patient-table.component.tsx +232 -0
  238. package/src/components/patient-table/icu-patient-table.scss +91 -0
  239. package/src/components/side-menu/left-panel.component.tsx +23 -0
  240. package/src/components/side-menu/left-panel.scss +7 -0
  241. package/src/components/summary/icu-summary-tiles.component.tsx +154 -0
  242. package/src/components/summary/icu-summary-tiles.scss +116 -0
  243. package/src/config-schema.ts +33 -0
  244. package/src/context/icu-census.context.tsx +68 -0
  245. package/src/dashboard-link.component.tsx +41 -0
  246. package/src/dashboard-link.scss +6 -0
  247. package/src/declarations.d.ts +2 -0
  248. package/src/icu-dashboard.component.tsx +28 -0
  249. package/src/icu-dashboard.scss +401 -0
  250. package/src/icu-embedded-dashboard.component.tsx +15 -0
  251. package/src/index.ts +59 -0
  252. package/src/left-panel-link.component.tsx +44 -0
  253. package/src/left-panel-link.scss +11 -0
  254. package/src/resources/icu-admission.resource.ts +546 -0
  255. package/src/root.component.tsx +29 -0
  256. package/src/root.scss +11 -0
  257. package/src/routes.json +38 -0
  258. package/src/types/icu-bed.types.ts +91 -0
  259. package/src/types/icu-census-patient.types.ts +24 -0
  260. package/src/types/icu-patient.types.ts +37 -0
  261. package/src/utils/icu-census.helpers.ts +31 -0
  262. package/src/utils/icu-day-label.ts +11 -0
  263. package/translations/am.json +48 -0
  264. package/translations/en.json +48 -0
  265. package/translations/fr.json +48 -0
  266. package/translations/sw.json +48 -0
  267. package/tsconfig.json +5 -0
  268. package/webpack.config.js +1 -0
@@ -0,0 +1,228 @@
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+
5
+ .board {
6
+ margin-bottom: layout.$spacing-07;
7
+ }
8
+
9
+ .boardHeader {
10
+ align-items: center;
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ gap: layout.$spacing-04;
14
+ justify-content: space-between;
15
+ margin-bottom: layout.$spacing-05;
16
+ }
17
+
18
+ .headerActions {
19
+ align-items: center;
20
+ display: flex;
21
+ flex-shrink: 0;
22
+ gap: layout.$spacing-03;
23
+ }
24
+
25
+ .title {
26
+ @include type.type-style('heading-compact-02');
27
+ margin: 0;
28
+ }
29
+
30
+ .grid {
31
+ display: grid;
32
+ gap: layout.$spacing-05;
33
+ grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
34
+ }
35
+
36
+ .card {
37
+ background: colors.$white;
38
+ border: 1px solid colors.$gray-20;
39
+ border-radius: layout.$spacing-04;
40
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: layout.$spacing-03;
44
+ min-height: 12rem;
45
+ overflow: hidden;
46
+ padding: 0;
47
+ position: relative;
48
+ }
49
+
50
+ .accentBar {
51
+ bottom: 0;
52
+ left: 0;
53
+ position: absolute;
54
+ top: 0;
55
+ width: 4px;
56
+ }
57
+
58
+ .accentBarAvailable {
59
+ background: colors.$green-50;
60
+ }
61
+
62
+ .accentBarReserved {
63
+ background: colors.$orange-70;
64
+ }
65
+
66
+ .accentBar0 {
67
+ background: colors.$blue-60;
68
+ }
69
+
70
+ .accentBar1 {
71
+ background: colors.$purple-60;
72
+ }
73
+
74
+ .accentBar2 {
75
+ background: colors.$teal-60;
76
+ }
77
+
78
+ .accentBar3 {
79
+ background: colors.$cyan-50;
80
+ }
81
+
82
+ .accentBar4 {
83
+ background: colors.$magenta-50;
84
+ }
85
+
86
+ .accentBar5 {
87
+ background: colors.$yellow-50;
88
+ }
89
+
90
+ .cardBody {
91
+ display: flex;
92
+ flex: 1;
93
+ flex-direction: column;
94
+ gap: layout.$spacing-03;
95
+ padding: layout.$spacing-05 layout.$spacing-05 layout.$spacing-04;
96
+ padding-left: calc(layout.$spacing-05 + 2px);
97
+ }
98
+
99
+ .cardHeader {
100
+ align-items: center;
101
+ display: flex;
102
+ gap: layout.$spacing-03;
103
+ justify-content: space-between;
104
+ }
105
+
106
+ .bedLabel {
107
+ @include type.type-style('label-01');
108
+ color: colors.$gray-70;
109
+ font-weight: 700;
110
+ letter-spacing: 0.02em;
111
+ text-transform: uppercase;
112
+ }
113
+
114
+ .dayPill {
115
+ @include type.type-style('label-01');
116
+ background: colors.$blue-20;
117
+ border-radius: 999px;
118
+ color: colors.$blue-70;
119
+ font-weight: 700;
120
+ padding: 0.2rem 0.65rem;
121
+ white-space: nowrap;
122
+ }
123
+
124
+ .dayPillEmpty {
125
+ background: colors.$green-20;
126
+ color: colors.$green-80;
127
+ }
128
+
129
+ .dayPillReserved {
130
+ background: colors.$orange-20;
131
+ color: colors.$orange-70;
132
+ }
133
+
134
+ .patientName {
135
+ @include type.type-style('heading-compact-02');
136
+ margin: 0;
137
+ word-break: break-word;
138
+ }
139
+
140
+ .meta {
141
+ @include type.type-style('body-compact-01');
142
+ color: colors.$gray-70;
143
+ margin: 0;
144
+ }
145
+
146
+ .flags {
147
+ display: flex;
148
+ flex-wrap: wrap;
149
+ gap: layout.$spacing-02;
150
+ }
151
+
152
+ .flag {
153
+ @include type.type-style('label-01');
154
+ border-radius: 999px;
155
+ font-weight: 700;
156
+ padding: 0.2rem 0.55rem;
157
+ }
158
+
159
+ .flagVent {
160
+ background: colors.$blue-20;
161
+ color: colors.$blue-70;
162
+ }
163
+
164
+ .flagVaso {
165
+ background: colors.$red-20;
166
+ color: colors.$red-70;
167
+ }
168
+
169
+ .flagCrrt {
170
+ background: colors.$purple-20;
171
+ color: colors.$purple-70;
172
+ }
173
+
174
+ .flagIso {
175
+ background: colors.$yellow-10;
176
+ color: colors.$yellow-60;
177
+ }
178
+
179
+ .flagTag {
180
+ background: colors.$gray-10;
181
+ color: colors.$gray-70;
182
+ }
183
+
184
+ .emptyHint {
185
+ @include type.type-style('body-compact-01');
186
+ color: colors.$gray-60;
187
+ margin: auto 0 0;
188
+ }
189
+
190
+ .cardFooter {
191
+ align-items: center;
192
+ background: colors.$gray-10;
193
+ border-top: 1px solid colors.$gray-20;
194
+ display: flex;
195
+ gap: layout.$spacing-04;
196
+ margin-top: auto;
197
+ padding: layout.$spacing-03 layout.$spacing-05;
198
+ padding-left: calc(layout.$spacing-05 + 2px);
199
+ }
200
+
201
+ .link {
202
+ @include type.type-style('body-compact-01');
203
+ align-items: center;
204
+ color: colors.$blue-60;
205
+ display: inline-flex;
206
+ font-weight: 600;
207
+ gap: 0.3rem;
208
+ text-decoration: none;
209
+
210
+ &:hover {
211
+ text-decoration: underline;
212
+ }
213
+ }
214
+
215
+ .linkSecondary {
216
+ @include type.type-style('label-01');
217
+ align-items: center;
218
+ color: colors.$gray-70;
219
+ display: inline-flex;
220
+ font-weight: 600;
221
+ gap: 0.3rem;
222
+ text-decoration: none;
223
+
224
+ &:hover {
225
+ color: colors.$blue-60;
226
+ text-decoration: underline;
227
+ }
228
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { PageHeader, FacilityPictogram } from '@openmrs/esm-framework';
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ import styles from './header.scss';
6
+
7
+ interface HeaderProps {
8
+ standalone?: boolean;
9
+ }
10
+
11
+ const Header: React.FC<HeaderProps> = () => {
12
+ const { t } = useTranslation();
13
+
14
+ return (
15
+ <div className={styles.wrapper}>
16
+ <PageHeader
17
+ className={styles.header}
18
+ title={t('icuModuleTitle', 'Intensive Care Unit')}
19
+ illustration={<FacilityPictogram />}
20
+ />
21
+ </div>
22
+ );
23
+ };
24
+
25
+ export default Header;
@@ -0,0 +1,24 @@
1
+ @use '@carbon/layout';
2
+
3
+ .wrapper {
4
+ margin-bottom: layout.$spacing-05;
5
+ }
6
+
7
+ .header {
8
+ margin-bottom: 0;
9
+ }
10
+
11
+ .subtitle {
12
+ color: var(--cds-text-secondary);
13
+ margin: 0;
14
+ padding-left: layout.$spacing-05;
15
+ }
16
+
17
+ .backLink {
18
+ margin-top: layout.$spacing-03;
19
+ padding-left: layout.$spacing-05;
20
+ }
21
+
22
+ .backLink a {
23
+ font-size: 0.875rem;
24
+ }
@@ -0,0 +1,232 @@
1
+ import React, { useMemo, useState } from 'react';
2
+ import {
3
+ DataTable,
4
+ InlineLoading,
5
+ InlineNotification,
6
+ Search,
7
+ Table,
8
+ TableBody,
9
+ TableCell,
10
+ TableHead,
11
+ TableHeader,
12
+ TableRow,
13
+ Tag,
14
+ } from '@carbon/react';
15
+ import { Information } from '@carbon/react/icons';
16
+ import { useTranslation } from 'react-i18next';
17
+
18
+ import { useIcuCensus } from '../../context/icu-census.context';
19
+ import { type IcuCensusPatient } from '../../types/icu-census-patient.types';
20
+ import { getOccupiedAssignments } from '../../utils/icu-census.helpers';
21
+ import { getIcuDayLabelForPatient } from '../../utils/icu-day-label';
22
+ import styles from './icu-patient-table.scss';
23
+
24
+ type IcuPatientTableRow = {
25
+ id: string;
26
+ bed: string;
27
+ layout: string;
28
+ patient: string;
29
+ identifier: string;
30
+ icuDay: string;
31
+ status: string;
32
+ ward: string;
33
+ raw: IcuCensusPatient;
34
+ };
35
+
36
+ const tableHeaders = [
37
+ { key: 'bed', headerKey: 'bed', default: 'Bed' },
38
+ { key: 'layout', headerKey: 'icuBedLayout', default: 'Row / Col' },
39
+ { key: 'patient', headerKey: 'patient', default: 'Patient' },
40
+ { key: 'identifier', headerKey: 'identifier', default: 'ID' },
41
+ { key: 'icuDay', headerKey: 'icuDay', default: 'ICU day' },
42
+ { key: 'status', headerKey: 'status', default: 'Status' },
43
+ { key: 'ward', headerKey: 'ward', default: 'Ward' },
44
+ ];
45
+
46
+ const IcuPatientTable: React.FC = () => {
47
+ const { t } = useTranslation();
48
+ const { boardState, getPatient, isLoading, error } = useIcuCensus();
49
+ const [query, setQuery] = useState('');
50
+
51
+ const rows = useMemo((): IcuPatientTableRow[] => {
52
+ const nowMs = Date.now();
53
+ const occupied = getOccupiedAssignments(boardState);
54
+
55
+ const activeRows: IcuPatientTableRow[] = occupied
56
+ .map((assignment) => {
57
+ const patient = getPatient(assignment.patientUuid);
58
+ if (!patient) {
59
+ return null;
60
+ }
61
+ return {
62
+ id: patient.patientUuid,
63
+ bed: assignment.bedLabel,
64
+ layout: `R${assignment.row} / C${assignment.column}`,
65
+ patient: patient.displayName,
66
+ identifier: patient.identifier,
67
+ icuDay: getIcuDayLabelForPatient({ admissionDate: patient.admissionDate }, nowMs),
68
+ status: t('activeIcu', 'Active'),
69
+ ward: patient.locationDisplay ?? '—',
70
+ raw: patient,
71
+ };
72
+ })
73
+ .filter((row): row is IcuPatientTableRow => Boolean(row));
74
+
75
+ return activeRows.sort((a, b) => a.bed.localeCompare(b.bed, undefined, { numeric: true }));
76
+ }, [boardState, getPatient, t]);
77
+
78
+ const filtered = useMemo(() => {
79
+ const q = query.trim().toLowerCase();
80
+ if (!q) {
81
+ return rows;
82
+ }
83
+ return rows.filter(
84
+ (r) =>
85
+ r.patient.toLowerCase().includes(q) ||
86
+ r.bed.toLowerCase().includes(q) ||
87
+ r.identifier.toLowerCase().includes(q) ||
88
+ r.ward.toLowerCase().includes(q),
89
+ );
90
+ }, [rows, query]);
91
+
92
+ const patientByRowId = useMemo(() => {
93
+ const map = new Map<string, IcuCensusPatient>();
94
+ for (const r of filtered) {
95
+ map.set(r.id, r.raw);
96
+ }
97
+ return map;
98
+ }, [filtered]);
99
+
100
+ return (
101
+ <>
102
+ <div className={styles.wrap}>
103
+ <div className={styles.header}>
104
+ <h3 className={styles.title}>{t('icuCensusList', 'Patient List')}</h3>
105
+ <div className={styles.search}>
106
+ <Search
107
+ size="md"
108
+ labelText={t('searchPatients', 'Search patients')}
109
+ placeholder={t('searchPatientBedOrId', 'Search patient, bed or ID...')}
110
+ value={query}
111
+ onChange={(e) => setQuery(e.target.value)}
112
+ closeButtonLabelText={t('clearSearch', 'Clear search')}
113
+ />
114
+ </div>
115
+ </div>
116
+
117
+ {isLoading && (
118
+ <div className={styles.emptyPad}>
119
+ <InlineLoading description={t('loadingIcuCensus', 'Loading ICU admissions…')} />
120
+ </div>
121
+ )}
122
+ {error && (
123
+ <div className={styles.emptyPad}>
124
+ <InlineNotification
125
+ kind="error"
126
+ lowContrast
127
+ title={t('icuCensusError', 'Could not load ICU census')}
128
+ subtitle={error.message}
129
+ />
130
+ </div>
131
+ )}
132
+ {!isLoading && !error && rows.length === 0 && (
133
+ <div className={styles.emptyPad}>
134
+ <InlineNotification
135
+ kind="info"
136
+ lowContrast
137
+ hideCloseButton
138
+ title={t('noIcuPatients', 'No ICU inpatients')}
139
+ subtitle={t(
140
+ 'noIcuPatientsSubtitle',
141
+ 'No patients on ICU beds or with an active ICU visit. Assign the patient to a bed in Bed Management, or ensure their visit location is an ICU-tagged ward.',
142
+ )}
143
+ />
144
+ </div>
145
+ )}
146
+ {filtered.length > 0 && (
147
+ <DataTable
148
+ rows={filtered}
149
+ headers={tableHeaders.map((h) => ({
150
+ key: h.key,
151
+ header: t(h.headerKey, h.default),
152
+ }))}>
153
+ {({ rows: tableRows, headers, getTableProps, getHeaderProps, getRowProps }) => (
154
+ <Table {...getTableProps()} className={styles.table} size="md">
155
+ <TableHead>
156
+ <TableRow>
157
+ {headers.map((header) => (
158
+ <TableHeader {...getHeaderProps({ header })} key={header.key}>
159
+ {header.header}
160
+ </TableHeader>
161
+ ))}
162
+ </TableRow>
163
+ </TableHead>
164
+ <TableBody>
165
+ {tableRows.map((row) => {
166
+ const patient = patientByRowId.get(row.id);
167
+ return (
168
+ <TableRow {...getRowProps({ row })} key={row.id}>
169
+ {row.cells.map((cell) => {
170
+ if (cell.info.header === 'patient' && patient) {
171
+ return (
172
+ <TableCell key={cell.id}>
173
+ <div className={styles.flagCell}>
174
+ <span>{cell.value}</span>
175
+ {patient.chartRetained && (
176
+ <Tag type="cool-gray" size="sm">
177
+ {t('retainedChart', 'Records')}
178
+ </Tag>
179
+ )}
180
+ {patient.ventilated && (
181
+ <Tag type="blue" size="sm">
182
+ {t('flagVentilated', 'Ventilated')}
183
+ </Tag>
184
+ )}
185
+ {patient.vasopressors && (
186
+ <Tag type="red" size="sm">
187
+ {patient.vasoDrug || t('flagVasopressors', 'Vasopressors')}
188
+ </Tag>
189
+ )}
190
+ {patient.crrt && (
191
+ <Tag type="purple" size="sm">
192
+ {t('flagCrrt', 'CRRT')}
193
+ </Tag>
194
+ )}
195
+ </div>
196
+ </TableCell>
197
+ );
198
+ }
199
+ return <TableCell key={cell.id}>{cell.value}</TableCell>;
200
+ })}
201
+ </TableRow>
202
+ );
203
+ })}
204
+ </TableBody>
205
+ </Table>
206
+ )}
207
+ </DataTable>
208
+ )}
209
+ {!isLoading && rows.length > 0 && filtered.length === 0 && (
210
+ <div className={styles.emptyPad}>
211
+ <InlineNotification
212
+ kind="info"
213
+ lowContrast
214
+ hideCloseButton
215
+ title={t('noSearchResults', 'No matching patients')}
216
+ subtitle={t('noSearchResultsSubtitle', 'Try a different patient name, bed or ID.')}
217
+ />
218
+ </div>
219
+ )}
220
+ </div>
221
+
222
+ <div className={styles.hint}>
223
+ <Information size={18} className={styles.hintIcon} />
224
+ <span>
225
+ {t('homeFooterHint', 'Patient charts (Start ICU and observations) will be enabled in the next ICU slice.')}
226
+ </span>
227
+ </div>
228
+ </>
229
+ );
230
+ };
231
+
232
+ export default IcuPatientTable;
@@ -0,0 +1,91 @@
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+
5
+ .wrap {
6
+ background: colors.$white;
7
+ border: 1px solid colors.$gray-20;
8
+ border-radius: layout.$spacing-04;
9
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
10
+ margin-bottom: layout.$spacing-05;
11
+ overflow: hidden;
12
+ }
13
+
14
+ .header {
15
+ align-items: center;
16
+ display: flex;
17
+ flex-wrap: wrap;
18
+ gap: layout.$spacing-04;
19
+ justify-content: space-between;
20
+ padding: layout.$spacing-05;
21
+ }
22
+
23
+ .title {
24
+ @include type.type-style('heading-compact-02');
25
+ margin: 0;
26
+ }
27
+
28
+ .search {
29
+ max-width: 18rem;
30
+ min-width: 12rem;
31
+ width: 100%;
32
+ }
33
+
34
+ .table {
35
+ margin-top: 0;
36
+ width: 100%;
37
+
38
+ :global(thead tr) {
39
+ background: colors.$blue-10;
40
+ }
41
+
42
+ :global(th) {
43
+ background: colors.$blue-10 !important;
44
+ color: colors.$gray-80;
45
+ font-weight: 700;
46
+ }
47
+ }
48
+
49
+ .link {
50
+ @include type.type-style('body-compact-01');
51
+ align-items: center;
52
+ color: colors.$blue-60;
53
+ display: inline-flex;
54
+ font-weight: 600;
55
+ gap: 0.3rem;
56
+ text-decoration: none;
57
+
58
+ &:hover {
59
+ text-decoration: underline;
60
+ }
61
+ }
62
+
63
+ .flagCell {
64
+ align-items: center;
65
+ display: flex;
66
+ flex-wrap: wrap;
67
+ gap: 0.35rem;
68
+ }
69
+
70
+ .hint {
71
+ @include type.type-style('body-compact-01');
72
+ align-items: flex-start;
73
+ background: colors.$blue-10;
74
+ border: 1px solid colors.$blue-30;
75
+ border-radius: layout.$spacing-03;
76
+ color: colors.$gray-80;
77
+ display: flex;
78
+ gap: layout.$spacing-03;
79
+ margin-bottom: layout.$spacing-05;
80
+ padding: layout.$spacing-04;
81
+ }
82
+
83
+ .hintIcon {
84
+ color: colors.$blue-70;
85
+ flex-shrink: 0;
86
+ margin-top: 0.1rem;
87
+ }
88
+
89
+ .emptyPad {
90
+ padding: layout.$spacing-05;
91
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { SideNav } from '@carbon/react';
3
+ import { attach, ExtensionSlot, isDesktop, useLayoutType } from '@openmrs/esm-framework';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import styles from './left-panel.scss';
7
+
8
+ attach('nav-menu-slot', 'icu-left-panel');
9
+
10
+ const LeftPanel: React.FC = () => {
11
+ const { t } = useTranslation();
12
+ const layout = useLayoutType();
13
+
14
+ return (
15
+ isDesktop(layout) && (
16
+ <SideNav aria-label={t('icuLeftPanel', 'ICU left panel')} className={styles.leftPanel} expanded>
17
+ <ExtensionSlot name="icu-left-panel-slot" />
18
+ </SideNav>
19
+ )
20
+ );
21
+ };
22
+
23
+ export default LeftPanel;
@@ -0,0 +1,7 @@
1
+ @use '@carbon/layout';
2
+
3
+ .leftPanel {
4
+ :global(.cds--side-nav) {
5
+ border-right: 1px solid var(--cds-border-subtle);
6
+ }
7
+ }