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 authored and GitHub committed 2024-08-12 15:03:50 +02:00
1 parent 24936d8b7b
commit 848bcbfb8f
17 files changed
+232 -8

No files matched your search

@@ -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"
@@ -330,6 +330,7 @@ const EventTypePage = (props: EventTypeSetupProps & { allActiveWorkflows?: Workf
},
})),
seatsPerTimeSlotEnabled: eventType.seatsPerTimeSlot,
rescheduleWithSameRoundRobinHost: eventType.rescheduleWithSameRoundRobinHost,
assignAllTeamMembers: eventType.assignAllTeamMembers,
aiPhoneCallConfig: {
generalPrompt: eventType.aiPhoneCallConfig?.generalPrompt ?? DEFAULT_PROMPT_VALUE,
@@ -2529,5 +2529,7 @@
"outlook_connect_atom_already_connected_label": "Connected Outlook Calendar",
"outlook_connect_atom_loading_label": "Checking Outlook Calendar",
"booking_question_response_variables": "Booking question response variables",
"reschedule_with_same_round_robin_host_title": "Reschedule with same Round-Robin host",
"reschedule_with_same_round_robin_host_description": "Rescheduled events will be assigned to the same host as initially scheduled",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -162,6 +162,7 @@ export type InputEventType = {
durationLimits?: IntervalLimit;
owner?: number;
metadata?: any;
rescheduleWithSameRoundRobinHost?: boolean;
} & Partial<Omit<Prisma.EventTypeCreateInput, "users" | "schedule" | "bookingLimits" | "durationLimits">>;
type AttendeeBookingSeatInput = Pick<Prisma.BookingSeatCreateInput, "referenceUid" | "data">;
@@ -353,6 +354,7 @@ export async function addEventTypes(eventTypes: InputEventType[], usersStore: In
: eventType.schedule,
owner: eventType.owner ? { connect: { id: eventType.owner } } : undefined,
schedulingType: eventType.schedulingType,
rescheduleWithSameRoundRobinHost: eventType.rescheduleWithSameRoundRobinHost,
};
});
log.silly("TestData: Creating EventType", JSON.stringify(eventTypesWithUsers));