@kenyaemr/esm-bed-management-app 1.0.1-pre.7 → 8.1.1-pre.118

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 (175) hide show
  1. package/.turbo/turbo-build.log +36 -0
  2. package/README.md +6 -38
  3. package/dist/130.js +2 -0
  4. package/dist/{800.js.LICENSE.txt → 130.js.LICENSE.txt} +2 -0
  5. package/dist/130.js.map +1 -0
  6. package/dist/148.js +1 -0
  7. package/dist/148.js.map +1 -0
  8. package/dist/169.js +1 -0
  9. package/dist/169.js.map +1 -0
  10. package/dist/271.js +1 -0
  11. package/dist/319.js +1 -0
  12. package/dist/325.js +1 -0
  13. package/dist/325.js.map +1 -0
  14. package/dist/339.js +1 -0
  15. package/dist/339.js.map +1 -0
  16. package/dist/455.js +1 -1
  17. package/dist/455.js.LICENSE.txt +6 -0
  18. package/dist/455.js.map +1 -1
  19. package/dist/460.js +1 -0
  20. package/dist/501.js +1 -0
  21. package/dist/501.js.map +1 -0
  22. package/dist/542.js +1 -0
  23. package/dist/542.js.map +1 -0
  24. package/dist/574.js +1 -1
  25. package/dist/591.js +2 -0
  26. package/dist/{26.js.LICENSE.txt → 591.js.LICENSE.txt} +3 -3
  27. package/dist/591.js.map +1 -0
  28. package/dist/644.js +1 -0
  29. package/dist/757.js +1 -0
  30. package/dist/766.js +2 -0
  31. package/dist/{330.js.LICENSE.txt → 766.js.LICENSE.txt} +0 -9
  32. package/dist/766.js.map +1 -0
  33. package/dist/{294.js → 784.js} +2 -2
  34. package/dist/{294.js.map → 784.js.map} +1 -1
  35. package/dist/788.js +1 -0
  36. package/dist/807.js +1 -0
  37. package/dist/833.js +1 -0
  38. package/dist/main.js +1 -1
  39. package/dist/main.js.map +1 -1
  40. package/dist/openmrs-esm-bed-management-app.js +1 -0
  41. package/dist/{esm-kenyaemr-bed-management-app.js.buildmanifest.json → openmrs-esm-bed-management-app.js.buildmanifest.json} +202 -155
  42. package/dist/openmrs-esm-bed-management-app.js.map +1 -0
  43. package/dist/routes.json +1 -1
  44. package/jest.config.js +3 -0
  45. package/package.json +25 -82
  46. package/src/__mocks__/react-i18next.js +18 -14
  47. package/src/admin-card-link.component.tsx +7 -10
  48. package/src/bed-administration/bed-administration-form.component.tsx +65 -99
  49. package/src/bed-administration/bed-administration-table.component.tsx +68 -127
  50. package/src/bed-administration/bed-administration-table.scss +12 -16
  51. package/src/bed-administration/bed-administration.resource.ts +16 -18
  52. package/src/bed-administration/edit-bed-form.component.tsx +20 -31
  53. package/src/bed-administration/new-bed-form.component.tsx +28 -44
  54. package/src/{bed-admission/bed-tag → bed-tag}/bed-tag-administration-table.component.tsx +35 -60
  55. package/src/{bed-admission/bed-tag → bed-tag}/bed-tags-admin-form.component.tsx +30 -34
  56. package/src/{bed-admission/bed-tag → bed-tag}/edit-tag-form.component.tsx +17 -25
  57. package/src/{bed-admission/bed-tag → bed-tag}/new-tag-form.component.tsx +20 -27
  58. package/src/{bed-admission/bed-type → bed-type}/bed-type-admin-form.component.tsx +37 -44
  59. package/src/{bed-admission/bed-type → bed-type}/bed-type-administration-table.component.tsx +36 -60
  60. package/src/{bed-admission/bed-type → bed-type}/edit-bed-type.component.tsx +17 -25
  61. package/src/{bed-admission/bed-type → bed-type}/new-bed-type-form.component.tsx +21 -28
  62. package/src/card-header/card-header.component.tsx +20 -0
  63. package/src/card-header/card-header.scss +45 -0
  64. package/src/config-schema.ts +9 -17
  65. package/src/declarations.d.ts +5 -5
  66. package/src/empty-state/empty-state.component.tsx +6 -21
  67. package/src/empty-state/empty-state.scss +10 -10
  68. package/src/header/header.component.tsx +14 -23
  69. package/src/header/header.scss +11 -11
  70. package/src/header/illustration.component.tsx +3 -3
  71. package/src/home.component.tsx +4 -4
  72. package/src/index.ts +21 -48
  73. package/src/left-panel/left-panel.component.tsx +7 -17
  74. package/src/left-panel/left-panel.scss +8 -7
  75. package/src/left-panel-link.component.tsx +14 -24
  76. package/src/root.component.tsx +12 -12
  77. package/src/root.scss +2 -2
  78. package/src/routes.json +12 -12
  79. package/src/setup-tests.ts +1 -1
  80. package/src/summary/summary.component.tsx +16 -30
  81. package/src/summary/summary.resource.ts +116 -95
  82. package/src/summary/summary.scss +31 -29
  83. package/src/types.ts +50 -40
  84. package/src/ward-card/ward-card.component.tsx +5 -12
  85. package/src/ward-card/ward-card.scss +2 -2
  86. package/src/ward-with-beds/ward-with-beds.component.tsx +28 -47
  87. package/src/ward-with-beds/ward-with-beds.scss +5 -5
  88. package/translations/am.json +51 -0
  89. package/translations/ar.json +51 -0
  90. package/translations/en.json +48 -4
  91. package/translations/es.json +51 -0
  92. package/translations/fr.json +51 -0
  93. package/translations/he.json +51 -0
  94. package/translations/km.json +51 -0
  95. package/translations/zh.json +51 -0
  96. package/translations/zh_CN.json +51 -0
  97. package/tsconfig.json +3 -21
  98. package/webpack.config.js +1 -1
  99. package/.editorconfig +0 -12
  100. package/.eslintignore +0 -2
  101. package/.eslintrc +0 -37
  102. package/.husky/pre-commit +0 -4
  103. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  104. package/.idea/modules.xml +0 -8
  105. package/.idea/vcs.xml +0 -6
  106. package/.prettierignore +0 -14
  107. package/.turbo.json +0 -18
  108. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  109. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +0 -550
  110. package/.yarn/versions/cb9a89ac.yml +0 -0
  111. package/LICENSE +0 -373
  112. package/dist/187.js +0 -1
  113. package/dist/187.js.map +0 -1
  114. package/dist/207.js +0 -1
  115. package/dist/207.js.map +0 -1
  116. package/dist/26.js +0 -2
  117. package/dist/26.js.map +0 -1
  118. package/dist/283.js +0 -1
  119. package/dist/283.js.map +0 -1
  120. package/dist/330.js +0 -2
  121. package/dist/330.js.map +0 -1
  122. package/dist/352.js +0 -1
  123. package/dist/352.js.map +0 -1
  124. package/dist/404.js +0 -1
  125. package/dist/404.js.map +0 -1
  126. package/dist/558.js +0 -2
  127. package/dist/558.js.LICENSE.txt +0 -14
  128. package/dist/558.js.map +0 -1
  129. package/dist/629.js +0 -1
  130. package/dist/629.js.map +0 -1
  131. package/dist/707.js +0 -1
  132. package/dist/707.js.map +0 -1
  133. package/dist/800.js +0 -2
  134. package/dist/800.js.map +0 -1
  135. package/dist/850.js +0 -1
  136. package/dist/850.js.map +0 -1
  137. package/dist/884.js +0 -1
  138. package/dist/884.js.map +0 -1
  139. package/dist/933.js +0 -1
  140. package/dist/933.js.map +0 -1
  141. package/dist/esm-kenyaemr-bed-management-app.js +0 -1
  142. package/dist/esm-kenyaemr-bed-management-app.js.map +0 -1
  143. package/i18next-parser.config.js +0 -89
  144. package/src/assets/landing-page.png +0 -0
  145. package/src/assets/logo.svg +0 -1
  146. package/src/bed-admission/active-patients/active-patients-table.component.tsx +0 -299
  147. package/src/bed-admission/active-patients/active-visits.resource.ts +0 -171
  148. package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
  149. package/src/bed-admission/active-patients/admission-action-button.component.tsx +0 -26
  150. package/src/bed-admission/active-patients/index.tsx +0 -15
  151. package/src/bed-admission/active-patients/patient-queues.resource.ts +0 -136
  152. package/src/bed-admission/active-patients/styles.scss +0 -284
  153. package/src/bed-admission/active-patients/view-action-menu.component.tsx +0 -33
  154. package/src/bed-admission/admitted-patients/active-admissions.resource.ts +0 -121
  155. package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +0 -280
  156. package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +0 -22
  157. package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +0 -55
  158. package/src/bed-admission/admitted-patients/styles.scss +0 -284
  159. package/src/bed-admission/bed-admission-tabs-styles.scss +0 -30
  160. package/src/bed-admission/bed-admission-tabs.component.tsx +0 -69
  161. package/src/bed-admission/bed-admission.component.tsx +0 -15
  162. package/src/bed-admission/bed-admission.resource.ts +0 -35
  163. package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +0 -101
  164. package/src/bed-admission/bed-layout/bed-layout.component.tsx +0 -64
  165. package/src/bed-admission/bed-layout/bed-layout.scss +0 -118
  166. package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +0 -26
  167. package/src/bed-admission/createDashboardLink.tsx +0 -47
  168. package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +0 -19
  169. package/src/bed-admission/helpers/functions.ts +0 -102
  170. package/src/bed-admission/types.ts +0 -133
  171. package/src/workspace/allocate-bed-workspace.component.tsx +0 -141
  172. package/src/workspace/allocate-bed.scss +0 -117
  173. package/src/workspace/overlay.component.tsx +0 -55
  174. package/src/workspace/overlay.scss +0 -96
  175. /package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
@@ -1,14 +1,26 @@
1
- import useSWR from "swr";
2
- import { FetchResponse, openmrsFetch } from "@openmrs/esm-framework";
3
- import type { AdmissionLocation, Bed, MappedBedData } from "../types";
4
-
5
- export const useLocationsByTag = (locationUuid: string) => {
6
- const locationsUrl = `/ws/rest/v1/location?tag=${locationUuid}&v=full`;
7
-
8
- const { data, error, isLoading, isValidating, mutate } = useSWR<
9
- { data },
10
- Error
11
- >(locationUuid ? locationsUrl : null, openmrsFetch);
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
- { data: { results: Array<Bed> } },
35
- Error
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 apiUrl = `/ws/rest/v1/location/${locationUuid}`;
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: data?.data?.display ?? null,
63
+ name: location?.display ?? null,
66
64
  isLoadingLocationData: isLoading,
67
65
  };
68
66
  };
69
67
 
70
- export const findBedByLocation = (locationUuid: string) => {
71
- const locationsUrl = `/ws/rest/v1/bed?locationUuid=${locationUuid}`;
72
- return openmrsFetch(locationsUrl, {
73
- method: "GET",
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
- export const useWards = (locationUuid: string) => {
78
- const locationsUrl = `/ws/rest/v1/location?tag=${locationUuid}&v=full`;
79
- const { data, error, isLoading, isValidating, mutate } = useSWR<
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
- { data: AdmissionLocation },
113
- Error
114
- >(locationsUrl, openmrsFetch);
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
- bedPayload,
185
+ bedTypePayload,
186
+ }: {
187
+ bedTypePayload: BedTypePayload;
165
188
  }): Promise<FetchResponse<BedType>> {
166
189
  const response: FetchResponse = await openmrsFetch(`/ws/rest/v1/bedtype`, {
167
- method: "POST",
168
- headers: { "Content-Type": "application/json" },
169
- body: bedPayload,
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: "POST",
179
- headers: { "Content-Type": "application/json" },
180
- body: bedPayload,
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
- bedPayload,
206
+ bedTypePayload,
186
207
  bedTypeId,
208
+ }: {
209
+ bedTypePayload: BedTypePayload;
210
+ bedTypeId: string;
187
211
  }): Promise<FetchResponse<BedType>> {
188
- const response: FetchResponse = await openmrsFetch(
189
- `/ws/rest/v1/bedtype/${bedTypeId}`,
190
- {
191
- method: "POST",
192
- headers: { "Content-Type": "application/json" },
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
- bedPayload,
220
+ bedTagPayload,
200
221
  bedTagId,
222
+ }: {
223
+ bedTagPayload: BedTagPayload;
224
+ bedTagId: string;
201
225
  }): Promise<FetchResponse<BedType>> {
202
- const response: FetchResponse = await openmrsFetch(
203
- `/ws/rest/v1/bedTag/${bedTagId}`,
204
- {
205
- method: "POST",
206
- headers: { "Content-Type": "application/json" },
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
  }
@@ -2,58 +2,60 @@
2
2
  @use '@carbon/layout';
3
3
 
4
4
  .cardContainer {
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: 1rem;
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
- background-color: colors.$white-0;
14
- color: colors.$teal-60;
15
- cursor: text;
13
+ background-color: colors.$white-0;
14
+ color: colors.$teal-60;
15
+ cursor: text;
16
16
  }
17
17
 
18
18
  .sectionLoader {
19
- text-align: center;
19
+ text-align: center;
20
20
  }
21
21
 
22
22
  .buttonMain {
23
- &:active, &:focus, &:hover {
24
- color: colors.$teal-60 !important;
25
- background-color: colors.$white-0 !important;
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
- margin-bottom: 4rem;
32
+ margin-bottom: layout.$spacing-10;
31
33
  }
32
34
 
33
35
  .buttonContainer {
34
- display: flex;
36
+ display: flex;
35
37
  }
36
38
 
37
39
  .buttonItems {
38
- flex: auto;
40
+ flex: auto;
39
41
  }
40
42
 
41
43
  .pageHeaderContainer {
42
- display: flex;
43
- justify-content: space-between;
44
- align-items: center;
45
- padding: layout.$spacing-05;
46
- background-color: #ededed;
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
- text-overflow: ellipsis;
51
- overflow: hidden;
52
- white-space: nowrap;
53
- font-size: 1.25rem;
54
- font-weight: 400;
55
- line-height: 1.4;
56
- letter-spacing: 0;
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
- margin: 2rem;
73
+ margin: layout.$spacing-07;
72
74
  }
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { KeyedMutator } from "swr";
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: "AVAILABLE" | string;
86
- location: string;
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 InitialData {
110
+ export interface BedTypeData {
97
111
  uuid: string;
98
- bedNumber: string;
99
- status: string;
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
- location: {
104
- display: string;
105
- uuid: string;
106
- };
107
- bedType: {
108
- name: string;
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 "react";
2
- import { Layer, Tile } from "@carbon/react";
3
- import styles from "./ward-card.scss";
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 "@carbon/type";
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: 1rem;
39
+ margin-bottom: layout.$spacing-05;
40
40
  }
41
41
 
42
42
  .link {