From 19eced00f5568446cf2401e03f8b8cb8f554d1bd Mon Sep 17 00:00:00 2001 From: kremedev <134702704+kremedev@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:00:00 +0300 Subject: [PATCH] fix: Unable to modify the location of a booking when rescheduling (#11651) --- apps/web/pages/booking/[uid].tsx | 68 ++++++++++++++++--- .../BookEventForm/BookingFields.tsx | 7 ++ 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx index f91e22c50f..af7b779dc8 100644 --- a/apps/web/pages/booking/[uid].tsx +++ b/apps/web/pages/booking/[uid].tsx @@ -115,6 +115,13 @@ export default function Success(props: SuccessProps) { const tz = props.tz ? props.tz : isSuccessBookingPage && attendeeTimeZone ? attendeeTimeZone : timeZone(); const location = props.bookingInfo.location as ReturnType; + let rescheduleLocation: string | undefined; + if ( + typeof props.bookingInfo.responses.location === "object" && + "optionValue" in props.bookingInfo.responses.location + ) { + rescheduleLocation = props.bookingInfo.responses.location.optionValue; + } const locationVideoCallUrl: string | undefined = bookingMetadataSchema.parse( props?.bookingInfo?.metadata || {} @@ -295,7 +302,14 @@ export default function Success(props: SuccessProps) { bookingInfo.status ); + const rescheduleLocationToDisplay = getSuccessPageLocationMessage( + rescheduleLocation ?? "", + t, + bookingInfo.status + ); + const providerName = guessEventLocationType(location)?.label; + const rescheduleProviderName = guessEventLocationType(rescheduleLocation)?.label; return (
@@ -467,18 +481,50 @@ export default function Success(props: SuccessProps) { <>
{t("where")}
- {locationToDisplay.startsWith("http") ? ( - - {providerName || "Link"} - - + {!rescheduleLocation || locationToDisplay === rescheduleLocationToDisplay ? ( + locationToDisplay.startsWith("http") ? ( + + {providerName || "Link"} + + + ) : ( + locationToDisplay + ) ) : ( - locationToDisplay + <> + {!!formerTime && + (locationToDisplay.startsWith("http") ? ( + + {providerName || "Link"} + + + ) : ( +

{locationToDisplay}

+ ))} + {rescheduleLocationToDisplay.startsWith("http") ? ( + + {rescheduleProviderName || "Link"} + + + ) : ( + rescheduleLocationToDisplay + )} + )}
diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookingFields.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookingFields.tsx index ab1505a787..a10cdae5b1 100644 --- a/packages/features/bookings/Booker/components/BookEventForm/BookingFields.tsx +++ b/packages/features/bookings/Booker/components/BookEventForm/BookingFields.tsx @@ -77,6 +77,13 @@ export const BookingFields = ({ return null; } + // Attendee location field can be edited during reschedule + if (field.name === SystemField.Enum.location) { + if (locationResponse?.value === "attendeeInPerson" || "phone") { + readOnly = false; + } + } + // Dynamically populate location field options if (field.name === SystemField.Enum.location && field.type === "radioInput") { if (!field.optionsInputs) {