@kenyaemr/esm-bed-management-app 1.0.1-pre.7 → 8.1.1-pre.118

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,5 +1,5 @@
1
- import React, { useEffect, useMemo, useState } from "react";
2
- import { useTranslation } from "react-i18next";
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
3
  import {
4
4
  Button,
5
5
  DataTable,
@@ -14,27 +14,23 @@ import {
14
14
  TableHeader,
15
15
  TableRow,
16
16
  Tile,
17
- } from "@carbon/react";
18
- import { Add, Edit } from "@carbon/react/icons";
19
- import {
20
- isDesktop as desktopLayout,
21
- useConfig,
22
- useLayoutType,
23
- } from "@openmrs/esm-framework";
24
- import { CardHeader, ErrorState } from "@openmrs/esm-patient-common-lib";
25
- import type { BedTypeData } from "../../types";
26
- import { useBedType } from "../../summary/summary.resource";
27
- import Header from "../../header/header.component";
28
- import BedTypeForm from "./new-bed-type-form.component";
29
- import styles from "../../bed-administration/bed-administration-table.scss";
30
- import EditBedTypeForm from "./edit-bed-type.component";
17
+ } from '@carbon/react';
18
+ import { Add, Edit } from '@carbon/react/icons';
19
+ import { ErrorState, isDesktop as desktopLayout, useLayoutType } from '@openmrs/esm-framework';
20
+ import type { BedTypeData } from '../types';
21
+ import { useBedType } from '../summary/summary.resource';
22
+ import Header from '../header/header.component';
23
+ import BedTypeForm from './new-bed-type-form.component';
24
+ import styles from '../bed-administration/bed-administration-table.scss';
25
+ import { CardHeader } from '../card-header/card-header.component';
26
+ import EditBedTypeForm from './edit-bed-type.component';
31
27
 
32
28
  const BedTypeAdministrationTable: React.FC = () => {
33
29
  const { t } = useTranslation();
34
- const headerTitle = t("bedType", "Bed Type");
30
+ const headerTitle = t('bedType', 'Bed Type');
35
31
  const layout = useLayoutType();
36
- const isTablet = layout === "tablet";
37
- const responsiveSize = isTablet ? "lg" : "sm";
32
+ const isTablet = layout === 'tablet';
33
+ const responsiveSize = isTablet ? 'lg' : 'sm';
38
34
  const isDesktop = desktopLayout(layout);
39
35
  const [showEditBedModal, setShowEditBedModal] = useState(false);
40
36
  const [isBedDataLoading, setIsBedDataLoading] = useState(false);
@@ -47,20 +43,20 @@ const BedTypeAdministrationTable: React.FC = () => {
47
43
  const pageSizes = [10, 20, 30, 40, 50];
48
44
  const tableHeaders = [
49
45
  {
50
- header: t("name", "Name"),
51
- key: "name",
46
+ header: t('name', 'Name'),
47
+ key: 'name',
52
48
  },
53
49
  {
54
- header: t("displayName", "Display Name"),
55
- key: "displayName",
50
+ header: t('displayName', 'Display Name'),
51
+ key: 'displayName',
56
52
  },
57
53
  {
58
- header: t("description", "Description"),
59
- key: "description",
54
+ header: t('description', 'Description'),
55
+ key: 'description',
60
56
  },
61
57
  {
62
- key: "actions",
63
- header: t("actions", "Actions"),
58
+ key: 'actions',
59
+ header: t('actions', 'Actions'),
64
60
  },
65
61
  ];
66
62
 
@@ -81,8 +77,8 @@ const BedTypeAdministrationTable: React.FC = () => {
81
77
  setShowEditBedModal(true);
82
78
  setAddBedTypeModal(false);
83
79
  }}
84
- kind={"ghost"}
85
- iconDescription={t("editBedType", "Edit Bed Type")}
80
+ kind={'ghost'}
81
+ iconDescription={t('editBedType', 'Edit Bed Type')}
86
82
  hasIconOnly
87
83
  size={responsiveSize}
88
84
  tooltipAlignment="start"
@@ -120,11 +116,7 @@ const BedTypeAdministrationTable: React.FC = () => {
120
116
 
121
117
  <div className={styles.widgetCard}>
122
118
  {showBedTypeModal ? (
123
- <BedTypeForm
124
- onModalChange={setAddBedTypeModal}
125
- showModal={showBedTypeModal}
126
- mutate={mutate}
127
- />
119
+ <BedTypeForm onModalChange={setAddBedTypeModal} showModal={showBedTypeModal} mutate={mutate} />
128
120
  ) : null}
129
121
  {showEditBedModal ? (
130
122
  <EditBedTypeForm
@@ -142,28 +134,19 @@ const BedTypeAdministrationTable: React.FC = () => {
142
134
  <Button
143
135
  kind="ghost"
144
136
  renderIcon={(props) => <Add size={16} {...props} />}
145
- onClick={() => setAddBedTypeModal(true)}
146
- >
147
- {t("addBedtype", "Add Bed Type")}
137
+ onClick={() => setAddBedTypeModal(true)}>
138
+ {t('addBedtype', 'Add Bed Type')}
148
139
  </Button>
149
140
  ) : null}
150
141
  </CardHeader>
151
- <DataTable
152
- rows={tableRows}
153
- headers={tableHeaders}
154
- isSortable
155
- size={isTablet ? "lg" : "sm"}
156
- useZebraStyles
157
- >
142
+ <DataTable rows={tableRows} headers={tableHeaders} isSortable size={isTablet ? 'lg' : 'sm'} useZebraStyles>
158
143
  {({ rows, headers, getTableProps }) => (
159
144
  <TableContainer>
160
145
  <Table {...getTableProps()}>
161
146
  <TableHead>
162
147
  <TableRow>
163
148
  {headers.map((header) => (
164
- <TableHeader>
165
- {header.header?.content ?? header.header}
166
- </TableHeader>
149
+ <TableHeader>{header.header?.content ?? header.header}</TableHeader>
167
150
  ))}
168
151
  </TableRow>
169
152
  </TableHead>
@@ -171,9 +154,7 @@ const BedTypeAdministrationTable: React.FC = () => {
171
154
  {rows.map((row) => (
172
155
  <TableRow key={row.id}>
173
156
  {row.cells.map((cell) => (
174
- <TableCell key={cell.id}>
175
- {cell.value?.content ?? cell.value}
176
- </TableCell>
157
+ <TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
177
158
  ))}
178
159
  </TableRow>
179
160
  ))}
@@ -183,21 +164,16 @@ const BedTypeAdministrationTable: React.FC = () => {
183
164
  <div className={styles.tileContainer}>
184
165
  <Tile className={styles.tile}>
185
166
  <div className={styles.tileContent}>
186
- <p className={styles.content}>
187
- {t("No data", "No data to display")}
188
- </p>
189
- <p className={styles.helper}>
190
- {t("checkFilters", "Check the filters above")}
191
- </p>
167
+ <p className={styles.content}>{t('No data', 'No data to display')}</p>
168
+ <p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
192
169
  </div>
193
- <p className={styles.separator}>{t("or", "or")}</p>
170
+ <p className={styles.separator}>{t('or', 'or')}</p>
194
171
  <Button
195
172
  kind="ghost"
196
173
  size="sm"
197
174
  renderIcon={(props) => <Add size={16} {...props} />}
198
- onClick={() => setAddBedTypeModal(true)}
199
- >
200
- {t("bedType", "Add Bed Type")}
175
+ onClick={() => setAddBedTypeModal(true)}>
176
+ {t('bedType', 'Add Bed Type')}
201
177
  </Button>
202
178
  </Tile>
203
179
  </div>
@@ -1,11 +1,11 @@
1
- import React, { useCallback } from "react";
2
- import { useTranslation } from "react-i18next";
3
- import { showToast, showNotification, useConfig } from "@openmrs/esm-framework";
1
+ import React, { useCallback } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { showToast, showNotification, useConfig } from '@openmrs/esm-framework';
4
4
 
5
- import { editBedType, useBedType } from "../../summary/summary.resource";
6
- import { BedTypeDataAdministration } from "../../bed-administration/bed-administration-types";
7
- import { BedTypeData, Mutator } from "../../types";
8
- import BedTypeAdministrationForm from "./bed-type-admin-form.component";
5
+ import { editBedType, useBedType } from '../summary/summary.resource';
6
+ import { type BedTypeDataAdministration } from '../bed-administration/bed-administration-types';
7
+ import { type BedTypeData, type Mutator } from '../types';
8
+ import BedTypeAdministrationForm from './bed-type-admin-form.component';
9
9
 
10
10
  interface EditBedTypeFormProps {
11
11
  showModal: boolean;
@@ -14,35 +14,27 @@ interface EditBedTypeFormProps {
14
14
  mutate: Mutator;
15
15
  }
16
16
 
17
- const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
18
- showModal,
19
- onModalChange,
20
- editData,
21
- mutate,
22
- }) => {
17
+ const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({ showModal, onModalChange, editData, mutate }) => {
23
18
  const { t } = useTranslation();
24
- const headerTitle = t("editBedType", "Edit Bed Type");
19
+ const headerTitle = t('editBedType', 'Edit Bed Type');
25
20
  const { bedTypeData } = useBedType();
26
21
  const availableBedTypes = bedTypeData ? bedTypeData : [];
27
22
  const handleCreateQuestion = useCallback(
28
23
  (formData: BedTypeDataAdministration) => {
29
24
  const bedUuid = editData.uuid;
30
25
  const { name, displayName, description } = formData;
31
- const bedPayload = {
26
+ const bedTypePayload = {
32
27
  name,
33
28
  displayName,
34
29
  description,
35
30
  };
36
- editBedType({ bedPayload, bedTypeId: bedUuid })
31
+ editBedType({ bedTypePayload, bedTypeId: bedUuid })
37
32
  .then(() => {
38
33
  showToast({
39
- title: t("formSaved", "Bed Type"),
40
- kind: "success",
34
+ title: t('formSaved', 'Bed Type'),
35
+ kind: 'success',
41
36
  critical: true,
42
- description:
43
- bedPayload.name +
44
- " " +
45
- t("saveSuccessMessage", "was saved successfully."),
37
+ description: bedTypePayload.name + ' ' + t('saveSuccessMessage', 'was saved successfully.'),
46
38
  });
47
39
 
48
40
  mutate();
@@ -50,8 +42,8 @@ const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
50
42
  })
51
43
  .catch((error) => {
52
44
  showNotification({
53
- title: t("errorCreatingForm", "Error creating bed"),
54
- kind: "error",
45
+ title: t('errorCreatingForm', 'Error creating bed'),
46
+ kind: 'error',
55
47
  critical: true,
56
48
  description: error?.message,
57
49
  });
@@ -59,7 +51,7 @@ const EditBedTypeForm: React.FC<EditBedTypeFormProps> = ({
59
51
  });
60
52
  onModalChange(false);
61
53
  },
62
- [onModalChange, mutate, editData, t]
54
+ [onModalChange, mutate, editData, t],
63
55
  );
64
56
 
65
57
  return (
@@ -1,10 +1,10 @@
1
- import React, { useCallback } from "react";
2
- import { useTranslation } from "react-i18next";
3
- import { showToast, showNotification, useConfig } from "@openmrs/esm-framework";
4
- import type { BedTypeData, Mutator } from "../../types";
5
- import { useBedType } from "../../bed-administration/bed-administration.resource";
6
- import { saveBedType, useLocationsByTag } from "../../summary/summary.resource";
7
- import BedTypeAdministrationForm from "./bed-type-admin-form.component";
1
+ import React, { useCallback } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { showToast, showNotification, useConfig } from '@openmrs/esm-framework';
4
+ import type { BedTypeData, Mutator } from '../types';
5
+ import { useBedType } from '../bed-administration/bed-administration.resource';
6
+ import { saveBedType, useLocationsWithAdmissionTag } from '../summary/summary.resource';
7
+ import BedTypeAdministrationForm from './bed-type-admin-form.component';
8
8
 
9
9
  interface BedTypeFormProps {
10
10
  showModal: boolean;
@@ -12,42 +12,35 @@ interface BedTypeFormProps {
12
12
  mutate: Mutator;
13
13
  }
14
14
 
15
- const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
16
- showModal,
17
- onModalChange,
18
- mutate,
19
- }) => {
15
+ const NewBedTypeForm: React.FC<BedTypeFormProps> = ({ showModal, onModalChange, mutate }) => {
20
16
  const { t } = useTranslation();
21
- const { admissionLocationTagUuid } = useConfig();
22
- const { data: admissionLocations } = useLocationsByTag(
23
- admissionLocationTagUuid
24
- );
25
- const headerTitle = t("addBedType", "Create Bed type");
17
+ const { data: admissionLocations } = useLocationsWithAdmissionTag();
18
+ const headerTitle = t('addBedType', 'Create Bed type');
26
19
  const { bedTypes } = useBedType();
27
20
  const availableBedTypes = bedTypes ? bedTypes : [];
28
21
 
29
22
  const initialData: BedTypeData = {
30
- uuid: "",
31
- name: "",
32
- displayName: "",
33
- description: "",
23
+ uuid: '',
24
+ name: '',
25
+ displayName: '',
26
+ description: '',
34
27
  };
35
28
 
36
29
  const handleCreateQuestion = useCallback(
37
30
  (formData: BedTypeData) => {
38
31
  const { name, displayName, description } = formData;
39
32
 
40
- const bedObject = {
33
+ const bedTypePayload = {
41
34
  name,
42
35
  displayName,
43
36
  description,
44
37
  };
45
38
 
46
- saveBedType({ bedPayload: bedObject })
39
+ saveBedType({ bedTypePayload })
47
40
  .then(() => {
48
41
  showToast({
49
- title: t("formCreated", "Add bed Type"),
50
- kind: "success",
42
+ title: t('formCreated', 'Add bed Type'),
43
+ kind: 'success',
51
44
  critical: true,
52
45
  description: `Bed ${name} was created successfully.`,
53
46
  });
@@ -57,8 +50,8 @@ const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
57
50
  })
58
51
  .catch((error) => {
59
52
  showNotification({
60
- title: t("errorCreatingForm", "Error creating bed"),
61
- kind: "error",
53
+ title: t('errorCreatingForm', 'Error creating bed'),
54
+ kind: 'error',
62
55
  critical: true,
63
56
  description: error?.message,
64
57
  });
@@ -66,7 +59,7 @@ const NewBedTypeForm: React.FC<BedTypeFormProps> = ({
66
59
  });
67
60
  onModalChange(false);
68
61
  },
69
- [onModalChange, mutate, t]
62
+ [onModalChange, mutate, t],
70
63
  );
71
64
 
72
65
  return (
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import { useLayoutType } from '@openmrs/esm-framework';
4
+ import styles from './card-header.scss';
5
+
6
+ interface CardHeaderProps {
7
+ title: string;
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ export function CardHeader({ title, children }: CardHeaderProps) {
12
+ const isTablet = useLayoutType() === 'tablet';
13
+
14
+ return (
15
+ <div className={classNames(isTablet ? styles.tabletHeader : styles.desktopHeader)}>
16
+ <h4>{title}</h4>
17
+ {children}
18
+ </div>
19
+ );
20
+ }
@@ -0,0 +1,45 @@
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
+
5
+ .desktopHeader,
6
+ .tabletHeader {
7
+ display: flex;
8
+ justify-content: space-between;
9
+ align-items: center;
10
+ padding: layout.$spacing-04 0 layout.$spacing-04 layout.$spacing-05;
11
+ background-color: $ui-background;
12
+
13
+ h4:after {
14
+ content: '';
15
+ display: block;
16
+ width: layout.$spacing-07;
17
+ padding-top: 0.188rem;
18
+ border-bottom: 0.375rem solid var(--brand-03);
19
+ }
20
+ }
21
+
22
+ .desktopHeader {
23
+ height: layout.$spacing-09;
24
+ h4 {
25
+ @include type.type-style('heading-compact-02');
26
+ color: $text-02;
27
+ }
28
+ }
29
+
30
+ .tabletHeader {
31
+ height: 4.5rem;
32
+ h4 {
33
+ @include type.type-style('heading-03');
34
+ color: $text-02;
35
+ }
36
+ }
37
+
38
+ // Overriding styles for RTL support
39
+ html[dir='rtl'] {
40
+ .desktopHeader,
41
+ .tabletHeader {
42
+ text-align: right;
43
+ padding: layout.$spacing-04 layout.$spacing-05 layout.$spacing-04 0;
44
+ }
45
+ }
@@ -1,21 +1,13 @@
1
- import { Type } from "@openmrs/esm-framework";
2
- import { boolean } from "zod";
1
+ import { Type } from '@openmrs/esm-framework';
3
2
 
4
3
  export const configSchema = {
5
- admissionLocationTagUuid: {
6
- _type: Type.UUID,
7
- _description:
8
- "UUID for the location tag of the `Admission Location`. Patients may only be admitted to inpatient care in a location with this tag",
9
- _default: "839c65c7-9998-4b90-b80b-39727dfe9fa2",
10
- },
11
- inpatientVisitUuid: {
12
- _type: Type.UUID,
13
- _description: "UUID for the inpatient visit",
14
- _default: "a73e2ac6-263b-47fc-99fc-e0f2c09fc914",
15
- },
16
- restrictWardAdministrationToLoginLocation: {
17
- _type: boolean,
18
- _description: "UUID for the inpatient visit",
19
- _default: false,
4
+ admissionLocationTagName: {
5
+ _type: Type.String,
6
+ _description: 'Patients may only be admitted to inpatient care in a location with this tag',
7
+ _default: 'Admission Location',
20
8
  },
21
9
  };
10
+
11
+ export interface BedManagementConfig {
12
+ admissionLocationTagName: string;
13
+ }
@@ -1,7 +1,7 @@
1
- declare module "@carbon/react";
2
- declare module "*.css";
3
- declare module "*.scss";
4
- declare module "*.png";
5
- declare module "*.svg";
1
+ declare module '@carbon/react';
2
+ declare module '*.css';
3
+ declare module '*.scss';
4
+ declare module '*.png';
5
+ declare module '*.svg';
6
6
 
7
7
  declare type SideNavProps = object;
@@ -1,16 +1,13 @@
1
- import React from "react";
2
- import { Layer, Tile } from "@carbon/react";
3
- import styles from "./empty-state.scss";
1
+ import React from 'react';
2
+ import { Layer, Tile } from '@carbon/react';
3
+ import styles from './empty-state.scss';
4
4
 
5
5
  type EmptyStateProps = {
6
6
  msg: string;
7
7
  helper: string;
8
8
  };
9
9
 
10
- const EmptyState: React.FC<EmptyStateProps> = ({
11
- msg,
12
- helper,
13
- }: EmptyStateProps) => {
10
+ const EmptyState: React.FC<EmptyStateProps> = ({ msg, helper }: EmptyStateProps) => {
14
11
  return (
15
12
  <Layer className={styles.layer}>
16
13
  <Tile className={styles.tile}>
@@ -30,13 +27,7 @@ const EmptyState: React.FC<EmptyStateProps> = ({
30
27
  fill="#C6C6C6"
31
28
  />
32
29
  <circle fill="#C6C6C6" cx={17.636} cy={2.314} r={1.855} />
33
- <circle
34
- fill="#FFF"
35
- fillRule="nonzero"
36
- cx={17.636}
37
- cy={2.314}
38
- r={1.175}
39
- />
30
+ <circle fill="#FFF" fillRule="nonzero" cx={17.636} cy={2.314} r={1.175} />
40
31
  <path
41
32
  d="M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z"
42
33
  fill="#F4F4F4"
@@ -50,13 +41,7 @@ const EmptyState: React.FC<EmptyStateProps> = ({
50
41
  fill="#C6C6C6"
51
42
  />
52
43
  <circle fill="#C6C6C6" cx={40.218} cy={9.755} r={1.855} />
53
- <circle
54
- fill="#FFF"
55
- fillRule="nonzero"
56
- cx={40.218}
57
- cy={9.755}
58
- r={1.13}
59
- />
44
+ <circle fill="#FFF" fillRule="nonzero" cx={40.218} cy={9.755} r={1.13} />
60
45
  </g>
61
46
  </svg>
62
47
  <p className={styles.content}>{msg}</p>
@@ -1,17 +1,17 @@
1
1
  @use '@carbon/colors';
2
2
  @use '@carbon/layout';
3
- @use "@carbon/type";
3
+ @use '@carbon/type';
4
4
 
5
5
  .desktopHeading {
6
6
  h4 {
7
- @include type.type-style("heading-compact-02");
7
+ @include type.type-style('heading-compact-02');
8
8
  color: colors.$gray-70;
9
9
  }
10
10
  }
11
11
 
12
12
  .tabletHeading {
13
13
  h4 {
14
- @include type.type-style("heading-03");
14
+ @include type.type-style('heading-03');
15
15
  color: colors.$gray-70;
16
16
  }
17
17
  }
@@ -23,26 +23,26 @@
23
23
  margin-bottom: layout.$spacing-05;
24
24
 
25
25
  h4:after {
26
- content: "";
26
+ content: '';
27
27
  display: block;
28
- width: 2rem;
28
+ width: layout.$spacing-07;
29
29
  padding-top: 0.188rem;
30
30
  border-bottom: 0.375rem solid var(--brand-03);
31
31
  }
32
32
  }
33
33
 
34
34
  .heading:after {
35
- content: "";
35
+ content: '';
36
36
  display: block;
37
- width: 2rem;
37
+ width: layout.$spacing-07;
38
38
  padding-top: 0.188rem;
39
39
  border-bottom: 0.375rem solid var(--brand-03);
40
40
  }
41
41
 
42
42
  .tile {
43
- padding: 2rem;
43
+ padding: layout.$spacing-07;
44
44
  border: 1px solid colors.$gray-20;
45
- margin: 1.5rem;
45
+ margin: layout.$spacing-06;
46
46
  }
47
47
 
48
48
  .layer {
@@ -50,7 +50,7 @@
50
50
  }
51
51
 
52
52
  .content {
53
- @include type.type-style("heading-compact-02");
53
+ @include type.type-style('heading-compact-02');
54
54
  color: colors.$gray-70;
55
55
  margin-top: layout.$spacing-05;
56
56
  margin-bottom: layout.$spacing-03;
@@ -1,47 +1,38 @@
1
- import React from "react";
2
- import {
3
- ConfigurableLink,
4
- formatDate,
5
- useSession,
6
- } from "@openmrs/esm-framework";
7
- import { useTranslation } from "react-i18next";
8
- import { Calendar, Location } from "@carbon/react/icons";
9
- import Illustration from "./illustration.component";
10
- import styles from "./header.scss";
1
+ import React from 'react';
2
+ import { ConfigurableLink, formatDate, useSession } from '@openmrs/esm-framework';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Calendar, Location } from '@carbon/react/icons';
5
+ import Illustration from './illustration.component';
6
+ import styles from './header.scss';
11
7
 
12
8
  type HeaderProps = {
13
9
  route: string;
14
10
  headerTitle?: string;
15
11
  };
16
12
 
17
- const Header: React.FC<HeaderProps> = ({
18
- route,
19
- headerTitle = "Bed Management",
20
- }) => {
13
+ const Header: React.FC<HeaderProps> = ({ route, headerTitle = 'Bed Management' }) => {
21
14
  const { t } = useTranslation();
22
15
  const userSession = useSession();
23
16
  const userLocation = userSession?.sessionLocation?.display;
24
17
 
25
18
  return (
26
19
  <div className={styles.header}>
27
- <div className={styles["left-justified-items"]}>
20
+ <div className={styles['left-justified-items']}>
28
21
  <ConfigurableLink to={`${window.getOpenmrsSpaBase()}bed-management`}>
29
22
  <Illustration />
30
23
  </ConfigurableLink>
31
- <div className={styles["page-labels"]}>
32
- <p>{t("headerTitle", headerTitle)}</p>
33
- <p className={styles["page-name"]}>{route}</p>
24
+ <div className={styles['page-labels']}>
25
+ <p>{t('headerTitle', headerTitle)}</p>
26
+ <p className={styles['page-name']}>{route}</p>
34
27
  </div>
35
28
  </div>
36
- <div className={styles["right-justified-items"]}>
37
- <div className={styles["date-and-location"]}>
29
+ <div className={styles['right-justified-items']}>
30
+ <div className={styles['date-and-location']}>
38
31
  <Location size={16} />
39
32
  <span className={styles.value}>{userLocation}</span>
40
33
  <span className={styles.middot}>&middot;</span>
41
34
  <Calendar size={16} />
42
- <span className={styles.value}>
43
- {formatDate(new Date(), { mode: "standard" })}
44
- </span>
35
+ <span className={styles.value}>{formatDate(new Date(), { mode: 'standard' })}</span>
45
36
  </div>
46
37
  </div>
47
38
  </div>