@kenyaemr/esm-service-queues-app 7.0.3-pre.89 → 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,15 +1,12 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { render, screen } from '@testing-library/react';
4
+ import { type ConfigObject, configSchema } from '../config-schema';
5
+ import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
4
6
  import { mockAppointmentsData } from '__mocks__';
5
7
  import AppointmentsTable from './scheduled-appointments-table.component';
6
8
 
7
- jest.mock('@openmrs/esm-framework', () => ({
8
- ...jest.requireActual('@openmrs/esm-framework'),
9
- useConfig: () => ({
10
- appointmentStatuses: ['All', 'Scheduled', 'Completed'],
11
- }),
12
- }));
9
+ const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
13
10
 
14
11
  jest.mock('./queue-linelist.resource', () => ({
15
12
  useAppointments: () => ({
@@ -19,6 +16,13 @@ jest.mock('./queue-linelist.resource', () => ({
19
16
  }));
20
17
 
21
18
  describe('AppointmentsTable', () => {
19
+ beforeEach(() => {
20
+ mockUseConfig.mockReturnValue({
21
+ ...getDefaultsFromConfigSchema(configSchema),
22
+ appointmentStatuses: ['All', 'Scheduled', 'Completed'],
23
+ });
24
+ });
25
+
22
26
  it('renders appointments when loading is complete', () => {
23
27
  render(<AppointmentsTable />);
24
28
 
@@ -28,7 +32,6 @@ describe('AppointmentsTable', () => {
28
32
 
29
33
  it('filters appointments based on status selection', async () => {
30
34
  const user = userEvent.setup();
31
-
32
35
  render(<AppointmentsTable />);
33
36
 
34
37
  const statusDropdown = screen.getAllByLabelText('Status:');
@@ -1,18 +1,18 @@
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
  $overlay-header-height: 5.5rem;
6
6
 
7
7
  .heading {
8
8
  @include type.type-style('heading-compact-01');
9
- margin: spacing.$spacing-05 0 spacing.$spacing-05;
9
+ margin: layout.$spacing-05 0 layout.$spacing-05;
10
10
  }
11
11
 
12
12
  .warningContainer {
13
13
  background-color: $carbon--red-50;
14
- padding: spacing.$spacing-04;
15
- margin: spacing.$spacing-03 0 spacing.$spacing-03;
14
+ padding: layout.$spacing-04;
15
+ margin: layout.$spacing-03 0 layout.$spacing-03;
16
16
  display: flex;
17
17
  justify-content: space-between;
18
18
  .warning {
@@ -29,16 +29,16 @@ $overlay-header-height: 5.5rem;
29
29
  }
30
30
 
31
31
  .grid {
32
- margin: 0 spacing.$spacing-05;
33
- padding: 0rem;
32
+ margin: 0 layout.$spacing-05;
33
+ padding: 0;
34
34
  }
35
35
 
36
36
  .input {
37
- margin-top: spacing.$spacing-04;
37
+ margin-top: layout.$spacing-04;
38
38
  }
39
39
 
40
40
  .button {
41
- height: spacing.$spacing-10;
41
+ height: layout.$spacing-10;
42
42
  display: flex;
43
43
  align-content: flex-start;
44
44
  align-items: baseline;
@@ -46,11 +46,11 @@ $overlay-header-height: 5.5rem;
46
46
  }
47
47
 
48
48
  .tablet {
49
- padding: spacing.$spacing-06 spacing.$spacing-05;
49
+ padding: layout.$spacing-06 layout.$spacing-05;
50
50
  background-color: $ui-02;
51
51
  }
52
52
 
53
53
  .desktop {
54
- padding: 0rem;
55
- margin-top: spacing.$spacing-05;
54
+ padding: 0;
55
+ margin-top: layout.$spacing-05;
56
56
  }
@@ -1,21 +1,23 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { render, screen } from '@testing-library/react';
4
+ import { useLayoutType } from '@openmrs/esm-framework';
4
5
  import QueueRoomForm from './queue-room-form.workspace';
5
6
 
6
- jest.mock('@openmrs/esm-framework', () => ({
7
- ...jest.requireActual('@openmrs/esm-framework'),
8
- useLayoutType: jest.fn(() => 'tablet'),
7
+ const mockUseLayoutType = jest.mocked(useLayoutType);
8
+
9
+ jest.mock('../patient-search/hooks/useQueueLocations', () => ({
10
+ ...jest.requireActual('../patient-search/hooks/useQueueLocations'),
9
11
  useQueueLocations: jest.fn(() => ({
10
12
  queueLocations: { uuid: 'e7786d9a-ab62-11ec-b909-0242ac120002', display: 'Location Test' },
11
13
  })),
12
- showSnackbar: jest.fn(),
13
14
  }));
14
15
 
15
16
  const workspaceProps = {
16
17
  closeWorkspace: jest.fn(),
17
18
  promptBeforeClosing: jest.fn(),
18
19
  closeWorkspaceWithSavedChanges: jest.fn(),
20
+ setTitle: jest.fn(),
19
21
  };
20
22
 
21
23
  jest.mock('./queue-room.resource', () => ({
@@ -23,6 +25,10 @@ jest.mock('./queue-room.resource', () => ({
23
25
  }));
24
26
 
25
27
  describe('QueueRoomForm', () => {
28
+ beforeEach(() => {
29
+ mockUseLayoutType.mockReturnValue('tablet');
30
+ });
31
+
26
32
  it('renders the form with queue room elements', () => {
27
33
  render(<QueueRoomForm {...workspaceProps} />);
28
34
 
@@ -39,7 +45,6 @@ describe('QueueRoomForm', () => {
39
45
  render(<QueueRoomForm {...workspaceProps} />);
40
46
 
41
47
  await user.click(screen.getByText('Save'));
42
-
43
48
  expect(screen.getByText('Missing queue room name')).toBeInTheDocument();
44
49
  });
45
50
 
@@ -52,7 +57,6 @@ describe('QueueRoomForm', () => {
52
57
 
53
58
  await user.type(queueRoomNameInput, 'Room 123');
54
59
  await user.click(screen.getByText('Save'));
55
-
56
60
  expect(screen.getByText('Missing queue room service')).toBeInTheDocument();
57
61
  });
58
62
 
@@ -63,7 +67,6 @@ describe('QueueRoomForm', () => {
63
67
  render(<QueueRoomForm {...{ ...workspaceProps, closeWorkspace }} />);
64
68
 
65
69
  await user.click(screen.getByText('Cancel'));
66
-
67
70
  expect(closeWorkspace).toHaveBeenCalledTimes(1);
68
71
  });
69
72
 
@@ -74,7 +77,6 @@ describe('QueueRoomForm', () => {
74
77
 
75
78
  const queueRoomNameInput = screen.getByLabelText('Queue room name');
76
79
  await user.type(queueRoomNameInput, 'Room 123');
77
-
78
80
  expect(queueRoomNameInput).toHaveValue('Room 123');
79
81
  });
80
82
  });
@@ -1,14 +1,16 @@
1
+ @use '@carbon/layout';
2
+
1
3
  .gridFlow {
2
4
  display: flex;
3
5
  flex-direction: row;
4
- padding: 2rem;
6
+ padding: layout.$spacing-07;
5
7
  flex-wrap: wrap;
6
8
  }
7
9
 
8
10
  .card {
9
11
  border-radius: 0.9rem;
10
12
  border: 1px solid #343332;
11
- margin: 1.5rem;
13
+ margin: layout.$spacing-06;
12
14
  padding: 1.3rem;
13
15
  width: 30%;
14
16
  text-align: center;
@@ -16,13 +18,13 @@
16
18
  }
17
19
 
18
20
  .header {
19
- font-size: 2rem;
21
+ font-size: layout.$spacing-07;
20
22
  font-weight: bold;
21
23
  color: black;
22
24
  }
23
25
 
24
26
  .headerBlinking {
25
- font-size: 2rem;
27
+ font-size: layout.$spacing-07;
26
28
  font-weight: bold;
27
29
  color: red;
28
30
  animation: blinker 1s linear infinite;
@@ -11,15 +11,15 @@ jest.mock('../helpers/helpers', () => ({
11
11
 
12
12
  describe('QueueScreen component', () => {
13
13
  test('renders loading skeleton when data is loading', () => {
14
- const mockedUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
15
- mockedUseActiveTickets.mockReturnValue({ isLoading: true, activeTickets: [], error: undefined, mutate: jest.fn() });
14
+ const mockUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
15
+ mockUseActiveTickets.mockReturnValue({ isLoading: true, activeTickets: [], error: undefined, mutate: jest.fn() });
16
16
  render(<QueueScreen />);
17
17
  expect(screen.getByRole('progressbar')).toBeInTheDocument();
18
18
  });
19
19
 
20
20
  test('renders error message when there is an error fetching data', () => {
21
- const mockedUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
22
- mockedUseActiveTickets.mockReturnValue({
21
+ const mockUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
22
+ mockUseActiveTickets.mockReturnValue({
23
23
  error: new Error('Error'),
24
24
  isLoading: false,
25
25
  activeTickets: [],
@@ -30,8 +30,8 @@ describe('QueueScreen component', () => {
30
30
  });
31
31
 
32
32
  test('renders table with active tickets when data is loaded', () => {
33
- const mockedUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
34
- mockedUseActiveTickets.mockReturnValue({
33
+ const mockUseActiveTickets = useActiveTickets as jest.MockedFunction<typeof useActiveTickets>;
34
+ mockUseActiveTickets.mockReturnValue({
35
35
  activeTickets: [
36
36
  {
37
37
  room: 'Room A',
@@ -1,16 +1,16 @@
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
  .heading {
6
6
  @include type.type-style('heading-compact-01');
7
- margin: spacing.$spacing-05 0 spacing.$spacing-05;
7
+ margin: layout.$spacing-05 0 layout.$spacing-05;
8
8
  }
9
9
 
10
10
  .warningContainer {
11
11
  background-color: $carbon--red-50;
12
- padding: spacing.$spacing-04;
13
- margin: spacing.$spacing-03 0 spacing.$spacing-03;
12
+ padding: layout.$spacing-04;
13
+ margin: layout.$spacing-03 0 layout.$spacing-03;
14
14
  display: flex;
15
15
  justify-content: space-between;
16
16
  .warning {
@@ -27,16 +27,16 @@
27
27
  }
28
28
 
29
29
  .grid {
30
- margin: 0 spacing.$spacing-05;
31
- padding: 0rem;
30
+ margin: 0 layout.$spacing-05;
31
+ padding: 0;
32
32
  }
33
33
 
34
34
  .input {
35
- margin-top: spacing.$spacing-04;
35
+ margin-top: layout.$spacing-04;
36
36
  }
37
37
 
38
38
  .button {
39
- height: spacing.$spacing-10;
39
+ height: layout.$spacing-10;
40
40
  display: flex;
41
41
  align-content: flex-start;
42
42
  align-items: baseline;
@@ -44,8 +44,8 @@
44
44
  }
45
45
 
46
46
  .buttonSet {
47
- padding: 0rem;
48
- margin-top: spacing.$spacing-05;
47
+ padding: 0;
48
+ margin-top: layout.$spacing-05;
49
49
  }
50
50
 
51
51
  /* Tablet */
@@ -55,7 +55,7 @@
55
55
  }
56
56
 
57
57
  .buttonSet {
58
- padding: spacing.$spacing-06 spacing.$spacing-05;
58
+ padding: layout.$spacing-06 layout.$spacing-05;
59
59
  background-color: $ui-02;
60
60
  }
61
61
  }
@@ -1,12 +1,17 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { render, screen } from '@testing-library/react';
4
+ import { useLayoutType } from '@openmrs/esm-framework';
4
5
  import QueueServiceForm from './queue-service-form.workspace';
5
6
 
6
- jest.mock('@openmrs/esm-framework', () => ({
7
- useLayoutType: () => 'desktop',
8
- showSnackbar: jest.fn(),
9
- }));
7
+ const defaultProps = {
8
+ closeWorkspace: jest.fn(),
9
+ promptBeforeClosing: jest.fn(),
10
+ closeWorkspaceWithSavedChanges: jest.fn(),
11
+ setTitle: jest.fn(),
12
+ };
13
+
14
+ const mockUseLayoutType = jest.mocked(useLayoutType);
10
15
 
11
16
  jest.mock('./queue-service.resource', () => ({
12
17
  useServiceConcepts: () => ({
@@ -28,22 +33,24 @@ jest.mock('../patient-search/hooks/useQueueLocations', () => ({
28
33
  }));
29
34
 
30
35
  describe('QueueServiceForm', () => {
36
+ beforeEach(() => {
37
+ mockUseLayoutType.mockReturnValue('tablet');
38
+ });
39
+
31
40
  it('should display required error messages when form is submitted with missing fields', async () => {
32
41
  const user = userEvent.setup();
33
42
 
34
- render(<QueueServiceForm toggleSearchType={() => {}} closePanel={() => {}} />);
43
+ render(<QueueServiceForm {...defaultProps} />);
35
44
 
36
45
  const submitButton = screen.getByText('Save');
37
-
38
46
  await user.click(submitButton);
39
-
40
47
  expect(screen.getByText('Missing queue name')).toBeInTheDocument();
41
48
  });
42
49
 
43
50
  it('should submit the form when all fields are filled', async () => {
44
51
  const user = userEvent.setup();
45
52
 
46
- render(<QueueServiceForm toggleSearchType={() => {}} closePanel={() => {}} />);
53
+ render(<QueueServiceForm {...defaultProps} />);
47
54
 
48
55
  const queueNameInput = screen.getByLabelText('Queue name');
49
56
  const serviceSelect = screen.getByLabelText('Select a service type');
@@ -13,7 +13,7 @@ export function QueueTableActionCell({ queueEntry }: QueueTableCellComponentProp
13
13
  <div className={styles.actionsCell}>
14
14
  <Button
15
15
  kind="ghost"
16
- aria-label={t('actions', 'Actions')}
16
+ aria-label={t('transition', 'Transition')}
17
17
  onClick={() => {
18
18
  const dispose = showModal('transition-queue-entry-modal', {
19
19
  closeModal: () => dispose(),
@@ -23,7 +23,7 @@ export function QueueTableActionCell({ queueEntry }: QueueTableCellComponentProp
23
23
  size={isDesktop(layout) ? 'sm' : 'lg'}>
24
24
  {t('transition', 'Transition')}
25
25
  </Button>
26
- <OverflowMenu aria-label="Actions menu" size={isDesktop(layout) ? 'sm' : 'lg'} flipped>
26
+ <OverflowMenu aria-label="Actions menu" size={isDesktop(layout) ? 'sm' : 'lg'} align="left" flipped>
27
27
  <OverflowMenuItem
28
28
  className={styles.menuItem}
29
29
  aria-label={t('edit', 'Edit')}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { type QueueTableColumnFunction, type QueueTableCellComponentProps } from '../../types';
3
3
 
4
4
  export const QueueTableComingFromCell = ({ queueEntry }: QueueTableCellComponentProps) => {
5
- return <>{queueEntry.queueComingFrom?.display}</>;
5
+ return <>{queueEntry.queueComingFrom?.display ?? '--'}</>;
6
6
  };
7
7
 
8
8
  export const queueTableComingFromColumn: QueueTableColumnFunction = (key, header) => ({
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
- import { DataTableSkeleton, Dropdown, TableToolbarSearch } from '@carbon/react';
2
+ import { DataTableSkeleton, Dropdown, Layer, TableToolbarSearch } from '@carbon/react';
3
3
  import { Add } from '@carbon/react/icons';
4
4
  import {
5
5
  closeWorkspace,
@@ -11,7 +11,6 @@ import {
11
11
  useLayoutType,
12
12
  } from '@openmrs/esm-framework';
13
13
  import { useTranslation } from 'react-i18next';
14
- import ClearQueueEntries from '../clear-queue-entries-dialog/clear-queue-entries.component';
15
14
  import {
16
15
  updateSelectedQueueStatus,
17
16
  updateSelectedService,
@@ -19,13 +18,14 @@ import {
19
18
  useSelectedQueueStatus,
20
19
  useSelectedService,
21
20
  } from '../helpers/helpers';
21
+ import { useColumns } from './cells/columns.resource';
22
+ import useQueueStatuses from '../hooks/useQueueStatuses';
23
+ import useQueueServices from '../hooks/useQueueService';
24
+ import ClearQueueEntries from '../clear-queue-entries-dialog/clear-queue-entries.component';
22
25
  import { useMutateQueueEntries, useQueueEntries } from '../hooks/useQueueEntries';
23
26
  import QueueTableExpandedRow from './queue-table-expanded-row.component';
24
27
  import QueueTable from './queue-table.component';
25
28
  import styles from './queue-table.scss';
26
- import { useColumns } from './cells/columns.resource';
27
- import useQueueStatuses from '../hooks/useQueueStatuses';
28
- import useQueueServices from '../hooks/useQueueService';
29
29
 
30
30
  const serviceQueuesPatientSearchWorkspace = 'service-queues-patient-search';
31
31
 
@@ -91,63 +91,65 @@ function DefaultQueueTable() {
91
91
  }, [queueEntries, searchTerm]);
92
92
 
93
93
  return (
94
- <div className={styles.container}>
95
- <div className={styles.headerContainer}>
96
- <div className={!isDesktop(layout) ? styles.tabletHeading : styles.desktopHeading}>
97
- <h4>{t('patientsCurrentlyInQueue', 'Patients currently in queue')}</h4>
98
- </div>
99
- <div className={styles.headerButtons}>
100
- <ExtensionSlot
101
- name="patient-search-button-slot"
102
- state={{
103
- isOpen: isPatientSearchOpen,
104
- searchQuery: patientSearchQuery,
105
- buttonText: t('addPatientToQueue', 'Add patient to queue'),
106
- overlayHeader: t('addPatientToQueue', 'Add patient to queue'),
107
- buttonProps: {
108
- kind: 'secondary',
109
- renderIcon: (props) => <Add size={16} {...props} />,
110
- size: 'sm',
111
- },
112
- searchQueryUpdatedAction: (searchQuery: string) => {
113
- setPatientSearchQuery(searchQuery);
114
- },
115
- selectPatientAction: (selectedPatientUuid: string) => {
116
- setIsPatientSearchOpen(false);
117
- launchWorkspace(serviceQueuesPatientSearchWorkspace, {
118
- selectedPatientUuid,
119
- currentServiceQueueUuid: selectedService?.serviceUuid,
120
- handleBackToSearchList,
121
- });
122
- },
123
- }}
124
- />
125
- </div>
126
- </div>
127
- {!isLoading ? (
128
- <div className={styles.paddedQueueTable}>
129
- <QueueTable
130
- queueEntries={filteredQueueEntries ?? []}
131
- isValidating={isValidating}
132
- queueUuid={null}
133
- statusUuid={null}
134
- ExpandedRow={QueueTableExpandedRow}
135
- tableFilter={[
136
- <QueueDropdownFilter />,
137
- <StatusDropdownFilter />,
138
- <TableToolbarSearch
139
- className={styles.search}
140
- onChange={(e) => setSearchTerm(e.target.value)}
141
- placeholder={t('searchThisList', 'Search this list')}
142
- size={isDesktop(layout) ? 'sm' : 'lg'}
143
- />,
144
- <ClearQueueEntries queueEntries={filteredQueueEntries} />,
145
- ]}
146
- />
94
+ <div className={styles.defaultQueueTable}>
95
+ <Layer className={styles.container}>
96
+ <div className={styles.headerContainer}>
97
+ <div className={!isDesktop(layout) ? styles.tabletHeading : styles.desktopHeading}>
98
+ <h4>{t('patientsCurrentlyInQueue', 'Patients currently in queue')}</h4>
99
+ </div>
100
+ <div className={styles.headerButtons}>
101
+ <ExtensionSlot
102
+ name="patient-search-button-slot"
103
+ state={{
104
+ isOpen: isPatientSearchOpen,
105
+ searchQuery: patientSearchQuery,
106
+ buttonText: t('addPatientToQueue', 'Add patient to queue'),
107
+ overlayHeader: t('addPatientToQueue', 'Add patient to queue'),
108
+ buttonProps: {
109
+ kind: 'secondary',
110
+ renderIcon: (props) => <Add size={16} {...props} />,
111
+ size: 'sm',
112
+ },
113
+ searchQueryUpdatedAction: (searchQuery: string) => {
114
+ setPatientSearchQuery(searchQuery);
115
+ },
116
+ selectPatientAction: (selectedPatientUuid: string) => {
117
+ setIsPatientSearchOpen(false);
118
+ launchWorkspace(serviceQueuesPatientSearchWorkspace, {
119
+ selectedPatientUuid,
120
+ currentServiceQueueUuid: selectedService?.serviceUuid,
121
+ handleBackToSearchList,
122
+ });
123
+ },
124
+ }}
125
+ />
126
+ </div>
147
127
  </div>
148
- ) : (
149
- <DataTableSkeleton role="progressbar" />
150
- )}
128
+ {!isLoading ? (
129
+ <div>
130
+ <QueueTable
131
+ queueEntries={filteredQueueEntries ?? []}
132
+ isValidating={isValidating}
133
+ queueUuid={null}
134
+ statusUuid={null}
135
+ ExpandedRow={QueueTableExpandedRow}
136
+ tableFilter={[
137
+ <QueueDropdownFilter />,
138
+ <StatusDropdownFilter />,
139
+ <TableToolbarSearch
140
+ className={styles.search}
141
+ onChange={(e) => setSearchTerm(e.target.value)}
142
+ placeholder={t('searchThisList', 'Search this list')}
143
+ size={isDesktop(layout) ? 'sm' : 'lg'}
144
+ />,
145
+ <ClearQueueEntries queueEntries={filteredQueueEntries} />,
146
+ ]}
147
+ />
148
+ </div>
149
+ ) : (
150
+ <DataTableSkeleton role="progressbar" />
151
+ )}
152
+ </Layer>
151
153
  </div>
152
154
  );
153
155
  }