From 33e81987796db2dc3057d927f54e8f61788875ce Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:44:29 -0400 Subject: [PATCH] Hotfix To Seats on Event Types (#4528) * Hotfix * Add seats input to event type page --- .../components/booking/pages/BookingPage.tsx | 10 ++--- .../v2/eventtype/EventAdvancedTab.tsx | 42 +++++++++++++++++++ apps/web/pages/api/book/event.ts | 17 ++++---- apps/web/public/static/locales/en/common.json | 5 ++- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx index 8067a6f8d7..b89182af17 100644 --- a/apps/web/components/booking/pages/BookingPage.tsx +++ b/apps/web/components/booking/pages/BookingPage.tsx @@ -199,16 +199,12 @@ const BookingPage = ({ // There should only exists one default userData variable for primaryAttendee. const defaultUserValues = { - email: booking?.attendees[0].email - ? booking.attendees[0].email + email: rescheduleUid + ? booking?.attendees[0].email : router.query.email ? (router.query.email as string) : "", - name: booking?.attendees[0].name - ? booking.attendees[0].name - : router.query.name - ? (router.query.name as string) - : "", + name: rescheduleUid ? booking?.attendees[0].name : router.query.name ? (router.query.name as string) : "", }; const defaultValues = () => { diff --git a/apps/web/components/v2/eventtype/EventAdvancedTab.tsx b/apps/web/components/v2/eventtype/EventAdvancedTab.tsx index c307f28ce0..17f1403c0c 100644 --- a/apps/web/components/v2/eventtype/EventAdvancedTab.tsx +++ b/apps/web/components/v2/eventtype/EventAdvancedTab.tsx @@ -41,6 +41,8 @@ export const EventAdvancedTab = ({ eventType, team }: Pick( eventType.customInputs.sort((a, b) => a.id - b.id) || [] ); @@ -293,6 +295,46 @@ export const EventAdvancedTab = ({ eventType, team }: Pick )} /> +
+ ( + <> +
+ { + setSeatsInputVisible(e); + onChange(e ? seatsPerTimeSlot : null); + }} + fitToHeight={true} + /> +
+ +

{t("offer_seats_description")}

+
+
+ {seatsInputVisible && ( +
+ {t("seats")}} + onChange={(e) => { + formMethods.setValue("seatsPerTimeSlot", Number(e.target.value)); + }} + /> +
+ )} + + )} + /> {showEventNameTip && (