@openmrs/esm-appointments-app 8.5.1-pre.5634 → 8.5.1-pre.5642

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.
@@ -30,4 +30,4 @@ Assets:
30
30
  2164.js (275 KiB)
31
31
  5449.js (1.6 MiB)
32
32
 
33
- webpack 5.99.9 compiled with 1 warning in 147939 ms
33
+ webpack 5.99.9 compiled with 1 warning in 135300 ms
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"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"Appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"search-patient","component":"searchPatient"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"}],"workspaces":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","title":"createNewAppointment","type":"form"}],"version":"8.5.1-pre.5634"}
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"},"order":2},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-dashboard","slot":"appointments-dashboard-slot","component":"appointmentsDashboard"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsList"},{"name":"early-appointments-panel","component":"earlyAppointments"},{"name":"patient-appointments-summary-dashboard","component":"patientAppointmentsSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"hideDashboardTitle":true,"path":"Appointments","slot":"patient-chart-appointments-dashboard-slot","title":"Appointments"}},{"name":"appointments-details-widget","component":"patientAppointmentsDetailedSummary","slot":"patient-chart-appointments-dashboard-slot","meta":{"columnSpan":1}},{"name":"patient-upcoming-appointment-widget","component":"patientUpcomingAppointmentsWidget","slot":"visit-form-top-slot"},{"name":"search-patient","component":"searchPatient"},{"name":"home-appointments-tile","slot":"home-metrics-tiles-slot","component":"homeAppointmentsTile"}],"modals":[{"name":"end-appointment-modal","component":"endAppointmentModal"},{"name":"cancel-appointment-modal","component":"cancelAppointmentModal"}],"workspaces":[{"name":"appointments-form-workspace","component":"appointmentsFormWorkspace","title":"createNewAppointment","type":"form"}],"version":"8.5.1-pre.5642"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "8.5.1-pre.5634",
3
+ "version": "8.5.1-pre.5642",
4
4
  "description": "Appointments front-end module for O3",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -1,31 +0,0 @@
1
- import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
- import { type AppointmentService } from '../../types';
3
-
4
- const appointmentServiceInitialValue: AppointmentService = {
5
- appointmentServiceId: 0,
6
- creatorName: '',
7
- description: '',
8
- durationMins: 0,
9
- endTime: '',
10
- initialAppointmentStatus: '',
11
- location: { uuid: '', display: '' },
12
- maxAppointmentsLimit: 0,
13
- name: '',
14
- startTime: '',
15
- uuid: '',
16
- color: '',
17
- startTimeTimeFormat: new Date().getHours() >= 12 ? 'PM' : 'AM',
18
- endTimeTimeFormat: new Date().getHours() >= 12 ? 'PM' : 'AM',
19
- };
20
-
21
- const addNewAppointmentService = (payload) => {
22
- return openmrsFetch(`${restBaseUrl}/appointmentService`, {
23
- method: 'POST',
24
- body: payload,
25
- headers: { 'Content-Type': 'application/json' },
26
- });
27
- };
28
-
29
- export const useAppointmentServices = () => {
30
- return { appointmentServiceInitialValue, addNewAppointmentService };
31
- };
@@ -1,17 +0,0 @@
1
- import * as Yup from 'yup';
2
- import { OpenmrsResource } from '@openmrs/esm-framework';
3
-
4
- export const validationSchema = Yup.object({
5
- description: Yup.string().optional(),
6
- durationMins: Yup.number().required('durationMinsRequired'),
7
- endTime: Yup.string().required('endTimeRequired'),
8
- initialAppointmentStatus: Yup.string().optional(),
9
- location: Yup.object({ uuid: Yup.string(), display: Yup.string() }).required('locationRequired'),
10
- maxAppointmentsLimit: Yup.number().required('maxAppointmentLimitRequired'),
11
- name: Yup.string().required('appointmentServiceNameRequired'),
12
- specialityUuid: Yup.string().optional(),
13
- startTime: Yup.string().required('startTimeRequired'),
14
- color: Yup.string().required('colorRequired'),
15
- startTimeTimeFormat: Yup.string().required('startTimeFormatRequired'),
16
- endTimeTimeFormat: Yup.string().required('endTimeFormatRequired'),
17
- });
@@ -1,182 +0,0 @@
1
- import React from 'react';
2
- import { Button, ButtonSet, Dropdown, Layer, SelectItem, TextInput, TimePicker, TimePickerSelect } from '@carbon/react';
3
- import { useTranslation } from 'react-i18next';
4
- import { Form, Formik, type FormikHelpers } from 'formik';
5
- import { validationSchema } from './appointment-services-validation';
6
- import { useAppointmentServices } from './appointment-services-hook';
7
- import { showSnackbar, useLocations } from '@openmrs/esm-framework';
8
- import type { AppointmentService } from '../../types';
9
- import { closeOverlay } from '../../hooks/useOverlay';
10
- import styles from './appointment-services.scss';
11
- import { appointmentLocationTagName } from '../../constants';
12
-
13
- interface AppointmentServicesProps {}
14
-
15
- const AppointmentServices: React.FC<AppointmentServicesProps> = () => {
16
- const { t } = useTranslation();
17
- const { appointmentServiceInitialValue, addNewAppointmentService } = useAppointmentServices();
18
-
19
- const locations = useLocations(appointmentLocationTagName);
20
- const handleSubmit = async (values: AppointmentService, helpers: FormikHelpers<AppointmentService>) => {
21
- const payload = {
22
- name: values.name,
23
- startTime: values.startTime.concat(':00'),
24
- endTime: values.endTime.concat(':00'),
25
- durationMins: values.durationMins,
26
- color: values.color,
27
- locationUuid: values.location.uuid,
28
- };
29
- addNewAppointmentService(payload).then(
30
- ({ status }) => {
31
- if (status === 200) {
32
- showSnackbar({
33
- isLowContrast: true,
34
- kind: 'success',
35
- subtitle: t('appointmentServiceCreate', 'Appointment service created successfully'),
36
- title: t('appointmentService', 'Appointment service'),
37
- });
38
- closeOverlay();
39
- }
40
- },
41
- (error) => {
42
- showSnackbar({
43
- title: t('errorCreatingAppointmentService', 'Error creating appointment service'),
44
- kind: 'error',
45
- subtitle: error?.message,
46
- });
47
- },
48
- );
49
- };
50
- return (
51
- <Formik
52
- onSubmit={handleSubmit}
53
- isInitialValid={false}
54
- validationSchema={validationSchema}
55
- initialValues={appointmentServiceInitialValue}>
56
- {(props) => {
57
- return (
58
- <Form onSubmit={props.handleSubmit} className={styles.appointmentServiceContainer}>
59
- <p className={styles.formTitle}>{t('createAppointmentService', 'Create appointment service')}</p>
60
- <Layer>
61
- <TextInput
62
- id="name"
63
- invalidText={t(props.errors.name)}
64
- labelText={t('appointmentServiceName', 'Appointment service name')}
65
- placeholder={t('appointmentServiceName', 'Appointment service name')}
66
- invalid={!!(props.touched && props.errors.name)}
67
- onChange={props.handleChange}
68
- value={props.values.name}
69
- name="name"
70
- onBlue={props.handleBlur}
71
- />
72
- </Layer>
73
- <Layer>
74
- <TimePicker
75
- className={styles.timePickerInput}
76
- invalid={!!(props.touched && props.errors.startTime)}
77
- pattern="([\d]+:[\d]{2})"
78
- name="startTime"
79
- value={props.values.startTime}
80
- onChange={props.handleChange}
81
- labelText={t('startTime', 'Start Time')}
82
- id="start-time-picker">
83
- <TimePickerSelect
84
- name="startTimeTimeFormat"
85
- onChange={props.handleChange}
86
- value={props.values.startTimeTimeFormat}
87
- invalid={!!(props.touched && props.errors.startTimeTimeFormat)}
88
- id="start-time-picker"
89
- labelText={t('time', 'Time')}
90
- aria-label={t('time', 'Time')}>
91
- <SelectItem value="AM" text="AM" />
92
- <SelectItem value="PM" text="PM" />
93
- </TimePickerSelect>
94
- </TimePicker>
95
- </Layer>
96
-
97
- <Layer>
98
- <TimePicker
99
- invalid={!!(props.touched && props.errors.endTime)}
100
- className={styles.timePickerInput}
101
- pattern="([\d]+:[\d]{2})"
102
- value={props.values.endTime}
103
- name="endTime"
104
- onChange={props.handleChange}
105
- labelText={t('endTime', 'End Time')}
106
- id="end-time-picker">
107
- <TimePickerSelect
108
- name="endTimeTimeFormat"
109
- onChange={props.handleChange}
110
- id="end-time-picker"
111
- value={props.values.endTimeTimeFormat}
112
- labelText={t('time', 'Time')}
113
- aria-label={t('time', 'Time')}>
114
- <SelectItem value="AM" text="AM" />
115
- <SelectItem value="PM" text="PM" />
116
- </TimePickerSelect>
117
- </TimePicker>
118
- </Layer>
119
-
120
- <Layer>
121
- <TextInput
122
- id="durationMins"
123
- invalidText={props.errors.durationMins}
124
- labelText={t('durationMins', 'Duration min')}
125
- placeholder={t('durationMins', 'Duration min')}
126
- invalid={!!(props.touched && props.errors.durationMins)}
127
- onChange={props.handleChange}
128
- value={props.values.durationMins}
129
- name="durationMins"
130
- />
131
- </Layer>
132
-
133
- <Layer>
134
- <Dropdown
135
- id="default"
136
- titleText={t('selectLocation', 'Select location')}
137
- label={t('selectLocation', 'Select location')}
138
- items={locations}
139
- itemToString={(item) => (item ? item.display : '')}
140
- selectedItem={props.values.location}
141
- invalid={!!(props.touched && props.errors.location?.uuid)}
142
- name="location"
143
- onChange={({ selectedItem }) => props.setValues({ ...props.values, location: selectedItem })}
144
- />
145
- </Layer>
146
-
147
- <Layer>
148
- <TextInput
149
- invalid={!!(props.touched && props.errors.color)}
150
- onChange={props.handleChange}
151
- invalidText={props.errors.color}
152
- labelText={t('appointmentColor', 'Appointment color')}
153
- type="color"
154
- name="color"
155
- />
156
- </Layer>
157
-
158
- <ButtonSet className={styles.buttonSet}>
159
- <Button
160
- onClick={closeOverlay}
161
- style={{ maxWidth: 'none', width: '50%' }}
162
- className={styles.button}
163
- kind="secondary">
164
- {t('discard', 'Discard')}
165
- </Button>
166
- <Button
167
- disabled={!props.isValid}
168
- style={{ maxWidth: 'none', width: '50%' }}
169
- className={styles.button}
170
- kind="primary"
171
- type="submit">
172
- {t('save', 'Save')}
173
- </Button>
174
- </ButtonSet>
175
- </Form>
176
- );
177
- }}
178
- </Formik>
179
- );
180
- };
181
-
182
- export default AppointmentServices;
@@ -1,25 +0,0 @@
1
- @use '@carbon/layout';
2
-
3
- .appointmentServiceContainer {
4
- margin: layout.$spacing-05 layout.$spacing-05;
5
-
6
- & > div {
7
- padding: layout.$spacing-03 0;
8
- }
9
- }
10
-
11
- .buttonSet {
12
- position: absolute;
13
- bottom: 0;
14
- left: 0;
15
- right: 0;
16
- margin: 0 layout.$spacing-05;
17
- }
18
-
19
- .button {
20
- height: layout.$spacing-10;
21
- display: flex;
22
- align-content: flex-start;
23
- align-items: baseline;
24
- width: auto;
25
- }
@@ -1,45 +0,0 @@
1
- import { getGlobalStore } from '@openmrs/esm-framework';
2
- import { useCallback, useEffect, useState } from 'react';
3
-
4
- export interface OverlayStore {
5
- isOverlayOpen: boolean;
6
- component?: any;
7
- header: string;
8
- }
9
-
10
- const initialState: OverlayStore = { isOverlayOpen: false, header: '' };
11
-
12
- const getOverlayStore = () => {
13
- return getGlobalStore('appointment-store', initialState);
14
- };
15
-
16
- export const launchOverlay = (headerTitle: string, componentToRender: any) => {
17
- const store = getOverlayStore();
18
- store.setState({ isOverlayOpen: true, component: componentToRender, header: headerTitle });
19
- };
20
-
21
- export const closeOverlay = (): void => {
22
- const store = getOverlayStore();
23
- store.setState({ component: null, isOverlayOpen: false });
24
- };
25
-
26
- export const useOverlay = () => {
27
- const [overlay, setOverlay] = useState<OverlayStore>();
28
-
29
- const update = useCallback((state: OverlayStore) => {
30
- setOverlay(state);
31
- }, []);
32
-
33
- useEffect(() => {
34
- update(getOverlayStore().getState());
35
- getOverlayStore().subscribe(update);
36
- }, [update]);
37
-
38
- const { isOverlayOpen, component, header } = overlay ?? {};
39
-
40
- return {
41
- isOverlayOpen,
42
- component,
43
- header,
44
- };
45
- };