From f79a7a540c76042b8545cb503d22447b095d1915 Mon Sep 17 00:00:00 2001 From: Mark Goodrich Date: Mon, 12 Feb 2024 13:21:08 -0500 Subject: [PATCH] O3-2827: Appointments: Refactor (Part I ?) add back in all day functionality --- .../esm-appointments-app/src/config-schema.ts | 6 ++++ .../src/form/appointments-form.component.tsx | 33 ++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/packages/esm-appointments-app/src/config-schema.ts b/packages/esm-appointments-app/src/config-schema.ts index b7e3ce853..86dd54497 100644 --- a/packages/esm-appointments-app/src/config-schema.ts +++ b/packages/esm-appointments-app/src/config-schema.ts @@ -85,6 +85,11 @@ export const configSchema = { 'Whether to show the Unscheduled Appointments tab. Note that configuring this to true requires a custom unscheduledAppointment endpoint not currently available', _default: false, }, + allowAllDayAppointments: { + _type: Type.Boolean, + _description: 'Whether to allow scheduling of all-day appointments (vs appointments with start time and end time)', + _default: true, + }, }; export interface ConfigObject { @@ -104,4 +109,5 @@ export interface ConfigObject { customPatientChartUrl: string; patientIdentifierType: string; showUnscheduledAppointmentsTab: boolean; + allowAllDayAppointments: boolean; } diff --git a/packages/esm-appointments-app/src/form/appointments-form.component.tsx b/packages/esm-appointments-app/src/form/appointments-form.component.tsx index b89d72e96..5b0fdafed 100644 --- a/packages/esm-appointments-app/src/form/appointments-form.component.tsx +++ b/packages/esm-appointments-app/src/form/appointments-form.component.tsx @@ -84,9 +84,10 @@ const AppointmentsForm: React.FC = ({ const locations = useLocations(); const session = useSession(); const { data: services, isLoading } = useAppointmentService(); - const { appointmentStatuses, appointmentTypes } = useConfig(); + const { appointmentStatuses, appointmentTypes, allowAllDayAppointments } = useConfig(); const [isRecurringAppointment, setIsRecurringAppointment] = useState(false); + const [isAllDayAppointment, setIsAllDayAppointment] = useState(false); const defaultRecurringPatternType = recurringPattern?.type || 'DAY'; const defaultRecurringPatternPeriod = recurringPattern?.period || 1; @@ -396,6 +397,16 @@ const AppointmentsForm: React.FC = ({
{isRecurringAppointment && (
+ {allowAllDayAppointments && ( + setIsAllDayAppointment(!isAllDayAppointment)} + toggled={isAllDayAppointment} + /> + )} = ({ /> - + {!isAllDayAppointment && ( + + )} = ({ {!isRecurringAppointment && (
+ {allowAllDayAppointments && ( + setIsAllDayAppointment(!isAllDayAppointment)} + toggled={isAllDayAppointment} + /> + )} = ({ /> - + {!isAllDayAppointment && ( + + )}
)}
{getValues('selectedService') && ( -
+