@kenyaemr/esm-appointments-app 7.0.3-pre.89 → 8.0.1-pre.95
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.
- package/.turbo/turbo-build.log +23 -22
- package/dist/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/23.js +2 -0
- package/dist/23.js.map +1 -0
- package/dist/265.js +1 -1
- package/dist/271.js +1 -1
- package/dist/319.js +1 -1
- package/dist/460.js +1 -1
- package/dist/529.js +1 -1
- package/dist/574.js +1 -1
- package/dist/581.js +1 -0
- package/dist/581.js.map +1 -0
- package/dist/644.js +1 -1
- package/dist/646.js +2 -0
- package/dist/646.js.map +1 -0
- package/dist/757.js +1 -1
- package/dist/788.js +1 -1
- package/dist/807.js +1 -1
- package/dist/833.js +1 -1
- package/dist/85.js +1 -0
- package/dist/85.js.map +1 -0
- package/dist/89.js +1 -0
- package/dist/89.js.map +1 -0
- package/dist/kenyaemr-esm-appointments-app.js +1 -1
- package/dist/kenyaemr-esm-appointments-app.js.buildmanifest.json +167 -143
- package/dist/kenyaemr-esm-appointments-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/admin/appointment-services/appointment-services.scss +5 -5
- package/src/appointments/appointment-tabs.scss +6 -7
- package/src/appointments/appointment-tabs.test.tsx +4 -11
- package/src/appointments/common-components/appointments-actions.test.tsx +121 -74
- package/src/appointments/common-components/appointments-table.scss +6 -6
- package/src/appointments/common-components/appointments-table.test.tsx +30 -32
- package/src/appointments/common-components/end-appointment.test.tsx +20 -19
- package/src/appointments/details/appointment-details.component.tsx +1 -1
- package/src/appointments/details/appointment-details.scss +13 -13
- package/src/appointments/details/appointment-details.test.tsx +49 -48
- package/src/appointments/scheduled/scheduled-appointments.component.tsx +1 -1
- package/src/appointments/scheduled/scheduled-appointments.scss +3 -1
- package/src/appointments/unscheduled/unscheduled-appointments.test.tsx +35 -37
- package/src/appointments.component.tsx +0 -1
- package/src/calendar/appointments-calendar-view-view.scss +3 -4
- package/src/calendar/appointments-calendar-view.test.tsx +1 -5
- package/src/calendar/header/calendar-header.scss +4 -4
- package/src/calendar/monthly/days-of-week.scss +1 -1
- package/src/calendar/monthly/monthly-view-workload.scss +10 -10
- package/src/config-schema.ts +88 -90
- package/src/empty-state/empty-state.scss +4 -4
- package/src/form/appointments-form.component.tsx +58 -26
- package/src/form/appointments-form.resource.ts +2 -2
- package/src/form/appointments-form.scss +11 -11
- package/src/form/appointments-form.test.tsx +42 -43
- package/src/header/appointments-header.scss +12 -12
- package/src/home/home-appointments.scss +0 -1
- package/src/homepage-tile/appointments-tile.component.tsx +23 -0
- package/src/homepage-tile/appointments-tile.scss +39 -0
- package/src/homepage-tile/appointments.resource.ts +15 -0
- package/src/hooks/useClinicalMetrics.ts +1 -1
- package/src/hooks/useDefaultLocation.ts +1 -1
- package/src/hooks/usePatientAppointmentHistory.ts +1 -1
- package/src/hooks/useProviders.ts +1 -1
- package/src/index.ts +5 -0
- package/src/metrics/appointments-metrics.scss +0 -1
- package/src/metrics/appointments-metrics.test.tsx +25 -31
- package/src/metrics/metrics-card.component.tsx +6 -33
- package/src/metrics/metrics-card.scss +8 -8
- package/src/metrics/metrics-header.scss +1 -1
- package/src/past-visit/past-visit.component.tsx +1 -1
- package/src/past-visit/past-visit.resource.ts +1 -1
- package/src/past-visit/past-visit.scss +19 -14
- package/src/patient-appointments/patient-appointments-action-menu.scss +6 -0
- package/src/patient-appointments/patient-appointments-base.component.tsx +6 -6
- package/src/patient-appointments/patient-appointments-base.scss +24 -29
- package/src/patient-appointments/patient-appointments-base.test.tsx +13 -11
- package/src/patient-appointments/patient-appointments-header.scss +4 -5
- package/src/patient-appointments/patient-appointments-overview.component.tsx +2 -2
- package/src/patient-appointments/patient-appointments-overview.scss +0 -1
- package/src/patient-appointments/patient-appointments.resource.ts +1 -1
- package/src/patient-appointments/patient-upcoming-appointments-card.component.tsx +3 -3
- package/src/patient-appointments/patient-upcoming-appointments-card.scss +11 -10
- package/src/patient-search/patient-search.scss +15 -14
- package/src/routes.json +5 -0
- package/src/types/index.ts +4 -0
- package/src/workload/monthly-view-workload/monthly-workload.scss +21 -6
- package/src/workload/monthly-view-workload/monthlyWorkCard.tsx +2 -2
- package/src/workload/workload.scss +3 -3
- package/translations/am.json +2 -0
- package/translations/ar.json +2 -0
- package/translations/en.json +2 -0
- package/translations/es.json +2 -0
- package/translations/fr.json +30 -28
- package/translations/he.json +2 -0
- package/translations/km.json +2 -0
- package/translations/zh.json +2 -0
- package/translations/zh_CN.json +2 -0
- package/dist/224.js +0 -1
- package/dist/224.js.map +0 -1
- package/dist/445.js +0 -2
- package/dist/445.js.map +0 -1
- package/dist/857.js +0 -2
- package/dist/857.js.map +0 -1
- package/dist/904.js +0 -1
- package/dist/904.js.map +0 -1
- package/src/root.scss +0 -50
- /package/dist/{857.js.LICENSE.txt → 23.js.LICENSE.txt} +0 -0
- /package/dist/{445.js.LICENSE.txt → 646.js.LICENSE.txt} +0 -0
- /package/src/helpers/{time.tsx → time.ts} +0 -0
- /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('
|
|
14
|
-
|
|
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
|
-
|
|
22
|
-
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
mockUpdateVisit.mockImplementation(() => of({}));
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
it('has a cancel button that closes the
|
|
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).
|
|
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).
|
|
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/
|
|
2
|
-
@use '@carbon/
|
|
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:
|
|
9
|
-
margin:
|
|
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:
|
|
23
|
+
margin-top: layout.$spacing-05;
|
|
24
24
|
display: flex;
|
|
25
|
-
column-gap:
|
|
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:
|
|
36
|
-
margin-top:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
22
|
+
description: '',
|
|
21
23
|
startTime: '',
|
|
22
24
|
endTime: '',
|
|
23
25
|
maxAppointmentsLimit: null,
|
|
24
|
-
durationMins:
|
|
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:
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
expect(getByText(/
|
|
96
|
-
expect(getByText(
|
|
97
|
-
expect(getByText(/
|
|
98
|
-
expect(getByText(
|
|
99
|
-
expect(getByText(/
|
|
100
|
-
expect(getByText(
|
|
101
|
-
expect(getByText(/
|
|
102
|
-
expect(getByText(
|
|
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,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 {
|
|
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 =
|
|
10
|
-
const mockUseUnscheduledAppointments =
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
@
|
|
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:
|
|
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
|
-
|
|
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/
|
|
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:
|
|
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:
|
|
30
|
+
margin-left: layout.$spacing-05;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@use '@carbon/styles/scss/type';
|
|
2
1
|
@use '@carbon/colors';
|
|
3
2
|
@use '@carbon/layout';
|
|
4
|
-
@
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
97
|
-
margin-right:
|
|
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:
|
|
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:
|
|
146
|
+
height: 6.25rem;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
.largeDesktop {
|
|
150
|
-
height:
|
|
150
|
+
height: 9.375rem;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
.red {
|