@openmrs/esm-bed-management-app 7.1.1-pre.3735
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 +35 -0
- package/README.md +8 -0
- package/dist/130.js +2 -0
- package/dist/130.js.LICENSE.txt +3 -0
- package/dist/130.js.map +1 -0
- package/dist/169.js +1 -0
- package/dist/169.js.map +1 -0
- package/dist/391.js +2 -0
- package/dist/391.js.LICENSE.txt +15 -0
- package/dist/391.js.map +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 -0
- package/dist/591.js +2 -0
- package/dist/591.js.LICENSE.txt +32 -0
- package/dist/591.js.map +1 -0
- package/dist/596.js +1 -0
- package/dist/596.js.map +1 -0
- package/dist/642.js +1 -0
- package/dist/642.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.js.map +1 -0
- package/dist/784.js +2 -0
- package/dist/784.js.LICENSE.txt +9 -0
- package/dist/784.js.map +1 -0
- package/dist/878.js +2 -0
- package/dist/878.js.LICENSE.txt +35 -0
- package/dist/878.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-bed-management-app.js +1 -0
- package/dist/openmrs-esm-bed-management-app.js.buildmanifest.json +403 -0
- package/dist/openmrs-esm-bed-management-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +55 -0
- package/src/__mocks__/react-i18next.js +50 -0
- package/src/admin-card-link.component.tsx +24 -0
- package/src/bed-administration/bed-administration-form.component.tsx +292 -0
- package/src/bed-administration/bed-administration-form.scss +0 -0
- package/src/bed-administration/bed-administration-table.component.tsx +258 -0
- package/src/bed-administration/bed-administration-table.scss +111 -0
- package/src/bed-administration/bed-administration-types.ts +20 -0
- package/src/bed-administration/bed-administration.resource.ts +57 -0
- package/src/bed-administration/edit-bed-form.component.tsx +89 -0
- package/src/bed-administration/new-bed-form.component.tsx +96 -0
- package/src/bed-tag/bed-tag-administration-table.component.tsx +192 -0
- package/src/bed-tag/bed-tags-admin-form.component.tsx +127 -0
- package/src/bed-tag/edit-tag-form.component.tsx +72 -0
- package/src/bed-tag/new-tag-form.component.tsx +76 -0
- package/src/bed-type/bed-type-admin-form.component.tsx +166 -0
- package/src/bed-type/bed-type-administration-table.component.tsx +198 -0
- package/src/bed-type/edit-bed-type.component.tsx +72 -0
- package/src/bed-type/new-bed-type-form.component.tsx +80 -0
- package/src/card-header/card-header.component.tsx +20 -0
- package/src/card-header/card-header.scss +45 -0
- package/src/config-schema.ts +13 -0
- package/src/declarations.d.ts +7 -0
- package/src/empty-state/empty-state.component.tsx +54 -0
- package/src/empty-state/empty-state.scss +62 -0
- package/src/header/header.component.tsx +42 -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 +51 -0
- package/src/left-panel/left-panel.component.tsx +23 -0
- package/src/left-panel/left-panel.scss +41 -0
- package/src/left-panel-link.component.tsx +39 -0
- package/src/root.component.tsx +39 -0
- package/src/root.scss +11 -0
- package/src/routes.json +56 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary/summary.component.tsx +60 -0
- package/src/summary/summary.resource.ts +232 -0
- package/src/summary/summary.scss +74 -0
- package/src/types.ts +173 -0
- package/src/ward-card/ward-card.component.tsx +34 -0
- package/src/ward-card/ward-card.scss +51 -0
- package/src/ward-with-beds/ward-with-beds.component.tsx +167 -0
- package/src/ward-with-beds/ward-with-beds.scss +27 -0
- package/translations/en.json +52 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,167 @@
|
|
|
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 { useBedsForLocation, useLocationName } from '../summary/summary.resource';
|
|
22
|
+
import styles from './ward-with-beds.scss';
|
|
23
|
+
|
|
24
|
+
type RouteParams = { location: string };
|
|
25
|
+
|
|
26
|
+
const WardWithBeds: React.FC = () => {
|
|
27
|
+
const { location } = useParams<RouteParams>();
|
|
28
|
+
const { isLoading, bedData } = useBedsForLocation(location);
|
|
29
|
+
|
|
30
|
+
const { name } = useLocationName(location);
|
|
31
|
+
|
|
32
|
+
const [pageSize, setPageSize] = useState(10);
|
|
33
|
+
const { results: paginatedData, goTo, currentPage } = usePagination(bedData, pageSize);
|
|
34
|
+
|
|
35
|
+
if (isLoading) {
|
|
36
|
+
<p>Loading...</p>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const tableHeaders = [
|
|
40
|
+
{
|
|
41
|
+
id: 0,
|
|
42
|
+
header: 'ID',
|
|
43
|
+
key: 'id',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 1,
|
|
47
|
+
header: 'Number',
|
|
48
|
+
key: 'number',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 2,
|
|
52
|
+
header: 'Name',
|
|
53
|
+
key: 'name',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 3,
|
|
57
|
+
header: 'Description',
|
|
58
|
+
key: 'description',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 4,
|
|
62
|
+
header: 'Occupied',
|
|
63
|
+
key: 'occupied',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const CustomTag = ({ condition }: { condition: boolean }) => {
|
|
68
|
+
const { t } = useTranslation();
|
|
69
|
+
|
|
70
|
+
if (condition) {
|
|
71
|
+
return (
|
|
72
|
+
<Tag type="green" size="md">
|
|
73
|
+
{t('yes', 'Yes')}
|
|
74
|
+
</Tag>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Tag type="red" size="md">
|
|
80
|
+
{t('no', 'No')}
|
|
81
|
+
</Tag>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const tableRows = useMemo(() => {
|
|
86
|
+
return paginatedData?.map((bed) => ({
|
|
87
|
+
id: bed.id,
|
|
88
|
+
number: bed.number,
|
|
89
|
+
name: bed.name,
|
|
90
|
+
description: bed.description,
|
|
91
|
+
occupied: <CustomTag condition={bed?.status === 'OCCUPIED'} />,
|
|
92
|
+
}));
|
|
93
|
+
}, [paginatedData]);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<Header route={name ? name : '--'} />
|
|
98
|
+
{isLoading && (
|
|
99
|
+
<div className={styles.container}>
|
|
100
|
+
<DataTableSkeleton role="progressbar" zebra />
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{bedData?.length ? (
|
|
105
|
+
<>
|
|
106
|
+
<div className={styles.backButton}>
|
|
107
|
+
<Button
|
|
108
|
+
kind="ghost"
|
|
109
|
+
renderIcon={(props) => <ArrowLeft size={24} {...props} />}
|
|
110
|
+
iconDescription="Return to summary"
|
|
111
|
+
onClick={() =>
|
|
112
|
+
navigate({
|
|
113
|
+
to: `${window.getOpenmrsSpaBase()}bed-management`,
|
|
114
|
+
})
|
|
115
|
+
}>
|
|
116
|
+
<span>Return to summary</span>
|
|
117
|
+
</Button>
|
|
118
|
+
</div>
|
|
119
|
+
<div className={styles.container}>
|
|
120
|
+
<DataTable rows={tableRows} headers={tableHeaders} useZebraStyles>
|
|
121
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps }) => (
|
|
122
|
+
<TableContainer>
|
|
123
|
+
<Table {...getTableProps()}>
|
|
124
|
+
<TableHead>
|
|
125
|
+
<TableRow>
|
|
126
|
+
{headers.map((header) => (
|
|
127
|
+
<TableHeader key={header.key} {...getHeaderProps({ header })}>
|
|
128
|
+
{header.header}
|
|
129
|
+
</TableHeader>
|
|
130
|
+
))}
|
|
131
|
+
</TableRow>
|
|
132
|
+
</TableHead>
|
|
133
|
+
<TableBody>
|
|
134
|
+
{rows.map((row) => (
|
|
135
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
136
|
+
{row.cells.map((cell) => (
|
|
137
|
+
<TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
|
|
138
|
+
))}
|
|
139
|
+
</TableRow>
|
|
140
|
+
))}
|
|
141
|
+
</TableBody>
|
|
142
|
+
</Table>
|
|
143
|
+
</TableContainer>
|
|
144
|
+
)}
|
|
145
|
+
</DataTable>
|
|
146
|
+
<Pagination
|
|
147
|
+
backwardText="Previous page"
|
|
148
|
+
forwardText="Next page"
|
|
149
|
+
itemsPerPageText="Items per page:"
|
|
150
|
+
page={currentPage}
|
|
151
|
+
pageNumberText="Page Number"
|
|
152
|
+
pageSize={pageSize}
|
|
153
|
+
onChange={({ page, pageSize }) => {
|
|
154
|
+
goTo(page);
|
|
155
|
+
setPageSize(pageSize);
|
|
156
|
+
}}
|
|
157
|
+
pageSizes={[10, 20, 30, 40, 50]}
|
|
158
|
+
totalItems={paginatedData?.length}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</>
|
|
162
|
+
) : null}
|
|
163
|
+
</>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
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,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"addBed": "Add bed",
|
|
4
|
+
"addBedTag": "Create Bed Tag",
|
|
5
|
+
"addBedtype": "Add Bed Type",
|
|
6
|
+
"addBedType": "Create Bed type",
|
|
7
|
+
"allocationStatus": "Allocated",
|
|
8
|
+
"bedId": "Bed ID",
|
|
9
|
+
"bedIdPlaceholder": "e.g. BMW-201",
|
|
10
|
+
"bedLocation": "Location",
|
|
11
|
+
"bedManagement": "Bed Management",
|
|
12
|
+
"bedName": "Bed Name",
|
|
13
|
+
"beds": "Beds",
|
|
14
|
+
"bedTag": "Bed Tag Name",
|
|
15
|
+
"bedTagPlaceholder": "",
|
|
16
|
+
"bedType": "Add Bed Type",
|
|
17
|
+
"bedTypePlaceholder": "",
|
|
18
|
+
"cancel": "Cancel",
|
|
19
|
+
"checkFilters": "Check the filters above",
|
|
20
|
+
"chooseBedtype": "Choose a bed type",
|
|
21
|
+
"chooseOccupiedStatus": "Choose occupied status",
|
|
22
|
+
"createNewBed": "Create a new bed",
|
|
23
|
+
"description": "Description",
|
|
24
|
+
"displayName": "Display Name",
|
|
25
|
+
"displayNamePlaceholder": "",
|
|
26
|
+
"editBed": "Edit Tag",
|
|
27
|
+
"editBedTag": "Edit Bed Tag",
|
|
28
|
+
"editBedType": "Edit Bed Type",
|
|
29
|
+
"error": "Error",
|
|
30
|
+
"errorCreatingForm": "Error creating bed",
|
|
31
|
+
"errorFetchingbedInformation": "Error fetching bed information",
|
|
32
|
+
"filterByOccupancyStatus": "Filter by occupancy status",
|
|
33
|
+
"formCreated": "Add bed Type",
|
|
34
|
+
"formSaved": "Bed Type",
|
|
35
|
+
"headerTitle": "",
|
|
36
|
+
"ids": "Id",
|
|
37
|
+
"location": "Locations",
|
|
38
|
+
"manageBeds": "Manage Beds",
|
|
39
|
+
"name": "Name",
|
|
40
|
+
"no": "No",
|
|
41
|
+
"No data": "No data to display",
|
|
42
|
+
"occupancyStatus": "Occupied",
|
|
43
|
+
"or": "or",
|
|
44
|
+
"pleaseFillField": "",
|
|
45
|
+
"required": "Required",
|
|
46
|
+
"save": "Save",
|
|
47
|
+
"saveSuccessMessage": "was saved successfully.",
|
|
48
|
+
"selectBedLocation": "Select a bed location",
|
|
49
|
+
"viewBeds": "View beds",
|
|
50
|
+
"wardAllocation": "Ward Allocation",
|
|
51
|
+
"yes": "Yes"
|
|
52
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('openmrs/default-webpack-config');
|