@licklist/design 0.67.5-dev.1 → 0.67.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.cjs +12 -15
- package/dist/assets/iframe/selectArrow.svg.js +17 -0
- package/dist/auth/Login/LoginComponent.js +1 -2
- package/dist/calendar/Calendar.d.ts +1 -1
- package/dist/calendar/Calendar.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +40 -35
- package/dist/calendar/utils/index.d.ts +2 -2
- package/dist/calendar/utils/index.d.ts.map +1 -1
- package/dist/calendar/utils/index.js +4 -20
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -2
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +4 -4
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +26 -27
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +3 -3
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -0
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +0 -2
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/layout/DropDown.d.ts +1 -2
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts +1 -3
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +8 -172
- package/dist/product-set/card/ProductSetCard.d.ts +2 -6
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +11 -30
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts +2 -3
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.js +1 -3
- package/dist/product-set/control/DateInput.d.ts.map +1 -1
- package/dist/product-set/control/DateInput.js +2 -2
- package/dist/product-set/control/ProductSetControl.d.ts +3 -3
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +16 -4
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +2 -48
- package/dist/product-set/form/ProductSetForm.d.ts +2 -6
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +5 -65
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +2 -0
- package/dist/product-set/form/SelectCategoryModal.d.ts +0 -12
- package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
- package/dist/product-set/form/SelectCategoryModal.js +1 -1
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +3 -0
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +3 -0
- package/dist/product-set/form/index.d.ts +0 -1
- package/dist/product-set/form/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.d.ts +0 -7
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +1 -10
- package/dist/provider/location-input/LocationInput.d.ts +1 -4
- package/dist/provider/location-input/LocationInput.d.ts.map +1 -1
- package/dist/provider/location-input/LocationInput.js +2 -41
- package/dist/provider/location-input/LocationInputDescription.d.ts +1 -4
- package/dist/provider/location-input/LocationInputDescription.d.ts.map +1 -1
- package/dist/provider/location-input/LocationInputDescription.js +12 -27
- package/dist/provider/location-input/index.d.ts +0 -1
- package/dist/provider/location-input/index.d.ts.map +1 -1
- package/dist/provider/provider-form/ProviderForm.d.ts +1 -3
- package/dist/provider/provider-form/ProviderForm.d.ts.map +1 -1
- package/dist/provider/provider-form/ProviderForm.js +3 -7
- package/dist/provider/venue-form/VenueForm.d.ts +1 -3
- package/dist/provider/venue-form/VenueForm.d.ts.map +1 -1
- package/dist/provider/venue-form/VenueForm.js +3 -7
- package/dist/provider/working-hours-input/WorkingHoursInput.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInput.js +2 -2
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +14 -7
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +1 -2
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +13 -7
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -4
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +3 -7
- package/dist/recurring-date-picker-input/utils.d.ts +0 -5
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +3 -83
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +7 -4
- package/dist/sales/guest-profile/previous-bookings/PreviousBookings.js +1 -1
- package/dist/sales/manual-booking/formatDays.js +3 -3
- package/dist/sales/manual-booking/select-event/SelectEvent.d.ts.map +1 -1
- package/dist/sales/manual-booking/select-event/SelectEvent.js +3 -3
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.js +2 -2
- package/dist/sales/notes/NotesTableRow.js +4 -3
- package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
- package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +0 -6
- package/dist/sortable-tree/SortableTreeItem.d.ts +1 -2
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +4 -10
- package/dist/styles/auth/AccessDenied.scss +1 -1
- package/dist/styles/back-button/BackButton.scss +24 -25
- package/dist/styles/back-button/_index.scss +1 -1
- package/dist/styles/company-user-form/UserForm.scss +7 -4
- package/dist/styles/company-user-form/_index.scss +1 -1
- package/dist/styles/custom-fields/CreateSortableListItem.scss +1 -2
- package/dist/styles/custom-fields/_index.scss +1 -1
- package/dist/styles/customers/Filter.scss +5 -5
- package/dist/styles/events/EditEventModal.scss +3 -1
- package/dist/styles/events/EventVenueMap.scss +7 -7
- package/dist/styles/form/Input.scss +1 -1
- package/dist/styles/header/Header.scss +1 -1
- package/dist/styles/header/elements/CompanySelector.scss +2 -2
- package/dist/styles/iframe-events/Calendar.scss +1 -0
- package/dist/styles/iframe-events/CalendarSelect.scss +1 -1
- package/dist/styles/iframe-events/CategoryStepsForm.scss +7 -6
- package/dist/styles/iframe-events/Event.scss +4 -2
- package/dist/styles/iframe-events/EventForm.scss +54 -54
- package/dist/styles/iframe-events/EventNavigationFooter.scss +0 -1
- package/dist/styles/iframe-events/TicketDescription.scss +1 -1
- package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/dist/styles/iframe-payments/PaymentForm.scss +1 -1
- package/dist/styles/layout/BackgroundVideoContainer.scss +2 -2
- package/dist/styles/notification/Notification.scss +1 -1
- package/dist/styles/order-items-table/OrderItemsTable.scss +2 -1
- package/dist/styles/product-set/CreateProductSetItem.scss +13 -15
- package/dist/styles/product-set/DateAndRecurrenceInput.scss +8 -6
- package/dist/styles/product-set/EditCategoryModal.scss +4 -4
- package/dist/styles/product-set/EditProductModal.scss +3 -3
- package/dist/styles/product-set/EditStepModal.scss +4 -4
- package/dist/styles/product-set/EditVenueMapSetModal.scss +6 -6
- package/dist/styles/product-set/ProductSetForm.scss +2 -25
- package/dist/styles/product-set/TutorialGifCard.scss +1 -1
- package/dist/styles/product-set/_index.scss +2 -2
- package/dist/styles/report/ReportCard.scss +0 -1
- package/dist/styles/report/_index.scss +1 -1
- package/dist/styles/resources-blocking/_index.scss +0 -4
- package/dist/styles/sales/BookingFilter.scss +2 -2
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/sales/BookingTabs.scss +5 -7
- package/dist/styles/sales/Filters.scss +4 -5
- package/dist/styles/sales/GuestProfile.scss +175 -170
- package/dist/styles/sales/LifeTimeSales.scss +1 -1
- package/dist/styles/sales/ManualBooking.scss +2 -4
- package/dist/styles/snippet-templates/_snippetVariables.scss +244 -63
- package/dist/styles/sortable-field/SortableField.scss +16 -16
- package/dist/styles/sortable-field/_index.scss +1 -1
- package/dist/styles/sortable-tree/Item.scss +4 -4
- package/dist/styles/table/Table.scss +1 -1
- package/dist/styles/themes/bookedit/_variables.scss +32 -10
- package/dist/styles/themes/licklist/_variables.scss +1 -1
- package/dist/styles/tiptap-editor/TiptapEditor.scss +10 -9
- package/dist/styles/tiptap-editor/_index.scss +1 -1
- package/dist/styles/venue-map-sets/VenueMapSetForm.scss +4 -5
- package/dist/styles/virtualized/_index.scss +1 -1
- package/dist/styles/zones/ZoneForm.scss +0 -1
- package/dist/styles/zones/ZoneRecurrencesControl.scss +8 -6
- package/dist/typeahead/Typeahead.d.ts +1 -5
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +2 -9
- package/dist/zone/form/ZoneForm.d.ts +2 -3
- package/dist/zone/form/ZoneForm.d.ts.map +1 -1
- package/dist/zone/form/ZoneForm.js +2 -4
- package/dist/zone/form/components/ZoneControl.d.ts +2 -3
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +2 -5
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -5
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +2 -5
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/auth/ChangePassword/ChangePassword.stories.tsx +1 -1
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/auth/ResetPassword/ResetPassword.stories.tsx +1 -1
- package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +28 -31
- package/src/calendar/utils/index.ts +4 -26
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +2 -3
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +37 -35
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +3 -3
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +1 -0
- package/src/header/elements/Elements.stories.tsx +1 -1
- package/src/help/popover/Popover.stories.tsx +1 -1
- package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +3 -3
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +0 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -1
- package/src/layout/DropDown.tsx +1 -2
- package/src/modals/confirmation/ConfirmModal.tsx +3 -19
- package/src/product-set/card/ProductSetCard.stories.tsx +1 -3
- package/src/product-set/card/ProductSetCard.tsx +8 -47
- package/src/product-set/control/DateAndRecurrenceInput.tsx +4 -6
- package/src/product-set/control/DateInput.tsx +1 -2
- package/src/product-set/control/ProductSetControl.tsx +15 -4
- package/src/product-set/control/ProductSetRecurrenceControl.stories.tsx +2 -2
- package/src/product-set/form/ProductCategoriesControl.tsx +1 -37
- package/src/product-set/form/ProductSetForm.tsx +3 -25
- package/src/product-set/form/ProductZonesControl.tsx +7 -4
- package/src/product-set/form/SelectCategoryModal.stories.tsx +1 -1
- package/src/product-set/form/SelectCategoryModal.tsx +2 -2
- package/src/product-set/form/SubProductsControl.tsx +3 -0
- package/src/product-set/form/VenueMapsControl.tsx +3 -0
- package/src/product-set/form/index.ts +0 -1
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +5 -5
- package/src/product-set/product/booking-management/ProductBookingManagement.stories.tsx +1 -1
- package/src/product-set/product/quantity/ProductQuantity.stories.tsx +1 -1
- package/src/product-set/product-zone/ProductZoneControl.tsx +9 -9
- package/src/product-set/utils/index.ts +0 -11
- package/src/provider/location-input/LocationInput.tsx +1 -36
- package/src/provider/location-input/LocationInputDescription.tsx +11 -23
- package/src/provider/location-input/index.ts +0 -1
- package/src/provider/provider-form/ProviderForm.tsx +2 -7
- package/src/provider/venue-form/VenueForm.tsx +2 -5
- package/src/provider/working-hours-input/WorkingHoursInput.tsx +6 -15
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +30 -11
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +22 -8
- package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +4 -11
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +3 -17
- package/src/recurring-date-picker-input/utils.ts +1 -97
- package/src/sales/booking/results/components/ResultCard.tsx +10 -4
- package/src/sales/guest-profile/previous-bookings/PreviousBookings.tsx +1 -1
- package/src/sales/manual-booking/formatDays.ts +3 -3
- package/src/sales/manual-booking/select-event/SelectEvent.tsx +2 -2
- package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +2 -2
- package/src/sales/notes/NotesTableRow.tsx +3 -3
- package/src/setting/admin/AdminSetting.stories.tsx +0 -1
- package/src/setting/admin/AdminSettingForm.tsx +2 -2
- package/src/setting/system/SystemSetting.stories.tsx +1 -1
- package/src/snippet/snippet-template/preview/Preview.tsx +0 -6
- package/src/sortable-tree/SortableTreeItem.tsx +0 -6
- package/src/styles/auth/AccessDenied.scss +1 -1
- package/src/styles/back-button/BackButton.scss +24 -25
- package/src/styles/back-button/_index.scss +1 -1
- package/src/styles/company-user-form/UserForm.scss +7 -4
- package/src/styles/company-user-form/_index.scss +1 -1
- package/src/styles/custom-fields/CreateSortableListItem.scss +1 -2
- package/src/styles/custom-fields/_index.scss +1 -1
- package/src/styles/customers/Filter.scss +5 -5
- package/src/styles/events/EditEventModal.scss +3 -1
- package/src/styles/events/EventVenueMap.scss +7 -7
- package/src/styles/form/Input.scss +1 -1
- package/src/styles/header/Header.scss +1 -1
- package/src/styles/header/elements/CompanySelector.scss +2 -2
- package/src/styles/iframe-events/Calendar.scss +1 -0
- package/src/styles/iframe-events/CalendarSelect.scss +1 -1
- package/src/styles/iframe-events/CategoryStepsForm.scss +7 -6
- package/src/styles/iframe-events/Event.scss +4 -2
- package/src/styles/iframe-events/EventForm.scss +54 -54
- package/src/styles/iframe-events/EventNavigationFooter.scss +0 -1
- package/src/styles/iframe-events/TicketDescription.scss +1 -1
- package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/src/styles/iframe-payments/PaymentForm.scss +1 -1
- package/src/styles/layout/BackgroundVideoContainer.scss +2 -2
- package/src/styles/notification/Notification.scss +1 -1
- package/src/styles/order-items-table/OrderItemsTable.scss +2 -1
- package/src/styles/product-set/CreateProductSetItem.scss +13 -15
- package/src/styles/product-set/DateAndRecurrenceInput.scss +8 -6
- package/src/styles/product-set/EditCategoryModal.scss +4 -4
- package/src/styles/product-set/EditProductModal.scss +3 -3
- package/src/styles/product-set/EditStepModal.scss +4 -4
- package/src/styles/product-set/EditVenueMapSetModal.scss +6 -6
- package/src/styles/product-set/ProductSetForm.scss +2 -25
- package/src/styles/product-set/TutorialGifCard.scss +1 -1
- package/src/styles/product-set/_index.scss +2 -2
- package/src/styles/report/ReportCard.scss +0 -1
- package/src/styles/report/_index.scss +1 -1
- package/src/styles/resources-blocking/_index.scss +0 -4
- package/src/styles/sales/BookingFilter.scss +2 -2
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/sales/BookingTabs.scss +5 -7
- package/src/styles/sales/Filters.scss +4 -5
- package/src/styles/sales/GuestProfile.scss +175 -170
- package/src/styles/sales/LifeTimeSales.scss +1 -1
- package/src/styles/sales/ManualBooking.scss +2 -4
- package/src/styles/snippet-templates/_snippetVariables.scss +244 -63
- package/src/styles/sortable-field/SortableField.scss +16 -16
- package/src/styles/sortable-field/_index.scss +1 -1
- package/src/styles/sortable-tree/Item.scss +4 -4
- package/src/styles/table/Table.scss +1 -1
- package/src/styles/themes/bookedit/_variables.scss +32 -10
- package/src/styles/themes/licklist/_variables.scss +1 -1
- package/src/styles/tiptap-editor/TiptapEditor.scss +10 -9
- package/src/styles/tiptap-editor/_index.scss +1 -1
- package/src/styles/venue-map-sets/VenueMapSetForm.scss +4 -5
- package/src/styles/virtualized/_index.scss +1 -1
- package/src/styles/zones/ZoneForm.scss +0 -1
- package/src/styles/zones/ZoneRecurrencesControl.scss +8 -6
- package/src/tiptap-editor/TipTapEditor.stories.tsx +4 -6
- package/src/tiptap-editor/TipTapMenu/TipTapMenu.stories.tsx +2 -5
- package/src/typeahead/Typeahead.tsx +1 -15
- package/src/zone/form/ZoneForm.tsx +2 -9
- package/src/zone/form/components/ZoneControl.tsx +3 -8
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +5 -10
- package/src/zone/form/utils/dates.ts +10 -9
- package/yarn.lock +53 -40
- package/dist/product-set/form/ProductSetNameControl.d.ts +0 -6
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +0 -1
- package/dist/product-set/form/ProductSetNameControl.js +0 -35
- package/src/product-set/form/ProductSetNameControl.tsx +0 -27
|
@@ -42,7 +42,7 @@ export const Default: Story<ProductQuantityControlProps<{}>> = (args) => {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export const ConstantForm: Story<ProductQuantityConstantControlProps<{}>> = (
|
|
45
|
-
args
|
|
45
|
+
args,
|
|
46
46
|
) => {
|
|
47
47
|
const form = useForm<ProductQuantityConstantControlValues>({
|
|
48
48
|
mode: "onChange",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useEffect, useMemo } from "react";
|
|
1
|
+
import React, { useContext, useEffect, useMemo } from "react";
|
|
2
2
|
import { Col, Form, Row } from "react-bootstrap";
|
|
3
3
|
import {
|
|
4
4
|
ArrayPath,
|
|
@@ -63,7 +63,7 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
63
63
|
const disabledDuration = capacity === "0" || !capacity;
|
|
64
64
|
|
|
65
65
|
const { providerHasBookingManagement, zones = [] } = useContext(
|
|
66
|
-
ProductSetLoadingContext
|
|
66
|
+
ProductSetLoadingContext
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
const currentZoneData = zones.find((zone) => zone.id === Number(zoneId));
|
|
@@ -75,10 +75,10 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
75
75
|
!productZones.find(
|
|
76
76
|
(productZone) =>
|
|
77
77
|
Number(productZone.zoneId) === zone.id &&
|
|
78
|
-
productZone.zoneId !== zoneId
|
|
79
|
-
)
|
|
78
|
+
productZone.zoneId !== zoneId
|
|
79
|
+
)
|
|
80
80
|
),
|
|
81
|
-
[zones, productZones, zoneId]
|
|
81
|
+
[zones, productZones, zoneId]
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
useEffect(() => {
|
|
@@ -89,7 +89,7 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
89
89
|
setValue(
|
|
90
90
|
`${fieldNamePrefix}.duration` as Path<T>,
|
|
91
91
|
/* @ts-expect-error 6385 */
|
|
92
|
-
0 as UnpackNestedValue<PathValue<T, Path<T
|
|
92
|
+
0 as UnpackNestedValue<PathValue<T, Path<T>>>
|
|
93
93
|
);
|
|
94
94
|
clearErrors(`${fieldNamePrefix}.duration` as Path<T>);
|
|
95
95
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -104,7 +104,7 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
104
104
|
/* @ts-expect-error 6385 */
|
|
105
105
|
(value * currentZoneData?.defaultDuration) as UnpackNestedValue<
|
|
106
106
|
PathValue<T, Path<T>>
|
|
107
|
-
|
|
107
|
+
>
|
|
108
108
|
);
|
|
109
109
|
};
|
|
110
110
|
return (
|
|
@@ -123,7 +123,7 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
123
123
|
disabled={isOverrides}
|
|
124
124
|
isInvalid={HookFormService.isInvalid(
|
|
125
125
|
`${fieldNamePrefix}.zoneId`,
|
|
126
|
-
errors
|
|
126
|
+
errors
|
|
127
127
|
)}
|
|
128
128
|
{...field}
|
|
129
129
|
>
|
|
@@ -147,7 +147,7 @@ export const ProductZoneControl = <T extends FormValues>({
|
|
|
147
147
|
<Form.Control.Feedback type="invalid">
|
|
148
148
|
{HookFormService.getErrors(
|
|
149
149
|
`${fieldNamePrefix}.zoneId` as Path<T>,
|
|
150
|
-
errors
|
|
150
|
+
errors
|
|
151
151
|
)}
|
|
152
152
|
</Form.Control.Feedback>
|
|
153
153
|
</Form.Group>
|
|
@@ -3,7 +3,6 @@ import { SmsTemplate } from "@licklist/core/dist/DataMapper/Notification/SmsTemp
|
|
|
3
3
|
import { TFunction } from "react-i18next";
|
|
4
4
|
import { UseFormSetError } from "react-hook-form";
|
|
5
5
|
import { checkIfZoneCategory } from "@licklist/plugins";
|
|
6
|
-
import { ProductSet } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
|
|
7
6
|
import { TemplateItem } from "../control/ProductSetControl";
|
|
8
7
|
import { ProductSetFormValues } from "../form/ProductSetForm";
|
|
9
8
|
|
|
@@ -13,11 +12,6 @@ interface CheckAvailableTimesErrors {
|
|
|
13
12
|
t: TFunction;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export interface MenuTypeheadItem {
|
|
17
|
-
id: number;
|
|
18
|
-
label: string;
|
|
19
|
-
value: number;
|
|
20
|
-
}
|
|
21
15
|
export const moveArrayElements = <T>(
|
|
22
16
|
array: T[],
|
|
23
17
|
prevIndex: number,
|
|
@@ -90,8 +84,3 @@ export const checkAvailableTimesErrors = ({
|
|
|
90
84
|
});
|
|
91
85
|
return hasError;
|
|
92
86
|
};
|
|
93
|
-
|
|
94
|
-
export const getTypeHeadItemsFromMenus = (
|
|
95
|
-
menus?: (ProductSet | ProductSetFormValues)[],
|
|
96
|
-
): MenuTypeheadItem[] =>
|
|
97
|
-
menus?.map((menu) => ({ id: menu.id, value: menu.id, label: menu.name }));
|
|
@@ -2,21 +2,17 @@ import { useId } from "@react-aria/utils";
|
|
|
2
2
|
import { Form } from "react-bootstrap";
|
|
3
3
|
import { useFormContext } from "react-hook-form";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { TimeZonePath, useTimeZoneApi } from "@licklist/plugins";
|
|
6
|
-
import { BlockLoader } from "src/static";
|
|
7
5
|
import CountryCodeSelect from "../../static/CountryCodeSelect";
|
|
8
6
|
import { LocationInputValues } from ".";
|
|
9
7
|
import { FormGroupControll } from "./components";
|
|
10
8
|
|
|
11
|
-
export function LocationInput(
|
|
9
|
+
export function LocationInput() {
|
|
12
10
|
const {
|
|
13
11
|
register,
|
|
14
12
|
formState: { errors },
|
|
15
13
|
} = useFormContext<LocationInputValues>();
|
|
16
14
|
const { t } = useTranslation("Design");
|
|
17
15
|
|
|
18
|
-
const { data, isLoading } = useTimeZoneApi(path).useAll();
|
|
19
|
-
|
|
20
16
|
const countryId = useId();
|
|
21
17
|
|
|
22
18
|
return (
|
|
@@ -43,7 +39,6 @@ export function LocationInput({ path }: { path: TimeZonePath }) {
|
|
|
43
39
|
name="location.postcode"
|
|
44
40
|
label={t("locationPostcode")}
|
|
45
41
|
/>
|
|
46
|
-
|
|
47
42
|
<Form.Group controlId={countryId}>
|
|
48
43
|
<Form.Label>{t("locationCountry")}</Form.Label>
|
|
49
44
|
<CountryCodeSelect
|
|
@@ -52,36 +47,6 @@ export function LocationInput({ path }: { path: TimeZonePath }) {
|
|
|
52
47
|
error={errors?.location?.country?.message}
|
|
53
48
|
/>
|
|
54
49
|
</Form.Group>
|
|
55
|
-
|
|
56
|
-
{isLoading ? (
|
|
57
|
-
<BlockLoader />
|
|
58
|
-
) : (
|
|
59
|
-
<Form.Group controlId="timeZoneId">
|
|
60
|
-
<Form.Label>{t("locationTimeZone")}</Form.Label>
|
|
61
|
-
<Form.Control
|
|
62
|
-
{...register("timeZoneId", {
|
|
63
|
-
required: t("Validation:fieldRequired", {
|
|
64
|
-
attribute: t("locationTimeZone"),
|
|
65
|
-
}) as string,
|
|
66
|
-
})}
|
|
67
|
-
as="select"
|
|
68
|
-
custom
|
|
69
|
-
isInvalid={Boolean(errors?.timeZoneId?.message)}
|
|
70
|
-
>
|
|
71
|
-
<option key="" value="" disabled>
|
|
72
|
-
{t("chooseTimeZone")}
|
|
73
|
-
</option>
|
|
74
|
-
{data.map((zone) => (
|
|
75
|
-
<option key={zone.id} value={zone.id.toString()}>
|
|
76
|
-
{zone.name}
|
|
77
|
-
</option>
|
|
78
|
-
))}
|
|
79
|
-
</Form.Control>
|
|
80
|
-
<Form.Control.Feedback type="invalid">
|
|
81
|
-
{errors?.timeZoneId?.message}
|
|
82
|
-
</Form.Control.Feedback>
|
|
83
|
-
</Form.Group>
|
|
84
|
-
)}
|
|
85
50
|
</>
|
|
86
51
|
);
|
|
87
52
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
import en from "react-phone-number-input/locale/en.json";
|
|
4
|
-
import { TimeZonePath, useTimeZoneApi } from "@licklist/plugins";
|
|
5
4
|
import { LocationInputValues } from ".";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function LocationInputDescription({ path }: { path: TimeZonePath }) {
|
|
6
|
+
export function LocationInputDescription() {
|
|
10
7
|
const { watch } = useFormContext<LocationInputValues>();
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const values = watch("location");
|
|
9
|
+
const fieldNames = [
|
|
10
|
+
"street",
|
|
11
|
+
"city",
|
|
12
|
+
"state",
|
|
13
|
+
"postcode",
|
|
14
|
+
"country",
|
|
15
|
+
] as const;
|
|
15
16
|
const fields = fieldNames.reduce<ReactElement[]>((acc, field) => {
|
|
16
|
-
const value =
|
|
17
|
+
const value = values?.[field];
|
|
17
18
|
if (!value) return acc;
|
|
18
19
|
|
|
19
20
|
return [
|
|
@@ -21,18 +22,5 @@ export function LocationInputDescription({ path }: { path: TimeZonePath }) {
|
|
|
21
22
|
<div key={field}>{field === "country" ? en[value] : value}</div>,
|
|
22
23
|
];
|
|
23
24
|
}, []);
|
|
24
|
-
|
|
25
|
-
const timeZoneId = watch("timeZoneId");
|
|
26
|
-
const timeZoneName = data?.find(
|
|
27
|
-
(timeZone) => timeZone.id === +timeZoneId,
|
|
28
|
-
)?.name;
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div>
|
|
32
|
-
<>
|
|
33
|
-
{fields}
|
|
34
|
-
{timeZoneName && <div key="timeZone">{timeZoneName}</div>}
|
|
35
|
-
</>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
25
|
+
return <div>{fields}</div>;
|
|
38
26
|
}
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
} from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
|
|
11
11
|
import { useMultipleImages } from "@licklist/plugins/dist/hooks/Media/useMultipleImages";
|
|
12
12
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
13
|
-
import { TimeZonePath } from "@licklist/plugins";
|
|
14
13
|
import { CollapsibleInputGroup } from "../../collapsible-input-group";
|
|
15
14
|
import {
|
|
16
15
|
CategoriesInput,
|
|
@@ -42,7 +41,6 @@ export interface ProviderFormProps extends HasPermissionProp {
|
|
|
42
41
|
companiesOptions?: TypeaheadOptions[];
|
|
43
42
|
onSubmit: (values: ProviderFormValues) => void;
|
|
44
43
|
intent?: "create" | "update";
|
|
45
|
-
path: TimeZonePath;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
const providerImageTypes = {
|
|
@@ -58,17 +56,14 @@ export function ProviderForm({
|
|
|
58
56
|
onSubmit,
|
|
59
57
|
intent = "update",
|
|
60
58
|
hasPermission = true,
|
|
61
|
-
path,
|
|
62
59
|
}: ProviderFormProps) {
|
|
63
60
|
const form = useForm<ProviderFormValues>({ defaultValues });
|
|
64
|
-
|
|
65
61
|
const {
|
|
66
62
|
setValue,
|
|
67
63
|
handleSubmit,
|
|
68
64
|
formState: { isSubmitting, errors },
|
|
69
65
|
getValues,
|
|
70
66
|
} = form;
|
|
71
|
-
|
|
72
67
|
const { t } = useTranslation("Design");
|
|
73
68
|
const [initialImages, setInitialImages] = useState<Image[] | null>(null);
|
|
74
69
|
|
|
@@ -106,10 +101,10 @@ export function ProviderForm({
|
|
|
106
101
|
<CollapsibleInputGroup
|
|
107
102
|
eventKey="location"
|
|
108
103
|
label={t("location")}
|
|
109
|
-
description={<LocationInputDescription
|
|
104
|
+
description={<LocationInputDescription />}
|
|
110
105
|
error={errors?.location?.country?.message}
|
|
111
106
|
>
|
|
112
|
-
<LocationInput
|
|
107
|
+
<LocationInput />
|
|
113
108
|
</CollapsibleInputGroup>
|
|
114
109
|
{categories && categories.length > 0 && (
|
|
115
110
|
<CollapsibleInputGroup
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
|
|
12
12
|
import { useMultipleImages } from "@licklist/plugins/dist/hooks/Media/useMultipleImages";
|
|
13
13
|
import { parseServerErrorForFormValidation } from "@licklist/plugins/dist/utils/parseError";
|
|
14
|
-
import { TimeZonePath } from "@licklist/plugins";
|
|
15
14
|
import { CollapsibleInputGroup } from "../../collapsible-input-group";
|
|
16
15
|
import {
|
|
17
16
|
CategoriesInput,
|
|
@@ -51,7 +50,6 @@ export interface VenueFormProps extends HasPermissionProp {
|
|
|
51
50
|
intent?: "create" | "update";
|
|
52
51
|
isLoading?: boolean;
|
|
53
52
|
errorResponse?: unknown;
|
|
54
|
-
path: TimeZonePath;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
const providerImageTypes = {
|
|
@@ -69,7 +67,6 @@ export function VenueForm({
|
|
|
69
67
|
hasPermission = true,
|
|
70
68
|
isLoading,
|
|
71
69
|
errorResponse,
|
|
72
|
-
path,
|
|
73
70
|
}: VenueFormProps) {
|
|
74
71
|
const form = useForm<VenueFormValues>({ defaultValues, mode: "onChange" });
|
|
75
72
|
const {
|
|
@@ -137,7 +134,7 @@ export function VenueForm({
|
|
|
137
134
|
<CollapsibleInputGroup
|
|
138
135
|
eventKey="location"
|
|
139
136
|
label={t("location")}
|
|
140
|
-
description={<LocationInputDescription
|
|
137
|
+
description={<LocationInputDescription />}
|
|
141
138
|
error={
|
|
142
139
|
errors?.location?.message ||
|
|
143
140
|
(errors?.location &&
|
|
@@ -146,7 +143,7 @@ export function VenueForm({
|
|
|
146
143
|
}))
|
|
147
144
|
}
|
|
148
145
|
>
|
|
149
|
-
<LocationInput
|
|
146
|
+
<LocationInput />
|
|
150
147
|
</CollapsibleInputGroup>
|
|
151
148
|
<CollapsibleInputGroup
|
|
152
149
|
eventKey="workingHours"
|
|
@@ -24,9 +24,8 @@ export function WorkingHoursInput() {
|
|
|
24
24
|
<Col>{t("Design:until")}</Col>
|
|
25
25
|
<Col>{t("Design:description")}</Col>
|
|
26
26
|
</Form.Row>
|
|
27
|
-
|
|
28
27
|
<Form.Control
|
|
29
|
-
{...register(`workingHours
|
|
28
|
+
{...register(`workingHours` as const, {
|
|
30
29
|
validate: (value) => {
|
|
31
30
|
const oneOfDaysFilled = value?.some(
|
|
32
31
|
(workingDay) => workingDay.start,
|
|
@@ -43,7 +42,6 @@ export function WorkingHoursInput() {
|
|
|
43
42
|
})}
|
|
44
43
|
type="hidden"
|
|
45
44
|
/>
|
|
46
|
-
|
|
47
45
|
{weekdays.map((name, i) => (
|
|
48
46
|
/*
|
|
49
47
|
* The only reason inputs have placeholders here is to fix
|
|
@@ -51,19 +49,14 @@ export function WorkingHoursInput() {
|
|
|
51
49
|
* which miscalculates alignment for empty inputs.
|
|
52
50
|
* Otherwise placeholders should not be used.
|
|
53
51
|
*/
|
|
54
|
-
<Form.Row key={
|
|
55
|
-
<Col
|
|
56
|
-
className="h5 text-lg-right text-nowrap mb-4 mb-lg-0"
|
|
57
|
-
xs="12"
|
|
58
|
-
lg="2"
|
|
59
|
-
>
|
|
52
|
+
<Form.Row key={i} className="align-items-baseline">
|
|
53
|
+
<Col className="h5 text-lg-right mb-4 mb-lg-0" xs="12" lg="2">
|
|
60
54
|
{name}
|
|
61
55
|
</Col>
|
|
62
|
-
|
|
63
56
|
<Form.Group as={Col}>
|
|
64
57
|
<Form.Label className="d-lg-none">{t("Design:from")}</Form.Label>
|
|
65
58
|
<Form.Control
|
|
66
|
-
{...register(`workingHours.${i}.start
|
|
59
|
+
{...register(`workingHours.${i}.start` as const, {
|
|
67
60
|
validate: (nextStartValue) => {
|
|
68
61
|
if (nextStartValue) {
|
|
69
62
|
clearErrors("workingHours");
|
|
@@ -76,22 +69,20 @@ export function WorkingHoursInput() {
|
|
|
76
69
|
placeholder={t("Design:from")}
|
|
77
70
|
/>
|
|
78
71
|
</Form.Group>
|
|
79
|
-
|
|
80
72
|
<Form.Group as={Col}>
|
|
81
73
|
<Form.Label className="d-lg-none">{t("Design:until")}</Form.Label>
|
|
82
74
|
<Form.Control
|
|
83
|
-
{...register(`workingHours.${i}.end`)}
|
|
75
|
+
{...register(`workingHours.${i}.end` as const)}
|
|
84
76
|
type="time"
|
|
85
77
|
placeholder={t("Design:until")}
|
|
86
78
|
/>
|
|
87
79
|
</Form.Group>
|
|
88
|
-
|
|
89
80
|
<Form.Group as={Col} xs="12" lg>
|
|
90
81
|
<Form.Label className="d-lg-none">
|
|
91
82
|
{t("Design:description")}
|
|
92
83
|
</Form.Label>
|
|
93
84
|
<Form.Control
|
|
94
|
-
{...register(`workingHours.${i}.description`)}
|
|
85
|
+
{...register(`workingHours.${i}.description` as const)}
|
|
95
86
|
placeholder={t("Design:description")}
|
|
96
87
|
/>
|
|
97
88
|
</Form.Group>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
1
2
|
import { Col, Row } from "react-bootstrap";
|
|
2
3
|
import { useFormContext } from "react-hook-form";
|
|
3
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
4
6
|
import { WorkingHoursInputValues } from ".";
|
|
5
7
|
import { useWeekdays } from "./utils";
|
|
6
8
|
|
|
@@ -14,17 +16,34 @@ export function WorkingHoursInputDescription() {
|
|
|
14
16
|
|
|
15
17
|
return (
|
|
16
18
|
<>
|
|
17
|
-
{Array.from({ length: weekdays.length }, (_, i) => i)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
{Array.from({ length: weekdays.length }, (_, i) => i)
|
|
20
|
+
.filter((i) => values?.[i]?.start)
|
|
21
|
+
.map((i) => {
|
|
22
|
+
const weekday = values?.[i];
|
|
23
|
+
return (
|
|
24
|
+
<Row key={i}>
|
|
25
|
+
<Col xs="auto">{weekdays[i]}:</Col>
|
|
26
|
+
<Col>
|
|
27
|
+
{weekday?.end
|
|
28
|
+
? weekday.start
|
|
29
|
+
? t("timeInterval", {
|
|
30
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
31
|
+
TIME_FORMAT,
|
|
32
|
+
),
|
|
33
|
+
end: DateTime.fromISO(weekday.start).toFormat(
|
|
34
|
+
TIME_FORMAT,
|
|
35
|
+
),
|
|
36
|
+
})
|
|
37
|
+
: t("timeFrom", {
|
|
38
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
39
|
+
TIME_FORMAT,
|
|
40
|
+
),
|
|
41
|
+
})
|
|
42
|
+
: null}
|
|
43
|
+
</Col>
|
|
44
|
+
</Row>
|
|
45
|
+
);
|
|
46
|
+
})}
|
|
28
47
|
</>
|
|
29
48
|
);
|
|
30
49
|
}
|
|
@@ -8,8 +8,12 @@ import {
|
|
|
8
8
|
useWatch,
|
|
9
9
|
Validate,
|
|
10
10
|
} from "react-hook-form";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
DATE_FORMAT,
|
|
13
|
+
TIME_FORMAT,
|
|
14
|
+
TIME_FULL_FORMAT,
|
|
15
|
+
} from "@licklist/core/dist/Config";
|
|
16
|
+
import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
|
|
13
17
|
import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
|
|
14
18
|
|
|
15
19
|
interface RecurrenceIntervalAndFrequencyInputProps {
|
|
@@ -27,9 +31,17 @@ interface RecurrenceIntervalAndFrequencyInputProps {
|
|
|
27
31
|
RegisterOptions,
|
|
28
32
|
"max" | "min" | "validate" | "required" | "pattern"
|
|
29
33
|
>;
|
|
30
|
-
timeZone: string;
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
const fromTimeFormat = fromFormat(TIME_FORMAT);
|
|
37
|
+
const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
|
|
38
|
+
|
|
39
|
+
// default values and entered values are in different formats
|
|
40
|
+
const fromTimeFormats = (time: string) =>
|
|
41
|
+
fromTimeFormat(time).isValid
|
|
42
|
+
? fromTimeFormat(time)
|
|
43
|
+
: fromTimeFullFormat(time);
|
|
44
|
+
|
|
33
45
|
function RecurrenceIntervalAndFrequencyInput({
|
|
34
46
|
disabled = false,
|
|
35
47
|
minDate,
|
|
@@ -39,7 +51,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
39
51
|
endTimeLabel,
|
|
40
52
|
startTimeRules,
|
|
41
53
|
endTimeRules,
|
|
42
|
-
timeZone,
|
|
43
54
|
}: RecurrenceIntervalAndFrequencyInputProps) {
|
|
44
55
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
45
56
|
|
|
@@ -55,10 +66,10 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
55
66
|
|
|
56
67
|
const _startTime = useWatch({ control, name: "startTime" });
|
|
57
68
|
const startTime =
|
|
58
|
-
_startTime &&
|
|
69
|
+
_startTime && fromTimeFormats(_startTime).toFormat(TIME_FORMAT);
|
|
59
70
|
|
|
60
71
|
const _endTime = useWatch({ control, name: "endTime" });
|
|
61
|
-
const endTime = _endTime &&
|
|
72
|
+
const endTime = _endTime && fromTimeFormats(_endTime).toFormat(TIME_FORMAT);
|
|
62
73
|
|
|
63
74
|
useEffect(() => {
|
|
64
75
|
if (!startDate || !endDate) {
|
|
@@ -108,8 +119,11 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
108
119
|
if (!startDate || !date) {
|
|
109
120
|
return true;
|
|
110
121
|
}
|
|
111
|
-
const currentStartDate =
|
|
112
|
-
|
|
122
|
+
const currentStartDate = DateTime.fromFormat(
|
|
123
|
+
startDate,
|
|
124
|
+
DATE_FORMAT,
|
|
125
|
+
);
|
|
126
|
+
const currentEndDate = DateTime.fromFormat(date, DATE_FORMAT);
|
|
113
127
|
return currentEndDate.diff(currentStartDate, ["days"]).days >=
|
|
114
128
|
0
|
|
115
129
|
? true
|
|
@@ -12,7 +12,9 @@ export default {
|
|
|
12
12
|
component: RecurringDatePickerInput,
|
|
13
13
|
} as Meta;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type DefaultRecurringDatePickerInputProps = RecurringDatePickerInputProps;
|
|
16
|
+
|
|
17
|
+
export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
|
|
16
18
|
return (
|
|
17
19
|
<Card style={{ maxWidth: "max-content" }}>
|
|
18
20
|
<Card.Body>
|
|
@@ -21,7 +23,7 @@ export const Default: Story<RecurringDatePickerInputProps> = (args) => {
|
|
|
21
23
|
</Card>
|
|
22
24
|
);
|
|
23
25
|
};
|
|
24
|
-
export const Valid: Story<
|
|
26
|
+
export const Valid: Story<DefaultRecurringDatePickerInputProps> = (args) => {
|
|
25
27
|
return (
|
|
26
28
|
<Card style={{ maxWidth: "max-content" }}>
|
|
27
29
|
<Card.Body>
|
|
@@ -32,15 +34,6 @@ export const Valid: Story<RecurringDatePickerInputProps> = (args) => {
|
|
|
32
34
|
};
|
|
33
35
|
Default.args = {
|
|
34
36
|
onChange: (data) => console.log("onSubmit", data),
|
|
35
|
-
workHours: [
|
|
36
|
-
{ start: "20:00", end: "04:00", day: 0, description: "" },
|
|
37
|
-
{ start: "20:00", end: "04:00", day: 1, description: "" },
|
|
38
|
-
{ start: "20:00", end: "04:00", day: 2, description: "" },
|
|
39
|
-
{ start: "20:00", end: "12:00", day: 3, description: "" },
|
|
40
|
-
{ start: "20:00", end: "23:00", day: 4, description: "" },
|
|
41
|
-
{ start: "08:00", end: "12:00", day: 5, description: "" },
|
|
42
|
-
{ start: "10:00", end: "16:00", day: 6, description: "" },
|
|
43
|
-
],
|
|
44
37
|
};
|
|
45
38
|
Valid.args = {
|
|
46
39
|
onChange: (data) => console.log("onSubmit", data),
|
|
@@ -2,7 +2,7 @@ import { useEffect, useMemo, PropsWithChildren } from "react";
|
|
|
2
2
|
import RRule, { Frequency, Weekday } from "rrule";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import Button from "react-bootstrap/Button";
|
|
5
|
-
import { DateTime, Interval
|
|
5
|
+
import { DateTime, Interval } from "luxon";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import {
|
|
8
8
|
DATE_TIME_FORMAT,
|
|
@@ -12,14 +12,9 @@ import {
|
|
|
12
12
|
import { usePreviousValue } from "@licklist/plugins/dist/hooks/Value/usePreviousValue";
|
|
13
13
|
import { FormProvider, useForm } from "react-hook-form";
|
|
14
14
|
import { Form } from "react-bootstrap";
|
|
15
|
-
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
16
15
|
import RecurrenceIntervalAndFrequencyInput from "./RecurrenceIntervalAndFrequencyInput";
|
|
17
16
|
import RecurrenceWeekdaysInput from "./RecurrenceWeekdaysInput";
|
|
18
|
-
import {
|
|
19
|
-
parseAndValidateRRule,
|
|
20
|
-
SupportedFrequency,
|
|
21
|
-
useWorkHoursValidation,
|
|
22
|
-
} from "./utils";
|
|
17
|
+
import { parseAndValidateRRule, SupportedFrequency } from "./utils";
|
|
23
18
|
import { ConfirmModal } from "../modals";
|
|
24
19
|
import { DeleteFieldButton } from "../product-set/elements";
|
|
25
20
|
|
|
@@ -31,8 +26,6 @@ export interface RecurringDatePickerInputProps {
|
|
|
31
26
|
initialFrequency?: Frequency;
|
|
32
27
|
setInitialStartDateAfterSelect?: boolean;
|
|
33
28
|
minDate?: string;
|
|
34
|
-
workHours: WorkHour[] | undefined;
|
|
35
|
-
timeZone: string;
|
|
36
29
|
}
|
|
37
30
|
|
|
38
31
|
export interface RecurringDatePickerInputValues {
|
|
@@ -58,8 +51,6 @@ export function RecurringDatePickerInput({
|
|
|
58
51
|
setInitialStartDateAfterSelect = false,
|
|
59
52
|
children,
|
|
60
53
|
minDate,
|
|
61
|
-
workHours,
|
|
62
|
-
timeZone,
|
|
63
54
|
}: PropsWithChildren<RecurringDatePickerInputProps>) {
|
|
64
55
|
const { t } = useTranslation(["Design"]);
|
|
65
56
|
|
|
@@ -93,8 +84,6 @@ export function RecurringDatePickerInput({
|
|
|
93
84
|
byWeekDay,
|
|
94
85
|
});
|
|
95
86
|
|
|
96
|
-
const validator = useWorkHoursValidation(byWeekDay, workHours, timeZone);
|
|
97
|
-
|
|
98
87
|
const onSubmit = (nextState: RecurringDatePickerInputValues) => {
|
|
99
88
|
const end = getDateTimeObject(endDate, endTime || "23:59:59");
|
|
100
89
|
|
|
@@ -160,7 +149,7 @@ export function RecurringDatePickerInput({
|
|
|
160
149
|
// Luxon use standard ISO calendar but in that case
|
|
161
150
|
// first weekday from weekdays array start from 0 index.
|
|
162
151
|
// We need to add 1 to it to show correct data
|
|
163
|
-
const currentWeekDay =
|
|
152
|
+
const currentWeekDay = byWeekDay[0]?.weekday + 1;
|
|
164
153
|
|
|
165
154
|
const currentDate = DateTime.local();
|
|
166
155
|
|
|
@@ -199,9 +188,6 @@ export function RecurringDatePickerInput({
|
|
|
199
188
|
<RecurrenceIntervalAndFrequencyInput
|
|
200
189
|
disabled={disabled}
|
|
201
190
|
minDate={minDate}
|
|
202
|
-
startTimeRules={validator}
|
|
203
|
-
endTimeRules={validator}
|
|
204
|
-
timeZone={timeZone}
|
|
205
191
|
/>
|
|
206
192
|
|
|
207
193
|
{children}
|