@kenyaemr/esm-bed-management-app 1.0.1-pre.4 → 8.1.1-pre.116
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.json +25 -82
- 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-types.ts +8 -0
- 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-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 +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 +26 -40
- 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 +14 -10
- package/src/root.scss +2 -2
- package/src/routes.json +12 -2
- package/src/setup-tests.ts +1 -1
- package/src/summary/summary.component.tsx +16 -30
- package/src/summary/summary.resource.ts +169 -60
- package/src/summary/summary.scss +31 -29
- package/src/types.ts +50 -29
- 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/6816f0d4.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/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/959.js +0 -1
- package/dist/959.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,284 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Button, Tooltip } from "@carbon/react";
|
|
2
|
-
import { Dashboard } from "@carbon/react/icons";
|
|
3
|
-
import React, { AnchorHTMLAttributes } from "react";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { interpolateUrl, navigate } from "@openmrs/esm-framework";
|
|
6
|
-
|
|
7
|
-
interface NameLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
8
|
-
to: string;
|
|
9
|
-
from: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const ViewActionsMenu: React.FC<NameLinkProps> = ({ from, to }) => {
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
|
|
15
|
-
const handleNameClick = (event: MouseEvent, to: string) => {
|
|
16
|
-
event.preventDefault();
|
|
17
|
-
navigate({ to });
|
|
18
|
-
localStorage.setItem("fromPage", from);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Tooltip align="bottom" label="View Patient">
|
|
23
|
-
<Button
|
|
24
|
-
kind="ghost"
|
|
25
|
-
onClick={(e) => handleNameClick(e, to)}
|
|
26
|
-
href={interpolateUrl(to)}
|
|
27
|
-
iconDescription={t("viewPatient", "View Patient")}
|
|
28
|
-
renderIcon={(props) => <Dashboard size={16} {...props} />}
|
|
29
|
-
/>
|
|
30
|
-
</Tooltip>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
export default ViewActionsMenu;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import useSWRInfinite from "swr/infinite";
|
|
3
|
-
import dayjs from "dayjs";
|
|
4
|
-
import isToday from "dayjs/plugin/isToday";
|
|
5
|
-
import last from "lodash-es/last";
|
|
6
|
-
import {
|
|
7
|
-
openmrsFetch,
|
|
8
|
-
useSession,
|
|
9
|
-
type FetchResponse,
|
|
10
|
-
} from "@openmrs/esm-framework";
|
|
11
|
-
import { AdmissionLocation } from "../../types";
|
|
12
|
-
|
|
13
|
-
dayjs.extend(isToday);
|
|
14
|
-
|
|
15
|
-
interface VisitResponse {
|
|
16
|
-
results: Array<AdmissionLocation>;
|
|
17
|
-
links: Array<{ rel: "prev" | "next" }>;
|
|
18
|
-
totalCount: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface BedPatientAssignment {
|
|
22
|
-
patientUuid: string;
|
|
23
|
-
age: number;
|
|
24
|
-
gender: string;
|
|
25
|
-
patientName: string;
|
|
26
|
-
ward: string;
|
|
27
|
-
bedNumber: string;
|
|
28
|
-
}
|
|
29
|
-
export function useActiveAdmissions() {
|
|
30
|
-
const session = useSession();
|
|
31
|
-
const sessionLocation = session?.sessionLocation?.uuid;
|
|
32
|
-
|
|
33
|
-
const getUrl = (
|
|
34
|
-
pageIndex,
|
|
35
|
-
previousPageData: FetchResponse<VisitResponse>
|
|
36
|
-
) => {
|
|
37
|
-
if (
|
|
38
|
-
pageIndex &&
|
|
39
|
-
!previousPageData?.data?.links?.some((link) => link.rel === "next")
|
|
40
|
-
) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const url = `/ws/rest/v1/admissionLocation?v=full`;
|
|
45
|
-
const urlSearchParams = new URLSearchParams();
|
|
46
|
-
|
|
47
|
-
if (pageIndex) {
|
|
48
|
-
urlSearchParams.append("startIndex", `${pageIndex * 50}`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return url + urlSearchParams.toString();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
data,
|
|
56
|
-
error,
|
|
57
|
-
isLoading,
|
|
58
|
-
isValidating,
|
|
59
|
-
size: pageNumber,
|
|
60
|
-
setSize,
|
|
61
|
-
mutate,
|
|
62
|
-
} = useSWRInfinite<FetchResponse<VisitResponse>, Error>(
|
|
63
|
-
sessionLocation ? getUrl : null,
|
|
64
|
-
openmrsFetch
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (
|
|
69
|
-
data &&
|
|
70
|
-
data?.[pageNumber - 1]?.data?.links?.some((link) => link.rel === "next")
|
|
71
|
-
) {
|
|
72
|
-
setSize((currentSize) => currentSize + 1);
|
|
73
|
-
}
|
|
74
|
-
}, [data, pageNumber]);
|
|
75
|
-
|
|
76
|
-
const formattedActiveVisits: any = (data: FetchResponse<VisitResponse>) => {
|
|
77
|
-
const result = data
|
|
78
|
-
? data[0].data?.results?.map((wardEntry) => {
|
|
79
|
-
return wardEntry.bedLayouts;
|
|
80
|
-
})
|
|
81
|
-
: [];
|
|
82
|
-
|
|
83
|
-
const allBeds = [];
|
|
84
|
-
|
|
85
|
-
result?.forEach((elemnt) => {
|
|
86
|
-
elemnt.forEach((b) => {
|
|
87
|
-
allBeds.push(b);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
const finalFinalList = allBeds
|
|
91
|
-
?.filter((b) => b.status === "OCCUPIED")
|
|
92
|
-
.map((bedEntry) => {
|
|
93
|
-
const patient: BedPatientAssignment = {
|
|
94
|
-
patientUuid: bedEntry.patient.uuid,
|
|
95
|
-
age: bedEntry.patient.person.age,
|
|
96
|
-
gender: bedEntry.patient.person.gender,
|
|
97
|
-
patientName: bedEntry.patient.person.preferredName.givenName
|
|
98
|
-
.concat(" ")
|
|
99
|
-
.concat(bedEntry.patient.person.preferredName.familyName),
|
|
100
|
-
ward: bedEntry.location,
|
|
101
|
-
bedNumber: bedEntry.bedNumber,
|
|
102
|
-
};
|
|
103
|
-
return patient;
|
|
104
|
-
});
|
|
105
|
-
return finalFinalList;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
patientQueueEntries: formattedActiveVisits(data),
|
|
110
|
-
isError: error,
|
|
111
|
-
isLoading,
|
|
112
|
-
isValidating,
|
|
113
|
-
patientQueueCount: data?.[0]?.data?.totalCount ?? 0,
|
|
114
|
-
mutate,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const getOriginFromPathName = (pathname = "") => {
|
|
119
|
-
const from = pathname.split("/");
|
|
120
|
-
return last(from);
|
|
121
|
-
};
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataTable,
|
|
3
|
-
DataTableSkeleton,
|
|
4
|
-
DefinitionTooltip,
|
|
5
|
-
Pagination,
|
|
6
|
-
Table,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
TableContainer,
|
|
10
|
-
TableHead,
|
|
11
|
-
TableHeader,
|
|
12
|
-
TableRow,
|
|
13
|
-
Tag,
|
|
14
|
-
Layer,
|
|
15
|
-
TableToolbar,
|
|
16
|
-
TableToolbarContent,
|
|
17
|
-
TableToolbarSearch,
|
|
18
|
-
TableExpandedRow,
|
|
19
|
-
TableExpandHeader,
|
|
20
|
-
TableExpandRow,
|
|
21
|
-
} from "@carbon/react";
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
isDesktop,
|
|
25
|
-
useConfig,
|
|
26
|
-
useLayoutType,
|
|
27
|
-
usePagination,
|
|
28
|
-
useSession,
|
|
29
|
-
} from "@openmrs/esm-framework";
|
|
30
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
31
|
-
import { useTranslation } from "react-i18next";
|
|
32
|
-
import { getOriginFromPathName } from "../helpers/functions";
|
|
33
|
-
import styles from "../active-patients/styles.scss";
|
|
34
|
-
import { useActiveAdmissions } from "./active-admissions.resource";
|
|
35
|
-
import EmptyState from "../../empty-state/empty-state.component";
|
|
36
|
-
import { patientDetailsProps } from "../types";
|
|
37
|
-
|
|
38
|
-
interface ActiveVisitsTableProps {
|
|
39
|
-
status: string;
|
|
40
|
-
setPatientCount?: (value: number) => void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const AdmittedPatientsTable: React.FC<ActiveVisitsTableProps> = ({
|
|
44
|
-
status,
|
|
45
|
-
setPatientCount,
|
|
46
|
-
}) => {
|
|
47
|
-
const { t } = useTranslation();
|
|
48
|
-
const session = useSession();
|
|
49
|
-
const currentPathName: string = window.location.pathname;
|
|
50
|
-
const fromPage: string = getOriginFromPathName(currentPathName);
|
|
51
|
-
const pageSizes = [10, 20, 30, 40, 50];
|
|
52
|
-
const [currentPageSize, setPageSize] = useState(10);
|
|
53
|
-
const [showOverlay, setShowOverlay] = useState(false);
|
|
54
|
-
const [selectedPatientDetails, setSelectedPatientDetails] =
|
|
55
|
-
useState<patientDetailsProps>();
|
|
56
|
-
|
|
57
|
-
const layout = useLayoutType();
|
|
58
|
-
|
|
59
|
-
const { patientQueueEntries, isLoading } = useActiveAdmissions();
|
|
60
|
-
const { restrictWardAdministrationToLoginLocation } = useConfig();
|
|
61
|
-
|
|
62
|
-
const handleBedAssigmentModal = useCallback(
|
|
63
|
-
(entry) => {
|
|
64
|
-
setSelectedPatientDetails({
|
|
65
|
-
name: entry.name,
|
|
66
|
-
patientUuid: entry.patientUuid,
|
|
67
|
-
encounter: entry.encounter,
|
|
68
|
-
locationUuid: session?.sessionLocation?.uuid,
|
|
69
|
-
locationTo: entry.locationTo,
|
|
70
|
-
locationFrom: entry.locationFrom,
|
|
71
|
-
queueUuid: entry.uuid,
|
|
72
|
-
});
|
|
73
|
-
setShowOverlay(true);
|
|
74
|
-
},
|
|
75
|
-
[session?.sessionLocation?.uuid]
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const renderActionButton = useCallback(
|
|
79
|
-
(entry) => {
|
|
80
|
-
const buttonTexts = {
|
|
81
|
-
pending: "Assign Bed",
|
|
82
|
-
completed: "Transfer",
|
|
83
|
-
};
|
|
84
|
-
const buttonText = buttonTexts[status] || "Un-assign";
|
|
85
|
-
|
|
86
|
-
// return (
|
|
87
|
-
// <AdmissionActionButton
|
|
88
|
-
// entry={entry}
|
|
89
|
-
// handleBedAssigmentModal={handleBedAssigmentModal}
|
|
90
|
-
// buttonText={buttonText}
|
|
91
|
-
// />
|
|
92
|
-
// );
|
|
93
|
-
},
|
|
94
|
-
[handleBedAssigmentModal, status]
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const {
|
|
98
|
-
goTo,
|
|
99
|
-
results: paginatedQueueEntries,
|
|
100
|
-
currentPage,
|
|
101
|
-
} = usePagination(patientQueueEntries, currentPageSize);
|
|
102
|
-
|
|
103
|
-
const tableHeaders = useMemo(
|
|
104
|
-
() => [
|
|
105
|
-
{
|
|
106
|
-
id: 0,
|
|
107
|
-
header: t("name", "Name"),
|
|
108
|
-
key: "patientName",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: 1,
|
|
112
|
-
header: t("age", "Age"),
|
|
113
|
-
key: "age",
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 2,
|
|
117
|
-
header: t("gender", "Gender"),
|
|
118
|
-
key: "gender",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
id: 3,
|
|
122
|
-
header: t("ward", "Ward"),
|
|
123
|
-
key: "ward",
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: 4,
|
|
127
|
-
header: t("bedNumber", "Bed Number"),
|
|
128
|
-
key: "bedNumber",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
id: 5,
|
|
132
|
-
header: t("actions", "Action"),
|
|
133
|
-
key: "actions",
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
[t]
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
const tableRows = useMemo(() => {
|
|
140
|
-
return paginatedQueueEntries?.map((entry: any, index) => ({
|
|
141
|
-
...(entry as object),
|
|
142
|
-
id: `${entry?.patientUuid}`,
|
|
143
|
-
actions: {
|
|
144
|
-
content: (
|
|
145
|
-
<div className={styles.displayFlex}>
|
|
146
|
-
{/* {renderActionButton(entry)} */}
|
|
147
|
-
</div>
|
|
148
|
-
),
|
|
149
|
-
},
|
|
150
|
-
}));
|
|
151
|
-
}, [paginatedQueueEntries, status, t, renderActionButton, fromPage]);
|
|
152
|
-
|
|
153
|
-
if (isLoading) {
|
|
154
|
-
return <DataTableSkeleton role="progressbar" />;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
(!isLoading && patientQueueEntries && status === "pending") ||
|
|
159
|
-
status === "completed" ||
|
|
160
|
-
status === ""
|
|
161
|
-
) {
|
|
162
|
-
setPatientCount(patientQueueEntries.length);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (patientQueueEntries?.length) {
|
|
166
|
-
return (
|
|
167
|
-
<div className={styles.container}>
|
|
168
|
-
<div className={styles.headerBtnContainer}></div>
|
|
169
|
-
|
|
170
|
-
<DataTable
|
|
171
|
-
data-floating-menu-container
|
|
172
|
-
headers={tableHeaders}
|
|
173
|
-
overflowMenuOnHover={isDesktop(layout) ? true : false}
|
|
174
|
-
rows={tableRows}
|
|
175
|
-
isSortable
|
|
176
|
-
size="xs"
|
|
177
|
-
useZebraStyles
|
|
178
|
-
>
|
|
179
|
-
{({ rows, headers, getTableProps, getRowProps, onInputChange }) => (
|
|
180
|
-
<TableContainer className={styles.tableContainer}>
|
|
181
|
-
<TableToolbar
|
|
182
|
-
style={{
|
|
183
|
-
position: "static",
|
|
184
|
-
height: "3rem",
|
|
185
|
-
overflow: "visible",
|
|
186
|
-
backgroundColor: "color",
|
|
187
|
-
}}
|
|
188
|
-
>
|
|
189
|
-
<TableToolbarContent className={styles.toolbarContent}>
|
|
190
|
-
<Layer>
|
|
191
|
-
<TableToolbarSearch
|
|
192
|
-
className={styles.search}
|
|
193
|
-
onChange={onInputChange}
|
|
194
|
-
placeholder={t("searchThisList", "Search this list")}
|
|
195
|
-
size="sm"
|
|
196
|
-
/>
|
|
197
|
-
</Layer>
|
|
198
|
-
</TableToolbarContent>
|
|
199
|
-
</TableToolbar>
|
|
200
|
-
<Table {...getTableProps()} className={styles.activeVisitsTable}>
|
|
201
|
-
<TableHead>
|
|
202
|
-
<TableRow>
|
|
203
|
-
<TableExpandHeader />
|
|
204
|
-
{headers.map((header) => (
|
|
205
|
-
<TableHeader>
|
|
206
|
-
{header.header?.content ?? header.header}
|
|
207
|
-
</TableHeader>
|
|
208
|
-
))}
|
|
209
|
-
</TableRow>
|
|
210
|
-
</TableHead>
|
|
211
|
-
<TableBody>
|
|
212
|
-
{rows.map((row, index) => {
|
|
213
|
-
return (
|
|
214
|
-
<>
|
|
215
|
-
<TableExpandRow {...getRowProps({ row })} key={row.id}>
|
|
216
|
-
{row.cells.map((cell) => (
|
|
217
|
-
<TableCell key={cell.id}>
|
|
218
|
-
{cell.value?.content ?? cell.value}
|
|
219
|
-
</TableCell>
|
|
220
|
-
))}
|
|
221
|
-
</TableExpandRow>
|
|
222
|
-
|
|
223
|
-
{row.isExpanded ? (
|
|
224
|
-
<TableExpandedRow
|
|
225
|
-
className={styles.expandedLabQueueVisitRow}
|
|
226
|
-
colSpan={headers.length + 2}
|
|
227
|
-
></TableExpandedRow>
|
|
228
|
-
) : (
|
|
229
|
-
<TableExpandedRow
|
|
230
|
-
className={styles.hiddenRow}
|
|
231
|
-
colSpan={headers.length + 2}
|
|
232
|
-
/>
|
|
233
|
-
)}
|
|
234
|
-
</>
|
|
235
|
-
);
|
|
236
|
-
})}
|
|
237
|
-
</TableBody>
|
|
238
|
-
</Table>
|
|
239
|
-
<Pagination
|
|
240
|
-
forwardText="Next page"
|
|
241
|
-
backwardText="Previous page"
|
|
242
|
-
page={currentPage}
|
|
243
|
-
pageSize={currentPageSize}
|
|
244
|
-
pageSizes={pageSizes}
|
|
245
|
-
totalItems={patientQueueEntries?.length}
|
|
246
|
-
className={styles.pagination}
|
|
247
|
-
onChange={({ pageSize, page }) => {
|
|
248
|
-
if (pageSize !== currentPageSize) {
|
|
249
|
-
setPageSize(pageSize);
|
|
250
|
-
}
|
|
251
|
-
if (page !== currentPage) {
|
|
252
|
-
goTo(page);
|
|
253
|
-
}
|
|
254
|
-
}}
|
|
255
|
-
/>
|
|
256
|
-
</TableContainer>
|
|
257
|
-
)}
|
|
258
|
-
</DataTable>
|
|
259
|
-
{/* {showOverlay && (
|
|
260
|
-
<AssignBedWorkSpace
|
|
261
|
-
patientDetails={selectedPatientDetails}
|
|
262
|
-
closePanel={() => setShowOverlay(false)}
|
|
263
|
-
queueStatus={status}
|
|
264
|
-
headerTitle={t(
|
|
265
|
-
"assignBedToPatient",
|
|
266
|
-
restrictWardAdministrationToLoginLocation === true
|
|
267
|
-
? `Assign Bed to Patient ${selectedPatientDetails.name} in the ${session?.sessionLocation?.display} Ward`
|
|
268
|
-
: `Assign Bed to Patient ${selectedPatientDetails.name}`
|
|
269
|
-
)}
|
|
270
|
-
/>
|
|
271
|
-
)} */}
|
|
272
|
-
</div>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return (
|
|
277
|
-
<EmptyState msg={t("noQueueItems", "No admissions to display")} helper="" />
|
|
278
|
-
);
|
|
279
|
-
};
|
|
280
|
-
export default AdmittedPatientsTable;
|