@openmrs/esm-appointments-app 5.2.2-pre.2544 → 5.2.2-pre.2549
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 +1 -1
- package/dist/799.js +1 -1
- package/dist/799.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-appointments-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/admin/appointment-services/appointment-services.component.tsx +6 -7
- package/src/appointments/forms/cancel-form/cancel-appointment.component.tsx +6 -7
- package/src/appointments/forms/cancel-form/cancel-appointment.test.tsx +10 -12
- package/src/appointments/forms/create-edit-form/appointments-form.component.tsx +6 -8
- package/src/patient-queue/visit-form/visit-form.component.tsx +8 -12
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"initial": true,
|
|
81
81
|
"entry": true,
|
|
82
82
|
"recorded": false,
|
|
83
|
-
"size":
|
|
83
|
+
"size": 4540693,
|
|
84
84
|
"sizes": {
|
|
85
85
|
"consume-shared": 252,
|
|
86
|
-
"javascript":
|
|
86
|
+
"javascript": 4519771,
|
|
87
87
|
"share-init": 252,
|
|
88
88
|
"runtime": 20418
|
|
89
89
|
},
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"auxiliaryFiles": [
|
|
101
101
|
"main.js.map"
|
|
102
102
|
],
|
|
103
|
-
"hash": "
|
|
103
|
+
"hash": "d34c9a4e6044489a",
|
|
104
104
|
"childrenByOrder": {}
|
|
105
105
|
},
|
|
106
106
|
{
|
|
@@ -490,9 +490,9 @@
|
|
|
490
490
|
"initial": false,
|
|
491
491
|
"entry": false,
|
|
492
492
|
"recorded": false,
|
|
493
|
-
"size":
|
|
493
|
+
"size": 482246,
|
|
494
494
|
"sizes": {
|
|
495
|
-
"javascript":
|
|
495
|
+
"javascript": 482078,
|
|
496
496
|
"consume-shared": 168
|
|
497
497
|
},
|
|
498
498
|
"names": [],
|
|
@@ -506,7 +506,7 @@
|
|
|
506
506
|
"auxiliaryFiles": [
|
|
507
507
|
"799.js.map"
|
|
508
508
|
],
|
|
509
|
-
"hash": "
|
|
509
|
+
"hash": "affd1fc4ba01bbb0",
|
|
510
510
|
"childrenByOrder": {}
|
|
511
511
|
},
|
|
512
512
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2549"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { Form, Formik, type FormikHelpers } from 'formik';
|
|
5
5
|
import { validationSchema } from './appointment-services-validation';
|
|
6
6
|
import { useAppointmentServices } from './appointment-services-hook';
|
|
7
|
-
import {
|
|
7
|
+
import { showSnackbar, useLocations } from '@openmrs/esm-framework';
|
|
8
8
|
import type { AppointmentService } from '../../types';
|
|
9
9
|
import { closeOverlay } from '../../hooks/useOverlay';
|
|
10
10
|
import styles from './appointment-services.scss';
|
|
@@ -29,21 +29,20 @@ const AppointmentServices: React.FC<AppointmentServicesProps> = () => {
|
|
|
29
29
|
addNewAppointmentService(payload).then(
|
|
30
30
|
({ status }) => {
|
|
31
31
|
if (status === 200) {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
showSnackbar({
|
|
33
|
+
isLowContrast: true,
|
|
34
34
|
kind: 'success',
|
|
35
|
-
|
|
35
|
+
subtitle: t('appointmentServiceCreate', 'Appointment service created successfully'),
|
|
36
36
|
title: t('appointmentService', 'Appointment service'),
|
|
37
37
|
});
|
|
38
38
|
closeOverlay();
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
(error) => {
|
|
42
|
-
|
|
42
|
+
showSnackbar({
|
|
43
43
|
title: t('errorCreatingAppointmentService', 'Error creating appointment service'),
|
|
44
44
|
kind: 'error',
|
|
45
|
-
|
|
46
|
-
description: error?.message,
|
|
45
|
+
subtitle: error?.message,
|
|
47
46
|
});
|
|
48
47
|
},
|
|
49
48
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Button, Layer, TextArea } from '@carbon/react';
|
|
4
|
-
import { useSession,
|
|
4
|
+
import { useSession, showSnackbar, ExtensionSlot, usePatient } from '@openmrs/esm-framework';
|
|
5
5
|
import { cancelAppointment } from '../forms.resource';
|
|
6
6
|
import { useSWRConfig } from 'swr';
|
|
7
7
|
import { useAppointmentDate } from '../../../helpers';
|
|
@@ -32,21 +32,20 @@ const CancelAppointment: React.FC<CancelAppointmentProps> = ({ appointment }) =>
|
|
|
32
32
|
setIsSubmitting(true);
|
|
33
33
|
const { status } = await cancelAppointment('Cancelled', appointment.id);
|
|
34
34
|
if (status === 200) {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
showSnackbar({
|
|
36
|
+
isLowContrast: true,
|
|
37
37
|
kind: 'success',
|
|
38
|
-
|
|
38
|
+
subtitle: t('cancelledSuccessfully', 'It has been cancelled successfully'),
|
|
39
39
|
title: t('appointmentCancelled', 'Appointment cancelled'),
|
|
40
40
|
});
|
|
41
41
|
mutate(`/ws/rest/v1/appointment/appointmentStatus?forDate=${currentAppointmentDate}&status=Scheduled`);
|
|
42
42
|
mutate(`/ws/rest/v1/appointment/appointmentStatus?forDate=${currentAppointmentDate}&status=Cancelled`);
|
|
43
43
|
closeOverlay();
|
|
44
44
|
} else {
|
|
45
|
-
|
|
45
|
+
showSnackbar({
|
|
46
46
|
title: t('appointmentCancelError', 'Error cancelling appointment'),
|
|
47
47
|
kind: 'error',
|
|
48
|
-
|
|
49
|
-
description: t('errorCancellingAppointment', 'Error cancelling the appointment'),
|
|
48
|
+
subtitle: t('errorCancellingAppointment', 'Error cancelling the appointment'),
|
|
50
49
|
});
|
|
51
50
|
setIsSubmitting(false);
|
|
52
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { screen, render } from '@testing-library/react';
|
|
4
|
-
import {
|
|
4
|
+
import { showSnackbar } from '@openmrs/esm-framework';
|
|
5
5
|
import { cancelAppointment } from '../forms.resource';
|
|
6
6
|
import { mockMappedAppointmentsData } from '__mocks__';
|
|
7
7
|
import CancelAppointment from './cancel-appointment.component';
|
|
@@ -10,9 +10,8 @@ const testProps = {
|
|
|
10
10
|
appointment: mockMappedAppointmentsData.data[0],
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const mockShowSnackbar = showSnackbar as jest.Mock;
|
|
14
14
|
const mockCancelAppointment = cancelAppointment as jest.Mock;
|
|
15
|
-
const mockShowNotification = showNotification as jest.Mock;
|
|
16
15
|
|
|
17
16
|
jest.mock('../forms.resource', () => {
|
|
18
17
|
const originalModule = jest.requireActual('../forms.resource');
|
|
@@ -32,7 +31,7 @@ jest.mock('@openmrs/esm-framework', () => {
|
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
describe('Cancel appointment form', () => {
|
|
35
|
-
it('should update appointment status to cancelled and show
|
|
34
|
+
it('should update appointment status to cancelled and show snackbar with success message', async () => {
|
|
36
35
|
const user = userEvent.setup();
|
|
37
36
|
|
|
38
37
|
mockCancelAppointment.mockReturnValueOnce({ status: 200, statusText: 'Appointment cancelled' });
|
|
@@ -42,12 +41,12 @@ describe('Cancel appointment form', () => {
|
|
|
42
41
|
await user.click(screen.getByRole('textbox', { name: /reason for changes/i }));
|
|
43
42
|
await user.click(screen.getByRole('button', { name: /cancel appointment/i }));
|
|
44
43
|
|
|
45
|
-
expect(
|
|
46
|
-
expect(
|
|
47
|
-
|
|
44
|
+
expect(mockShowSnackbar).toHaveBeenCalledTimes(1);
|
|
45
|
+
expect(mockShowSnackbar).toHaveBeenCalledWith({
|
|
46
|
+
isLowContrast: true,
|
|
48
47
|
kind: 'success',
|
|
49
48
|
title: 'Appointment cancelled',
|
|
50
|
-
|
|
49
|
+
subtitle: 'It has been cancelled successfully',
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
|
|
@@ -62,12 +61,11 @@ describe('Cancel appointment form', () => {
|
|
|
62
61
|
|
|
63
62
|
await user.click(screen.getByRole('textbox', { name: /reason for changes/i }));
|
|
64
63
|
await user.click(screen.getByRole('button', { name: /cancel appointment/i }));
|
|
65
|
-
expect(
|
|
66
|
-
expect(
|
|
67
|
-
critical: true,
|
|
64
|
+
expect(mockShowSnackbar).toHaveBeenCalledTimes(2);
|
|
65
|
+
expect(mockShowSnackbar).toHaveBeenCalledWith({
|
|
68
66
|
kind: 'error',
|
|
69
67
|
title: 'Error cancelling appointment',
|
|
70
|
-
|
|
68
|
+
subtitle: 'Error cancelling the appointment',
|
|
71
69
|
});
|
|
72
70
|
});
|
|
73
71
|
});
|
|
@@ -29,8 +29,7 @@ import {
|
|
|
29
29
|
} from '@carbon/react';
|
|
30
30
|
import {
|
|
31
31
|
ExtensionSlot,
|
|
32
|
-
|
|
33
|
-
showToast,
|
|
32
|
+
showSnackbar,
|
|
34
33
|
useConfig,
|
|
35
34
|
useLayoutType,
|
|
36
35
|
useLocations,
|
|
@@ -128,10 +127,10 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
|
|
|
128
127
|
saveAppointment(appointmentPayload).then(
|
|
129
128
|
({ status }) => {
|
|
130
129
|
if (status === 200) {
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
showSnackbar({
|
|
131
|
+
isLowContrast: true,
|
|
133
132
|
kind: 'success',
|
|
134
|
-
|
|
133
|
+
subtitle: t('appointmentNowVisible', 'It is now visible on the appointments page'),
|
|
135
134
|
title: t('appointmentScheduled', 'Appointment scheduled'),
|
|
136
135
|
});
|
|
137
136
|
setIsSubmitting(false);
|
|
@@ -145,11 +144,10 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
|
|
|
145
144
|
}
|
|
146
145
|
},
|
|
147
146
|
(error) => {
|
|
148
|
-
|
|
147
|
+
showSnackbar({
|
|
149
148
|
title: t('appointmentFormError', 'Error scheduling appointment'),
|
|
150
149
|
kind: 'error',
|
|
151
|
-
|
|
152
|
-
description: error?.message,
|
|
150
|
+
subtitle: error?.message,
|
|
153
151
|
});
|
|
154
152
|
setIsSubmitting(false);
|
|
155
153
|
},
|
|
@@ -27,10 +27,7 @@ import {
|
|
|
27
27
|
useVisitTypes,
|
|
28
28
|
type NewVisitPayload,
|
|
29
29
|
saveVisit,
|
|
30
|
-
|
|
31
|
-
toDateObjectStrict,
|
|
32
|
-
showNotification,
|
|
33
|
-
showToast,
|
|
30
|
+
showSnackbar,
|
|
34
31
|
usePatient,
|
|
35
32
|
useConfig,
|
|
36
33
|
useLocations,
|
|
@@ -138,10 +135,11 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
|
|
|
138
135
|
({ status }) => {
|
|
139
136
|
if (status === 201) {
|
|
140
137
|
mutate();
|
|
141
|
-
|
|
138
|
+
showSnackbar({
|
|
142
139
|
kind: 'success',
|
|
140
|
+
isLowContrast: true,
|
|
143
141
|
title: t('visitStarted', 'Visit started'),
|
|
144
|
-
|
|
142
|
+
subtitle: t(
|
|
145
143
|
'queueAddedSuccessfully',
|
|
146
144
|
`Patient has been added to the queue successfully.`,
|
|
147
145
|
`${hours} : ${minutes}`,
|
|
@@ -150,11 +148,10 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
|
|
|
150
148
|
}
|
|
151
149
|
},
|
|
152
150
|
(error) => {
|
|
153
|
-
|
|
151
|
+
showSnackbar({
|
|
154
152
|
title: t('queueEntryError', 'Error adding patient to the queue'),
|
|
155
153
|
kind: 'error',
|
|
156
|
-
|
|
157
|
-
description: error?.message,
|
|
154
|
+
subtitle: error?.message,
|
|
158
155
|
});
|
|
159
156
|
},
|
|
160
157
|
);
|
|
@@ -165,11 +162,10 @@ const VisitForm: React.FC<VisitFormProps> = ({ patientUuid, appointment }) => {
|
|
|
165
162
|
}
|
|
166
163
|
},
|
|
167
164
|
(error) => {
|
|
168
|
-
|
|
165
|
+
showSnackbar({
|
|
169
166
|
title: t('startVisitError', 'Error starting visit'),
|
|
170
167
|
kind: 'error',
|
|
171
|
-
|
|
172
|
-
description: error?.message,
|
|
168
|
+
subtitle: error?.message,
|
|
173
169
|
});
|
|
174
170
|
},
|
|
175
171
|
);
|