@kenyaemr/esm-express-workflow-app 5.4.3 → 5.4.4-pre.100

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 (388) hide show
  1. package/.turbo/turbo-build.log +7 -12
  2. package/dist/1074.js +1 -0
  3. package/dist/1074.js.map +1 -0
  4. package/dist/12.js +17 -0
  5. package/dist/12.js.map +1 -0
  6. package/dist/1311.js +1 -0
  7. package/dist/1311.js.map +1 -0
  8. package/dist/1323.js +1 -0
  9. package/dist/1323.js.map +1 -0
  10. package/dist/1469.js +1 -0
  11. package/dist/1469.js.map +1 -0
  12. package/dist/1506.js +13 -0
  13. package/dist/1506.js.map +1 -0
  14. package/dist/1562.js +1 -0
  15. package/dist/1562.js.map +1 -0
  16. package/dist/1760.js +1 -0
  17. package/dist/1760.js.map +1 -0
  18. package/dist/1780.js +1 -0
  19. package/dist/1780.js.map +1 -0
  20. package/dist/1804.js +1 -0
  21. package/dist/1804.js.map +1 -0
  22. package/dist/1884.js +1 -0
  23. package/dist/1884.js.map +1 -0
  24. package/dist/1972.js +1 -0
  25. package/dist/1972.js.map +1 -0
  26. package/dist/1990.js +1 -0
  27. package/dist/1990.js.map +1 -0
  28. package/dist/2016.js +1 -0
  29. package/dist/2016.js.map +1 -0
  30. package/dist/2024.js +1 -0
  31. package/dist/2024.js.map +1 -0
  32. package/dist/2153.js +1 -0
  33. package/dist/2153.js.map +1 -0
  34. package/dist/216.js +1 -0
  35. package/dist/216.js.map +1 -0
  36. package/dist/2225.js +1 -0
  37. package/dist/2225.js.map +1 -0
  38. package/dist/2294.js +1 -0
  39. package/dist/2294.js.map +1 -0
  40. package/dist/2345.js +1 -0
  41. package/dist/2345.js.map +1 -0
  42. package/dist/2499.js +1 -0
  43. package/dist/2499.js.map +1 -0
  44. package/dist/2500.js +1 -0
  45. package/dist/2500.js.map +1 -0
  46. package/dist/2586.js +1 -0
  47. package/dist/2586.js.map +1 -0
  48. package/dist/2625.js +1 -0
  49. package/dist/2625.js.map +1 -0
  50. package/dist/2685.js +1 -0
  51. package/dist/2685.js.map +1 -0
  52. package/dist/2809.js +1 -0
  53. package/dist/2809.js.map +1 -0
  54. package/dist/2851.js +1 -0
  55. package/dist/2851.js.map +1 -0
  56. package/dist/2881.js +1 -0
  57. package/dist/2881.js.map +1 -0
  58. package/dist/2948.js +1 -0
  59. package/dist/2948.js.map +1 -0
  60. package/dist/2968.js +1 -0
  61. package/dist/2968.js.map +1 -0
  62. package/dist/2978.js +1 -0
  63. package/dist/2978.js.map +1 -0
  64. package/dist/2998.js +1 -0
  65. package/dist/2998.js.map +1 -0
  66. package/dist/3089.js +1 -0
  67. package/dist/3089.js.map +1 -0
  68. package/dist/3548.js +1 -0
  69. package/dist/3548.js.map +1 -0
  70. package/dist/3567.js +1 -0
  71. package/dist/3567.js.map +1 -0
  72. package/dist/3569.js +1 -0
  73. package/dist/3569.js.map +1 -0
  74. package/dist/3571.js +1 -0
  75. package/dist/3571.js.map +1 -0
  76. package/dist/3691.js +1 -0
  77. package/dist/3691.js.map +1 -0
  78. package/dist/3730.js +1 -0
  79. package/dist/3730.js.map +1 -0
  80. package/dist/3923.js +1 -0
  81. package/dist/3923.js.map +1 -0
  82. package/dist/3963.js +1 -0
  83. package/dist/3963.js.map +1 -0
  84. package/dist/4024.js +1 -0
  85. package/dist/4024.js.map +1 -0
  86. package/dist/405.js +1 -0
  87. package/dist/405.js.map +1 -0
  88. package/dist/4071.js +1 -0
  89. package/dist/4071.js.map +1 -0
  90. package/dist/4271.js +1 -0
  91. package/dist/4271.js.map +1 -0
  92. package/dist/4296.js +1 -0
  93. package/dist/4296.js.map +1 -0
  94. package/dist/4337.js +1 -0
  95. package/dist/4337.js.map +1 -0
  96. package/dist/4432.js +1 -0
  97. package/dist/4432.js.map +1 -0
  98. package/dist/4581.js +1 -0
  99. package/dist/4581.js.map +1 -0
  100. package/dist/4637.js +11 -0
  101. package/dist/4637.js.map +1 -0
  102. package/dist/4666.js +1 -0
  103. package/dist/4666.js.map +1 -0
  104. package/dist/4680.js +1 -0
  105. package/dist/4680.js.map +1 -0
  106. package/dist/4735.js +1 -0
  107. package/dist/4735.js.map +1 -0
  108. package/dist/4737.js +1 -0
  109. package/dist/4737.js.map +1 -0
  110. package/dist/4744.js +1 -0
  111. package/dist/4744.js.map +1 -0
  112. package/dist/4795.js +1 -0
  113. package/dist/4795.js.map +1 -0
  114. package/dist/4813.js +2 -0
  115. package/dist/4813.js.map +1 -0
  116. package/dist/4818.js +1 -0
  117. package/dist/4818.js.map +1 -0
  118. package/dist/4858.js +1 -0
  119. package/dist/4858.js.map +1 -0
  120. package/dist/487.js +1 -0
  121. package/dist/487.js.map +1 -0
  122. package/dist/4970.js +1 -0
  123. package/dist/4970.js.map +1 -0
  124. package/dist/5038.js +1 -0
  125. package/dist/5038.js.map +1 -0
  126. package/dist/5202.js +1 -0
  127. package/dist/5202.js.map +1 -0
  128. package/dist/5491.js +1 -0
  129. package/dist/5491.js.map +1 -0
  130. package/dist/5592.js +1 -0
  131. package/dist/5592.js.map +1 -0
  132. package/dist/5669.js +1 -0
  133. package/dist/5669.js.map +1 -0
  134. package/dist/586.js +1 -0
  135. package/dist/586.js.map +1 -0
  136. package/dist/5932.js +1 -0
  137. package/dist/5932.js.map +1 -0
  138. package/dist/5995.js +1 -0
  139. package/dist/5995.js.map +1 -0
  140. package/dist/6258.js +1 -0
  141. package/dist/6258.js.map +1 -0
  142. package/dist/629.js +1 -0
  143. package/dist/629.js.map +1 -0
  144. package/dist/6328.js +1 -0
  145. package/dist/6328.js.map +1 -0
  146. package/dist/6355.js +1 -0
  147. package/dist/6355.js.map +1 -0
  148. package/dist/6419.js +1 -0
  149. package/dist/6419.js.map +1 -0
  150. package/dist/644.js +1 -0
  151. package/dist/644.js.map +1 -0
  152. package/dist/6456.js +1 -0
  153. package/dist/6466.js +3 -0
  154. package/dist/6466.js.map +1 -0
  155. package/dist/655.js +1 -0
  156. package/dist/655.js.map +1 -0
  157. package/dist/6798.js +66 -0
  158. package/dist/6798.js.map +1 -0
  159. package/dist/6910.js +1 -0
  160. package/dist/6910.js.map +1 -0
  161. package/dist/6925.js +1 -0
  162. package/dist/6925.js.map +1 -0
  163. package/dist/70.js +1 -0
  164. package/dist/70.js.map +1 -0
  165. package/dist/7201.js +1 -0
  166. package/dist/7201.js.map +1 -0
  167. package/dist/7234.js +1 -0
  168. package/dist/7234.js.map +1 -0
  169. package/dist/7261.js +1 -0
  170. package/dist/7261.js.map +1 -0
  171. package/dist/7326.js +1 -0
  172. package/dist/7359.js +1 -0
  173. package/dist/7487.js +1 -0
  174. package/dist/7487.js.map +1 -0
  175. package/dist/7591.js +1 -0
  176. package/dist/7591.js.map +1 -0
  177. package/dist/7607.js +1 -0
  178. package/dist/7701.js +1 -0
  179. package/dist/7701.js.map +1 -0
  180. package/dist/7717.js +1 -0
  181. package/dist/7717.js.map +1 -0
  182. package/dist/7739.js +1 -0
  183. package/dist/7739.js.map +1 -0
  184. package/dist/7788.js +1 -0
  185. package/dist/7788.js.map +1 -0
  186. package/dist/7819.js +1 -0
  187. package/dist/7819.js.map +1 -0
  188. package/dist/7971.js +1 -0
  189. package/dist/7971.js.map +1 -0
  190. package/dist/7983.js +1 -0
  191. package/dist/7983.js.map +1 -0
  192. package/dist/807.js +1 -0
  193. package/dist/807.js.map +1 -0
  194. package/dist/8159.js +7 -0
  195. package/dist/8159.js.map +1 -0
  196. package/dist/8338.js +1 -0
  197. package/dist/8338.js.map +1 -0
  198. package/dist/845.js +1 -0
  199. package/dist/845.js.map +1 -0
  200. package/dist/8570.js +1 -0
  201. package/dist/8570.js.map +1 -0
  202. package/dist/8661.js +1 -0
  203. package/dist/8661.js.map +1 -0
  204. package/dist/87.js +1 -0
  205. package/dist/87.js.map +1 -0
  206. package/dist/8727.js +1 -0
  207. package/dist/8766.js +1 -0
  208. package/dist/8766.js.map +1 -0
  209. package/dist/8828.js +1 -0
  210. package/dist/8828.js.map +1 -0
  211. package/dist/8860.js +1 -0
  212. package/dist/8860.js.map +1 -0
  213. package/dist/8911.js +1 -0
  214. package/dist/8911.js.map +1 -0
  215. package/dist/8930.js +1 -0
  216. package/dist/8930.js.map +1 -0
  217. package/dist/8971.js +1 -0
  218. package/dist/8971.js.map +1 -0
  219. package/dist/9124.js +1 -0
  220. package/dist/9124.js.map +1 -0
  221. package/dist/9157.js +1 -0
  222. package/dist/9157.js.map +1 -0
  223. package/dist/9182.js +1 -0
  224. package/dist/921.js +1 -0
  225. package/dist/921.js.map +1 -0
  226. package/dist/9212.js +1 -0
  227. package/dist/9212.js.map +1 -0
  228. package/dist/9255.js +1 -0
  229. package/dist/9255.js.map +1 -0
  230. package/dist/9257.js +1 -0
  231. package/dist/9257.js.map +1 -0
  232. package/dist/9316.js +1 -0
  233. package/dist/9316.js.map +1 -0
  234. package/dist/9333.js +1 -0
  235. package/dist/9333.js.map +1 -0
  236. package/dist/9404.js +1 -0
  237. package/dist/9404.js.map +1 -0
  238. package/dist/9446.js +1 -0
  239. package/dist/9446.js.map +1 -0
  240. package/dist/9447.js +1 -0
  241. package/dist/9447.js.map +1 -0
  242. package/dist/9449.js +1 -0
  243. package/dist/9449.js.map +1 -0
  244. package/dist/9535.js +1 -0
  245. package/dist/9535.js.map +1 -0
  246. package/dist/9606.js +1 -0
  247. package/dist/9606.js.map +1 -0
  248. package/dist/973.js +1 -0
  249. package/dist/973.js.map +1 -0
  250. package/dist/9845.js +1 -0
  251. package/dist/9845.js.map +1 -0
  252. package/dist/kenyaemr-esm-express-workflow-app.js +5 -5
  253. package/dist/kenyaemr-esm-express-workflow-app.js.buildmanifest.json +3004 -175
  254. package/dist/kenyaemr-esm-express-workflow-app.js.map +1 -1
  255. package/dist/main.js +5 -114
  256. package/dist/main.js.map +1 -1
  257. package/dist/routes.json +1 -1
  258. package/package.json +6 -7
  259. package/rspack.config.js +1 -1
  260. package/src/components/accounting/index.tsx +11 -10
  261. package/src/components/admissions/index.tsx +11 -10
  262. package/src/components/appointments/index.ts +10 -8
  263. package/src/components/consultation/clinical-encounter/encounter-details.component.tsx +9 -9
  264. package/src/components/consultation/clinical-encounter/encounter-details.test.tsx +19 -18
  265. package/src/components/consultation/consultation-context.tsx +19 -0
  266. package/src/components/consultation/consultation-summary-cards.component.tsx +124 -0
  267. package/src/components/consultation/consultation.component.tsx +41 -268
  268. package/src/components/consultation/consultation.resource.ts +67 -24
  269. package/src/components/consultation/consultation.scss +5 -0
  270. package/src/components/consultation/consultation.utils.tsx +222 -0
  271. package/src/components/consultation/dashboard.component.tsx +0 -2
  272. package/src/components/consultation/index.ts +27 -20
  273. package/src/components/facility-dashboard/index.tsx +10 -9
  274. package/src/components/laboratory/index.ts +11 -10
  275. package/src/components/laboratory/lab-table.component.tsx +22 -8
  276. package/src/components/laboratory/laboratory-tabs.component.tsx +2 -2
  277. package/src/components/mch/dashboard.component.tsx +0 -2
  278. package/src/components/mch/index.tsx +10 -9
  279. package/src/components/mch/mch.consultation.component.tsx +27 -15
  280. package/src/components/mch/mch.triage.component.tsx +42 -33
  281. package/src/components/pharmacy/index.ts +20 -18
  282. package/src/components/pharmacy/orders/pharmacy-orders.component.tsx +35 -13
  283. package/src/components/pharmacy/orders/pharmacy-orders.test.tsx +8 -7
  284. package/src/components/procedures/index.ts +11 -10
  285. package/src/components/procedures/procedures-table.component.tsx +44 -13
  286. package/src/components/procedures/procedures-tabs.component.tsx +2 -2
  287. package/src/components/radiology-and-imaging/index.ts +14 -10
  288. package/src/components/radiology-and-imaging/radiology-and-imaging-table.component.tsx +35 -15
  289. package/src/components/radiology-and-imaging/radiology-and-imaging.component.tsx +2 -2
  290. package/src/components/registration/card/HIE-card/hie-card.component.tsx +32 -44
  291. package/src/components/registration/card/Local-card/local-card.component.tsx +22 -24
  292. package/src/components/registration/dependants/dependants.component.tsx +32 -60
  293. package/src/components/registration/dependants/dependants.resource.ts +79 -50
  294. package/src/components/registration/helper/index.ts +4 -0
  295. package/src/components/registration/index.ts +10 -9
  296. package/src/components/registration/search-bar/search-bar.resource.ts +32 -93
  297. package/src/components/registration/start-visit-form/hooks/useDefaultFacilityLocation.tsx +15 -0
  298. package/src/components/registration/start-visit-form/hooks/useDefaultVisitLocation.tsx +24 -0
  299. package/src/components/registration/start-visit-form/hooks/useOfflineVisitType.tsx +18 -0
  300. package/src/components/registration/start-visit-form/hooks/useRecommendedVisitTypes.tsx +36 -0
  301. package/src/components/registration/start-visit-form/hooks/useVisitAttributeType.tsx +102 -0
  302. package/src/components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.extension.tsx +55 -0
  303. package/src/components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.scss +3 -0
  304. package/src/components/registration/start-visit-form/start-visit-workspace/base-visit-type.component.tsx +126 -0
  305. package/src/components/registration/start-visit-form/start-visit-workspace/base-visit-type.scss +75 -0
  306. package/src/components/registration/start-visit-form/start-visit-workspace/exported-visit-form.workspace.tsx +743 -0
  307. package/src/components/registration/start-visit-form/start-visit-workspace/location-selector.component.tsx +86 -0
  308. package/src/components/registration/start-visit-form/start-visit-workspace/recommended-visit-type.component.tsx +32 -0
  309. package/src/components/registration/start-visit-form/start-visit-workspace/visit-attribute-type.component.tsx +257 -0
  310. package/src/components/registration/start-visit-form/start-visit-workspace/visit-attribute-type.scss +5 -0
  311. package/src/components/registration/start-visit-form/start-visit-workspace/visit-date-time.component.tsx +193 -0
  312. package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.resource.ts +383 -0
  313. package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.scss +166 -0
  314. package/src/components/registration/start-visit-form/visit-form-workspace/visit-form.workspace.tsx +55 -0
  315. package/src/components/reports/index.ts +10 -9
  316. package/src/components/triage/dashboard.component.tsx +0 -2
  317. package/src/components/triage/index.ts +10 -9
  318. package/src/components/triage/triage.component.tsx +92 -42
  319. package/src/components/triage/triage.resource.ts +56 -50
  320. package/src/components/triage/triage.scss +6 -0
  321. package/src/config-schema.ts +91 -0
  322. package/src/hooks/useServiceQueues.tsx +95 -25
  323. package/src/index.ts +32 -13
  324. package/src/routes.json +53 -254
  325. package/src/shared/orders/OrdersTabs.tsx +8 -3
  326. package/src/shared/patient-chart/patient-chart.resources.ts +8 -12
  327. package/src/shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component.tsx +1 -2
  328. package/src/shared/pin-put/pinput.component.test.tsx +7 -6
  329. package/src/shared/queue/queue-entry/queue-entry-table.component.tsx +99 -88
  330. package/src/shared/queue/queue-entry/queue-entry-table.scss +4 -0
  331. package/src/shared/queue/queue-summary-cards.component.tsx +32 -0
  332. package/src/shared/queue/queue-tab.component.tsx +182 -70
  333. package/src/shared/queue/queue-tab.scss +1 -0
  334. package/src/shared/queue/queue-workflow-context.tsx +90 -0
  335. package/src/shared/tabs/extension-tabs.component.tsx +9 -6
  336. package/src/shared/utils/index.ts +1 -2
  337. package/src/types/index.ts +17 -2
  338. package/translations/am.json +64 -13
  339. package/translations/en.json +59 -8
  340. package/translations/sw.json +58 -7
  341. package/dist/127.js +0 -1
  342. package/dist/200.js +0 -1
  343. package/dist/200.js.map +0 -1
  344. package/dist/24.js +0 -1
  345. package/dist/24.js.map +0 -1
  346. package/dist/267.js +0 -1
  347. package/dist/267.js.map +0 -1
  348. package/dist/285.js +0 -1
  349. package/dist/285.js.map +0 -1
  350. package/dist/329.js +0 -1
  351. package/dist/329.js.map +0 -1
  352. package/dist/40.js +0 -1
  353. package/dist/466.js +0 -1
  354. package/dist/466.js.map +0 -1
  355. package/dist/472.js +0 -66
  356. package/dist/472.js.map +0 -1
  357. package/dist/490.js +0 -1
  358. package/dist/490.js.map +0 -1
  359. package/dist/54.js +0 -1
  360. package/dist/54.js.map +0 -1
  361. package/dist/689.js +0 -1
  362. package/dist/689.js.map +0 -1
  363. package/dist/697.js +0 -1
  364. package/dist/697.js.map +0 -1
  365. package/dist/704.js +0 -1
  366. package/dist/704.js.map +0 -1
  367. package/dist/710.js +0 -1
  368. package/dist/710.js.map +0 -1
  369. package/dist/729.js +0 -17
  370. package/dist/729.js.map +0 -1
  371. package/dist/805.js +0 -37
  372. package/dist/805.js.map +0 -1
  373. package/dist/847.js +0 -1
  374. package/dist/847.js.map +0 -1
  375. package/dist/85.js +0 -1
  376. package/dist/85.js.map +0 -1
  377. package/dist/882.js +0 -1
  378. package/dist/91.js +0 -1
  379. package/dist/91.js.map +0 -1
  380. package/dist/916.js +0 -1
  381. package/dist/994.js +0 -1
  382. package/dist/994.js.map +0 -1
  383. package/dist/998.js +0 -1
  384. package/dist/998.js.map +0 -1
  385. package/jest.config.js +0 -3
  386. package/src/shared/patient-chart/patient-chart.component.tsx +0 -61
  387. package/src/shared/patient-chart/patient-chart.scss +0 -15
  388. package/src/shared/patient-chart/useInitialize.ts +0 -24
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import capitalize from 'lodash-es/capitalize';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import {
@@ -9,13 +9,14 @@ import {
9
9
  ExtensionSlot,
10
10
  useConfig,
11
11
  } from '@openmrs/esm-framework';
12
- import { InlineLoading } from '@carbon/react';
12
+ import { TabsSkeleton } from '@carbon/react';
13
13
 
14
14
  import { useQueues } from '../../hooks/useServiceQueues';
15
15
  import QueueTab from '../../shared/queue/queue-tab.component';
16
+ import QueueSummaryCards, { QueueSummaryCard } from '../../shared/queue/queue-summary-cards.component';
17
+ import { QueueWorkflowProvider, useQueueWorkflowContext } from '../../shared/queue/queue-workflow-context';
16
18
  import styles from './triage.scss';
17
- import { Queue, QueueFilter } from '../../types';
18
- import { useTriageQueuesMetrics } from './triage.resource';
19
+ import { Queue } from '../../types';
19
20
  import { ExpressWorkflowConfig } from '../../config-schema';
20
21
 
21
22
  type TriageProps = {
@@ -38,55 +39,102 @@ export default Triage;
38
39
 
39
40
  const TriageQueueTab: React.FC = () => {
40
41
  const { t } = useTranslation();
41
- const [currQueue, setCurrQueue] = useState<Queue>();
42
- const { queues, isLoading, error } = useQueues();
43
- const [filters, setFilters] = useState<Array<QueueFilter>>([]);
44
42
  const {
45
43
  queueStatusConceptUuids: { finishedStatus, waitingStatus, inServiceStatus },
46
44
  queueServiceConceptUuids,
47
45
  } = useConfig<ExpressWorkflowConfig>();
48
46
 
49
- const triageQueues = queues
50
- .filter(
51
- (queue) =>
52
- queue.service.uuid === queueServiceConceptUuids.triageService &&
53
- !queue.location.display.toLowerCase().includes('mch') &&
54
- queue?.queueRooms?.length > 0,
55
- )
56
- .sort((a, b) => a.name.localeCompare(b.name));
57
- const activeQueue = useMemo(() => currQueue ?? triageQueues[0], [currQueue, triageQueues]);
47
+ const { queues, isLoading: isLoadingQueues, error: errorLoadingQueues } = useQueues();
58
48
 
59
- const {
60
- error: metricsError,
61
- isLoading: isLoadingMetrics,
62
- waitingEntries,
63
- attendedtoEntries,
64
- } = useTriageQueuesMetrics(activeQueue);
65
-
66
- if (isLoadingMetrics) {
67
- return <InlineLoading description={t('loadingQueues', 'Loading queues...')} />;
49
+ const triageQueues = useMemo(
50
+ () =>
51
+ queues
52
+ .filter(
53
+ (queue) =>
54
+ queue.service.uuid === queueServiceConceptUuids.triageService &&
55
+ !queue.location.display.toLowerCase().includes('mch') &&
56
+ queue?.queueRooms?.length > 0,
57
+ )
58
+ .sort((a, b) => a.name.localeCompare(b.name)),
59
+ [queues, queueServiceConceptUuids.triageService],
60
+ );
61
+
62
+ if (isLoadingQueues) {
63
+ return (
64
+ <div className={styles.contentArea}>
65
+ <TabsSkeleton />
66
+ </div>
67
+ );
68
+ }
69
+
70
+ if (errorLoadingQueues) {
71
+ return (
72
+ <div className={styles.contentArea}>
73
+ <ErrorState error={errorLoadingQueues} headerTitle={t('errorLoadingQueues', 'Error loading queues')} />
74
+ </div>
75
+ );
68
76
  }
69
77
 
70
- if (metricsError) {
71
- return <ErrorState error={metricsError} headerTitle={t('errorLoadingQueues', 'Error loading queues')} />;
78
+ if (!triageQueues.length) {
79
+ return <div className={styles.contentArea} />;
72
80
  }
73
- const cards = [
81
+
82
+ return (
83
+ <QueueWorkflowProvider queues={triageQueues}>
84
+ <TriageContent
85
+ triageQueues={triageQueues}
86
+ waitingStatus={waitingStatus}
87
+ finishedStatus={finishedStatus}
88
+ inServiceStatus={inServiceStatus}
89
+ />
90
+ </QueueWorkflowProvider>
91
+ );
92
+ };
93
+
94
+ type TriageContentProps = {
95
+ triageQueues: Queue[];
96
+ waitingStatus: string;
97
+ finishedStatus: string;
98
+ inServiceStatus: string;
99
+ };
100
+
101
+ const TriageContent: React.FC<TriageContentProps> = ({
102
+ triageQueues,
103
+ waitingStatus,
104
+ finishedStatus,
105
+ inServiceStatus,
106
+ }) => {
107
+ const { t } = useTranslation();
108
+ const { queueEntries, setFilters, queueEntriesError } = useQueueWorkflowContext();
109
+
110
+ const waitingEntries = useMemo(
111
+ () => queueEntries.filter((entry) => entry?.status?.uuid === waitingStatus),
112
+ [queueEntries, waitingStatus],
113
+ );
114
+
115
+ const attendedToEntries = useMemo(
116
+ () =>
117
+ queueEntries.filter((entry) => entry?.status?.uuid === inServiceStatus || entry?.status?.uuid === finishedStatus),
118
+ [queueEntries, inServiceStatus, finishedStatus],
119
+ );
120
+
121
+ const cards: Array<QueueSummaryCard> = [
74
122
  {
75
123
  title: t('clientsPatientsWaiting', 'Clients/Patients waiting'),
76
124
  value: waitingEntries.length.toString(),
77
125
  onClick: () => {
78
- setFilters((prevFilters) => [
79
- ...prevFilters.filter((f) => f.key !== 'status'),
126
+ setFilters((prev) => [
127
+ ...prev.filter((f) => f.key !== 'status'),
80
128
  { key: 'status', value: waitingStatus, label: t('waiting', 'Waiting') },
81
129
  ]);
82
130
  },
83
131
  },
84
132
  {
85
133
  title: t('clientsPatientsAttendedTo', 'Clients/Patients attended to'),
86
- value: attendedtoEntries.length.toString(),
134
+ value: attendedToEntries.length.toString(),
87
135
  onClick: () => {
88
- setFilters((prevFilters) => [
89
- ...prevFilters.filter((f) => f.key !== 'status'),
136
+ setFilters((prev) => [
137
+ ...prev.filter((f) => f.key !== 'status'),
90
138
  { key: 'status', value: `${finishedStatus},${inServiceStatus}`, label: t('attendedTo', 'Attended to') },
91
139
  ]);
92
140
  },
@@ -94,14 +142,16 @@ const TriageQueueTab: React.FC = () => {
94
142
  ];
95
143
 
96
144
  return (
97
- <QueueTab
98
- queues={triageQueues}
99
- navigatePath="triage"
100
- usePatientChart
101
- cards={cards}
102
- onTabChanged={setCurrQueue}
103
- filters={filters}
104
- onFiltersChanged={setFilters}
105
- />
145
+ <div className={styles.contentArea}>
146
+ <QueueSummaryCards cards={cards} />
147
+ {queueEntriesError ? (
148
+ <ErrorState
149
+ error={queueEntriesError}
150
+ headerTitle={t('errorLoadingQueueEntries', 'Error loading queue entries')}
151
+ />
152
+ ) : (
153
+ <QueueTab queues={triageQueues} navigatePath="triage" usePatientChart />
154
+ )}
155
+ </div>
106
156
  );
107
157
  };
@@ -1,62 +1,68 @@
1
- import { useConfig } from '@openmrs/esm-framework';
2
1
  import { useMemo } from 'react';
3
- import { ExpressWorkflowConfig } from '../../config-schema';
2
+ import dayjs from 'dayjs';
3
+ import { useConfig } from '@openmrs/esm-framework';
4
+
5
+ import { type ExpressWorkflowConfig } from '../../config-schema';
4
6
  import { useQueueEntries } from '../../hooks/useServiceQueues';
5
- import { Queue } from '../../types';
7
+ import { type Queue } from '../../types';
6
8
 
7
9
  export const useTriageQueuesMetrics = (queue?: Queue) => {
8
- const { queueServiceConceptUuids, queueStatusConceptUuids } = useConfig<ExpressWorkflowConfig>();
9
- const {
10
- queueEntries: waitingEntries,
11
- isLoading: isLoadingWaiting,
12
- error: waitingError,
13
- } = useQueueEntries({
14
- service: [queueServiceConceptUuids.triageService],
15
- statuses: [queueStatusConceptUuids.waitingStatus],
16
- location: queue?.location?.uuid ? [queue.location.uuid] : undefined,
17
- });
18
- const {
19
- queueEntries: inServiceEntries,
20
- isLoading: isLoadingInService,
21
- error: inServiceError,
22
- } = useQueueEntries({
23
- service: [queueServiceConceptUuids.triageService],
24
- statuses: [queueStatusConceptUuids.inServiceStatus],
25
- location: queue?.location?.uuid ? [queue.location.uuid] : undefined,
26
- });
10
+ const { queueStatusConceptUuids } = useConfig<ExpressWorkflowConfig>();
11
+
27
12
  const {
28
- queueEntries: finishedEntries,
29
- isLoading: isLoadingFinished,
30
- error: finishedError,
13
+ queueEntries: allTriageEntries,
14
+ isLoading,
15
+ error,
16
+ isValidating: isValidatingQueueEntries,
31
17
  } = useQueueEntries({
32
- service: [queueServiceConceptUuids.triageService],
33
- statuses: [queueStatusConceptUuids.finishedStatus],
34
- location: queue?.location?.uuid ? [queue.location.uuid] : undefined,
35
- });
36
- const { queueEntries: attendedtoEntries } = useQueueEntries({
37
- service: [queueServiceConceptUuids.triageService],
38
- statuses: [queueStatusConceptUuids.inServiceStatus, queueStatusConceptUuids.finishedStatus],
39
18
  location: queue?.location?.uuid ? [queue.location.uuid] : undefined,
19
+ startedOnOrAfter: dayjs().subtract(24, 'hour').format('YYYY-MM-DD HH:mm:ss'),
40
20
  });
41
21
 
22
+ const queueUuid = queue?.uuid;
23
+
24
+ const waitingEntries = useMemo(
25
+ () =>
26
+ allTriageEntries.filter(
27
+ (entry) => entry?.queue?.uuid === queueUuid && entry?.status?.uuid === queueStatusConceptUuids.waitingStatus,
28
+ ),
29
+ [allTriageEntries, queueUuid, queueStatusConceptUuids.waitingStatus],
30
+ );
31
+
32
+ const inServiceEntries = useMemo(
33
+ () =>
34
+ allTriageEntries.filter(
35
+ (entry) => entry?.queue?.uuid === queueUuid && entry?.status?.uuid === queueStatusConceptUuids.inServiceStatus,
36
+ ),
37
+ [allTriageEntries, queueUuid, queueStatusConceptUuids.inServiceStatus],
38
+ );
39
+
40
+ const finishedEntries = useMemo(
41
+ () =>
42
+ allTriageEntries.filter(
43
+ (entry) => entry?.queue?.uuid === queueUuid && entry?.status?.uuid === queueStatusConceptUuids.finishedStatus,
44
+ ),
45
+ [allTriageEntries, queueUuid, queueStatusConceptUuids.finishedStatus],
46
+ );
47
+
48
+ const attendedToEntries = useMemo(
49
+ () =>
50
+ allTriageEntries.filter(
51
+ (entry) =>
52
+ entry?.queue?.uuid === queueUuid &&
53
+ (entry?.status?.uuid === queueStatusConceptUuids.inServiceStatus ||
54
+ entry?.status?.uuid === queueStatusConceptUuids.finishedStatus),
55
+ ),
56
+ [allTriageEntries, queueUuid, queueStatusConceptUuids.inServiceStatus, queueStatusConceptUuids.finishedStatus],
57
+ );
58
+
42
59
  return {
43
- isLoading: isLoadingFinished || isLoadingInService || isLoadingWaiting,
44
- waitingEntries: useMemo(
45
- () => waitingEntries.filter((entry) => entry?.queue?.uuid === queue?.uuid),
46
- [waitingEntries, queue],
47
- ),
48
- inServiceEntries: useMemo(
49
- () => inServiceEntries.filter((entry) => entry?.queue?.uuid === queue?.uuid),
50
- [inServiceEntries, queue],
51
- ),
52
- finishedEntries: useMemo(
53
- () => finishedEntries.filter((entry) => entry?.queue?.uuid === queue?.uuid),
54
- [finishedEntries, queue],
55
- ),
56
- attendedtoEntries: useMemo(
57
- () => attendedtoEntries.filter((entry) => entry?.queue?.uuid === queue?.uuid),
58
- [attendedtoEntries, queue],
59
- ),
60
- error: finishedError ?? inServiceError ?? waitingError,
60
+ isLoading,
61
+ waitingEntries,
62
+ inServiceEntries,
63
+ finishedEntries,
64
+ attendedToEntries,
65
+ error,
66
+ isValidating: isValidatingQueueEntries,
61
67
  };
62
68
  };
@@ -1,6 +1,7 @@
1
1
  @use '@carbon/layout';
2
2
  @use '@carbon/type';
3
3
  @use '@carbon/colors';
4
+
4
5
  .pageHeader {
5
6
  @include type.type-style('body-compact-02');
6
7
  height: layout.$spacing-12;
@@ -10,3 +11,8 @@
10
11
  background: colors.$white-0;
11
12
  border-bottom: 1px solid colors.$gray-20;
12
13
  }
14
+
15
+ .contentArea {
16
+ padding: layout.$spacing-05;
17
+ min-height: 400px;
18
+ }
@@ -176,6 +176,82 @@ export const configSchema = {
176
176
  _description: 'The UUID of the outpatient visit type.',
177
177
  _default: '3371a4d4-f66f-4454-a86d-92c7b3da990c',
178
178
  },
179
+ inPatientVisitTypeUuid: {
180
+ _type: Type.String,
181
+ _description: 'The UUID of the in-patient visit type.',
182
+ _default: 'a73e2ac6-263b-47fc-99fc-e0f2c09fc914',
183
+ },
184
+ defaultFacilityUrl: {
185
+ _type: Type.String,
186
+ _default: '',
187
+ _description: 'Custom URL to load default facility if it is not in the session',
188
+ },
189
+ offlineVisitTypeUuid: {
190
+ _type: Type.UUID,
191
+ _description: 'The UUID of the visit type to be used for the automatically created offline visits.',
192
+ _default: '',
193
+ },
194
+ showRecommendedVisitTypeTab: {
195
+ _type: Type.Boolean,
196
+ _description: 'Whether start visit form should display recommended visit type tab. Requires `visitTypeResourceUrl`',
197
+ _default: false,
198
+ },
199
+ visitTypeResourceUrl: {
200
+ _type: Type.String,
201
+ _default: '',
202
+ _description: 'Custom URL to load resources required for showing recommended visit types',
203
+ },
204
+ disableChangingVisitLocation: {
205
+ _type: Type.Boolean,
206
+ _description: 'Whether the visit location field in the Start Visit form should be view-only.',
207
+ _default: false,
208
+ },
209
+ visitAttributeTypes: {
210
+ _type: Type.Array,
211
+ _elements: {
212
+ _type: Type.Object,
213
+ uuid: {
214
+ _type: Type.UUID,
215
+ _description: 'UUID of the visit attribute type',
216
+ },
217
+ required: {
218
+ _type: Type.Boolean,
219
+ _description: 'Whether the attribute type field is required or not',
220
+ _default: false,
221
+ },
222
+ displayInThePatientBanner: {
223
+ _type: Type.Boolean,
224
+ _description: "Whether we should show this visit attribute's value in the patient banner",
225
+ _default: true,
226
+ },
227
+ },
228
+ _description: 'List of visit attribute types shown when filling the visit form',
229
+ _default: [
230
+ {
231
+ uuid: '',
232
+ required: false,
233
+ displayInThePatientBanner: true,
234
+ },
235
+ {
236
+ uuid: '',
237
+ required: false,
238
+ displayInThePatientBanner: true,
239
+ },
240
+ ],
241
+ },
242
+ showUpcomingAppointments: {
243
+ _type: Type.Boolean,
244
+ _description: 'Whether start visit form should display upcoming appointments',
245
+ _default: false,
246
+ },
247
+ excludedVisitTypeUuids: {
248
+ _type: Type.Array,
249
+ _elements: {
250
+ _type: Type.UUID,
251
+ },
252
+ _default: ['02b67c47-6071-4091-953d-ad21452e830c'],
253
+ _description: 'List of visit type UUIDs to exclude from the start visit form',
254
+ },
179
255
  };
180
256
 
181
257
  export type ExpressWorkflowConfig = {
@@ -231,4 +307,19 @@ export type ExpressWorkflowConfig = {
231
307
  labourWard: string;
232
308
  };
233
309
  outpatientVisitTypeUuid: string;
310
+ inPatientVisitTypeUuid: string;
311
+ defaultFacilityUrl: string; //done
312
+ offlineVisitTypeUuid: string;
313
+ showRecommendedVisitTypeTab: boolean;
314
+ visitTypeResourceUrl: string;
315
+ disableChangingVisitLocation: boolean;
316
+ restrictByVisitLocationTag: boolean;
317
+ visitAttributeTypes: Array<{
318
+ displayInThePatientBanner: boolean;
319
+ required: boolean;
320
+ showWhenExpression?: string;
321
+ uuid: string;
322
+ }>; // done
323
+ showUpcomingAppointments: boolean; //done
324
+ excludedVisitTypeUuids: Array<string>;
234
325
  };
@@ -1,68 +1,138 @@
1
- import { openmrsFetch, restBaseUrl, useConfig } from '@openmrs/esm-framework';
2
- import dayjs from 'dayjs';
3
1
  import { useMemo } from 'react';
4
- import useSWR from 'swr';
5
- import { ExpressWorkflowConfig } from '../config-schema';
6
- import { Queue, QueueEntry, QueueEntryFilters } from '../types/index';
2
+ import useSWRImmutable from 'swr/immutable';
3
+ import dayjs from 'dayjs';
4
+ import { openmrsFetch, restBaseUrl, useConfig, useOpenmrsPagination } from '@openmrs/esm-framework';
5
+
6
+ import { type ExpressWorkflowConfig } from '../config-schema';
7
+ import { QueueEntriesPagination, type Queue, type QueueEntry, type QueueEntryFilters } from '../types/index';
8
+
9
+ const QUEUE_LIST_REP =
10
+ 'custom:(uuid,display,name,location:(uuid,display),service:(uuid,display),queueRooms:(uuid,display))';
11
+
12
+ const SWR_QUEUE_OPTIONS = {
13
+ dedupingInterval: 5000,
14
+ revalidateOnFocus: false,
15
+ } as const;
7
16
 
8
17
  export const useQueues = () => {
9
- const { data, isLoading, error } = useSWR<{ data: { results: Array<Queue> } }>(
10
- '/ws/rest/v1/queue?v=full',
18
+ const queueListKey = `/ws/rest/v1/queue?v=${encodeURIComponent(QUEUE_LIST_REP)}`;
19
+ const { data, isLoading, error, isValidating } = useSWRImmutable<{ data: { results: Array<Queue> } }>(
20
+ queueListKey,
11
21
  openmrsFetch,
22
+ SWR_QUEUE_OPTIONS,
12
23
  );
13
24
 
14
25
  return {
15
26
  queues: data?.data?.results || [],
16
27
  isLoading,
17
28
  error,
29
+ isValidating,
18
30
  };
19
31
  };
20
32
 
21
- export const useQueueEntries = (filters?: QueueEntryFilters) => {
33
+ export const useQueueEntries = (filters?: QueueEntryFilters, defaultPageSize: number = 10) => {
22
34
  const { outpatientVisitTypeUuid } = useConfig<ExpressWorkflowConfig>();
23
35
  const repString =
24
- 'custom:(uuid,display,queue,status,patient:(uuid,display,person,identifiers:(uuid,display,identifier,identifierType)),visit:(uuid,display,startDatetime,visitType:(uuid,display),encounters:(uuid,display,diagnoses,encounterDatetime,encounterType,obs,encounterProviders,voided),attributes:(uuid,display,value,attributeType)),priority,priorityComment,sortWeight,startedAt,endedAt,locationWaitingFor,queueComingFrom,providerWaitingFor,previousQueueEntry)';
36
+ 'custom:(uuid,queue:(uuid,display,name,location:(uuid,display)),status:(uuid,display),patient:(uuid,person:(uuid,display),identifiers:(uuid,display,identifier,identifierType:(uuid,display))),visit:(uuid,visitType:(uuid),attributes:(uuid,value,attributeType:(uuid))),priority:(uuid,display),priorityComment,startedAt,previousQueueEntry:(uuid,queue:(uuid,display)))';
25
37
 
26
- const buildQueryParams = (filters?: QueueEntryFilters & { status: string[] }): string => {
38
+ const queryString = useMemo(() => {
27
39
  const params = new URLSearchParams();
28
40
  params.append('v', repString);
29
41
 
30
- if (filters) {
31
- Object.entries(filters).forEach(([key, value]) => {
32
- if (value !== undefined && value !== null) {
33
- if (Array.isArray(value)) {
34
- value.forEach((v) => params.append(key, v));
35
- } else {
36
- params.append(key, String(value));
37
- }
42
+ const merged = {
43
+ ...filters,
44
+ status: filters?.statuses ?? [],
45
+ statuses: undefined,
46
+ startedOnOrAfter: filters?.startedOnOrAfter ?? undefined,
47
+ startedOnOrBefore: filters?.startedOnOrBefore ?? undefined,
48
+ queue: filters?.queues ?? [],
49
+ };
50
+ if (merged) {
51
+ Object.entries(merged).forEach(([key, value]) => {
52
+ if (key === 'statuses' || value === undefined || value === null) {
53
+ return;
54
+ }
55
+ if (Array.isArray(value)) {
56
+ [...value].sort((a, b) => String(a).localeCompare(String(b))).forEach((v) => params.append(key, v));
57
+ } else {
58
+ params.append(key, String(value));
38
59
  }
39
60
  });
40
61
  }
41
62
 
42
- if (!filters || filters.isEnded === undefined || filters.isEnded === null) {
63
+ if (filters?.isEnded == null) {
43
64
  params.append('isEnded', 'false');
44
65
  }
45
66
 
46
67
  return params.toString();
47
- };
68
+ }, [
69
+ filters?.location?.join(','),
70
+ filters?.service?.join(','),
71
+ [...(filters?.statuses ?? [])].sort((a, b) => String(a).localeCompare(String(b))).join(','),
72
+ filters?.priorities?.join(','),
73
+ filters?.patient,
74
+ filters?.visit,
75
+ filters?.hasVisit,
76
+ filters?.isEnded,
77
+ filters?.locationsWaitingFor?.join(','),
78
+ filters?.providersWaitingFor?.join(','),
79
+ filters?.queuesComingFrom?.join(','),
80
+ filters?.queues?.join(','),
81
+ ]);
48
82
 
49
- const queryString = buildQueryParams({ ...filters, status: filters?.statuses ?? [], statuses: [] });
50
- const url = `/ws/rest/v1/queue-entry${queryString ? `?${queryString}` : ''}`;
83
+ const url = queryString ? `/ws/rest/v1/queue-entry?${queryString}` : '/ws/rest/v1/queue-entry';
84
+
85
+ const {
86
+ data,
87
+ isLoading,
88
+ isValidating,
89
+ error,
90
+ totalPages,
91
+ totalCount,
92
+ currentPage,
93
+ currentPageSize,
94
+ paginated,
95
+ showNextButton,
96
+ showPreviousButton,
97
+ goTo,
98
+ goToNext,
99
+ goToPrevious,
100
+ } = useOpenmrsPagination<QueueEntry>(url, defaultPageSize, {
101
+ swrConfig: {
102
+ revalidateOnFocus: true,
103
+ keepPreviousData: true,
104
+ },
105
+ });
51
106
 
52
- const { data, isLoading, error } = useSWR<{ data: { results: Array<QueueEntry> } }>(url, openmrsFetch);
53
107
  const queueEntries = useMemo(() => {
54
- return (data?.data?.results ?? [])?.filter((entry) => {
108
+ return (data ?? [])?.filter((entry) => {
55
109
  return (
56
110
  dayjs(entry.startedAt).isAfter(dayjs().subtract(24, 'hour')) &&
57
111
  entry?.visit?.visitType?.uuid === outpatientVisitTypeUuid
58
112
  );
59
113
  });
60
- }, [data?.data?.results, outpatientVisitTypeUuid]);
114
+ }, [data, outpatientVisitTypeUuid]);
115
+
116
+ const pagination: QueueEntriesPagination = {
117
+ totalPages,
118
+ totalCount,
119
+ currentPage,
120
+ currentPageSize,
121
+ paginated,
122
+ showNextButton,
123
+ showPreviousButton,
124
+ goTo,
125
+ goToNext,
126
+ goToPrevious,
127
+ defaultPageSize,
128
+ };
61
129
 
62
130
  return {
63
131
  queueEntries,
64
132
  isLoading,
133
+ isValidating,
65
134
  error,
135
+ pagination,
66
136
  };
67
137
  };
68
138
  export function serveQueueEntry(servicePointName: string, ticketNumber: string, status: string, locationUuid?: string) {
package/src/index.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
2
2
  import { configSchema } from './config-schema';
3
- import CheckinFormExtraExtension from './components/registration/checkin-form-extra/checkin-form-extra.extension';
4
- import { Home } from '@carbon/react/icons';
5
-
6
- import PatientSummaryDashboard from './shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component';
7
- import { createLeftPanelLink } from './shared/dashboard-link/dashboard-link.component';
8
3
 
9
4
  const moduleName = '@kenyaemr/esm-express-workflow-app';
10
5
 
@@ -37,15 +32,39 @@ export const otpVerificationModal = getAsyncLifecycle(
37
32
  () => import('./shared/otp-verification/otp-verification.modal'),
38
33
  options,
39
34
  );
40
- export const checkinFormExtraExtension = getSyncLifecycle(CheckinFormExtraExtension, options);
41
- export const patientSummaryDashboard = getSyncLifecycle(PatientSummaryDashboard, options);
35
+ export const checkinFormExtraExtension = getAsyncLifecycle(
36
+ () => import('./components/registration/checkin-form-extra/checkin-form-extra.extension'),
37
+ options,
38
+ );
39
+ export const patientSummaryDashboard = getAsyncLifecycle(
40
+ () => import('./shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component'),
41
+ options,
42
+ );
43
+
44
+ export const customStartVisitOverflowMenuItem = getAsyncLifecycle(
45
+ () => import('./components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.extension'),
46
+ {
47
+ featureName: 'patient-actions-slot-deceased-button',
48
+ moduleName,
49
+ },
50
+ );
51
+
52
+ export const visitFormWorkspace = getAsyncLifecycle(
53
+ () => import('./components/registration/start-visit-form/visit-form-workspace/visit-form.workspace'),
54
+ options,
55
+ );
42
56
 
43
57
  export const queuesAdminHome = getAsyncLifecycle(() => import('./shared/queue/queues-home.component'), options);
44
- export const homepageDashboardLink = getSyncLifecycle(
45
- createLeftPanelLink({
46
- name: `consultation`,
47
- title: 'Home',
48
- icon: Home,
49
- }),
58
+ export const homepageDashboardLink = getAsyncLifecycle(
59
+ () =>
60
+ Promise.all([import('./shared/dashboard-link/dashboard-link.component'), import('@carbon/react/icons')]).then(
61
+ ([m, icons]) => ({
62
+ default: m.createLeftPanelLink({
63
+ name: 'consultation',
64
+ title: 'Home',
65
+ icon: icons.Home,
66
+ }),
67
+ }),
68
+ ),
50
69
  options,
51
70
  );