From a66610d9c20c3da533056d6d1b22728fb0156278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Mon, 3 Jan 2022 16:19:05 -0700 Subject: [PATCH] Zomars/cal 777 switching off paid mode bug (#1401) * Adds Form component * Disabling price sets it to 0 --- pages/event-types/[type].tsx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pages/event-types/[type].tsx b/pages/event-types/[type].tsx index 8c435391..34d1719c 100644 --- a/pages/event-types/[type].tsx +++ b/pages/event-types/[type].tsx @@ -46,6 +46,7 @@ import { WorkingHours } from "@lib/types/schedule"; import { Dialog, DialogContent, DialogTrigger } from "@components/Dialog"; import Shell from "@components/Shell"; import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; +import { Form } from "@components/form/fields"; import CustomInputTypeForm from "@components/pages/eventtypes/CustomInputTypeForm"; import Button from "@components/ui/Button"; import { Scheduler } from "@components/ui/Scheduler"; @@ -500,8 +501,9 @@ const EventTypePage = (props: inferSSRProps) => {
-
{ + { const enteredTitle: string = values.title; const advancedPayload: AdvancedOptions = {}; @@ -514,12 +516,10 @@ const EventTypePage = (props: inferSSRProps) => { advancedPayload.periodEndDate = values.periodDates.endDate || undefined; advancedPayload.minimumBookingNotice = values.minimumBookingNotice; advancedPayload.slotInterval = values.slotInterval; - // prettier-ignore - advancedPayload.price = - !requirePayment ? undefined : - values.price ? Math.round(parseFloat(asStringOrThrow(values.price)) * 100) : - /* otherwise */ 0; - advancedPayload.currency = currency; // + advancedPayload.price = requirePayment + ? Math.round(parseFloat(asStringOrThrow(values.price)) * 100) + : 0; + advancedPayload.currency = currency; advancedPayload.availability = values.scheduler.enteredAvailability || undefined; advancedPayload.customInputs = values.customInputs; advancedPayload.timeZone = values.scheduler.selectedTimezone; @@ -544,7 +544,7 @@ const EventTypePage = (props: inferSSRProps) => { : {}), }; updateMutation.mutate(payload); - })} + }} className="space-y-6">
@@ -1105,7 +1105,7 @@ const EventTypePage = (props: inferSSRProps) => {
- +
@@ -1176,8 +1176,9 @@ const EventTypePage = (props: inferSSRProps) => {
-
{ + { const newLocation = values.locationType; let details = {}; @@ -1200,7 +1201,7 @@ const EventTypePage = (props: inferSSRProps) => { } setShowLocationModal(false); - })}> + }}> ) => { {t("cancel")} - +