@kenyaemr/esm-service-queues-app 8.1.1-pre.129 → 8.1.2-pre.152

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 (256) hide show
  1. package/.turbo/turbo-build.log +26 -26
  2. package/dist/1006.js +1 -0
  3. package/dist/1006.js.map +1 -0
  4. package/dist/1060.js +1 -0
  5. package/dist/1060.js.map +1 -0
  6. package/dist/130.js +1 -1
  7. package/dist/130.js.map +1 -1
  8. package/dist/1325.js +1 -0
  9. package/dist/1325.js.map +1 -0
  10. package/dist/1644.js +1 -0
  11. package/dist/1727.js +1 -0
  12. package/dist/1727.js.map +1 -0
  13. package/dist/1800.js +1 -0
  14. package/dist/1800.js.map +1 -0
  15. package/dist/236.js +1 -1
  16. package/dist/2757.js +1 -0
  17. package/dist/{282.js → 2760.js} +1 -1
  18. package/dist/2760.js.map +1 -0
  19. package/dist/2784.js +2 -0
  20. package/dist/2784.js.map +1 -0
  21. package/dist/3199.js +1 -0
  22. package/dist/3199.js.map +1 -0
  23. package/dist/3372.js +2 -0
  24. package/dist/3372.js.map +1 -0
  25. package/dist/3574.js +1 -0
  26. package/dist/3604.js +1 -0
  27. package/dist/3604.js.map +1 -0
  28. package/dist/3652.js +1 -0
  29. package/dist/3760.js +1 -0
  30. package/dist/3760.js.map +1 -0
  31. package/dist/3818.js +1 -0
  32. package/dist/3818.js.map +1 -0
  33. package/dist/3828.js +1 -0
  34. package/dist/3828.js.map +1 -0
  35. package/dist/4272.js +1 -0
  36. package/dist/4378.js +1 -0
  37. package/dist/443.js +1 -0
  38. package/dist/443.js.map +1 -0
  39. package/dist/4460.js +1 -0
  40. package/dist/4705.js +1 -0
  41. package/dist/4911.js +1 -0
  42. package/dist/4911.js.map +1 -0
  43. package/dist/5236.js +1 -0
  44. package/dist/5236.js.map +1 -0
  45. package/dist/5240.js +1 -0
  46. package/dist/5282.js +1 -0
  47. package/dist/5282.js.map +1 -0
  48. package/dist/5336.js +1 -0
  49. package/dist/539.js +1 -0
  50. package/dist/5673.js +1 -0
  51. package/dist/5711.js +1 -0
  52. package/dist/5737.js +1 -0
  53. package/dist/5833.js +1 -0
  54. package/dist/6566.js +1 -0
  55. package/dist/6578.js +2 -0
  56. package/dist/{660.js.LICENSE.txt → 6578.js.LICENSE.txt} +5 -0
  57. package/dist/6578.js.map +1 -0
  58. package/dist/6591.js +2 -0
  59. package/dist/6591.js.map +1 -0
  60. package/dist/6670.js +1 -0
  61. package/dist/6670.js.map +1 -0
  62. package/dist/6727.js +1 -0
  63. package/dist/744.js +1 -0
  64. package/dist/752.js +1 -1
  65. package/dist/752.js.map +1 -1
  66. package/dist/7807.js +1 -0
  67. package/dist/8271.js +1 -0
  68. package/dist/8319.js +1 -0
  69. package/dist/8788.js +1 -0
  70. package/dist/899.js +1 -0
  71. package/dist/9261.js +1 -0
  72. package/dist/9392.js +1 -0
  73. package/dist/9392.js.map +1 -0
  74. package/dist/9993.js +1 -0
  75. package/dist/9993.js.map +1 -0
  76. package/dist/kenyaemr-esm-service-queues-app.js +1 -1
  77. package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +541 -234
  78. package/dist/kenyaemr-esm-service-queues-app.js.map +1 -1
  79. package/dist/main.js +1 -1
  80. package/dist/main.js.LICENSE.txt +5 -0
  81. package/dist/main.js.map +1 -1
  82. package/dist/routes.json +1 -1
  83. package/package-lock.json +2 -2
  84. package/package.json +8 -5
  85. package/src/active-visits/active-visits-table.resource.ts +0 -62
  86. package/src/active-visits/change-status-dialog.component.tsx +10 -3
  87. package/src/active-visits/change-status-dialog.scss +29 -1
  88. package/src/active-visits/change-status-dialog.test.tsx +11 -3
  89. package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +53 -54
  90. package/src/add-provider-queue-room/add-provider-queue-room.scss +28 -0
  91. package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +1 -1
  92. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +1 -0
  93. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +29 -0
  94. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +4 -1
  95. package/src/config-schema.ts +28 -8
  96. package/src/create-queue-entry/create-queue-entry.workspace.tsx +99 -0
  97. package/src/create-queue-entry/existing-visit-form/existing-visit-form.component.tsx +73 -0
  98. package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx → create-queue-entry/queue-fields/queue-fields.component.tsx} +76 -50
  99. package/src/create-queue-entry/queue-fields/queue-fields.resource.ts +63 -0
  100. package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.scss → create-queue-entry/queue-fields/queue-fields.scss} +0 -4
  101. package/src/{patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx → create-queue-entry/queue-fields/queue-fields.test.tsx} +37 -17
  102. package/src/create-queue-entry/queue-fields/visit-form-queue-fields.extension.tsx +31 -0
  103. package/src/hooks/useQueueEntries.ts +13 -12
  104. package/src/index.ts +8 -14
  105. package/src/patient-info/patient-info.component.tsx +10 -8
  106. package/src/patient-queue-header/patient-queue-header.component.tsx +18 -13
  107. package/src/patient-queue-metrics/metrics-header.component.tsx +4 -4
  108. package/src/queue-entry-table-components/queue-priority.component.tsx +16 -11
  109. package/src/queue-entry-table-components/queue-priority.scss +5 -0
  110. package/src/queue-entry-table-components/transition-entry.component.tsx +1 -1
  111. package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +1 -1
  112. package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +13 -12
  113. package/src/queue-patient-linelists/scheduled-appointments-table.component.tsx +1 -1
  114. package/src/queue-rooms/queue-room-form.test.tsx +2 -2
  115. package/src/queue-rooms/queue-room-form.workspace.tsx +1 -1
  116. package/src/queue-screen/queue-screen.test.tsx +11 -4
  117. package/src/queue-services/queue-service-form.test.tsx +76 -16
  118. package/src/queue-services/queue-service-form.workspace.tsx +131 -131
  119. package/src/queue-services/queue-service.resource.ts +7 -2
  120. package/src/queue-table/cells/columns.resource.ts +10 -7
  121. package/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx +1 -0
  122. package/src/queue-table/default-queue-table.component.tsx +12 -13
  123. package/src/queue-table/default-queue-table.test.tsx +3 -3
  124. package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.scss +28 -0
  125. package/src/queue-table/queue-entry-actions/queue-entry-actions.modal.tsx +8 -2
  126. package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.modal.tsx +2 -1
  127. package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.scss +29 -0
  128. package/src/queue-table/queue-table.component.tsx +1 -1
  129. package/src/queue-table/queue-table.scss +12 -2
  130. package/src/queue-table/queue-table.test.tsx +10 -1
  131. package/src/remove-queue-entry-dialog/remove-queue-entry.component.tsx +16 -4
  132. package/src/remove-queue-entry-dialog/remove-queue-entry.scss +29 -0
  133. package/src/routes.json +4 -8
  134. package/src/transition-latest-queue-entry/transition-latest-queue-entry.resource.ts +2 -10
  135. package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +41 -32
  136. package/src/transition-queue-entry/transition-queue-entry-dialog.scss +28 -0
  137. package/src/types/index.ts +0 -8
  138. package/src/views/queue-tables-for-all-statuses.component.tsx +12 -15
  139. package/translations/am.json +5 -78
  140. package/translations/ar.json +5 -78
  141. package/translations/de.json +235 -0
  142. package/translations/en.json +9 -86
  143. package/translations/es.json +3 -76
  144. package/translations/fr.json +5 -78
  145. package/translations/he.json +5 -78
  146. package/translations/hi.json +235 -0
  147. package/translations/hi_IN.json +235 -0
  148. package/translations/id.json +235 -0
  149. package/translations/it.json +235 -0
  150. package/translations/km.json +5 -78
  151. package/translations/ne.json +235 -0
  152. package/translations/pt.json +235 -0
  153. package/translations/pt_BR.json +235 -0
  154. package/translations/qu.json +235 -0
  155. package/translations/si.json +235 -0
  156. package/translations/sw.json +235 -0
  157. package/translations/sw_KE.json +235 -0
  158. package/translations/tr.json +235 -0
  159. package/translations/tr_TR.json +235 -0
  160. package/translations/uk.json +235 -0
  161. package/translations/vi.json +235 -0
  162. package/translations/zh.json +6 -79
  163. package/translations/zh_CN.json +5 -78
  164. package/dist/169.js +0 -1
  165. package/dist/169.js.map +0 -1
  166. package/dist/199.js +0 -1
  167. package/dist/199.js.map +0 -1
  168. package/dist/236.js.map +0 -1
  169. package/dist/271.js +0 -1
  170. package/dist/282.js.map +0 -1
  171. package/dist/319.js +0 -1
  172. package/dist/325.js +0 -1
  173. package/dist/325.js.map +0 -1
  174. package/dist/366.js +0 -1
  175. package/dist/366.js.map +0 -1
  176. package/dist/372.js +0 -2
  177. package/dist/372.js.map +0 -1
  178. package/dist/392.js +0 -1
  179. package/dist/392.js.map +0 -1
  180. package/dist/460.js +0 -1
  181. package/dist/501.js +0 -1
  182. package/dist/501.js.map +0 -1
  183. package/dist/574.js +0 -1
  184. package/dist/591.js +0 -2
  185. package/dist/591.js.map +0 -1
  186. package/dist/6.js +0 -1
  187. package/dist/6.js.map +0 -1
  188. package/dist/60.js +0 -1
  189. package/dist/60.js.map +0 -1
  190. package/dist/604.js +0 -1
  191. package/dist/604.js.map +0 -1
  192. package/dist/644.js +0 -1
  193. package/dist/660.js +0 -2
  194. package/dist/660.js.map +0 -1
  195. package/dist/670.js +0 -1
  196. package/dist/670.js.map +0 -1
  197. package/dist/727.js +0 -1
  198. package/dist/727.js.map +0 -1
  199. package/dist/748.js +0 -1
  200. package/dist/748.js.map +0 -1
  201. package/dist/757.js +0 -1
  202. package/dist/760.js +0 -1
  203. package/dist/760.js.map +0 -1
  204. package/dist/784.js +0 -2
  205. package/dist/784.js.map +0 -1
  206. package/dist/788.js +0 -1
  207. package/dist/800.js +0 -1
  208. package/dist/800.js.map +0 -1
  209. package/dist/807.js +0 -1
  210. package/dist/818.js +0 -1
  211. package/dist/818.js.map +0 -1
  212. package/dist/828.js +0 -1
  213. package/dist/828.js.map +0 -1
  214. package/dist/833.js +0 -1
  215. package/dist/911.js +0 -1
  216. package/dist/911.js.map +0 -1
  217. package/dist/940.js +0 -1
  218. package/dist/940.js.map +0 -1
  219. package/src/add-patient-toqueue/add-patient-toqueue-dialog.component.tsx +0 -228
  220. package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +0 -32
  221. package/src/patient-search/advanced-search.component.tsx +0 -191
  222. package/src/patient-search/advanced-search.scss +0 -154
  223. package/src/patient-search/advanced-search.test.tsx +0 -26
  224. package/src/patient-search/basic-search.component.tsx +0 -112
  225. package/src/patient-search/basic-search.scss +0 -139
  226. package/src/patient-search/basic-search.test.tsx +0 -18
  227. package/src/patient-search/empty-data-illustration.component.tsx +0 -41
  228. package/src/patient-search/hooks/useActivePatientEnrollment.tsx +0 -29
  229. package/src/patient-search/hooks/useDefaultLocation.ts +0 -14
  230. package/src/patient-search/hooks/usePatients.tsx +0 -25
  231. package/src/patient-search/hooks/useRecommendedVisitTypes.tsx +0 -35
  232. package/src/patient-search/hooks/useScheduledVisits.ts +0 -52
  233. package/src/patient-search/patient-scheduled-visits.component.tsx +0 -315
  234. package/src/patient-search/patient-scheduled-visits.scss +0 -131
  235. package/src/patient-search/patient-scheduled-visits.test.tsx +0 -39
  236. package/src/patient-search/patient-search.workspace.tsx +0 -135
  237. package/src/patient-search/search-illustration.component.tsx +0 -27
  238. package/src/patient-search/search-results.component.tsx +0 -75
  239. package/src/patient-search/search-results.scss +0 -80
  240. package/src/patient-search/search-results.test.tsx +0 -69
  241. package/src/patient-search/search.resource.ts +0 -10
  242. package/src/patient-search/visit-form/existing-visit-form.component.tsx +0 -112
  243. package/src/patient-search/visit-form/queue.resource.ts +0 -64
  244. package/src/patient-search/visit-form/visit-form.component.tsx +0 -337
  245. package/src/patient-search/visit-form/visit-type-selector.component.tsx +0 -153
  246. package/src/patient-search/visit-form/visit-type-selector.scss +0 -100
  247. package/src/patient-search/visit-form/visit-type-selector.test.tsx +0 -84
  248. package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +0 -277
  249. package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +0 -93
  250. package/src/visits-missing-inqueue/visits-missing-inqueue.scss +0 -111
  251. /package/dist/{784.js.LICENSE.txt → 2784.js.LICENSE.txt} +0 -0
  252. /package/dist/{372.js.LICENSE.txt → 3372.js.LICENSE.txt} +0 -0
  253. /package/dist/{591.js.LICENSE.txt → 6591.js.LICENSE.txt} +0 -0
  254. /package/src/{patient-search/patient-search.scss → create-queue-entry/create-queue-entry.scss} +0 -0
  255. /package/src/{patient-search/visit-form/visit-form.scss → create-queue-entry/existing-visit-form/existing-visit-form.scss} +0 -0
  256. /package/src/{patient-search → create-queue-entry}/hooks/useQueueLocations.tsx +0 -0
@@ -1,112 +0,0 @@
1
- import React, { useMemo, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import debounce from 'lodash-es/debounce';
4
- import { Search, Button, InlineLoading, Layer, Tile } from '@carbon/react';
5
- import { Search as SearchIcon } from '@carbon/react/icons';
6
- import EmptyDataIllustration from './empty-data-illustration.component';
7
- import SearchIllustration from './search-illustration.component';
8
- import SearchResults from './search-results.component';
9
- import usePatients from './hooks/usePatients';
10
- import { SearchTypes } from '../types';
11
- import styles from './basic-search.scss';
12
-
13
- interface BasicSearchProps {
14
- toggleSearchType: (searchMode: SearchTypes) => void;
15
- }
16
-
17
- const searchTimeoutInMs = 300;
18
-
19
- const BasicSearch: React.FC<BasicSearchProps> = ({ toggleSearchType }) => {
20
- const { t } = useTranslation();
21
- const [searchTerm, setSearchTerm] = useState('');
22
- const [query, setQuery] = useState<string>(null);
23
- const { patients, isLoading } = usePatients(query);
24
-
25
- const handleSearch = useMemo(() => debounce((searchTerm) => setSearchTerm(searchTerm), searchTimeoutInMs), []);
26
-
27
- const performSearch = () => setQuery(searchTerm);
28
-
29
- return (
30
- <div className={patients?.length ? styles.lightBackground : styles.resultsContainer}>
31
- <div className={styles.searchboxContainer}>
32
- <Layer className={styles.searchboxLayer}>
33
- <Search
34
- autoFocus
35
- className={styles.searchInput}
36
- labelText={t('searchForPatient', 'Search for a patient')}
37
- placeholder={t('searchboxPlaceholder', 'Search for a patient name or ID number')}
38
- onChange={(event) => handleSearch(event.target.value)}
39
- onClear={() => setQuery(null)}
40
- />
41
- </Layer>
42
- <Button onClick={performSearch} iconDescription="Basic search" size="md" kind="secondary">
43
- {t('search', 'Search')}
44
- </Button>
45
- </div>
46
- {
47
- <>
48
- {query === null && (
49
- <div>
50
- <div className={styles.tileContainer}>
51
- <Layer>
52
- <Tile className={styles.tile}>
53
- <SearchIllustration />
54
- <div className={styles.helperText}>
55
- <p className={styles.primaryText}>{t('primaryHelperText', 'Search for a patient')}</p>
56
- <p className={styles.secondaryText}>
57
- {t('secondaryHelperText', "Type the patient's name or unique ID number")}
58
- </p>
59
- </div>
60
- </Tile>
61
- </Layer>
62
- </div>
63
- <p className={styles.separator}>{t('or', 'or')}</p>
64
- <div className={styles.buttonContainer}>
65
- <Button
66
- kind="ghost"
67
- disabled
68
- iconDescription="Advanced search"
69
- renderIcon={(props) => <SearchIcon size={16} {...props} />}
70
- onClick={() => toggleSearchType(SearchTypes.ADVANCED)}>
71
- {t('advancedSearch', 'Advanced search')}
72
- </Button>
73
- </div>
74
- </div>
75
- )}
76
- {isLoading && (
77
- <div className={styles.loadingContainer}>
78
- <InlineLoading description={t('loading', 'Loading...')} />
79
- </div>
80
- )}
81
-
82
- {patients.length > 0 && <SearchResults toggleSearchType={toggleSearchType} patients={patients} />}
83
-
84
- {patients.length === 0 && query !== null && !isLoading && (
85
- <div className={styles.resultsContainer}>
86
- <div style={{ margin: '1rem' }}>
87
- <p className={styles.resultsText}>{t('noResultsFound', 'No results found')}</p>
88
- <Layer>
89
- <Tile className={styles.emptySearchResultsTile}>
90
- <EmptyDataIllustration />
91
- <p className={styles.emptyResultText}>
92
- {t('noPatientFoundMessage', 'Sorry, no patient has been found')}
93
- </p>
94
- <p className={styles.actionText}>
95
- <span>
96
- {t('trySearchWithPatientUniqueID', "Try searching with the patient's unique ID number")}
97
- </span>
98
- <br />
99
- <span>{t('orPatientName', "OR the patient's name(s)")}</span>
100
- </p>
101
- </Tile>
102
- </Layer>
103
- </div>
104
- </div>
105
- )}
106
- </>
107
- }
108
- </div>
109
- );
110
- };
111
-
112
- export default BasicSearch;
@@ -1,139 +0,0 @@
1
- @use '@carbon/layout';
2
- @use '@carbon/type';
3
- @use '@openmrs/esm-styleguide/src/vars' as *;
4
-
5
- .searchboxContainer {
6
- display: flex;
7
- align-items: center;
8
- margin-bottom: layout.$spacing-05;
9
- }
10
-
11
- .searchboxLayer {
12
- flex-grow: 1;
13
- }
14
-
15
- .tileContainer {
16
- :global(.omrs-breakpoint-gt-tablet) & {
17
- margin: 0 layout.$spacing-06 0;
18
- }
19
-
20
- :global(.omrs-breakpoint-lt-desktop) & {
21
- width: 60%;
22
- margin: auto;
23
- }
24
- }
25
-
26
- .tile {
27
- display: flex;
28
- flex-flow: column wrap;
29
- align-items: center;
30
- justify-content: center;
31
- padding: layout.$spacing-07 0 layout.$spacing-06;
32
- text-align: center;
33
- border: 1px solid $ui-03;
34
- }
35
-
36
- .helperText {
37
- margin-top: 1.25rem;
38
- color: $text-02;
39
-
40
- .primaryText {
41
- @include type.type-style('heading-compact-01');
42
- }
43
-
44
- .secondaryText {
45
- width: 12rem;
46
- margin-top: layout.$spacing-02;
47
- @include type.type-style('body-01');
48
- }
49
- }
50
-
51
- .separator {
52
- @include type.type-style('heading-03');
53
- color: $text-02;
54
- width: 12rem;
55
- margin: layout.$spacing-09 auto;
56
- overflow: hidden;
57
- text-align: center;
58
-
59
- &::before,
60
- &::after {
61
- background-color: $text-03;
62
- content: '';
63
- display: inline-block;
64
- height: 1px;
65
- position: relative;
66
- vertical-align: middle;
67
- width: 50%;
68
- }
69
-
70
- &::before {
71
- right: layout.$spacing-05;
72
- margin-left: -50%;
73
- }
74
-
75
- &::after {
76
- left: layout.$spacing-05;
77
- margin-right: -50%;
78
- }
79
- }
80
-
81
- .buttonContainer {
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- }
86
-
87
- .resultsContainer {
88
- height: 100vh;
89
- }
90
-
91
- .lightBackground {
92
- @extend .resultsContainer;
93
- background-color: white;
94
- }
95
-
96
- .loadingContainer {
97
- height: 80vh;
98
- display: flex;
99
- justify-content: center;
100
- align-items: center;
101
-
102
- & > div {
103
- width: fit-content !important;
104
- }
105
- }
106
-
107
- .helperText {
108
- color: var(--omrs-color-ink-medium-contrast);
109
- margin-left: 2.375rem;
110
- }
111
-
112
- .resultsText {
113
- @include type.type-style('label-01');
114
- color: $text-02;
115
- border-bottom: 0.063rem solid $ui-03;
116
- padding: layout.$spacing-03 0;
117
- }
118
-
119
- .emptyResultText {
120
- @include type.type-style('heading-compact-01');
121
- color: $text-02;
122
- margin-top: layout.$spacing-05;
123
- margin-bottom: 0.313rem;
124
- }
125
-
126
- .actionText {
127
- @include type.type-style('body-01');
128
- color: $text-02;
129
- }
130
-
131
- .emptySearchResultsTile {
132
- text-align: center;
133
- margin-top: layout.$spacing-05;
134
- padding: layout.$spacing-09 0;
135
- }
136
-
137
- :global(.omrs-breakpoint-gt-tablet) .emptySearchResultsTile {
138
- background-color: $ui-02;
139
- }
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import BasicSearch from './basic-search.component';
4
-
5
- describe('BasicSearch', () => {
6
- test('renders the basic patient search in an overlay', () => {
7
- render(<BasicSearch toggleSearchType={jest.fn()} />);
8
-
9
- const searchbox = screen.getByRole('searchbox', { name: /search for a patient/i });
10
- const searchButton = screen.getByRole('button', { name: /^search$/i });
11
- expect(searchbox).toBeInTheDocument();
12
- expect(searchButton).toBeInTheDocument();
13
- expect(screen.getByPlaceholderText(/search for a patient name or id number/i)).toBeInTheDocument();
14
- expect(screen.getByRole('button', { name: /advanced search/i })).toBeDisabled();
15
- expect(screen.getByText('or')).toBeInTheDocument();
16
- expect(screen.getByText(/type the patient's name or unique id number/i)).toBeInTheDocument();
17
- });
18
- });
@@ -1,41 +0,0 @@
1
- import * as React from 'react';
2
-
3
- const EmptyDataIllustration = ({ width = '61', height = '59' }) => {
4
- return (
5
- <svg width={width} height={height} viewBox="0 0 61 59">
6
- <title>Empty data illustration</title>
7
- <g fill="none" fillRule="evenodd">
8
- <path
9
- d="M38.133 13.186H21.947c-.768.001-1.39.623-1.39 1.391V50.55l-.186.057-3.97 1.216a.743.743 0 01-.927-.493L3.664 12.751a.742.742 0 01.492-.926l6.118-1.874 17.738-5.43 6.119-1.873a.741.741 0 01.926.492L38.076 13l.057.186z"
10
- fill="#E0E0E0"
11
- />
12
- <path
13
- d="M41.664 13L38.026 1.117A1.576 1.576 0 0036.056.07l-8.601 2.633-17.737 5.43-8.603 2.634a1.578 1.578 0 00-1.046 1.97l12.436 40.616a1.58 1.58 0 001.969 1.046l5.897-1.805.185-.057v-.194l-.185.057-5.952 1.822a1.393 1.393 0 01-1.737-.923L.247 12.682a1.39 1.39 0 01.923-1.738L9.772 8.31 27.51 2.881 36.112.247a1.393 1.393 0 011.737.923L41.47 13l.057.186h.193l-.057-.185z"
14
- fill="#8D8D8D"
15
- />
16
- <path
17
- d="M11.378 11.855a.836.836 0 01-.798-.59L9.385 7.361a.835.835 0 01.554-1.042l16.318-4.996a.836.836 0 011.042.554l1.195 3.902a.836.836 0 01-.554 1.043l-16.318 4.995a.831.831 0 01-.244.037z"
18
- fill="#C6C6C6"
19
- />
20
- <circle fill="#C6C6C6" cx={17.636} cy={2.314} r={1.855} />
21
- <circle fill="#FFF" fillRule="nonzero" cx={17.636} cy={2.314} r={1.175} />
22
- <path
23
- 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"
24
- fill="#E0E0E0"
25
- />
26
- <path
27
- d="M41.47 13H21.948a1.579 1.579 0 00-1.576 1.577V52.4l.185-.057V14.577c.001-.768.623-1.39 1.391-1.39h19.581L41.471 13zm17.02 0H21.947a1.579 1.579 0 00-1.576 1.577v42.478c0 .87.706 1.576 1.576 1.577H58.49a1.579 1.579 0 001.576-1.577V14.577a1.579 1.579 0 00-1.576-1.576zm1.39 44.055c0 .768-.622 1.39-1.39 1.392H21.947c-.768-.001-1.39-.624-1.39-1.392V14.577c0-.768.622-1.39 1.39-1.39H58.49c.768 0 1.39.622 1.39 1.39v42.478z"
28
- fill="#8D8D8D"
29
- />
30
- <path
31
- d="M48.751 17.082H31.686a.836.836 0 01-.835-.835v-4.081c0-.46.374-.834.835-.835H48.75c.461 0 .834.374.835.835v4.08c0 .462-.374.835-.835.836z"
32
- fill="#C6C6C6"
33
- />
34
- <circle fill="#C6C6C6" cx={40.218} cy={9.755} r={1.855} />
35
- <circle fill="#FFF" fillRule="nonzero" cx={40.218} cy={9.755} r={1.13} />
36
- </g>
37
- </svg>
38
- );
39
- };
40
-
41
- export default EmptyDataIllustration;
@@ -1,29 +0,0 @@
1
- import { useMemo } from 'react';
2
- import useSWR from 'swr';
3
- import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
4
- import { type PatientProgram } from '../../types';
5
- import uniqBy from 'lodash-es/uniqBy';
6
-
7
- export const useActivePatientEnrollment = (patientUuid: string) => {
8
- const customRepresentation = `custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))`;
9
- const apiUrl = `${restBaseUrl}/programenrollment?patient=${patientUuid}&v=${customRepresentation}`;
10
-
11
- const { data, error, isLoading } = useSWR<{ data: { results: Array<PatientProgram> } }>(
12
- patientUuid ? apiUrl : null,
13
- openmrsFetch,
14
- );
15
-
16
- const activePatientEnrollment = useMemo(
17
- () =>
18
- data?.data.results
19
- .sort((a, b) => (b.dateEnrolled > a.dateEnrolled ? 1 : -1))
20
- .filter((enrollment) => enrollment.dateCompleted === null) ?? [],
21
- [data?.data.results],
22
- );
23
-
24
- return {
25
- activePatientEnrollment: uniqBy(activePatientEnrollment, (program) => program?.program?.uuid),
26
- error,
27
- isLoading,
28
- };
29
- };
@@ -1,14 +0,0 @@
1
- import { type FetchResponse, openmrsFetch, useConfig } from '@openmrs/esm-framework';
2
- import useSWRImmutable from 'swr/immutable';
3
-
4
- export const useDefaultLoginLocation = () => {
5
- const config = useConfig();
6
- const apiUrl = config.defaultFacilityUrl;
7
- const { data, error, isLoading } = useSWRImmutable<FetchResponse>(apiUrl, openmrsFetch);
8
-
9
- return {
10
- defaultFacility: data ? data?.data : null,
11
- isLoading: isLoading,
12
- error,
13
- };
14
- };
@@ -1,25 +0,0 @@
1
- import { useMemo } from 'react';
2
- import useSWR from 'swr';
3
- import { fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework';
4
-
5
- interface FHIRResponse {
6
- entry: Array<{ resource: fhir.Patient }>;
7
- total: number;
8
- type: string;
9
- resourceType: string;
10
- }
11
-
12
- const usePatients = (searchTerm: string) => {
13
- const apiUrl = `${fhirBaseUrl}/Patient?name=${searchTerm}&_summary=data`;
14
-
15
- const { data, error, isLoading } = useSWR<{ data: FHIRResponse }>(searchTerm !== null ? apiUrl : null, openmrsFetch);
16
-
17
- const searchedPatients = useMemo(
18
- () => data?.data?.entry?.map((response) => response.resource) ?? [],
19
- [data?.data?.entry],
20
- );
21
-
22
- return { patients: searchedPatients, isLoading: isLoading && searchTerm !== null, error };
23
- };
24
-
25
- export default usePatients;
@@ -1,35 +0,0 @@
1
- import useSWR from 'swr';
2
- import { openmrsFetch, useConfig } from '@openmrs/esm-framework';
3
- import { type ConfigObject } from '../../config-schema';
4
- import { useMemo } from 'react';
5
-
6
- interface EnrollmentVisitType {
7
- dataDependencies: Array<string>;
8
- enrollmentOptions: object;
9
- incompatibleWith: Array<string>;
10
- name: string;
11
- visitTypes: { allowed: Array<EnrollmentVisitType>; disallowed: Array<EnrollmentVisitType> };
12
- }
13
-
14
- export const useRecommendedVisitTypes = (
15
- patientUuid: string,
16
- enrollmentUuid: string,
17
- programUuid: string,
18
- locationUuid: string,
19
- ) => {
20
- const { visitTypeResourceUrl, showRecommendedVisitTypeTab } = useConfig<ConfigObject>();
21
-
22
- const apiUrl = `${visitTypeResourceUrl}${patientUuid}/program/${programUuid}/enrollment/${enrollmentUuid}?intendedLocationUuid=${locationUuid}`;
23
-
24
- const { data, error, isLoading } = useSWR<{ data: EnrollmentVisitType }>(
25
- showRecommendedVisitTypeTab && patientUuid && enrollmentUuid && programUuid ? apiUrl : null,
26
- openmrsFetch,
27
- );
28
-
29
- const recommendedVisitTypes = useMemo(() => data?.data?.visitTypes?.allowed.map(mapToVisitType) ?? [], [data]);
30
- return { recommendedVisitTypes, error, isLoading };
31
- };
32
-
33
- const mapToVisitType = (visitType) => {
34
- return { ...visitType, display: visitType.name };
35
- };
@@ -1,52 +0,0 @@
1
- import useSWR from 'swr';
2
- import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
3
- import dayjs from 'dayjs';
4
- import { type AppointmentsFetchResponse } from '../../types';
5
-
6
- const fetcher = (appointmentsSearchUrl: string, patientUuid: string) => {
7
- const abortController = new AbortController();
8
- let startDate = dayjs(new Date().toISOString()).subtract(6, 'month').toISOString();
9
-
10
- return openmrsFetch(appointmentsSearchUrl, {
11
- method: 'POST',
12
- signal: abortController.signal,
13
- headers: {
14
- 'Content-Type': 'application/json',
15
- },
16
- body: {
17
- patientUuid: patientUuid,
18
- startDate: startDate,
19
- },
20
- });
21
- };
22
-
23
- export function useScheduledVisits(patientUuid: string) {
24
- const appointmentsSearchUrl = `${restBaseUrl}/appointments/search`;
25
-
26
- const { data, error, isLoading } = useSWR<AppointmentsFetchResponse, Error>(
27
- patientUuid ? [appointmentsSearchUrl, patientUuid] : null,
28
- ([appointmentsSearchUrl, patientUuid]) => fetcher(appointmentsSearchUrl, patientUuid as string),
29
- );
30
-
31
- const appointments = data?.data?.length
32
- ? data.data.sort((a, b) => (b.startDateTime > a.startDateTime ? 1 : -1))
33
- : null;
34
-
35
- // visits + or - 7 days before visit date
36
- const recentVisits = appointments?.filter(
37
- (appointment) =>
38
- dayjs((appointment.startDateTime / 1000) * 1000).isBefore(dayjs().add(7, 'day')) ||
39
- dayjs((appointment.startDateTime / 1000) * 1000).isBefore(dayjs().subtract(7, 'day')),
40
- );
41
-
42
- // visits past 7 days
43
- const futureVisits = appointments?.filter((appointment) =>
44
- dayjs((appointment.startDateTime / 1000) * 1000).isAfter(dayjs().add(7, 'day')),
45
- );
46
-
47
- return {
48
- appointments: data ? { recentVisits, futureVisits } : null,
49
- error,
50
- isLoading,
51
- };
52
- }