@kenyaemr/esm-bed-management-app 1.0.1-pre.4
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +37 -0
- package/.husky/pre-commit +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/6816f0d4.yml +0 -0
- package/LICENSE +373 -0
- package/README.md +40 -0
- package/dist/187.js +1 -0
- package/dist/187.js.map +1 -0
- package/dist/207.js +1 -0
- package/dist/207.js.map +1 -0
- package/dist/26.js +2 -0
- package/dist/26.js.LICENSE.txt +32 -0
- package/dist/26.js.map +1 -0
- package/dist/283.js +1 -0
- package/dist/283.js.map +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/294.js.map +1 -0
- package/dist/330.js +2 -0
- package/dist/330.js.LICENSE.txt +44 -0
- package/dist/330.js.map +1 -0
- package/dist/352.js +1 -0
- package/dist/352.js.map +1 -0
- package/dist/404.js +1 -0
- package/dist/404.js.map +1 -0
- package/dist/455.js +2 -0
- package/dist/455.js.LICENSE.txt +9 -0
- package/dist/455.js.map +1 -0
- package/dist/558.js +2 -0
- package/dist/558.js.LICENSE.txt +14 -0
- package/dist/558.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/629.js +1 -0
- package/dist/629.js.map +1 -0
- package/dist/707.js +1 -0
- package/dist/707.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/884.js +1 -0
- package/dist/884.js.map +1 -0
- package/dist/933.js +1 -0
- package/dist/933.js.map +1 -0
- package/dist/959.js +1 -0
- package/dist/959.js.map +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js.buildmanifest.json +532 -0
- package/dist/esm-kenyaemr-bed-management-app.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +0 -0
- package/package.json +112 -0
- package/src/__mocks__/react-i18next.js +55 -0
- package/src/admin-card-link.component.tsx +27 -0
- package/src/assets/landing-page.png +0 -0
- package/src/assets/logo.svg +1 -0
- package/src/bed-administration/bed-administration-form.component.tsx +326 -0
- package/src/bed-administration/bed-administration-form.scss +0 -0
- package/src/bed-administration/bed-administration-table.component.tsx +317 -0
- package/src/bed-administration/bed-administration-table.scss +112 -0
- package/src/bed-administration/bed-administration-types.ts +12 -0
- package/src/bed-administration/bed-administration.resource.ts +59 -0
- package/src/bed-administration/edit-bed-form.component.tsx +100 -0
- package/src/bed-administration/new-bed-form.component.tsx +112 -0
- package/src/bed-admission/active-patients/active-patients-table.component.tsx +299 -0
- package/src/bed-admission/active-patients/active-visits.resource.ts +171 -0
- package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
- package/src/bed-admission/active-patients/admission-action-button.component.tsx +26 -0
- package/src/bed-admission/active-patients/index.tsx +15 -0
- package/src/bed-admission/active-patients/patient-queues.resource.ts +136 -0
- package/src/bed-admission/active-patients/styles.scss +284 -0
- package/src/bed-admission/active-patients/view-action-menu.component.tsx +33 -0
- package/src/bed-admission/admitted-patients/active-admissions.resource.ts +121 -0
- package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +280 -0
- package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +22 -0
- package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +55 -0
- package/src/bed-admission/admitted-patients/styles.scss +284 -0
- package/src/bed-admission/bed-admission-tabs-styles.scss +30 -0
- package/src/bed-admission/bed-admission-tabs.component.tsx +69 -0
- package/src/bed-admission/bed-admission.component.tsx +15 -0
- package/src/bed-admission/bed-admission.resource.ts +35 -0
- package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +101 -0
- package/src/bed-admission/bed-layout/bed-layout.component.tsx +64 -0
- package/src/bed-admission/bed-layout/bed-layout.scss +118 -0
- package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +26 -0
- package/src/bed-admission/createDashboardLink.tsx +47 -0
- package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +19 -0
- package/src/bed-admission/helpers/functions.ts +102 -0
- package/src/bed-admission/types.ts +133 -0
- package/src/config-schema.ts +21 -0
- package/src/declarations.d.ts +7 -0
- package/src/empty-state/empty-state.component.tsx +69 -0
- package/src/empty-state/empty-state.scss +62 -0
- package/src/header/header.component.tsx +51 -0
- package/src/header/header.scss +72 -0
- package/src/header/illustration.component.tsx +13 -0
- package/src/home.component.tsx +15 -0
- package/src/home.scss +5 -0
- package/src/index.ts +65 -0
- package/src/left-panel/left-panel.component.tsx +33 -0
- package/src/left-panel/left-panel.scss +41 -0
- package/src/left-panel-link.component.tsx +49 -0
- package/src/root.component.tsx +35 -0
- package/src/root.scss +11 -0
- package/src/routes.json +46 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary/summary.component.tsx +74 -0
- package/src/summary/summary.resource.ts +123 -0
- package/src/summary/summary.scss +72 -0
- package/src/types.ts +152 -0
- package/src/ward-card/ward-card.component.tsx +41 -0
- package/src/ward-card/ward-card.scss +51 -0
- package/src/ward-with-beds/ward-with-beds.component.tsx +186 -0
- package/src/ward-with-beds/ward-with-beds.scss +27 -0
- package/src/workspace/allocate-bed-workspace.component.tsx +141 -0
- package/src/workspace/allocate-bed.scss +117 -0
- package/src/workspace/overlay.component.tsx +55 -0
- package/src/workspace/overlay.scss +96 -0
- package/translations/en.json +7 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +1 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { KeyedMutator } from "swr";
|
|
2
|
+
|
|
3
|
+
export type Tag = {
|
|
4
|
+
uuid: string;
|
|
5
|
+
display: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
retired: boolean;
|
|
9
|
+
links: Array<{
|
|
10
|
+
rel: string;
|
|
11
|
+
uri: string;
|
|
12
|
+
resourceAlias: string;
|
|
13
|
+
}>;
|
|
14
|
+
resourceVersion: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type Location = {
|
|
18
|
+
uuid: string;
|
|
19
|
+
display: string;
|
|
20
|
+
name: string;
|
|
21
|
+
description: string | null;
|
|
22
|
+
address1: string | null;
|
|
23
|
+
address2: string | null;
|
|
24
|
+
cityVillage: string | null;
|
|
25
|
+
stateProvince: string | null;
|
|
26
|
+
country: string | null;
|
|
27
|
+
postalCode: string | null;
|
|
28
|
+
latitude: string | null;
|
|
29
|
+
longitude: string | null;
|
|
30
|
+
countyDistrict: string | null;
|
|
31
|
+
address3: string | null;
|
|
32
|
+
address4: string | null;
|
|
33
|
+
address5: string | null;
|
|
34
|
+
address6: string | null;
|
|
35
|
+
tags: Tag[];
|
|
36
|
+
parentLocation: Location;
|
|
37
|
+
childLocations: Location[];
|
|
38
|
+
retired: boolean;
|
|
39
|
+
auditInfo: {
|
|
40
|
+
creator: {
|
|
41
|
+
uuid: string;
|
|
42
|
+
display: string;
|
|
43
|
+
links: Array<{
|
|
44
|
+
rel: string;
|
|
45
|
+
uri: string;
|
|
46
|
+
resourceAlias: string;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
dateCreated: string;
|
|
50
|
+
changedBy: null;
|
|
51
|
+
dateChanged: null;
|
|
52
|
+
};
|
|
53
|
+
address7: string | null;
|
|
54
|
+
address8: string | null;
|
|
55
|
+
address9: string | null;
|
|
56
|
+
address10: string | null;
|
|
57
|
+
address11: string | null;
|
|
58
|
+
address12: string | null;
|
|
59
|
+
address13: string | null;
|
|
60
|
+
address14: string | null;
|
|
61
|
+
address15: string | null;
|
|
62
|
+
links: Array<{
|
|
63
|
+
rel: string;
|
|
64
|
+
uri: string;
|
|
65
|
+
resourceAlias: string;
|
|
66
|
+
}>;
|
|
67
|
+
resourceVersion: string;
|
|
68
|
+
beds: Bed[];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export interface Bed {
|
|
72
|
+
id: number;
|
|
73
|
+
bedId: number;
|
|
74
|
+
uuid: string;
|
|
75
|
+
bedNumber: string;
|
|
76
|
+
bedType: {
|
|
77
|
+
uuid: string;
|
|
78
|
+
name: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
description: string;
|
|
81
|
+
resourceVersion: string;
|
|
82
|
+
};
|
|
83
|
+
row: number;
|
|
84
|
+
column: number;
|
|
85
|
+
status: "AVAILABLE" | string;
|
|
86
|
+
location: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface BedType {
|
|
90
|
+
uuid: string;
|
|
91
|
+
name: string;
|
|
92
|
+
displayName: string;
|
|
93
|
+
description: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface InitialData {
|
|
97
|
+
uuid: string;
|
|
98
|
+
bedNumber: string;
|
|
99
|
+
status: string;
|
|
100
|
+
description: string;
|
|
101
|
+
row: number;
|
|
102
|
+
column: number;
|
|
103
|
+
location: {
|
|
104
|
+
display: string;
|
|
105
|
+
uuid: string;
|
|
106
|
+
};
|
|
107
|
+
bedType: {
|
|
108
|
+
name: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type Mutator = KeyedMutator<{
|
|
113
|
+
data: {
|
|
114
|
+
results: Array<Location>;
|
|
115
|
+
};
|
|
116
|
+
}>;
|
|
117
|
+
|
|
118
|
+
export type AdmissionLocation = {
|
|
119
|
+
ward: {
|
|
120
|
+
uuid: string;
|
|
121
|
+
display: string;
|
|
122
|
+
name: string;
|
|
123
|
+
description: string;
|
|
124
|
+
};
|
|
125
|
+
totalBeds: number;
|
|
126
|
+
occupiedBeds: number;
|
|
127
|
+
bedLayouts: Array<BedDetails>;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type MappedBedData = Array<{
|
|
131
|
+
id: number;
|
|
132
|
+
number: string;
|
|
133
|
+
name: string;
|
|
134
|
+
description: string;
|
|
135
|
+
status: string;
|
|
136
|
+
uuid: string;
|
|
137
|
+
}>;
|
|
138
|
+
|
|
139
|
+
export interface BedDetails extends Bed {
|
|
140
|
+
patient: null | {
|
|
141
|
+
uuid: string;
|
|
142
|
+
person: {
|
|
143
|
+
gender: string;
|
|
144
|
+
age: number;
|
|
145
|
+
preferredName: {
|
|
146
|
+
givenName: string;
|
|
147
|
+
familyName: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
identifiers: Array<{ identifier: string }>;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Layer, Tile } from "@carbon/react";
|
|
3
|
+
import styles from "./ward-card.scss";
|
|
4
|
+
|
|
5
|
+
interface WardCardProps {
|
|
6
|
+
label: string;
|
|
7
|
+
value: number | string;
|
|
8
|
+
headerLabel: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
service?: string;
|
|
11
|
+
serviceUuid?: string;
|
|
12
|
+
locationUuid?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const WardCard: React.FC<WardCardProps> = ({
|
|
16
|
+
children,
|
|
17
|
+
headerLabel,
|
|
18
|
+
label,
|
|
19
|
+
value,
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<Layer
|
|
23
|
+
className={`${children && styles.cardWithChildren} ${styles.container}`}
|
|
24
|
+
>
|
|
25
|
+
<Tile className={styles.tileContainer}>
|
|
26
|
+
<div className={styles.tileHeader}>
|
|
27
|
+
<div className={styles.headerLabelContainer}>
|
|
28
|
+
<label className={styles.headerLabel}>{headerLabel}</label>
|
|
29
|
+
</div>
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
<div>
|
|
33
|
+
<label className={styles.totalsLabel}>{label}</label>
|
|
34
|
+
<p className={styles.totalsValue}>{value}</p>
|
|
35
|
+
</div>
|
|
36
|
+
</Tile>
|
|
37
|
+
</Layer>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default WardCard;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use "@carbon/type";
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
flex-grow: 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tileContainer {
|
|
10
|
+
border: 1px solid colors.$gray-20;
|
|
11
|
+
height: 7.875rem;
|
|
12
|
+
padding: layout.$spacing-05;
|
|
13
|
+
margin: layout.$spacing-03 layout.$spacing-03;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tileHeader {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: baseline;
|
|
20
|
+
margin-bottom: layout.$spacing-03;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.headerLabel {
|
|
24
|
+
@include type.type-style('heading-compact-01');
|
|
25
|
+
color: colors.$gray-70;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.totalsLabel {
|
|
29
|
+
@include type.type-style('label-01');
|
|
30
|
+
color: colors.$gray-70;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.totalsValue {
|
|
34
|
+
@include type.type-style('heading-04');
|
|
35
|
+
color: colors.$gray-100;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.headerLabelContainer {
|
|
39
|
+
margin-bottom: 1rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.link {
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
color: colors.$blue-60;
|
|
47
|
+
|
|
48
|
+
svg {
|
|
49
|
+
margin-left: layout.$spacing-03;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
DataTable,
|
|
7
|
+
DataTableSkeleton,
|
|
8
|
+
Pagination,
|
|
9
|
+
TableContainer,
|
|
10
|
+
Table,
|
|
11
|
+
TableHead,
|
|
12
|
+
TableRow,
|
|
13
|
+
TableHeader,
|
|
14
|
+
TableBody,
|
|
15
|
+
TableCell,
|
|
16
|
+
Tag,
|
|
17
|
+
} from "@carbon/react";
|
|
18
|
+
import { ArrowLeft } from "@carbon/react/icons";
|
|
19
|
+
import { navigate, usePagination } from "@openmrs/esm-framework";
|
|
20
|
+
import Header from "../header/header.component";
|
|
21
|
+
import {
|
|
22
|
+
useBedsForLocation,
|
|
23
|
+
useLocationName,
|
|
24
|
+
} from "../summary/summary.resource";
|
|
25
|
+
import styles from "./ward-with-beds.scss";
|
|
26
|
+
|
|
27
|
+
type RouteParams = { location: string };
|
|
28
|
+
|
|
29
|
+
const WardWithBeds: React.FC = () => {
|
|
30
|
+
const { location } = useParams<RouteParams>();
|
|
31
|
+
const { isLoading, bedData } = useBedsForLocation(location);
|
|
32
|
+
|
|
33
|
+
const { name } = useLocationName(location);
|
|
34
|
+
|
|
35
|
+
const [pageSize, setPageSize] = useState(10);
|
|
36
|
+
const {
|
|
37
|
+
results: paginatedData,
|
|
38
|
+
goTo,
|
|
39
|
+
currentPage,
|
|
40
|
+
} = usePagination(bedData, pageSize);
|
|
41
|
+
|
|
42
|
+
if (isLoading) {
|
|
43
|
+
<p>Loading...</p>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const tableHeaders = [
|
|
47
|
+
{
|
|
48
|
+
id: 0,
|
|
49
|
+
header: "ID",
|
|
50
|
+
key: "id",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 1,
|
|
54
|
+
header: "Number",
|
|
55
|
+
key: "number",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 2,
|
|
59
|
+
header: "Name",
|
|
60
|
+
key: "name",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 3,
|
|
64
|
+
header: "Description",
|
|
65
|
+
key: "description",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 4,
|
|
69
|
+
header: "Occupied",
|
|
70
|
+
key: "occupied",
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const CustomTag = ({ condition }: { condition: boolean }) => {
|
|
75
|
+
const { t } = useTranslation();
|
|
76
|
+
|
|
77
|
+
if (condition) {
|
|
78
|
+
return (
|
|
79
|
+
<Tag type="green" size="md">
|
|
80
|
+
{t("yes", "Yes")}
|
|
81
|
+
</Tag>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Tag type="red" size="md">
|
|
87
|
+
{t("no", "No")}
|
|
88
|
+
</Tag>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const tableRows = useMemo(() => {
|
|
93
|
+
return paginatedData?.map((bed) => ({
|
|
94
|
+
id: bed.id,
|
|
95
|
+
number: bed.number,
|
|
96
|
+
name: bed.name,
|
|
97
|
+
description: bed.description,
|
|
98
|
+
occupied: <CustomTag condition={bed?.status === "OCCUPIED"} />,
|
|
99
|
+
}));
|
|
100
|
+
}, [paginatedData]);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<Header route={name ? name : "--"} />
|
|
105
|
+
{isLoading && (
|
|
106
|
+
<div className={styles.container}>
|
|
107
|
+
<DataTableSkeleton role="progressbar" zebra />
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{bedData?.length ? (
|
|
112
|
+
<>
|
|
113
|
+
<div className={styles.backButton}>
|
|
114
|
+
<Button
|
|
115
|
+
kind="ghost"
|
|
116
|
+
renderIcon={(props) => <ArrowLeft size={24} {...props} />}
|
|
117
|
+
iconDescription="Return to summary"
|
|
118
|
+
onClick={() =>
|
|
119
|
+
navigate({
|
|
120
|
+
to: `${window.getOpenmrsSpaBase()}bed-management`,
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<span>Return to summary</span>
|
|
125
|
+
</Button>
|
|
126
|
+
</div>
|
|
127
|
+
<div className={styles.container}>
|
|
128
|
+
<DataTable rows={tableRows} headers={tableHeaders} useZebraStyles>
|
|
129
|
+
{({
|
|
130
|
+
rows,
|
|
131
|
+
headers,
|
|
132
|
+
getHeaderProps,
|
|
133
|
+
getRowProps,
|
|
134
|
+
getTableProps,
|
|
135
|
+
}) => (
|
|
136
|
+
<TableContainer>
|
|
137
|
+
<Table {...getTableProps()}>
|
|
138
|
+
<TableHead>
|
|
139
|
+
<TableRow>
|
|
140
|
+
{headers.map((header) => (
|
|
141
|
+
<TableHeader
|
|
142
|
+
key={header.key}
|
|
143
|
+
{...getHeaderProps({ header })}
|
|
144
|
+
>
|
|
145
|
+
{header.header}
|
|
146
|
+
</TableHeader>
|
|
147
|
+
))}
|
|
148
|
+
</TableRow>
|
|
149
|
+
</TableHead>
|
|
150
|
+
<TableBody>
|
|
151
|
+
{rows.map((row) => (
|
|
152
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
153
|
+
{row.cells.map((cell) => (
|
|
154
|
+
<TableCell key={cell.id}>
|
|
155
|
+
{cell.value?.content ?? cell.value}
|
|
156
|
+
</TableCell>
|
|
157
|
+
))}
|
|
158
|
+
</TableRow>
|
|
159
|
+
))}
|
|
160
|
+
</TableBody>
|
|
161
|
+
</Table>
|
|
162
|
+
</TableContainer>
|
|
163
|
+
)}
|
|
164
|
+
</DataTable>
|
|
165
|
+
<Pagination
|
|
166
|
+
backwardText="Previous page"
|
|
167
|
+
forwardText="Next page"
|
|
168
|
+
itemsPerPageText="Items per page:"
|
|
169
|
+
page={currentPage}
|
|
170
|
+
pageNumberText="Page Number"
|
|
171
|
+
pageSize={pageSize}
|
|
172
|
+
onChange={({ page, pageSize }) => {
|
|
173
|
+
goTo(page);
|
|
174
|
+
setPageSize(pageSize);
|
|
175
|
+
}}
|
|
176
|
+
pageSizes={[10, 20, 30, 40, 50]}
|
|
177
|
+
totalItems={paginatedData?.length}
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
</>
|
|
181
|
+
) : null}
|
|
182
|
+
</>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default WardWithBeds;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
|
|
3
|
+
.container {
|
|
4
|
+
margin: 1rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.backButton {
|
|
8
|
+
align-items: center;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
margin-left: 1rem;
|
|
12
|
+
|
|
13
|
+
button {
|
|
14
|
+
display: flex;
|
|
15
|
+
padding-left: 0 !important;
|
|
16
|
+
|
|
17
|
+
svg {
|
|
18
|
+
order: 1;
|
|
19
|
+
margin-right: layout.$spacing-03;
|
|
20
|
+
margin-left: 0.5 !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
span {
|
|
24
|
+
order: 2;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { Stack, ButtonSet, Button } from "@carbon/react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import {
|
|
6
|
+
showNotification,
|
|
7
|
+
showToast,
|
|
8
|
+
useConfig,
|
|
9
|
+
useLayoutType,
|
|
10
|
+
} from "@openmrs/esm-framework";
|
|
11
|
+
import styles from "./allocate-bed.scss";
|
|
12
|
+
import Overlay from "./overlay.component";
|
|
13
|
+
import {
|
|
14
|
+
assignPatientBed,
|
|
15
|
+
endPatientQueue,
|
|
16
|
+
} from "../bed-admission/bed-admission.resource";
|
|
17
|
+
import BedLayoutList from "../bed-admission/bed-layout/bed-layout-list.component";
|
|
18
|
+
import LocationComboBox from "../bed-admission/admitted-patients/location-combo-box.component";
|
|
19
|
+
import { Bed } from "../types";
|
|
20
|
+
|
|
21
|
+
interface WorkSpaceProps {
|
|
22
|
+
closePanel: (e: boolean) => void;
|
|
23
|
+
headerTitle?: string;
|
|
24
|
+
queueStatus: string;
|
|
25
|
+
patientDetails: {
|
|
26
|
+
name: string;
|
|
27
|
+
patientUuid: string;
|
|
28
|
+
locationUuid: string;
|
|
29
|
+
locationTo: string;
|
|
30
|
+
locationFrom: string;
|
|
31
|
+
queueUuid: string;
|
|
32
|
+
encounter: {
|
|
33
|
+
uuid: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const AllocateBedWorkSpace: React.FC<WorkSpaceProps> = ({
|
|
39
|
+
headerTitle,
|
|
40
|
+
closePanel,
|
|
41
|
+
patientDetails,
|
|
42
|
+
queueStatus,
|
|
43
|
+
}) => {
|
|
44
|
+
const { t } = useTranslation();
|
|
45
|
+
const isTablet = useLayoutType() === "tablet";
|
|
46
|
+
const [selectedBed, setSelectedBed] = useState<Bed>();
|
|
47
|
+
const [isBedAssigned, setIsBedAssigned] = useState(false);
|
|
48
|
+
const [isQueueEnded, setIsQueueEnded] = useState(false);
|
|
49
|
+
const { restrictWardAdministrationToLoginLocation } = useConfig();
|
|
50
|
+
const [locationUuid, setLocation] = useState(
|
|
51
|
+
restrictWardAdministrationToLoginLocation ? patientDetails.locationUuid : ""
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const handleClick = (bed) => {
|
|
55
|
+
setSelectedBed(bed);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleAssignBedToPatient = useCallback(() => {
|
|
59
|
+
const patientAndEncounterUuids = {
|
|
60
|
+
encounterUuid:
|
|
61
|
+
patientDetails?.encounter?.uuid ??
|
|
62
|
+
"84d26085-da4c-461a-8481-7c95ed3f4558",
|
|
63
|
+
patientUuid: patientDetails.patientUuid,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
assignPatientBed(patientAndEncounterUuids, selectedBed.bedId)
|
|
67
|
+
.then(() => {
|
|
68
|
+
setIsBedAssigned(true);
|
|
69
|
+
showToast({
|
|
70
|
+
title: t("bedAssigned", "Bed Assigned"),
|
|
71
|
+
kind: "success",
|
|
72
|
+
critical: true,
|
|
73
|
+
description: `Bed ${selectedBed.bedNumber} was assigned to ${patientDetails.name} successfully.`,
|
|
74
|
+
});
|
|
75
|
+
closePanel(false);
|
|
76
|
+
})
|
|
77
|
+
.catch((error) => {
|
|
78
|
+
showNotification({
|
|
79
|
+
title: t("errorAssigningBed", "Error assigning bed"),
|
|
80
|
+
kind: "error",
|
|
81
|
+
critical: true,
|
|
82
|
+
description: error?.message,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}, [patientDetails, selectedBed, t]);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<Overlay header={headerTitle} closePanel={() => closePanel(false)}>
|
|
90
|
+
<div className={styles.container}>
|
|
91
|
+
<Stack gap={8} className={styles.container}>
|
|
92
|
+
<section className={styles.section}>
|
|
93
|
+
{restrictWardAdministrationToLoginLocation ? (
|
|
94
|
+
<LocationComboBox setLocationUuid={setLocation} />
|
|
95
|
+
) : (
|
|
96
|
+
<>
|
|
97
|
+
<LocationComboBox setLocationUuid={setLocation} />
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
<BedLayoutList
|
|
101
|
+
locationUuid={locationUuid}
|
|
102
|
+
handleClick={handleClick}
|
|
103
|
+
patientDetails={patientDetails}
|
|
104
|
+
/>{" "}
|
|
105
|
+
</section>
|
|
106
|
+
</Stack>
|
|
107
|
+
</div>
|
|
108
|
+
{selectedBed && (
|
|
109
|
+
<span className={styles.admitPatientInfo}>
|
|
110
|
+
{" "}
|
|
111
|
+
{t(
|
|
112
|
+
"admittingPatientToBedText",
|
|
113
|
+
`Click Save button to admit patient to Bed ${selectedBed.bedNumber}`
|
|
114
|
+
)}
|
|
115
|
+
</span>
|
|
116
|
+
)}
|
|
117
|
+
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
|
118
|
+
<Button
|
|
119
|
+
className={styles.button}
|
|
120
|
+
kind="secondary"
|
|
121
|
+
onClick={closePanel}
|
|
122
|
+
>
|
|
123
|
+
{t("discard", "Discard")}
|
|
124
|
+
</Button>
|
|
125
|
+
<Button
|
|
126
|
+
onClick={handleAssignBedToPatient}
|
|
127
|
+
className={classNames(styles.button, {
|
|
128
|
+
[styles.disabled]: !selectedBed,
|
|
129
|
+
})}
|
|
130
|
+
kind="primary"
|
|
131
|
+
type="submit"
|
|
132
|
+
>
|
|
133
|
+
{t("save", "Save")}
|
|
134
|
+
</Button>
|
|
135
|
+
</ButtonSet>
|
|
136
|
+
</Overlay>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default AllocateBedWorkSpace;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
// margin: spacing.$spacing-05 0rem;
|
|
7
|
+
background-color: $ui-background;
|
|
8
|
+
max-height: 100%;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
& section {
|
|
12
|
+
margin: spacing.$spacing-09 0 0;
|
|
13
|
+
// overflow-y: auto;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:global(.cds--text-input) {
|
|
18
|
+
&:focus,
|
|
19
|
+
&:hover {
|
|
20
|
+
outline: 2px solid var(--cds-focus,#ff832b);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.admitPatientInfo {
|
|
26
|
+
padding: 2rem;
|
|
27
|
+
background-color: #fff;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.heading {
|
|
31
|
+
@include type.type-style('heading-03');
|
|
32
|
+
margin: spacing.$spacing-05;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sectionTitle {
|
|
36
|
+
@include type.type-style('heading-compact-02');
|
|
37
|
+
color: $text-02;
|
|
38
|
+
margin-bottom: spacing.$spacing-05;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dateTimeSection {
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.radioButton {
|
|
46
|
+
margin: spacing.$spacing-05 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.headerGridRow {
|
|
50
|
+
border-bottom: 0.0625rem solid $grey-2;
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dataGridRow {
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: 50% 10% 1fr;
|
|
57
|
+
margin: spacing.$spacing-03 spacing.$spacing-05;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.form {
|
|
62
|
+
background-color: $ui-background;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.button {
|
|
69
|
+
height: 4rem;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-content: flex-start;
|
|
72
|
+
align-items: baseline;
|
|
73
|
+
min-width: 50%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tablet {
|
|
77
|
+
padding: spacing.$spacing-06 spacing.$spacing-05;
|
|
78
|
+
background-color: $ui-02;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.desktop {
|
|
82
|
+
padding: 0rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media screen and (max-width: 600px) {
|
|
86
|
+
.dateTimeSection {
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.backButton {
|
|
92
|
+
align-items: center;
|
|
93
|
+
display: flex;
|
|
94
|
+
justify-content: flex-start;
|
|
95
|
+
margin: spacing.$spacing-03 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
@include type.type-style('body-compact-01');
|
|
98
|
+
|
|
99
|
+
button {
|
|
100
|
+
display: flex;
|
|
101
|
+
|
|
102
|
+
svg {
|
|
103
|
+
order: 1;
|
|
104
|
+
margin-right: spacing.$spacing-03;
|
|
105
|
+
margin-left: 0rem !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
span {
|
|
109
|
+
order: 2;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.disabled {
|
|
115
|
+
opacity: 0.8;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|