@kenyaemr/esm-morgue-app 5.4.2-pre.2283 → 5.4.2-pre.2291
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.
- package/.turbo/turbo-build.log +19 -19
- package/dist/109.js +2 -0
- package/dist/109.js.map +1 -0
- package/dist/201.js +1 -0
- package/dist/201.js.map +1 -0
- package/dist/293.js +1 -0
- package/dist/293.js.map +1 -0
- package/dist/300.js +1 -1
- package/dist/347.js +1 -2
- package/dist/347.js.map +1 -1
- package/dist/373.js +2 -0
- package/dist/373.js.map +1 -0
- package/dist/38.js +1 -0
- package/dist/38.js.map +1 -0
- package/dist/389.js +1 -0
- package/dist/389.js.map +1 -0
- package/dist/398.js +1 -0
- package/dist/398.js.map +1 -0
- package/dist/4.js +2 -0
- package/dist/4.js.map +1 -0
- package/dist/410.js +1 -0
- package/dist/410.js.map +1 -0
- package/dist/420.js +2 -0
- package/dist/420.js.map +1 -0
- package/dist/467.js +1 -0
- package/dist/467.js.map +1 -0
- package/dist/632.js +1 -0
- package/dist/632.js.map +1 -0
- package/dist/798.js +1 -0
- package/dist/798.js.map +1 -0
- package/dist/811.js +1 -0
- package/dist/811.js.map +1 -0
- package/dist/824.js +1 -0
- package/dist/824.js.map +1 -0
- package/dist/827.js +1 -0
- package/dist/827.js.map +1 -0
- package/dist/842.js +2 -0
- package/dist/842.js.LICENSE.txt +5 -0
- package/dist/842.js.map +1 -0
- package/dist/918.js +1 -1
- package/dist/918.js.map +1 -1
- package/dist/kenyaemr-esm-morgue-app.js +1 -1
- package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +218 -291
- package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.LICENSE.txt +15 -0
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/bed/bed.component.tsx +164 -0
- package/src/bed/bed.scss +192 -0
- package/src/bed/divider/divider.component.tsx +18 -0
- package/src/bed/empty-bed.component.tsx +47 -0
- package/src/bed-layout/admitted/admitted-bed-layout.component.tsx +189 -0
- package/src/bed-layout/awaiting/awaiting-bed-layout.component.tsx +86 -0
- package/src/bed-layout/bed-layout.resource.ts +72 -0
- package/src/bed-layout/bed-layout.scss +55 -0
- package/src/bed-layout/discharged/discharged-bed-layout.component.tsx +109 -0
- package/src/bed-layout/discharged/discharged-bed-layout.resource.ts +99 -0
- package/src/bed-linelist-view/admitted/admitted-bed-linelist-view.component.tsx +420 -0
- package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +224 -0
- package/src/bed-linelist-view/bed-linelist-view.scss +5 -0
- package/src/bed-linelist-view/discharged/discharged-bed-line-view.component.tsx +256 -0
- package/src/config-schema.ts +41 -9
- package/src/constants.ts +57 -0
- package/src/deceased-patient-header/deceased-patient-header.component.tsx +31 -0
- package/src/deceased-patient-header/deceased-patient-header.scss +50 -0
- package/src/{component → deceased-patient-header}/deceasedInfo/deceased-info.component.tsx +1 -1
- package/src/deceased-patient-header/deceasedInfo/deceased-info.resource.ts +11 -0
- package/src/extension/actionButton.component.tsx +5 -59
- package/src/extension/deceasedInfoBanner.component.tsx +5 -9
- package/src/{hook/useAdmitPatient.ts → forms/admit-deceased-person-workspace/admit-deceased-person.resource.ts} +177 -46
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +143 -0
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +648 -0
- package/src/{hook/usePersonAttributes.ts → forms/discharge-deceased-person-workspace/discharge-body.resource.ts} +1 -1
- package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +56 -0
- package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +362 -0
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.resource.ts +18 -0
- package/src/{workspaces/patientAdditionalInfoForm.scss → forms/dispose-deceased-person-workspace/dispose-deceased-person.scss} +46 -66
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.workspace.tsx +401 -0
- package/src/forms/form-entry-workspace/form-entry-workspace.workspace.tsx +62 -0
- package/src/forms/swap-compartment-workspace/swap-unit.scss +144 -0
- package/src/forms/swap-compartment-workspace/swap-unit.workspace.tsx +280 -0
- package/src/header/header.component.tsx +41 -0
- package/src/header/header.scss +58 -0
- package/src/home/home.component.tsx +87 -0
- package/src/home/home.resource.ts +261 -0
- package/src/home/home.scss +5 -0
- package/src/index.ts +18 -12
- package/src/metrics/metrics-card.component.tsx +31 -0
- package/src/metrics/metrics-card.scss +51 -0
- package/src/root.component.tsx +7 -3
- package/src/routes.json +25 -14
- package/src/schemas/index.ts +66 -0
- package/src/summary/summary.component.tsx +42 -0
- package/src/summary/summary.scss +10 -0
- package/src/switcher/content-switcher.component.tsx +220 -0
- package/src/switcher/content-switcher.scss +30 -0
- package/src/types/index.ts +336 -359
- package/src/utils/utils.ts +20 -2
- package/src/view-details/main/main.component.tsx +34 -0
- package/src/view-details/main/main.scss +45 -0
- package/src/view-details/panels/attachement.component.tsx +21 -0
- package/src/view-details/panels/autopsy.component.tsx +215 -0
- package/src/view-details/panels/billing-history.component.tsx +13 -0
- package/src/view-details/panels/observations/observation.component.tsx +57 -0
- package/src/view-details/panels/observations/observation.scss +24 -0
- package/src/view-details/panels/panels.scss +46 -0
- package/src/view-details/view-details.component.tsx +65 -0
- package/src/view-details/view-details.resource.ts +65 -0
- package/src/view-details/views-details.scss +82 -0
- package/translations/en.json +74 -21
- package/tsconfig.json +1 -1
- package/dist/113.js +0 -1
- package/dist/113.js.map +0 -1
- package/dist/160.js +0 -1
- package/dist/160.js.map +0 -1
- package/dist/299.js +0 -1
- package/dist/299.js.map +0 -1
- package/dist/433.js +0 -2
- package/dist/433.js.map +0 -1
- package/dist/441.js +0 -1
- package/dist/441.js.map +0 -1
- package/dist/496.js +0 -1
- package/dist/496.js.map +0 -1
- package/dist/511.js +0 -1
- package/dist/511.js.map +0 -1
- package/dist/603.js +0 -1
- package/dist/603.js.map +0 -1
- package/dist/610.js +0 -1
- package/dist/610.js.map +0 -1
- package/dist/612.js +0 -1
- package/dist/612.js.map +0 -1
- package/dist/656.js +0 -2
- package/dist/656.js.map +0 -1
- package/dist/752.js +0 -1
- package/dist/752.js.map +0 -1
- package/dist/754.js +0 -1
- package/dist/754.js.map +0 -1
- package/dist/781.js +0 -1
- package/dist/781.js.map +0 -1
- package/dist/801.js +0 -2
- package/dist/801.js.map +0 -1
- package/dist/817.js +0 -1
- package/dist/817.js.map +0 -1
- package/dist/877.js +0 -1
- package/dist/877.js.map +0 -1
- package/dist/924.js +0 -1
- package/dist/924.js.map +0 -1
- package/src/autosuggest/autosuggest.component.tsx +0 -162
- package/src/autosuggest/autosuggest.scss +0 -61
- package/src/autosuggest/patient-search-info.component.tsx +0 -75
- package/src/autosuggest/patient-search-info.scss +0 -62
- package/src/autosuggest/search-empty-state.component.tsx +0 -21
- package/src/autosuggest/search-empty-state.scss +0 -18
- package/src/card/avail-compartment.compartment.tsx +0 -94
- package/src/card/compartment-view.compartment.tsx +0 -62
- package/src/card/compartment.scss +0 -128
- package/src/card/compartmentSharing.component.tsx +0 -21
- package/src/card/compartmentSharing.scss +0 -24
- package/src/card/empty-compartment.component.tsx +0 -28
- package/src/card/empty-compartment.scss +0 -61
- package/src/component/main.component.tsx +0 -17
- package/src/component/next-of-kin-details/nextOfKinDetails.component.tsx +0 -50
- package/src/component/next-of-kin-details/nextOfKinDetails.scss +0 -37
- package/src/header/admitted-queue-header.component.tsx +0 -30
- package/src/header/admitted-queue-header.scss +0 -32
- package/src/header/morgue-header.component.tsx +0 -38
- package/src/header/morgue-header.scss +0 -95
- package/src/header/morgue-illustration.component.tsx +0 -13
- package/src/hook/useDeceasedPatients.ts +0 -12
- package/src/hook/useDischargedPatient.ts +0 -55
- package/src/hook/useMorgue.resource.ts +0 -163
- package/src/hook/useMortuaryAdmissionLocation.ts +0 -64
- package/src/tables/admitted-queue.component.tsx +0 -54
- package/src/tables/admitted-queue.scss +0 -62
- package/src/tables/discharge-queue.component.tsx +0 -87
- package/src/tables/generic-table.component.tsx +0 -140
- package/src/tables/generic-table.scss +0 -37
- package/src/tabs/tabs.component.tsx +0 -82
- package/src/tabs/tabs.scss +0 -15
- package/src/workspaces/admit-body.scss +0 -46
- package/src/workspaces/admit-body.workspace.tsx +0 -79
- package/src/workspaces/discharge-body.scss +0 -67
- package/src/workspaces/discharge-body.workspace.tsx +0 -329
- package/src/workspaces/patientAdditionalInfoForm.workspace.tsx +0 -562
- package/src/workspaces/swap-unit.scss +0 -46
- package/src/workspaces/swap-unit.workspace.tsx +0 -168
- /package/dist/{347.js.LICENSE.txt → 109.js.LICENSE.txt} +0 -0
- /package/dist/{656.js.LICENSE.txt → 373.js.LICENSE.txt} +0 -0
- /package/dist/{801.js.LICENSE.txt → 4.js.LICENSE.txt} +0 -0
- /package/dist/{433.js.LICENSE.txt → 420.js.LICENSE.txt} +0 -0
- /package/src/{component → deceased-patient-header}/deceasedInfo/deceased-info.scss +0 -0
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { Button, ButtonSet, Form, Stack, Column, Dropdown, InlineLoading, InlineNotification } from '@carbon/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import DeceasedInfo from '../component/deceasedInfo/deceased-info.component';
|
|
5
|
-
import styles from './swap-unit.scss';
|
|
6
|
-
import { useAdmissionLocation } from '../hook/useMortuaryAdmissionLocation';
|
|
7
|
-
import { Controller, useForm } from 'react-hook-form';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { zodResolver } from '@hookform/resolvers/zod';
|
|
10
|
-
import { useVisit, showSnackbar, navigate } from '@openmrs/esm-framework';
|
|
11
|
-
import { useMortuaryOperation } from '../hook/useAdmitPatient';
|
|
12
|
-
|
|
13
|
-
interface SwapFormProps {
|
|
14
|
-
closeWorkspace: () => void;
|
|
15
|
-
patientUuid: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const schema = z.object({
|
|
19
|
-
availableCompartment: z.number().min(1, 'Please select an available compartment'),
|
|
20
|
-
});
|
|
21
|
-
const SwapForm: React.FC<SwapFormProps> = ({ closeWorkspace, patientUuid }) => {
|
|
22
|
-
const { t } = useTranslation();
|
|
23
|
-
const { admissionLocation, isLoading: isLoadingAdmissionLocation } = useAdmissionLocation();
|
|
24
|
-
const { currentVisit } = useVisit(patientUuid);
|
|
25
|
-
const { assignDeceasedToCompartment, removeDeceasedFromCompartment, createEncounterForCompartmentSwap } =
|
|
26
|
-
useMortuaryOperation();
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
control,
|
|
30
|
-
handleSubmit,
|
|
31
|
-
formState: { errors, isSubmitting },
|
|
32
|
-
} = useForm({
|
|
33
|
-
resolver: zodResolver(schema),
|
|
34
|
-
defaultValues: {
|
|
35
|
-
availableCompartment: '',
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const currentBed = admissionLocation?.bedLayouts?.find((bed) =>
|
|
40
|
-
bed.patients.some((patient) => patient.uuid === patientUuid),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const currentBedNumber = currentBed?.bedNumber;
|
|
44
|
-
|
|
45
|
-
const dropdownItems =
|
|
46
|
-
admissionLocation?.bedLayouts?.map((bed) => ({
|
|
47
|
-
bedId: bed.bedId,
|
|
48
|
-
display:
|
|
49
|
-
bed.status === 'OCCUPIED'
|
|
50
|
-
? `${bed.bedNumber} . ${bed.patients.map((patient) => patient?.person?.display).join(' . ')}`
|
|
51
|
-
: `${bed.bedNumber} . ${bed.status}`,
|
|
52
|
-
disabled: bed.bedId === currentBed?.bedId,
|
|
53
|
-
})) || [];
|
|
54
|
-
|
|
55
|
-
const onSubmit = async (data: any) => {
|
|
56
|
-
const { availableCompartment } = data;
|
|
57
|
-
const bedSelected = admissionLocation?.bedLayouts?.find((bed) => bed.bedId === availableCompartment);
|
|
58
|
-
const bedAssignedToPatient = admissionLocation?.bedLayouts?.find((bed) =>
|
|
59
|
-
bed.patients.some((patient) => patient.uuid === patientUuid),
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
const encounterResponse = await createEncounterForCompartmentSwap(patientUuid, currentVisit?.uuid);
|
|
64
|
-
|
|
65
|
-
if (encounterResponse.ok) {
|
|
66
|
-
if (bedSelected) {
|
|
67
|
-
const compartmentResponse = await assignDeceasedToCompartment(
|
|
68
|
-
patientUuid,
|
|
69
|
-
availableCompartment,
|
|
70
|
-
encounterResponse.data.uuid,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
if (compartmentResponse.ok) {
|
|
74
|
-
showSnackbar({
|
|
75
|
-
kind: 'success',
|
|
76
|
-
title: t('deceasedPatientAssignedNewBed', 'Deceased patient assigned to new compartment'),
|
|
77
|
-
subtitle: t(
|
|
78
|
-
'deceasedPatientAssignedNewBedDetail',
|
|
79
|
-
'{{patientName}} assigned to compartment {{bedNumber}}',
|
|
80
|
-
{
|
|
81
|
-
patientName: currentVisit?.patient?.person?.display,
|
|
82
|
-
bedNumber: bedSelected.bedNumber,
|
|
83
|
-
},
|
|
84
|
-
),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
} else if (bedAssignedToPatient) {
|
|
88
|
-
const unassignResponse = await removeDeceasedFromCompartment(patientUuid, bedAssignedToPatient.bedId);
|
|
89
|
-
|
|
90
|
-
if (unassignResponse.ok) {
|
|
91
|
-
showSnackbar({
|
|
92
|
-
kind: 'success',
|
|
93
|
-
title: t('patientUnassignedFromBed', 'Deceased patient unassigned from bed'),
|
|
94
|
-
subtitle: t('patientUnassignedFromBedDetail', '{{patientName}} is now unassigned from bed', {
|
|
95
|
-
patientName: currentVisit?.patient?.person?.display,
|
|
96
|
-
}),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} else {
|
|
101
|
-
<InlineNotification
|
|
102
|
-
kind="error"
|
|
103
|
-
title={t('errorCreatingEncounter', 'Error assigning deceased to compartment')}
|
|
104
|
-
/>;
|
|
105
|
-
}
|
|
106
|
-
} catch (error) {
|
|
107
|
-
showSnackbar({
|
|
108
|
-
kind: 'error',
|
|
109
|
-
title: t('errorChangingPatientBedAssignment', 'Error changing patient bed assignment'),
|
|
110
|
-
subtitle: error?.message,
|
|
111
|
-
});
|
|
112
|
-
} finally {
|
|
113
|
-
closeWorkspace();
|
|
114
|
-
navigate({ to: window.getOpenmrsSpaBase() + `home/morgue` });
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
if (isLoadingAdmissionLocation) {
|
|
119
|
-
return <InlineLoading status="active" iconDescription="Loading" description="Loading admission location..." />;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<Form className={styles.formContainer} onSubmit={handleSubmit(onSubmit)}>
|
|
124
|
-
<Stack gap={4} className={styles.formGrid}>
|
|
125
|
-
<DeceasedInfo patientUuid={patientUuid} />
|
|
126
|
-
|
|
127
|
-
{currentBedNumber && (
|
|
128
|
-
<Column className={styles.searchContainer}>
|
|
129
|
-
<p>
|
|
130
|
-
{t('currentCompartment', 'Current Compartment')}: {currentBedNumber}
|
|
131
|
-
</p>
|
|
132
|
-
</Column>
|
|
133
|
-
)}
|
|
134
|
-
|
|
135
|
-
<Column className={styles.searchContainer}>
|
|
136
|
-
<Controller
|
|
137
|
-
name="availableCompartment"
|
|
138
|
-
control={control}
|
|
139
|
-
render={({ field }) => (
|
|
140
|
-
<Dropdown
|
|
141
|
-
{...field}
|
|
142
|
-
id="avail-compartment"
|
|
143
|
-
className={styles.sectionField}
|
|
144
|
-
items={dropdownItems}
|
|
145
|
-
itemToString={(item) => item?.display || ''}
|
|
146
|
-
titleText={t('availableCompartment', 'Available Compartment')}
|
|
147
|
-
label={t('ChooseOptions', 'Choose option')}
|
|
148
|
-
onChange={({ selectedItem }) => field.onChange(selectedItem?.bedId)}
|
|
149
|
-
invalid={!!errors.availableCompartment}
|
|
150
|
-
invalidText={errors.availableCompartment?.message}
|
|
151
|
-
/>
|
|
152
|
-
)}
|
|
153
|
-
/>
|
|
154
|
-
</Column>
|
|
155
|
-
|
|
156
|
-
<ButtonSet className={styles.buttonSet}>
|
|
157
|
-
<Button size="lg" kind="secondary" onClick={closeWorkspace}>
|
|
158
|
-
{t('discard', 'Discard')}
|
|
159
|
-
</Button>
|
|
160
|
-
<Button kind="primary" size="lg" type="submit" disabled={isSubmitting}>
|
|
161
|
-
{isSubmitting ? <InlineLoading description={t('swapping', 'Swapping...')} /> : t('swap', 'Swap Unit')}
|
|
162
|
-
</Button>
|
|
163
|
-
</ButtonSet>
|
|
164
|
-
</Stack>
|
|
165
|
-
</Form>
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
export default SwapForm;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|