@kenyaemr/esm-bed-management-app 1.0.1-pre.4 → 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.
Files changed (177) hide show
  1. package/.turbo/turbo-build.log +36 -0
  2. package/README.md +6 -38
  3. package/dist/130.js +2 -0
  4. package/dist/{800.js.LICENSE.txt → 130.js.LICENSE.txt} +2 -0
  5. package/dist/130.js.map +1 -0
  6. package/dist/148.js +1 -0
  7. package/dist/148.js.map +1 -0
  8. package/dist/169.js +1 -0
  9. package/dist/169.js.map +1 -0
  10. package/dist/271.js +1 -0
  11. package/dist/319.js +1 -0
  12. package/dist/325.js +1 -0
  13. package/dist/325.js.map +1 -0
  14. package/dist/339.js +1 -0
  15. package/dist/339.js.map +1 -0
  16. package/dist/455.js +1 -1
  17. package/dist/455.js.LICENSE.txt +6 -0
  18. package/dist/455.js.map +1 -1
  19. package/dist/460.js +1 -0
  20. package/dist/501.js +1 -0
  21. package/dist/501.js.map +1 -0
  22. package/dist/542.js +1 -0
  23. package/dist/542.js.map +1 -0
  24. package/dist/574.js +1 -1
  25. package/dist/591.js +2 -0
  26. package/dist/{26.js.LICENSE.txt → 591.js.LICENSE.txt} +3 -3
  27. package/dist/591.js.map +1 -0
  28. package/dist/644.js +1 -0
  29. package/dist/757.js +1 -0
  30. package/dist/766.js +2 -0
  31. package/dist/{330.js.LICENSE.txt → 766.js.LICENSE.txt} +0 -9
  32. package/dist/766.js.map +1 -0
  33. package/dist/{294.js → 784.js} +2 -2
  34. package/dist/{294.js.map → 784.js.map} +1 -1
  35. package/dist/788.js +1 -0
  36. package/dist/807.js +1 -0
  37. package/dist/833.js +1 -0
  38. package/dist/main.js +1 -1
  39. package/dist/main.js.map +1 -1
  40. package/dist/openmrs-esm-bed-management-app.js +1 -0
  41. package/dist/{esm-kenyaemr-bed-management-app.js.buildmanifest.json → openmrs-esm-bed-management-app.js.buildmanifest.json} +202 -155
  42. package/dist/openmrs-esm-bed-management-app.js.map +1 -0
  43. package/dist/routes.json +1 -1
  44. package/jest.config.js +3 -0
  45. package/package-lock.json +5893 -0
  46. package/package.json +25 -83
  47. package/src/__mocks__/react-i18next.js +18 -14
  48. package/src/admin-card-link.component.tsx +7 -10
  49. package/src/bed-administration/bed-administration-form.component.tsx +65 -99
  50. package/src/bed-administration/bed-administration-table.component.tsx +68 -127
  51. package/src/bed-administration/bed-administration-table.scss +12 -16
  52. package/src/bed-administration/bed-administration-types.ts +8 -0
  53. package/src/bed-administration/bed-administration.resource.ts +16 -18
  54. package/src/bed-administration/edit-bed-form.component.tsx +20 -31
  55. package/src/bed-administration/new-bed-form.component.tsx +28 -44
  56. package/src/bed-tag/bed-tag-administration-table.component.tsx +192 -0
  57. package/src/bed-tag/bed-tags-admin-form.component.tsx +127 -0
  58. package/src/bed-tag/edit-tag-form.component.tsx +72 -0
  59. package/src/bed-tag/new-tag-form.component.tsx +76 -0
  60. package/src/bed-type/bed-type-admin-form.component.tsx +166 -0
  61. package/src/bed-type/bed-type-administration-table.component.tsx +198 -0
  62. package/src/bed-type/edit-bed-type.component.tsx +72 -0
  63. package/src/bed-type/new-bed-type-form.component.tsx +80 -0
  64. package/src/card-header/card-header.component.tsx +20 -0
  65. package/src/card-header/card-header.scss +45 -0
  66. package/src/config-schema.ts +9 -17
  67. package/src/declarations.d.ts +5 -5
  68. package/src/empty-state/empty-state.component.tsx +6 -21
  69. package/src/empty-state/empty-state.scss +10 -10
  70. package/src/header/header.component.tsx +14 -23
  71. package/src/header/header.scss +11 -11
  72. package/src/header/illustration.component.tsx +3 -3
  73. package/src/home.component.tsx +4 -4
  74. package/src/index.ts +26 -40
  75. package/src/left-panel/left-panel.component.tsx +7 -17
  76. package/src/left-panel/left-panel.scss +8 -7
  77. package/src/left-panel-link.component.tsx +14 -24
  78. package/src/root.component.tsx +14 -10
  79. package/src/root.scss +2 -2
  80. package/src/routes.json +12 -2
  81. package/src/setup-tests.ts +1 -1
  82. package/src/summary/summary.component.tsx +16 -30
  83. package/src/summary/summary.resource.ts +169 -60
  84. package/src/summary/summary.scss +31 -29
  85. package/src/types.ts +50 -29
  86. package/src/ward-card/ward-card.component.tsx +5 -12
  87. package/src/ward-card/ward-card.scss +2 -2
  88. package/src/ward-with-beds/ward-with-beds.component.tsx +28 -47
  89. package/src/ward-with-beds/ward-with-beds.scss +5 -5
  90. package/translations/am.json +51 -0
  91. package/translations/ar.json +51 -0
  92. package/translations/en.json +48 -4
  93. package/translations/es.json +51 -0
  94. package/translations/fr.json +51 -0
  95. package/translations/he.json +51 -0
  96. package/translations/km.json +51 -0
  97. package/translations/zh.json +51 -0
  98. package/translations/zh_CN.json +51 -0
  99. package/tsconfig.json +3 -21
  100. package/webpack.config.js +1 -1
  101. package/.editorconfig +0 -12
  102. package/.eslintignore +0 -2
  103. package/.eslintrc +0 -37
  104. package/.husky/pre-commit +0 -4
  105. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  106. package/.idea/modules.xml +0 -8
  107. package/.idea/vcs.xml +0 -6
  108. package/.prettierignore +0 -14
  109. package/.turbo.json +0 -18
  110. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  111. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +0 -550
  112. package/.yarn/versions/6816f0d4.yml +0 -0
  113. package/LICENSE +0 -373
  114. package/dist/187.js +0 -1
  115. package/dist/187.js.map +0 -1
  116. package/dist/207.js +0 -1
  117. package/dist/207.js.map +0 -1
  118. package/dist/26.js +0 -2
  119. package/dist/26.js.map +0 -1
  120. package/dist/283.js +0 -1
  121. package/dist/283.js.map +0 -1
  122. package/dist/330.js +0 -2
  123. package/dist/330.js.map +0 -1
  124. package/dist/352.js +0 -1
  125. package/dist/352.js.map +0 -1
  126. package/dist/404.js +0 -1
  127. package/dist/404.js.map +0 -1
  128. package/dist/558.js +0 -2
  129. package/dist/558.js.LICENSE.txt +0 -14
  130. package/dist/558.js.map +0 -1
  131. package/dist/629.js +0 -1
  132. package/dist/629.js.map +0 -1
  133. package/dist/707.js +0 -1
  134. package/dist/707.js.map +0 -1
  135. package/dist/800.js +0 -2
  136. package/dist/800.js.map +0 -1
  137. package/dist/884.js +0 -1
  138. package/dist/884.js.map +0 -1
  139. package/dist/933.js +0 -1
  140. package/dist/933.js.map +0 -1
  141. package/dist/959.js +0 -1
  142. package/dist/959.js.map +0 -1
  143. package/dist/esm-kenyaemr-bed-management-app.js +0 -1
  144. package/dist/esm-kenyaemr-bed-management-app.js.map +0 -1
  145. package/i18next-parser.config.js +0 -89
  146. package/src/assets/landing-page.png +0 -0
  147. package/src/assets/logo.svg +0 -1
  148. package/src/bed-admission/active-patients/active-patients-table.component.tsx +0 -299
  149. package/src/bed-admission/active-patients/active-visits.resource.ts +0 -171
  150. package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
  151. package/src/bed-admission/active-patients/admission-action-button.component.tsx +0 -26
  152. package/src/bed-admission/active-patients/index.tsx +0 -15
  153. package/src/bed-admission/active-patients/patient-queues.resource.ts +0 -136
  154. package/src/bed-admission/active-patients/styles.scss +0 -284
  155. package/src/bed-admission/active-patients/view-action-menu.component.tsx +0 -33
  156. package/src/bed-admission/admitted-patients/active-admissions.resource.ts +0 -121
  157. package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +0 -280
  158. package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +0 -22
  159. package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +0 -55
  160. package/src/bed-admission/admitted-patients/styles.scss +0 -284
  161. package/src/bed-admission/bed-admission-tabs-styles.scss +0 -30
  162. package/src/bed-admission/bed-admission-tabs.component.tsx +0 -69
  163. package/src/bed-admission/bed-admission.component.tsx +0 -15
  164. package/src/bed-admission/bed-admission.resource.ts +0 -35
  165. package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +0 -101
  166. package/src/bed-admission/bed-layout/bed-layout.component.tsx +0 -64
  167. package/src/bed-admission/bed-layout/bed-layout.scss +0 -118
  168. package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +0 -26
  169. package/src/bed-admission/createDashboardLink.tsx +0 -47
  170. package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +0 -19
  171. package/src/bed-admission/helpers/functions.ts +0 -102
  172. package/src/bed-admission/types.ts +0 -133
  173. package/src/workspace/allocate-bed-workspace.component.tsx +0 -141
  174. package/src/workspace/allocate-bed.scss +0 -117
  175. package/src/workspace/overlay.component.tsx +0 -55
  176. package/src/workspace/overlay.scss +0 -96
  177. /package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
@@ -1,118 +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
- .bedLayout {
7
- position: relative;
8
- margin: 20px;
9
- display: flex;
10
- align-items: center;
11
- justify-content: space-between;
12
- padding: 0 20px;
13
- border-radius: 8px;
14
- border: 1px solid #42be65;
15
-
16
- .bedPillow {
17
- background-color: #fff;
18
- border-radius: 3rem;
19
- border: 1px solid #42be65;
20
- }
21
-
22
- .bedNumber {
23
- font-weight: bold;
24
- }
25
-
26
- &:hover {
27
- cursor: pointer;
28
- }
29
- }
30
-
31
- .bedLayoutSelected {
32
- background-color: #42be65 !important;
33
- color: #fff !important;
34
- border: 5px solid #e4e1c9 !important;
35
- opacity:1 !important;
36
- }
37
-
38
- ;
39
-
40
- .bedInfoMain {
41
- display: flex;
42
- align-self: center;
43
- }
44
-
45
- .bedInfoContainer {
46
- display: flex;
47
- justify-content: flex-end;
48
- padding-right: 4rem;
49
- border-bottom: 1px solid #a8a8a8;
50
- }
51
-
52
- .bedInfoText {
53
- align-self: center;
54
- }
55
-
56
- .disabled {
57
- opacity: 0.8;
58
- pointer-events: none;
59
- }
60
-
61
- .errorContainer {
62
- width: 90%;
63
- position: absolute;
64
- }
65
-
66
- .loadingContainer {
67
- position: absolute;
68
- margin: spacing.$spacing-02 spacing.$spacing-05 0;
69
- }
70
-
71
- .bed {
72
- height: 60px;
73
- width: 8rem;
74
- }
75
-
76
- .pillow {
77
- width: 10px;
78
- height: 40px;
79
- }
80
-
81
- .available {
82
- background-color: #fff;
83
- color: #525252;
84
- opacity: 1;
85
- pointer-events: auto;
86
- }
87
-
88
- .occupied {
89
- background-color: #42be65;
90
- color: #fff;
91
- opacity: 0.5;
92
- pointer-events: none;
93
- }
94
-
95
- .minOccupied {
96
- height: 1.5rem;
97
- width: 2.5rem;
98
- color: #fff;
99
- background-color: rgb(66, 190, 101);
100
- padding: 0 6px;
101
- border-radius: 5px;
102
- pointer-events: none;
103
- }
104
-
105
- .minAvailable {
106
- height: 1.5rem;
107
- width: 2.5rem;
108
- color: none;
109
- background-color: #fff;
110
- padding: 0 6px;
111
- border-radius: 5px;
112
- pointer-events: none;
113
- }
114
-
115
- .minPillow {
116
- width: 7px;
117
- height: 1rem;
118
- }
@@ -1,26 +0,0 @@
1
- import React from "react";
2
- import styles from "./bed-layout.scss";
3
- import BedLayout from "./bed-layout.component";
4
-
5
- const MinBedLayout: React.FC = () => {
6
- return (
7
- <div className={styles.bedInfoContainer}>
8
- <div className={styles.bedInfoMain}>
9
- <BedLayout
10
- bedPillowStyles={styles.minPillow}
11
- layOutStyles={styles.minOccupied}
12
- />{" "}
13
- <span className={styles.bedInfoText}>Occupied</span>
14
- </div>
15
- <div className={styles.bedInfoMain}>
16
- <BedLayout
17
- bedPillowStyles={styles.minPillow}
18
- layOutStyles={styles.minAvailable}
19
- />{" "}
20
- <span className={styles.bedInfoText}>Available</span>
21
- </div>
22
- </div>
23
- );
24
- };
25
-
26
- export default MinBedLayout;
@@ -1,47 +0,0 @@
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()}home${name ? `/${name}` : ""}`}
33
- className={`cds--side-nav__link ${
34
- name === urlSegment && "active-left-nav-link"
35
- }`}
36
- >
37
- {title}
38
- </ConfigurableLink>
39
- );
40
- }
41
-
42
- export const createDashboardLink = (config: LinkConfig) => () =>
43
- (
44
- <BrowserRouter>
45
- <LinkExtension config={config} />
46
- </BrowserRouter>
47
- );
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import ActivePatientsTable from "../active-patients/active-patients-table.component";
3
- interface DischargedPatientsListProps {
4
- status: string;
5
- setPatientCount: (value: number) => void;
6
- }
7
-
8
- const DischargedPatientsList: React.FC<DischargedPatientsListProps> = ({
9
- status,
10
- setPatientCount,
11
- }) => {
12
- return (
13
- <>
14
- <ActivePatientsTable status={status} setPatientCount={setPatientCount} />
15
- </>
16
- );
17
- };
18
-
19
- export default DischargedPatientsList;
@@ -1,102 +0,0 @@
1
- import { OpenmrsResource } from "@openmrs/esm-framework";
2
- import last from "lodash-es/last";
3
-
4
- export type QueuePriority = "Emergency" | "Not Urgent" | "Priority" | "Urgent";
5
- export type MappedQueuePriority = Omit<QueuePriority, "Urgent">;
6
-
7
- export const getTagType = (priority: string) => {
8
- switch (priority as MappedQueuePriority) {
9
- case "Emergency":
10
- return "red";
11
- case "Not Urgent":
12
- return "green";
13
- default:
14
- return "gray";
15
- }
16
- };
17
-
18
- export const buildStatusString = (status: string) => {
19
- if (!status) {
20
- return "";
21
- }
22
- if (status === "pending") {
23
- return `${status}`;
24
- } else if (status === "picked") {
25
- return `Attending`;
26
- } else if (status === "completed") {
27
- return `Finished`;
28
- }
29
- };
30
-
31
- export const trimVisitNumber = (visitNumber: string) => {
32
- if (!visitNumber) {
33
- return;
34
- }
35
- return visitNumber.substring(15);
36
- };
37
-
38
- export const formatWaitTime = (waitTime: string, t) => {
39
- const num = parseInt(waitTime);
40
- const hours = num / 60;
41
- const rhours = Math.floor(hours);
42
- const minutes = (hours - rhours) * 60;
43
- const rminutes = Math.round(minutes);
44
- if (rhours > 0) {
45
- return (
46
- rhours +
47
- " " +
48
- `${t("hoursAnd", "hours and ")}` +
49
- rminutes +
50
- " " +
51
- `${t("minutes", "minutes")}`
52
- );
53
- } else {
54
- return rminutes + " " + `${t("minutes", "minutes")}`;
55
- }
56
- };
57
-
58
- export const getTagColor = (waitTime: string) => {
59
- const num = parseInt(waitTime);
60
- if (num <= 30) {
61
- return "green";
62
- } else if (num > 30 && num <= 45) {
63
- return "orange";
64
- } else {
65
- return "red";
66
- }
67
- };
68
-
69
- export const getGender = (gender, t) => {
70
- switch (gender) {
71
- case "M":
72
- return t("male", "Male");
73
- case "F":
74
- return t("female", "Female");
75
- case "O":
76
- return t("other", "Other");
77
- case "U":
78
- return t("unknown", "Unknown");
79
- default:
80
- return gender;
81
- }
82
- };
83
-
84
- export function findObsByConceptUUID(
85
- arr: Array<OpenmrsResource>,
86
- ids: Array<string>
87
- ) {
88
- for (const visit of arr) {
89
- return visit.obs.filter((o) => {
90
- return ids.includes(o.concept.uuid);
91
- });
92
- }
93
- }
94
-
95
- export function timeDiffInMinutes(date1: Date, date2: Date) {
96
- return Math.round((date1.getTime() - date2.getTime()) / (1000 * 3600 * 24));
97
- }
98
-
99
- export const getOriginFromPathName = (pathname = "") => {
100
- const from = pathname.split("/");
101
- return last(from);
102
- };
@@ -1,133 +0,0 @@
1
- export interface PatientQueueResponse {
2
- results: Array<PatientQueue>;
3
- }
4
-
5
- export interface PatientQueue {
6
- uuid: string;
7
- creator: {
8
- uuid: string;
9
- display: string;
10
- username: string;
11
- systemId: string;
12
- person: UuidDisplay;
13
- privileges: [];
14
- roles: Array<UuidDisplay>;
15
- retired: boolean;
16
- };
17
- dateCreated: string;
18
- changedBy?: string;
19
- dateChanged?: string;
20
- voided: boolean;
21
- dateVoided: string;
22
- voidedBy: string;
23
- patient: {
24
- uuid: string;
25
- display: string;
26
- identifiers: Array<UuidDisplay>;
27
- person: {
28
- uuid: string;
29
- display: string;
30
- gender: string;
31
- age: number;
32
- birthdate: string;
33
- birthdateEstimated: boolean;
34
- dead: boolean;
35
- deathDate?: string;
36
- causeOfDeath?: string;
37
- preferredName: UuidDisplay;
38
- preferredAddress: UuidDisplay;
39
- attributes: [];
40
- voided: boolean;
41
- birthtime?: string;
42
- deathdateEstimated: boolean;
43
- };
44
- voided: boolean;
45
- };
46
- provider: {
47
- uuid: string;
48
- display: string;
49
- person: UuidDisplay;
50
- identifier: string;
51
- attributes: [];
52
- retired: boolean;
53
- };
54
- locationFrom: QueueLocation;
55
- locationTo: QueueLocation;
56
- encounter: {
57
- uuid: string;
58
- };
59
- status: string; // TODO add status enum
60
- priority: number; // TODO add priority enum
61
- priorityComment: string;
62
- visitNumber: string;
63
- comment: string;
64
- queueRoom: QueueRoom;
65
- datePicked: string;
66
- dateCompleted: string;
67
- }
68
-
69
- export interface QueueLocation {
70
- uuid: string;
71
- display: string;
72
- name: string;
73
- description: string;
74
- address1?: string;
75
- address2?: string;
76
- cityVillage?: string;
77
- stateProvince?: string;
78
- country: string;
79
- postalCode?: string;
80
- latitude?: string;
81
- longitude?: string;
82
- countyDistrict?: string;
83
- address3?: string;
84
- address4?: string;
85
- address5?: string;
86
- address6?: string;
87
- tags: Array<UuidDisplay>;
88
- parentLocation: UuidDisplay;
89
- childLocations: Array<UuidDisplay>;
90
- retired: boolean;
91
- attributes: [];
92
- }
93
-
94
- export interface QueueRoom {
95
- uuid: string;
96
- display: string;
97
- name: string;
98
- description: string;
99
- address1?: string;
100
- address2?: string;
101
- cityVillage?: string;
102
- stateProvince?: string;
103
- country?: string;
104
- postalCode?: string;
105
- latitude?: string;
106
- longitude?: string;
107
- countyDistrict?: string;
108
- address3?: string;
109
- address4?: string;
110
- address5?: string;
111
- address6?: string;
112
- tags: Array<UuidDisplay>;
113
- parentLocation: UuidDisplay;
114
- childLocations: Array<QueueLocation>;
115
- retired: boolean;
116
- }
117
-
118
- export interface UuidDisplay {
119
- uuid: string;
120
- display: string;
121
- }
122
-
123
- export interface patientDetailsProps {
124
- name: string;
125
- patientUuid: string;
126
- encounter: {
127
- uuid: string;
128
- };
129
- locationUuid: string;
130
- locationTo: string;
131
- locationFrom: string;
132
- queueUuid: string;
133
- }
@@ -1,141 +0,0 @@
1
- import React, { useCallback, useState } from "react";
2
- import classNames from "classnames";
3
- import { Stack, ButtonSet, Button } from "@carbon/react";
4
- import { useTranslation } from "react-i18next";
5
- import {
6
- showNotification,
7
- showToast,
8
- useConfig,
9
- useLayoutType,
10
- } from "@openmrs/esm-framework";
11
- import styles from "./allocate-bed.scss";
12
- import Overlay from "./overlay.component";
13
- import {
14
- assignPatientBed,
15
- endPatientQueue,
16
- } from "../bed-admission/bed-admission.resource";
17
- import BedLayoutList from "../bed-admission/bed-layout/bed-layout-list.component";
18
- import LocationComboBox from "../bed-admission/admitted-patients/location-combo-box.component";
19
- import { Bed } from "../types";
20
-
21
- interface WorkSpaceProps {
22
- closePanel: (e: boolean) => void;
23
- headerTitle?: string;
24
- queueStatus: string;
25
- patientDetails: {
26
- name: string;
27
- patientUuid: string;
28
- locationUuid: string;
29
- locationTo: string;
30
- locationFrom: string;
31
- queueUuid: string;
32
- encounter: {
33
- uuid: string;
34
- };
35
- };
36
- }
37
-
38
- const AllocateBedWorkSpace: React.FC<WorkSpaceProps> = ({
39
- headerTitle,
40
- closePanel,
41
- patientDetails,
42
- queueStatus,
43
- }) => {
44
- const { t } = useTranslation();
45
- const isTablet = useLayoutType() === "tablet";
46
- const [selectedBed, setSelectedBed] = useState<Bed>();
47
- const [isBedAssigned, setIsBedAssigned] = useState(false);
48
- const [isQueueEnded, setIsQueueEnded] = useState(false);
49
- const { restrictWardAdministrationToLoginLocation } = useConfig();
50
- const [locationUuid, setLocation] = useState(
51
- restrictWardAdministrationToLoginLocation ? patientDetails.locationUuid : ""
52
- );
53
-
54
- const handleClick = (bed) => {
55
- setSelectedBed(bed);
56
- };
57
-
58
- const handleAssignBedToPatient = useCallback(() => {
59
- const patientAndEncounterUuids = {
60
- encounterUuid:
61
- patientDetails?.encounter?.uuid ??
62
- "84d26085-da4c-461a-8481-7c95ed3f4558",
63
- patientUuid: patientDetails.patientUuid,
64
- };
65
-
66
- assignPatientBed(patientAndEncounterUuids, selectedBed.bedId)
67
- .then(() => {
68
- setIsBedAssigned(true);
69
- showToast({
70
- title: t("bedAssigned", "Bed Assigned"),
71
- kind: "success",
72
- critical: true,
73
- description: `Bed ${selectedBed.bedNumber} was assigned to ${patientDetails.name} successfully.`,
74
- });
75
- closePanel(false);
76
- })
77
- .catch((error) => {
78
- showNotification({
79
- title: t("errorAssigningBed", "Error assigning bed"),
80
- kind: "error",
81
- critical: true,
82
- description: error?.message,
83
- });
84
- });
85
- }, [patientDetails, selectedBed, t]);
86
-
87
- return (
88
- <>
89
- <Overlay header={headerTitle} closePanel={() => closePanel(false)}>
90
- <div className={styles.container}>
91
- <Stack gap={8} className={styles.container}>
92
- <section className={styles.section}>
93
- {restrictWardAdministrationToLoginLocation ? (
94
- <LocationComboBox setLocationUuid={setLocation} />
95
- ) : (
96
- <>
97
- <LocationComboBox setLocationUuid={setLocation} />
98
- </>
99
- )}
100
- <BedLayoutList
101
- locationUuid={locationUuid}
102
- handleClick={handleClick}
103
- patientDetails={patientDetails}
104
- />{" "}
105
- </section>
106
- </Stack>
107
- </div>
108
- {selectedBed && (
109
- <span className={styles.admitPatientInfo}>
110
- {" "}
111
- {t(
112
- "admittingPatientToBedText",
113
- `Click Save button to admit patient to Bed ${selectedBed.bedNumber}`
114
- )}
115
- </span>
116
- )}
117
- <ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
118
- <Button
119
- className={styles.button}
120
- kind="secondary"
121
- onClick={closePanel}
122
- >
123
- {t("discard", "Discard")}
124
- </Button>
125
- <Button
126
- onClick={handleAssignBedToPatient}
127
- className={classNames(styles.button, {
128
- [styles.disabled]: !selectedBed,
129
- })}
130
- kind="primary"
131
- type="submit"
132
- >
133
- {t("save", "Save")}
134
- </Button>
135
- </ButtonSet>
136
- </Overlay>
137
- </>
138
- );
139
- };
140
-
141
- export default AllocateBedWorkSpace;
@@ -1,117 +0,0 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
4
-
5
- .container {
6
- // margin: spacing.$spacing-05 0rem;
7
- background-color: $ui-background;
8
- max-height: 100%;
9
-
10
-
11
- & section {
12
- margin: spacing.$spacing-09 0 0;
13
- // overflow-y: auto;
14
-
15
- }
16
-
17
- :global(.cds--text-input) {
18
- &:focus,
19
- &:hover {
20
- outline: 2px solid var(--cds-focus,#ff832b);
21
- }
22
- }
23
- }
24
-
25
- .admitPatientInfo {
26
- padding: 2rem;
27
- background-color: #fff;
28
- }
29
-
30
- .heading {
31
- @include type.type-style('heading-03');
32
- margin: spacing.$spacing-05;
33
- }
34
-
35
- .sectionTitle {
36
- @include type.type-style('heading-compact-02');
37
- color: $text-02;
38
- margin-bottom: spacing.$spacing-05;
39
- }
40
-
41
- .dateTimeSection {
42
- display: flex;
43
- }
44
-
45
- .radioButton {
46
- margin: spacing.$spacing-05 0;
47
- }
48
-
49
- .headerGridRow {
50
- border-bottom: 0.0625rem solid $grey-2;
51
- margin: 0;
52
- }
53
-
54
- .dataGridRow {
55
- display: grid;
56
- grid-template-columns: 50% 10% 1fr;
57
- margin: spacing.$spacing-03 spacing.$spacing-05;
58
- width: 100%;
59
- }
60
-
61
- .form {
62
- background-color: $ui-background;
63
- display: flex;
64
- flex-direction: column;
65
- justify-content: space-between;
66
- }
67
-
68
- .button {
69
- height: 4rem;
70
- display: flex;
71
- align-content: flex-start;
72
- align-items: baseline;
73
- min-width: 50%;
74
- }
75
-
76
- .tablet {
77
- padding: spacing.$spacing-06 spacing.$spacing-05;
78
- background-color: $ui-02;
79
- }
80
-
81
- .desktop {
82
- padding: 0rem;
83
- }
84
-
85
- @media screen and (max-width: 600px) {
86
- .dateTimeSection {
87
- flex-direction: column;
88
- }
89
- }
90
-
91
- .backButton {
92
- align-items: center;
93
- display: flex;
94
- justify-content: flex-start;
95
- margin: spacing.$spacing-03 0;
96
- padding: 0;
97
- @include type.type-style('body-compact-01');
98
-
99
- button {
100
- display: flex;
101
-
102
- svg {
103
- order: 1;
104
- margin-right: spacing.$spacing-03;
105
- margin-left: 0rem !important;
106
- }
107
-
108
- span {
109
- order: 2;
110
- }
111
- }
112
- }
113
-
114
- .disabled {
115
- opacity: 0.8;
116
- pointer-events: none;
117
- }