ix disable cancelling persistence and rescheduling toggle (#26131)

This commit is contained in:
Anik Dhabal Babu
2025-12-22 15:31:16 +00:00
committed by GitHub
parent 76b53eb3d4
commit c746fdcdfe
2 changed files with 8 additions and 9 deletions
@@ -44,11 +44,11 @@ export default function DisableReschedulingController({
);
const radioGroupOnValueChangeRef = useRef<((val: string) => void) | null>(null);
const shouldShowRadioButtons =
const [shouldShowRadioButtons, setShouldShowRadioButtons] = useState(
disableRescheduling ||
(currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0) ||
eventType.disableRescheduling === true;
eventType.disableRescheduling === true || false
);
useEffect(() => {
if (currentMinimumRescheduleNotice && currentMinimumRescheduleNotice > 0) {
setMinimumRescheduleNoticeValue(currentMinimumRescheduleNotice);
@@ -93,10 +93,12 @@ export default function DisableReschedulingController({
onChange(true);
onDisableRescheduling(true);
formMethods.setValue("minimumRescheduleNotice", null, { shouldDirty: true });
setShouldShowRadioButtons(true);
} else {
onChange(false);
onDisableRescheduling(false);
formMethods.setValue("minimumRescheduleNotice", null, { shouldDirty: true });
setShouldShowRadioButtons(false);
}
}}>
{shouldShowRadioButtons && (
@@ -541,8 +541,6 @@ export const EventAdvancedTab = ({
multiplePrivateLinksLocked.disabled = true;
}
const [disableCancelling, setDisableCancelling] = useState(eventType.disableCancelling || false);
const [disableRescheduling, setDisableRescheduling] = useState(eventType.disableRescheduling || false);
const [allowReschedulingCancelledBookings, setallowReschedulingCancelledBookings] = useState(
@@ -691,8 +689,8 @@ export const EventAdvancedTab = ({
{!isPlatform && (
<>
<Controller
name="disableCancelling"
render={({ field: { onChange } }) => (
name="disabledCancelling"
render={({ field: { onChange, value } }) => (
<SettingsToggle
labelClassName="text-sm"
toggleSwitchAtTheEnd={true}
@@ -707,9 +705,8 @@ export const EventAdvancedTab = ({
href="https://cal.com/help/event-types/disable-canceling-rescheduling#disable-cancelling"
/>
}
checked={disableCancelling}
checked={value}
onCheckedChange={(val) => {
setDisableCancelling(val);
onChange(val);
}}
/>