diff --git a/apps/web/components/eventtype/EventAdvancedTab.tsx b/apps/web/components/eventtype/EventAdvancedTab.tsx index 563250a671..6ddba9b78b 100644 --- a/apps/web/components/eventtype/EventAdvancedTab.tsx +++ b/apps/web/components/eventtype/EventAdvancedTab.tsx @@ -433,6 +433,23 @@ export const EventAdvancedTab = ({ eventType, team }: Pick )} /> + ( + onChange(e)} + /> + )} + /> {allowDisablingAttendeeConfirmationEmails(workflows) && ( <> { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore // eslint-disable-next-line - const { schedulingType, id, teamId, timeZone, users, requiresBookerEmailVerification, ...evType } = - mockFindFirstEventType({ - id: 123, - metadata: { managedEventConfig: {} }, - locations: [], - }); + const { + schedulingType, + id, + teamId, + timeZone, + requiresBookerEmailVerification, + lockTimeZoneToggleOnBookingPage, + ...evType + } = mockFindFirstEventType({ + id: 123, + metadata: { managedEventConfig: {} }, + locations: [], + }); const result = await updateChildrenEventTypes({ eventTypeId: 1, oldEventType: { children: [], team: { name: "" } }, @@ -145,6 +152,7 @@ describe("handleChildrenEventTypes", () => { userId, scheduleId, requiresBookerEmailVerification, + lockTimeZoneToggleOnBookingPage, ...evType } = mockFindFirstEventType({ metadata: { managedEventConfig: {} }, @@ -230,12 +238,19 @@ describe("handleChildrenEventTypes", () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore // eslint-disable-next-line - const { schedulingType, id, teamId, timeZone, users, requiresBookerEmailVerification, ...evType } = - mockFindFirstEventType({ - id: 123, - metadata: { managedEventConfig: {} }, - locations: [], - }); + const { + schedulingType, + id, + teamId, + timeZone, + requiresBookerEmailVerification, + lockTimeZoneToggleOnBookingPage, + ...evType + } = mockFindFirstEventType({ + id: 123, + metadata: { managedEventConfig: {} }, + locations: [], + }); prismaMock.eventType.deleteMany.mockResolvedValue([123] as unknown as Prisma.BatchPayload); const result = await updateChildrenEventTypes({ eventTypeId: 1, @@ -277,6 +292,7 @@ describe("handleChildrenEventTypes", () => { parentId, userId, requiresBookerEmailVerification, + lockTimeZoneToggleOnBookingPage, ...evType } = mockFindFirstEventType({ metadata: { managedEventConfig: {} }, @@ -327,6 +343,7 @@ describe("handleChildrenEventTypes", () => { userId: _userId, // eslint-disable-next-line @typescript-eslint/no-unused-vars requiresBookerEmailVerification, + lockTimeZoneToggleOnBookingPage, ...evType } = mockFindFirstEventType({ metadata: { managedEventConfig: {} }, diff --git a/packages/features/bookings/Booker/components/EventMeta.tsx b/packages/features/bookings/Booker/components/EventMeta.tsx index 83bcfc6312..f282e48d5e 100644 --- a/packages/features/bookings/Booker/components/EventMeta.tsx +++ b/packages/features/bookings/Booker/components/EventMeta.tsx @@ -105,6 +105,7 @@ export const EventMeta = () => { )} + { {bookerState === "booking" ? ( <>{timezone} ) : ( - + { }} value={timezone} onChange={(tz) => setTimezone(tz.value)} + isDisabled={event.lockTimeZoneToggleOnBookingPage} /> )} diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 3488442086..997b318bf4 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -276,6 +276,7 @@ const getEventTypesFromDB = async (eventTypeId: number) => { periodEndDate: true, periodDays: true, periodCountCalendarDays: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, userId: true, @@ -2686,6 +2687,7 @@ const findBookingQuery = async (bookingId: number) => { description: true, currency: true, length: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, price: true, diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.ts index 3b6d8f704f..85bab2e26f 100644 --- a/packages/features/eventtypes/lib/getPublicEvent.ts +++ b/packages/features/eventtypes/lib/getPublicEvent.ts @@ -33,6 +33,7 @@ const publicEventSelect = Prisma.validator()({ customInputs: true, disableGuests: true, metadata: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, recurringEvent: true, diff --git a/packages/lib/defaultEvents.ts b/packages/lib/defaultEvents.ts index 5aba14feaa..5243b63ebd 100644 --- a/packages/lib/defaultEvents.ts +++ b/packages/lib/defaultEvents.ts @@ -86,6 +86,7 @@ const commons = { recurringEvent: null, destinationCalendar: null, team: null, + lockTimeZoneToggleOnBookingPage: false, requiresConfirmation: false, requiresBookerEmailVerification: false, bookingLimits: null, diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts index 7ce86719fd..be26508d9f 100644 --- a/packages/lib/getEventTypeById.ts +++ b/packages/lib/getEventTypeById.ts @@ -89,6 +89,7 @@ export default async function getEventTypeById({ periodStartDate: true, periodEndDate: true, periodCountCalendarDays: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, recurringEvent: true, diff --git a/packages/lib/test/builder.ts b/packages/lib/test/builder.ts index 7769023a59..bd9e9fc516 100644 --- a/packages/lib/test/builder.ts +++ b/packages/lib/test/builder.ts @@ -85,6 +85,7 @@ export const buildEventType = (eventType?: Partial): EventType => { periodDays: null, periodCountCalendarDays: null, recurringEvent: null, + lockTimeZoneToggleOnBookingPage: false, requiresConfirmation: false, disableGuests: false, hideCalendarNotes: false, diff --git a/packages/prisma/migrations/20231020090443_add_lock_timezone_toggle/migration.sql b/packages/prisma/migrations/20231020090443_add_lock_timezone_toggle/migration.sql new file mode 100644 index 0000000000..c97b6146c5 --- /dev/null +++ b/packages/prisma/migrations/20231020090443_add_lock_timezone_toggle/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "EventType" ADD COLUMN "lockTimeZoneToggleOnBookingPage" BOOLEAN NOT NULL DEFAULT false; diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index 7eee884084..6356442fa9 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -86,6 +86,7 @@ model EventType { periodEndDate DateTime? periodDays Int? periodCountCalendarDays Boolean? + lockTimeZoneToggleOnBookingPage Boolean @default(false) requiresConfirmation Boolean @default(false) requiresBookerEmailVerification Boolean @default(false) /// @zod.custom(imports.recurringEventType) diff --git a/packages/prisma/selects/event-types.ts b/packages/prisma/selects/event-types.ts index c47e148dde..35733ede28 100644 --- a/packages/prisma/selects/event-types.ts +++ b/packages/prisma/selects/event-types.ts @@ -11,6 +11,7 @@ export const baseEventTypeSelect = Prisma.validator()({ hidden: true, price: true, currency: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, }); @@ -28,6 +29,7 @@ export const bookEventTypeSelect = Prisma.validator()({ periodStartDate: true, periodEndDate: true, recurringEvent: true, + lockTimeZoneToggleOnBookingPage: true, requiresConfirmation: true, requiresBookerEmailVerification: true, metadata: true,