@openmrs/esm-appointments-app 8.3.2-pre.4972 → 8.3.2-pre.4994
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 +3 -3
- package/dist/1761.js +1 -0
- package/dist/1761.js.map +1 -0
- package/dist/2753.js +1 -1
- package/dist/2753.js.map +1 -1
- package/dist/2923.js +1 -1
- package/dist/2923.js.map +1 -1
- package/dist/3260.js +1 -1
- package/dist/3260.js.map +1 -1
- package/dist/3574.js +1 -1
- package/dist/6179.js +1 -1
- package/dist/6179.js.map +1 -1
- package/dist/646.js +1 -1
- package/dist/646.js.map +1 -1
- package/dist/953.js +1 -0
- package/dist/953.js.map +1 -0
- package/dist/9874.js +1 -1
- package/dist/9874.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 +73 -73
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/appointments/common-components/appointments-table.component.tsx +4 -3
- package/src/appointments/common-components/end-appointment.modal.tsx +1 -1
- package/src/form/appointments-form.test.tsx +1 -1
- package/src/index.ts +3 -4
- package/src/metrics/metrics-header.component.tsx +1 -1
- package/src/patient-appointments/patient-appointments-action-menu.component.tsx +15 -24
- package/src/patient-appointments/patient-appointments-base.component.tsx +9 -4
- package/src/patient-appointments/patient-appointments-cancel.modal.tsx +14 -16
- package/src/patient-search/patient-search.component.tsx +2 -3
- package/src/routes.json +10 -43
- package/translations/en.json +1 -2
- package/dist/310.js +0 -1
- package/dist/310.js.map +0 -1
- package/dist/8906.js +0 -1
- package/dist/8906.js.map +0 -1
- /package/src/appointments/common-components/{end-appointment.modal.scss → end-appointment.scss} +0 -0
- /package/src/form/{appointments-form.component.tsx → appointments-form.workspace.tsx} +0 -0
|
@@ -15,7 +15,7 @@ import { mockUseAppointmentServiceData, mockSession, mockLocations, mockProvider
|
|
|
15
15
|
import { mockPatient, renderWithSwr, waitForLoadingToFinish } from 'tools';
|
|
16
16
|
import { saveAppointment } from './appointments-form.resource';
|
|
17
17
|
import { useProviders } from '../hooks/useProviders';
|
|
18
|
-
import AppointmentForm from './appointments-form.
|
|
18
|
+
import AppointmentForm from './appointments-form.workspace';
|
|
19
19
|
|
|
20
20
|
const defaultProps = {
|
|
21
21
|
context: 'creating',
|
package/src/index.ts
CHANGED
|
@@ -75,8 +75,6 @@ export const earlyAppointments = getAsyncLifecycle(
|
|
|
75
75
|
options,
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
export const appointmentsForm = getAsyncLifecycle(() => import('./form/appointments-form.component'), options);
|
|
79
|
-
|
|
80
78
|
export const searchPatient = getAsyncLifecycle(() => import('./patient-search/patient-search.component'), options);
|
|
81
79
|
|
|
82
80
|
// t('Appointments', 'Appointments')
|
|
@@ -100,12 +98,13 @@ export const patientUpcomingAppointmentsWidget = getAsyncLifecycle(
|
|
|
100
98
|
options,
|
|
101
99
|
);
|
|
102
100
|
|
|
103
|
-
export const
|
|
101
|
+
export const cancelAppointmentModal = getAsyncLifecycle(
|
|
104
102
|
() => import('./patient-appointments/patient-appointments-cancel.modal'),
|
|
105
103
|
options,
|
|
106
104
|
);
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
// t('createNewAppointment', 'Create new appointment')
|
|
107
|
+
export const appointmentsFormWorkspace = getAsyncLifecycle(() => import('./form/appointments-form.workspace'), options);
|
|
109
108
|
|
|
110
109
|
export const endAppointmentModal = getAsyncLifecycle(
|
|
111
110
|
() => import('./appointments/common-components/end-appointment.modal'),
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Layer, OverflowMenu, OverflowMenuItem } from '@carbon/react';
|
|
4
4
|
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
|
|
5
|
-
import {
|
|
5
|
+
import { showModal, useLayoutType } from '@openmrs/esm-framework';
|
|
6
6
|
import type { Appointment } from '../types';
|
|
7
|
-
import PatientAppointmentContext, { PatientAppointmentContextTypes } from '../hooks/patientAppointmentContext';
|
|
8
7
|
import styles from './patient-appointments-action-menu.scss';
|
|
9
8
|
|
|
10
9
|
interface appointmentsActionMenuProps {
|
|
@@ -15,25 +14,17 @@ interface appointmentsActionMenuProps {
|
|
|
15
14
|
export const PatientAppointmentsActionMenu = ({ appointment, patientUuid }: appointmentsActionMenuProps) => {
|
|
16
15
|
const { t } = useTranslation();
|
|
17
16
|
const isTablet = useLayoutType() === 'tablet';
|
|
18
|
-
const patientAppointmentContext = useContext(PatientAppointmentContext);
|
|
19
17
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} else {
|
|
28
|
-
launchWorkspace('edit-appointments-form', {
|
|
29
|
-
context: 'editing',
|
|
30
|
-
appointment,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}, [appointment, patientAppointmentContext, t]);
|
|
18
|
+
const handleLaunchEditAppointmentForm = () => {
|
|
19
|
+
launchPatientWorkspace('appointments-form-workspace', {
|
|
20
|
+
appointment,
|
|
21
|
+
context: 'editing',
|
|
22
|
+
workspaceTitle: t('editAppointment', 'Edit appointment'),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
34
25
|
|
|
35
|
-
const
|
|
36
|
-
const dispose = showModal('
|
|
26
|
+
const handleLaunchCancelAppointmentModal = () => {
|
|
27
|
+
const dispose = showModal('cancel-appointment-modal', {
|
|
37
28
|
closeCancelModal: () => dispose(),
|
|
38
29
|
appointmentUuid: appointment.uuid,
|
|
39
30
|
patientUuid,
|
|
@@ -46,16 +37,16 @@ export const PatientAppointmentsActionMenu = ({ appointment, patientUuid }: appo
|
|
|
46
37
|
<OverflowMenuItem
|
|
47
38
|
className={styles.menuItem}
|
|
48
39
|
id="editAppointment"
|
|
49
|
-
onClick={launchEditAppointmentForm}
|
|
50
40
|
itemText={t('edit', 'Edit')}
|
|
41
|
+
onClick={handleLaunchEditAppointmentForm}
|
|
51
42
|
/>
|
|
52
43
|
<OverflowMenuItem
|
|
53
44
|
className={styles.menuItem}
|
|
45
|
+
hasDivider
|
|
54
46
|
id="cancelAppointment"
|
|
55
|
-
itemText={t('cancel', 'Cancel')}
|
|
56
|
-
onClick={launchCancelAppointmentDialog}
|
|
57
47
|
isDelete={true}
|
|
58
|
-
|
|
48
|
+
itemText={t('cancel', 'Cancel')}
|
|
49
|
+
onClick={handleLaunchCancelAppointmentModal}
|
|
59
50
|
/>
|
|
60
51
|
</OverflowMenu>
|
|
61
52
|
</Layer>
|
|
@@ -37,21 +37,26 @@ const PatientAppointmentsBase: React.FC<PatientAppointmentsBaseProps> = ({ patie
|
|
|
37
37
|
isValidating,
|
|
38
38
|
} = usePatientAppointments(patientUuid, startDate, new AbortController());
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const handleLaunchAppointmentsForm = () => {
|
|
41
41
|
if (patientAppointmentContext === PatientAppointmentContextTypes.PATIENT_CHART) {
|
|
42
42
|
launchPatientWorkspace('appointments-form-workspace');
|
|
43
43
|
} else {
|
|
44
|
-
launchWorkspace('
|
|
44
|
+
launchWorkspace('appointments-form-workspace', {
|
|
45
45
|
context: 'creating',
|
|
46
46
|
patientUuid,
|
|
47
|
+
workspaceTitle: t('createNewAppointment', 'Create new appointment'),
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
if (isLoading)
|
|
52
|
+
if (isLoading) {
|
|
53
|
+
return <DataTableSkeleton role="progressbar" compact={!isTablet} zebra />;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
if (error) {
|
|
53
57
|
return <ErrorState headerTitle={headerTitle} error={error} />;
|
|
54
58
|
}
|
|
59
|
+
|
|
55
60
|
if (appointmentsData && Object.keys(appointmentsData)?.length) {
|
|
56
61
|
return (
|
|
57
62
|
<div className={styles.widgetCard}>
|
|
@@ -77,7 +82,7 @@ const PatientAppointmentsBase: React.FC<PatientAppointmentsBaseProps> = ({ patie
|
|
|
77
82
|
kind="ghost"
|
|
78
83
|
renderIcon={(props) => <Add size={16} {...props} />}
|
|
79
84
|
iconDescription="Add Appointments"
|
|
80
|
-
onClick={
|
|
85
|
+
onClick={handleLaunchAppointmentsForm}>
|
|
81
86
|
{t('add', 'Add')}
|
|
82
87
|
</Button>
|
|
83
88
|
</div>
|
|
@@ -5,13 +5,13 @@ import { showSnackbar } from '@openmrs/esm-framework';
|
|
|
5
5
|
import { changeAppointmentStatus, usePatientAppointments } from './patient-appointments.resource';
|
|
6
6
|
import styles from './patient-appointments-cancel.scss';
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface CancelAppointmentModalProps {
|
|
9
9
|
closeCancelModal: () => void;
|
|
10
10
|
appointmentUuid: string;
|
|
11
11
|
patientUuid: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const CancelAppointmentModal: React.FC<CancelAppointmentModalProps> = ({
|
|
15
15
|
closeCancelModal,
|
|
16
16
|
appointmentUuid,
|
|
17
17
|
patientUuid,
|
|
@@ -20,21 +20,19 @@ const PatientCancelAppointmentModal: React.FC<PatientCancelAppointmentModalProps
|
|
|
20
20
|
const { mutate } = usePatientAppointments(patientUuid, new Date().toUTCString(), new AbortController());
|
|
21
21
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const handleCancelAppointment = async () => {
|
|
24
24
|
setIsSubmitting(true);
|
|
25
25
|
|
|
26
26
|
changeAppointmentStatus('Cancelled', appointmentUuid)
|
|
27
|
-
.then((
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
}
|
|
27
|
+
.then(() => {
|
|
28
|
+
mutate();
|
|
29
|
+
closeCancelModal();
|
|
30
|
+
showSnackbar({
|
|
31
|
+
isLowContrast: true,
|
|
32
|
+
kind: 'success',
|
|
33
|
+
subtitle: t('appointmentCancelledSuccessfully', 'Appointment cancelled successfully'),
|
|
34
|
+
title: t('appointmentCancelled', 'Appointment cancelled'),
|
|
35
|
+
});
|
|
38
36
|
})
|
|
39
37
|
.catch((err) => {
|
|
40
38
|
showSnackbar({
|
|
@@ -60,7 +58,7 @@ const PatientCancelAppointmentModal: React.FC<PatientCancelAppointmentModalProps
|
|
|
60
58
|
<Button kind="secondary" onClick={closeCancelModal}>
|
|
61
59
|
{t('discard', 'Discard')}
|
|
62
60
|
</Button>
|
|
63
|
-
<Button kind="danger" onClick={
|
|
61
|
+
<Button kind="danger" onClick={handleCancelAppointment} disabled={isSubmitting}>
|
|
64
62
|
{t('cancelAppointment', 'Cancel appointment')}
|
|
65
63
|
</Button>
|
|
66
64
|
</ModalFooter>
|
|
@@ -68,4 +66,4 @@ const PatientCancelAppointmentModal: React.FC<PatientCancelAppointmentModalProps
|
|
|
68
66
|
);
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
export default
|
|
69
|
+
export default CancelAppointmentModal;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExtensionSlot, launchWorkspace } from '@openmrs/esm-framework';
|
|
3
3
|
import styles from './patient-search.scss';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
4
|
|
|
6
5
|
const PatientSearch: React.FC = () => {
|
|
7
|
-
const { t } = useTranslation();
|
|
8
6
|
const launchCreateAppointmentForm = (patient) => {
|
|
9
7
|
const props = {
|
|
10
8
|
patientUuid: patient.uuid,
|
|
11
9
|
context: 'creating',
|
|
12
10
|
mutate: () => {}, // TODO get this to mutate properly
|
|
13
11
|
};
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
launchWorkspace('appointments-form-workspace', { ...props });
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
return (
|
package/src/routes.json
CHANGED
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"slot": "calendar-dashboard-slot",
|
|
31
31
|
"component": "appointmentsCalendarDashboardLink"
|
|
32
32
|
},
|
|
33
|
-
|
|
34
33
|
{
|
|
35
34
|
"name": "todays-appointments-dashboard",
|
|
36
35
|
"slot": "todays-appointment-slot",
|
|
@@ -65,16 +64,6 @@
|
|
|
65
64
|
"name": "early-appointments-panel",
|
|
66
65
|
"component": "earlyAppointments"
|
|
67
66
|
},
|
|
68
|
-
{
|
|
69
|
-
"name": "appointments-form-workspace",
|
|
70
|
-
"component": "appointmentsFormWorkspace",
|
|
71
|
-
"meta": {
|
|
72
|
-
"title": {
|
|
73
|
-
"key": "createNewAppointment",
|
|
74
|
-
"default": "Create new appointment"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
67
|
{
|
|
79
68
|
"name": "patient-appointments-summary-dashboard",
|
|
80
69
|
"component": "patientAppointmentsSummaryDashboardLink",
|
|
@@ -102,39 +91,9 @@
|
|
|
102
91
|
"component": "patientUpcomingAppointmentsWidget",
|
|
103
92
|
"slot": "visit-form-top-slot"
|
|
104
93
|
},
|
|
105
|
-
{
|
|
106
|
-
"name": "edit-appointments-form",
|
|
107
|
-
"component": "appointmentsForm",
|
|
108
|
-
"meta": {
|
|
109
|
-
"title":{
|
|
110
|
-
"key":"editAppointment",
|
|
111
|
-
"default":"Edit Appointment"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
94
|
{
|
|
116
95
|
"name": "search-patient",
|
|
117
96
|
"component": "searchPatient"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"name": "create-appointment",
|
|
121
|
-
"component": "appointmentsForm",
|
|
122
|
-
"meta": {
|
|
123
|
-
"title": {
|
|
124
|
-
"key":"appointmentForm",
|
|
125
|
-
"default":"Appointment Form"
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "add-appointment",
|
|
131
|
-
"component": "appointmentsForm",
|
|
132
|
-
"meta": {
|
|
133
|
-
"title": {
|
|
134
|
-
"key": "createNewAppointment",
|
|
135
|
-
"default": "Create new appointment"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
97
|
},
|
|
139
98
|
{
|
|
140
99
|
"name": "home-appointments-tile",
|
|
@@ -148,8 +107,16 @@
|
|
|
148
107
|
"component": "endAppointmentModal"
|
|
149
108
|
},
|
|
150
109
|
{
|
|
151
|
-
"name": "
|
|
152
|
-
"component": "
|
|
110
|
+
"name": "cancel-appointment-modal",
|
|
111
|
+
"component": "cancelAppointmentModal"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"workspaces": [
|
|
115
|
+
{
|
|
116
|
+
"name": "appointments-form-workspace",
|
|
117
|
+
"component": "appointmentsFormWorkspace",
|
|
118
|
+
"title": "createNewAppointment",
|
|
119
|
+
"type": "form"
|
|
153
120
|
}
|
|
154
121
|
]
|
|
155
122
|
}
|
package/translations/en.json
CHANGED
|
@@ -77,8 +77,7 @@
|
|
|
77
77
|
"durationInMinutes": "Duration (minutes)",
|
|
78
78
|
"durationMins": "Duration min",
|
|
79
79
|
"edit": "Edit",
|
|
80
|
-
"editAppointment": "Edit
|
|
81
|
-
"editAppointments": "Edit Appointment",
|
|
80
|
+
"editAppointment": "Edit appointment",
|
|
82
81
|
"emptyStateText": "There are no <1>{{displayText}}</1> to display",
|
|
83
82
|
"encounters": "Encounters",
|
|
84
83
|
"encounterType": "Encounter type",
|