@kenyaemr/esm-bed-management-app 1.0.1-pre.7 → 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.
Files changed (175) 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.json +25 -82
  46. package/src/__mocks__/react-i18next.js +18 -14
  47. package/src/admin-card-link.component.tsx +7 -10
  48. package/src/bed-administration/bed-administration-form.component.tsx +65 -99
  49. package/src/bed-administration/bed-administration-table.component.tsx +68 -127
  50. package/src/bed-administration/bed-administration-table.scss +12 -16
  51. package/src/bed-administration/bed-administration.resource.ts +16 -18
  52. package/src/bed-administration/edit-bed-form.component.tsx +20 -31
  53. package/src/bed-administration/new-bed-form.component.tsx +28 -44
  54. package/src/{bed-admission/bed-tag → bed-tag}/bed-tag-administration-table.component.tsx +35 -60
  55. package/src/{bed-admission/bed-tag → bed-tag}/bed-tags-admin-form.component.tsx +30 -34
  56. package/src/{bed-admission/bed-tag → bed-tag}/edit-tag-form.component.tsx +17 -25
  57. package/src/{bed-admission/bed-tag → bed-tag}/new-tag-form.component.tsx +20 -27
  58. package/src/{bed-admission/bed-type → bed-type}/bed-type-admin-form.component.tsx +37 -44
  59. package/src/{bed-admission/bed-type → bed-type}/bed-type-administration-table.component.tsx +36 -60
  60. package/src/{bed-admission/bed-type → bed-type}/edit-bed-type.component.tsx +17 -25
  61. package/src/{bed-admission/bed-type → bed-type}/new-bed-type-form.component.tsx +21 -28
  62. package/src/card-header/card-header.component.tsx +20 -0
  63. package/src/card-header/card-header.scss +45 -0
  64. package/src/config-schema.ts +9 -17
  65. package/src/declarations.d.ts +5 -5
  66. package/src/empty-state/empty-state.component.tsx +6 -21
  67. package/src/empty-state/empty-state.scss +10 -10
  68. package/src/header/header.component.tsx +14 -23
  69. package/src/header/header.scss +11 -11
  70. package/src/header/illustration.component.tsx +3 -3
  71. package/src/home.component.tsx +4 -4
  72. package/src/index.ts +21 -48
  73. package/src/left-panel/left-panel.component.tsx +7 -17
  74. package/src/left-panel/left-panel.scss +8 -7
  75. package/src/left-panel-link.component.tsx +14 -24
  76. package/src/root.component.tsx +12 -12
  77. package/src/root.scss +2 -2
  78. package/src/routes.json +12 -12
  79. package/src/setup-tests.ts +1 -1
  80. package/src/summary/summary.component.tsx +16 -30
  81. package/src/summary/summary.resource.ts +116 -95
  82. package/src/summary/summary.scss +31 -29
  83. package/src/types.ts +50 -40
  84. package/src/ward-card/ward-card.component.tsx +5 -12
  85. package/src/ward-card/ward-card.scss +2 -2
  86. package/src/ward-with-beds/ward-with-beds.component.tsx +28 -47
  87. package/src/ward-with-beds/ward-with-beds.scss +5 -5
  88. package/translations/am.json +51 -0
  89. package/translations/ar.json +51 -0
  90. package/translations/en.json +48 -4
  91. package/translations/es.json +51 -0
  92. package/translations/fr.json +51 -0
  93. package/translations/he.json +51 -0
  94. package/translations/km.json +51 -0
  95. package/translations/zh.json +51 -0
  96. package/translations/zh_CN.json +51 -0
  97. package/tsconfig.json +3 -21
  98. package/webpack.config.js +1 -1
  99. package/.editorconfig +0 -12
  100. package/.eslintignore +0 -2
  101. package/.eslintrc +0 -37
  102. package/.husky/pre-commit +0 -4
  103. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  104. package/.idea/modules.xml +0 -8
  105. package/.idea/vcs.xml +0 -6
  106. package/.prettierignore +0 -14
  107. package/.turbo.json +0 -18
  108. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  109. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +0 -550
  110. package/.yarn/versions/cb9a89ac.yml +0 -0
  111. package/LICENSE +0 -373
  112. package/dist/187.js +0 -1
  113. package/dist/187.js.map +0 -1
  114. package/dist/207.js +0 -1
  115. package/dist/207.js.map +0 -1
  116. package/dist/26.js +0 -2
  117. package/dist/26.js.map +0 -1
  118. package/dist/283.js +0 -1
  119. package/dist/283.js.map +0 -1
  120. package/dist/330.js +0 -2
  121. package/dist/330.js.map +0 -1
  122. package/dist/352.js +0 -1
  123. package/dist/352.js.map +0 -1
  124. package/dist/404.js +0 -1
  125. package/dist/404.js.map +0 -1
  126. package/dist/558.js +0 -2
  127. package/dist/558.js.LICENSE.txt +0 -14
  128. package/dist/558.js.map +0 -1
  129. package/dist/629.js +0 -1
  130. package/dist/629.js.map +0 -1
  131. package/dist/707.js +0 -1
  132. package/dist/707.js.map +0 -1
  133. package/dist/800.js +0 -2
  134. package/dist/800.js.map +0 -1
  135. package/dist/850.js +0 -1
  136. package/dist/850.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/esm-kenyaemr-bed-management-app.js +0 -1
  142. package/dist/esm-kenyaemr-bed-management-app.js.map +0 -1
  143. package/i18next-parser.config.js +0 -89
  144. package/src/assets/landing-page.png +0 -0
  145. package/src/assets/logo.svg +0 -1
  146. package/src/bed-admission/active-patients/active-patients-table.component.tsx +0 -299
  147. package/src/bed-admission/active-patients/active-visits.resource.ts +0 -171
  148. package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
  149. package/src/bed-admission/active-patients/admission-action-button.component.tsx +0 -26
  150. package/src/bed-admission/active-patients/index.tsx +0 -15
  151. package/src/bed-admission/active-patients/patient-queues.resource.ts +0 -136
  152. package/src/bed-admission/active-patients/styles.scss +0 -284
  153. package/src/bed-admission/active-patients/view-action-menu.component.tsx +0 -33
  154. package/src/bed-admission/admitted-patients/active-admissions.resource.ts +0 -121
  155. package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +0 -280
  156. package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +0 -22
  157. package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +0 -55
  158. package/src/bed-admission/admitted-patients/styles.scss +0 -284
  159. package/src/bed-admission/bed-admission-tabs-styles.scss +0 -30
  160. package/src/bed-admission/bed-admission-tabs.component.tsx +0 -69
  161. package/src/bed-admission/bed-admission.component.tsx +0 -15
  162. package/src/bed-admission/bed-admission.resource.ts +0 -35
  163. package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +0 -101
  164. package/src/bed-admission/bed-layout/bed-layout.component.tsx +0 -64
  165. package/src/bed-admission/bed-layout/bed-layout.scss +0 -118
  166. package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +0 -26
  167. package/src/bed-admission/createDashboardLink.tsx +0 -47
  168. package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +0 -19
  169. package/src/bed-admission/helpers/functions.ts +0 -102
  170. package/src/bed-admission/types.ts +0 -133
  171. package/src/workspace/allocate-bed-workspace.component.tsx +0 -141
  172. package/src/workspace/allocate-bed.scss +0 -117
  173. package/src/workspace/overlay.component.tsx +0 -55
  174. package/src/workspace/overlay.scss +0 -96
  175. /package/dist/{294.js.LICENSE.txt → 784.js.LICENSE.txt} +0 -0
@@ -1,69 +0,0 @@
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;
@@ -1,15 +0,0 @@
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;
@@ -1,35 +0,0 @@
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
- }
@@ -1,101 +0,0 @@
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;
@@ -1,64 +0,0 @@
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;
@@ -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
- };