@openmrs/esm-ward-app 10.0.2 → 10.0.3-pre.2

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 (363) hide show
  1. package/.turbo/turbo-build.log +4 -3
  2. package/dist/1070.js +1 -0
  3. package/dist/1070.js.map +1 -0
  4. package/dist/1480.js +1 -0
  5. package/dist/1480.js.map +1 -0
  6. package/dist/1646.js +1 -0
  7. package/dist/1646.js.map +1 -0
  8. package/dist/1664.js +1 -0
  9. package/dist/1664.js.map +1 -0
  10. package/dist/1780.js +1 -0
  11. package/dist/1780.js.map +1 -0
  12. package/dist/1789.js +1 -0
  13. package/dist/1789.js.map +1 -0
  14. package/dist/1869.js +1 -0
  15. package/dist/1869.js.map +1 -0
  16. package/dist/1877.js +1 -0
  17. package/dist/1877.js.map +1 -0
  18. package/dist/1978.js +1 -0
  19. package/dist/1978.js.map +1 -0
  20. package/dist/2101.js +1 -0
  21. package/dist/2101.js.map +1 -0
  22. package/dist/2317.js +1 -0
  23. package/dist/2317.js.map +1 -0
  24. package/dist/2416.js +1 -0
  25. package/dist/2416.js.map +1 -0
  26. package/dist/2495.js +1 -0
  27. package/dist/2495.js.map +1 -0
  28. package/dist/282.js +1 -0
  29. package/dist/282.js.map +1 -0
  30. package/dist/2881.js +1 -0
  31. package/dist/2881.js.map +1 -0
  32. package/dist/2898.js +1 -0
  33. package/dist/2898.js.map +1 -0
  34. package/dist/3378.js +1 -0
  35. package/dist/3378.js.map +1 -0
  36. package/dist/3514.js +38 -0
  37. package/dist/3514.js.map +1 -0
  38. package/dist/3720.js +1 -0
  39. package/dist/3720.js.map +1 -0
  40. package/dist/3852.js +1 -0
  41. package/dist/3852.js.map +1 -0
  42. package/dist/3963.js +1 -0
  43. package/dist/3963.js.map +1 -0
  44. package/dist/3989.js +1 -0
  45. package/dist/3989.js.map +1 -0
  46. package/dist/4106.js +1 -0
  47. package/dist/4106.js.map +1 -0
  48. package/dist/4111.js +1 -0
  49. package/dist/4111.js.map +1 -0
  50. package/dist/434.js +1 -0
  51. package/dist/434.js.map +1 -0
  52. package/dist/4348.js +1 -0
  53. package/dist/4348.js.map +1 -0
  54. package/dist/4383.js +1 -0
  55. package/dist/4383.js.map +1 -0
  56. package/dist/4658.js +1 -0
  57. package/dist/4658.js.map +1 -0
  58. package/dist/466.js +1 -0
  59. package/dist/466.js.map +1 -0
  60. package/dist/4928.js +1 -0
  61. package/dist/4928.js.map +1 -0
  62. package/dist/502.js +1 -0
  63. package/dist/502.js.map +1 -0
  64. package/dist/5117.js +1 -0
  65. package/dist/5117.js.map +1 -0
  66. package/dist/5132.js +1 -0
  67. package/dist/5132.js.map +1 -0
  68. package/dist/5145.js +1 -0
  69. package/dist/5145.js.map +1 -0
  70. package/dist/5503.js +1 -0
  71. package/dist/5503.js.map +1 -0
  72. package/dist/5509.js +1 -0
  73. package/dist/5509.js.map +1 -0
  74. package/dist/556.js +1 -0
  75. package/dist/556.js.map +1 -0
  76. package/dist/5576.js +1 -0
  77. package/dist/5576.js.map +1 -0
  78. package/dist/5644.js +1 -0
  79. package/dist/5644.js.map +1 -0
  80. package/dist/5709.js +1 -0
  81. package/dist/5709.js.map +1 -0
  82. package/dist/5773.js +1 -0
  83. package/dist/5773.js.map +1 -0
  84. package/dist/582.js +1 -0
  85. package/dist/582.js.map +1 -0
  86. package/dist/5940.js +1 -0
  87. package/dist/5940.js.map +1 -0
  88. package/dist/6047.js +1 -0
  89. package/dist/6047.js.map +1 -0
  90. package/dist/6174.js +1 -0
  91. package/dist/6174.js.map +1 -0
  92. package/dist/6270.js +1 -0
  93. package/dist/6270.js.map +1 -0
  94. package/dist/6371.js +1 -0
  95. package/dist/6371.js.map +1 -0
  96. package/dist/6377.js +1 -0
  97. package/dist/6377.js.map +1 -0
  98. package/dist/6418.js +1 -0
  99. package/dist/6418.js.map +1 -0
  100. package/dist/6444.js +1 -0
  101. package/dist/6444.js.map +1 -0
  102. package/dist/6508.js +1 -0
  103. package/dist/6508.js.map +1 -0
  104. package/dist/6673.js +11 -0
  105. package/dist/6673.js.map +1 -0
  106. package/dist/6703.js +1 -0
  107. package/dist/6703.js.map +1 -0
  108. package/dist/6724.js +1 -0
  109. package/dist/6724.js.map +1 -0
  110. package/dist/6802.js +1 -0
  111. package/dist/6802.js.map +1 -0
  112. package/dist/689.js +1 -0
  113. package/dist/689.js.map +1 -0
  114. package/dist/6904.js +1 -0
  115. package/dist/6904.js.map +1 -0
  116. package/dist/7045.js +1 -0
  117. package/dist/7045.js.map +1 -0
  118. package/dist/7175.js +1 -0
  119. package/dist/7175.js.map +1 -0
  120. package/dist/7182.js +1 -0
  121. package/dist/7182.js.map +1 -0
  122. package/dist/7249.js +1 -0
  123. package/dist/7249.js.map +1 -0
  124. package/dist/7330.js +1 -0
  125. package/dist/7330.js.map +1 -0
  126. package/dist/7742.js +1 -0
  127. package/dist/7742.js.map +1 -0
  128. package/dist/7912.js +1 -0
  129. package/dist/7912.js.map +1 -0
  130. package/dist/8063.js +1 -0
  131. package/dist/8063.js.map +1 -0
  132. package/dist/833.js +1 -0
  133. package/dist/833.js.map +1 -0
  134. package/dist/8340.js +1 -0
  135. package/dist/8340.js.map +1 -0
  136. package/dist/8358.js +1 -0
  137. package/dist/8358.js.map +1 -0
  138. package/dist/8359.js +1 -0
  139. package/dist/8359.js.map +1 -0
  140. package/dist/8417.js +1 -0
  141. package/dist/8417.js.map +1 -0
  142. package/dist/8424.js +1 -0
  143. package/dist/8424.js.map +1 -0
  144. package/dist/8493.js +1 -0
  145. package/dist/8493.js.map +1 -0
  146. package/dist/85.js +1 -0
  147. package/dist/85.js.map +1 -0
  148. package/dist/8695.js +1 -0
  149. package/dist/8695.js.map +1 -0
  150. package/dist/9011.js +1 -0
  151. package/dist/{6925.js.map → 9011.js.map} +1 -1
  152. package/dist/903.js +1 -0
  153. package/dist/903.js.map +1 -0
  154. package/dist/9061.js +1 -0
  155. package/dist/9061.js.map +1 -0
  156. package/dist/9072.js +1 -0
  157. package/dist/9072.js.map +1 -0
  158. package/dist/9080.js +1 -0
  159. package/dist/9080.js.map +1 -0
  160. package/dist/9427.js +1 -0
  161. package/dist/9427.js.map +1 -0
  162. package/dist/9712.js +1 -0
  163. package/dist/9712.js.map +1 -0
  164. package/dist/9771.js +1 -0
  165. package/dist/9771.js.map +1 -0
  166. package/dist/9806.js +1 -0
  167. package/dist/9806.js.map +1 -0
  168. package/dist/9983.js +1 -0
  169. package/dist/9983.js.map +1 -0
  170. package/dist/main.js +6 -5
  171. package/dist/main.js.map +1 -1
  172. package/dist/openmrs-esm-ward-app.js +6 -5
  173. package/dist/openmrs-esm-ward-app.js.buildmanifest.json +669 -585
  174. package/dist/openmrs-esm-ward-app.js.map +1 -1
  175. package/dist/routes.json +1 -1
  176. package/package.json +3 -2
  177. package/src/action-menu-buttons/order-basket-action-button.component.tsx +3 -2
  178. package/src/beds/empty-bed.component.tsx +1 -1
  179. package/src/beds/ward-bed.component.tsx +6 -2
  180. package/src/ward-patient-card/card-rows/mother-child-row.component.tsx +3 -39
  181. package/src/ward-patient-card/row-elements/ward-mother-or-child.component.tsx +50 -0
  182. package/src/ward-view/maternal-ward/maternal-ward-pending-patients.component.tsx +14 -6
  183. package/src/ward-view/maternal-ward/maternal-ward-view.resource.ts +2 -2
  184. package/src/ward-workspace/admission-request-card/admission-request-card-actions.component.tsx +14 -5
  185. package/src/ward-workspace/admission-request-card/maternal-admission-request-card.component.tsx +136 -0
  186. package/src/ward-workspace/admission-request-card/maternal-admission-request-card.resource.ts +11 -0
  187. package/src/ward-workspace/admit-patient-button.component.tsx +44 -26
  188. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.test.tsx +19 -4
  189. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.workspace.tsx +74 -69
  190. package/src/ward-workspace/cancel-admission-request-workspace/cancel-admission-request.component.tsx +41 -17
  191. package/src/ward-workspace/cancel-admission-request-workspace/cancel-admission-request.workspace.tsx +8 -2
  192. package/src/ward-workspace/create-admission-encounter/create-admission-encounter.workspace.tsx +9 -5
  193. package/src/ward-workspace/patient-transfer-bed-swap/patient-admit-or-transfer-request-form.component.tsx +29 -14
  194. package/src/ward-workspace/patient-transfer-request-workspace/patient-transfer-request.workspace.tsx +6 -1
  195. package/src/ward.resource.ts +4 -0
  196. package/translations/am.json +13 -12
  197. package/translations/ar.json +13 -12
  198. package/translations/ar_SY.json +13 -12
  199. package/translations/bn.json +13 -12
  200. package/translations/cs.json +13 -12
  201. package/translations/de.json +137 -136
  202. package/translations/en.json +13 -12
  203. package/translations/en_US.json +13 -12
  204. package/translations/es.json +13 -12
  205. package/translations/es_MX.json +13 -12
  206. package/translations/fr.json +13 -12
  207. package/translations/he.json +13 -12
  208. package/translations/hi.json +13 -12
  209. package/translations/hi_IN.json +13 -12
  210. package/translations/id.json +13 -12
  211. package/translations/it.json +13 -12
  212. package/translations/ka.json +13 -12
  213. package/translations/km.json +13 -12
  214. package/translations/ku.json +13 -12
  215. package/translations/ky.json +13 -12
  216. package/translations/lg.json +13 -12
  217. package/translations/ne.json +13 -12
  218. package/translations/pl.json +13 -12
  219. package/translations/pt.json +13 -12
  220. package/translations/pt_BR.json +13 -12
  221. package/translations/qu.json +13 -12
  222. package/translations/ro_RO.json +13 -12
  223. package/translations/ru_RU.json +13 -12
  224. package/translations/si.json +13 -12
  225. package/translations/sq.json +13 -12
  226. package/translations/sw.json +13 -12
  227. package/translations/sw_KE.json +13 -12
  228. package/translations/tr.json +13 -12
  229. package/translations/tr_TR.json +13 -12
  230. package/translations/uk.json +13 -12
  231. package/translations/uz.json +13 -12
  232. package/translations/uz@Latn.json +13 -12
  233. package/translations/uz_UZ.json +13 -12
  234. package/translations/vi.json +13 -12
  235. package/translations/zh.json +142 -141
  236. package/translations/zh_CN.json +93 -92
  237. package/translations/zh_TW.json +13 -12
  238. package/dist/1011.js +0 -1
  239. package/dist/1011.js.map +0 -1
  240. package/dist/126.js +0 -1
  241. package/dist/1307.js +0 -1
  242. package/dist/1307.js.map +0 -1
  243. package/dist/1369.js +0 -1
  244. package/dist/1369.js.map +0 -1
  245. package/dist/15.js +0 -1
  246. package/dist/1554.js +0 -1
  247. package/dist/1554.js.map +0 -1
  248. package/dist/1564.js +0 -1
  249. package/dist/1567.js +0 -1
  250. package/dist/1739.js +0 -1
  251. package/dist/1739.js.map +0 -1
  252. package/dist/1845.js +0 -1
  253. package/dist/1895.js +0 -1
  254. package/dist/1895.js.map +0 -1
  255. package/dist/1953.js +0 -1
  256. package/dist/2016.js +0 -1
  257. package/dist/2016.js.map +0 -1
  258. package/dist/2117.js +0 -1
  259. package/dist/2117.js.map +0 -1
  260. package/dist/215.js +0 -1
  261. package/dist/2178.js +0 -1
  262. package/dist/2191.js +0 -1
  263. package/dist/2191.js.map +0 -1
  264. package/dist/239.js +0 -1
  265. package/dist/239.js.map +0 -1
  266. package/dist/2459.js +0 -1
  267. package/dist/2459.js.map +0 -1
  268. package/dist/2566.js +0 -1
  269. package/dist/2586.js +0 -1
  270. package/dist/2586.js.map +0 -1
  271. package/dist/2640.js +0 -1
  272. package/dist/2640.js.map +0 -1
  273. package/dist/2759.js +0 -1
  274. package/dist/3089.js +0 -1
  275. package/dist/3089.js.map +0 -1
  276. package/dist/3230.js +0 -1
  277. package/dist/3441.js +0 -1
  278. package/dist/3565.js +0 -1
  279. package/dist/3571.js +0 -1
  280. package/dist/3571.js.map +0 -1
  281. package/dist/3624.js +0 -1
  282. package/dist/3624.js.map +0 -1
  283. package/dist/3746.js +0 -1
  284. package/dist/3925.js +0 -1
  285. package/dist/3946.js +0 -1
  286. package/dist/3948.js +0 -11
  287. package/dist/3948.js.map +0 -1
  288. package/dist/4285.js +0 -1
  289. package/dist/4285.js.map +0 -1
  290. package/dist/4373.js +0 -1
  291. package/dist/4373.js.map +0 -1
  292. package/dist/4425.js +0 -1
  293. package/dist/4425.js.map +0 -1
  294. package/dist/4675.js +0 -1
  295. package/dist/4675.js.map +0 -1
  296. package/dist/4744.js +0 -1
  297. package/dist/4744.js.map +0 -1
  298. package/dist/4809.js +0 -1
  299. package/dist/4894.js +0 -1
  300. package/dist/4970.js +0 -1
  301. package/dist/4970.js.map +0 -1
  302. package/dist/5130.js +0 -1
  303. package/dist/5187.js +0 -1
  304. package/dist/5490.js +0 -1
  305. package/dist/5490.js.map +0 -1
  306. package/dist/5491.js +0 -1
  307. package/dist/5491.js.map +0 -1
  308. package/dist/5595.js +0 -1
  309. package/dist/5659.js +0 -1
  310. package/dist/5659.js.map +0 -1
  311. package/dist/5961.js +0 -1
  312. package/dist/6026.js +0 -1
  313. package/dist/6026.js.map +0 -1
  314. package/dist/6133.js +0 -1
  315. package/dist/6199.js +0 -1
  316. package/dist/6199.js.map +0 -1
  317. package/dist/6285.js +0 -1
  318. package/dist/6285.js.map +0 -1
  319. package/dist/6296.js +0 -1
  320. package/dist/6296.js.map +0 -1
  321. package/dist/634.js +0 -1
  322. package/dist/634.js.map +0 -1
  323. package/dist/6455.js +0 -1
  324. package/dist/6455.js.map +0 -1
  325. package/dist/6456.js +0 -1
  326. package/dist/6466.js +0 -1
  327. package/dist/6515.js +0 -1
  328. package/dist/6515.js.map +0 -1
  329. package/dist/6613.js +0 -1
  330. package/dist/6783.js +0 -1
  331. package/dist/6925.js +0 -1
  332. package/dist/7073.js +0 -1
  333. package/dist/7073.js.map +0 -1
  334. package/dist/7348.js +0 -1
  335. package/dist/74.js +0 -1
  336. package/dist/74.js.map +0 -1
  337. package/dist/7543.js +0 -1
  338. package/dist/7607.js +0 -1
  339. package/dist/772.js +0 -1
  340. package/dist/8599.js +0 -1
  341. package/dist/8727.js +0 -1
  342. package/dist/8847.js +0 -1
  343. package/dist/892.js +0 -38
  344. package/dist/892.js.map +0 -1
  345. package/dist/9015.js +0 -1
  346. package/dist/906.js +0 -1
  347. package/dist/9065.js +0 -1
  348. package/dist/9071.js +0 -1
  349. package/dist/9071.js.map +0 -1
  350. package/dist/9182.js +0 -1
  351. package/dist/9314.js +0 -1
  352. package/dist/9314.js.map +0 -1
  353. package/dist/9339.js +0 -1
  354. package/dist/9453.js +0 -1
  355. package/dist/9668.js +0 -1
  356. package/dist/9668.js.map +0 -1
  357. package/dist/9727.js +0 -1
  358. package/dist/9727.js.map +0 -1
  359. package/dist/9833.js +0 -1
  360. package/dist/9833.js.map +0 -1
  361. package/dist/9920.js +0 -1
  362. package/dist/9938.js +0 -1
  363. /package/src/ward-patient-card/{card-rows/mother-child-row.scss → row-elements/ward-mother-or-child.scss} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { ActionMenuButton2, AddIcon, ShoppingCartIcon } from '@openmrs/esm-framework';
3
+ import { ActionMenuButton2, AddIcon, ShoppingCartIcon, usePatient } from '@openmrs/esm-framework';
4
4
  import { type WardPatientWorkspaceDefinition } from '../types';
5
5
 
6
6
  /**
@@ -8,6 +8,7 @@ import { type WardPatientWorkspaceDefinition } from '../types';
8
8
  */
9
9
  function WardPatientOrderBasketActionButton({ groupProps: { wardPatient } }: WardPatientWorkspaceDefinition) {
10
10
  const { t } = useTranslation();
11
+ const { patient: fhirPatient } = usePatient(wardPatient.patient.uuid);
11
12
 
12
13
  return (
13
14
  <ActionMenuButton2
@@ -17,7 +18,7 @@ function WardPatientOrderBasketActionButton({ groupProps: { wardPatient } }: War
17
18
  workspaceName: 'ward-patient-order-basket-workspace',
18
19
  windowProps: {
19
20
  patientUuid: wardPatient.patient.uuid,
20
- patient: wardPatient.patient,
21
+ patient: fhirPatient,
21
22
  visitContext: wardPatient.visit,
22
23
  drugOrderWorkspaceName: 'ward-patient-order-basket-add-drug-order-workspace',
23
24
  labOrderWorkspaceName: 'ward-patient-order-basket-add-lab-order-workspace',
@@ -12,7 +12,7 @@ const EmptyBed: React.FC<EmptyBedProps> = ({ bed }) => {
12
12
  const { t } = useTranslation();
13
13
 
14
14
  return (
15
- <div className={styles.emptyBed}>
15
+ <div id={`bed-${bed.bedNumber}`} className={styles.emptyBed}>
16
16
  <span className={`${wardPatientCardStyles.wardPatientBedNumber} ${wardPatientCardStyles.empty}`}>
17
17
  {bed.bedNumber}
18
18
  </span>
@@ -15,7 +15,7 @@ const WardBed: React.FC<WardBedProps> = (props) => {
15
15
  return patientCards?.length > 0 ? <OccupiedBed {...props} /> : <EmptyBed bed={bed} />;
16
16
  };
17
17
 
18
- const OccupiedBed: React.FC<WardBedProps> = ({ patientCards, isLoadingDivider }) => {
18
+ const OccupiedBed: React.FC<WardBedProps> = ({ patientCards, isLoadingDivider, bed }) => {
19
19
  // interlace patient card with bed dividers between each of them
20
20
  const patientCardsWithDividers = patientCards.flatMap((patientCard, index) => {
21
21
  if (index == 0) {
@@ -25,7 +25,11 @@ const OccupiedBed: React.FC<WardBedProps> = ({ patientCards, isLoadingDivider })
25
25
  }
26
26
  });
27
27
 
28
- return <div className={styles.occupiedBed}>{patientCardsWithDividers}</div>;
28
+ return (
29
+ <div id={`bed-${bed.bedNumber}`} className={styles.occupiedBed}>
30
+ {patientCardsWithDividers}
31
+ </div>
32
+ );
29
33
  };
30
34
 
31
35
  export default WardBed;
@@ -1,14 +1,8 @@
1
1
  import React from 'react';
2
- import classNames from 'classnames';
3
- import { BabyIcon, MotherIcon, type Patient, useAppContext } from '@openmrs/esm-framework';
4
- import { type InpatientAdmission, type MaternalWardViewContext } from '../../types';
2
+ import { useAppContext } from '@openmrs/esm-framework';
3
+ import { type MaternalWardViewContext } from '../../types';
5
4
  import { type MaternalWardPatientCardProps } from '../../ward-view/maternal-ward/maternal-ward-patient-card.component';
6
- import WardPatientAge from '../row-elements/ward-patient-age.component';
7
- import WardPatientIdentifier from '../row-elements/ward-patient-identifier.component';
8
- import WardPatientLocation from '../row-elements/ward-patient-location.component';
9
- import WardPatientName from '../row-elements/ward-patient-name.component';
10
- import wardPatientCardStyles from '../ward-patient-card.scss';
11
- import styles from './mother-child-row.scss';
5
+ import MotherOrChild from '../row-elements/ward-mother-or-child.component';
12
6
 
13
7
  /**
14
8
  * This component displays the mother or children of the patient in the patient card. The patient's child is
@@ -51,34 +45,4 @@ const MotherChildRow: React.FC<MaternalWardPatientCardProps> = ({ wardPatient, c
51
45
  );
52
46
  };
53
47
 
54
- interface MotherOrChildProp {
55
- otherPatient: Patient;
56
- otherPatientAdmission: InpatientAdmission;
57
- isOtherPatientTheMother: boolean;
58
- }
59
-
60
- const MotherOrChild: React.FC<MotherOrChildProp> = ({
61
- otherPatient,
62
- otherPatientAdmission,
63
- isOtherPatientTheMother,
64
- }) => {
65
- const Icon = isOtherPatientTheMother ? MotherIcon : BabyIcon;
66
-
67
- return (
68
- <div
69
- key={otherPatient.uuid}
70
- className={classNames(styles.motherOrBabyRow, wardPatientCardStyles.wardPatientCardRow)}>
71
- <div className={styles.motherOrBabyIconDiv}>
72
- <Icon className={styles.motherOrBabyIcon} size={24} />
73
- </div>
74
- <div className={classNames(styles.motherOrBabyRowElementsDiv, wardPatientCardStyles.dotSeparatedChildren)}>
75
- <WardPatientName patient={otherPatient} />
76
- <WardPatientIdentifier id="patient-identifier" patient={otherPatient} />
77
- <WardPatientAge patient={otherPatient} />
78
- <WardPatientLocation inpatientAdmission={otherPatientAdmission} />
79
- </div>
80
- </div>
81
- );
82
- };
83
-
84
48
  export default MotherChildRow;
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import { BabyIcon, MotherIcon, type Patient } from '@openmrs/esm-framework';
4
+ import WardPatientAge from '../row-elements/ward-patient-age.component';
5
+ import WardPatientIdentifier from '../row-elements/ward-patient-identifier.component';
6
+ import WardPatientLocation from '../row-elements/ward-patient-location.component';
7
+ import WardPatientName from '../row-elements/ward-patient-name.component';
8
+ import { type InpatientAdmission } from '../../types';
9
+ import styles from './ward-mother-or-child.scss';
10
+ import wardPatientCardStyles from '../ward-patient-card.scss';
11
+
12
+ interface MotherOrChildProp {
13
+ otherPatient: Patient;
14
+ otherPatientAdmission: InpatientAdmission;
15
+ isOtherPatientTheMother: boolean;
16
+ children?: React.ReactNode;
17
+ }
18
+
19
+ /**
20
+ * A row element that displays a related patient (otherPatient) to the ward patient. The related patient
21
+ * can either be the mother or child of the ward patient.
22
+ * @returns
23
+ */
24
+ const MotherOrChild: React.FC<MotherOrChildProp> = ({
25
+ otherPatient,
26
+ otherPatientAdmission,
27
+ isOtherPatientTheMother,
28
+ children,
29
+ }) => {
30
+ const Icon = isOtherPatientTheMother ? MotherIcon : BabyIcon;
31
+
32
+ return (
33
+ <div key={otherPatient.uuid} className={wardPatientCardStyles.wardPatientCardRow}>
34
+ {children}
35
+ <div className={styles.motherOrBabyRow}>
36
+ <div className={styles.motherOrBabyIconDiv}>
37
+ <Icon className={styles.motherOrBabyIcon} size={24} />
38
+ </div>
39
+ <div className={classNames(styles.motherOrBabyRowElementsDiv, wardPatientCardStyles.dotSeparatedChildren)}>
40
+ <WardPatientName patient={otherPatient} />
41
+ <WardPatientIdentifier id="patient-identifier" patient={otherPatient} />
42
+ <WardPatientAge patient={otherPatient} />
43
+ <WardPatientLocation inpatientAdmission={otherPatientAdmission} />
44
+ </div>
45
+ </div>
46
+ </div>
47
+ );
48
+ };
49
+
50
+ export default MotherOrChild;
@@ -6,7 +6,7 @@ import AdmissionRequestNoteRow from '../../ward-patient-card/card-rows/admission
6
6
  import CodedObsTagsRow from '../../ward-patient-card/card-rows/coded-obs-tags-row.component';
7
7
  import MotherChildRow from '../../ward-patient-card/card-rows/mother-child-row.component';
8
8
  import WardPatientSkeletonText from '../../ward-patient-card/row-elements/ward-patient-skeleton-text.component';
9
- import AdmissionRequestCard from '../../ward-workspace/admission-request-card/admission-request-card.component';
9
+ import MaternalAdmissionRequestCard from '../../ward-workspace/admission-request-card/maternal-admission-request-card.component';
10
10
 
11
11
  function MaternalWardPendingPatients() {
12
12
  const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
@@ -18,6 +18,15 @@ function MaternalWardPendingPatients() {
18
18
  error: errorFetchingInpatientRequests,
19
19
  } = inpatientRequestResponse ?? {};
20
20
 
21
+ const inpatientRequestsOfWardByPatientUuid = inpatientRequests?.reduce(
22
+ (map, inpatientRequest) => {
23
+ const patientUuid = inpatientRequest.patient.uuid;
24
+ map[patientUuid] = inpatientRequest;
25
+ return map;
26
+ },
27
+ {} as Record<string, InpatientRequest>,
28
+ );
29
+
21
30
  return isLoadingInpatientRequests ? (
22
31
  <WardPatientSkeletonText />
23
32
  ) : errorFetchingInpatientRequests ? (
@@ -34,11 +43,10 @@ function MaternalWardPendingPatients() {
34
43
  };
35
44
 
36
45
  return (
37
- <AdmissionRequestCard key={`admission-request-card-${i}`} wardPatient={wardPatient}>
38
- <CodedObsTagsRow id="pregnancy-complications" {...wardPatient} />
39
- <MotherChildRow wardPatient={wardPatient} childrenOfWardPatientInSameBed={[]} />
40
- <AdmissionRequestNoteRow id={'admission-request-note'} wardPatient={wardPatient} />
41
- </AdmissionRequestCard>
46
+ <MaternalAdmissionRequestCard
47
+ key={`admission-request-card-${i}`}
48
+ wardPatient={wardPatient}
49
+ inpatientRequestsOfWardByPatientUuid={inpatientRequestsOfWardByPatientUuid}></MaternalAdmissionRequestCard>
42
50
  );
43
51
  })}
44
52
  </>
@@ -17,14 +17,14 @@ export function useMotherChildrenRelationshipsByPatient(
17
17
  mothers: allWardPatientUuids,
18
18
  requireMotherHasActiveVisit: true,
19
19
  requireChildHasActiveVisit: true,
20
- requireChildBornDuringMothersActiveVisit: true,
20
+ requireChildBornDuringMothersActiveVisit: false,
21
21
  };
22
22
 
23
23
  const getMotherRequestParams: MothersAndChildrenSearchCriteria = {
24
24
  children: allWardPatientUuids,
25
25
  requireMotherHasActiveVisit: true,
26
26
  requireChildHasActiveVisit: true,
27
- requireChildBornDuringMothersActiveVisit: true,
27
+ requireChildBornDuringMothersActiveVisit: false,
28
28
  };
29
29
 
30
30
  const {
@@ -1,22 +1,30 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@carbon/react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { closeWorkspaceGroup2, launchWorkspace2, useLayoutType, useWorkspace2Context } from '@openmrs/esm-framework';
5
- import type { WardPatientCardType, WardPatientWorkspaceProps } from '../../types';
4
+ import { closeWorkspaceGroup2, useLayoutType, useWorkspace2Context } from '@openmrs/esm-framework';
5
+ import type { WardPatient } from '../../types';
6
6
  import AdmitPatientButton from '../admit-patient-button.component';
7
7
  import styles from './admission-request-card.scss';
8
8
 
9
- const AdmissionRequestCardActions: WardPatientCardType = ({ wardPatient }) => {
9
+ interface AdmissionRequestCardActionsProps {
10
+ wardPatient: WardPatient;
11
+ relatedTransferPatients?: WardPatient[];
12
+ }
13
+
14
+ const AdmissionRequestCardActions: React.FC<AdmissionRequestCardActionsProps> = ({
15
+ wardPatient,
16
+ relatedTransferPatients,
17
+ }) => {
10
18
  const { t } = useTranslation();
11
19
  const responsiveSize = useLayoutType() === 'tablet' ? 'lg' : 'md';
12
20
  const { closeWorkspace, launchChildWorkspace } = useWorkspace2Context();
13
21
 
14
22
  const launchPatientTransferForm = () => {
15
- launchChildWorkspace('transfer-elsewhere-workspace', { wardPatient });
23
+ launchChildWorkspace('transfer-elsewhere-workspace', { wardPatient, relatedTransferPatients });
16
24
  };
17
25
 
18
26
  const launchCancelAdmissionForm = () => {
19
- launchChildWorkspace('cancel-admission-request-workspace', { wardPatient });
27
+ launchChildWorkspace('cancel-admission-request-workspace', { wardPatient, relatedTransferPatients });
20
28
  };
21
29
 
22
30
  const isTransfer = wardPatient.inpatientRequest.dispositionType == 'TRANSFER';
@@ -31,6 +39,7 @@ const AdmissionRequestCardActions: WardPatientCardType = ({ wardPatient }) => {
31
39
  </Button>
32
40
  <AdmitPatientButton
33
41
  wardPatient={wardPatient}
42
+ relatedTransferPatients={relatedTransferPatients}
34
43
  dispositionType={wardPatient.inpatientRequest.dispositionType}
35
44
  onAdmitPatientSuccess={async () => {
36
45
  await closeWorkspace({ discardUnsavedChanges: true });
@@ -0,0 +1,136 @@
1
+ import React, { useMemo, useState, type ReactNode } from 'react';
2
+ import { Checkbox, CheckboxGroup } from '@carbon/react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useAppContext } from '@openmrs/esm-framework';
5
+ import { makeWardPatient } from './maternal-admission-request-card.resource';
6
+ import type { InpatientRequest, MaternalWardViewContext, WardPatient } from '../../types';
7
+ import AdmissionRequestCardActions from './admission-request-card-actions.component';
8
+ import AdmissionRequestCardHeader from './admission-request-card-header.component';
9
+ import AdmissionRequestNoteRow from '../../ward-patient-card/card-rows/admission-request-note-row.component';
10
+ import CodedObsTagsRow from '../../ward-patient-card/card-rows/coded-obs-tags-row.component';
11
+ import MotherOrChild from '../../ward-patient-card/row-elements/ward-mother-or-child.component';
12
+ import styles from './admission-request-card.scss';
13
+
14
+ interface MaternalAdmissionRequestCardProps {
15
+ wardPatient: WardPatient;
16
+ children?: ReactNode;
17
+ inpatientRequestsOfWardByPatientUuid: Record<string, InpatientRequest>;
18
+ }
19
+
20
+ const MaternalAdmissionRequestCard: React.FC<MaternalAdmissionRequestCardProps> = ({
21
+ wardPatient,
22
+ children,
23
+ inpatientRequestsOfWardByPatientUuid,
24
+ }) => {
25
+ const { motherChildRelationships } = useAppContext<MaternalWardViewContext>('maternal-ward-view-context') ?? {};
26
+ const [selectedRelatedPatient, setCheckedRelatedPatient] = useState<string[]>([]);
27
+ const { t } = useTranslation();
28
+
29
+ const { childrenByMotherUuid, motherByChildUuid } = motherChildRelationships ?? {};
30
+
31
+ const motherOfPatient = useMemo(
32
+ () => motherByChildUuid?.get(wardPatient.patient.uuid) ?? null,
33
+ [motherByChildUuid, wardPatient.patient.uuid],
34
+ );
35
+
36
+ const childrenOfPatient = useMemo(
37
+ () => childrenByMotherUuid?.get(wardPatient.patient.uuid) ?? [],
38
+ [childrenByMotherUuid, wardPatient.patient.uuid],
39
+ );
40
+
41
+ const relatedPendingWardMother: WardPatient | null = useMemo(() => {
42
+ if (!motherOfPatient) return null;
43
+ const request = inpatientRequestsOfWardByPatientUuid[motherOfPatient.patient.uuid];
44
+ return request ? makeWardPatient(request) : null;
45
+ }, [motherOfPatient, inpatientRequestsOfWardByPatientUuid]);
46
+
47
+ const relatedPendingWardChildren: WardPatient[] = useMemo(() => {
48
+ const wardPatients: WardPatient[] = [];
49
+ for (const child of childrenOfPatient ?? []) {
50
+ const request = inpatientRequestsOfWardByPatientUuid[child.patient.uuid];
51
+ if (request) wardPatients.push(makeWardPatient(request));
52
+ }
53
+ return wardPatients;
54
+ }, [childrenOfPatient, inpatientRequestsOfWardByPatientUuid]);
55
+
56
+ const selectedRelatedWardPatients = useMemo(
57
+ () =>
58
+ [...(relatedPendingWardMother ? [relatedPendingWardMother] : []), ...relatedPendingWardChildren].filter((wp) =>
59
+ selectedRelatedPatient.includes(wp.patient.uuid),
60
+ ),
61
+ [relatedPendingWardMother, relatedPendingWardChildren, selectedRelatedPatient],
62
+ );
63
+
64
+ return (
65
+ <div className={styles.admissionRequestCard}>
66
+ <AdmissionRequestCardHeader {...{ wardPatient }} />
67
+ <CodedObsTagsRow id="pregnancy-complications" {...wardPatient} />
68
+ {motherOfPatient && (
69
+ <MotherOrChild
70
+ otherPatient={motherOfPatient.patient}
71
+ otherPatientAdmission={motherOfPatient.currentAdmission}
72
+ isOtherPatientTheMother={true}>
73
+ {relatedPendingWardMother && (
74
+ <div>
75
+ <CheckboxGroup legendText={''}>
76
+ <Checkbox
77
+ checked={selectedRelatedPatient.includes(motherOfPatient.patient.uuid)}
78
+ className={styles.checkbox}
79
+ id={motherOfPatient.patient.uuid}
80
+ key={'also-transfer-' + motherOfPatient.patient.uuid}
81
+ labelText={
82
+ relatedPendingWardMother.inpatientRequest.dispositionType === 'ADMIT'
83
+ ? t('alsoAdmitOrCancel', 'Also admit / cancel:')
84
+ : t('alsoTransferOrCancel', 'Also transfer / cancel:')
85
+ }
86
+ onChange={(_, { checked, id }) => {
87
+ const currentValue = selectedRelatedPatient;
88
+ setCheckedRelatedPatient(
89
+ checked ? [...currentValue, id] : currentValue.filter((item) => item !== id),
90
+ );
91
+ }}
92
+ />
93
+ </CheckboxGroup>
94
+ </div>
95
+ )}
96
+ </MotherOrChild>
97
+ )}
98
+ {childrenOfPatient?.map((childOfPatient) => (
99
+ <MotherOrChild
100
+ key={childOfPatient.patient.uuid}
101
+ otherPatient={childOfPatient.patient}
102
+ otherPatientAdmission={childOfPatient.currentAdmission}
103
+ isOtherPatientTheMother={false}>
104
+ {relatedPendingWardChildren.some((wp) => wp.patient.uuid === childOfPatient.patient.uuid) && (
105
+ <div>
106
+ <CheckboxGroup legendText={''}>
107
+ <Checkbox
108
+ checked={selectedRelatedPatient.includes(childOfPatient.patient.uuid)}
109
+ className={styles.checkbox}
110
+ id={childOfPatient.patient.uuid}
111
+ key={'also-transfer-' + childOfPatient.patient.uuid}
112
+ labelText={
113
+ relatedPendingWardChildren.find((wp) => wp.patient.uuid === childOfPatient.patient.uuid)
114
+ ?.inpatientRequest.dispositionType === 'ADMIT'
115
+ ? t('alsoAdmitOrCancel', 'Also admit / cancel:')
116
+ : t('alsoTransferOrCancel', 'Also transfer / cancel:')
117
+ }
118
+ onChange={(_, { checked, id }) => {
119
+ const currentValue = selectedRelatedPatient;
120
+ setCheckedRelatedPatient(
121
+ checked ? [...currentValue, id] : currentValue.filter((item) => item !== id),
122
+ );
123
+ }}
124
+ />
125
+ </CheckboxGroup>
126
+ </div>
127
+ )}
128
+ </MotherOrChild>
129
+ ))}
130
+ <AdmissionRequestNoteRow id={'admission-request-note'} wardPatient={wardPatient} />
131
+ <AdmissionRequestCardActions wardPatient={wardPatient} relatedTransferPatients={selectedRelatedWardPatients} />
132
+ </div>
133
+ );
134
+ };
135
+
136
+ export default MaternalAdmissionRequestCard;
@@ -0,0 +1,11 @@
1
+ import { type InpatientRequest, type WardPatient } from '../../types';
2
+
3
+ export function makeWardPatient(request: InpatientRequest): WardPatient {
4
+ return {
5
+ patient: request.patient,
6
+ visit: request.visit,
7
+ bed: null,
8
+ inpatientAdmission: null,
9
+ inpatientRequest: request,
10
+ };
11
+ }
@@ -16,6 +16,8 @@ import { useAdmitPatient } from '../ward.resource';
16
16
  interface AdmitPatientButtonProps {
17
17
  wardPatient: WardPatient;
18
18
 
19
+ relatedTransferPatients?: WardPatient[];
20
+
19
21
  /**
20
22
  * whether to create an admit or transfer encounter for the given patient
21
23
  */
@@ -26,6 +28,7 @@ interface AdmitPatientButtonProps {
26
28
 
27
29
  const AdmitPatientButton: React.FC<AdmitPatientButtonProps> = ({
28
30
  wardPatient,
31
+ relatedTransferPatients,
29
32
  onAdmitPatientSuccess,
30
33
  disabled,
31
34
  dispositionType,
@@ -39,7 +42,8 @@ const AdmitPatientButton: React.FC<AdmitPatientButtonProps> = ({
39
42
  const [isAdmitting, setIsAdmitting] = useState(false);
40
43
  const { launchChildWorkspace } = useWorkspace2Context();
41
44
 
42
- const launchPatientAdmissionForm = () => launchChildWorkspace('admit-patient-form-workspace', { wardPatient });
45
+ const launchPatientAdmissionForm = () =>
46
+ launchChildWorkspace('admit-patient-form-workspace', { wardPatient, relatedTransferPatients });
43
47
 
44
48
  const isBedManagementModuleInstalled = useFeatureFlag('bedmanagement-module');
45
49
 
@@ -51,45 +55,59 @@ const AdmitPatientButton: React.FC<AdmitPatientButtonProps> = ({
51
55
  launchPatientAdmissionForm();
52
56
  } else {
53
57
  setIsAdmitting(true);
54
- try {
55
- const response = await admitPatient(patient, dispositionType, visit.uuid);
56
- await wardPatientGroupDetails?.mutate?.();
57
- if (response && response?.ok) {
58
+ const allPatientsToAdmit = [wardPatient, ...(relatedTransferPatients ?? [])];
59
+ const results = await Promise.allSettled(
60
+ allPatientsToAdmit.map((wp) =>
61
+ admitPatient(wp.patient, wp.inpatientRequest?.dispositionType ?? dispositionType, wp.visit.uuid),
62
+ ),
63
+ );
64
+ await wardPatientGroupDetails?.mutate?.();
65
+
66
+ results.forEach((result, i) => {
67
+ const wp = allPatientsToAdmit[i];
68
+ const patientName = wp.patient.person.preferredName.display;
69
+ const wpDispositionType = wp.inpatientRequest?.dispositionType ?? dispositionType;
70
+ if (result.status === 'fulfilled') {
58
71
  showSnackbar({
59
72
  kind: 'success',
60
73
  title:
61
- dispositionType === 'ADMIT'
74
+ wpDispositionType === 'ADMIT'
62
75
  ? t('patientAdmittedSuccessfully', 'Patient admitted successfully')
63
76
  : t('patientTransferredSuccessfully', 'Patient transferred successfully'),
64
77
  subtitle:
65
- dispositionType === 'ADMIT'
66
- ? t('patientAdmittedToLocation', 'Patient admitted successfully to {{location}}', {
78
+ wpDispositionType === 'ADMIT'
79
+ ? t('patientAdmittedToLocation', '{{patientName}} admitted successfully to {{location}}', {
80
+ patientName,
67
81
  location: location?.display,
68
82
  })
69
- : t('patientTransferredToLocation', 'Patient transferred successfully to {{location}}', {
83
+ : t('patientTransferredToLocation', '{{patientName}} transferred successfully to {{location}}', {
84
+ patientName,
70
85
  location: location?.display,
71
86
  }),
72
87
  });
88
+ } else {
89
+ // TODO: better way to handle / display error messages
90
+ // https://openmrs.atlassian.net/browse/O3-5423
91
+ const err = result.reason;
92
+ const errorMessage =
93
+ err?.responseBody?.error?.globalErrors?.[0]?.message ??
94
+ err?.message ??
95
+ t('unknownError', 'An unknown error occurred');
96
+ showSnackbar({
97
+ kind: 'error',
98
+ title:
99
+ wpDispositionType === 'ADMIT'
100
+ ? t('errorAdmittingPatient', 'Failed to admit {{patientName}}', { patientName })
101
+ : t('errorTransferringPatient', 'Failed to transfer {{patientName}}', { patientName }),
102
+ subtitle: errorMessage,
103
+ });
73
104
  }
105
+ });
106
+
107
+ if (results.some((r) => r.status === 'fulfilled')) {
74
108
  onAdmitPatientSuccess();
75
- } catch (err) {
76
- // TODO: better way to handle / display error messages
77
- // https://openmrs.atlassian.net/browse/O3-5423
78
- const errorMessage =
79
- err?.responseBody?.error?.globalErrors?.[0]?.message ??
80
- err.message ??
81
- t('unknownError', 'An unknown error occurred');
82
- showSnackbar({
83
- kind: 'error',
84
- title:
85
- dispositionType === 'ADMIT'
86
- ? t('errrorAdmitingPatient', 'Failed to admit patient')
87
- : t('errorTransferringPatient', 'Failed to transfer patient'),
88
- subtitle: errorMessage,
89
- });
90
- } finally {
91
- setIsAdmitting(false);
92
109
  }
110
+ setIsAdmitting(false);
93
111
  }
94
112
  };
95
113
 
@@ -13,7 +13,12 @@ import { renderWithSwr } from 'tools';
13
13
  import { mockWardPatientGroupDetails, mockWardViewContext } from '../../../mock';
14
14
  import { useAssignedBedByPatient } from '../../hooks/useAssignedBedByPatient';
15
15
  import type { WardPatient, WardPatientWorkspaceProps, WardViewContext } from '../../types';
16
- import { assignPatientToBed, removePatientFromBed, useAdmitPatient } from '../../ward.resource';
16
+ import {
17
+ assignPatientToBed,
18
+ getAssignedBedByPatient,
19
+ removePatientFromBed,
20
+ useAdmitPatient,
21
+ } from '../../ward.resource';
17
22
  import AdmitPatientFormWorkspace from './admit-patient-form.workspace';
18
23
  import useWardLocation from '../../hooks/useWardLocation';
19
24
 
@@ -43,6 +48,7 @@ jest.mock('../../ward.resource', () => ({
43
48
  useAdmitPatient: jest.fn(),
44
49
  assignPatientToBed: jest.fn(),
45
50
  removePatientFromBed: jest.fn(),
51
+ getAssignedBedByPatient: jest.fn(),
46
52
  }));
47
53
 
48
54
  const mockedUseWardLocation = jest.mocked(useWardLocation);
@@ -53,6 +59,7 @@ const mockedUseAssignedBedByPatient = jest.mocked(useAssignedBedByPatient);
53
59
  const mockedAssignPatientToBed = jest.mocked(assignPatientToBed);
54
60
  const mockedRemovePatientFromBed = jest.mocked(removePatientFromBed);
55
61
  const mockedUseAdmitPatient = jest.mocked(useAdmitPatient);
62
+ const mockedGetAssignedBedByPatient = jest.mocked(getAssignedBedByPatient);
56
63
 
57
64
  jest.mocked(useAppContext<WardViewContext>).mockReturnValue(mockWardViewContext);
58
65
 
@@ -83,6 +90,7 @@ const mockWorkspaceProps: Workspace2DefinitionProps<WardPatientWorkspaceProps, {
83
90
  workspaceName: '',
84
91
  windowName: '',
85
92
  isRootWorkspace: false,
93
+ showActionMenu: false,
86
94
  };
87
95
 
88
96
  function renderAdmissionForm() {
@@ -146,6 +154,13 @@ describe('Testing AdmitPatientForm', () => {
146
154
  mockedRemovePatientFromBed.mockResolvedValue({
147
155
  ok: true,
148
156
  });
157
+
158
+ // @ts-ignore - we only need the data key for now
159
+ mockedGetAssignedBedByPatient.mockResolvedValue({
160
+ data: {
161
+ results: [{ bedId: 1 }],
162
+ },
163
+ });
149
164
  });
150
165
 
151
166
  it('should render admit patient form', async () => {
@@ -213,7 +228,7 @@ describe('Testing AdmitPatientForm', () => {
213
228
  await user.click(admitButton);
214
229
  expect(mockedShowSnackbar).toHaveBeenCalledWith({
215
230
  kind: 'error',
216
- title: 'Failed to admit patient',
231
+ title: 'Failed to admit Alice Johnson',
217
232
  subtitle: 'Failed to create encounter',
218
233
  });
219
234
  });
@@ -231,7 +246,7 @@ describe('Testing AdmitPatientForm', () => {
231
246
  expect(mockedShowSnackbar).toHaveBeenCalledWith({
232
247
  kind: 'warning',
233
248
  title: 'Patient admitted successfully',
234
- subtitle: 'Patient admitted successfully but fail to assign bed to patient',
249
+ subtitle: 'Alice Johnson admitted successfully but failed to assign bed',
235
250
  });
236
251
  });
237
252
 
@@ -245,7 +260,7 @@ describe('Testing AdmitPatientForm', () => {
245
260
  expect(mockedRemovePatientFromBed).toHaveBeenCalledWith(1, mockPatientAlice.uuid);
246
261
  expect(mockedShowSnackbar).toHaveBeenCalledWith({
247
262
  kind: 'success',
248
- subtitle: 'Patient admitted successfully to Inpatient Ward',
263
+ subtitle: 'Alice Johnson admitted successfully to Inpatient Ward',
249
264
  title: 'Patient admitted successfully',
250
265
  });
251
266
  });