@kenyaemr/esm-bed-management-app 1.0.1-pre.11
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +37 -0
- package/.husky/pre-commit +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/3d353a50.yml +0 -0
- package/LICENSE +373 -0
- package/README.md +40 -0
- package/dist/207.js +1 -0
- package/dist/207.js.map +1 -0
- package/dist/26.js +2 -0
- package/dist/26.js.LICENSE.txt +32 -0
- package/dist/26.js.map +1 -0
- package/dist/283.js +1 -0
- package/dist/283.js.map +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/294.js.map +1 -0
- package/dist/330.js +2 -0
- package/dist/330.js.LICENSE.txt +44 -0
- package/dist/330.js.map +1 -0
- package/dist/404.js +1 -0
- package/dist/404.js.map +1 -0
- package/dist/455.js +2 -0
- package/dist/455.js.LICENSE.txt +9 -0
- package/dist/455.js.map +1 -0
- package/dist/558.js +2 -0
- package/dist/558.js.LICENSE.txt +14 -0
- package/dist/558.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/629.js +1 -0
- package/dist/629.js.map +1 -0
- package/dist/637.js +1 -0
- package/dist/637.js.map +1 -0
- package/dist/707.js +1 -0
- package/dist/707.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/850.js +1 -0
- package/dist/850.js.map +1 -0
- package/dist/884.js +1 -0
- package/dist/884.js.map +1 -0
- package/dist/933.js +1 -0
- package/dist/933.js.map +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js.buildmanifest.json +506 -0
- package/dist/esm-kenyaemr-bed-management-app.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +0 -0
- package/package.json +112 -0
- package/src/__mocks__/react-i18next.js +55 -0
- package/src/admin-card-link.component.tsx +27 -0
- package/src/assets/landing-page.png +0 -0
- package/src/assets/logo.svg +1 -0
- package/src/bed-administration/bed-administration-form.component.tsx +326 -0
- package/src/bed-administration/bed-administration-form.scss +0 -0
- package/src/bed-administration/bed-administration-table.component.tsx +317 -0
- package/src/bed-administration/bed-administration-table.scss +112 -0
- package/src/bed-administration/bed-administration-types.ts +20 -0
- package/src/bed-administration/bed-administration.resource.ts +59 -0
- package/src/bed-administration/edit-bed-form.component.tsx +100 -0
- package/src/bed-administration/new-bed-form.component.tsx +112 -0
- package/src/bed-admission/active-patients/active-patients-table.component.tsx +299 -0
- package/src/bed-admission/active-patients/active-visits.resource.ts +171 -0
- package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
- package/src/bed-admission/active-patients/admission-action-button.component.tsx +26 -0
- package/src/bed-admission/active-patients/index.tsx +15 -0
- package/src/bed-admission/active-patients/patient-queues.resource.ts +136 -0
- package/src/bed-admission/active-patients/styles.scss +284 -0
- package/src/bed-admission/active-patients/view-action-menu.component.tsx +33 -0
- package/src/bed-admission/admitted-patients/active-admissions.resource.ts +125 -0
- package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +280 -0
- package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +22 -0
- package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +55 -0
- package/src/bed-admission/admitted-patients/styles.scss +284 -0
- package/src/bed-admission/bed-admission-tabs-styles.scss +30 -0
- package/src/bed-admission/bed-admission-tabs.component.tsx +69 -0
- package/src/bed-admission/bed-admission.component.tsx +15 -0
- package/src/bed-admission/bed-admission.resource.ts +52 -0
- package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +101 -0
- package/src/bed-admission/bed-layout/bed-layout.component.tsx +64 -0
- package/src/bed-admission/bed-layout/bed-layout.scss +118 -0
- package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +26 -0
- package/src/bed-admission/bed-tag/bed-tag-administration-table.component.tsx +217 -0
- package/src/bed-admission/bed-tag/bed-tags-admin-form.component.tsx +131 -0
- package/src/bed-admission/bed-tag/edit-tag-form.component.tsx +80 -0
- package/src/bed-admission/bed-tag/new-tag-form.component.tsx +83 -0
- package/src/bed-admission/bed-type/bed-type-admin-form.component.tsx +173 -0
- package/src/bed-admission/bed-type/bed-type-administration-table.component.tsx +222 -0
- package/src/bed-admission/bed-type/edit-bed-type.component.tsx +80 -0
- package/src/bed-admission/bed-type/new-bed-type-form.component.tsx +87 -0
- package/src/bed-admission/createDashboardLink.tsx +47 -0
- package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +19 -0
- package/src/bed-admission/helpers/functions.ts +102 -0
- package/src/bed-admission/types.ts +133 -0
- package/src/config-schema.ts +31 -0
- package/src/declarations.d.ts +7 -0
- package/src/empty-state/empty-state.component.tsx +69 -0
- package/src/empty-state/empty-state.scss +62 -0
- package/src/header/header.component.tsx +51 -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 +78 -0
- package/src/left-panel/left-panel.component.tsx +33 -0
- package/src/left-panel/left-panel.scss +41 -0
- package/src/left-panel-link.component.tsx +49 -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 +74 -0
- package/src/summary/summary.resource.ts +211 -0
- package/src/summary/summary.scss +72 -0
- package/src/types.ts +163 -0
- package/src/ward-card/ward-card.component.tsx +41 -0
- package/src/ward-card/ward-card.scss +51 -0
- package/src/ward-with-beds/ward-with-beds.component.tsx +186 -0
- package/src/ward-with-beds/ward-with-beds.scss +27 -0
- package/src/workspace/allocate-bed-workspace.component.tsx +188 -0
- package/src/workspace/allocate-bed.scss +124 -0
- package/src/workspace/overlay.component.tsx +55 -0
- package/src/workspace/overlay.scss +96 -0
- package/translations/en.json +7 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use "@carbon/type";
|
|
4
|
+
|
|
5
|
+
.header {
|
|
6
|
+
@include type.type-style('body-compact-02');
|
|
7
|
+
color: colors.$gray-70;
|
|
8
|
+
height: layout.$spacing-12;
|
|
9
|
+
background-color: colors.$white-0;
|
|
10
|
+
display: flex;
|
|
11
|
+
padding-left: 8px;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
border-bottom: 1px solid colors.$gray-20;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.left-justified-items {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: center;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.right-justified-items {
|
|
24
|
+
@include type.type-style('body-compact-02');
|
|
25
|
+
color: colors.$gray-70;
|
|
26
|
+
margin: 0.5rem;
|
|
27
|
+
padding-top: 0.75rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.page-name {
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
@include type.type-style('heading-04');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.page-labels {
|
|
36
|
+
margin: 1rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.middot {
|
|
40
|
+
margin: 0 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.date-and-location {
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: flex-end;
|
|
46
|
+
align-items: center;
|
|
47
|
+
margin-right: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.value {
|
|
51
|
+
margin-left: 0.25rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.middot {
|
|
55
|
+
margin: 0 0.5rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.view {
|
|
59
|
+
@include type.type-style('label-01');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
svg.iconOverrides {
|
|
63
|
+
width: 72 !important;
|
|
64
|
+
height: 72 !important;
|
|
65
|
+
fill: var(--brand-03);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.svgContainer svg {
|
|
69
|
+
width: 72px;
|
|
70
|
+
height: 72px;
|
|
71
|
+
fill: var(--brand-03);
|
|
72
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styles from "./header.scss";
|
|
3
|
+
import { Stethoscope } from "@carbon/react/icons";
|
|
4
|
+
|
|
5
|
+
const Illustration: React.FC = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div className={styles.svgContainer}>
|
|
8
|
+
<Stethoscope className={styles.iconOverrides} />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default Illustration;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import BedManagementSummary from "./summary/summary.component";
|
|
3
|
+
import Header from "./header/header.component";
|
|
4
|
+
import styles from "./home.scss";
|
|
5
|
+
|
|
6
|
+
const Home: React.FC = () => {
|
|
7
|
+
return (
|
|
8
|
+
<section className={styles.section}>
|
|
9
|
+
<Header route="Summary" />
|
|
10
|
+
<BedManagementSummary />
|
|
11
|
+
</section>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Home;
|
package/src/home.scss
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAsyncLifecycle,
|
|
3
|
+
defineConfigSchema,
|
|
4
|
+
getSyncLifecycle,
|
|
5
|
+
} from "@openmrs/esm-framework";
|
|
6
|
+
import { configSchema } from "./config-schema";
|
|
7
|
+
import { createLeftPanelLink } from "./left-panel-link.component";
|
|
8
|
+
import { createDashboardLink } from "./bed-admission/createDashboardLink";
|
|
9
|
+
|
|
10
|
+
const moduleName = "@kenyaemr/esm-bed-management-app";
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
featureName: "bed-management",
|
|
14
|
+
moduleName,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const importTranslation = require.context(
|
|
18
|
+
"../translations",
|
|
19
|
+
false,
|
|
20
|
+
/.json$/,
|
|
21
|
+
"lazy"
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function startupApp() {
|
|
25
|
+
defineConfigSchema(moduleName, configSchema);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const root = getAsyncLifecycle(
|
|
29
|
+
() => import("./root.component"),
|
|
30
|
+
options
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const bedAdmission = getAsyncLifecycle(
|
|
34
|
+
() => import("./bed-admission/bed-admission.component"),
|
|
35
|
+
options
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const adminCardLink = getAsyncLifecycle(
|
|
39
|
+
() => import("./admin-card-link.component"),
|
|
40
|
+
options
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const summaryLeftPanelLink = getSyncLifecycle(
|
|
44
|
+
createLeftPanelLink({
|
|
45
|
+
name: "bed-management",
|
|
46
|
+
title: "Summary",
|
|
47
|
+
}),
|
|
48
|
+
options
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const adminLeftPanelLink = getSyncLifecycle(
|
|
52
|
+
createLeftPanelLink({
|
|
53
|
+
name: "administration",
|
|
54
|
+
title: "Ward Allocation",
|
|
55
|
+
}),
|
|
56
|
+
options
|
|
57
|
+
);
|
|
58
|
+
export const bedTypeLeftPanelLink = getSyncLifecycle(
|
|
59
|
+
createLeftPanelLink({
|
|
60
|
+
name: "bed-type",
|
|
61
|
+
title: "Bed Type",
|
|
62
|
+
}),
|
|
63
|
+
options
|
|
64
|
+
);
|
|
65
|
+
export const bedTagLeftPanelLink = getSyncLifecycle(
|
|
66
|
+
createLeftPanelLink({
|
|
67
|
+
name: "bed-tag",
|
|
68
|
+
title: "Bed Tag",
|
|
69
|
+
}),
|
|
70
|
+
options
|
|
71
|
+
);
|
|
72
|
+
export const bedAdmissionDashboardLink = getSyncLifecycle(
|
|
73
|
+
createDashboardLink({
|
|
74
|
+
name: "bed-admission",
|
|
75
|
+
title: "In Patient",
|
|
76
|
+
}),
|
|
77
|
+
options
|
|
78
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
attach,
|
|
4
|
+
detach,
|
|
5
|
+
ExtensionSlot,
|
|
6
|
+
isDesktop,
|
|
7
|
+
useLayoutType,
|
|
8
|
+
} from "@openmrs/esm-framework";
|
|
9
|
+
import { SideNav } from "@carbon/react";
|
|
10
|
+
import styles from "./left-panel.scss";
|
|
11
|
+
|
|
12
|
+
const LeftPanel: React.FC = () => {
|
|
13
|
+
const layout = useLayoutType();
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
attach("nav-menu-slot", "bed-management-left-panel");
|
|
17
|
+
return () => detach("nav-menu-slot", "bed-management-left-panel");
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
isDesktop(layout) && (
|
|
22
|
+
<SideNav
|
|
23
|
+
aria-label="Bed management left panel"
|
|
24
|
+
className={styles.leftPanel}
|
|
25
|
+
expanded
|
|
26
|
+
>
|
|
27
|
+
<ExtensionSlot name="bed-management-left-panel-slot" />
|
|
28
|
+
</SideNav>
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default LeftPanel;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use "@carbon/type";
|
|
3
|
+
|
|
4
|
+
.leftPanel {
|
|
5
|
+
border-right: 1px solid colors.$gray-20;
|
|
6
|
+
padding-top: 1rem;
|
|
7
|
+
|
|
8
|
+
// Left nav menu item
|
|
9
|
+
:global(.cds--side-nav__link) {
|
|
10
|
+
color: colors.$gray-70;
|
|
11
|
+
@include type.type-style("heading-compact-01");
|
|
12
|
+
|
|
13
|
+
&:focus,
|
|
14
|
+
&:hover {
|
|
15
|
+
background-color: colors.$gray-10-hover;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Active menu item
|
|
19
|
+
&:global(.active-left-nav-link) {
|
|
20
|
+
color: colors.$gray-100;
|
|
21
|
+
border-left: 0.25rem solid var(--brand-01);
|
|
22
|
+
outline: none;
|
|
23
|
+
padding: 0 0.75rem;
|
|
24
|
+
background-color: colors.$gray-20;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Desktop */
|
|
30
|
+
:global(.omrs-breakpoint-gt-tablet) {
|
|
31
|
+
:global(.cds--side-nav__link) {
|
|
32
|
+
height: 2rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Tablet */
|
|
37
|
+
:global(.omrs-breakpoint-lt-desktop) {
|
|
38
|
+
:global(.cds--side-nav__link) {
|
|
39
|
+
height: 3rem;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import last from "lodash-es/last";
|
|
3
|
+
import { BrowserRouter, useLocation } from "react-router-dom";
|
|
4
|
+
import { ConfigurableLink } from "@openmrs/esm-framework";
|
|
5
|
+
|
|
6
|
+
export interface LinkConfig {
|
|
7
|
+
name: string;
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function LinkExtension({ config }: { config: LinkConfig }) {
|
|
12
|
+
const { name, title } = config;
|
|
13
|
+
const location = useLocation();
|
|
14
|
+
|
|
15
|
+
let urlSegment = useMemo(
|
|
16
|
+
() => decodeURIComponent(last(location.pathname.split("/"))),
|
|
17
|
+
[location.pathname]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const isUUID = (value) => {
|
|
21
|
+
const regex =
|
|
22
|
+
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
|
|
23
|
+
return regex.test(value);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (isUUID(urlSegment)) {
|
|
27
|
+
urlSegment = "summary";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ConfigurableLink
|
|
32
|
+
to={`${window.getOpenmrsSpaBase()}bed-management${
|
|
33
|
+
name && name !== "bed-management" ? `/${name}` : ""
|
|
34
|
+
}`}
|
|
35
|
+
className={`cds--side-nav__link ${
|
|
36
|
+
name === urlSegment && "active-left-nav-link"
|
|
37
|
+
}`}
|
|
38
|
+
>
|
|
39
|
+
{title}
|
|
40
|
+
</ConfigurableLink>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const createLeftPanelLink = (config: LinkConfig) => () =>
|
|
45
|
+
(
|
|
46
|
+
<BrowserRouter>
|
|
47
|
+
<LinkExtension config={config} />
|
|
48
|
+
</BrowserRouter>
|
|
49
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
|
3
|
+
import { setLeftNav, unsetLeftNav } from "@openmrs/esm-framework";
|
|
4
|
+
import BedAdministrationTable from "./bed-administration/bed-administration-table.component";
|
|
5
|
+
import Home from "./home.component";
|
|
6
|
+
import LeftPanel from "./left-panel/left-panel.component";
|
|
7
|
+
import WardWithBeds from "./ward-with-beds/ward-with-beds.component";
|
|
8
|
+
import styles from "./root.scss";
|
|
9
|
+
import BedTagAdministrationTable from "./bed-admission/bed-tag/bed-tag-administration-table.component";
|
|
10
|
+
import BedTypeAdministrationTable from "./bed-admission/bed-type/bed-type-administration-table.component";
|
|
11
|
+
|
|
12
|
+
const Root: React.FC = () => {
|
|
13
|
+
const spaBasePath = window.spaBase;
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setLeftNav({
|
|
17
|
+
name: "bed-management-left-panel-slot",
|
|
18
|
+
basePath: spaBasePath,
|
|
19
|
+
});
|
|
20
|
+
return () => unsetLeftNav("bed-management-left-panel-slot");
|
|
21
|
+
}, [spaBasePath]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<BrowserRouter basename={`${window.getOpenmrsSpaBase()}bed-management`}>
|
|
25
|
+
<LeftPanel />
|
|
26
|
+
<main className={styles.container}>
|
|
27
|
+
<Routes>
|
|
28
|
+
<Route path="/" element={<Home />} />
|
|
29
|
+
<Route path="/location/:location" element={<WardWithBeds />} />
|
|
30
|
+
<Route path="/administration" element={<BedAdministrationTable />} />
|
|
31
|
+
<Route path="/bed-tag" element={<BedTagAdministrationTable />} />
|
|
32
|
+
<Route path="/bed-type" element={<BedTypeAdministrationTable />} />
|
|
33
|
+
</Routes>
|
|
34
|
+
</main>
|
|
35
|
+
</BrowserRouter>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Root;
|
package/src/root.scss
ADDED
package/src/routes.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"fhir2": "^1.2.0",
|
|
5
|
+
"webservices.rest": "^2.24.0"
|
|
6
|
+
},
|
|
7
|
+
"pages": [
|
|
8
|
+
{
|
|
9
|
+
"component": "root",
|
|
10
|
+
"route": "bed-management"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"extensions": [
|
|
14
|
+
{
|
|
15
|
+
"component": "adminCardLink",
|
|
16
|
+
"name": "bed-management-admin-card-link",
|
|
17
|
+
"slot": "system-admin-page-card-link-slot"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"component": "adminLeftPanelLink",
|
|
21
|
+
"name": "bed-administration-left-panel-link",
|
|
22
|
+
"slot": "bed-management-left-panel-slot"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"component": "summaryLeftPanelLink",
|
|
26
|
+
"name": "bed-management-home-dashboard-link",
|
|
27
|
+
"slot": "bed-management-left-panel-slot",
|
|
28
|
+
"order": 0
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"component": "bedAdmission",
|
|
32
|
+
"name": "bed-admission-dashboard",
|
|
33
|
+
"slot": "bed-admission-dashboard-slot"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"component": "bedTypeLeftPanelLink",
|
|
37
|
+
"name": "bed-type-left-panel-link",
|
|
38
|
+
"slot": "bed-management-left-panel-slot"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"component": "bedTagLeftPanelLink",
|
|
42
|
+
"name": "bed-tag-left-panel-link",
|
|
43
|
+
"slot": "bed-management-left-panel-slot"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "bed-admission-dashboard-link",
|
|
47
|
+
"component": "bedAdmissionDashboardLink",
|
|
48
|
+
"slot": "homepage-dashboard-slot",
|
|
49
|
+
"meta": {
|
|
50
|
+
"name": "bed-admission",
|
|
51
|
+
"slot": "bed-admission-dashboard-slot",
|
|
52
|
+
"title": "Bed-admission"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DataTableSkeleton } from "@carbon/react";
|
|
3
|
+
import { ArrowRight } from "@carbon/react/icons";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { ConfigurableLink } from "@openmrs/esm-framework";
|
|
6
|
+
import { useAdmissionLocations } from "./summary.resource";
|
|
7
|
+
import EmptyState from "../empty-state/empty-state.component";
|
|
8
|
+
import WardCard from "../ward-card/ward-card.component";
|
|
9
|
+
import styles from "./summary.scss";
|
|
10
|
+
import { ErrorState } from "@openmrs/esm-patient-common-lib";
|
|
11
|
+
|
|
12
|
+
const Summary: React.FC = () => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const {
|
|
15
|
+
data: admissionLocations,
|
|
16
|
+
isLoading,
|
|
17
|
+
error,
|
|
18
|
+
} = useAdmissionLocations();
|
|
19
|
+
|
|
20
|
+
if (isLoading) {
|
|
21
|
+
return (
|
|
22
|
+
<div className={styles.loader}>
|
|
23
|
+
<DataTableSkeleton role="progressbar" zebra />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (admissionLocations?.length) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={styles.cardContainer}>
|
|
31
|
+
{admissionLocations.map((admissionLocation) => {
|
|
32
|
+
const routeSegment = `${window.getOpenmrsSpaBase()}bed-management/location/${
|
|
33
|
+
admissionLocation.ward.uuid
|
|
34
|
+
}`;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<WardCard
|
|
38
|
+
headerLabel={admissionLocation.ward.display}
|
|
39
|
+
label={t("beds", "Beds")}
|
|
40
|
+
value={admissionLocation?.totalBeds}
|
|
41
|
+
>
|
|
42
|
+
{admissionLocation?.totalBeds && (
|
|
43
|
+
<div className={styles.link}>
|
|
44
|
+
<ConfigurableLink className={styles.link} to={routeSegment}>
|
|
45
|
+
{t("viewBeds", "View beds")}
|
|
46
|
+
</ConfigurableLink>
|
|
47
|
+
<ArrowRight size={16} />
|
|
48
|
+
</div>
|
|
49
|
+
)}
|
|
50
|
+
</WardCard>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!isLoading && admissionLocations?.length === 0 && !error) {
|
|
58
|
+
return <EmptyState msg="No data to display" helper={""} />;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (error) {
|
|
62
|
+
return (
|
|
63
|
+
<ErrorState
|
|
64
|
+
headerTitle={t(
|
|
65
|
+
"errorFetchingbedInformation",
|
|
66
|
+
"Error fetching bed information"
|
|
67
|
+
)}
|
|
68
|
+
error={error}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Summary;
|