Fixes minimumBookingNotice (#4656)
parent
f14b13a1ba
commit
91909281bc
|
@ -6,7 +6,7 @@ import { useFormContext, Controller, useWatch } from "react-hook-form";
|
||||||
import { classNames } from "@calcom/lib";
|
import { classNames } from "@calcom/lib";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { PeriodType } from "@calcom/prisma/client";
|
import { PeriodType } from "@calcom/prisma/client";
|
||||||
import { Select, Switch, Label, Input } from "@calcom/ui/v2";
|
import { Select, Switch, Label, Input, TextField } from "@calcom/ui/v2";
|
||||||
import DateRangePicker from "@calcom/ui/v2/core/form/date-range-picker/DateRangePicker";
|
import DateRangePicker from "@calcom/ui/v2/core/form/date-range-picker/DateRangePicker";
|
||||||
|
|
||||||
export const EventLimitsTab = (props: Pick<EventTypeSetupInfered, "eventType">) => {
|
export const EventLimitsTab = (props: Pick<EventTypeSetupInfered, "eventType">) => {
|
||||||
|
@ -113,35 +113,12 @@ export const EventLimitsTab = (props: Pick<EventTypeSetupInfered, "eventType">)
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col space-y-4 pt-4 lg:flex-row lg:space-y-0 lg:space-x-4">
|
<div className="flex flex-col space-y-4 pt-4 lg:flex-row lg:space-y-0 lg:space-x-4">
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Label htmlFor="minimumBookingNotice">{t("minimum_booking_notice")} </Label>
|
<TextField
|
||||||
<Controller
|
required
|
||||||
name="minimumBookingNotice"
|
label={t("minimum_booking_notice")}
|
||||||
control={formMethods.control}
|
type="number"
|
||||||
defaultValue={eventType.minimumBookingNotice || 0}
|
placeholder="120"
|
||||||
render={({ field: { onChange, value } }) => {
|
{...formMethods.register("minimumBookingNotice", { valueAsNumber: true })}
|
||||||
const minimumBookingOptions = [
|
|
||||||
{
|
|
||||||
label: t("event_buffer_default"),
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
...[5, 10, 15, 20, 30, 45, 60, 90, 120].map((minutes) => ({
|
|
||||||
label: minutes + " " + t("minutes"),
|
|
||||||
value: minutes,
|
|
||||||
})),
|
|
||||||
];
|
|
||||||
return (
|
|
||||||
<Select
|
|
||||||
isSearchable={false}
|
|
||||||
onChange={(val) => {
|
|
||||||
if (val) onChange(val.value);
|
|
||||||
}}
|
|
||||||
defaultValue={
|
|
||||||
minimumBookingOptions.find((option) => option.value === value) || minimumBookingOptions[0]
|
|
||||||
}
|
|
||||||
options={minimumBookingOptions}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
|
|
Loading…
Reference in New Issue