@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.
Files changed (40) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/dist/1761.js +1 -0
  3. package/dist/1761.js.map +1 -0
  4. package/dist/2753.js +1 -1
  5. package/dist/2753.js.map +1 -1
  6. package/dist/2923.js +1 -1
  7. package/dist/2923.js.map +1 -1
  8. package/dist/3260.js +1 -1
  9. package/dist/3260.js.map +1 -1
  10. package/dist/3574.js +1 -1
  11. package/dist/6179.js +1 -1
  12. package/dist/6179.js.map +1 -1
  13. package/dist/646.js +1 -1
  14. package/dist/646.js.map +1 -1
  15. package/dist/953.js +1 -0
  16. package/dist/953.js.map +1 -0
  17. package/dist/9874.js +1 -1
  18. package/dist/9874.js.map +1 -1
  19. package/dist/main.js +1 -1
  20. package/dist/main.js.map +1 -1
  21. package/dist/openmrs-esm-appointments-app.js.buildmanifest.json +73 -73
  22. package/dist/routes.json +1 -1
  23. package/package.json +1 -1
  24. package/src/appointments/common-components/appointments-table.component.tsx +4 -3
  25. package/src/appointments/common-components/end-appointment.modal.tsx +1 -1
  26. package/src/form/appointments-form.test.tsx +1 -1
  27. package/src/index.ts +3 -4
  28. package/src/metrics/metrics-header.component.tsx +1 -1
  29. package/src/patient-appointments/patient-appointments-action-menu.component.tsx +15 -24
  30. package/src/patient-appointments/patient-appointments-base.component.tsx +9 -4
  31. package/src/patient-appointments/patient-appointments-cancel.modal.tsx +14 -16
  32. package/src/patient-search/patient-search.component.tsx +2 -3
  33. package/src/routes.json +10 -43
  34. package/translations/en.json +1 -2
  35. package/dist/310.js +0 -1
  36. package/dist/310.js.map +0 -1
  37. package/dist/8906.js +0 -1
  38. package/dist/8906.js.map +0 -1
  39. /package/src/appointments/common-components/{end-appointment.modal.scss → end-appointment.scss} +0 -0
  40. /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.component';
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 patientAppointmentsCancelConfirmationDialog = getAsyncLifecycle(
101
+ export const cancelAppointmentModal = getAsyncLifecycle(
104
102
  () => import('./patient-appointments/patient-appointments-cancel.modal'),
105
103
  options,
106
104
  );
107
105
 
108
- export const appointmentsFormWorkspace = getAsyncLifecycle(() => import('./form/appointments-form.component'), options);
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'),
@@ -24,7 +24,7 @@ const MetricsHeader: React.FC = () => {
24
24
  mutate: () => {}, // TODO get this to mutate properly
25
25
  };
26
26
 
27
- launchWorkspace('create-appointment', { ...props });
27
+ launchWorkspace('appointments-form-workspace', { ...props });
28
28
  };
29
29
 
30
30
  return (
@@ -1,10 +1,9 @@
1
- import React, { useCallback, useContext } from '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 { launchWorkspace, showModal, useLayoutType } from '@openmrs/esm-framework';
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 launchEditAppointmentForm = useCallback(() => {
21
- if (patientAppointmentContext === PatientAppointmentContextTypes.PATIENT_CHART) {
22
- launchPatientWorkspace('appointments-form-workspace', {
23
- workspaceTitle: t('editAppointment', 'Edit an appointment'),
24
- appointment,
25
- context: 'editing',
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 launchCancelAppointmentDialog = () => {
36
- const dispose = showModal('patient-appointment-cancel-confirmation-dialog', {
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
- hasDivider
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 launchAppointmentsForm = () => {
40
+ const handleLaunchAppointmentsForm = () => {
41
41
  if (patientAppointmentContext === PatientAppointmentContextTypes.PATIENT_CHART) {
42
42
  launchPatientWorkspace('appointments-form-workspace');
43
43
  } else {
44
- launchWorkspace('add-appointment', {
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) return <DataTableSkeleton role="progressbar" compact={!isTablet} zebra />;
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={launchAppointmentsForm}>
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 PatientCancelAppointmentModalProps {
8
+ interface CancelAppointmentModalProps {
9
9
  closeCancelModal: () => void;
10
10
  appointmentUuid: string;
11
11
  patientUuid: string;
12
12
  }
13
13
 
14
- const PatientCancelAppointmentModal: React.FC<PatientCancelAppointmentModalProps> = ({
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 handleCancel = async () => {
23
+ const handleCancelAppointment = async () => {
24
24
  setIsSubmitting(true);
25
25
 
26
26
  changeAppointmentStatus('Cancelled', appointmentUuid)
27
- .then(({ status }) => {
28
- if (status === 200) {
29
- mutate();
30
- closeCancelModal();
31
- showSnackbar({
32
- isLowContrast: true,
33
- kind: 'success',
34
- subtitle: t('appointmentCancelledSuccessfully', 'Appointment cancelled successfully'),
35
- title: t('appointmentCancelled', 'Appointment cancelled'),
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={handleCancel} disabled={isSubmitting}>
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 PatientCancelAppointmentModal;
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
- launchWorkspace('create-appointment', { ...props });
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": "patient-appointment-cancel-confirmation-dialog",
152
- "component": "patientAppointmentsCancelConfirmationDialog"
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
  }
@@ -77,8 +77,7 @@
77
77
  "durationInMinutes": "Duration (minutes)",
78
78
  "durationMins": "Duration min",
79
79
  "edit": "Edit",
80
- "editAppointment": "Edit Appointment",
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",