@kenyaemr/esm-bed-management-app 1.0.1-pre.4
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/6816f0d4.yml +0 -0
- package/LICENSE +373 -0
- package/README.md +40 -0
- package/dist/187.js +1 -0
- package/dist/187.js.map +1 -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/352.js +1 -0
- package/dist/352.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/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/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/959.js +1 -0
- package/dist/959.js.map +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js.buildmanifest.json +532 -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 +12 -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 +121 -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 +35 -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/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 +21 -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 +65 -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 +35 -0
- package/src/root.scss +11 -0
- package/src/routes.json +46 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary/summary.component.tsx +74 -0
- package/src/summary/summary.resource.ts +123 -0
- package/src/summary/summary.scss +72 -0
- package/src/types.ts +152 -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 +141 -0
- package/src/workspace/allocate-bed.scss +117 -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,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import AdmittedPatientsTable from "./admitted-patients-table.component";
|
|
3
|
+
interface AdmittedPatientsListProps {
|
|
4
|
+
status: string;
|
|
5
|
+
setPatientCount: (value: number) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const AdmittedPatientsList: React.FC<AdmittedPatientsListProps> = ({
|
|
9
|
+
status,
|
|
10
|
+
setPatientCount,
|
|
11
|
+
}) => {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<AdmittedPatientsTable
|
|
15
|
+
status={status}
|
|
16
|
+
setPatientCount={setPatientCount}
|
|
17
|
+
/>
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default AdmittedPatientsList;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { ComboBox, FormGroup } from "@carbon/react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useLocationsByTag } from "../../summary/summary.resource";
|
|
5
|
+
import { useConfig, useSession } from "@openmrs/esm-framework";
|
|
6
|
+
|
|
7
|
+
const LocationComboBox = ({ setLocationUuid }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const {
|
|
10
|
+
admissionLocationTagUuid,
|
|
11
|
+
restrictWardAdministrationToLoginLocation,
|
|
12
|
+
} = useConfig();
|
|
13
|
+
const session = useSession();
|
|
14
|
+
const [selectedLocationId] = useState("");
|
|
15
|
+
|
|
16
|
+
const { data: admissionLocations } = useLocationsByTag(
|
|
17
|
+
admissionLocationTagUuid
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const filterLocationNames = (location) => {
|
|
21
|
+
return (
|
|
22
|
+
location.item.display
|
|
23
|
+
?.toLowerCase()
|
|
24
|
+
.includes(location?.inputValue?.toLowerCase()) ?? []
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<FormGroup>
|
|
30
|
+
<ComboBox
|
|
31
|
+
aria-label={t("location", "Locations")}
|
|
32
|
+
id="location"
|
|
33
|
+
label={t("location", "Locations")}
|
|
34
|
+
shouldFilterItem={filterLocationNames}
|
|
35
|
+
items={admissionLocations}
|
|
36
|
+
onChange={({ selectedItem }) => {
|
|
37
|
+
setLocationUuid(selectedItem?.uuid ?? "");
|
|
38
|
+
}}
|
|
39
|
+
selectedItem={admissionLocations?.find(
|
|
40
|
+
(location) => location?.uuid === selectedLocationId
|
|
41
|
+
)}
|
|
42
|
+
itemToString={(location) => location?.display ?? ""}
|
|
43
|
+
placeholder={t("selectNewLocation", "Select an admission location")}
|
|
44
|
+
title={selectedLocationId}
|
|
45
|
+
initialSelectedItem={
|
|
46
|
+
restrictWardAdministrationToLoginLocation
|
|
47
|
+
? session.sessionLocation
|
|
48
|
+
: ""
|
|
49
|
+
}
|
|
50
|
+
/>
|
|
51
|
+
</FormGroup>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default LocationComboBox;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
@use '@carbon/type';
|
|
2
|
+
@use '@carbon/colors';
|
|
3
|
+
@use '@carbon/styles/scss/spacing';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.container {
|
|
7
|
+
background-color: $ui-01;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.displayFlex {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.section {
|
|
15
|
+
border-right: 1px solid colors.$gray-20;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.activePatientsTable tr:last-of-type {
|
|
19
|
+
td {
|
|
20
|
+
border-bottom: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.headerContainer {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
align-items: center;
|
|
28
|
+
background-color: $ui-background;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.headerButtons {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-flow: column;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.heading {
|
|
37
|
+
font-size: 20px;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.filterContainer {
|
|
42
|
+
:global(.cds--dropdown__wrapper--inline) {
|
|
43
|
+
gap: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:global(.cds--list-box__menu-icon) {
|
|
47
|
+
height: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:global(.cds--dropdown--inline) :global(.cds--list-box__field) {
|
|
51
|
+
min-width: 12rem;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tooltip :global(.cds--tooltip__trigger.cds--tooltip__trigger--definition) {
|
|
56
|
+
border-bottom: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.tag {
|
|
60
|
+
margin: 0.25rem 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.priorityTag {
|
|
64
|
+
@extend .tag;
|
|
65
|
+
@include type.type-style('label-01');
|
|
66
|
+
color: #943d00;
|
|
67
|
+
background-color: #ffc9a3;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.backgroundDataFetchingIndicator {
|
|
71
|
+
align-items: center;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex: 1 1 0%;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.search {
|
|
78
|
+
max-width: 16rem;
|
|
79
|
+
|
|
80
|
+
input {
|
|
81
|
+
background-color: $ui-02 !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tableContainer {
|
|
86
|
+
background-color: $ui-01;
|
|
87
|
+
margin: 0 spacing.$spacing-05;
|
|
88
|
+
padding: 0;
|
|
89
|
+
|
|
90
|
+
a {
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
th {
|
|
95
|
+
color: $text-02;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:global(.cds--data-table) {
|
|
99
|
+
background-color: $ui-03;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:global(.cds--data-table-content) {
|
|
103
|
+
display: contents;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.toolbarContent {
|
|
107
|
+
height: spacing.$spacing-07;
|
|
108
|
+
margin-bottom: spacing.$spacing-02;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.emptyRow {
|
|
113
|
+
padding: 0 1rem;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.activeVisitsTable tr:last-of-type {
|
|
119
|
+
td {
|
|
120
|
+
border-bottom: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.expandedActiveVisitRow {
|
|
125
|
+
:global(.cds--tab-content) {
|
|
126
|
+
padding: 0.5rem 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
td {
|
|
130
|
+
padding: 0.5rem;
|
|
131
|
+
|
|
132
|
+
>div {
|
|
133
|
+
max-height: max-content !important;
|
|
134
|
+
background-color: $ui-02;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
th[colspan] td[colspan]>div:first-child {
|
|
139
|
+
padding: 0 1rem;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.hiddenRow {
|
|
144
|
+
display: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.content {
|
|
148
|
+
@include type.type-style('heading-compact-02');
|
|
149
|
+
color: $text-02;
|
|
150
|
+
margin-bottom: 0.5rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.helper {
|
|
154
|
+
@include type.type-style('body-compact-01');
|
|
155
|
+
color: $text-02;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.separator {
|
|
159
|
+
@include type.type-style('body-compact-02');
|
|
160
|
+
color: $text-02;
|
|
161
|
+
width: 80%;
|
|
162
|
+
margin: 1.5rem auto;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
text-align: center;
|
|
165
|
+
|
|
166
|
+
&::before,
|
|
167
|
+
&::after {
|
|
168
|
+
background-color: $text-03;
|
|
169
|
+
content: '';
|
|
170
|
+
display: inline-block;
|
|
171
|
+
height: 1px;
|
|
172
|
+
position: relative;
|
|
173
|
+
vertical-align: middle;
|
|
174
|
+
width: 50%;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&::before {
|
|
178
|
+
right: 0.5rem;
|
|
179
|
+
margin-left: -50%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&::after {
|
|
183
|
+
left: 0.5rem;
|
|
184
|
+
margin-right: -50%;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.tileContainer {
|
|
189
|
+
background-color: $ui-02;
|
|
190
|
+
border-top: 1px solid $ui-03;
|
|
191
|
+
padding: 5rem 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.tile {
|
|
195
|
+
margin: auto;
|
|
196
|
+
width: fit-content;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.tileContent {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
align-items: center;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.menuItem {
|
|
206
|
+
max-width: none;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.desktopHeading {
|
|
210
|
+
h4 {
|
|
211
|
+
@include type.type-style('heading-compact-02');
|
|
212
|
+
color: $text-02;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.tabletHeading {
|
|
217
|
+
h4 {
|
|
218
|
+
@include type.type-style('heading-03');
|
|
219
|
+
color: $text-02;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.desktopHeading,
|
|
224
|
+
.tabletHeading {
|
|
225
|
+
text-align: left;
|
|
226
|
+
text-transform: capitalize;
|
|
227
|
+
margin-bottom: spacing.$spacing-05;
|
|
228
|
+
|
|
229
|
+
h4:after {
|
|
230
|
+
content: '';
|
|
231
|
+
display: block;
|
|
232
|
+
width: 2rem;
|
|
233
|
+
padding-top: 3px;
|
|
234
|
+
border-bottom: 0.375rem solid var(--brand-03);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.statusContainer {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
|
|
242
|
+
svg {
|
|
243
|
+
margin-right: 0.5rem;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.visitType {
|
|
248
|
+
@include type.type-style('heading-compact-02');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.headerBtnContainer {
|
|
252
|
+
background-color: $ui-background;
|
|
253
|
+
text-align: right;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.addPatientToListBtn {
|
|
257
|
+
margin-left: spacing.$spacing-05;
|
|
258
|
+
height: spacing.$spacing-09;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.editIcon {
|
|
262
|
+
color: $interactive-01;
|
|
263
|
+
margin-top: 0.5rem;
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.expandedLabQueueVisitRow {
|
|
268
|
+
:global(.cds--tab-content) {
|
|
269
|
+
padding: 0.5rem 0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
td {
|
|
273
|
+
padding: 0.5rem;
|
|
274
|
+
|
|
275
|
+
>div {
|
|
276
|
+
max-height: max-content !important;
|
|
277
|
+
background-color: $ui-02;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
th[colspan] td[colspan]>div:first-child {
|
|
282
|
+
padding: 0 1rem;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
2
|
+
|
|
3
|
+
.tabsContainer {
|
|
4
|
+
:global(.cds--tabs__nav-item--selected) {
|
|
5
|
+
box-shadow: inset 0 2px 0 0 var(--brand-03) !important;
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tab {
|
|
11
|
+
min-width: 8rem;
|
|
12
|
+
|
|
13
|
+
&:active,
|
|
14
|
+
&:focus {
|
|
15
|
+
outline: none !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.container {
|
|
21
|
+
background-color: $ui-01;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.cardContainer {
|
|
25
|
+
background-color: $ui-02;
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
padding: 1rem;
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Tab, TabList, TabPanel, TabPanels, Tabs } from "@carbon/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import styles from "./bed-admission-tabs-styles.scss";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import ActivePatientsTable from "./active-patients/active-patients-table.component";
|
|
6
|
+
import AdmittedPatientsList from "./admitted-patients/admitted-patients.component";
|
|
7
|
+
import DischargedPatientsList from "./discharged-patients/discharged-patients.componet";
|
|
8
|
+
import WardCard from "../ward-card/ward-card.component";
|
|
9
|
+
|
|
10
|
+
const BedAdmissionTabs: React.FC = () => {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const [admittedCount, setAdmittedCount] = useState(0);
|
|
13
|
+
const [toAdmitCount, setToAdmitCount] = useState(0);
|
|
14
|
+
const [toDischargeCount, setToDischargeCount] = useState(0);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.cardContainer}>
|
|
19
|
+
<WardCard
|
|
20
|
+
label="patients"
|
|
21
|
+
headerLabel="To Admit"
|
|
22
|
+
value={admittedCount}
|
|
23
|
+
/>
|
|
24
|
+
<WardCard
|
|
25
|
+
label="patients"
|
|
26
|
+
headerLabel="Admitted"
|
|
27
|
+
value={toAdmitCount}
|
|
28
|
+
/>
|
|
29
|
+
<WardCard
|
|
30
|
+
label="patients"
|
|
31
|
+
headerLabel="To Discharge"
|
|
32
|
+
value={toDischargeCount}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div className={styles.container}>
|
|
36
|
+
<Tabs>
|
|
37
|
+
<TabList contained fullWidth className={styles.tabsContainer}>
|
|
38
|
+
<Tab className={styles.tab}>
|
|
39
|
+
{t("toAdmit", `To Admit (${admittedCount})`)}
|
|
40
|
+
</Tab>
|
|
41
|
+
<Tab className={styles.tab}>
|
|
42
|
+
{t("admitted", `Admitted (${toAdmitCount})`)}
|
|
43
|
+
</Tab>
|
|
44
|
+
<Tab className={styles.tab}>
|
|
45
|
+
{t("discharged", `To Discharge (0)`)}
|
|
46
|
+
</Tab>
|
|
47
|
+
</TabList>
|
|
48
|
+
<TabPanels>
|
|
49
|
+
<TabPanel>
|
|
50
|
+
<ActivePatientsTable
|
|
51
|
+
status="pending"
|
|
52
|
+
setPatientCount={setAdmittedCount}
|
|
53
|
+
/>
|
|
54
|
+
</TabPanel>
|
|
55
|
+
<TabPanel>
|
|
56
|
+
<AdmittedPatientsList
|
|
57
|
+
status="completed"
|
|
58
|
+
setPatientCount={setToAdmitCount}
|
|
59
|
+
/>
|
|
60
|
+
</TabPanel>
|
|
61
|
+
<TabPanel></TabPanel>
|
|
62
|
+
</TabPanels>
|
|
63
|
+
</Tabs>
|
|
64
|
+
</div>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default BedAdmissionTabs;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
|
3
|
+
import ActivePatientsHome from "./active-patients";
|
|
4
|
+
|
|
5
|
+
const BedAdmission: React.FC = () => {
|
|
6
|
+
return (
|
|
7
|
+
<BrowserRouter basename={window.getOpenmrsSpaBase()}>
|
|
8
|
+
<Routes>
|
|
9
|
+
<Route path="/home/bed-admission" element={<ActivePatientsHome />} />
|
|
10
|
+
</Routes>
|
|
11
|
+
</BrowserRouter>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default BedAdmission;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FetchResponse, openmrsFetch } from "@openmrs/esm-framework";
|
|
2
|
+
|
|
3
|
+
export async function assignPatientBed(
|
|
4
|
+
requestPayload,
|
|
5
|
+
bedId
|
|
6
|
+
): Promise<FetchResponse> {
|
|
7
|
+
const abortController = new AbortController();
|
|
8
|
+
abortController.abort();
|
|
9
|
+
const response: FetchResponse = await openmrsFetch(
|
|
10
|
+
`/ws/rest/v1/beds/${bedId}`,
|
|
11
|
+
{
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: { "Content-Type": "application/json" },
|
|
14
|
+
body: requestPayload,
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function endPatientQueue(
|
|
21
|
+
queueStatus,
|
|
22
|
+
queueUuid
|
|
23
|
+
): Promise<FetchResponse> {
|
|
24
|
+
const abortController = new AbortController();
|
|
25
|
+
abortController.abort();
|
|
26
|
+
const response: FetchResponse = await openmrsFetch(
|
|
27
|
+
`/ws/rest/v1/patientqueue/${queueUuid}`,
|
|
28
|
+
{
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
body: queueStatus,
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Column, InlineLoading, Grid } from "@carbon/react";
|
|
3
|
+
import { ErrorState } from "@openmrs/esm-patient-common-lib";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import BedLayout from "./bed-layout.component";
|
|
6
|
+
import styles from "./bed-layout.scss";
|
|
7
|
+
import EmptyState from "../../empty-state/empty-state.component";
|
|
8
|
+
import MinBedLayout from "./min-bed-layout.component";
|
|
9
|
+
import { useAdmissionLocationBedLayout } from "../../summary/summary.resource";
|
|
10
|
+
import { patientDetailsProps } from "../types";
|
|
11
|
+
interface BedLayoutListProps {
|
|
12
|
+
locationUuid: string;
|
|
13
|
+
handleClick: (e) => void;
|
|
14
|
+
patientDetails: patientDetailsProps;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const BedLayoutList: React.FC<BedLayoutListProps> = React.memo(
|
|
18
|
+
({ locationUuid, handleClick, patientDetails }) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const [selectedBed, setSelectedBed] = useState(null);
|
|
21
|
+
const {
|
|
22
|
+
data: bedData,
|
|
23
|
+
isLoading,
|
|
24
|
+
error,
|
|
25
|
+
} = useAdmissionLocationBedLayout(locationUuid);
|
|
26
|
+
|
|
27
|
+
const getLayoutClass = (status: string) =>
|
|
28
|
+
status === "AVAILABLE" ? styles.available : styles.occupied;
|
|
29
|
+
|
|
30
|
+
if (isLoading) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={styles.loadingContainer}>
|
|
33
|
+
<InlineLoading
|
|
34
|
+
status="active"
|
|
35
|
+
iconDescription={t("loading", "Loading")}
|
|
36
|
+
description={t("loading", "Loading...")}
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (error) {
|
|
43
|
+
return (
|
|
44
|
+
<div className={styles.errorContainer}>
|
|
45
|
+
<ErrorState
|
|
46
|
+
headerTitle={t(
|
|
47
|
+
"errorFetchingbedInformation",
|
|
48
|
+
"Error fetching bed information"
|
|
49
|
+
)}
|
|
50
|
+
error={error}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (locationUuid === undefined) {
|
|
57
|
+
return (
|
|
58
|
+
<div className={styles.errorContainer}>
|
|
59
|
+
<EmptyState
|
|
60
|
+
msg={t("noWardSelected", "No ward has been selected")}
|
|
61
|
+
helper=""
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (locationUuid !== undefined && !bedData?.length) {
|
|
67
|
+
return (
|
|
68
|
+
<div className={styles.errorContainer}>
|
|
69
|
+
<EmptyState
|
|
70
|
+
msg={t("noBedItems", "No bed to display in this ward")}
|
|
71
|
+
helper=""
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<MinBedLayout />
|
|
79
|
+
<Grid>
|
|
80
|
+
{bedData?.map((bed) => (
|
|
81
|
+
<Column key={bed.bedNumber} lg={5} md={5} sm={5}>
|
|
82
|
+
<BedLayout
|
|
83
|
+
handleBedAssignment={() => {
|
|
84
|
+
setSelectedBed(bed.bedId);
|
|
85
|
+
handleClick(bed);
|
|
86
|
+
}}
|
|
87
|
+
bedPillowStyles={styles.pillow}
|
|
88
|
+
layOutStyles={`${styles.bed} ${getLayoutClass(bed.status)}`}
|
|
89
|
+
isBedSelected={selectedBed === bed.bedId}
|
|
90
|
+
patientDetails={patientDetails}
|
|
91
|
+
bedDetails={bed}
|
|
92
|
+
/>
|
|
93
|
+
</Column>
|
|
94
|
+
))}
|
|
95
|
+
</Grid>
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
export default BedLayoutList;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import styles from "./bed-layout.scss";
|
|
4
|
+
import { patientDetailsProps } from "../types";
|
|
5
|
+
import { BedDetails } from "../../types";
|
|
6
|
+
|
|
7
|
+
interface BedProps {
|
|
8
|
+
handleBedAssignment?: () => void;
|
|
9
|
+
isBedSelected?: boolean;
|
|
10
|
+
layOutStyles?: string;
|
|
11
|
+
bedPillowStyles?: string;
|
|
12
|
+
patientDetails?: patientDetailsProps;
|
|
13
|
+
bedDetails?: BedDetails;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const BedLayout: React.FC<BedProps> = ({
|
|
17
|
+
layOutStyles,
|
|
18
|
+
bedPillowStyles,
|
|
19
|
+
handleBedAssignment,
|
|
20
|
+
isBedSelected,
|
|
21
|
+
bedDetails,
|
|
22
|
+
patientDetails,
|
|
23
|
+
}) => {
|
|
24
|
+
const bedRef = useRef(null);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div
|
|
29
|
+
ref={bedRef}
|
|
30
|
+
role="button"
|
|
31
|
+
tabIndex={0}
|
|
32
|
+
onClick={() => handleBedAssignment()}
|
|
33
|
+
className={classnames(styles.bedLayout, {
|
|
34
|
+
[layOutStyles]: layOutStyles,
|
|
35
|
+
[styles.bedLayoutSelected]:
|
|
36
|
+
isBedSelected ||
|
|
37
|
+
(bedDetails &&
|
|
38
|
+
bedDetails.patient &&
|
|
39
|
+
bedDetails.patient.uuid === patientDetails.patientUuid),
|
|
40
|
+
})}
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
className={classnames(styles.bedPillow, {
|
|
44
|
+
[bedPillowStyles]: bedPillowStyles,
|
|
45
|
+
})}
|
|
46
|
+
></div>
|
|
47
|
+
<div style={{ display: "grid" }}>
|
|
48
|
+
<span className={styles.bedNumber}>
|
|
49
|
+
{bedDetails && bedDetails.bedNumber}
|
|
50
|
+
</span>
|
|
51
|
+
<span className={styles.bedNumber}>
|
|
52
|
+
{bedDetails &&
|
|
53
|
+
bedDetails.patient &&
|
|
54
|
+
bedDetails.patient.uuid === patientDetails.patientUuid
|
|
55
|
+
? bedDetails.patient.identifiers[0].identifier
|
|
56
|
+
: ""}
|
|
57
|
+
</span>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default BedLayout;
|