@kenyaemr/esm-service-queues-app 7.0.3-pre.88 → 7.0.3-pre.94

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 (186) hide show
  1. package/.turbo/turbo-build.log +18 -17
  2. package/dist/130.js +1 -1
  3. package/dist/130.js.map +1 -1
  4. package/dist/199.js +1 -1
  5. package/dist/236.js +1 -0
  6. package/dist/236.js.map +1 -0
  7. package/dist/265.js +1 -0
  8. package/dist/265.js.map +1 -0
  9. package/dist/271.js +1 -1
  10. package/dist/282.js +1 -0
  11. package/dist/282.js.map +1 -0
  12. package/dist/319.js +1 -1
  13. package/dist/366.js +1 -0
  14. package/dist/366.js.map +1 -0
  15. package/dist/392.js +1 -0
  16. package/dist/392.js.map +1 -0
  17. package/dist/460.js +1 -1
  18. package/dist/484.js +2 -0
  19. package/dist/484.js.map +1 -0
  20. package/dist/574.js +1 -1
  21. package/dist/6.js +1 -1
  22. package/dist/604.js +1 -0
  23. package/dist/604.js.map +1 -0
  24. package/dist/644.js +1 -1
  25. package/dist/670.js +1 -0
  26. package/dist/670.js.map +1 -0
  27. package/dist/727.js +1 -0
  28. package/dist/727.js.map +1 -0
  29. package/dist/752.js +1 -1
  30. package/dist/757.js +1 -1
  31. package/dist/760.js +1 -0
  32. package/dist/760.js.map +1 -0
  33. package/dist/788.js +1 -1
  34. package/dist/800.js +1 -1
  35. package/dist/807.js +1 -1
  36. package/dist/818.js +1 -0
  37. package/dist/818.js.map +1 -0
  38. package/dist/828.js +1 -1
  39. package/dist/833.js +1 -1
  40. package/dist/911.js +1 -0
  41. package/dist/911.js.map +1 -0
  42. package/dist/kenyaemr-esm-service-queues-app.js +1 -1
  43. package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +160 -160
  44. package/dist/kenyaemr-esm-service-queues-app.js.map +1 -1
  45. package/dist/main.js +1 -1
  46. package/dist/main.js.map +1 -1
  47. package/dist/routes.json +1 -1
  48. package/package.json +1 -1
  49. package/src/active-visits/active-visits-table.resource.ts +1 -1
  50. package/src/active-visits/change-status-dialog.scss +11 -11
  51. package/src/active-visits/change-status-dialog.test.tsx +36 -31
  52. package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +10 -10
  53. package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +4 -4
  54. package/src/add-provider-queue-room/add-provider-queue-room.resource.ts +2 -2
  55. package/src/add-provider-queue-room/add-provider-queue-room.scss +6 -6
  56. package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +44 -38
  57. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +1 -1
  58. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +2 -3
  59. package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +15 -15
  60. package/src/config-schema.ts +84 -84
  61. package/src/current-visit/current-visit-summary.component.tsx +1 -1
  62. package/src/current-visit/current-visit-summary.test.tsx +12 -11
  63. package/src/current-visit/current-visit.resource.ts +1 -1
  64. package/src/current-visit/current-visit.scss +4 -4
  65. package/src/current-visit/hooks/useVitalsConceptMetadata.tsx +1 -1
  66. package/src/current-visit/visit-details/triage-note.scss +11 -11
  67. package/src/helpers/helpers.test.ts +24 -0
  68. package/src/helpers/helpers.ts +41 -14
  69. package/src/home.test.tsx +10 -12
  70. package/src/hooks/useQueueService.ts +16 -10
  71. package/src/past-visit/past-visit-details/past-visit-summary.scss +8 -8
  72. package/src/past-visit/past-visit.component.tsx +1 -1
  73. package/src/past-visit/past-visit.resource.ts +1 -1
  74. package/src/past-visit/past-visit.scss +17 -17
  75. package/src/past-visit/past-visit.test.tsx +8 -13
  76. package/src/patient-info/appointment-details.scss +7 -7
  77. package/src/patient-info/appointment-details.test.tsx +11 -6
  78. package/src/patient-info/appointments.resource.ts +1 -1
  79. package/src/patient-info/patient-info.scss +9 -9
  80. package/src/patient-info/patient-info.test.tsx +3 -14
  81. package/src/patient-queue-header/patient-queue-header.component.tsx +4 -1
  82. package/src/patient-queue-header/patient-queue-header.scss +11 -11
  83. package/src/patient-queue-metrics/clinic-metrics.component.tsx +1 -1
  84. package/src/patient-queue-metrics/clinic-metrics.resource.ts +2 -2
  85. package/src/patient-queue-metrics/clinic-metrics.scss +4 -4
  86. package/src/patient-queue-metrics/clinic-metrics.test.tsx +40 -45
  87. package/src/patient-queue-metrics/metrics-card.scss +11 -11
  88. package/src/patient-queue-metrics/metrics-header.scss +2 -2
  89. package/src/patient-search/advanced-search.scss +27 -27
  90. package/src/patient-search/advanced-search.test.tsx +6 -9
  91. package/src/patient-search/basic-search.scss +14 -14
  92. package/src/patient-search/basic-search.test.tsx +2 -7
  93. package/src/patient-search/hooks/useDefaultLocation.ts +1 -1
  94. package/src/patient-search/hooks/useQueueLocations.tsx +1 -0
  95. package/src/patient-search/hooks/useScheduledVisits.ts +1 -1
  96. package/src/patient-search/patient-scheduled-visits.component.tsx +4 -4
  97. package/src/patient-search/patient-scheduled-visits.scss +17 -17
  98. package/src/patient-search/patient-scheduled-visits.test.tsx +18 -23
  99. package/src/patient-search/patient-search.scss +7 -7
  100. package/src/patient-search/patient-search.workspace.tsx +4 -4
  101. package/src/patient-search/search-results.scss +11 -11
  102. package/src/patient-search/search-results.test.tsx +2 -10
  103. package/src/patient-search/visit-form/visit-form.scss +12 -13
  104. package/src/patient-search/visit-form/visit-type-selector.component.tsx +9 -11
  105. package/src/patient-search/visit-form/visit-type-selector.scss +13 -13
  106. package/src/patient-search/visit-form/visit-type-selector.test.tsx +4 -3
  107. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.scss +1 -3
  108. package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +15 -9
  109. package/src/queue-entry-table-components/edit-entry.scss +1 -1
  110. package/src/queue-entry-table-components/queue-priority.scss +3 -4
  111. package/src/queue-entry-table-components/transition-entry.scss +1 -1
  112. package/src/queue-patient-linelists/queue-linelist-base-table.scss +16 -17
  113. package/src/queue-patient-linelists/queue-linelist-base-table.test.tsx +7 -8
  114. package/src/queue-patient-linelists/queue-linelist-filter.scss +13 -13
  115. package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +9 -6
  116. package/src/queue-patient-linelists/queue-linelist.resource.ts +4 -4
  117. package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +10 -7
  118. package/src/queue-rooms/queue-room-form.scss +13 -13
  119. package/src/queue-rooms/queue-room-form.test.tsx +10 -8
  120. package/src/queue-screen/queue-screen.scss +6 -4
  121. package/src/queue-screen/queue-screen.test.tsx +6 -6
  122. package/src/queue-services/queue-service-form.scss +13 -13
  123. package/src/queue-services/queue-service-form.test.tsx +15 -8
  124. package/src/queue-table/cells/queue-table-action-cell.component.tsx +2 -2
  125. package/src/queue-table/cells/queue-table-coming-from-cell.component.tsx +1 -1
  126. package/src/queue-table/default-queue-table.component.tsx +63 -61
  127. package/src/queue-table/default-queue-table.test.tsx +61 -61
  128. package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.scss +36 -0
  129. package/src/queue-table/queue-entry-actions/queue-entry-actions.modal.tsx +30 -10
  130. package/src/queue-table/queue-entry-actions/queue-entry-actions.test.tsx +34 -103
  131. package/src/queue-table/queue-entry-actions/queue-entry-confirm-action.test.tsx +42 -25
  132. package/src/queue-table/queue-entry-actions/queue-entry-undo-actions.test.tsx +19 -14
  133. package/src/queue-table/queue-table-by-status-skeleton.component.tsx +1 -5
  134. package/src/queue-table/queue-table-expanded-row.component.tsx +1 -2
  135. package/src/queue-table/queue-table-metrics-card.scss +7 -7
  136. package/src/queue-table/queue-table-metrics.scss +3 -3
  137. package/src/queue-table/queue-table.component.tsx +8 -11
  138. package/src/queue-table/queue-table.scss +32 -26
  139. package/src/queue-table/queue-table.test.tsx +46 -21
  140. package/src/remove-queue-entry-dialog/remove-queue-entry.resource.ts +1 -1
  141. package/src/remove-queue-entry-dialog/remove-queue-entry.scss +2 -2
  142. package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +13 -12
  143. package/src/side-menu/side-menu.test.tsx +0 -1
  144. package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +1 -1
  145. package/src/transition-queue-entry/transition-queue-entry-dialog.scss +5 -5
  146. package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +33 -44
  147. package/src/views/queue-tables-for-all-statuses.component.tsx +14 -14
  148. package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +1 -1
  149. package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +1 -1
  150. package/src/visits-missing-inqueue/visits-missing-inqueue.scss +17 -14
  151. package/translations/am.json +4 -2
  152. package/translations/ar.json +4 -2
  153. package/translations/en.json +1 -0
  154. package/translations/es.json +4 -2
  155. package/translations/fr.json +39 -37
  156. package/translations/he.json +4 -2
  157. package/translations/km.json +4 -2
  158. package/translations/zh.json +4 -2
  159. package/translations/zh_CN.json +4 -2
  160. package/dist/276.js +0 -1
  161. package/dist/276.js.map +0 -1
  162. package/dist/384.js +0 -2
  163. package/dist/384.js.map +0 -1
  164. package/dist/401.js +0 -1
  165. package/dist/401.js.map +0 -1
  166. package/dist/430.js +0 -1
  167. package/dist/430.js.map +0 -1
  168. package/dist/60.js +0 -1
  169. package/dist/60.js.map +0 -1
  170. package/dist/600.js +0 -1
  171. package/dist/600.js.map +0 -1
  172. package/dist/647.js +0 -1
  173. package/dist/647.js.map +0 -1
  174. package/dist/650.js +0 -1
  175. package/dist/650.js.map +0 -1
  176. package/dist/669.js +0 -1
  177. package/dist/669.js.map +0 -1
  178. package/dist/764.js +0 -1
  179. package/dist/764.js.map +0 -1
  180. package/dist/877.js +0 -1
  181. package/dist/877.js.map +0 -1
  182. package/dist/917.js +0 -1
  183. package/dist/917.js.map +0 -1
  184. package/src/queue-table/queue-entry-actions/queue-entry-actons-modal.scss +0 -36
  185. package/src/root.scss +0 -15
  186. /package/dist/{384.js.LICENSE.txt → 484.js.LICENSE.txt} +0 -0
@@ -1,9 +1,9 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .medicationContainer {
6
- margin-bottom: spacing.$spacing-06;
6
+ margin-bottom: layout.$spacing-06;
7
7
  }
8
8
 
9
9
  .medicationRecord {
@@ -28,7 +28,7 @@
28
28
 
29
29
  .dosage {
30
30
  @include type.type-style('heading-compact-01');
31
- margin-left: spacing.$spacing-03;
31
+ margin-left: layout.$spacing-03;
32
32
  }
33
33
 
34
34
  .date {
@@ -39,13 +39,13 @@
39
39
  .metadata {
40
40
  @include type.type-style('label-01');
41
41
  color: $text-02;
42
- margin: spacing.$spacing-02 0;
42
+ margin: layout.$spacing-02 0;
43
43
  }
44
44
 
45
45
  .label01 {
46
46
  @include type.type-style('label-01');
47
47
  color: $text-02;
48
- margin: spacing.$spacing-02 0;
48
+ margin: layout.$spacing-02 0;
49
49
  }
50
50
 
51
51
  .notesSubHeading {
@@ -54,5 +54,5 @@
54
54
  }
55
55
 
56
56
  .notesContainer {
57
- margin: spacing.$spacing-05 0 spacing.$spacing-05;
57
+ margin: layout.$spacing-05 0 layout.$spacing-05;
58
58
  }
@@ -12,7 +12,7 @@ interface PastVisitProps {
12
12
 
13
13
  const PastVisit: React.FC<PastVisitProps> = ({ patientUuid }) => {
14
14
  const { t } = useTranslation();
15
- const { visits, isError, isLoading } = usePastVisits(patientUuid);
15
+ const { visits, isLoading } = usePastVisits(patientUuid);
16
16
 
17
17
  if (isLoading) {
18
18
  return <StructuredListSkeleton role="progressbar" />;
@@ -25,7 +25,7 @@ export function usePastVisits(patientUuid: string) {
25
25
 
26
26
  return {
27
27
  visits: data ? previousVisit : null,
28
- isError: error,
28
+ error,
29
29
  isLoading,
30
30
  isValidating,
31
31
  };
@@ -1,9 +1,9 @@
1
- @use '@carbon/styles/scss/type';
2
- @use '@carbon/styles/scss/spacing';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .wrapper {
6
- margin-top: spacing.$spacing-03;
6
+ margin-top: layout.$spacing-03;
7
7
  }
8
8
 
9
9
  .bodyShort02 {
@@ -17,7 +17,7 @@
17
17
  .date {
18
18
  @include type.type-style('label-01');
19
19
  color: $text-02;
20
- margin: spacing.$spacing-03 0rem spacing.$spacing-03;
20
+ margin: layout.$spacing-03 0 layout.$spacing-03;
21
21
  }
22
22
 
23
23
  .visitType {
@@ -26,19 +26,19 @@
26
26
 
27
27
  .container {
28
28
  background-color: $ui-background;
29
- padding: spacing.$spacing-03;
30
- margin: spacing.$spacing-03 0rem spacing.$spacing-03;
29
+ padding: layout.$spacing-03;
30
+ margin: layout.$spacing-03 0 layout.$spacing-03;
31
31
  width: 100%;
32
32
  }
33
33
 
34
34
  .tabs > :global(.cds--tab-content) {
35
- padding: spacing.$spacing-05 0rem !important;
35
+ padding: layout.$spacing-05 0 !important;
36
36
  }
37
37
 
38
38
  .header::after {
39
39
  content: '';
40
40
  display: block;
41
- width: spacing.$spacing-07;
41
+ width: layout.$spacing-07;
42
42
  padding-top: 0.188rem;
43
43
  border-bottom: 0.375rem solid var(--brand-03);
44
44
  }
@@ -47,7 +47,7 @@
47
47
  background-color: $ui-background;
48
48
  display: grid;
49
49
  grid-template-columns: max-content auto;
50
- min-height: spacing.$spacing-13;
50
+ min-height: layout.$spacing-13;
51
51
  }
52
52
 
53
53
  .flexSections {
@@ -55,10 +55,10 @@
55
55
  }
56
56
 
57
57
  .verticalTabs {
58
- margin: spacing.$spacing-04 0;
58
+ margin: layout.$spacing-04 0;
59
59
 
60
60
  &:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item + .cds--tabs--scrollable__nav-item) {
61
- margin-left: 0rem;
61
+ margin-left: 0;
62
62
  }
63
63
 
64
64
  > ul {
@@ -76,13 +76,13 @@
76
76
 
77
77
  .desktopTabs {
78
78
  button {
79
- height: spacing.$spacing-07;
79
+ height: layout.$spacing-07;
80
80
  }
81
81
  }
82
82
 
83
83
  .tabletTabs {
84
84
  button {
85
- height: spacing.$spacing-09;
85
+ height: layout.$spacing-09;
86
86
  }
87
87
  }
88
88
 
@@ -99,13 +99,13 @@
99
99
  border-left: 3px solid var(--brand-03);
100
100
  border-bottom: none;
101
101
  font-weight: 600;
102
- margin-left: 0rem !important;
102
+ margin-left: 0 !important;
103
103
  }
104
104
 
105
105
  &[aria-selected='false'] {
106
106
  border-bottom: none;
107
107
  border-left: 2px solid $ui-03;
108
- margin-left: 0rem !important;
108
+ margin-left: 0 !important;
109
109
  }
110
110
  }
111
111
 
@@ -117,7 +117,7 @@
117
117
 
118
118
  .tabContent {
119
119
  border-top: 1px solid $ui-03;
120
- padding: spacing.$spacing-05 0;
120
+ padding: layout.$spacing-05 0;
121
121
  width: 70%;
122
122
  }
123
123
 
@@ -1,41 +1,36 @@
1
1
  import React from 'react';
2
2
  import { screen } from '@testing-library/react';
3
- import PastVisitSummary from './past-visit-details/past-visit-summary.component';
4
3
  import userEvent from '@testing-library/user-event';
5
4
  import { mockPastVisit } from '__mocks__';
6
5
  import { mockPatient, renderWithSwr } from 'tools';
7
6
  import { usePastVisits } from './past-visit.resource';
7
+ import PastVisitSummary from './past-visit-details/past-visit-summary.component';
8
8
 
9
- const mockUsePastVisits = usePastVisits as jest.Mock;
9
+ const mockUsePastVisits = jest.mocked(usePastVisits);
10
10
 
11
11
  jest.mock('./past-visit.resource', () => ({
12
12
  usePastVisits: jest.fn(),
13
13
  }));
14
14
 
15
- describe('PastVisit: ', () => {
15
+ describe('PastVisit', () => {
16
16
  it('renders an empty state when notes, encounters, medications, and vitals data is not available', async () => {
17
17
  const user = userEvent.setup();
18
18
 
19
19
  mockUsePastVisits.mockReturnValueOnce({
20
- data: mockPastVisit.data.results,
20
+ visits: mockPastVisit.data.results[0],
21
+ error: null,
22
+ isLoading: false,
23
+ isValidating: false,
21
24
  });
22
25
 
23
- renderPastVisitTabs();
26
+ renderWithSwr(<PastVisitSummary patientUuid={mockPatient.id} encounters={[]} />);
24
27
 
25
28
  expect(screen.queryAllByText(/vitals/i));
26
29
  const vitalsTab = screen.getByRole('tab', { name: /vitals/i });
27
-
28
30
  expect(vitalsTab).toBeInTheDocument();
29
-
30
31
  expect(screen.getByRole('tab', { name: /notes/i })).toBeInTheDocument();
31
32
  expect(screen.getByRole('tab', { name: /medications/i })).toBeInTheDocument();
32
-
33
33
  await user.click(vitalsTab);
34
-
35
34
  expect(vitalsTab).toHaveAttribute('aria-selected', 'true');
36
35
  });
37
36
  });
38
-
39
- function renderPastVisitTabs() {
40
- renderWithSwr(<PastVisitSummary patientUuid={mockPatient.id} encounters={[]} />);
41
- }
@@ -1,20 +1,20 @@
1
- @use '@carbon/styles/scss/colors';
2
- @use '@carbon/styles/scss/type';
3
- @use '@carbon/styles/scss/spacing';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .widgetCard {
7
7
  border: 1px solid colors.$blue-20;
8
8
  border-left: none;
9
9
  border-right: none;
10
10
  background-color: colors.$blue-10;
11
- padding: spacing.$spacing-05;
11
+ padding: layout.$spacing-05;
12
12
  }
13
13
 
14
14
  .title {
15
15
  @include type.type-style('heading-compact-01');
16
16
  color: $text-02;
17
- margin-bottom: spacing.$spacing-02;
17
+ margin-bottom: layout.$spacing-02;
18
18
  }
19
19
 
20
20
  .subtitle {
@@ -25,7 +25,7 @@
25
25
  .content {
26
26
  @include type.type-style('heading-compact-01');
27
27
  background-color: colors.$blue-10;
28
- padding: spacing.$spacing-05;
28
+ padding: layout.$spacing-05;
29
29
  border: 1px solid colors.$blue-20;
30
30
  }
31
31
 
@@ -1,16 +1,16 @@
1
1
  import React from 'react';
2
2
  import { screen } from '@testing-library/react';
3
3
  import { mockPatient, renderWithSwr } from 'tools';
4
- import AppointmentDetails from './appointment-details.component';
5
- import { usePastVisits } from './../past-visit/past-visit.resource';
6
4
  import { useAppointments } from './appointments.resource';
5
+ import { usePastVisits } from './../past-visit/past-visit.resource';
6
+ import AppointmentDetails from './appointment-details.component';
7
7
 
8
8
  const testProps = {
9
9
  patientUuid: mockPatient.id,
10
10
  };
11
11
 
12
- const mockUseAppointments = useAppointments as jest.Mock;
13
- const mockUsePastVisits = usePastVisits as jest.Mock;
12
+ const mockUseAppointments = jest.mocked(useAppointments);
13
+ const mockUsePastVisits = jest.mocked(usePastVisits);
14
14
 
15
15
  jest.mock('./../past-visit/past-visit.resource', () => ({
16
16
  usePastVisits: jest.fn(),
@@ -22,8 +22,13 @@ jest.mock('./appointments.resource', () => ({
22
22
 
23
23
  describe('RecentandUpcomingAppointments', () => {
24
24
  it('renders no data if past and upcoming visit is empty', async () => {
25
- mockUseAppointments.mockReturnValueOnce({ data: [] });
26
- mockUsePastVisits.mockReturnValueOnce({ data: [] });
25
+ mockUseAppointments.mockReturnValueOnce({
26
+ upcomingAppointment: null,
27
+ error: null,
28
+ isLoading: false,
29
+ isValidating: false,
30
+ });
31
+ mockUsePastVisits.mockReturnValueOnce({ visits: null, error: null, isLoading: false, isValidating: false });
27
32
  renderAppointments();
28
33
 
29
34
  expect(screen.getByText(/there is no last encounter to display for this patient/i)).toBeInTheDocument();
@@ -36,7 +36,7 @@ export function useAppointments(patientUuid: string, startDate: string) {
36
36
 
37
37
  return {
38
38
  upcomingAppointment: upcomingAppointment ? upcomingAppointment : null,
39
- isError: error,
39
+ error,
40
40
  isLoading,
41
41
  isValidating,
42
42
  };
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/type';
2
- @use '@carbon/styles/scss/spacing';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .container {
6
6
  border-bottom: 0.0125rem solid $color-gray-30;
@@ -10,7 +10,7 @@
10
10
 
11
11
  .patientInfoContainer {
12
12
  background-color: $ui-02;
13
- padding: 0 0 0 spacing.$spacing-05;
13
+ padding: 0 0 0 layout.$spacing-05;
14
14
  display: flex;
15
15
  align-items: center;
16
16
  min-height: 7rem;
@@ -18,7 +18,7 @@
18
18
 
19
19
  .activePatientInfoContainer {
20
20
  background-color: $color-blue-10;
21
- padding: 0 0 0 spacing.$spacing-05;
21
+ padding: 0 0 0 layout.$spacing-05;
22
22
  display: flex;
23
23
  align-items: center;
24
24
  min-height: 7rem;
@@ -29,14 +29,14 @@
29
29
  }
30
30
 
31
31
  .patientInfoContent {
32
- margin: spacing.$spacing-05 0 0 spacing.$spacing-05;
32
+ margin: layout.$spacing-05 0 0 layout.$spacing-05;
33
33
  width: 100%;
34
34
  }
35
35
 
36
36
  .demographics {
37
37
  @include type.type-style('body-compact-02');
38
38
  color: $text-02;
39
- margin-top: spacing.$spacing-02;
39
+ margin-top: layout.$spacing-02;
40
40
  }
41
41
 
42
42
  .identifier {
@@ -50,11 +50,11 @@
50
50
  align-items: center;
51
51
 
52
52
  & > button {
53
- min-height: 2rem;
53
+ min-height: layout.$spacing-07;
54
54
  }
55
55
  }
56
56
 
57
57
  .patientEditBtn {
58
58
  color: $ui-05;
59
- margin: spacing.$spacing-03;
59
+ margin: layout.$spacing-03;
60
60
  }
@@ -1,29 +1,18 @@
1
1
  import React from 'react';
2
- import userEvent from '@testing-library/user-event';
3
2
  import { screen, render } from '@testing-library/react';
4
3
  import { age } from '@openmrs/esm-framework';
5
4
  import { mockPatient, mockPatientWithLongName, mockPatientWithoutFormattedName } from 'tools';
6
5
  import PatientInfo from './patient-info.component';
7
6
 
8
- const mockAge = age as jest.Mock;
7
+ const mockAge = jest.mocked(age);
9
8
 
10
- jest.mock('@openmrs/esm-framework', () => {
11
- const originalModule = jest.requireActual('@openmrs/esm-framework');
12
- return {
13
- ...originalModule,
14
- age: jest.fn(),
15
- };
16
- });
17
-
18
- describe('Patient Info', () => {
9
+ describe('Patient info', () => {
19
10
  it.each([
20
11
  [mockPatient, 'Wilson, John'],
21
12
  [mockPatientWithLongName, 'family name, Some very long given name'],
22
13
  [mockPatientWithoutFormattedName, 'given middle family name'],
23
14
  ])(`should render patient info correctly`, async (patient, displayName) => {
24
- const user = userEvent.setup();
25
-
26
- mockAge.mockReturnValue(35);
15
+ mockAge.mockReturnValue('35');
27
16
 
28
17
  renderPatientInfo(patient);
29
18
 
@@ -47,7 +47,10 @@ const PatientQueueHeader: React.FC<PatientQueueHeaderProps> = ({ title, showLoca
47
47
  if (queueLocations.length === 1) {
48
48
  handleQueueLocationChange({ selectedItem: queueLocations[0] });
49
49
  }
50
- if (queueLocations.some((location) => location.id === userSession?.sessionLocation?.uuid)) {
50
+ if (
51
+ queueLocations.some((location) => location.id === userSession?.sessionLocation?.uuid) &&
52
+ currentQueueLocationUuid
53
+ ) {
51
54
  handleQueueLocationChange({
52
55
  selectedItem: {
53
56
  id: userSession?.sessionLocation?.uuid,
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/type';
2
- @use '@carbon/styles/scss/spacing';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .header {
6
6
  @include type.type-style('body-compact-02');
@@ -10,7 +10,7 @@
10
10
  border-left: 0px;
11
11
  display: flex;
12
12
  justify-content: space-between;
13
- padding-right: 1rem;
13
+ padding-right: layout.$spacing-05;
14
14
  }
15
15
 
16
16
  .left-justified-items {
@@ -22,7 +22,7 @@
22
22
  .right-justified-items {
23
23
  @include type.type-style('body-compact-02');
24
24
  color: $text-02;
25
- padding-top: 1rem;
25
+ padding-top: layout.$spacing-05;
26
26
  }
27
27
 
28
28
  .page-name {
@@ -31,7 +31,7 @@
31
31
 
32
32
  .page-labels {
33
33
  p:first-of-type {
34
- margin-bottom: 0.25rem;
34
+ margin-bottom: layout.$spacing-02;
35
35
  }
36
36
  }
37
37
 
@@ -42,11 +42,11 @@
42
42
  }
43
43
 
44
44
  .value {
45
- margin-left: 0.25rem;
45
+ margin-left: layout.$spacing-02;
46
46
  }
47
47
 
48
48
  .middot {
49
- margin: 0 0.5rem;
49
+ margin: 0 layout.$spacing-03;
50
50
  }
51
51
 
52
52
  .view {
@@ -57,7 +57,7 @@
57
57
  display: flex;
58
58
  align-items: center;
59
59
  justify-content: flex-end;
60
- margin-top: 0.5rem;
60
+ margin-top: layout.$spacing-03;
61
61
  }
62
62
 
63
63
  .dropdown {
@@ -67,7 +67,7 @@
67
67
  }
68
68
 
69
69
  :global(.cds--dropdown--inline .cds--list-box__menu) {
70
- left: -4rem;
70
+ left: -(layout.$spacing-10);
71
71
  }
72
72
  }
73
73
 
@@ -75,7 +75,7 @@
75
75
  html[dir='rtl'] {
76
76
  .date-and-location {
77
77
  margin-right: unset;
78
- margin-left: spacing.$spacing-05;
78
+ margin-left: layout.$spacing-05;
79
79
  & > svg:first-child {
80
80
  order: -1;
81
81
  }
@@ -21,7 +21,7 @@ function ClinicMetrics() {
21
21
  const layout = useLayoutType();
22
22
  const mutate = useMutateQueueEntries();
23
23
  const currentQueueLocation = useSelectedQueueLocationUuid();
24
- const { services } = useQueueServices(currentQueueLocation);
24
+ const { services } = useQueueServices();
25
25
  const currentService = useSelectedService();
26
26
  const { serviceCount } = useServiceMetricsCount(currentService?.serviceUuid, currentQueueLocation);
27
27
  const [initialSelectedItem, setInitialSelectItem] = useState(() => {
@@ -35,7 +35,7 @@ export function useActiveVisits() {
35
35
  return {
36
36
  activeVisitsCount: uniquePatientUUIDs.size,
37
37
  isLoading,
38
- isError: error,
38
+ error,
39
39
  isValidating,
40
40
  };
41
41
  }
@@ -51,7 +51,7 @@ export function useAverageWaitTime(serviceUuid: string, statusUuid: string) {
51
51
  return {
52
52
  waitTime: data ? data?.data : null,
53
53
  isLoading,
54
- isError: error,
54
+ error,
55
55
  isValidating,
56
56
  mutate,
57
57
  };
@@ -1,11 +1,11 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@openmrs/esm-styleguide/src/vars' as *;
3
3
 
4
4
  .cardContainer {
5
5
  background-color: $ui-02;
6
6
  display: flex;
7
7
  justify-content: space-between;
8
- padding: 0 spacing.$spacing-05 spacing.$spacing-07 spacing.$spacing-03;
8
+ padding: 0 layout.$spacing-05 layout.$spacing-07 layout.$spacing-03;
9
9
  flex-flow: row wrap;
10
- margin-top: -(spacing.$spacing-03);
10
+ margin-top: -(layout.$spacing-03);
11
11
  }
@@ -1,20 +1,26 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import { openmrsFetch, useConfig } from '@openmrs/esm-framework';
3
+ import {
4
+ type FetchResponse,
5
+ getDefaultsFromConfigSchema,
6
+ openmrsFetch,
7
+ useConfig,
8
+ useLocations,
9
+ useSession,
10
+ } from '@openmrs/esm-framework';
4
11
  import { mockMetrics, mockServiceTypes, mockLocations, mockSession } from '__mocks__';
12
+ import { type ConfigObject, configSchema } from '../config-schema';
5
13
  import ClinicMetrics from './clinic-metrics.component';
6
14
 
7
- const mockedOpenmrsFetch = openmrsFetch as jest.Mock;
8
- const mockedUseConfig = useConfig as jest.Mock;
15
+ const mockOpenmrsFetch = jest.mocked(openmrsFetch);
16
+ const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
17
+ const mockUseLocations = jest.mocked(useLocations);
18
+ const mockUseSession = jest.mocked(useSession);
9
19
 
10
- jest.mock('./queue-metrics.resource', () => {
11
- const originalModule = jest.requireActual('./queue-metrics.resource');
12
-
13
- return {
14
- ...originalModule,
15
- useServiceMetricsCount: jest.fn().mockReturnValue(5),
16
- };
17
- });
20
+ jest.mock('./queue-metrics.resource', () => ({
21
+ ...jest.requireActual('./queue-metrics.resource'),
22
+ useServiceMetricsCount: jest.fn().mockReturnValue(5),
23
+ }));
18
24
 
19
25
  jest.mock('../hooks/useQueues', () => {
20
26
  return {
@@ -22,44 +28,37 @@ jest.mock('../hooks/useQueues', () => {
22
28
  };
23
29
  });
24
30
 
25
- jest.mock('./clinic-metrics.resource', () => {
26
- const originalModule = jest.requireActual('./clinic-metrics.resource');
31
+ jest.mock('./clinic-metrics.resource', () => ({
32
+ ...jest.requireActual('./clinic-metrics.resource'),
33
+ useActiveVisits: jest.fn().mockReturnValue({
34
+ activeVisitsCount: mockMetrics.activeVisitsCount,
35
+ }),
36
+ useAverageWaitTime: jest.fn().mockReturnValue({ waitTime: mockMetrics.waitTime }),
37
+ }));
27
38
 
28
- return {
29
- ...originalModule,
30
- useAverageWaitTime: jest.fn().mockImplementation(() => ({ waitTime: mockMetrics.waitTime })),
31
- useActiveVisits: jest.fn().mockImplementation(() => ({ activeVisitsCount: mockMetrics.activeVisitsCount })),
32
- };
33
- });
34
-
35
- jest.mock('@openmrs/esm-framework', () => {
36
- const originalModule = jest.requireActual('@openmrs/esm-framework');
37
-
38
- return {
39
- ...originalModule,
40
- useLocations: jest.fn().mockImplementation(() => mockLocations.data),
41
- useSession: jest.fn().mockImplementation(() => mockSession.data),
42
- };
43
- });
44
-
45
- jest.mock('../helpers/helpers', () => {
46
- const originalModule = jest.requireActual('../helpers/helpers');
47
-
48
- return {
49
- ...originalModule,
50
- useSelectedServiceName: jest.fn().mockReturnValue('All'),
51
- };
52
- });
39
+ jest.mock('../helpers/helpers', () => ({
40
+ ...jest.requireActual('../helpers/helpers'),
41
+ useSelectedServiceName: jest.fn().mockReturnValue('All'),
42
+ }));
53
43
 
54
44
  describe('Clinic metrics', () => {
45
+ beforeEach(() => {
46
+ mockUseConfig.mockReturnValue({
47
+ ...getDefaultsFromConfigSchema(configSchema),
48
+ });
49
+ mockUseLocations.mockReturnValue(mockLocations.data.results);
50
+ mockUseSession.mockReturnValue(mockSession.data);
51
+ });
52
+
55
53
  it('renders a dashboard outlining metrics from the outpatient clinic', async () => {
56
- mockedUseConfig.mockReturnValue({
54
+ mockUseConfig.mockReturnValue({
55
+ ...getDefaultsFromConfigSchema(configSchema),
57
56
  visitQueueNumberAttributeUuid: 'c61ce16f-272a-41e7-9924-4c555d0932c5',
58
57
  });
59
58
 
60
- mockedOpenmrsFetch.mockReturnValue({ data: mockMetrics });
59
+ mockOpenmrsFetch.mockResolvedValue({ data: mockMetrics } as unknown as FetchResponse);
61
60
 
62
- renderClinicMetrics();
61
+ render(<ClinicMetrics />);
63
62
 
64
63
  await screen.findByText(/Checked in patients/i);
65
64
  expect(screen.getByText(/100/i)).toBeInTheDocument();
@@ -70,7 +69,3 @@ describe('Clinic metrics', () => {
70
69
  expect(screen.getByText(/69/i)).toBeInTheDocument();
71
70
  });
72
71
  });
73
-
74
- function renderClinicMetrics() {
75
- render(<ClinicMetrics />);
76
- }