feat: provide option to allow rescheduling with the same round-robin host (#15132)

* feat: provide option to allow rescheduling with the same round-robin
host

* update

* fix type error

* fix and update

* fix type error

* update

* remove

* Update getEventTypesFromDB.ts

* add test

* small fix

* fix requested changes
This commit is contained in:
Anik Dhabal Babu
2024-08-12 15:03:50 +02:00
committed by GitHub
parent 24936d8b7b
commit 848bcbfb8f
17 changed files with 232 additions and 8 deletions
@@ -23,6 +23,7 @@ import { APP_NAME, IS_VISUAL_REGRESSION_TESTING, WEBSITE_URL } from "@calcom/lib
import { generateHashedLink } from "@calcom/lib/generateHashedLink";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { Prisma } from "@calcom/prisma/client";
import { SchedulingType } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import {
Alert,
@@ -88,6 +89,9 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
formMethods.getValues("metadata")?.apps?.stripe?.enabled === true &&
formMethods.getValues("metadata")?.apps?.stripe?.paymentOption === "HOLD";
const isRoundRobinEventType =
eventType.schedulingType && eventType.schedulingType === SchedulingType.ROUND_ROBIN;
useEffect(() => {
!hashedUrl && setHashedUrl(generateHashedLink(formMethods.getValues("users")[0]?.id ?? team?.id));
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -533,6 +537,22 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
/>
)}
/>
{isRoundRobinEventType && (
<Controller
name="rescheduleWithSameRoundRobinHost"
render={({ field: { value, onChange } }) => (
<SettingsToggle
labelClassName="text-sm"
toggleSwitchAtTheEnd={true}
switchContainerClassName="border-subtle rounded-lg border py-6 px-4 sm:px-6"
title={t("reschedule_with_same_round_robin_host_title")}
description={t("reschedule_with_same_round_robin_host_description")}
checked={value}
onCheckedChange={(e) => onChange(e)}
/>
)}
/>
)}
{allowDisablingAttendeeConfirmationEmails(workflows) && (
<Controller
name="metadata.disableStandardEmails.confirmation.attendee"