@kenyaemr/esm-morgue-app 5.4.1-pre.1842 → 5.4.1-pre.1850

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 (111) hide show
  1. package/.turbo/turbo-build.log +85 -22
  2. package/dist/160.js +1 -0
  3. package/dist/160.js.map +1 -0
  4. package/dist/195.js +1 -0
  5. package/dist/195.js.map +1 -0
  6. package/dist/240.js +1 -0
  7. package/dist/240.js.map +1 -0
  8. package/dist/282.js +1 -0
  9. package/dist/282.js.map +1 -0
  10. package/dist/300.js +1 -1
  11. package/dist/{561.js → 521.js} +1 -1
  12. package/dist/521.js.map +1 -0
  13. package/dist/527.js +1 -0
  14. package/dist/527.js.map +1 -0
  15. package/dist/596.js +1 -0
  16. package/dist/596.js.map +1 -0
  17. package/dist/652.js +1 -1
  18. package/dist/652.js.map +1 -1
  19. package/dist/659.js +2 -0
  20. package/dist/659.js.map +1 -0
  21. package/dist/675.js +2 -0
  22. package/dist/{485.js.map → 675.js.map} +1 -1
  23. package/dist/730.js +1 -0
  24. package/dist/730.js.map +1 -0
  25. package/dist/755.js +1 -0
  26. package/dist/755.js.map +1 -0
  27. package/dist/795.js +1 -0
  28. package/dist/795.js.map +1 -0
  29. package/dist/818.js +1 -0
  30. package/dist/818.js.map +1 -0
  31. package/dist/{942.js → 870.js} +1 -1
  32. package/dist/870.js.map +1 -0
  33. package/dist/909.js +2 -0
  34. package/dist/909.js.map +1 -0
  35. package/dist/926.js +1 -1
  36. package/dist/926.js.map +1 -1
  37. package/dist/929.js +1 -0
  38. package/dist/929.js.map +1 -0
  39. package/dist/960.js +1 -0
  40. package/dist/960.js.map +1 -0
  41. package/dist/kenyaemr-esm-morgue-app.js +1 -1
  42. package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +371 -127
  43. package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
  44. package/dist/main.js +1 -1
  45. package/dist/main.js.map +1 -1
  46. package/dist/routes.json +1 -1
  47. package/package.json +1 -1
  48. package/src/autosuggest/autosuggest.component.tsx +162 -0
  49. package/src/autosuggest/autosuggest.scss +61 -0
  50. package/src/autosuggest/patient-search-info.component.tsx +75 -0
  51. package/src/autosuggest/patient-search-info.scss +62 -0
  52. package/src/autosuggest/search-empty-state.component.tsx +21 -0
  53. package/src/autosuggest/search-empty-state.scss +18 -0
  54. package/src/card/avail-compartment.compartment.tsx +40 -41
  55. package/src/card/compartment-view.compartment.tsx +37 -14
  56. package/src/card/compartment.scss +18 -13
  57. package/src/card/compartmentSharing.component.tsx +21 -0
  58. package/src/card/compartmentSharing.scss +24 -0
  59. package/src/card/empty-compartment.component.tsx +11 -7
  60. package/src/card/empty-compartment.scss +61 -0
  61. package/src/component/deceasedInfo/deceased-info.component.tsx +1 -1
  62. package/src/component/main.component.tsx +1 -7
  63. package/src/component/next-of-kin-details/nextOfKinDetails.component.tsx +50 -0
  64. package/src/component/next-of-kin-details/nextOfKinDetails.scss +37 -0
  65. package/src/config-schema.ts +30 -22
  66. package/src/extension/actionButton.component.tsx +74 -0
  67. package/src/extension/actionButton.scss +69 -0
  68. package/src/extension/deceasedInfoBanner.component.tsx +57 -0
  69. package/src/hook/useAdmitPatient.ts +285 -0
  70. package/src/hook/useDeceasedPatients.ts +12 -0
  71. package/src/hook/useDischargedPatient.ts +55 -0
  72. package/src/hook/useMorgue.resource.ts +11 -120
  73. package/src/hook/useMortuaryAdmissionLocation.ts +64 -0
  74. package/src/hook/usePersonAttributes.ts +65 -0
  75. package/src/index.ts +4 -0
  76. package/src/routes.json +24 -7
  77. package/src/tables/admitted-queue.component.tsx +17 -21
  78. package/src/tables/discharge-queue.component.tsx +33 -27
  79. package/src/tables/generic-table.component.tsx +44 -19
  80. package/src/tabs/tabs.component.tsx +36 -16
  81. package/src/tabs/tabs.scss +3 -186
  82. package/src/types/index.ts +291 -9
  83. package/src/utils/utils.ts +55 -4
  84. package/src/workspaces/admit-body.scss +46 -0
  85. package/src/workspaces/admit-body.workspace.tsx +79 -0
  86. package/src/workspaces/discharge-body.scss +2 -2
  87. package/src/workspaces/discharge-body.workspace.tsx +157 -101
  88. package/src/workspaces/patientAdditionalInfoForm.workspace.tsx +141 -218
  89. package/src/workspaces/swap-unit.scss +46 -0
  90. package/src/workspaces/swap-unit.workspace.tsx +168 -0
  91. package/translations/en.json +22 -7
  92. package/dist/340.js +0 -1
  93. package/dist/340.js.map +0 -1
  94. package/dist/38.js +0 -1
  95. package/dist/38.js.map +0 -1
  96. package/dist/485.js +0 -2
  97. package/dist/553.js +0 -1
  98. package/dist/553.js.map +0 -1
  99. package/dist/561.js.map +0 -1
  100. package/dist/592.js +0 -2
  101. package/dist/592.js.map +0 -1
  102. package/dist/759.js +0 -1
  103. package/dist/759.js.map +0 -1
  104. package/dist/942.js.map +0 -1
  105. package/dist/987.js +0 -2
  106. package/dist/987.js.map +0 -1
  107. package/src/component/deceasedInfo/deceased-header.component.tsx +0 -37
  108. package/src/tables/waiting-queue.component.tsx +0 -91
  109. /package/dist/{987.js.LICENSE.txt → 659.js.LICENSE.txt} +0 -0
  110. /package/dist/{485.js.LICENSE.txt → 675.js.LICENSE.txt} +0 -0
  111. /package/dist/{592.js.LICENSE.txt → 909.js.LICENSE.txt} +0 -0
@@ -1,58 +1,50 @@
1
1
  import {
2
2
  Button,
3
3
  ButtonSet,
4
- ComboBox,
5
4
  Column,
5
+ ComboBox,
6
6
  DatePicker,
7
7
  DatePickerInput,
8
+ Dropdown,
9
+ FilterableMultiSelect,
8
10
  Form,
9
- TextArea,
11
+ Layer,
12
+ RadioButton,
13
+ RadioButtonGroup,
14
+ Search,
15
+ SelectItem,
16
+ InlineNotification,
10
17
  Stack,
11
18
  TextInput,
19
+ Tile,
12
20
  TimePicker,
21
+ InlineLoading,
13
22
  TimePickerSelect,
14
- SelectItem,
15
- RadioButtonGroup,
16
- RadioButton,
17
- Layer,
18
- Tile,
19
- Search,
20
- FilterableMultiSelect,
21
- Dropdown,
22
23
  } from '@carbon/react';
23
- import {
24
- ResponsiveWrapper,
25
- useLayoutType,
26
- useConfig,
27
- useSession,
28
- showSnackbar,
29
- formatTime,
30
- parseDate,
31
- } from '@openmrs/esm-framework';
32
- import React, { useMemo, useState, useEffect } from 'react';
33
- import { useTranslation } from 'react-i18next';
24
+ import { zodResolver } from '@hookform/resolvers/zod';
25
+ import { ResponsiveWrapper, restBaseUrl, showSnackbar, useConfig } from '@openmrs/esm-framework';
26
+ import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib';
34
27
  import classNames from 'classnames';
35
- import styles from './patientAdditionalInfoForm.scss';
28
+ import fuzzy from 'fuzzy';
29
+ import React, { useEffect, useMemo, useState } from 'react';
30
+ import { Controller, useForm } from 'react-hook-form';
31
+ import { useTranslation } from 'react-i18next';
32
+ import { mutate } from 'swr';
33
+ import { z } from 'zod';
34
+ import { ConfigObject } from '../config-schema';
35
+ import { PENDING_PAYMENT_STATUS } from '../constants';
36
36
  import {
37
37
  createPatientBill,
38
- startVisitWithEncounter,
39
38
  useBillableItems,
40
39
  useCashPoint,
41
- useMorgueCompartment,
42
40
  usePaymentModes,
43
41
  useVisitType,
44
42
  } from '../hook/useMorgue.resource';
45
- import fuzzy from 'fuzzy';
46
- import { Controller, useForm } from 'react-hook-form';
47
- import { z } from 'zod';
48
- import { zodResolver } from '@hookform/resolvers/zod';
49
- import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib';
50
- import isEmpty from 'lodash-es/isEmpty';
51
- import { ConfigObject } from '../config-schema';
52
- import { PENDING_PAYMENT_STATUS } from '../constants';
53
- import { mutate } from 'swr';
54
- import dayjs from 'dayjs';
55
- import DeceasedHeader from '../component/deceasedInfo/deceased-header.component';
43
+ import { useAdmissionLocation } from '../hook/useMortuaryAdmissionLocation';
44
+ import { getCurrentTime, patientInfoSchema } from '../utils/utils';
45
+ import styles from './patientAdditionalInfoForm.scss';
46
+ import { useMortuaryOperation } from '../hook/useAdmitPatient';
47
+ import DeceasedInfo from '../component/deceasedInfo/deceased-info.component';
56
48
 
57
49
  interface PatientAdditionalInfoFormProps {
58
50
  closeWorkspace: () => void;
@@ -61,58 +53,25 @@ interface PatientAdditionalInfoFormProps {
61
53
 
62
54
  const MAX_RESULTS = 5;
63
55
 
64
- const patientInfoSchema = z.object({
65
- dateOfAdmission: z.date({ coerce: true }).refine((date) => !!date, 'Date of admission is required'),
66
- timeOfDeath: z
67
- .string()
68
- .nonempty('Time of death is required')
69
- .regex(/^(0[1-9]|1[0-2]):[0-5][0-9]\s?(AM|PM)$/i, 'Time of death must be in the format hh:mm AM/PM'),
70
- tagNumber: z.string().nonempty('Tag number is required'),
71
- obNumber: z.string().optional(),
72
- policeName: z.string().optional(),
73
- policeIDNo: z.string().optional(),
74
- dischargeArea: z.string().optional(),
75
- burialPermitNo: z.string().nonempty('Burial Permit is required'),
76
- visitType: z.string().uuid('invalid visit type'),
77
- availableCompartment: z.string(),
78
- services: z.array(z.string().uuid('invalid service')).nonempty('Must select one service'),
79
- paymentMethod: z.string().uuid('invalid payment method'),
80
- insuranceScheme: z.string().optional(),
81
- policyNumber: z.string().optional(),
82
- });
83
-
84
56
  const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ closeWorkspace, patientUuid }) => {
85
57
  const { t } = useTranslation();
86
- const layout = useLayoutType();
87
58
  const { data: visitTypes, isLoading: isLoadingVisitTypes } = useVisitType();
88
59
  const { lineItems, isLoading: isLoadingLineItems, error: lineError } = useBillableItems();
60
+ const { time: defaultTime, period: defaultPeriod } = getCurrentTime();
89
61
  const { cashPoints, isLoading: isLoadingCashPoints, error: cashError } = useCashPoint();
90
62
  const cashPointUuid = cashPoints?.[0]?.uuid ?? '';
91
63
 
92
64
  const { insuranceSchemes } = useConfig({ externalModuleName: '@kenyaemr/esm-billing-app' });
93
65
 
94
66
  const { paymentModes, isLoading: isLoadingPaymentModes } = usePaymentModes();
95
- const { morgueCompartments } = useMorgueCompartment();
96
67
  const {
97
- sessionLocation: { uuid: locationUuid },
98
- currentProvider: { uuid: currentProviderUuid },
99
- user: { roles },
100
- } = useSession();
68
+ admissionLocation,
69
+ isLoading: isLoadingAdmissionLocation,
70
+ mutate: mutateAdmissionLocation,
71
+ } = useAdmissionLocation();
101
72
 
102
- const {
103
- morgueVisitTypeUuid,
104
- morgueDepartmentServiceTypeUuid,
105
- insurancepaymentModeUuid,
106
- visitPaymentMethodAttributeUuid,
107
- morgueAdmissionEncounterType,
108
- tagNumberUuid,
109
- policeIDNumber,
110
- policeNameUuid,
111
- burialPermitNumberUuid,
112
- obNumberUuid,
113
- encounterProviderRoleUuid,
114
- dischargeAreaUuid,
115
- } = useConfig<ConfigObject>();
73
+ const { morgueVisitTypeUuid, morgueDepartmentServiceTypeUuid, insurancepaymentModeUuid } = useConfig<ConfigObject>();
74
+ const { admitBody, errorFetchingEmrConfiguration, isLoadingEmrConfiguration } = useMortuaryOperation();
116
75
 
117
76
  const [searchTerm, setSearchTerm] = useState<string>('');
118
77
  const [isPoliceCase, setIsPoliceCase] = useState<string | null>(null);
@@ -127,14 +86,13 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
127
86
  resolver: zodResolver(patientInfoSchema),
128
87
  defaultValues: {
129
88
  dateOfAdmission: new Date(),
130
- timeOfDeath: '',
89
+ timeOfDeath: defaultTime,
90
+ period: defaultPeriod,
131
91
  tagNumber: '',
132
92
  obNumber: '',
133
93
  policeName: '',
134
94
  policeIDNo: '',
135
- burialPermitNo: '',
136
95
  visitType: morgueVisitTypeUuid,
137
- availableCompartment: '',
138
96
  paymentMethod: '',
139
97
  insuranceScheme: '',
140
98
  dischargeArea: '',
@@ -180,68 +138,26 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
180
138
  };
181
139
  });
182
140
 
183
- const encounterDateTime = dayjs(data.dateOfAdmission).toISOString();
141
+ const { admissionEncounter, compartment } = await admitBody(patientUuid, data);
184
142
 
185
- const obs = [];
186
- if (data.tagNumber) {
187
- obs.push({ concept: tagNumberUuid, value: data.tagNumber });
188
- }
189
- if (data.obNumber) {
190
- obs.push({ concept: obNumberUuid, value: data.obNumber });
191
- }
192
- if (data.policeName) {
193
- obs.push({ concept: policeNameUuid, value: data.policeName });
194
- }
195
- if (data.policeIDNo) {
196
- obs.push({ concept: policeIDNumber, value: data.policeIDNo });
197
- }
198
- if (data.burialPermitNo) {
199
- obs.push({ concept: burialPermitNumberUuid, value: data.burialPermitNo });
200
- }
201
- if (data.dischargeArea) {
202
- obs.push({ concept: dischargeAreaUuid, value: data.dischargeArea });
143
+ if (admissionEncounter && compartment) {
144
+ showSnackbar({
145
+ title: t('admissionSuccess', 'Deceased Admission'),
146
+ subtitle: t('admissionSuccessMessage', 'Patient has been admitted to the mortuary successfully'),
147
+ kind: 'success',
148
+ });
149
+ } else {
150
+ showSnackbar({
151
+ title: t('admissionError', 'Deceased Admission Error'),
152
+ subtitle: t(
153
+ 'admissionError',
154
+ 'An error has occurred while admitting deceased patient to the mortuary, Contact system administrator',
155
+ ),
156
+ kind: 'error',
157
+ isLowContrast: true,
158
+ });
203
159
  }
204
160
 
205
- const encounterPayload = {
206
- visit: {
207
- patient: patientUuid,
208
- startDatetime: encounterDateTime,
209
- visitType: data.visitType,
210
- location: locationUuid,
211
- attributes: [
212
- {
213
- attributeType: visitPaymentMethodAttributeUuid,
214
- value: data.paymentMethod,
215
- },
216
- ],
217
- },
218
- encounterDatetime: new Date().toISOString(),
219
- patient: patientUuid,
220
- encounterType: morgueAdmissionEncounterType,
221
- location: data.availableCompartment,
222
- encounterProviders: [
223
- {
224
- provider: currentProviderUuid,
225
- encounterRole: encounterProviderRoleUuid,
226
- },
227
- ],
228
- obs: obs.length > 0 ? obs : undefined,
229
- };
230
- await startVisitWithEncounter(encounterPayload).then(
231
- () => {
232
- showSnackbar({ title: 'Start visit', subtitle: ' visit has been started successfully', kind: 'success' });
233
- },
234
- (error) => {
235
- const errorMessage = JSON.stringify(error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, ''));
236
- showSnackbar({
237
- title: 'Visit Error',
238
- subtitle: `An error has occurred while starting visit, Contact system administrator quoting this error ${errorMessage}`,
239
- kind: 'error',
240
- isLowContrast: true,
241
- });
242
- },
243
- );
244
-
245
161
  const billPayload = {
246
162
  lineItems: linesItems,
247
163
  cashPoint: cashPointUuid,
@@ -252,7 +168,11 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
252
168
 
253
169
  await createPatientBill(billPayload).then(
254
170
  () => {
255
- showSnackbar({ title: 'Patient Bill', subtitle: 'Patient has been billed successfully', kind: 'success' });
171
+ showSnackbar({
172
+ title: t('patientBill', 'Patient Bill'),
173
+ subtitle: t('patientBillSuccess', 'Patient has been billed successfully'),
174
+ kind: 'success',
175
+ });
256
176
  },
257
177
  (error) => {
258
178
  const errorMessage = JSON.stringify(error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, ''));
@@ -264,10 +184,7 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
264
184
  });
265
185
  },
266
186
  );
267
-
268
- mutate((key) => {
269
- return typeof key === 'string' && key.startsWith('/ws/rest/v1/morgue');
270
- });
187
+ mutateAdmissionLocation();
271
188
  closeWorkspace();
272
189
  };
273
190
 
@@ -280,11 +197,17 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
280
197
  const handlePoliceCaseChange = (selectedItem: string | null) => {
281
198
  setIsPoliceCase(selectedItem);
282
199
  };
200
+ if (isLoadingEmrConfiguration) {
201
+ return <InlineLoading status="active" description="Loading....." />;
202
+ }
203
+ if (errorFetchingEmrConfiguration) {
204
+ return <InlineNotification kind="error" title={errorFetchingEmrConfiguration} />;
205
+ }
283
206
  return (
284
207
  <Form className={styles.formContainer} onSubmit={handleSubmit(onSubmit)}>
285
208
  <Stack gap={4} className={styles.formGrid}>
286
209
  <br />
287
- <DeceasedHeader patientUuid={patientUuid} />
210
+ <DeceasedInfo patientUuid={patientUuid} />
288
211
  <Column>
289
212
  <Controller
290
213
  name="dateOfAdmission"
@@ -310,48 +233,44 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
310
233
  )}
311
234
  />
312
235
  </Column>
313
-
314
236
  <Column>
315
- <Controller
316
- name="timeOfDeath"
317
- control={control}
318
- render={({ field }) => {
319
- const [timeValue, periodValue] = field.value ? field.value.split(' ') : ['', 'AM'];
320
-
321
- return (
322
- <div className={styles.dateTimeSection}>
323
- <ResponsiveWrapper>
237
+ <div className={styles.dateTimeSection}>
238
+ <ResponsiveWrapper>
239
+ <Controller
240
+ name="timeOfDeath"
241
+ control={control}
242
+ render={({ field }) => {
243
+ return (
324
244
  <TimePicker
245
+ {...field}
325
246
  id="time-of-death-picker"
326
247
  labelText={t('timeAdmission', 'Time of admission*')}
327
248
  className={styles.formAdmissionTimepicker}
328
- value={timeValue}
329
- onChange={(e) => {
330
- field.onChange(`${e.target.value} ${periodValue}`);
331
- }}
332
249
  invalid={!!errors.timeOfDeath}
333
250
  invalidText={errors.timeOfDeath?.message}
334
251
  />
335
- <TimePickerSelect
336
- className={styles.formDeathTimepickerSelector}
337
- id="time-picker-select"
338
- labelText={t('selectPeriod', 'AM/PM')}
339
- value={periodValue}
340
- onChange={(e) => {
341
- field.onChange(`${timeValue} ${e.target.value}`);
342
- }}
343
- invalid={!!errors.timeOfDeath}
344
- invalidText={errors.timeOfDeath?.message}>
345
- <SelectItem value="AM" text="AM" />
346
- <SelectItem value="PM" text="PM" />
347
- </TimePickerSelect>
348
- </ResponsiveWrapper>
349
- </div>
350
- );
351
- }}
352
- />
252
+ );
253
+ }}
254
+ />
255
+ <Controller
256
+ name="period"
257
+ control={control}
258
+ render={({ field }) => (
259
+ <TimePickerSelect
260
+ {...field}
261
+ className={styles.formDeathTimepickerSelector}
262
+ id="time-picker-select"
263
+ labelText={t('selectPeriod', 'AM/PM')}
264
+ invalid={!!errors.period}
265
+ invalidText={errors.period?.message}>
266
+ <SelectItem value="AM" text="AM" />
267
+ <SelectItem value="PM" text="PM" />
268
+ </TimePickerSelect>
269
+ )}
270
+ />
271
+ </ResponsiveWrapper>
272
+ </div>
353
273
  </Column>
354
-
355
274
  <Column>
356
275
  <span className={styles.visitTypeHeader}>{t('visitTypes', 'Visit type')}</span>
357
276
 
@@ -465,24 +384,42 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
465
384
  <Controller
466
385
  control={control}
467
386
  name="services"
468
- render={({ field }) => (
469
- <FilterableMultiSelect
470
- id="billing-service"
471
- className={styles.formAdmissionDatepicker}
472
- titleText={t('searchServices', 'Search services')}
473
- items={lineItems
474
- .filter((service) => service?.serviceType?.uuid === morgueDepartmentServiceTypeUuid)
475
- .map((service) => service.uuid)}
476
- itemToString={(item) => lineItems.find((i) => i.uuid === item)?.name ?? ''}
477
- onChange={({ selectedItems }) => {
478
- field.onChange(selectedItems);
479
- }}
480
- placeholder={t('Service', 'Service')}
481
- initialSelectedItems={field.value}
482
- invalid={!!errors.services}
483
- invalidText={errors.services?.message}
484
- />
485
- )}
387
+ render={({ field }) => {
388
+ const availableServices = lineItems.filter(
389
+ (service) => service?.serviceType?.uuid === morgueDepartmentServiceTypeUuid,
390
+ );
391
+ return (
392
+ <>
393
+ {availableServices.length > 0 ? (
394
+ <>
395
+ <FilterableMultiSelect
396
+ id="billing-service"
397
+ className={styles.formAdmissionDatepicker}
398
+ titleText={t('searchServices', 'Search services')}
399
+ items={availableServices.map((service) => service.uuid)}
400
+ itemToString={(item) => availableServices.find((i) => i.uuid === item)?.name ?? ''}
401
+ onChange={({ selectedItems }) => {
402
+ field.onChange(selectedItems);
403
+ }}
404
+ placeholder={t('Service', 'Service')}
405
+ initialSelectedItems={field.value}
406
+ invalid={!!errors.services}
407
+ invalidText={errors.services?.message}
408
+ />
409
+ </>
410
+ ) : (
411
+ <InlineNotification
412
+ kind="warning"
413
+ title={t(
414
+ 'noServicesAvailable',
415
+ 'No service price has been configured for the mortuary department.',
416
+ )}
417
+ lowContrast
418
+ />
419
+ )}
420
+ </>
421
+ );
422
+ }}
486
423
  />
487
424
  </Column>
488
425
  )}
@@ -520,7 +457,6 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
520
457
  )}
521
458
  />
522
459
  </Column>
523
-
524
460
  <Column>
525
461
  <Dropdown
526
462
  onChange={(e) => handlePoliceCaseChange(e.selectedItem)}
@@ -535,7 +471,6 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
535
471
  )}
536
472
  />
537
473
  </Column>
538
-
539
474
  {isPoliceCase === 'Yes' && (
540
475
  <>
541
476
  <Column>
@@ -592,7 +527,6 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
592
527
  </Column>
593
528
  </>
594
529
  )}
595
-
596
530
  <Column>
597
531
  <Controller
598
532
  name="availableCompartment"
@@ -602,13 +536,19 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
602
536
  {...field}
603
537
  id="avail-compartment"
604
538
  className={styles.sectionField}
605
- items={morgueCompartments.map((compartment) => compartment.uuid)}
606
- itemToString={(item) =>
607
- morgueCompartments.find((compartment) => compartment.uuid === item)?.display ?? ''
539
+ items={
540
+ admissionLocation?.bedLayouts?.map((bed) => ({
541
+ bedId: bed.bedId,
542
+ display:
543
+ bed.status === 'OCCUPIED'
544
+ ? `${bed.bedNumber} . ${bed.patients.map((patient) => patient?.person?.display).join(' . ')}`
545
+ : `${bed.bedNumber} . ${bed.status}`,
546
+ })) || []
608
547
  }
548
+ itemToString={(item) => item?.display || ''}
609
549
  titleText={t('availableCompartment', 'Available Compartment')}
610
550
  label={t('ChooseOptions', 'Choose option')}
611
- onChange={({ selectedItem }) => field.onChange(selectedItem)}
551
+ onChange={({ selectedItem }) => field.onChange(selectedItem?.bedId)}
612
552
  initialSelectedItems={field.value}
613
553
  invalid={!!errors.availableCompartment}
614
554
  invalidText={errors.availableCompartment?.message}
@@ -616,23 +556,6 @@ const PatientAdditionalInfoForm: React.FC<PatientAdditionalInfoFormProps> = ({ c
616
556
  )}
617
557
  />
618
558
  </Column>
619
- <Column>
620
- <Controller
621
- name="burialPermitNo"
622
- control={control}
623
- render={({ field }) => (
624
- <TextInput
625
- {...field}
626
- id="burialPermitNo"
627
- className={styles.formAdmissionDatepicker}
628
- placeholder={t('burialPermitNo', 'Burial permit number')}
629
- labelText={t('burialPermitNumber', 'Burial permit number')}
630
- invalid={!!errors.burialPermitNo}
631
- invalidText={errors.burialPermitNo?.message}
632
- />
633
- )}
634
- />
635
- </Column>
636
559
  <ButtonSet className={styles.buttonSet}>
637
560
  <Button style={{ maxWidth: '65%' }} size="lg" kind="secondary" onClick={closeWorkspace}>
638
561
  {t('discard', 'Discard')}
@@ -0,0 +1,46 @@
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@carbon/colors';
4
+
5
+ .formButton {
6
+ height: layout.$spacing-09;
7
+ display: flex;
8
+ align-content: flex-start;
9
+ align-items: baseline;
10
+ min-width: layout.$spacing-11;
11
+ margin-bottom: layout.$spacing-05;
12
+ }
13
+
14
+ .buttonSet {
15
+ position: absolute;
16
+ bottom: layout.$spacing-05;
17
+ left: 4%;
18
+ width: 80%;
19
+ display: flex;
20
+ gap: layout.$spacing-02;
21
+
22
+ & > button {
23
+ max-width: 40%;
24
+ width: 40%;
25
+ }
26
+ }
27
+ .searchContainer {
28
+ padding: layout.$spacing-04;
29
+ }
30
+
31
+ .admissionRequestActionBar {
32
+ width: 100%;
33
+ padding: layout.$spacing-05;
34
+ margin-left: layout.$spacing-10;
35
+ }
36
+
37
+ .buttonRow {
38
+ display: flex;
39
+ width: 100%;
40
+ gap: 8px;
41
+ }
42
+
43
+ .actionButton {
44
+ flex-grow: 1;
45
+ width: 100%;
46
+ }