Scheduling infrastructure for absolutely everyone.
fix/update-days-schedule (#1931)
alannnc9863178025d9
diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsxindex 42676c17c9d..3fb8c88edf6 100644--- a/apps/web/pages/event-types/[type].tsx+++ b/apps/web/pages/event-types/[type].tsx@@ -178,6 +178,11 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {const [requirePayment, setRequirePayment] = useState(eventType.price > 0);const [advancedSettingsVisible, setAdvancedSettingsVisible] = useState(false);+ const [availabilityState, setAvailabilityState] = useState<{+ openingHours: AvailabilityInput[];+ dateOverrides: AvailabilityInput[];+ }>({ openingHours: [], dateOverrides: [] });+useEffect(() => {const fetchTokens = async () => {// Get a list of most popular ERC20s and ERC777s, combine them into a single list, set as tokensList@@ -671,8 +676,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {form={formMethods}handleSubmit={async (values) => {const { periodDates, periodCountCalendarDays, smartContractAddress, ...input } = values;+updateMutation.mutate({...input,+ availability: availabilityState,periodStartDate: periodDates.startDate,periodEndDate: periodDates.endDate,periodCountCalendarDays: periodCountCalendarDays === "1",@@ -1187,10 +1194,14 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {render={() => (<SchedulersetAvailability={(val) => {- formMethods.setValue("availability", {+ const schedule = {openingHours: val.openingHours,dateOverrides: val.dateOverrides,- });+ };+ // Updating internal state that would be sent on mutation+ setAvailabilityState(schedule);+ // Updating form values displayed, but this one doesn't reach form submit scope+ formMethods.setValue("availability", schedule);}}setTimeZone={(timeZone) => {formMethods.setValue("timeZone", timeZone);