@kenyaemr/esm-appointments-app 7.0.3-pre.89 → 8.0.0

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 (112) hide show
  1. package/.turbo/turbo-build.log +23 -22
  2. package/dist/130.js +1 -1
  3. package/dist/130.js.map +1 -1
  4. package/dist/23.js +2 -0
  5. package/dist/23.js.map +1 -0
  6. package/dist/265.js +1 -1
  7. package/dist/271.js +1 -1
  8. package/dist/319.js +1 -1
  9. package/dist/460.js +1 -1
  10. package/dist/529.js +1 -1
  11. package/dist/574.js +1 -1
  12. package/dist/581.js +1 -0
  13. package/dist/581.js.map +1 -0
  14. package/dist/644.js +1 -1
  15. package/dist/646.js +2 -0
  16. package/dist/646.js.map +1 -0
  17. package/dist/757.js +1 -1
  18. package/dist/788.js +1 -1
  19. package/dist/807.js +1 -1
  20. package/dist/833.js +1 -1
  21. package/dist/85.js +1 -0
  22. package/dist/85.js.map +1 -0
  23. package/dist/89.js +1 -0
  24. package/dist/89.js.map +1 -0
  25. package/dist/kenyaemr-esm-appointments-app.js +1 -1
  26. package/dist/kenyaemr-esm-appointments-app.js.buildmanifest.json +167 -143
  27. package/dist/kenyaemr-esm-appointments-app.js.map +1 -1
  28. package/dist/main.js +1 -1
  29. package/dist/main.js.map +1 -1
  30. package/dist/routes.json +1 -1
  31. package/package.json +2 -3
  32. package/src/admin/appointment-services/appointment-services.scss +5 -5
  33. package/src/appointments/appointment-tabs.scss +6 -7
  34. package/src/appointments/appointment-tabs.test.tsx +4 -11
  35. package/src/appointments/common-components/appointments-actions.test.tsx +121 -74
  36. package/src/appointments/common-components/appointments-table.scss +6 -6
  37. package/src/appointments/common-components/appointments-table.test.tsx +30 -32
  38. package/src/appointments/common-components/end-appointment.test.tsx +20 -19
  39. package/src/appointments/details/appointment-details.component.tsx +1 -1
  40. package/src/appointments/details/appointment-details.scss +13 -13
  41. package/src/appointments/details/appointment-details.test.tsx +49 -48
  42. package/src/appointments/scheduled/scheduled-appointments.component.tsx +1 -1
  43. package/src/appointments/scheduled/scheduled-appointments.scss +3 -1
  44. package/src/appointments/unscheduled/unscheduled-appointments.test.tsx +35 -37
  45. package/src/appointments.component.tsx +0 -1
  46. package/src/calendar/appointments-calendar-view-view.scss +3 -4
  47. package/src/calendar/appointments-calendar-view.test.tsx +1 -5
  48. package/src/calendar/header/calendar-header.scss +4 -4
  49. package/src/calendar/monthly/days-of-week.scss +1 -1
  50. package/src/calendar/monthly/monthly-view-workload.scss +10 -10
  51. package/src/config-schema.ts +88 -90
  52. package/src/empty-state/empty-state.scss +4 -4
  53. package/src/form/appointments-form.component.tsx +58 -26
  54. package/src/form/appointments-form.resource.ts +2 -2
  55. package/src/form/appointments-form.scss +11 -11
  56. package/src/form/appointments-form.test.tsx +42 -43
  57. package/src/header/appointments-header.scss +12 -12
  58. package/src/home/home-appointments.scss +0 -1
  59. package/src/homepage-tile/appointments-tile.component.tsx +23 -0
  60. package/src/homepage-tile/appointments-tile.scss +39 -0
  61. package/src/homepage-tile/appointments.resource.ts +15 -0
  62. package/src/hooks/useClinicalMetrics.ts +1 -1
  63. package/src/hooks/useDefaultLocation.ts +1 -1
  64. package/src/hooks/usePatientAppointmentHistory.ts +1 -1
  65. package/src/hooks/useProviders.ts +1 -1
  66. package/src/index.ts +5 -0
  67. package/src/metrics/appointments-metrics.scss +0 -1
  68. package/src/metrics/appointments-metrics.test.tsx +25 -31
  69. package/src/metrics/metrics-card.component.tsx +6 -33
  70. package/src/metrics/metrics-card.scss +8 -8
  71. package/src/metrics/metrics-header.scss +1 -1
  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 +19 -14
  75. package/src/patient-appointments/patient-appointments-action-menu.scss +6 -0
  76. package/src/patient-appointments/patient-appointments-base.component.tsx +6 -6
  77. package/src/patient-appointments/patient-appointments-base.scss +24 -29
  78. package/src/patient-appointments/patient-appointments-base.test.tsx +13 -11
  79. package/src/patient-appointments/patient-appointments-header.scss +4 -5
  80. package/src/patient-appointments/patient-appointments-overview.component.tsx +2 -2
  81. package/src/patient-appointments/patient-appointments-overview.scss +0 -1
  82. package/src/patient-appointments/patient-appointments.resource.ts +1 -1
  83. package/src/patient-appointments/patient-upcoming-appointments-card.component.tsx +3 -3
  84. package/src/patient-appointments/patient-upcoming-appointments-card.scss +11 -10
  85. package/src/patient-search/patient-search.scss +15 -14
  86. package/src/routes.json +5 -0
  87. package/src/types/index.ts +4 -0
  88. package/src/workload/monthly-view-workload/monthly-workload.scss +21 -6
  89. package/src/workload/monthly-view-workload/monthlyWorkCard.tsx +2 -2
  90. package/src/workload/workload.scss +3 -3
  91. package/translations/am.json +2 -0
  92. package/translations/ar.json +2 -0
  93. package/translations/en.json +2 -0
  94. package/translations/es.json +2 -0
  95. package/translations/fr.json +30 -28
  96. package/translations/he.json +2 -0
  97. package/translations/km.json +2 -0
  98. package/translations/zh.json +2 -0
  99. package/translations/zh_CN.json +2 -0
  100. package/dist/224.js +0 -1
  101. package/dist/224.js.map +0 -1
  102. package/dist/445.js +0 -2
  103. package/dist/445.js.map +0 -1
  104. package/dist/857.js +0 -2
  105. package/dist/857.js.map +0 -1
  106. package/dist/904.js +0 -1
  107. package/dist/904.js.map +0 -1
  108. package/src/root.scss +0 -50
  109. /package/dist/{857.js.LICENSE.txt → 23.js.LICENSE.txt} +0 -0
  110. /package/dist/{445.js.LICENSE.txt → 646.js.LICENSE.txt} +0 -0
  111. /package/src/helpers/{time.tsx → time.ts} +0 -0
  112. /package/src/patient-appointments/{patient-appointments-table.tsx → patient-appointments-table.component.tsx} +0 -0
@@ -1,46 +1,47 @@
1
1
  import React from 'react';
2
+ import { of } from 'rxjs';
2
3
  import { render, screen } from '@testing-library/react';
3
4
  import userEvent from '@testing-library/user-event';
4
- import { updateVisit, showSnackbar, useVisit } from '@openmrs/esm-framework';
5
+ import { updateVisit, showSnackbar, useVisit, type VisitReturnType } from '@openmrs/esm-framework';
5
6
  import { changeAppointmentStatus } from '../../patient-appointments/patient-appointments.resource';
6
7
  import EndAppointmentModal from './end-appointment.modal';
7
8
 
8
9
  const closeModal = jest.fn();
10
+ const mockUseVisit = jest.mocked(useVisit);
11
+ const mockUpdateVisit = jest.mocked(updateVisit);
12
+
9
13
  jest.mock('../../patient-appointments/patient-appointments.resource', () => ({
10
14
  changeAppointmentStatus: jest.fn().mockResolvedValue({}),
11
15
  }));
12
16
 
13
- jest.mock('@openmrs/esm-framework', () => ({
14
- useVisit: jest.fn(),
15
- updateVisit: jest.fn().mockReturnValue({ toPromise: jest.fn().mockResolvedValue({}) }),
16
- showSnackbar: jest.fn(),
17
- parseDate: jest.fn(),
17
+ jest.mock('../../form/appointments-form.resource', () => ({
18
+ useMutateAppointments: jest.fn().mockReturnValue({ mutateAppointments: jest.fn() }),
18
19
  }));
19
20
 
20
21
  describe('EndAppointmentModal', () => {
21
- afterEach(() => {
22
- jest.clearAllMocks();
22
+ beforeEach(() => {
23
+ mockUpdateVisit.mockImplementation(() => of({}));
23
24
  });
24
25
 
25
- it('has a cancel button that closes the model', async () => {
26
- useVisit.mockReturnValue({});
26
+ it('has a cancel button that closes the modal', async () => {
27
27
  const user = userEvent.setup();
28
+
28
29
  render(<EndAppointmentModal appointmentUuid={'abc'} patientUuid={'123'} closeModal={closeModal} />);
30
+
29
31
  const cancelButton = screen.getByText('Cancel');
30
32
  await user.click(cancelButton);
31
33
  expect(closeModal).toHaveBeenCalled();
32
34
  });
33
35
 
34
36
  it('should update appointment status but not visit on submit if no active visit', async () => {
35
- useVisit.mockReturnValue({});
36
37
  const user = userEvent.setup();
37
38
 
38
39
  render(<EndAppointmentModal appointmentUuid={'abc'} patientUuid={'123'} closeModal={closeModal} />);
39
40
 
40
41
  const submitButton = screen.getByRole('button', { name: /check out/i });
41
- expect(submitButton).not.toBeDisabled();
42
- await user.click(submitButton);
42
+ expect(submitButton).toBeEnabled();
43
43
 
44
+ await user.click(submitButton);
44
45
  expect(changeAppointmentStatus).toHaveBeenCalledWith('Completed', 'abc');
45
46
  expect(useVisit).toHaveBeenCalledWith('123');
46
47
  expect(updateVisit).not.toHaveBeenCalled();
@@ -54,18 +55,18 @@ describe('EndAppointmentModal', () => {
54
55
  });
55
56
 
56
57
  it('should update appointment status and visit on submit if active visit', async () => {
57
- useVisit.mockReturnValue({
58
- mutate: jest.fn(),
59
- activeVisit: { location: { uuid: 'def' }, visitType: { uuid: 'ghi' }, startDatetime: new Date() },
60
- });
61
58
  const user = userEvent.setup();
62
59
 
60
+ mockUseVisit.mockReturnValue({
61
+ activeVisit: { location: { uuid: 'def' }, visitType: { uuid: 'ghi' }, startDatetime: new Date() },
62
+ mutate: jest.fn(),
63
+ } as unknown as VisitReturnType);
64
+
63
65
  render(<EndAppointmentModal appointmentUuid={'abc'} patientUuid={'123'} closeModal={closeModal} />);
64
66
 
65
67
  const submitButton = screen.getByRole('button', { name: /check out/i });
66
- expect(submitButton).not.toBeDisabled();
68
+ expect(submitButton).toBeEnabled();
67
69
  await user.click(submitButton);
68
-
69
70
  expect(changeAppointmentStatus).toHaveBeenCalledWith('Completed', 'abc');
70
71
  expect(useVisit).toHaveBeenCalledWith('123');
71
72
  expect(updateVisit).toHaveBeenCalled();
@@ -51,7 +51,7 @@ const AppointmentDetails: React.FC<AppointmentDetailsProps> = ({ appointment })
51
51
  )}
52
52
  {patient && patient?.telecom
53
53
  ? patient.telecom.map((contact, i) => (
54
- <div className={styles.labelContainer}>
54
+ <div key={i} className={styles.labelContainer}>
55
55
  <p className={styles.labelBold}>{t('Contact', 'Contact {{index}}', { index: i + 1 })}: </p>
56
56
  <p className={styles.label}>{contact.value}</p>
57
57
  </div>
@@ -1,12 +1,12 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
3
  @use '@carbon/colors';
4
4
 
5
5
  .appointmentDetailsContainer {
6
6
  min-height: fit-content;
7
7
  background-color: colors.$white;
8
- padding: spacing.$spacing-05;
9
- margin: spacing.$spacing-03;
8
+ padding: layout.$spacing-05;
9
+ margin: layout.$spacing-03;
10
10
  }
11
11
 
12
12
  .title {
@@ -20,9 +20,9 @@
20
20
  }
21
21
 
22
22
  .tags {
23
- margin-top: spacing.$spacing-05;
23
+ margin-top: layout.$spacing-05;
24
24
  display: flex;
25
- column-gap: spacing.$spacing-03;
25
+ column-gap: layout.$spacing-03;
26
26
 
27
27
  & > div {
28
28
  margin: 0;
@@ -32,13 +32,13 @@
32
32
  .patientInfoGrid {
33
33
  display: grid;
34
34
  grid-template-columns: 1fr 1fr 1fr;
35
- column-gap: spacing.$spacing-05;
36
- margin-top: spacing.$spacing-05;
35
+ column-gap: layout.$spacing-05;
36
+ margin-top: layout.$spacing-05;
37
37
  }
38
38
 
39
39
  .gridTitle {
40
40
  @include type.type-style('label-02');
41
- margin-bottom: spacing.$spacing-04;
41
+ margin-bottom: layout.$spacing-04;
42
42
  color: colors.$gray-70;
43
43
  }
44
44
 
@@ -50,7 +50,7 @@
50
50
  .historyGrid {
51
51
  display: grid;
52
52
  grid-template-columns: 1fr 1fr;
53
- row-gap: spacing.$spacing-05;
53
+ row-gap: layout.$spacing-05;
54
54
  }
55
55
 
56
56
  .historyGridLabel {
@@ -59,13 +59,13 @@
59
59
  }
60
60
  .historyGridCount {
61
61
  @include type.type-style('heading-02');
62
- margin-top: spacing.$spacing-01;
62
+ margin-top: layout.$spacing-01;
63
63
  color: colors.$blue-60;
64
64
  }
65
65
 
66
66
  .historyGridCountRed {
67
67
  @include type.type-style('heading-02');
68
- margin-top: spacing.$spacing-01;
68
+ margin-top: layout.$spacing-01;
69
69
  color: colors.$red-60;
70
70
  }
71
71
 
@@ -73,7 +73,7 @@
73
73
  @include type.type-style('label-01');
74
74
  color: colors.$gray-70;
75
75
  font-weight: bold;
76
- margin-right: spacing.$spacing-02;
76
+ margin-right: layout.$spacing-02;
77
77
  }
78
78
 
79
79
  .labelContainer {
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { usePatient } from '@openmrs/esm-framework';
4
+ import { mockPatient } from 'tools';
5
+ import type { AppointmentKind, AppointmentStatus, Appointment } from '../../types';
3
6
  import AppointmentDetails from './appointment-details.component';
4
- import { type Appointment } from '../../types';
5
7
 
6
8
  const appointment: Appointment = {
7
9
  uuid: '7cd38a6d-377e-491b-8284-b04cf8b8c6d8',
@@ -17,17 +19,17 @@ const appointment: Appointment = {
17
19
  service: {
18
20
  appointmentServiceId: 1,
19
21
  name: 'Outpatient',
20
- description: null,
22
+ description: '',
21
23
  startTime: '',
22
24
  endTime: '',
23
25
  maxAppointmentsLimit: null,
24
- durationMins: null,
26
+ durationMins: undefined,
25
27
  location: {
26
28
  uuid: '8d6c993e-c2cc-11de-8d13-0010c6dffd0f',
27
29
  },
28
30
  uuid: 'e2ec9cf0-ec38-4d2b-af6c-59c82fa30b90',
29
31
  initialAppointmentStatus: 'Scheduled',
30
- creatorName: null,
32
+ creatorName: '',
31
33
  },
32
34
  provider: {
33
35
  uuid: 'f9badd80-ab76-11e2-9e96-0800200c9a66',
@@ -36,17 +38,20 @@ const appointment: Appointment = {
36
38
  location: { name: 'HIV Clinic', uuid: '2131aff8-2e2a-480a-b7ab-4ac53250262b' },
37
39
  startDateTime: 1630326900000,
38
40
  endDateTime: 1630327200000,
39
- appointmentKind: 'WalkIn',
40
- status: 'Scheduled',
41
+ appointmentKind: 'WalkIn' as AppointmentKind.WALKIN,
42
+ status: 'Scheduled' as AppointmentStatus.SCHEDULED,
41
43
  comments: 'Some comments',
42
44
  additionalInfo: null,
43
45
  providers: [{ uuid: '24252571-dd5a-11e6-9d9c-0242ac150002', display: 'Dr James Cook' }],
44
46
  recurring: false,
45
47
  voided: false,
48
+ dateAppointmentScheduled: '',
46
49
  teleconsultationLink: null,
47
50
  extensions: [],
48
51
  };
49
52
 
53
+ const mockUsePatient = jest.mocked(usePatient);
54
+
50
55
  jest.mock('../../hooks/usePatientAppointmentHistory', () => ({
51
56
  usePatientAppointmentHistory: () => ({
52
57
  appointmentsCount: {
@@ -58,46 +63,42 @@ jest.mock('../../hooks/usePatientAppointmentHistory', () => ({
58
63
  }),
59
64
  }));
60
65
 
61
- jest.mock('@openmrs/esm-framework', () => {
62
- const originalModule = jest.requireActual('@openmrs/esm-framework');
63
- return {
64
- ...originalModule,
65
- usePatient: jest.fn().mockImplementation((...args) => ({
66
- patient: {
67
- birthDate: '22-Mar-2020',
68
- telecom: [
69
- {
70
- uuid: 'tel-uuid-1',
71
- value: '0899129989932',
72
- },
73
- ],
74
- },
75
- })),
76
- };
77
- });
78
-
79
66
  test('renders appointment details correctly', async () => {
80
- const { getByText } = render(<AppointmentDetails appointment={appointment} />);
81
- expect(getByText(/Patient name/i)).toBeInTheDocument();
82
- expect(getByText(/John Wilson/i)).toBeInTheDocument();
83
- expect(getByText(/Age/i)).toBeInTheDocument();
84
- expect(getByText(/34/i)).toBeInTheDocument();
85
- expect(getByText(/Gender/i)).toBeInTheDocument();
86
- expect(getByText(/Male/i)).toBeInTheDocument();
87
- expect(getByText(/Date of birth/i)).toBeInTheDocument();
88
- expect(getByText(/Date of birth/i)).toBeInTheDocument();
89
- expect(getByText(/22-Mar-2020/i)).toBeInTheDocument();
90
- expect(getByText(/Contact 1/i)).toBeInTheDocument();
91
- expect(getByText(/0899129989932/i)).toBeInTheDocument();
92
- expect(getByText(/Appointment Notes/i)).toBeInTheDocument();
93
- expect(getByText(/Some comments/i)).toBeInTheDocument();
94
- expect(getByText(/Appointment History/i)).toBeInTheDocument();
95
- expect(getByText(/Completed/i)).toBeInTheDocument();
96
- expect(getByText('1', { exact: true })).toBeInTheDocument();
97
- expect(getByText(/Missed/i)).toBeInTheDocument();
98
- expect(getByText('2', { exact: true })).toBeInTheDocument();
99
- expect(getByText(/Cancelled/i)).toBeInTheDocument();
100
- expect(getByText('3', { exact: true })).toBeInTheDocument();
101
- expect(getByText(/Upcoming/i)).toBeInTheDocument();
102
- expect(getByText('4', { exact: true })).toBeInTheDocument();
67
+ mockUsePatient.mockReturnValue({
68
+ error: null,
69
+ isLoading: false,
70
+ patientUuid: mockPatient.id,
71
+ patient: {
72
+ birthDate: '22-Mar-2020',
73
+ telecom: [
74
+ {
75
+ value: '0899129989932',
76
+ },
77
+ ],
78
+ },
79
+ });
80
+
81
+ render(<AppointmentDetails appointment={appointment} />);
82
+ expect(screen.getByText(/Patient name/i)).toBeInTheDocument();
83
+ expect(screen.getByText(/John Wilson/i)).toBeInTheDocument();
84
+ expect(screen.getByText(/Age/i)).toBeInTheDocument();
85
+ expect(screen.getByText(/34/i)).toBeInTheDocument();
86
+ expect(screen.getByText(/Gender/i)).toBeInTheDocument();
87
+ expect(screen.getByText(/Male/i)).toBeInTheDocument();
88
+ expect(screen.getByText(/Date of birth/i)).toBeInTheDocument();
89
+ expect(screen.getByText(/Date of birth/i)).toBeInTheDocument();
90
+ expect(screen.getByText(/22-Mar-2020/i)).toBeInTheDocument();
91
+ expect(screen.getByText(/Contact 1/i)).toBeInTheDocument();
92
+ expect(screen.getByText(/0899129989932/i)).toBeInTheDocument();
93
+ expect(screen.getByText(/Appointment Notes/i)).toBeInTheDocument();
94
+ expect(screen.getByText(/Some comments/i)).toBeInTheDocument();
95
+ expect(screen.getByText(/Appointment History/i)).toBeInTheDocument();
96
+ expect(screen.getByText(/Completed/i)).toBeInTheDocument();
97
+ expect(screen.getByText('1', { exact: true })).toBeInTheDocument();
98
+ expect(screen.getByText(/Missed/i)).toBeInTheDocument();
99
+ expect(screen.getByText('2', { exact: true })).toBeInTheDocument();
100
+ expect(screen.getByText(/Cancelled/i)).toBeInTheDocument();
101
+ expect(screen.getByText('3', { exact: true })).toBeInTheDocument();
102
+ expect(screen.getByText(/Upcoming/i)).toBeInTheDocument();
103
+ expect(screen.getByText('4', { exact: true })).toBeInTheDocument();
103
104
  });
@@ -12,8 +12,8 @@ import {
12
12
  useLayoutType,
13
13
  isDesktop,
14
14
  } from '@openmrs/esm-framework';
15
- import styles from './scheduled-appointments.scss';
16
15
  import SelectedDateContext from '../../hooks/selectedDateContext';
16
+ import styles from './scheduled-appointments.scss';
17
17
 
18
18
  dayjs.extend(isSameOrBefore);
19
19
 
@@ -1,4 +1,6 @@
1
+ @use '@carbon/layout';
2
+
1
3
  .switcher {
2
- margin: 1rem 0;
4
+ margin: layout.$spacing-05 0;
3
5
  max-width: 70%;
4
6
  }
@@ -1,49 +1,51 @@
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 { getByTextWithMarkup } from '../../../../../tools/test-utils';
4
+ import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
5
+ import { type ConfigObject, configSchema } from '../../config-schema';
6
+ import { getByTextWithMarkup } from 'tools';
5
7
  import { useUnscheduledAppointments } from '../../hooks/useUnscheduledAppointments';
6
8
  import { downloadUnscheduledAppointments } from '../../helpers/excel';
7
9
  import UnscheduledAppointments from './unscheduled-appointments.component';
8
10
 
9
- const mockDownloadAppointmentsAsExcel = downloadUnscheduledAppointments as jest.Mock;
10
- const mockUseUnscheduledAppointments = useUnscheduledAppointments as jest.Mock;
11
+ const mockDownloadAppointmentsAsExcel = jest.mocked(downloadUnscheduledAppointments);
12
+ const mockUseUnscheduledAppointments = jest.mocked(useUnscheduledAppointments);
13
+ const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
11
14
 
12
15
  jest.mock('../../helpers/excel');
13
16
  jest.mock('../../hooks/useOverlay');
14
17
  jest.mock('../../hooks/useUnscheduledAppointments');
15
18
 
16
- jest.mock('@openmrs/esm-framework', () => {
17
- const originalModule = jest.requireActual('@openmrs/esm-framework');
18
- return {
19
- ...originalModule,
20
- useConfig: jest.fn(() => ({
19
+ const mockUnscheduledAppointments = [
20
+ {
21
+ age: 20,
22
+ dob: 1262304000,
23
+ dateTime: new Date(),
24
+ gender: 'M',
25
+ identifier: '1234-56-78',
26
+ name: 'Test Patient',
27
+ phoneNumber: '123-456-7890',
28
+ uuid: '1234',
29
+ },
30
+ {
31
+ age: 30,
32
+ dob: 1262304000,
33
+ dateTime: new Date(),
34
+ gender: 'F',
35
+ identifier: '2345-67-89',
36
+ name: 'Another Patient',
37
+ phoneNumber: '',
38
+ uuid: '5678',
39
+ },
40
+ ];
41
+
42
+ describe('UnscheduledAppointments', () => {
43
+ beforeEach(() => {
44
+ mockUseConfig.mockReturnValue({
45
+ ...getDefaultsFromConfigSchema(configSchema),
21
46
  customPatientChartUrl: 'someUrl',
22
- })),
23
- };
24
- });
25
-
26
- describe('UnscheduledAppointments component', () => {
27
- const mockUnscheduledAppointments = [
28
- {
29
- uuid: '1234',
30
- name: 'Test Patient',
31
- identifier: '1234-56-78',
32
- gender: 'M',
33
- phoneNumber: '123-456-7890',
34
- age: 20,
35
- dob: 1262304000,
36
- },
37
- {
38
- uuid: '5678',
39
- name: 'Another Patient',
40
- identifier: '2345-67-89',
41
- gender: 'F',
42
- phoneNumber: '',
43
- age: 30,
44
- dob: 1262304000,
45
- },
46
- ];
47
+ });
48
+ });
47
49
 
48
50
  it('renders the component correctly', async () => {
49
51
  mockUseUnscheduledAppointments.mockReturnValue({
@@ -108,12 +110,9 @@ describe('UnscheduledAppointments component', () => {
108
110
  });
109
111
 
110
112
  render(<UnscheduledAppointments />);
111
-
112
113
  const downloadButton = await screen.findByText('Download');
113
114
  expect(downloadButton).toBeInTheDocument();
114
-
115
115
  await user.click(downloadButton);
116
-
117
116
  expect(mockDownloadAppointmentsAsExcel).toHaveBeenCalledWith(mockUnscheduledAppointments);
118
117
  });
119
118
 
@@ -125,7 +124,6 @@ describe('UnscheduledAppointments component', () => {
125
124
  });
126
125
 
127
126
  render(<UnscheduledAppointments />);
128
-
129
127
  expect(getByTextWithMarkup('There are no unscheduled appointments to display')).toBeInTheDocument();
130
128
  });
131
129
  });
@@ -4,7 +4,6 @@ import dayjs from 'dayjs';
4
4
  import AppointmentTabs from './appointments/appointment-tabs.component';
5
5
  import AppointmentsHeader from './header/appointments-header.component';
6
6
  import AppointmentMetrics from './metrics/appointments-metrics.component';
7
- import { WorkspaceOverlay } from '@openmrs/esm-framework';
8
7
  import { useParams } from 'react-router-dom';
9
8
  import SelectedDateContext from './hooks/selectedDateContext';
10
9
  import { omrsDateFormat } from './constants';
@@ -1,7 +1,6 @@
1
- @use '@carbon/styles/scss/type';
2
- @use '@carbon/styles/scss/spacing';
3
1
  @use '@carbon/colors';
4
- @import '~@openmrs/esm-styleguide/src/vars';
2
+ @use '@carbon/layout';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
4
 
6
5
  .wrapper {
7
6
  position: relative;
@@ -13,7 +12,7 @@
13
12
  }
14
13
 
15
14
  .calendarViewContainer {
16
- margin: spacing.$spacing-05;
15
+ margin: layout.$spacing-05;
17
16
  }
18
17
  .backgroundColor {
19
18
  margin: 1px 0 0;
@@ -4,7 +4,7 @@ import AppointmentsCalendarView from './appointments-calendar-view.component';
4
4
 
5
5
  describe('Appointment calendar view', () => {
6
6
  it('renders appointments in calendar view from appointments list', async () => {
7
- renderAppointmentsCalendarListView();
7
+ render(<AppointmentsCalendarView />);
8
8
 
9
9
  const expectedTableRows = [
10
10
  /John Wilson 30-Aug-2021 03:35 03:35 Dr James Cook Outpatient Walk in appointments/,
@@ -16,7 +16,3 @@ describe('Appointment calendar view', () => {
16
16
  });
17
17
  });
18
18
  });
19
-
20
- function renderAppointmentsCalendarListView() {
21
- render(<AppointmentsCalendarView />);
22
- }
@@ -1,12 +1,12 @@
1
- @use '@carbon/styles/scss/type';
2
1
  @use '@carbon/colors';
3
- @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
4
 
5
5
  .titleContainer {
6
6
  display: flex;
7
7
  justify-content: space-between;
8
8
  align-items: center;
9
- margin-left: 1rem;
9
+ margin-left: layout.$spacing-05;
10
10
 
11
11
  & > p {
12
12
  @include type.type-style('heading-02');
@@ -27,6 +27,6 @@
27
27
  // Overriding styles for RTL support
28
28
  html[dir='rtl'] {
29
29
  .titleContent {
30
- margin-left: 1rem;
30
+ margin-left: layout.$spacing-05;
31
31
  }
32
32
  }
@@ -1,7 +1,7 @@
1
1
  @use '@carbon/colors';
2
2
  @use '@carbon/layout';
3
3
  @use '@carbon/type';
4
- @import '~@openmrs/esm-styleguide/src/vars';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .tileContainer {
7
7
  height: layout.$spacing-10;
@@ -1,7 +1,7 @@
1
- @use '@carbon/styles/scss/type';
2
1
  @use '@carbon/colors';
3
2
  @use '@carbon/layout';
4
- @import '~@openmrs/esm-styleguide/src/vars';
3
+ @use '@carbon/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .monthly-cell {
7
7
  border-left: 1px solid colors.$gray-20;
@@ -37,7 +37,7 @@
37
37
  display: list-item;
38
38
 
39
39
  span:not(:first-child) {
40
- margin: 0rem 0.75rem;
40
+ margin: 0 layout.$spacing-04;
41
41
  }
42
42
  }
43
43
 
@@ -50,7 +50,7 @@
50
50
  position: relative;
51
51
  border-right: 1px solid colors.$gray-20;
52
52
  border-bottom: 1px solid colors.$gray-20;
53
- min-height: 120px;
53
+ min-height: 7.5rem;
54
54
  color: colors.$white;
55
55
 
56
56
  .week-time {
@@ -84,7 +84,7 @@
84
84
  display: flex;
85
85
  flex-direction: column;
86
86
  align-items: start;
87
- margin: 0.1rem 0.1rem 0.5rem 0.1rem;
87
+ margin: 0.1rem 0.1rem layout.$spacing-03 0.1rem;
88
88
 
89
89
  & > span {
90
90
  @include type.type-style('label-02');
@@ -93,8 +93,8 @@
93
93
 
94
94
  .serviceArea {
95
95
  width: 100%;
96
- padding: 0.125rem;
97
- margin-right: 0.5rem;
96
+ padding: layout.$spacing-01;
97
+ margin-right: layout.$spacing-03;
98
98
  display: grid;
99
99
  grid-template-columns: 4fr 1fr;
100
100
  justify-content: flex-start;
@@ -119,7 +119,7 @@
119
119
  }
120
120
 
121
121
  .totals {
122
- padding: 0.125rem;
122
+ padding: layout.$spacing-01;
123
123
  display: grid;
124
124
  grid-template-columns: 4fr 1fr;
125
125
  justify-content: flex-start;
@@ -143,11 +143,11 @@
143
143
  }
144
144
 
145
145
  .smallDesktop {
146
- height: 100px;
146
+ height: 6.25rem;
147
147
  }
148
148
 
149
149
  .largeDesktop {
150
- height: 150px;
150
+ height: 9.375rem;
151
151
  }
152
152
 
153
153
  .red {