@kenyaemr/esm-bed-management-app 1.0.1-pre.7 → 8.0.2
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 -83
- 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,5 +1,5 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from
|
|
2
|
-
import { useTranslation } from
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
DataTable,
|
|
@@ -14,27 +14,23 @@ import {
|
|
|
14
14
|
TableHeader,
|
|
15
15
|
TableRow,
|
|
16
16
|
Tile,
|
|
17
|
-
} from
|
|
18
|
-
import { Add, Edit } from
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import Header from "../../header/header.component";
|
|
28
|
-
import BedTypeForm from "./new-bed-type-form.component";
|
|
29
|
-
import styles from "../../bed-administration/bed-administration-table.scss";
|
|
30
|
-
import EditBedTypeForm from "./edit-bed-type.component";
|
|
17
|
+
} from '@carbon/react';
|
|
18
|
+
import { Add, Edit } from '@carbon/react/icons';
|
|
19
|
+
import { ErrorState, isDesktop as desktopLayout, useLayoutType } from '@openmrs/esm-framework';
|
|
20
|
+
import type { BedTypeData } from '../types';
|
|
21
|
+
import { useBedType } from '../summary/summary.resource';
|
|
22
|
+
import Header from '../header/header.component';
|
|
23
|
+
import BedTypeForm from './new-bed-type-form.component';
|
|
24
|
+
import styles from '../bed-administration/bed-administration-table.scss';
|
|
25
|
+
import { CardHeader } from '../card-header/card-header.component';
|
|
26
|
+
import EditBedTypeForm from './edit-bed-type.component';
|
|
31
27
|
|
|
32
28
|
const BedTypeAdministrationTable: React.FC = () => {
|
|
33
29
|
const { t } = useTranslation();
|
|
34
|
-
const headerTitle = t(
|
|
30
|
+
const headerTitle = t('bedType', 'Bed Type');
|
|
35
31
|
const layout = useLayoutType();
|
|
36
|
-
const isTablet = layout ===
|
|
37
|
-
const responsiveSize = isTablet ?
|
|
32
|
+
const isTablet = layout === 'tablet';
|
|
33
|
+
const responsiveSize = isTablet ? 'lg' : 'sm';
|
|
38
34
|
const isDesktop = desktopLayout(layout);
|
|
39
35
|
const [showEditBedModal, setShowEditBedModal] = useState(false);
|
|
40
36
|
const [isBedDataLoading, setIsBedDataLoading] = useState(false);
|
|
@@ -47,20 +43,20 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
47
43
|
const pageSizes = [10, 20, 30, 40, 50];
|
|
48
44
|
const tableHeaders = [
|
|
49
45
|
{
|
|
50
|
-
header: t(
|
|
51
|
-
key:
|
|
46
|
+
header: t('name', 'Name'),
|
|
47
|
+
key: 'name',
|
|
52
48
|
},
|
|
53
49
|
{
|
|
54
|
-
header: t(
|
|
55
|
-
key:
|
|
50
|
+
header: t('displayName', 'Display Name'),
|
|
51
|
+
key: 'displayName',
|
|
56
52
|
},
|
|
57
53
|
{
|
|
58
|
-
header: t(
|
|
59
|
-
key:
|
|
54
|
+
header: t('description', 'Description'),
|
|
55
|
+
key: 'description',
|
|
60
56
|
},
|
|
61
57
|
{
|
|
62
|
-
key:
|
|
63
|
-
header: t(
|
|
58
|
+
key: 'actions',
|
|
59
|
+
header: t('actions', 'Actions'),
|
|
64
60
|
},
|
|
65
61
|
];
|
|
66
62
|
|
|
@@ -81,8 +77,8 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
81
77
|
setShowEditBedModal(true);
|
|
82
78
|
setAddBedTypeModal(false);
|
|
83
79
|
}}
|
|
84
|
-
kind={
|
|
85
|
-
iconDescription={t(
|
|
80
|
+
kind={'ghost'}
|
|
81
|
+
iconDescription={t('editBedType', 'Edit Bed Type')}
|
|
86
82
|
hasIconOnly
|
|
87
83
|
size={responsiveSize}
|
|
88
84
|
tooltipAlignment="start"
|
|
@@ -120,11 +116,7 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
120
116
|
|
|
121
117
|
<div className={styles.widgetCard}>
|
|
122
118
|
{showBedTypeModal ? (
|
|
123
|
-
<BedTypeForm
|
|
124
|
-
onModalChange={setAddBedTypeModal}
|
|
125
|
-
showModal={showBedTypeModal}
|
|
126
|
-
mutate={mutate}
|
|
127
|
-
/>
|
|
119
|
+
<BedTypeForm onModalChange={setAddBedTypeModal} showModal={showBedTypeModal} mutate={mutate} />
|
|
128
120
|
) : null}
|
|
129
121
|
{showEditBedModal ? (
|
|
130
122
|
<EditBedTypeForm
|
|
@@ -142,28 +134,19 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
142
134
|
<Button
|
|
143
135
|
kind="ghost"
|
|
144
136
|
renderIcon={(props) => <Add size={16} {...props} />}
|
|
145
|
-
onClick={() => setAddBedTypeModal(true)}
|
|
146
|
-
|
|
147
|
-
{t("addBedtype", "Add Bed Type")}
|
|
137
|
+
onClick={() => setAddBedTypeModal(true)}>
|
|
138
|
+
{t('addBedtype', 'Add Bed Type')}
|
|
148
139
|
</Button>
|
|
149
140
|
) : null}
|
|
150
141
|
</CardHeader>
|
|
151
|
-
<DataTable
|
|
152
|
-
rows={tableRows}
|
|
153
|
-
headers={tableHeaders}
|
|
154
|
-
isSortable
|
|
155
|
-
size={isTablet ? "lg" : "sm"}
|
|
156
|
-
useZebraStyles
|
|
157
|
-
>
|
|
142
|
+
<DataTable rows={tableRows} headers={tableHeaders} isSortable size={isTablet ? 'lg' : 'sm'} useZebraStyles>
|
|
158
143
|
{({ rows, headers, getTableProps }) => (
|
|
159
144
|
<TableContainer>
|
|
160
145
|
<Table {...getTableProps()}>
|
|
161
146
|
<TableHead>
|
|
162
147
|
<TableRow>
|
|
163
148
|
{headers.map((header) => (
|
|
164
|
-
<TableHeader>
|
|
165
|
-
{header.header?.content ?? header.header}
|
|
166
|
-
</TableHeader>
|
|
149
|
+
<TableHeader>{header.header?.content ?? header.header}</TableHeader>
|
|
167
150
|
))}
|
|
168
151
|
</TableRow>
|
|
169
152
|
</TableHead>
|
|
@@ -171,9 +154,7 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
171
154
|
{rows.map((row) => (
|
|
172
155
|
<TableRow key={row.id}>
|
|
173
156
|
{row.cells.map((cell) => (
|
|
174
|
-
<TableCell key={cell.id}>
|
|
175
|
-
{cell.value?.content ?? cell.value}
|
|
176
|
-
</TableCell>
|
|
157
|
+
<TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
|
|
177
158
|
))}
|
|
178
159
|
</TableRow>
|
|
179
160
|
))}
|
|
@@ -183,21 +164,16 @@ const BedTypeAdministrationTable: React.FC = () => {
|
|
|
183
164
|
<div className={styles.tileContainer}>
|
|
184
165
|
<Tile className={styles.tile}>
|
|
185
166
|
<div className={styles.tileContent}>
|
|
186
|
-
<p className={styles.content}>
|
|
187
|
-
|
|
188
|
-
</p>
|
|
189
|
-
<p className={styles.helper}>
|
|
190
|
-
{t("checkFilters", "Check the filters above")}
|
|
191
|
-
</p>
|
|
167
|
+
<p className={styles.content}>{t('No data', 'No data to display')}</p>
|
|
168
|
+
<p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
|
|
192
169
|
</div>
|
|
193
|
-
<p className={styles.separator}>{t(
|
|
170
|
+
<p className={styles.separator}>{t('or', 'or')}</p>
|
|
194
171
|
<Button
|
|
195
172
|
kind="ghost"
|
|
196
173
|
size="sm"
|
|
197
174
|
renderIcon={(props) => <Add size={16} {...props} />}
|
|
198
|
-
onClick={() => setAddBedTypeModal(true)}
|
|
199
|
-
|
|
200
|
-
{t("bedType", "Add Bed Type")}
|
|
175
|
+
onClick={() => setAddBedTypeModal(true)}>
|
|
176
|
+
{t('bedType', 'Add Bed Type')}
|
|
201
177
|
</Button>
|
|
202
178
|
</Tile>
|
|
203
179
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useCallback } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import { showToast, showNotification, useConfig } from
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { showToast, showNotification, useConfig } from '@openmrs/esm-framework';
|
|
4
4
|
|
|
5
|
-
import { editBedType, useBedType } from
|
|
6
|
-
import { BedTypeDataAdministration } from
|
|
7
|
-
import { BedTypeData, Mutator } from
|
|
8
|
-
import BedTypeAdministrationForm from
|
|
5
|
+
import { editBedType, useBedType } from '../summary/summary.resource';
|
|
6
|
+
import { type BedTypeDataAdministration } from '../bed-administration/bed-administration-types';
|
|
7
|
+
import { type BedTypeData, type Mutator } from '../types';
|
|
8
|
+
import BedTypeAdministrationForm from './bed-type-admin-form.component';
|
|
9
9
|
|
|
10
10
|
interface EditBedTypeFormProps {
|
|
11
11
|
showModal: boolean;
|
|
@@ -14,35 +14,27 @@ interface EditBedTypeFormProps {
|
|
|
14
14
|
mutate: Mutator;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
|
|
18
|
-
showModal,
|
|
19
|
-
onModalChange,
|
|
20
|
-
editData,
|
|
21
|
-
mutate,
|
|
22
|
-
}) => {
|
|
17
|
+
const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({ showModal, onModalChange, editData, mutate }) => {
|
|
23
18
|
const { t } = useTranslation();
|
|
24
|
-
const headerTitle = t(
|
|
19
|
+
const headerTitle = t('editBedType', 'Edit Bed Type');
|
|
25
20
|
const { bedTypeData } = useBedType();
|
|
26
21
|
const availableBedTypes = bedTypeData ? bedTypeData : [];
|
|
27
22
|
const handleCreateQuestion = useCallback(
|
|
28
23
|
(formData: BedTypeDataAdministration) => {
|
|
29
24
|
const bedUuid = editData.uuid;
|
|
30
25
|
const { name, displayName, description } = formData;
|
|
31
|
-
const
|
|
26
|
+
const bedTypePayload = {
|
|
32
27
|
name,
|
|
33
28
|
displayName,
|
|
34
29
|
description,
|
|
35
30
|
};
|
|
36
|
-
editBedType({
|
|
31
|
+
editBedType({ bedTypePayload, bedTypeId: bedUuid })
|
|
37
32
|
.then(() => {
|
|
38
33
|
showToast({
|
|
39
|
-
title: t(
|
|
40
|
-
kind:
|
|
34
|
+
title: t('formSaved', 'Bed Type'),
|
|
35
|
+
kind: 'success',
|
|
41
36
|
critical: true,
|
|
42
|
-
description:
|
|
43
|
-
bedPayload.name +
|
|
44
|
-
" " +
|
|
45
|
-
t("saveSuccessMessage", "was saved successfully."),
|
|
37
|
+
description: bedTypePayload.name + ' ' + t('saveSuccessMessage', 'was saved successfully.'),
|
|
46
38
|
});
|
|
47
39
|
|
|
48
40
|
mutate();
|
|
@@ -50,8 +42,8 @@ const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
|
|
|
50
42
|
})
|
|
51
43
|
.catch((error) => {
|
|
52
44
|
showNotification({
|
|
53
|
-
title: t(
|
|
54
|
-
kind:
|
|
45
|
+
title: t('errorCreatingForm', 'Error creating bed'),
|
|
46
|
+
kind: 'error',
|
|
55
47
|
critical: true,
|
|
56
48
|
description: error?.message,
|
|
57
49
|
});
|
|
@@ -59,7 +51,7 @@ const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
|
|
|
59
51
|
});
|
|
60
52
|
onModalChange(false);
|
|
61
53
|
},
|
|
62
|
-
[onModalChange, mutate, editData, t]
|
|
54
|
+
[onModalChange, mutate, editData, t],
|
|
63
55
|
);
|
|
64
56
|
|
|
65
57
|
return (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useCallback } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import { showToast, showNotification, useConfig } from
|
|
4
|
-
import type { BedTypeData, Mutator } from
|
|
5
|
-
import { useBedType } from
|
|
6
|
-
import { saveBedType,
|
|
7
|
-
import BedTypeAdministrationForm from
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { showToast, showNotification, useConfig } from '@openmrs/esm-framework';
|
|
4
|
+
import type { BedTypeData, Mutator } from '../types';
|
|
5
|
+
import { useBedType } from '../bed-administration/bed-administration.resource';
|
|
6
|
+
import { saveBedType, useLocationsWithAdmissionTag } from '../summary/summary.resource';
|
|
7
|
+
import BedTypeAdministrationForm from './bed-type-admin-form.component';
|
|
8
8
|
|
|
9
9
|
interface BedTypeFormProps {
|
|
10
10
|
showModal: boolean;
|
|
@@ -12,42 +12,35 @@ interface BedTypeFormProps {
|
|
|
12
12
|
mutate: Mutator;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
|
|
16
|
-
showModal,
|
|
17
|
-
onModalChange,
|
|
18
|
-
mutate,
|
|
19
|
-
}) => {
|
|
15
|
+
const NewBedTypeForm: React.FC<BedTypeFormProps> = ({ showModal, onModalChange, mutate }) => {
|
|
20
16
|
const { t } = useTranslation();
|
|
21
|
-
const {
|
|
22
|
-
const
|
|
23
|
-
admissionLocationTagUuid
|
|
24
|
-
);
|
|
25
|
-
const headerTitle = t("addBedType", "Create Bed type");
|
|
17
|
+
const { data: admissionLocations } = useLocationsWithAdmissionTag();
|
|
18
|
+
const headerTitle = t('addBedType', 'Create Bed type');
|
|
26
19
|
const { bedTypes } = useBedType();
|
|
27
20
|
const availableBedTypes = bedTypes ? bedTypes : [];
|
|
28
21
|
|
|
29
22
|
const initialData: BedTypeData = {
|
|
30
|
-
uuid:
|
|
31
|
-
name:
|
|
32
|
-
displayName:
|
|
33
|
-
description:
|
|
23
|
+
uuid: '',
|
|
24
|
+
name: '',
|
|
25
|
+
displayName: '',
|
|
26
|
+
description: '',
|
|
34
27
|
};
|
|
35
28
|
|
|
36
29
|
const handleCreateQuestion = useCallback(
|
|
37
30
|
(formData: BedTypeData) => {
|
|
38
31
|
const { name, displayName, description } = formData;
|
|
39
32
|
|
|
40
|
-
const
|
|
33
|
+
const bedTypePayload = {
|
|
41
34
|
name,
|
|
42
35
|
displayName,
|
|
43
36
|
description,
|
|
44
37
|
};
|
|
45
38
|
|
|
46
|
-
saveBedType({
|
|
39
|
+
saveBedType({ bedTypePayload })
|
|
47
40
|
.then(() => {
|
|
48
41
|
showToast({
|
|
49
|
-
title: t(
|
|
50
|
-
kind:
|
|
42
|
+
title: t('formCreated', 'Add bed Type'),
|
|
43
|
+
kind: 'success',
|
|
51
44
|
critical: true,
|
|
52
45
|
description: `Bed ${name} was created successfully.`,
|
|
53
46
|
});
|
|
@@ -57,8 +50,8 @@ const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
|
|
|
57
50
|
})
|
|
58
51
|
.catch((error) => {
|
|
59
52
|
showNotification({
|
|
60
|
-
title: t(
|
|
61
|
-
kind:
|
|
53
|
+
title: t('errorCreatingForm', 'Error creating bed'),
|
|
54
|
+
kind: 'error',
|
|
62
55
|
critical: true,
|
|
63
56
|
description: error?.message,
|
|
64
57
|
});
|
|
@@ -66,7 +59,7 @@ const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
|
|
|
66
59
|
});
|
|
67
60
|
onModalChange(false);
|
|
68
61
|
},
|
|
69
|
-
[onModalChange, mutate, t]
|
|
62
|
+
[onModalChange, mutate, t],
|
|
70
63
|
);
|
|
71
64
|
|
|
72
65
|
return (
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useLayoutType } from '@openmrs/esm-framework';
|
|
4
|
+
import styles from './card-header.scss';
|
|
5
|
+
|
|
6
|
+
interface CardHeaderProps {
|
|
7
|
+
title: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function CardHeader({ title, children }: CardHeaderProps) {
|
|
12
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={classNames(isTablet ? styles.tabletHeader : styles.desktopHeader)}>
|
|
16
|
+
<h4>{title}</h4>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@carbon/type';
|
|
3
|
+
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
4
|
+
|
|
5
|
+
.desktopHeader,
|
|
6
|
+
.tabletHeader {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
align-items: center;
|
|
10
|
+
padding: layout.$spacing-04 0 layout.$spacing-04 layout.$spacing-05;
|
|
11
|
+
background-color: $ui-background;
|
|
12
|
+
|
|
13
|
+
h4:after {
|
|
14
|
+
content: '';
|
|
15
|
+
display: block;
|
|
16
|
+
width: layout.$spacing-07;
|
|
17
|
+
padding-top: 0.188rem;
|
|
18
|
+
border-bottom: 0.375rem solid var(--brand-03);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.desktopHeader {
|
|
23
|
+
height: layout.$spacing-09;
|
|
24
|
+
h4 {
|
|
25
|
+
@include type.type-style('heading-compact-02');
|
|
26
|
+
color: $text-02;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tabletHeader {
|
|
31
|
+
height: 4.5rem;
|
|
32
|
+
h4 {
|
|
33
|
+
@include type.type-style('heading-03');
|
|
34
|
+
color: $text-02;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Overriding styles for RTL support
|
|
39
|
+
html[dir='rtl'] {
|
|
40
|
+
.desktopHeader,
|
|
41
|
+
.tabletHeader {
|
|
42
|
+
text-align: right;
|
|
43
|
+
padding: layout.$spacing-04 layout.$spacing-05 layout.$spacing-04 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/config-schema.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import { Type } from
|
|
2
|
-
import { boolean } from "zod";
|
|
1
|
+
import { Type } from '@openmrs/esm-framework';
|
|
3
2
|
|
|
4
3
|
export const configSchema = {
|
|
5
|
-
|
|
6
|
-
_type: Type.
|
|
7
|
-
_description:
|
|
8
|
-
|
|
9
|
-
_default: "839c65c7-9998-4b90-b80b-39727dfe9fa2",
|
|
10
|
-
},
|
|
11
|
-
inpatientVisitUuid: {
|
|
12
|
-
_type: Type.UUID,
|
|
13
|
-
_description: "UUID for the inpatient visit",
|
|
14
|
-
_default: "a73e2ac6-263b-47fc-99fc-e0f2c09fc914",
|
|
15
|
-
},
|
|
16
|
-
restrictWardAdministrationToLoginLocation: {
|
|
17
|
-
_type: boolean,
|
|
18
|
-
_description: "UUID for the inpatient visit",
|
|
19
|
-
_default: false,
|
|
4
|
+
admissionLocationTagName: {
|
|
5
|
+
_type: Type.String,
|
|
6
|
+
_description: 'Patients may only be admitted to inpatient care in a location with this tag',
|
|
7
|
+
_default: 'Admission Location',
|
|
20
8
|
},
|
|
21
9
|
};
|
|
10
|
+
|
|
11
|
+
export interface BedManagementConfig {
|
|
12
|
+
admissionLocationTagName: string;
|
|
13
|
+
}
|
package/src/declarations.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
declare module
|
|
3
|
-
declare module
|
|
4
|
-
declare module
|
|
5
|
-
declare module
|
|
1
|
+
declare module '@carbon/react';
|
|
2
|
+
declare module '*.css';
|
|
3
|
+
declare module '*.scss';
|
|
4
|
+
declare module '*.png';
|
|
5
|
+
declare module '*.svg';
|
|
6
6
|
|
|
7
7
|
declare type SideNavProps = object;
|
|
@@ -1,16 +1,13 @@
|
|
|
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 './empty-state.scss';
|
|
4
4
|
|
|
5
5
|
type EmptyStateProps = {
|
|
6
6
|
msg: string;
|
|
7
7
|
helper: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const EmptyState: React.FC<EmptyStateProps> = ({
|
|
11
|
-
msg,
|
|
12
|
-
helper,
|
|
13
|
-
}: EmptyStateProps) => {
|
|
10
|
+
const EmptyState: React.FC<EmptyStateProps> = ({ msg, helper }: EmptyStateProps) => {
|
|
14
11
|
return (
|
|
15
12
|
<Layer className={styles.layer}>
|
|
16
13
|
<Tile className={styles.tile}>
|
|
@@ -30,13 +27,7 @@ const EmptyState: React.FC<EmptyStateProps> = ({
|
|
|
30
27
|
fill="#C6C6C6"
|
|
31
28
|
/>
|
|
32
29
|
<circle fill="#C6C6C6" cx={17.636} cy={2.314} r={1.855} />
|
|
33
|
-
<circle
|
|
34
|
-
fill="#FFF"
|
|
35
|
-
fillRule="nonzero"
|
|
36
|
-
cx={17.636}
|
|
37
|
-
cy={2.314}
|
|
38
|
-
r={1.175}
|
|
39
|
-
/>
|
|
30
|
+
<circle fill="#FFF" fillRule="nonzero" cx={17.636} cy={2.314} r={1.175} />
|
|
40
31
|
<path
|
|
41
32
|
d="M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z"
|
|
42
33
|
fill="#F4F4F4"
|
|
@@ -50,13 +41,7 @@ const EmptyState: React.FC<EmptyStateProps> = ({
|
|
|
50
41
|
fill="#C6C6C6"
|
|
51
42
|
/>
|
|
52
43
|
<circle fill="#C6C6C6" cx={40.218} cy={9.755} r={1.855} />
|
|
53
|
-
<circle
|
|
54
|
-
fill="#FFF"
|
|
55
|
-
fillRule="nonzero"
|
|
56
|
-
cx={40.218}
|
|
57
|
-
cy={9.755}
|
|
58
|
-
r={1.13}
|
|
59
|
-
/>
|
|
44
|
+
<circle fill="#FFF" fillRule="nonzero" cx={40.218} cy={9.755} r={1.13} />
|
|
60
45
|
</g>
|
|
61
46
|
</svg>
|
|
62
47
|
<p className={styles.content}>{msg}</p>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
@use '@carbon/colors';
|
|
2
2
|
@use '@carbon/layout';
|
|
3
|
-
@use
|
|
3
|
+
@use '@carbon/type';
|
|
4
4
|
|
|
5
5
|
.desktopHeading {
|
|
6
6
|
h4 {
|
|
7
|
-
@include type.type-style(
|
|
7
|
+
@include type.type-style('heading-compact-02');
|
|
8
8
|
color: colors.$gray-70;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.tabletHeading {
|
|
13
13
|
h4 {
|
|
14
|
-
@include type.type-style(
|
|
14
|
+
@include type.type-style('heading-03');
|
|
15
15
|
color: colors.$gray-70;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
margin-bottom: layout.$spacing-05;
|
|
24
24
|
|
|
25
25
|
h4:after {
|
|
26
|
-
content:
|
|
26
|
+
content: '';
|
|
27
27
|
display: block;
|
|
28
|
-
width:
|
|
28
|
+
width: layout.$spacing-07;
|
|
29
29
|
padding-top: 0.188rem;
|
|
30
30
|
border-bottom: 0.375rem solid var(--brand-03);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.heading:after {
|
|
35
|
-
content:
|
|
35
|
+
content: '';
|
|
36
36
|
display: block;
|
|
37
|
-
width:
|
|
37
|
+
width: layout.$spacing-07;
|
|
38
38
|
padding-top: 0.188rem;
|
|
39
39
|
border-bottom: 0.375rem solid var(--brand-03);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.tile {
|
|
43
|
-
padding:
|
|
43
|
+
padding: layout.$spacing-07;
|
|
44
44
|
border: 1px solid colors.$gray-20;
|
|
45
|
-
margin:
|
|
45
|
+
margin: layout.$spacing-06;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.layer {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.content {
|
|
53
|
-
@include type.type-style(
|
|
53
|
+
@include type.type-style('heading-compact-02');
|
|
54
54
|
color: colors.$gray-70;
|
|
55
55
|
margin-top: layout.$spacing-05;
|
|
56
56
|
margin-bottom: layout.$spacing-03;
|
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from "react-i18next";
|
|
8
|
-
import { Calendar, Location } from "@carbon/react/icons";
|
|
9
|
-
import Illustration from "./illustration.component";
|
|
10
|
-
import styles from "./header.scss";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigurableLink, formatDate, useSession } from '@openmrs/esm-framework';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Calendar, Location } from '@carbon/react/icons';
|
|
5
|
+
import Illustration from './illustration.component';
|
|
6
|
+
import styles from './header.scss';
|
|
11
7
|
|
|
12
8
|
type HeaderProps = {
|
|
13
9
|
route: string;
|
|
14
10
|
headerTitle?: string;
|
|
15
11
|
};
|
|
16
12
|
|
|
17
|
-
const Header: React.FC<HeaderProps> = ({
|
|
18
|
-
route,
|
|
19
|
-
headerTitle = "Bed Management",
|
|
20
|
-
}) => {
|
|
13
|
+
const Header: React.FC<HeaderProps> = ({ route, headerTitle = 'Bed Management' }) => {
|
|
21
14
|
const { t } = useTranslation();
|
|
22
15
|
const userSession = useSession();
|
|
23
16
|
const userLocation = userSession?.sessionLocation?.display;
|
|
24
17
|
|
|
25
18
|
return (
|
|
26
19
|
<div className={styles.header}>
|
|
27
|
-
<div className={styles[
|
|
20
|
+
<div className={styles['left-justified-items']}>
|
|
28
21
|
<ConfigurableLink to={`${window.getOpenmrsSpaBase()}bed-management`}>
|
|
29
22
|
<Illustration />
|
|
30
23
|
</ConfigurableLink>
|
|
31
|
-
<div className={styles[
|
|
32
|
-
<p>{t(
|
|
33
|
-
<p className={styles[
|
|
24
|
+
<div className={styles['page-labels']}>
|
|
25
|
+
<p>{t('headerTitle', headerTitle)}</p>
|
|
26
|
+
<p className={styles['page-name']}>{route}</p>
|
|
34
27
|
</div>
|
|
35
28
|
</div>
|
|
36
|
-
<div className={styles[
|
|
37
|
-
<div className={styles[
|
|
29
|
+
<div className={styles['right-justified-items']}>
|
|
30
|
+
<div className={styles['date-and-location']}>
|
|
38
31
|
<Location size={16} />
|
|
39
32
|
<span className={styles.value}>{userLocation}</span>
|
|
40
33
|
<span className={styles.middot}>·</span>
|
|
41
34
|
<Calendar size={16} />
|
|
42
|
-
<span className={styles.value}>
|
|
43
|
-
{formatDate(new Date(), { mode: "standard" })}
|
|
44
|
-
</span>
|
|
35
|
+
<span className={styles.value}>{formatDate(new Date(), { mode: 'standard' })}</span>
|
|
45
36
|
</div>
|
|
46
37
|
</div>
|
|
47
38
|
</div>
|