@openmrs/esm-bed-management-app 8.1.2-pre.4671 → 8.2.0
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 +4 -4
- package/dist/288.js +1 -1
- package/dist/288.js.map +1 -1
- package/dist/574.js +1 -1
- package/dist/openmrs-esm-bed-management-app.js.buildmanifest.json +8 -8
- package/dist/routes.json +1 -1
- package/package.json +2 -3
- package/src/bed-administration/bed-administration-form.component.tsx +51 -53
- package/src/bed-administration/bed-administration-table.component.tsx +2 -2
- package/src/bed-administration/bed-administration-types.ts +0 -1
- package/src/bed-administration/edit-bed-form.component.tsx +2 -4
- package/src/bed-administration/new-bed-form.component.tsx +3 -5
- package/src/summary/summary.resource.ts +1 -2
- package/src/types.ts +1 -6
- package/src/ward-with-beds/ward-with-beds.component.tsx +12 -18
- package/translations/en.json +18 -2
|
@@ -2,13 +2,13 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { showSnackbar } from '@openmrs/esm-framework';
|
|
4
4
|
import { type BedAdministrationData } from './bed-administration-types';
|
|
5
|
-
import { type
|
|
5
|
+
import { type BedWithLocation } from '../types';
|
|
6
6
|
import { editBed, useBedType } from './bed-administration.resource';
|
|
7
7
|
import { useLocationsWithAdmissionTag } from '../summary/summary.resource';
|
|
8
8
|
import BedAdministrationForm from './bed-administration-form.component';
|
|
9
9
|
|
|
10
10
|
interface EditBedFormProps {
|
|
11
|
-
editData:
|
|
11
|
+
editData: BedWithLocation;
|
|
12
12
|
mutate: () => void;
|
|
13
13
|
onModalChange: (showModal: boolean) => void;
|
|
14
14
|
showModal: boolean;
|
|
@@ -31,7 +31,6 @@ const EditBedForm: React.FC<EditBedFormProps> = ({ showModal, onModalChange, edi
|
|
|
31
31
|
bedId = editData.bedNumber,
|
|
32
32
|
bedRow = editData.row.toString(),
|
|
33
33
|
bedType = editData.bedType.name,
|
|
34
|
-
description = editData.description,
|
|
35
34
|
location: { uuid: bedLocation = editData.location.uuid },
|
|
36
35
|
occupancyStatus = editData.status,
|
|
37
36
|
} = formData;
|
|
@@ -40,7 +39,6 @@ const EditBedForm: React.FC<EditBedFormProps> = ({ showModal, onModalChange, edi
|
|
|
40
39
|
bedNumber: bedId,
|
|
41
40
|
bedType,
|
|
42
41
|
column: parseInt(bedColumn),
|
|
43
|
-
description,
|
|
44
42
|
locationUuid: bedLocation,
|
|
45
43
|
row: parseInt(bedRow),
|
|
46
44
|
status: occupancyStatus.toUpperCase(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { showSnackbar } from '@openmrs/esm-framework';
|
|
4
|
-
import { type
|
|
4
|
+
import { type BedWithLocation } from '../types';
|
|
5
5
|
import { type BedAdministrationData } from './bed-administration-types';
|
|
6
6
|
import { saveBed, useBedType } from './bed-administration.resource';
|
|
7
7
|
import { useLocationsWithAdmissionTag } from '../summary/summary.resource';
|
|
@@ -23,11 +23,10 @@ const NewBedForm: React.FC<NewBedFormProps> = ({ showModal, onModalChange, mutat
|
|
|
23
23
|
const occupancyStatuses = ['Available', 'Occupied'];
|
|
24
24
|
const availableBedTypes = bedTypes ? bedTypes : [];
|
|
25
25
|
|
|
26
|
-
const initialData:
|
|
26
|
+
const initialData: BedWithLocation = {
|
|
27
27
|
bedNumber: '',
|
|
28
28
|
bedType: null,
|
|
29
29
|
column: 0,
|
|
30
|
-
description: '',
|
|
31
30
|
id: 0,
|
|
32
31
|
location: defaultLocation || { display: '', uuid: '' },
|
|
33
32
|
row: 0,
|
|
@@ -37,12 +36,11 @@ const NewBedForm: React.FC<NewBedFormProps> = ({ showModal, onModalChange, mutat
|
|
|
37
36
|
|
|
38
37
|
const handleCreateBed = useCallback(
|
|
39
38
|
(formData: BedAdministrationData) => {
|
|
40
|
-
const { bedId,
|
|
39
|
+
const { bedId, occupancyStatus, bedRow, bedColumn, location, bedType } = formData;
|
|
41
40
|
|
|
42
41
|
const bedObject = {
|
|
43
42
|
bedNumber: bedId,
|
|
44
43
|
bedType,
|
|
45
|
-
description,
|
|
46
44
|
status: occupancyStatus.toUpperCase(),
|
|
47
45
|
row: parseInt(bedRow.toString()),
|
|
48
46
|
column: parseInt(bedColumn.toString()),
|
|
@@ -46,9 +46,8 @@ export const useBedsForLocation = (locationUuid: string) => {
|
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const mappedBedData: MappedBedData = (data?.data?.results ?? []).map((bed) => ({
|
|
49
|
-
description: bed.bedType?.description,
|
|
50
49
|
id: bed.id,
|
|
51
|
-
|
|
50
|
+
type: bed.bedType?.displayName,
|
|
52
51
|
number: bed.bedNumber,
|
|
53
52
|
status: bed.status,
|
|
54
53
|
uuid: bed.uuid,
|
package/src/types.ts
CHANGED
|
@@ -103,10 +103,6 @@ export interface BedType {
|
|
|
103
103
|
resourceVersion: string;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
export interface BedFormData extends BedWithLocation {
|
|
107
|
-
description: string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
106
|
export interface BedTypeData {
|
|
111
107
|
uuid: string;
|
|
112
108
|
name: string;
|
|
@@ -159,8 +155,7 @@ export type AdmissionLocation = {
|
|
|
159
155
|
export type MappedBedData = Array<{
|
|
160
156
|
id: number;
|
|
161
157
|
number: string;
|
|
162
|
-
|
|
163
|
-
description: string;
|
|
158
|
+
type: string;
|
|
164
159
|
status: string;
|
|
165
160
|
uuid: string;
|
|
166
161
|
}>;
|
|
@@ -36,33 +36,28 @@ const WardWithBeds: React.FC = () => {
|
|
|
36
36
|
const { results: paginatedData, goTo, currentPage } = usePagination(bedsData, pageSize);
|
|
37
37
|
|
|
38
38
|
if (isLoadingBeds) {
|
|
39
|
-
<p>Loading
|
|
39
|
+
<p>{t('loading', 'Loading...')}</p>;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const tableHeaders = [
|
|
43
43
|
{
|
|
44
44
|
id: 0,
|
|
45
|
-
header: 'ID',
|
|
45
|
+
header: t('id', 'ID'),
|
|
46
46
|
key: 'id',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
id: 1,
|
|
50
|
-
header: 'Number',
|
|
50
|
+
header: t('number', 'Number'),
|
|
51
51
|
key: 'number',
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
id: 2,
|
|
55
|
-
header: '
|
|
56
|
-
key: '
|
|
55
|
+
header: t('type', 'Type'),
|
|
56
|
+
key: 'type',
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
id: 3,
|
|
60
|
-
header: '
|
|
61
|
-
key: 'description',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 4,
|
|
65
|
-
header: 'Occupied',
|
|
60
|
+
header: t('occupied', 'Occupied'),
|
|
66
61
|
key: 'occupied',
|
|
67
62
|
},
|
|
68
63
|
];
|
|
@@ -89,8 +84,7 @@ const WardWithBeds: React.FC = () => {
|
|
|
89
84
|
return paginatedData?.map((bed) => ({
|
|
90
85
|
id: bed.id,
|
|
91
86
|
number: bed.number,
|
|
92
|
-
|
|
93
|
-
description: bed.description,
|
|
87
|
+
type: bed.type,
|
|
94
88
|
occupied: <CustomTag condition={bed?.status === 'OCCUPIED'} />,
|
|
95
89
|
}));
|
|
96
90
|
}, [paginatedData]);
|
|
@@ -116,7 +110,7 @@ const WardWithBeds: React.FC = () => {
|
|
|
116
110
|
to: `${window.getOpenmrsSpaBase()}bed-management`,
|
|
117
111
|
})
|
|
118
112
|
}>
|
|
119
|
-
<span>Return to summary</span>
|
|
113
|
+
<span>{t('returnToSummary', 'Return to summary')}</span>
|
|
120
114
|
</Button>
|
|
121
115
|
<span>{isValidating ? <InlineLoading /> : null}</span>
|
|
122
116
|
<Button
|
|
@@ -164,11 +158,11 @@ const WardWithBeds: React.FC = () => {
|
|
|
164
158
|
)}
|
|
165
159
|
</DataTable>
|
|
166
160
|
<Pagination
|
|
167
|
-
backwardText=
|
|
168
|
-
forwardText=
|
|
169
|
-
itemsPerPageText=
|
|
161
|
+
backwardText={t('previousPage', 'Previous page')}
|
|
162
|
+
forwardText={t('nextPage', 'Next page')}
|
|
163
|
+
itemsPerPageText={t('itemsPerPage', 'Items per page:')}
|
|
170
164
|
page={currentPage}
|
|
171
|
-
pageNumberText=
|
|
165
|
+
pageNumberText={t('pageNumber', 'Page Number')}
|
|
172
166
|
pageSize={pageSize}
|
|
173
167
|
onChange={({ page, pageSize }) => {
|
|
174
168
|
goTo(page);
|
package/translations/en.json
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
"addBedTag": "Create bed tag",
|
|
5
5
|
"addBedType": "Add bed type",
|
|
6
6
|
"allocationStatus": "Allocated",
|
|
7
|
-
"
|
|
7
|
+
"bedColumn": "Bed column",
|
|
8
8
|
"bedId": "Bed ID",
|
|
9
9
|
"bedLocation": "Location",
|
|
10
10
|
"bedManagement": "Bed management",
|
|
11
11
|
"bedManagementLeftPanel": "Bed management left panel",
|
|
12
12
|
"bedName": "Bed name",
|
|
13
13
|
"bedNumber": "Bed number",
|
|
14
|
+
"bedRow": "Bed row",
|
|
14
15
|
"beds": "Beds",
|
|
15
16
|
"bedTagCreated": "Bed tag created",
|
|
16
17
|
"bedTagCreatedSuccessfully": "",
|
|
@@ -46,23 +47,38 @@
|
|
|
46
47
|
"errorCreatingForm": "Error creating bed",
|
|
47
48
|
"errorFetchingbedInformation": "Error fetching bed information",
|
|
48
49
|
"filterByOccupancyStatus": "Filter by occupancy status",
|
|
50
|
+
"id": "ID",
|
|
49
51
|
"ids": "Id",
|
|
52
|
+
"invalidBedId": "Bed ID cannot be empty",
|
|
53
|
+
"invalidBedType": "Please select a valid bed type",
|
|
54
|
+
"invalidLocation": "Please select a valid location",
|
|
55
|
+
"invalidNumber": "Please enter a valid number",
|
|
56
|
+
"invalidOccupancyStatus": "Please select a valid occupied status",
|
|
57
|
+
"itemsPerPage": "Items per page:",
|
|
58
|
+
"loading": "Loading...",
|
|
50
59
|
"location": "Location",
|
|
51
60
|
"manageBeds": "Manage beds",
|
|
52
61
|
"name": "Name",
|
|
53
62
|
"newBedCreated": "New bed created",
|
|
63
|
+
"nextPage": "Next page",
|
|
54
64
|
"no": "No",
|
|
55
65
|
"No data": "No data to display",
|
|
56
66
|
"noDataToDisplay": "No data to display",
|
|
67
|
+
"number": "Number",
|
|
68
|
+
"occupancyStatus": "Occupancy status",
|
|
57
69
|
"occupancyStatusAvailable": "Available",
|
|
58
70
|
"occupancyStatusOccupied": "Occupied",
|
|
59
|
-
"
|
|
71
|
+
"occupied": "Occupied",
|
|
60
72
|
"or": "or",
|
|
73
|
+
"pageNumber": "Page Number",
|
|
61
74
|
"pleaseFillField": "",
|
|
75
|
+
"previousPage": "Previous page",
|
|
62
76
|
"required": "Required",
|
|
77
|
+
"returnToSummary": "Return to summary",
|
|
63
78
|
"save": "Save",
|
|
64
79
|
"selectBedLocation": "Select a bed location",
|
|
65
80
|
"summary": "Summary",
|
|
81
|
+
"type": "Type",
|
|
66
82
|
"viewBeds": "View beds",
|
|
67
83
|
"wardAllocation": "Ward allocation",
|
|
68
84
|
"yes": "Yes"
|