@kenyaemr/esm-morgue-app 5.4.4-pre.98 → 5.4.5-pre.16

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 (266) hide show
  1. package/package.json +3 -3
  2. package/src/bed/components/deceased-patient-status-footer.component.tsx +1 -1
  3. package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +1 -0
  4. package/src/config-schema.ts +8 -2
  5. package/src/dashboard.meta.ts +1 -1
  6. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +19 -0
  7. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +21 -28
  8. package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +20 -0
  9. package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +22 -27
  10. package/src/forms/swap-compartment-workspace/swap-unit.scss +20 -0
  11. package/src/forms/swap-compartment-workspace/swap-unit.workspace.tsx +10 -15
  12. package/src/index.ts +2 -2
  13. package/src/left-panel/morgue-left-panel-link.component.tsx +3 -1
  14. package/src/mark-patient-deceased-extension/overflow-menu-item/mark-patient-deceased-overflow.extension.tsx +10 -2
  15. package/src/modals/mortuary-gate-pass/print-preview-confirmation.modal.tsx +10 -22
  16. package/src/routes.json +5 -1
  17. package/translations/am.json +163 -0
  18. package/translations/en.json +163 -0
  19. package/translations/fr.json +211 -31
  20. package/translations/sw.json +163 -0
  21. package/.turbo/turbo-build.log +0 -6
  22. package/dist/1074.js +0 -1
  23. package/dist/1074.js.map +0 -1
  24. package/dist/1190.js +0 -1
  25. package/dist/1190.js.map +0 -1
  26. package/dist/12.js +0 -17
  27. package/dist/12.js.map +0 -1
  28. package/dist/1272.js +0 -1
  29. package/dist/1272.js.map +0 -1
  30. package/dist/1285.js +0 -1
  31. package/dist/1285.js.map +0 -1
  32. package/dist/1288.js +0 -1
  33. package/dist/1288.js.map +0 -1
  34. package/dist/1311.js +0 -1
  35. package/dist/1311.js.map +0 -1
  36. package/dist/1374.js +0 -1
  37. package/dist/1374.js.map +0 -1
  38. package/dist/1402.js +0 -1
  39. package/dist/1402.js.map +0 -1
  40. package/dist/1462.js +0 -1
  41. package/dist/1462.js.map +0 -1
  42. package/dist/1469.js +0 -1
  43. package/dist/1469.js.map +0 -1
  44. package/dist/1506.js +0 -13
  45. package/dist/1506.js.map +0 -1
  46. package/dist/1772.js +0 -1
  47. package/dist/1772.js.map +0 -1
  48. package/dist/1889.js +0 -1
  49. package/dist/1889.js.map +0 -1
  50. package/dist/1972.js +0 -1
  51. package/dist/1972.js.map +0 -1
  52. package/dist/1981.js +0 -1
  53. package/dist/1981.js.map +0 -1
  54. package/dist/1990.js +0 -1
  55. package/dist/1990.js.map +0 -1
  56. package/dist/2016.js +0 -1
  57. package/dist/2016.js.map +0 -1
  58. package/dist/2153.js +0 -1
  59. package/dist/2153.js.map +0 -1
  60. package/dist/216.js +0 -1
  61. package/dist/216.js.map +0 -1
  62. package/dist/2252.js +0 -1
  63. package/dist/2252.js.map +0 -1
  64. package/dist/2270.js +0 -1
  65. package/dist/2270.js.map +0 -1
  66. package/dist/2294.js +0 -1
  67. package/dist/2294.js.map +0 -1
  68. package/dist/2345.js +0 -1
  69. package/dist/2345.js.map +0 -1
  70. package/dist/235.js +0 -1
  71. package/dist/235.js.map +0 -1
  72. package/dist/2441.js +0 -1
  73. package/dist/2441.js.map +0 -1
  74. package/dist/2500.js +0 -1
  75. package/dist/2500.js.map +0 -1
  76. package/dist/251.js +0 -1
  77. package/dist/251.js.map +0 -1
  78. package/dist/2567.js +0 -1
  79. package/dist/2567.js.map +0 -1
  80. package/dist/257.js +0 -1
  81. package/dist/257.js.map +0 -1
  82. package/dist/2584.js +0 -1
  83. package/dist/2584.js.map +0 -1
  84. package/dist/2586.js +0 -1
  85. package/dist/2586.js.map +0 -1
  86. package/dist/2625.js +0 -1
  87. package/dist/2625.js.map +0 -1
  88. package/dist/2652.js +0 -1
  89. package/dist/2652.js.map +0 -1
  90. package/dist/2685.js +0 -1
  91. package/dist/2685.js.map +0 -1
  92. package/dist/2724.js +0 -1
  93. package/dist/2724.js.map +0 -1
  94. package/dist/2731.js +0 -1
  95. package/dist/2731.js.map +0 -1
  96. package/dist/2948.js +0 -1
  97. package/dist/2948.js.map +0 -1
  98. package/dist/2970.js +0 -1
  99. package/dist/2970.js.map +0 -1
  100. package/dist/3089.js +0 -1
  101. package/dist/3089.js.map +0 -1
  102. package/dist/3190.js +0 -1
  103. package/dist/3190.js.map +0 -1
  104. package/dist/3293.js +0 -1
  105. package/dist/3293.js.map +0 -1
  106. package/dist/3548.js +0 -1
  107. package/dist/3548.js.map +0 -1
  108. package/dist/3571.js +0 -1
  109. package/dist/3571.js.map +0 -1
  110. package/dist/3691.js +0 -1
  111. package/dist/3691.js.map +0 -1
  112. package/dist/3735.js +0 -1
  113. package/dist/3735.js.map +0 -1
  114. package/dist/3798.js +0 -1
  115. package/dist/3798.js.map +0 -1
  116. package/dist/3816.js +0 -1
  117. package/dist/3816.js.map +0 -1
  118. package/dist/3906.js +0 -1
  119. package/dist/3906.js.map +0 -1
  120. package/dist/3963.js +0 -1
  121. package/dist/3963.js.map +0 -1
  122. package/dist/405.js +0 -1
  123. package/dist/405.js.map +0 -1
  124. package/dist/4282.js +0 -1
  125. package/dist/4282.js.map +0 -1
  126. package/dist/4296.js +0 -1
  127. package/dist/4296.js.map +0 -1
  128. package/dist/4337.js +0 -1
  129. package/dist/4337.js.map +0 -1
  130. package/dist/4716.js +0 -1
  131. package/dist/4716.js.map +0 -1
  132. package/dist/4735.js +0 -1
  133. package/dist/4735.js.map +0 -1
  134. package/dist/4744.js +0 -1
  135. package/dist/4744.js.map +0 -1
  136. package/dist/4813.js +0 -2
  137. package/dist/4813.js.map +0 -1
  138. package/dist/4827.js +0 -1
  139. package/dist/4827.js.map +0 -1
  140. package/dist/4858.js +0 -1
  141. package/dist/4858.js.map +0 -1
  142. package/dist/487.js +0 -1
  143. package/dist/487.js.map +0 -1
  144. package/dist/4970.js +0 -1
  145. package/dist/4970.js.map +0 -1
  146. package/dist/5202.js +0 -1
  147. package/dist/5202.js.map +0 -1
  148. package/dist/5234.js +0 -1
  149. package/dist/5234.js.map +0 -1
  150. package/dist/5386.js +0 -1
  151. package/dist/5386.js.map +0 -1
  152. package/dist/5490.js +0 -1
  153. package/dist/5490.js.map +0 -1
  154. package/dist/552.js +0 -1
  155. package/dist/552.js.map +0 -1
  156. package/dist/5592.js +0 -1
  157. package/dist/5592.js.map +0 -1
  158. package/dist/5669.js +0 -1
  159. package/dist/5669.js.map +0 -1
  160. package/dist/606.js +0 -1
  161. package/dist/606.js.map +0 -1
  162. package/dist/6092.js +0 -1
  163. package/dist/6092.js.map +0 -1
  164. package/dist/6178.js +0 -1
  165. package/dist/6178.js.map +0 -1
  166. package/dist/6258.js +0 -1
  167. package/dist/6258.js.map +0 -1
  168. package/dist/6456.js +0 -1
  169. package/dist/6466.js +0 -3
  170. package/dist/6466.js.map +0 -1
  171. package/dist/6492.js +0 -1
  172. package/dist/6492.js.map +0 -1
  173. package/dist/6675.js +0 -1
  174. package/dist/6675.js.map +0 -1
  175. package/dist/6676.js +0 -1
  176. package/dist/6676.js.map +0 -1
  177. package/dist/7005.js +0 -1
  178. package/dist/7005.js.map +0 -1
  179. package/dist/7160.js +0 -1
  180. package/dist/7160.js.map +0 -1
  181. package/dist/7201.js +0 -1
  182. package/dist/7201.js.map +0 -1
  183. package/dist/7210.js +0 -1
  184. package/dist/7210.js.map +0 -1
  185. package/dist/7234.js +0 -1
  186. package/dist/7234.js.map +0 -1
  187. package/dist/7261.js +0 -1
  188. package/dist/7261.js.map +0 -1
  189. package/dist/7326.js +0 -1
  190. package/dist/7336.js +0 -1
  191. package/dist/7336.js.map +0 -1
  192. package/dist/7463.js +0 -1
  193. package/dist/7463.js.map +0 -1
  194. package/dist/7545.js +0 -1
  195. package/dist/7545.js.map +0 -1
  196. package/dist/7607.js +0 -1
  197. package/dist/7717.js +0 -1
  198. package/dist/7717.js.map +0 -1
  199. package/dist/7737.js +0 -1
  200. package/dist/7737.js.map +0 -1
  201. package/dist/7739.js +0 -1
  202. package/dist/7739.js.map +0 -1
  203. package/dist/7765.js +0 -1
  204. package/dist/7765.js.map +0 -1
  205. package/dist/7769.js +0 -1
  206. package/dist/7769.js.map +0 -1
  207. package/dist/7785.js +0 -1
  208. package/dist/7785.js.map +0 -1
  209. package/dist/7819.js +0 -1
  210. package/dist/7819.js.map +0 -1
  211. package/dist/7820.js +0 -1
  212. package/dist/7820.js.map +0 -1
  213. package/dist/7844.js +0 -1
  214. package/dist/7844.js.map +0 -1
  215. package/dist/7874.js +0 -1
  216. package/dist/7874.js.map +0 -1
  217. package/dist/7971.js +0 -1
  218. package/dist/7971.js.map +0 -1
  219. package/dist/8159.js +0 -7
  220. package/dist/8159.js.map +0 -1
  221. package/dist/8244.js +0 -1
  222. package/dist/8244.js.map +0 -1
  223. package/dist/845.js +0 -1
  224. package/dist/845.js.map +0 -1
  225. package/dist/8570.js +0 -1
  226. package/dist/8570.js.map +0 -1
  227. package/dist/8670.js +0 -1
  228. package/dist/8670.js.map +0 -1
  229. package/dist/87.js +0 -1
  230. package/dist/87.js.map +0 -1
  231. package/dist/8727.js +0 -1
  232. package/dist/8828.js +0 -1
  233. package/dist/8828.js.map +0 -1
  234. package/dist/8860.js +0 -1
  235. package/dist/8860.js.map +0 -1
  236. package/dist/9124.js +0 -1
  237. package/dist/9124.js.map +0 -1
  238. package/dist/913.js +0 -1
  239. package/dist/913.js.map +0 -1
  240. package/dist/9182.js +0 -1
  241. package/dist/921.js +0 -1
  242. package/dist/921.js.map +0 -1
  243. package/dist/9404.js +0 -1
  244. package/dist/9404.js.map +0 -1
  245. package/dist/9406.js +0 -1
  246. package/dist/9406.js.map +0 -1
  247. package/dist/9446.js +0 -1
  248. package/dist/9446.js.map +0 -1
  249. package/dist/9449.js +0 -1
  250. package/dist/9449.js.map +0 -1
  251. package/dist/9566.js +0 -5
  252. package/dist/9566.js.map +0 -1
  253. package/dist/9641.js +0 -1
  254. package/dist/9641.js.map +0 -1
  255. package/dist/9801.js +0 -1
  256. package/dist/9801.js.map +0 -1
  257. package/dist/9835.js +0 -11
  258. package/dist/9835.js.map +0 -1
  259. package/dist/9938.js +0 -1
  260. package/dist/9938.js.map +0 -1
  261. package/dist/kenyaemr-esm-morgue-app.js +0 -5
  262. package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +0 -3398
  263. package/dist/kenyaemr-esm-morgue-app.js.map +0 -1
  264. package/dist/main.js +0 -5
  265. package/dist/main.js.map +0 -1
  266. package/dist/routes.json +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-morgue-app",
3
- "version": "5.4.4-pre.98",
3
+ "version": "5.4.5-pre.16",
4
4
  "description": "morgue app for KenyaEMR",
5
5
  "keywords": [
6
6
  "openmrs"
@@ -22,7 +22,7 @@
22
22
  "build": "rspack --mode=production",
23
23
  "coverage": "echo \"Jest has been removed; no unit test runner is configured\" && exit 0",
24
24
  "debug": "npm run serve",
25
- "extract-translations": "i18next 'src/**/*.component.tsx' 'src/index.ts' --config ../../tools/i18next-parser.config.js",
25
+ "extract-translations": "i18next 'src/**/*.{ts,tsx}' --config ../../tools/i18next-parser.config.js",
26
26
  "lint": "eslint src --ext ts,tsx",
27
27
  "serve": "rspack serve --mode=development",
28
28
  "start": "openmrs develop",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "stableVersion": "5.4.3"
49
+ "stableVersion": "5.4.4"
50
50
  }
@@ -3,7 +3,7 @@ import { Tag } from '@carbon/react';
3
3
  import styles from '../bed.scss';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { type EnhancedPatient } from '../../types';
6
- import { type Visit } from '@openmrs/esm-framework/src';
6
+ import { type Visit } from '@openmrs/esm-framework';
7
7
  interface PatientStatusFooterProps {
8
8
  patient: EnhancedPatient;
9
9
  isAdmitted: boolean;
@@ -159,6 +159,7 @@ const AwaitingBedLineListView: React.FC<AwaitingBedLineListViewProps> = ({
159
159
  });
160
160
 
161
161
  mutated?.();
162
+ dispose();
162
163
  } catch (error) {
163
164
  showSnackbar({
164
165
  kind: 'error',
@@ -100,12 +100,12 @@ export const configSchema = {
100
100
  autopsyFormUuid: {
101
101
  _type: Type.String,
102
102
  _description: 'UUID for autopsy form',
103
- _default: '2b61a73-4971-4fc0-b20b-9a30176317e2',
103
+ _default: '016beec1-edff-4293-b3ed-817c7dddaa93',
104
104
  },
105
105
  autopsyEncounterFormUuid: {
106
106
  _type: Type.String,
107
107
  _description: 'Encounter UUID for autopsy',
108
- _default: '465a92f2-baf8-42e9-9612-53064be868e8',
108
+ _default: '32b61a73-4971-4fc0-b20b-9a30176317e2',
109
109
  },
110
110
  courtOrderCaseNumberUuid: {
111
111
  _type: Type.String,
@@ -289,6 +289,11 @@ export const configSchema = {
289
289
  _default: 'dfacd928-0370-4315-99d7-6ec1c9f7ae76',
290
290
  _description: 'UUID for the patient Opennmrs identifier type to display',
291
291
  },
292
+ paymentMethods: {
293
+ _type: Type.Array,
294
+ _description: 'List of payment methods used when printing gatepass',
295
+ _default: ['Cash', 'Cheque', 'SHA', 'Scheme', 'M.R.M'],
296
+ },
292
297
  };
293
298
 
294
299
  export interface BillingConfig {
@@ -362,4 +367,5 @@ export type ConfigObject = {
362
367
  mortuaryNotUrgentPriorityUuid: string;
363
368
  mortalityEncounterTypeUuid: string;
364
369
  patientIdentifierTypeUuid: string;
370
+ paymentMethods: Array<string>;
365
371
  };
@@ -1,5 +1,5 @@
1
1
  export const mortuaryDashboardMeta = {
2
2
  name: 'mortuary',
3
- title: 'Mortuary',
3
+ title: 'mortuary',
4
4
  path: 'mortuary',
5
5
  };
@@ -27,6 +27,25 @@
27
27
  .buttonContainer {
28
28
  max-width: 50%;
29
29
  }
30
+ .buttonSet {
31
+ display: grid;
32
+ grid-template-columns: 1fr 1fr;
33
+ width: 100%;
34
+ margin-top: auto;
35
+
36
+ :global(.cds--btn) {
37
+ max-width: none;
38
+ width: 100%;
39
+ display: inline-flex;
40
+ justify-content: center;
41
+ align-items: center;
42
+ }
43
+
44
+ &.tablet {
45
+ padding: layout.$spacing-04 layout.$spacing-05;
46
+ background-color: colors.$white;
47
+ }
48
+ }
30
49
  .inlineLoading {
31
50
  display: flex;
32
51
  align-items: center;
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import {
3
3
  Button,
4
4
  ButtonSet,
@@ -71,7 +71,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
71
71
  const { t } = useTranslation();
72
72
  const isTablet = useLayoutType() === 'tablet';
73
73
  const [searchTerm, setSearchTerm] = useState('');
74
- const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
75
74
  const { time: defaultTime, period: defaultPeriod } = getCurrentTime();
76
75
  const config = useConfig<ConfigObject>();
77
76
 
@@ -141,6 +140,10 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
141
140
  },
142
141
  });
143
142
 
143
+ const closeWorkspaceWithSavedChanges = () => {
144
+ closeWorkspace({ discardUnsavedChanges: true });
145
+ };
146
+
144
147
  const placeOfDeath = watch('placeOfDeath');
145
148
  const deadBodyPreservation = watch('deadBodyPreservation');
146
149
  const paymentMethodObservable = watch('paymentMethod');
@@ -189,6 +192,7 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
189
192
  if (isSubmitting) {
190
193
  return;
191
194
  }
195
+
192
196
  const { admissionEncounter, compartment } = await admitBody(patientUuid, data);
193
197
 
194
198
  if (admissionEncounter && compartment) {
@@ -215,7 +219,7 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
215
219
  kind: 'success',
216
220
  });
217
221
  mutated();
218
- closeWorkspace();
222
+ closeWorkspaceWithSavedChanges();
219
223
  } catch (error) {
220
224
  showSnackbar({
221
225
  title: t('error', 'Error'),
@@ -225,12 +229,8 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
225
229
  }
226
230
  };
227
231
 
228
- useEffect(() => {
229
- setHasUnsavedChanges(isDirty);
230
- }, [isDirty, setHasUnsavedChanges]);
231
-
232
232
  return (
233
- <Workspace2 title={t('admitDeceasedPerson', 'Admit deceased person')} hasUnsavedChanges={hasUnsavedChanges}>
233
+ <Workspace2 title={t('admitDeceasedPerson', 'Admit deceased person')} hasUnsavedChanges={isDirty}>
234
234
  <Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
235
235
  <div className={styles.formContainer}>
236
236
  <Stack gap={3}>
@@ -394,9 +394,7 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
394
394
  titleText={t('searchServices', 'Search services *')}
395
395
  items={availableServices.map((service) => service.uuid)}
396
396
  itemToString={(item) => availableServices.find((i) => i.uuid === item)?.name ?? ''}
397
- onChange={({ selectedItems }) => {
398
- field.onChange(selectedItems);
399
- }}
397
+ onChange={({ selectedItems }) => field.onChange(selectedItems)}
400
398
  placeholder={t('Service', 'Service')}
401
399
  initialSelectedItems={field.value}
402
400
  invalid={!!errors.services}
@@ -418,6 +416,7 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
418
416
  />
419
417
  </Column>
420
418
  )}
419
+
421
420
  <ResponsiveWrapper>
422
421
  <Controller
423
422
  name="placeOfDeath"
@@ -498,18 +497,16 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
498
497
  <Controller
499
498
  name="timeOfDeath"
500
499
  control={control}
501
- render={({ field }) => {
502
- return (
503
- <TimePicker
504
- {...field}
505
- id="time-of-death-picker"
506
- labelText={t('timeAdmission', 'Time of admission *')}
507
- className={styles.formAdmissionTimepicker}
508
- invalid={!!errors.timeOfDeath}
509
- invalidText={errors.timeOfDeath?.message}
510
- />
511
- );
512
- }}
500
+ render={({ field }) => (
501
+ <TimePicker
502
+ {...field}
503
+ id="time-of-death-picker"
504
+ labelText={t('timeAdmission', 'Time of admission *')}
505
+ className={styles.formAdmissionTimepicker}
506
+ invalid={!!errors.timeOfDeath}
507
+ invalidText={errors.timeOfDeath?.message}
508
+ />
509
+ )}
513
510
  />
514
511
  <Controller
515
512
  name="period"
@@ -540,7 +537,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
540
537
  render={({ field }) => {
541
538
  const yesOption = deathConfirmationTypes.find((type) => type.label === 'Yes');
542
539
  const noOption = deathConfirmationTypes.find((type) => type.label === 'No');
543
-
544
540
  return (
545
541
  <RadioButtonGroup
546
542
  name="deathConfirmed"
@@ -603,7 +599,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
603
599
  </Column>
604
600
  </FormGroup>
605
601
  </ResponsiveWrapper>
606
-
607
602
  <ResponsiveWrapper>
608
603
  <FormGroup legendText="">
609
604
  <Column>
@@ -654,7 +649,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
654
649
  render={({ field }) => {
655
650
  const yesOption = deathConfirmationTypes.find((type) => type.label === 'Yes');
656
651
  const noOption = deathConfirmationTypes.find((type) => type.label === 'No');
657
-
658
652
  return (
659
653
  <RadioButtonGroup
660
654
  name="autopsyPermission"
@@ -757,7 +751,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
757
751
  </Column>
758
752
  </FormGroup>
759
753
  </ResponsiveWrapper>
760
-
761
754
  <ResponsiveWrapper>
762
755
  <FormGroup legendText="">
763
756
  <Column>
@@ -777,7 +770,6 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
777
770
  </Column>
778
771
  </FormGroup>
779
772
  </ResponsiveWrapper>
780
-
781
773
  <ResponsiveWrapper>
782
774
  <FormGroup legendText="">
783
775
  <Column>
@@ -800,6 +792,7 @@ const AdmitDeceasedPerson: React.FC<Workspace2DefinitionProps<AdmitDeceasedPerso
800
792
  </ResponsiveWrapper>
801
793
  </>
802
794
  )}
795
+
803
796
  <FormGroup
804
797
  className={styles.supportingDocuments}
805
798
  legendText={t('supportingDocuments', 'Supporting Documents')}>
@@ -21,6 +21,26 @@
21
21
  background-color: colors.$white;
22
22
  }
23
23
 
24
+ .buttonSet {
25
+ display: grid;
26
+ grid-template-columns: 1fr 1fr;
27
+ width: 100%;
28
+ margin-top: auto;
29
+
30
+ :global(.cds--btn) {
31
+ max-width: none;
32
+ width: 100%;
33
+ display: inline-flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+ }
37
+
38
+ &.tablet {
39
+ padding: layout.$spacing-04 layout.$spacing-05;
40
+ background-color: colors.$white;
41
+ }
42
+ }
43
+
24
44
  .desktop {
25
45
  padding: 0;
26
46
  padding: layout.$spacing-01 layout.$spacing-04;
@@ -61,7 +61,7 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
61
61
  const { t } = useTranslation();
62
62
  const isTablet = useLayoutType() === 'tablet';
63
63
  const [submissionError, setSubmissionError] = useState<string | null>(null);
64
- const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
64
+
65
65
  const { activeVisit, currentVisitIsRetrospective } = useVisit(patientUuid);
66
66
  const { queueEntry } = useVisitQueueEntry(patientUuid, activeVisit?.uuid);
67
67
  const { dischargeBody } = useMortuaryOperation();
@@ -108,8 +108,24 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
108
108
  },
109
109
  });
110
110
 
111
+ const closeWorkspaceWithSavedChanges = () => {
112
+ closeWorkspace({ discardUnsavedChanges: true });
113
+ };
114
+
111
115
  const selectedDischargeType = watch('dischargeType');
112
116
 
117
+ const getAttributeValue = useCallback(
118
+ (attributeTypeUuid: string) =>
119
+ personAttributes?.find((attr) => attr.attributeType.uuid === attributeTypeUuid)?.value || '',
120
+ [personAttributes],
121
+ );
122
+
123
+ const getExistingAttributeUuid = useCallback(
124
+ (attributeTypeUuid: string) =>
125
+ personAttributes?.find((attr) => attr.attributeType.uuid === attributeTypeUuid)?.uuid || null,
126
+ [personAttributes],
127
+ );
128
+
113
129
  useEffect(() => {
114
130
  if (personAttributes?.length) {
115
131
  setValue('nextOfKinNames', getAttributeValue(nextOfKinNameUuid));
@@ -120,30 +136,19 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
120
136
  }, [
121
137
  personAttributes,
122
138
  setValue,
139
+ getAttributeValue,
123
140
  nextOfKinNameUuid,
124
141
  nextOfKinRelationshipUuid,
125
142
  nextOfKinPhoneUuid,
126
143
  nextOfKinNationalIdUuid,
127
144
  ]);
128
145
 
129
- const getAttributeValue = useCallback(
130
- (attributeTypeUuid: string) =>
131
- personAttributes?.find((attr) => attr.attributeType.uuid === attributeTypeUuid)?.value || '',
132
- [personAttributes],
133
- );
134
-
135
- const getExistingAttributeUuid = useCallback(
136
- (attributeTypeUuid: string) =>
137
- personAttributes?.find((attr) => attr.attributeType.uuid === attributeTypeUuid)?.uuid || null,
138
- [personAttributes],
139
- );
140
-
141
146
  const onSubmit = async (data) => {
142
147
  setSubmissionError(null);
143
148
 
144
149
  if (currentVisitIsRetrospective) {
145
150
  setCurrentVisit(null, null);
146
- closeWorkspace();
151
+ closeWorkspaceWithSavedChanges();
147
152
  return;
148
153
  }
149
154
 
@@ -180,15 +185,10 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
180
185
 
181
186
  for (const attr of attributeUpdates) {
182
187
  try {
183
- const attributeData: any = {
184
- attributeType: attr.uuid,
185
- value: attr.value,
186
- };
187
-
188
+ const attributeData: any = { attributeType: attr.uuid, value: attr.value };
188
189
  if (attr.existingUuid) {
189
190
  attributeData.uuid = attr.existingUuid;
190
191
  }
191
-
192
192
  await createOrUpdatePersonAttribute(patientUuid, attributeData, patientInfo);
193
193
  } catch (error) {
194
194
  showSnackbar({
@@ -214,7 +214,7 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
214
214
  });
215
215
 
216
216
  mutate();
217
- closeWorkspace();
217
+ closeWorkspaceWithSavedChanges();
218
218
  } catch (error) {
219
219
  let errorMessage = t('dischargeUnknownError', 'An unknown error occurred');
220
220
  if (error?.message) {
@@ -224,7 +224,6 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
224
224
  } else if (error?.responseBody?.error?.globalErrors) {
225
225
  errorMessage = error.responseBody.error.globalErrors[0]?.message || errorMessage;
226
226
  }
227
-
228
227
  setSubmissionError(errorMessage);
229
228
  showSnackbar({
230
229
  title: t('dischargeError', 'Discharge Error'),
@@ -235,12 +234,8 @@ const DischargeForm: React.FC<Workspace2DefinitionProps<DischargeFormProps, obje
235
234
  }
236
235
  };
237
236
 
238
- useEffect(() => {
239
- setHasUnsavedChanges(isDirty);
240
- }, [isDirty, setHasUnsavedChanges]);
241
-
242
237
  return (
243
- <Workspace2 title={t('dischargeForm', 'Discharge form')} hasUnsavedChanges={hasUnsavedChanges}>
238
+ <Workspace2 title={t('dischargeForm', 'Discharge form')} hasUnsavedChanges={isDirty}>
244
239
  <Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
245
240
  <div className={styles.formContainer}>
246
241
  {isLoadingBills && <InlineLoading description={t('loadingBills', 'Loading bills...')} />}
@@ -142,3 +142,23 @@
142
142
  .sectionField {
143
143
  padding-top: layout.$spacing-03;
144
144
  }
145
+
146
+ .buttonSet {
147
+ display: grid;
148
+ grid-template-columns: 1fr 1fr;
149
+ width: 100%;
150
+ margin-top: auto;
151
+
152
+ :global(.cds--btn) {
153
+ max-width: none;
154
+ width: 100%;
155
+ display: inline-flex;
156
+ justify-content: center;
157
+ align-items: center;
158
+ }
159
+
160
+ &.tablet {
161
+ padding: layout.$spacing-04 layout.$spacing-05;
162
+ background-color: colors.$white;
163
+ }
164
+ }
@@ -13,7 +13,7 @@ import {
13
13
  Tile,
14
14
  FormGroup,
15
15
  } from '@carbon/react';
16
- import React, { useState, useMemo, useEffect } from 'react';
16
+ import React, { useState, useMemo } from 'react';
17
17
  import { useTranslation } from 'react-i18next';
18
18
  import DeceasedInfo from '../../deceased-patient-header/deceasedInfo/deceased-info.component';
19
19
  import styles from './swap-unit.scss';
@@ -62,7 +62,6 @@ const SwapForm: React.FC<Workspace2DefinitionProps<SwapFormProps, object, object
62
62
  const { currentVisit } = useVisit(patientUuid);
63
63
  const { assignDeceasedToCompartment, removeDeceasedFromCompartment, createEncounterForCompartmentSwap } =
64
64
  useMortuaryOperation();
65
- const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
66
65
  const [searchTerm, setSearchTerm] = useState('');
67
66
 
68
67
  const {
@@ -76,6 +75,10 @@ const SwapForm: React.FC<Workspace2DefinitionProps<SwapFormProps, object, object
76
75
  },
77
76
  });
78
77
 
78
+ const closeWorkspaceWithSavedChanges = () => {
79
+ closeWorkspace({ discardUnsavedChanges: true });
80
+ };
81
+
79
82
  const currentBed = mortuaryLocation?.bedLayouts?.find((bed) =>
80
83
  bed.patients?.some((patient) => patient.uuid === patientUuid),
81
84
  );
@@ -150,7 +153,7 @@ const SwapForm: React.FC<Workspace2DefinitionProps<SwapFormProps, object, object
150
153
 
151
154
  mutate();
152
155
  navigate({ to: window.getOpenmrsSpaBase() + `home/mortuary` });
153
- closeWorkspace();
156
+ closeWorkspaceWithSavedChanges();
154
157
  } else {
155
158
  showSnackbar({
156
159
  kind: 'error',
@@ -167,12 +170,8 @@ const SwapForm: React.FC<Workspace2DefinitionProps<SwapFormProps, object, object
167
170
  }
168
171
  };
169
172
 
170
- useEffect(() => {
171
- setHasUnsavedChanges(isDirty);
172
- }, [isDirty, setHasUnsavedChanges]);
173
-
174
173
  return (
175
- <Workspace2 title={t('swapCompartment', 'Swap compartment')} hasUnsavedChanges={hasUnsavedChanges}>
174
+ <Workspace2 title={t('swapCompartment', 'Swap compartment')} hasUnsavedChanges={isDirty}>
176
175
  <Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
177
176
  <div className={styles.formContainer}>
178
177
  <Stack gap={3}>
@@ -262,15 +261,11 @@ const SwapForm: React.FC<Workspace2DefinitionProps<SwapFormProps, object, object
262
261
  </ResponsiveWrapper>
263
262
  </Stack>
264
263
  </div>
265
- <ButtonSet
266
- className={classNames({
267
- [styles.tablet]: isTablet,
268
- [styles.desktop]: !isTablet,
269
- })}>
270
- <Button className={styles.buttonContainer} kind="secondary" onClick={() => closeWorkspace()}>
264
+ <ButtonSet className={classNames(styles.buttonSet, { [styles.tablet]: isTablet })}>
265
+ <Button kind="secondary" onClick={() => closeWorkspace()}>
271
266
  {t('cancel', 'Cancel')}
272
267
  </Button>
273
- <Button className={styles.buttonContainer} disabled={isSubmitting || !isDirty} kind="primary" type="submit">
268
+ <Button disabled={isSubmitting || !isDirty} kind="primary" type="submit">
274
269
  {isSubmitting ? (
275
270
  <span className={styles.inlineLoading}>
276
271
  {t('submitting', 'Submitting' + '...')}
package/src/index.ts CHANGED
@@ -32,13 +32,13 @@ export function startupApp() {
32
32
  }
33
33
 
34
34
  export const root = getAsyncLifecycle(() => import('./root.component'), options);
35
-
35
+ // t("mortuary", "Morgue")
36
36
  export const morgueDashboardLink = getAsyncLifecycle(
37
37
  () =>
38
38
  import('./left-panel/morgue-left-panel-link.component').then((m) => ({
39
39
  default: m.createLeftPanelLink({
40
40
  name: 'morgue',
41
- title: 'Mortuary',
41
+ title: 'mortuary',
42
42
  }),
43
43
  })),
44
44
  options,
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import last from 'lodash-es/last';
3
3
  import { BrowserRouter, useLocation } from 'react-router-dom';
4
4
  import { ConfigurableLink } from '@openmrs/esm-framework';
5
+ import { useTranslation } from 'react-i18next';
5
6
 
6
7
  export interface LinkConfig {
7
8
  name: string;
@@ -9,6 +10,7 @@ export interface LinkConfig {
9
10
  }
10
11
 
11
12
  export function LinkExtension({ config }: { config: LinkConfig }) {
13
+ const { t } = useTranslation();
12
14
  const { name, title } = config;
13
15
  const location = useLocation();
14
16
  const spaBasePath = window.getOpenmrsSpaBase() + 'home';
@@ -28,7 +30,7 @@ export function LinkExtension({ config }: { config: LinkConfig }) {
28
30
  <ConfigurableLink
29
31
  to={spaBasePath + '/' + name}
30
32
  className={`cds--side-nav__link ${name === urlSegment && 'active-left-nav-link'}`}>
31
- {title}
33
+ {t(title)}
32
34
  </ConfigurableLink>
33
35
  );
34
36
  }
@@ -2,6 +2,7 @@ import React, { useCallback } from 'react';
2
2
  import { OverflowMenuItem } from '@carbon/react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { launchWorkspace2 } from '@openmrs/esm-framework';
5
+ import { usePatientChartStore } from '@openmrs/esm-patient-common-lib';
5
6
 
6
7
  import styles from './mark-patient-deceased-overflow.scss';
7
8
 
@@ -15,11 +16,18 @@ const MarkPatientDeceasedOverflowMenuItem: React.FC<MarkPatientDeceasedOverflowM
15
16
  patientUuid,
16
17
  }) => {
17
18
  const { t } = useTranslation();
19
+ const { visitContext, mutateVisitContext } = usePatientChartStore(patientUuid);
18
20
  const isDead = patient.deceasedBoolean ?? Boolean(patient.deceasedDateTime);
19
21
 
20
22
  const handleLaunchModal = useCallback(
21
- () => launchWorkspace2('mortuary-mark-patient-deceased-workspace-form', { patientUuid }),
22
- [],
23
+ () =>
24
+ launchWorkspace2(
25
+ 'mortuary-mark-patient-deceased-workspace-form',
26
+ { patientUuid },
27
+ {},
28
+ { patient, patientUuid, visitContext, mutateVisitContext },
29
+ ),
30
+ [patient, patientUuid, visitContext, mutateVisitContext],
23
31
  );
24
32
 
25
33
  return (
@@ -1,11 +1,12 @@
1
1
  import React, { useRef, useState, useMemo } from 'react';
2
2
  import { Button, ButtonSet, ModalBody, ModalFooter, InlineNotification } from '@carbon/react';
3
3
  import { useReactToPrint } from 'react-to-print';
4
- import { formatDate, formatDatetime, parseDate, useSession } from '@openmrs/esm-framework';
4
+ import { formatDate, formatDatetime, parseDate, useConfig, useSession } from '@openmrs/esm-framework';
5
5
  import styles from './print-preview-confirmation.scss';
6
6
  import { type Patient } from '../../types';
7
7
  import { formatDateTime, documentId, getAbsoluteDateTime } from '../../utils/utils';
8
8
  import { useTranslation } from 'react-i18next';
9
+ import { ConfigObject } from '../../config-schema';
9
10
 
10
11
  type PrintPreviewModalProps = {
11
12
  onClose: () => void;
@@ -15,6 +16,7 @@ type PrintPreviewModalProps = {
15
16
 
16
17
  const PrintPreviewModal: React.FC<PrintPreviewModalProps> = ({ onClose, patient, encounterDate }) => {
17
18
  const { t } = useTranslation();
19
+ const { paymentMethods } = useConfig<ConfigObject>();
18
20
  const [printError, setPrintError] = useState<string | null>(null);
19
21
  const printRef = useRef<HTMLDivElement>(null);
20
22
  const { sessionLocation, user } = useSession();
@@ -28,7 +30,7 @@ const PrintPreviewModal: React.FC<PrintPreviewModalProps> = ({ onClose, patient,
28
30
  setPrintError(null);
29
31
  },
30
32
  onPrintError: (_, error) => {
31
- setPrintError(error?.message || 'An error occurred while printing');
33
+ setPrintError(error?.message || t('errorOccurredWhilePrinting', 'An error occurred while printing'));
32
34
  },
33
35
  pageStyle: `
34
36
  @page {
@@ -108,26 +110,12 @@ const PrintPreviewModal: React.FC<PrintPreviewModalProps> = ({ onClose, patient,
108
110
  {t('methodOfPayment', 'Method of payment (tick as appropriate)')}
109
111
  </div>
110
112
  <div className={styles.paymentGrid}>
111
- <div className={styles.paymentOption}>
112
- <span className={styles.checkbox}></span>
113
- <span className={styles.optionLabel}>{t('cash', 'Cash')}</span>
114
- </div>
115
- <div className={styles.paymentOption}>
116
- <span className={styles.checkbox}></span>
117
- <span className={styles.optionLabel}>{t('cheque', 'Cheque')}</span>
118
- </div>
119
- <div className={styles.paymentOption}>
120
- <span className={styles.checkbox}></span>
121
- <span className={styles.optionLabel}>{t('sha', 'SHA')}</span>
122
- </div>
123
- <div className={styles.paymentOption}>
124
- <span className={styles.checkbox}></span>
125
- <span className={styles.optionLabel}>{t('scheme', 'Scheme')}</span>
126
- </div>
127
- <div className={styles.paymentOption}>
128
- <span className={styles.checkbox}></span>
129
- <span className={styles.optionLabel}>{t('mrM', 'M.R.M')}</span>
130
- </div>
113
+ {paymentMethods.map((method, i) => (
114
+ <div className={styles.paymentOption} key={i}>
115
+ <span className={styles.checkbox}></span>
116
+ <span className={styles.optionLabel}>{t(method)}</span>
117
+ </div>
118
+ ))}
131
119
  <div className={styles.paymentOption}>
132
120
  <span className={styles.checkbox}></span>
133
121
  <span className={styles.optionLabel}>
package/src/routes.json CHANGED
@@ -75,7 +75,7 @@
75
75
  {
76
76
  "name": "mortuary-mark-patient-deceased-workspace-form",
77
77
  "component": "markPatientDeceasedForm",
78
- "window": "morgue-workspace-window"
78
+ "window": "patient-chart-workspace-window"
79
79
  },
80
80
  {
81
81
  "name": "discharge-body-form",
@@ -100,6 +100,10 @@
100
100
  "canHide": true,
101
101
  "group": "morgue-workspace-group",
102
102
  "width": "wider"
103
+ },
104
+ {
105
+ "name": "patient-chart-workspace-window",
106
+ "group": "patient-chart"
103
107
  }
104
108
  ],
105
109
  "workspaceGroups2": [