@openmrs/esm-appointments-app 5.2.2-pre.2430 → 5.2.2-pre.2441

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.
@@ -80,10 +80,10 @@
80
80
  "initial": true,
81
81
  "entry": true,
82
82
  "recorded": false,
83
- "size": 4538674,
83
+ "size": 4539072,
84
84
  "sizes": {
85
85
  "consume-shared": 252,
86
- "javascript": 4517752,
86
+ "javascript": 4518150,
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": "e2a5317e72ad4308",
103
+ "hash": "a7e8f660b86ec22e",
104
104
  "childrenByOrder": {}
105
105
  },
106
106
  {
@@ -422,9 +422,9 @@
422
422
  "initial": false,
423
423
  "entry": false,
424
424
  "recorded": false,
425
- "size": 480227,
425
+ "size": 480625,
426
426
  "sizes": {
427
- "javascript": 480059,
427
+ "javascript": 480457,
428
428
  "consume-shared": 168
429
429
  },
430
430
  "names": [],
@@ -438,7 +438,7 @@
438
438
  "auxiliaryFiles": [
439
439
  "755.js.map"
440
440
  ],
441
- "hash": "43422d9285aaa607",
441
+ "hash": "ec0e13a531b07fa9",
442
442
  "childrenByOrder": {}
443
443
  },
444
444
  {
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.2430"}
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.2441"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "5.2.2-pre.2430",
3
+ "version": "5.2.2-pre.2441",
4
4
  "description": "Appointments front-end module for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -28,7 +28,6 @@ import {
28
28
  Toggle,
29
29
  } from '@carbon/react';
30
30
  import {
31
- ConfigObject,
32
31
  ExtensionSlot,
33
32
  showNotification,
34
33
  showToast,
@@ -55,6 +54,7 @@ import LocationSelectOption from '../../common-components/location-select-option
55
54
  import WorkloadCard from '../workload.component';
56
55
  import styles from './appointments-form.scss';
57
56
  import { useAppointmentList } from '../../../hooks/useAppointmentList';
57
+ import { ConfigObject } from '../../../config-schema';
58
58
 
59
59
  interface AppointmentFormProps {
60
60
  appointment?: MappedAppointment;
@@ -71,7 +71,8 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
71
71
  const sessionUser = useSession();
72
72
  const isTablet = useLayoutType() === 'tablet';
73
73
  const initialAppointmentFormValues = useInitialAppointmentFormValue(appointment, patientUuid);
74
- const { appointmentTypes, appointmentStatuses, hiddenFormFields } = useConfig<ConfigObject>();
74
+ const { appointmentTypes, appointmentStatuses, hiddenFormFields, allowAllDayAppointments } =
75
+ useConfig<ConfigObject>();
75
76
 
76
77
  const [isSubmitting, setIsSubmitting] = useState(false);
77
78
  const [patientAppointment, setPatientAppointment] = useState<PatientAppointment>(initialAppointmentFormValues);
@@ -225,15 +226,17 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
225
226
  </Column>
226
227
  <Column>
227
228
  <section className={styles.flexRow}>
228
- <Toggle
229
- className={styles.flex1}
230
- defaultToggled={patientAppointment.isFullDay}
231
- id="allDay"
232
- labelA={t('off', 'Off')}
233
- labelB={t('on', 'On')}
234
- labelText={t('allDay', 'All Day')}
235
- onToggle={(value) => setPatientAppointment({ ...patientAppointment, isFullDay: value })}
236
- />
229
+ {allowAllDayAppointments && (
230
+ <Toggle
231
+ className={styles.flex1}
232
+ defaultToggled={patientAppointment.isFullDay}
233
+ id="allDay"
234
+ labelA={t('off', 'Off')}
235
+ labelB={t('on', 'On')}
236
+ labelText={t('allDay', 'All Day')}
237
+ onToggle={(value) => setPatientAppointment({ ...patientAppointment, isFullDay: value })}
238
+ />
239
+ )}
237
240
  <DatePicker
238
241
  dateFormat="d/m/Y"
239
242
  datePickerType="single"
@@ -1,7 +1,8 @@
1
- import { OpenmrsResource, useSession } from '@openmrs/esm-framework';
1
+ import { OpenmrsResource, useConfig, useSession } from '@openmrs/esm-framework';
2
2
  import dayjs from 'dayjs';
3
3
  import { amPm } from '../../helpers';
4
4
  import { MappedAppointment } from '../../types';
5
+ import { ConfigObject } from '../../config-schema';
5
6
 
6
7
  export interface PatientAppointment {
7
8
  appointmentKind: string;
@@ -34,6 +35,7 @@ export const useInitialAppointmentFormValue = (
34
35
  patientUuid: string,
35
36
  ): PatientAppointment => {
36
37
  const session = useSession();
38
+ const { allowAllDayAppointments } = useConfig<ConfigObject>();
37
39
 
38
40
  // Build the initial form value for the appointment.
39
41
  const patientAppointment: PatientAppointment = {
@@ -52,7 +54,7 @@ export const useInitialAppointmentFormValue = (
52
54
  patientUuid: appointment?.patientUuid ?? patientUuid,
53
55
  visitDate: appointment?.dateTime ? new Date(appointment.dateTime) : new Date(),
54
56
  timeFormat: new Date().getHours() >= 12 ? 'PM' : 'AM',
55
- isFullDay: true,
57
+ isFullDay: allowAllDayAppointments,
56
58
  day: appointment?.dateTime,
57
59
  };
58
60
 
@@ -83,6 +83,11 @@ export const configSchema = {
83
83
  'Whether to show the Unscheduled Appointments tab. Note that configuring this to true requires a custom unscheduledAppointment endpoint not currently available',
84
84
  _default: false,
85
85
  },
86
+ allowAllDayAppointments: {
87
+ _type: Type.Boolean,
88
+ _description: 'Whether to allow scheduling of all-day appointments (vs appointments with start time and end time)',
89
+ _default: true,
90
+ },
86
91
  };
87
92
 
88
93
  export interface ConfigObject {
@@ -102,4 +107,5 @@ export interface ConfigObject {
102
107
  customPatientChartUrl: string;
103
108
  patientIdentifierType: string;
104
109
  showUnscheduledAppointmentsTab: boolean;
110
+ allowAllDayAppointments: boolean;
105
111
  }