@kenyaemr/esm-bed-management-app 1.0.1-pre.7 → 8.0.3-pre.131
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 +36 -0
- package/README.md +6 -38
- package/dist/130.js +2 -0
- package/dist/{800.js.LICENSE.txt → 130.js.LICENSE.txt} +2 -0
- package/dist/130.js.map +1 -0
- package/dist/148.js +1 -0
- package/dist/148.js.map +1 -0
- package/dist/169.js +1 -0
- package/dist/169.js.map +1 -0
- package/dist/271.js +1 -0
- package/dist/319.js +1 -0
- package/dist/325.js +1 -0
- package/dist/325.js.map +1 -0
- package/dist/339.js +1 -0
- package/dist/339.js.map +1 -0
- package/dist/455.js +1 -1
- package/dist/455.js.LICENSE.txt +6 -0
- package/dist/455.js.map +1 -1
- package/dist/460.js +1 -0
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/542.js +1 -0
- package/dist/542.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/591.js +2 -0
- package/dist/{26.js.LICENSE.txt → 591.js.LICENSE.txt} +3 -3
- package/dist/591.js.map +1 -0
- package/dist/644.js +1 -0
- package/dist/757.js +1 -0
- package/dist/766.js +2 -0
- package/dist/{330.js.LICENSE.txt → 766.js.LICENSE.txt} +0 -9
- package/dist/766.js.map +1 -0
- package/dist/{294.js → 784.js} +2 -2
- package/dist/{294.js.map → 784.js.map} +1 -1
- package/dist/788.js +1 -0
- package/dist/807.js +1 -0
- package/dist/833.js +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-bed-management-app.js +1 -0
- package/dist/{esm-kenyaemr-bed-management-app.js.buildmanifest.json → openmrs-esm-bed-management-app.js.buildmanifest.json} +202 -155
- package/dist/openmrs-esm-bed-management-app.js.map +1 -0
- package/dist/routes.json +1 -1
- package/jest.config.js +3 -0
- package/package-lock.json +5893 -0
- package/package.json +25 -82
- package/src/__mocks__/react-i18next.js +18 -14
- package/src/admin-card-link.component.tsx +7 -10
- package/src/bed-administration/bed-administration-form.component.tsx +65 -99
- package/src/bed-administration/bed-administration-table.component.tsx +68 -127
- package/src/bed-administration/bed-administration-table.scss +12 -16
- package/src/bed-administration/bed-administration.resource.ts +16 -18
- package/src/bed-administration/edit-bed-form.component.tsx +20 -31
- package/src/bed-administration/new-bed-form.component.tsx +28 -44
- package/src/{bed-admission/bed-tag → bed-tag}/bed-tag-administration-table.component.tsx +35 -60
- package/src/{bed-admission/bed-tag → bed-tag}/bed-tags-admin-form.component.tsx +30 -34
- package/src/{bed-admission/bed-tag → bed-tag}/edit-tag-form.component.tsx +17 -25
- package/src/{bed-admission/bed-tag → bed-tag}/new-tag-form.component.tsx +20 -27
- package/src/{bed-admission/bed-type → bed-type}/bed-type-admin-form.component.tsx +37 -44
- package/src/{bed-admission/bed-type → bed-type}/bed-type-administration-table.component.tsx +36 -60
- package/src/{bed-admission/bed-type → bed-type}/edit-bed-type.component.tsx +17 -25
- package/src/{bed-admission/bed-type → bed-type}/new-bed-type-form.component.tsx +21 -28
- package/src/card-header/card-header.component.tsx +20 -0
- package/src/card-header/card-header.scss +45 -0
- package/src/config-schema.ts +9 -17
- package/src/declarations.d.ts +5 -5
- package/src/empty-state/empty-state.component.tsx +6 -21
- package/src/empty-state/empty-state.scss +10 -10
- package/src/header/header.component.tsx +14 -23
- package/src/header/header.scss +11 -11
- package/src/header/illustration.component.tsx +3 -3
- package/src/home.component.tsx +4 -4
- package/src/index.ts +21 -48
- package/src/left-panel/left-panel.component.tsx +7 -17
- package/src/left-panel/left-panel.scss +8 -7
- package/src/left-panel-link.component.tsx +14 -24
- package/src/root.component.tsx +12 -12
- package/src/root.scss +2 -2
- package/src/routes.json +12 -12
- package/src/setup-tests.ts +1 -1
- package/src/summary/summary.component.tsx +16 -30
- package/src/summary/summary.resource.ts +116 -95
- package/src/summary/summary.scss +31 -29
- package/src/types.ts +50 -40
- package/src/ward-card/ward-card.component.tsx +5 -12
- package/src/ward-card/ward-card.scss +2 -2
- package/src/ward-with-beds/ward-with-beds.component.tsx +28 -47
- package/src/ward-with-beds/ward-with-beds.scss +5 -5
- package/translations/am.json +51 -0
- package/translations/ar.json +51 -0
- package/translations/en.json +48 -4
- package/translations/es.json +51 -0
- package/translations/fr.json +51 -0
- package/translations/he.json +51 -0
- package/translations/km.json +51 -0
- package/translations/zh.json +51 -0
- package/translations/zh_CN.json +51 -0
- package/tsconfig.json +3 -21
- package/webpack.config.js +1 -1
- package/.editorconfig +0 -12
- package/.eslintignore +0 -2
- package/.eslintrc +0 -37
- package/.husky/pre-commit +0 -4
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.prettierignore +0 -14
- package/.turbo.json +0 -18
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +0 -550
- package/.yarn/versions/cb9a89ac.yml +0 -0
- package/LICENSE +0 -373
- package/dist/187.js +0 -1
- package/dist/187.js.map +0 -1
- package/dist/207.js +0 -1
- package/dist/207.js.map +0 -1
- package/dist/26.js +0 -2
- package/dist/26.js.map +0 -1
- package/dist/283.js +0 -1
- package/dist/283.js.map +0 -1
- package/dist/330.js +0 -2
- package/dist/330.js.map +0 -1
- package/dist/352.js +0 -1
- package/dist/352.js.map +0 -1
- package/dist/404.js +0 -1
- package/dist/404.js.map +0 -1
- package/dist/558.js +0 -2
- package/dist/558.js.LICENSE.txt +0 -14
- package/dist/558.js.map +0 -1
- package/dist/629.js +0 -1
- package/dist/629.js.map +0 -1
- package/dist/707.js +0 -1
- package/dist/707.js.map +0 -1
- package/dist/800.js +0 -2
- package/dist/800.js.map +0 -1
- package/dist/850.js +0 -1
- package/dist/850.js.map +0 -1
- package/dist/884.js +0 -1
- package/dist/884.js.map +0 -1
- package/dist/933.js +0 -1
- package/dist/933.js.map +0 -1
- package/dist/esm-kenyaemr-bed-management-app.js +0 -1
- package/dist/esm-kenyaemr-bed-management-app.js.map +0 -1
- package/i18next-parser.config.js +0 -89
- package/src/assets/landing-page.png +0 -0
- package/src/assets/logo.svg +0 -1
- package/src/bed-admission/active-patients/active-patients-table.component.tsx +0 -299
- package/src/bed-admission/active-patients/active-visits.resource.ts +0 -171
- package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
- package/src/bed-admission/active-patients/admission-action-button.component.tsx +0 -26
- package/src/bed-admission/active-patients/index.tsx +0 -15
- package/src/bed-admission/active-patients/patient-queues.resource.ts +0 -136
- package/src/bed-admission/active-patients/styles.scss +0 -284
- package/src/bed-admission/active-patients/view-action-menu.component.tsx +0 -33
- package/src/bed-admission/admitted-patients/active-admissions.resource.ts +0 -121
- package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +0 -280
- package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +0 -22
- package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +0 -55
- package/src/bed-admission/admitted-patients/styles.scss +0 -284
- package/src/bed-admission/bed-admission-tabs-styles.scss +0 -30
- package/src/bed-admission/bed-admission-tabs.component.tsx +0 -69
- package/src/bed-admission/bed-admission.component.tsx +0 -15
- package/src/bed-admission/bed-admission.resource.ts +0 -35
- package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +0 -101
- package/src/bed-admission/bed-layout/bed-layout.component.tsx +0 -64
- package/src/bed-admission/bed-layout/bed-layout.scss +0 -118
- package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +0 -26
- package/src/bed-admission/createDashboardLink.tsx +0 -47
- package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +0 -19
- package/src/bed-admission/helpers/functions.ts +0 -102
- package/src/bed-admission/types.ts +0 -133
- package/src/workspace/allocate-bed-workspace.component.tsx +0 -141
- package/src/workspace/allocate-bed.scss +0 -117
- package/src/workspace/overlay.component.tsx +0 -55
- package/src/workspace/overlay.scss +0 -96
- /package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import useSWR from
|
|
2
|
-
import { FetchResponse, openmrsFetch } from
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import useSWR from 'swr';
|
|
2
|
+
import { type FetchResponse, openmrsFetch, useConfig } from '@openmrs/esm-framework';
|
|
3
|
+
import type {
|
|
4
|
+
AdmissionLocation,
|
|
5
|
+
Bed,
|
|
6
|
+
BedFetchResponse,
|
|
7
|
+
BedTagPayload,
|
|
8
|
+
BedTypePayload,
|
|
9
|
+
LocationFetchResponse,
|
|
10
|
+
MappedBedData,
|
|
11
|
+
Mutator,
|
|
12
|
+
} from '../types';
|
|
13
|
+
import { type BedManagementConfig } from '../config-schema';
|
|
14
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
15
|
+
|
|
16
|
+
export const useLocationsWithAdmissionTag = () => {
|
|
17
|
+
const { admissionLocationTagName } = useConfig<BedManagementConfig>();
|
|
18
|
+
const locationsUrl = `/ws/rest/v1/location?tag=${admissionLocationTagName}&v=full`;
|
|
19
|
+
|
|
20
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<LocationFetchResponse, Error>(
|
|
21
|
+
admissionLocationTagName ? locationsUrl : null,
|
|
22
|
+
openmrsFetch,
|
|
23
|
+
);
|
|
12
24
|
|
|
13
25
|
return {
|
|
14
26
|
data: data?.data?.results ?? [],
|
|
@@ -19,33 +31,23 @@ export const useLocationsByTag = (locationUuid: string) => {
|
|
|
19
31
|
};
|
|
20
32
|
};
|
|
21
33
|
|
|
22
|
-
export const getBedsForLocation = (locationUuid: string) => {
|
|
23
|
-
const locationsUrl = `/ws/rest/v1/bed?locationUuid=${locationUuid}`;
|
|
24
|
-
|
|
25
|
-
return openmrsFetch(locationsUrl, {
|
|
26
|
-
method: "GET",
|
|
27
|
-
}).then((res) => res?.data?.results ?? []);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
34
|
export const useBedsForLocation = (locationUuid: string) => {
|
|
31
35
|
const apiUrl = `/ws/rest/v1/bed?locationUuid=${locationUuid}&v=full`;
|
|
32
36
|
|
|
33
|
-
const { data, isLoading, error } = useSWR<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
>(locationUuid ? apiUrl : null, openmrsFetch);
|
|
37
|
-
|
|
38
|
-
const mappedBedData: MappedBedData = (data?.data?.results ?? []).map(
|
|
39
|
-
(bed) => ({
|
|
40
|
-
id: bed.id,
|
|
41
|
-
number: bed.bedNumber,
|
|
42
|
-
name: bed.bedType?.displayName,
|
|
43
|
-
description: bed.bedType?.description,
|
|
44
|
-
status: bed.status,
|
|
45
|
-
uuid: bed.uuid,
|
|
46
|
-
})
|
|
37
|
+
const { data, isLoading, error } = useSWR<{ data: { results: Array<Bed> } }, Error>(
|
|
38
|
+
locationUuid ? apiUrl : null,
|
|
39
|
+
openmrsFetch,
|
|
47
40
|
);
|
|
48
41
|
|
|
42
|
+
const mappedBedData: MappedBedData = (data?.data?.results ?? []).map((bed) => ({
|
|
43
|
+
id: bed.id,
|
|
44
|
+
number: bed.bedNumber,
|
|
45
|
+
name: bed.bedType?.displayName,
|
|
46
|
+
description: bed.bedType?.description,
|
|
47
|
+
status: bed.status,
|
|
48
|
+
uuid: bed.uuid,
|
|
49
|
+
}));
|
|
50
|
+
|
|
49
51
|
return {
|
|
50
52
|
bedData: mappedBedData,
|
|
51
53
|
isLoading,
|
|
@@ -54,41 +56,65 @@ export const useBedsForLocation = (locationUuid: string) => {
|
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
export const useLocationName = (locationUuid: string) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const { data, isLoading } = useSWR<{ data }, Error>(
|
|
60
|
-
locationUuid ? apiUrl : null,
|
|
61
|
-
openmrsFetch
|
|
62
|
-
);
|
|
59
|
+
const { data: allLocations, isLoading } = useLocationsWithAdmissionTag();
|
|
63
60
|
|
|
61
|
+
const location = allLocations.find((loc) => loc.uuid == locationUuid);
|
|
64
62
|
return {
|
|
65
|
-
name:
|
|
63
|
+
name: location?.display ?? null,
|
|
66
64
|
isLoadingLocationData: isLoading,
|
|
67
65
|
};
|
|
68
66
|
};
|
|
69
67
|
|
|
70
|
-
export
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
export function useBedsGroupedByLocation() {
|
|
69
|
+
const { data: locations, isLoading: isLoadingLocations } = useLocationsWithAdmissionTag();
|
|
70
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
71
|
+
const [isValidating, setIsValidating] = useState(true);
|
|
72
|
+
const [error, setError] = useState(null);
|
|
73
|
+
const [result, setResult] = useState([]);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!isLoadingLocations && locations && isValidating) {
|
|
77
|
+
const fetchData = async () => {
|
|
78
|
+
const promises = locations.map(async (location) => {
|
|
79
|
+
const bedsUrl = `/ws/rest/v1/bed?locationUuid=${location.uuid}`;
|
|
80
|
+
const bedsFetchResult = await openmrsFetch<BedFetchResponse>(bedsUrl, {
|
|
81
|
+
method: 'GET',
|
|
82
|
+
});
|
|
83
|
+
if (bedsFetchResult.data.results.length) {
|
|
84
|
+
return bedsFetchResult.data.results.map((bed) => ({
|
|
85
|
+
...bed,
|
|
86
|
+
location: location,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const updatedWards = (await Promise.all(promises)).filter(Boolean);
|
|
93
|
+
setResult(updatedWards);
|
|
94
|
+
};
|
|
95
|
+
fetchData()
|
|
96
|
+
.catch((e) => {
|
|
97
|
+
setError(e);
|
|
98
|
+
})
|
|
99
|
+
.finally(() => {
|
|
100
|
+
setIsLoading(false);
|
|
101
|
+
setIsValidating(false);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, [locations, isLoading]);
|
|
76
105
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{ data },
|
|
81
|
-
Error
|
|
82
|
-
>(locationUuid ? locationsUrl : null, openmrsFetch);
|
|
106
|
+
const mutate = useCallback(() => {
|
|
107
|
+
setIsValidating(true);
|
|
108
|
+
}, []);
|
|
83
109
|
|
|
84
110
|
return {
|
|
85
|
-
data,
|
|
111
|
+
data: result,
|
|
86
112
|
error,
|
|
87
|
-
isLoading,
|
|
113
|
+
isLoading: isLoading || isLoadingLocations,
|
|
88
114
|
isValidating,
|
|
89
115
|
mutate,
|
|
90
116
|
};
|
|
91
|
-
}
|
|
117
|
+
}
|
|
92
118
|
|
|
93
119
|
export const useAdmissionLocations = () => {
|
|
94
120
|
const locationsUrl = `/ws/rest/v1/admissionLocation?v=full`;
|
|
@@ -108,10 +134,10 @@ export const useAdmissionLocations = () => {
|
|
|
108
134
|
|
|
109
135
|
export const useAdmissionLocationBedLayout = (locationUuid: string) => {
|
|
110
136
|
const locationsUrl = `/ws/rest/v1/admissionLocation/${locationUuid}?v=full`;
|
|
111
|
-
const { data, error, isLoading, isValidating, mutate } = useSWR<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
137
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<{ data: AdmissionLocation }, Error>(
|
|
138
|
+
locationsUrl,
|
|
139
|
+
openmrsFetch,
|
|
140
|
+
);
|
|
115
141
|
|
|
116
142
|
return {
|
|
117
143
|
data: data?.data?.bedLayouts ?? [],
|
|
@@ -121,12 +147,10 @@ export const useAdmissionLocationBedLayout = (locationUuid: string) => {
|
|
|
121
147
|
mutate,
|
|
122
148
|
};
|
|
123
149
|
};
|
|
150
|
+
|
|
124
151
|
export const useBedType = () => {
|
|
125
152
|
const url = `/ws/rest/v1/bedtype/`;
|
|
126
|
-
const { data, error, isLoading, isValidating, mutate } = useSWR<
|
|
127
|
-
{ data },
|
|
128
|
-
Error
|
|
129
|
-
>(url, openmrsFetch);
|
|
153
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<{ data }, Error>(url, openmrsFetch);
|
|
130
154
|
const results = data?.data?.results ? data?.data?.results : [];
|
|
131
155
|
return {
|
|
132
156
|
bedTypeData: results,
|
|
@@ -139,10 +163,7 @@ export const useBedType = () => {
|
|
|
139
163
|
|
|
140
164
|
export const useBedTag = () => {
|
|
141
165
|
const url = `/ws/rest/v1/bedTag/`;
|
|
142
|
-
const { data, error, isLoading, isValidating, mutate } = useSWR<
|
|
143
|
-
{ data },
|
|
144
|
-
Error
|
|
145
|
-
>(url, openmrsFetch);
|
|
166
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<{ data }, Error>(url, openmrsFetch);
|
|
146
167
|
const results = data?.data?.results ? data?.data?.results : [];
|
|
147
168
|
return {
|
|
148
169
|
bedTypeData: results,
|
|
@@ -161,51 +182,51 @@ interface BedTag {
|
|
|
161
182
|
name: string;
|
|
162
183
|
}
|
|
163
184
|
export async function saveBedType({
|
|
164
|
-
|
|
185
|
+
bedTypePayload,
|
|
186
|
+
}: {
|
|
187
|
+
bedTypePayload: BedTypePayload;
|
|
165
188
|
}): Promise<FetchResponse<BedType>> {
|
|
166
189
|
const response: FetchResponse = await openmrsFetch(`/ws/rest/v1/bedtype`, {
|
|
167
|
-
method:
|
|
168
|
-
headers: {
|
|
169
|
-
body:
|
|
190
|
+
method: 'POST',
|
|
191
|
+
headers: { 'Content-Type': 'application/json' },
|
|
192
|
+
body: bedTypePayload,
|
|
170
193
|
});
|
|
171
194
|
return response;
|
|
172
195
|
}
|
|
173
196
|
|
|
174
|
-
export async function saveBedTag({
|
|
175
|
-
bedPayload,
|
|
176
|
-
}): Promise<FetchResponse<BedTag>> {
|
|
197
|
+
export async function saveBedTag({ bedTagPayload }: { bedTagPayload: BedTagPayload }): Promise<FetchResponse<BedTag>> {
|
|
177
198
|
const response: FetchResponse = await openmrsFetch(`/ws/rest/v1/bedTag/`, {
|
|
178
|
-
method:
|
|
179
|
-
headers: {
|
|
180
|
-
body:
|
|
199
|
+
method: 'POST',
|
|
200
|
+
headers: { 'Content-Type': 'application/json' },
|
|
201
|
+
body: bedTagPayload,
|
|
181
202
|
});
|
|
182
203
|
return response;
|
|
183
204
|
}
|
|
184
205
|
export async function editBedType({
|
|
185
|
-
|
|
206
|
+
bedTypePayload,
|
|
186
207
|
bedTypeId,
|
|
208
|
+
}: {
|
|
209
|
+
bedTypePayload: BedTypePayload;
|
|
210
|
+
bedTypeId: string;
|
|
187
211
|
}): Promise<FetchResponse<BedType>> {
|
|
188
|
-
const response: FetchResponse = await openmrsFetch(
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
body: bedPayload,
|
|
194
|
-
}
|
|
195
|
-
);
|
|
212
|
+
const response: FetchResponse = await openmrsFetch(`/ws/rest/v1/bedtype/${bedTypeId}`, {
|
|
213
|
+
method: 'POST',
|
|
214
|
+
headers: { 'Content-Type': 'application/json' },
|
|
215
|
+
body: bedTypePayload,
|
|
216
|
+
});
|
|
196
217
|
return response;
|
|
197
218
|
}
|
|
198
219
|
export async function editBedTag({
|
|
199
|
-
|
|
220
|
+
bedTagPayload,
|
|
200
221
|
bedTagId,
|
|
222
|
+
}: {
|
|
223
|
+
bedTagPayload: BedTagPayload;
|
|
224
|
+
bedTagId: string;
|
|
201
225
|
}): Promise<FetchResponse<BedType>> {
|
|
202
|
-
const response: FetchResponse = await openmrsFetch(
|
|
203
|
-
|
|
204
|
-
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
body: bedPayload,
|
|
208
|
-
}
|
|
209
|
-
);
|
|
226
|
+
const response: FetchResponse = await openmrsFetch(`/ws/rest/v1/bedTag/${bedTagId}`, {
|
|
227
|
+
method: 'POST',
|
|
228
|
+
headers: { 'Content-Type': 'application/json' },
|
|
229
|
+
body: bedTagPayload,
|
|
230
|
+
});
|
|
210
231
|
return response;
|
|
211
232
|
}
|
package/src/summary/summary.scss
CHANGED
|
@@ -2,58 +2,60 @@
|
|
|
2
2
|
@use '@carbon/layout';
|
|
3
3
|
|
|
4
4
|
.cardContainer {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
background-color: colors.$white-0;
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding: layout.$spacing-05;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.buttonMain {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
background-color: colors.$white-0;
|
|
14
|
+
color: colors.$teal-60;
|
|
15
|
+
cursor: text;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.sectionLoader {
|
|
19
|
-
|
|
19
|
+
text-align: center;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.buttonMain {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
&:active,
|
|
24
|
+
&:focus,
|
|
25
|
+
&:hover {
|
|
26
|
+
color: colors.$teal-60 !important;
|
|
27
|
+
background-color: colors.$white-0 !important;
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
.inactiveMain {
|
|
30
|
-
|
|
32
|
+
margin-bottom: layout.$spacing-10;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
.buttonContainer {
|
|
34
|
-
|
|
36
|
+
display: flex;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.buttonItems {
|
|
38
|
-
|
|
40
|
+
flex: auto;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
.pageHeaderContainer {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
align-items: center;
|
|
47
|
+
padding: layout.$spacing-05;
|
|
48
|
+
background-color: #ededed;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
.pageHeader {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
font-size: 1.25rem;
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
line-height: 1.4;
|
|
58
|
+
letter-spacing: 0;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
.link {
|
|
@@ -68,5 +70,5 @@
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
.loader {
|
|
71
|
-
|
|
73
|
+
margin: layout.$spacing-07;
|
|
72
74
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KeyedMutator } from
|
|
1
|
+
import type { KeyedMutator } from 'swr';
|
|
2
2
|
|
|
3
3
|
export type Tag = {
|
|
4
4
|
uuid: string;
|
|
@@ -14,6 +14,12 @@ export type Tag = {
|
|
|
14
14
|
resourceVersion: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
export type LocationFetchResponse = {
|
|
18
|
+
data: {
|
|
19
|
+
results: Array<Location>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
17
23
|
export type Location = {
|
|
18
24
|
uuid: string;
|
|
19
25
|
display: string;
|
|
@@ -68,22 +74,25 @@ export type Location = {
|
|
|
68
74
|
beds: Bed[];
|
|
69
75
|
};
|
|
70
76
|
|
|
77
|
+
export type BedFetchResponse = {
|
|
78
|
+
results: Array<Bed>;
|
|
79
|
+
};
|
|
80
|
+
|
|
71
81
|
export interface Bed {
|
|
72
82
|
id: number;
|
|
73
|
-
bedId: number;
|
|
74
83
|
uuid: string;
|
|
75
84
|
bedNumber: string;
|
|
76
|
-
bedType
|
|
77
|
-
uuid: string;
|
|
78
|
-
name: string;
|
|
79
|
-
displayName: string;
|
|
80
|
-
description: string;
|
|
81
|
-
resourceVersion: string;
|
|
82
|
-
};
|
|
85
|
+
bedType?: BedType;
|
|
83
86
|
row: number;
|
|
84
87
|
column: number;
|
|
85
|
-
status:
|
|
86
|
-
|
|
88
|
+
status: 'AVAILABLE' | 'OCCUPIED';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface BedWithLocation extends Bed {
|
|
92
|
+
location: {
|
|
93
|
+
display: string;
|
|
94
|
+
uuid: string;
|
|
95
|
+
};
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
export interface BedType {
|
|
@@ -91,22 +100,42 @@ export interface BedType {
|
|
|
91
100
|
name: string;
|
|
92
101
|
displayName: string;
|
|
93
102
|
description: string;
|
|
103
|
+
resourceVersion: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface BedFormData extends BedWithLocation {
|
|
107
|
+
description: string;
|
|
94
108
|
}
|
|
95
109
|
|
|
96
|
-
export interface
|
|
110
|
+
export interface BedTypeData {
|
|
97
111
|
uuid: string;
|
|
98
|
-
|
|
99
|
-
|
|
112
|
+
name: string;
|
|
113
|
+
displayName: string;
|
|
100
114
|
description: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface BedTagData {
|
|
118
|
+
uuid: string;
|
|
119
|
+
name: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface BedPostPayload {
|
|
123
|
+
bedNumber: string;
|
|
124
|
+
bedType: string;
|
|
101
125
|
row: number;
|
|
102
126
|
column: number;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
status: string;
|
|
128
|
+
locationUuid: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface BedTagPayload {
|
|
132
|
+
name: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface BedTypePayload {
|
|
136
|
+
name: string;
|
|
137
|
+
displayName: string;
|
|
138
|
+
description: string;
|
|
110
139
|
}
|
|
111
140
|
|
|
112
141
|
export type Mutator = KeyedMutator<{
|
|
@@ -139,25 +168,6 @@ export type MappedBedData = Array<{
|
|
|
139
168
|
export interface BedDetails extends Bed {
|
|
140
169
|
patient: null | {
|
|
141
170
|
uuid: string;
|
|
142
|
-
person: {
|
|
143
|
-
gender: string;
|
|
144
|
-
age: number;
|
|
145
|
-
preferredName: {
|
|
146
|
-
givenName: string;
|
|
147
|
-
familyName: string;
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
171
|
identifiers: Array<{ identifier: string }>;
|
|
151
172
|
};
|
|
152
173
|
}
|
|
153
|
-
export interface BedTypeData {
|
|
154
|
-
uuid: string;
|
|
155
|
-
name: string;
|
|
156
|
-
displayName: string;
|
|
157
|
-
description: string;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface BedTagData {
|
|
161
|
-
uuid: string;
|
|
162
|
-
name: string;
|
|
163
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Layer, Tile } from
|
|
3
|
-
import styles from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Layer, Tile } from '@carbon/react';
|
|
3
|
+
import styles from './ward-card.scss';
|
|
4
4
|
|
|
5
5
|
interface WardCardProps {
|
|
6
6
|
label: string;
|
|
@@ -12,16 +12,9 @@ interface WardCardProps {
|
|
|
12
12
|
locationUuid?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const WardCard: React.FC<WardCardProps> = ({
|
|
16
|
-
children,
|
|
17
|
-
headerLabel,
|
|
18
|
-
label,
|
|
19
|
-
value,
|
|
20
|
-
}) => {
|
|
15
|
+
const WardCard: React.FC<WardCardProps> = ({ children, headerLabel, label, value }) => {
|
|
21
16
|
return (
|
|
22
|
-
<Layer
|
|
23
|
-
className={`${children && styles.cardWithChildren} ${styles.container}`}
|
|
24
|
-
>
|
|
17
|
+
<Layer className={`${children && styles.cardWithChildren} ${styles.container}`}>
|
|
25
18
|
<Tile className={styles.tileContainer}>
|
|
26
19
|
<div className={styles.tileHeader}>
|
|
27
20
|
<div className={styles.headerLabelContainer}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use '@carbon/colors';
|
|
2
2
|
@use '@carbon/layout';
|
|
3
|
-
@use
|
|
3
|
+
@use '@carbon/type';
|
|
4
4
|
|
|
5
5
|
.container {
|
|
6
6
|
flex-grow: 1;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.headerLabelContainer {
|
|
39
|
-
margin-bottom:
|
|
39
|
+
margin-bottom: layout.$spacing-05;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.link {
|