@licklist/design 0.67.1 → 0.67.2-dev.2
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 +15 -12
- package/dist/auth/Login/LoginComponent.js +2 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +35 -40
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.js +5 -3
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +3 -6
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
- 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 +2 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/layout/DropDown.d.ts +2 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/layout/DropDownToggle.d.ts.map +1 -1
- package/dist/layout/DropDownToggle.js +1 -0
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.js +1 -0
- 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 +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +48 -2
- package/dist/product-set/form/ProductSetForm.d.ts +4 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +60 -2
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +0 -2
- package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
- 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 +0 -3
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +0 -3
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.js +2 -1
- package/dist/provider/location-input/LocationInput.d.ts +4 -1
- package/dist/provider/location-input/LocationInput.d.ts.map +1 -1
- package/dist/provider/location-input/LocationInput.js +46 -2
- package/dist/provider/location-input/index.d.ts +1 -0
- package/dist/provider/location-input/index.d.ts.map +1 -1
- package/dist/provider/provider-form/ProviderForm.d.ts +3 -1
- package/dist/provider/provider-form/ProviderForm.d.ts.map +1 -1
- package/dist/provider/provider-form/ProviderForm.js +26 -5
- package/dist/provider/venue-form/VenueForm.d.ts +3 -1
- package/dist/provider/venue-form/VenueForm.d.ts.map +1 -1
- package/dist/provider/venue-form/VenueForm.js +4 -2
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +4 -8
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +3 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +6 -3
- package/dist/recurring-date-picker-input/utils.d.ts +5 -0
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +75 -3
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +0 -2
- 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 +6 -0
- package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +10 -4
- package/dist/styles/auth/AccessDenied.scss +1 -1
- package/dist/styles/back-button/BackButton.scss +25 -24
- package/dist/styles/back-button/_index.scss +1 -1
- package/dist/styles/company-user-form/UserForm.scss +4 -7
- package/dist/styles/company-user-form/_index.scss +1 -1
- package/dist/styles/custom-fields/CreateSortableListItem.scss +2 -1
- package/dist/styles/custom-fields/_index.scss +1 -1
- package/dist/styles/customers/Filter.scss +5 -5
- package/dist/styles/events/EditEventModal.scss +1 -3
- 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 +0 -1
- package/dist/styles/iframe-events/CalendarSelect.scss +1 -1
- package/dist/styles/iframe-events/CategoryStepsForm.scss +6 -7
- package/dist/styles/iframe-events/Event.scss +2 -4
- package/dist/styles/iframe-events/EventForm.scss +54 -54
- package/dist/styles/iframe-events/EventNavigationFooter.scss +1 -0
- 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 +1 -2
- package/dist/styles/product-set/CreateProductSetItem.scss +15 -13
- package/dist/styles/product-set/DateAndRecurrenceInput.scss +6 -8
- 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 +25 -2
- package/dist/styles/product-set/TutorialGifCard.scss +1 -1
- package/dist/styles/product-set/_index.scss +2 -2
- package/dist/styles/report/ReportCard.scss +1 -0
- package/dist/styles/report/_index.scss +1 -1
- package/dist/styles/resources-blocking/_index.scss +4 -0
- package/dist/styles/sales/BookingFilter.scss +2 -2
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/sales/BookingTabs.scss +7 -5
- package/dist/styles/sales/Filters.scss +5 -4
- package/dist/styles/sales/GuestProfile.scss +170 -175
- package/dist/styles/sales/LifeTimeSales.scss +1 -1
- package/dist/styles/sales/ManualBooking.scss +4 -2
- package/dist/styles/snippet-templates/_snippetVariables.scss +63 -244
- 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 +10 -32
- package/dist/styles/themes/licklist/_variables.scss +1 -1
- package/dist/styles/tiptap-editor/TiptapEditor.scss +9 -10
- package/dist/styles/tiptap-editor/_index.scss +1 -1
- package/dist/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
- package/dist/styles/virtualized/_index.scss +1 -1
- package/dist/styles/zones/ZoneForm.scss +1 -0
- package/dist/styles/zones/ZoneRecurrencesControl.scss +6 -8
- package/dist/zone/form/ZoneForm.d.ts +2 -2
- package/dist/zone/form/ZoneForm.d.ts.map +1 -1
- package/dist/zone/form/ZoneForm.js +3 -2
- package/dist/zone/form/components/ZoneControl.d.ts +2 -2
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +4 -2
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +4 -2
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/package.json +8 -8
- 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 +31 -28
- package/src/events/edit-event-modal/component/SaleDeadline/SaleDeadline.tsx +3 -5
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +0 -4
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
- 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 +1 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
- package/src/layout/DropDown.tsx +2 -1
- package/src/layout/DropDownToggle.tsx +2 -0
- package/src/product-set/card/ProductSetCard.stories.tsx +3 -1
- package/src/product-set/control/DateAndRecurrenceInput.tsx +3 -4
- package/src/product-set/control/DateInput.tsx +2 -1
- package/src/product-set/control/ProductSetControl.tsx +1 -1
- package/src/product-set/control/ProductSetRecurrenceControl.stories.tsx +2 -2
- package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
- package/src/product-set/form/ProductSetForm.tsx +22 -3
- package/src/product-set/form/ProductZonesControl.tsx +4 -7
- 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 +0 -3
- package/src/product-set/form/VenueMapsControl.tsx +0 -3
- package/src/product-set/hooks/useSortableTreeFunctions.ts +2 -0
- 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/provider/location-input/LocationInput.tsx +40 -1
- package/src/provider/location-input/index.ts +1 -0
- package/src/provider/provider-form/ProviderForm.tsx +26 -2
- package/src/provider/venue-form/VenueForm.tsx +4 -1
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
- package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +11 -4
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +12 -1
- package/src/recurring-date-picker-input/utils.ts +91 -1
- package/src/sales/booking/results/components/ResultCard.tsx +0 -2
- package/src/setting/admin/AdminSetting.stories.tsx +1 -0
- 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 +6 -0
- package/src/sortable-tree/SortableTreeItem.tsx +6 -0
- package/src/styles/auth/AccessDenied.scss +1 -1
- package/src/styles/back-button/BackButton.scss +25 -24
- package/src/styles/back-button/_index.scss +1 -1
- package/src/styles/company-user-form/UserForm.scss +4 -7
- package/src/styles/company-user-form/_index.scss +1 -1
- package/src/styles/custom-fields/CreateSortableListItem.scss +2 -1
- package/src/styles/custom-fields/_index.scss +1 -1
- package/src/styles/customers/Filter.scss +5 -5
- package/src/styles/events/EditEventModal.scss +1 -3
- 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 +0 -1
- package/src/styles/iframe-events/CalendarSelect.scss +1 -1
- package/src/styles/iframe-events/CategoryStepsForm.scss +6 -7
- package/src/styles/iframe-events/Event.scss +2 -4
- package/src/styles/iframe-events/EventForm.scss +54 -54
- package/src/styles/iframe-events/EventNavigationFooter.scss +1 -0
- 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 +1 -2
- package/src/styles/product-set/CreateProductSetItem.scss +15 -13
- package/src/styles/product-set/DateAndRecurrenceInput.scss +6 -8
- 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 +25 -2
- package/src/styles/product-set/TutorialGifCard.scss +1 -1
- package/src/styles/product-set/_index.scss +2 -2
- package/src/styles/report/ReportCard.scss +1 -0
- package/src/styles/report/_index.scss +1 -1
- package/src/styles/resources-blocking/_index.scss +4 -0
- package/src/styles/sales/BookingFilter.scss +2 -2
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/sales/BookingTabs.scss +7 -5
- package/src/styles/sales/Filters.scss +5 -4
- package/src/styles/sales/GuestProfile.scss +170 -175
- package/src/styles/sales/LifeTimeSales.scss +1 -1
- package/src/styles/sales/ManualBooking.scss +4 -2
- package/src/styles/snippet-templates/_snippetVariables.scss +63 -244
- 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 +10 -32
- package/src/styles/themes/licklist/_variables.scss +1 -1
- package/src/styles/tiptap-editor/TiptapEditor.scss +9 -10
- package/src/styles/tiptap-editor/_index.scss +1 -1
- package/src/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
- package/src/styles/virtualized/_index.scss +1 -1
- package/src/styles/zones/ZoneForm.scss +1 -0
- package/src/styles/zones/ZoneRecurrencesControl.scss +6 -8
- package/src/tiptap-editor/TipTapEditor.stories.tsx +6 -4
- package/src/tiptap-editor/TipTapMenu/TipTapMenu.stories.tsx +5 -2
- package/src/zone/form/ZoneForm.tsx +3 -2
- package/src/zone/form/components/ZoneControl.tsx +3 -3
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +7 -5
- package/src/zone/form/utils/dates.ts +9 -10
- package/yarn.lock +103 -116
- package/dist/assets/iframe/selectArrow.svg.js +0 -17
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "react-icons/fa";
|
|
26
26
|
import { ProductSetLoadingContext } from "./context";
|
|
27
27
|
|
|
28
|
-
const CATEGORY_TYPES_NAMES = {
|
|
28
|
+
export const CATEGORY_TYPES_NAMES = {
|
|
29
29
|
menuItems: CATEGORY_TYPE_MENU_ITEMS,
|
|
30
30
|
tickets: CATEGORY_TYPE_TICKETS,
|
|
31
31
|
bookings: CATEGORY_TYPE_BOOKINGS,
|
|
@@ -33,7 +33,7 @@ const CATEGORY_TYPES_NAMES = {
|
|
|
33
33
|
fixedDuration: CATEGORY_TYPE_FIXED_DURATION,
|
|
34
34
|
} as const;
|
|
35
35
|
|
|
36
|
-
type CategoryConfig = { label: string; icon: ReactElement };
|
|
36
|
+
export type CategoryConfig = { label: string; icon: ReactElement };
|
|
37
37
|
|
|
38
38
|
const MAIN_CATEGORIES: Partial<Record<CategoryType, CategoryConfig>> = {
|
|
39
39
|
[CATEGORY_TYPES_NAMES.tickets]: {
|
|
@@ -71,9 +71,6 @@ export function SubProductsControl({
|
|
|
71
71
|
images: subProducts[index]?.images as Image[],
|
|
72
72
|
};
|
|
73
73
|
// @ts-expect-error TS2345
|
|
74
|
-
// @TODO fix prod type error
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
76
|
-
// @ts-ignore
|
|
77
74
|
append(subProductCopy);
|
|
78
75
|
}}
|
|
79
76
|
/>
|
|
@@ -47,9 +47,6 @@ export const VenueMapsControl = ({
|
|
|
47
47
|
url={image.url}
|
|
48
48
|
name={name}
|
|
49
49
|
points={points}
|
|
50
|
-
// @TODO fix prod type error
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
-
// @ts-ignore
|
|
53
50
|
products={products}
|
|
54
51
|
pointProducts={pointProducts}
|
|
55
52
|
onPointProductsChange={onPointProductsChange}
|
|
@@ -9,11 +9,13 @@ interface useSortableTreeFunctionsProps {
|
|
|
9
9
|
export const useSortableTreeFunctions = ({
|
|
10
10
|
fieldName,
|
|
11
11
|
remove,
|
|
12
|
+
isOverrides,
|
|
12
13
|
}: useSortableTreeFunctionsProps) => {
|
|
13
14
|
const { getValues, setValue } = useFormContext();
|
|
14
15
|
const [previousValue, setEditValue] = useState(null);
|
|
15
16
|
|
|
16
17
|
const edit = (index: number) => {
|
|
18
|
+
if (isOverrides) return;
|
|
17
19
|
const currentCategoryProduct = getValues(`${fieldName}.${index}` as const);
|
|
18
20
|
const cloneCategoryProduct = structuredClone(currentCategoryProduct);
|
|
19
21
|
setEditValue(cloneCategoryProduct);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useContext } from "react";
|
|
2
2
|
import { Col, Form } from "react-bootstrap";
|
|
3
3
|
import { Controller, Path, useFormContext } from "react-hook-form";
|
|
4
4
|
import { HookFormService } from "@licklist/plugins";
|
|
@@ -98,7 +98,7 @@ export const AdvancedOptions = <T extends FormValues>({
|
|
|
98
98
|
{...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
|
|
99
99
|
isInvalid={HookFormService.isInvalid<T>(
|
|
100
100
|
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
101
|
-
errors
|
|
101
|
+
errors,
|
|
102
102
|
)}
|
|
103
103
|
disabled={isLoading || isOverrides}
|
|
104
104
|
defaultValue=""
|
|
@@ -115,7 +115,7 @@ export const AdvancedOptions = <T extends FormValues>({
|
|
|
115
115
|
<Form.Control.Feedback type="invalid">
|
|
116
116
|
{HookFormService.getErrors<T>(
|
|
117
117
|
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
118
|
-
errors
|
|
118
|
+
errors,
|
|
119
119
|
)}
|
|
120
120
|
</Form.Control.Feedback>
|
|
121
121
|
</Form.Group>
|
|
@@ -134,7 +134,7 @@ export const AdvancedOptions = <T extends FormValues>({
|
|
|
134
134
|
onChange={onChange}
|
|
135
135
|
isInvalid={HookFormService.isInvalid<T>(
|
|
136
136
|
`${fieldNamePrefix}.termsAndConditions` as Path<T>,
|
|
137
|
-
errors
|
|
137
|
+
errors,
|
|
138
138
|
)}
|
|
139
139
|
disabled={isLoading || isOverrides}
|
|
140
140
|
name={name}
|
|
@@ -147,7 +147,7 @@ export const AdvancedOptions = <T extends FormValues>({
|
|
|
147
147
|
<Form.Control.Feedback type="invalid">
|
|
148
148
|
{HookFormService.getErrors<T>(
|
|
149
149
|
`${fieldNamePrefix}.termsAndConditions` as Path<T>,
|
|
150
|
-
errors
|
|
150
|
+
errors,
|
|
151
151
|
)}
|
|
152
152
|
</Form.Control.Feedback>
|
|
153
153
|
</Form.Group>
|
|
@@ -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
|
|
1
|
+
import { 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>
|
|
@@ -2,18 +2,22 @@ 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";
|
|
5
6
|
import CountryCodeSelect from "../../static/CountryCodeSelect";
|
|
6
7
|
import { LocationInputValues } from ".";
|
|
7
8
|
import { FormGroupControll } from "./components";
|
|
8
9
|
|
|
9
|
-
export function LocationInput() {
|
|
10
|
+
export function LocationInput({ path }: { path: TimeZonePath }) {
|
|
10
11
|
const {
|
|
11
12
|
register,
|
|
12
13
|
formState: { errors },
|
|
13
14
|
} = useFormContext<LocationInputValues>();
|
|
14
15
|
const { t } = useTranslation("Design");
|
|
15
16
|
|
|
17
|
+
const { data, isLoading } = useTimeZoneApi(path).useAll();
|
|
18
|
+
|
|
16
19
|
const countryId = useId();
|
|
20
|
+
const timeZoneId = useId();
|
|
17
21
|
|
|
18
22
|
return (
|
|
19
23
|
<>
|
|
@@ -39,6 +43,7 @@ export function LocationInput() {
|
|
|
39
43
|
name="location.postcode"
|
|
40
44
|
label={t("locationPostcode")}
|
|
41
45
|
/>
|
|
46
|
+
|
|
42
47
|
<Form.Group controlId={countryId}>
|
|
43
48
|
<Form.Label>{t("locationCountry")}</Form.Label>
|
|
44
49
|
<CountryCodeSelect
|
|
@@ -47,6 +52,40 @@ export function LocationInput() {
|
|
|
47
52
|
error={errors?.location?.country?.message}
|
|
48
53
|
/>
|
|
49
54
|
</Form.Group>
|
|
55
|
+
|
|
56
|
+
<Form.Group controlId={timeZoneId}>
|
|
57
|
+
<Form.Label>{t("locationTimeZone")}</Form.Label>
|
|
58
|
+
<Form.Control
|
|
59
|
+
{...register("location.timeZone", {
|
|
60
|
+
required: t("Validation:fieldRequired", {
|
|
61
|
+
attribute: t("locationTimeZone"),
|
|
62
|
+
}) as string,
|
|
63
|
+
})}
|
|
64
|
+
as="select"
|
|
65
|
+
custom
|
|
66
|
+
isInvalid={Boolean(errors?.location?.timeZone?.message)}
|
|
67
|
+
>
|
|
68
|
+
{isLoading ? (
|
|
69
|
+
<option key="" value="" disabled>
|
|
70
|
+
{t("loading")}
|
|
71
|
+
</option>
|
|
72
|
+
) : (
|
|
73
|
+
<>
|
|
74
|
+
<option key="" value="" disabled>
|
|
75
|
+
{t("chooseTimeZone")}
|
|
76
|
+
</option>
|
|
77
|
+
{data.map((zone) => (
|
|
78
|
+
<option key={zone.id} value={zone.id}>
|
|
79
|
+
{zone.name}
|
|
80
|
+
</option>
|
|
81
|
+
))}
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
84
|
+
</Form.Control>
|
|
85
|
+
<Form.Control.Feedback type="invalid">
|
|
86
|
+
{errors?.location?.timeZone?.message}
|
|
87
|
+
</Form.Control.Feedback>
|
|
88
|
+
</Form.Group>
|
|
50
89
|
</>
|
|
51
90
|
);
|
|
52
91
|
}
|
|
@@ -10,6 +10,9 @@ 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 { ENDPOINTS } from "@licklist/core/dist/Config";
|
|
14
|
+
import { TimeZonePath, useTimeZoneApi } from "@licklist/plugins";
|
|
15
|
+
import { DateTime } from "luxon";
|
|
13
16
|
import { CollapsibleInputGroup } from "../../collapsible-input-group";
|
|
14
17
|
import {
|
|
15
18
|
CategoriesInput,
|
|
@@ -41,6 +44,7 @@ export interface ProviderFormProps extends HasPermissionProp {
|
|
|
41
44
|
companiesOptions?: TypeaheadOptions[];
|
|
42
45
|
onSubmit: (values: ProviderFormValues) => void;
|
|
43
46
|
intent?: "create" | "update";
|
|
47
|
+
path: TimeZonePath;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
const providerImageTypes = {
|
|
@@ -56,14 +60,34 @@ export function ProviderForm({
|
|
|
56
60
|
onSubmit,
|
|
57
61
|
intent = "update",
|
|
58
62
|
hasPermission = true,
|
|
63
|
+
path,
|
|
59
64
|
}: ProviderFormProps) {
|
|
60
|
-
const
|
|
65
|
+
const { data } = useTimeZoneApi(ENDPOINTS.TIME_ZONE_ADMIN).useAll();
|
|
66
|
+
|
|
67
|
+
const defaultTimeZone = data
|
|
68
|
+
?.find((zone) => zone.name === DateTime.now().zoneName)
|
|
69
|
+
?.id?.toString();
|
|
70
|
+
|
|
71
|
+
const form = useForm<ProviderFormValues>({
|
|
72
|
+
defaultValues: defaultValues ?? {
|
|
73
|
+
location: { timeZone: defaultTimeZone },
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
61
77
|
const {
|
|
62
78
|
setValue,
|
|
63
79
|
handleSubmit,
|
|
64
80
|
formState: { isSubmitting, errors },
|
|
65
81
|
getValues,
|
|
66
82
|
} = form;
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!defaultValues.location.timeZone) {
|
|
86
|
+
setValue("location.timeZone", defaultTimeZone);
|
|
87
|
+
}
|
|
88
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
|
+
}, [defaultTimeZone]);
|
|
90
|
+
|
|
67
91
|
const { t } = useTranslation("Design");
|
|
68
92
|
const [initialImages, setInitialImages] = useState<Image[] | null>(null);
|
|
69
93
|
|
|
@@ -104,7 +128,7 @@ export function ProviderForm({
|
|
|
104
128
|
description={<LocationInputDescription />}
|
|
105
129
|
error={errors?.location?.country?.message}
|
|
106
130
|
>
|
|
107
|
-
<LocationInput />
|
|
131
|
+
<LocationInput path={path} />
|
|
108
132
|
</CollapsibleInputGroup>
|
|
109
133
|
{categories && categories.length > 0 && (
|
|
110
134
|
<CollapsibleInputGroup
|
|
@@ -11,6 +11,7 @@ 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";
|
|
14
15
|
import { CollapsibleInputGroup } from "../../collapsible-input-group";
|
|
15
16
|
import {
|
|
16
17
|
CategoriesInput,
|
|
@@ -50,6 +51,7 @@ export interface VenueFormProps extends HasPermissionProp {
|
|
|
50
51
|
intent?: "create" | "update";
|
|
51
52
|
isLoading?: boolean;
|
|
52
53
|
errorResponse?: unknown;
|
|
54
|
+
path: TimeZonePath;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
const providerImageTypes = {
|
|
@@ -67,6 +69,7 @@ export function VenueForm({
|
|
|
67
69
|
hasPermission = true,
|
|
68
70
|
isLoading,
|
|
69
71
|
errorResponse,
|
|
72
|
+
path,
|
|
70
73
|
}: VenueFormProps) {
|
|
71
74
|
const form = useForm<VenueFormValues>({ defaultValues, mode: "onChange" });
|
|
72
75
|
const {
|
|
@@ -143,7 +146,7 @@ export function VenueForm({
|
|
|
143
146
|
}))
|
|
144
147
|
}
|
|
145
148
|
>
|
|
146
|
-
<LocationInput />
|
|
149
|
+
<LocationInput path={path} />
|
|
147
150
|
</CollapsibleInputGroup>
|
|
148
151
|
<CollapsibleInputGroup
|
|
149
152
|
eventKey="workingHours"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
1
|
import { Col, Row } from "react-bootstrap";
|
|
3
2
|
import { useFormContext } from "react-hook-form";
|
|
4
3
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
6
4
|
import { WorkingHoursInputValues } from ".";
|
|
7
5
|
import { useWeekdays } from "./utils";
|
|
8
6
|
|
|
@@ -24,22 +22,10 @@ export function WorkingHoursInputDescription() {
|
|
|
24
22
|
<Row key={i}>
|
|
25
23
|
<Col xs="auto">{weekdays[i]}:</Col>
|
|
26
24
|
<Col>
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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}
|
|
25
|
+
{t("timeInterval", {
|
|
26
|
+
start: weekday.start,
|
|
27
|
+
end: weekday.end,
|
|
28
|
+
})}
|
|
43
29
|
</Col>
|
|
44
30
|
</Row>
|
|
45
31
|
);
|
|
@@ -12,9 +12,7 @@ export default {
|
|
|
12
12
|
component: RecurringDatePickerInput,
|
|
13
13
|
} as Meta;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
|
|
15
|
+
export const Default: Story<RecurringDatePickerInputProps> = (args) => {
|
|
18
16
|
return (
|
|
19
17
|
<Card style={{ maxWidth: "max-content" }}>
|
|
20
18
|
<Card.Body>
|
|
@@ -23,7 +21,7 @@ export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
|
|
|
23
21
|
</Card>
|
|
24
22
|
);
|
|
25
23
|
};
|
|
26
|
-
export const Valid: Story<
|
|
24
|
+
export const Valid: Story<RecurringDatePickerInputProps> = (args) => {
|
|
27
25
|
return (
|
|
28
26
|
<Card style={{ maxWidth: "max-content" }}>
|
|
29
27
|
<Card.Body>
|
|
@@ -34,6 +32,15 @@ export const Valid: Story<DefaultRecurringDatePickerInputProps> = (args) => {
|
|
|
34
32
|
};
|
|
35
33
|
Default.args = {
|
|
36
34
|
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
|
+
],
|
|
37
44
|
};
|
|
38
45
|
Valid.args = {
|
|
39
46
|
onChange: (data) => console.log("onSubmit", data),
|
|
@@ -12,9 +12,14 @@ 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";
|
|
15
16
|
import RecurrenceIntervalAndFrequencyInput from "./RecurrenceIntervalAndFrequencyInput";
|
|
16
17
|
import RecurrenceWeekdaysInput from "./RecurrenceWeekdaysInput";
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
parseAndValidateRRule,
|
|
20
|
+
SupportedFrequency,
|
|
21
|
+
useWorkHoursValidation,
|
|
22
|
+
} from "./utils";
|
|
18
23
|
import { ConfirmModal } from "../modals";
|
|
19
24
|
import { DeleteFieldButton } from "../product-set/elements";
|
|
20
25
|
|
|
@@ -26,6 +31,7 @@ export interface RecurringDatePickerInputProps {
|
|
|
26
31
|
initialFrequency?: Frequency;
|
|
27
32
|
setInitialStartDateAfterSelect?: boolean;
|
|
28
33
|
minDate?: string;
|
|
34
|
+
workHours: WorkHour[] | undefined;
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
export interface RecurringDatePickerInputValues {
|
|
@@ -51,6 +57,7 @@ export function RecurringDatePickerInput({
|
|
|
51
57
|
setInitialStartDateAfterSelect = false,
|
|
52
58
|
children,
|
|
53
59
|
minDate,
|
|
60
|
+
workHours,
|
|
54
61
|
}: PropsWithChildren<RecurringDatePickerInputProps>) {
|
|
55
62
|
const { t } = useTranslation(["Design"]);
|
|
56
63
|
|
|
@@ -84,6 +91,8 @@ export function RecurringDatePickerInput({
|
|
|
84
91
|
byWeekDay,
|
|
85
92
|
});
|
|
86
93
|
|
|
94
|
+
const validator = useWorkHoursValidation(byWeekDay, workHours);
|
|
95
|
+
|
|
87
96
|
const onSubmit = (nextState: RecurringDatePickerInputValues) => {
|
|
88
97
|
const end = getDateTimeObject(endDate, endTime || "23:59:59");
|
|
89
98
|
|
|
@@ -188,6 +197,8 @@ export function RecurringDatePickerInput({
|
|
|
188
197
|
<RecurrenceIntervalAndFrequencyInput
|
|
189
198
|
disabled={disabled}
|
|
190
199
|
minDate={minDate}
|
|
200
|
+
startTimeRules={validator}
|
|
201
|
+
endTimeRules={validator}
|
|
191
202
|
/>
|
|
192
203
|
|
|
193
204
|
{children}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TIME_FORMAT, TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
|
|
2
|
+
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
3
|
+
import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
|
|
4
|
+
import { DateTime, Interval } from "luxon";
|
|
5
|
+
import { Validate } from "react-hook-form";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
2
7
|
import RRule, { Frequency, Weekday } from "rrule";
|
|
3
8
|
|
|
4
9
|
export const getWeekdayForFrequency = ({
|
|
@@ -11,6 +16,7 @@ export const getWeekdayForFrequency = ({
|
|
|
11
16
|
const parsedDate = DateTime.fromISO(date);
|
|
12
17
|
return new Weekday(
|
|
13
18
|
parsedDate.weekday - 1,
|
|
19
|
+
// eslint-disable-next-line no-nested-ternary
|
|
14
20
|
frequency !== Frequency.MONTHLY
|
|
15
21
|
? undefined
|
|
16
22
|
: parsedDate.day + 7 > parsedDate.daysInMonth
|
|
@@ -109,3 +115,87 @@ export const parseAndValidateRRule = ({
|
|
|
109
115
|
until: options.until,
|
|
110
116
|
} as ParsedRRuleOptions;
|
|
111
117
|
};
|
|
118
|
+
|
|
119
|
+
export const useWorkHoursValidation = (
|
|
120
|
+
byWeekDay: Weekday[] = [],
|
|
121
|
+
workHours: WorkHour[] | undefined,
|
|
122
|
+
): {
|
|
123
|
+
/* @ts-expect-error 2314 */
|
|
124
|
+
validate?: Validate<string>;
|
|
125
|
+
} => {
|
|
126
|
+
const { t } = useTranslation("Validation");
|
|
127
|
+
if (!workHours) return {};
|
|
128
|
+
|
|
129
|
+
const fromTimeFormat = fromFormat(TIME_FORMAT);
|
|
130
|
+
const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
|
|
131
|
+
|
|
132
|
+
// map every day to array of intervals describing workhours for that day
|
|
133
|
+
let intervalsByDay = workHours.map((workhour, index, self) => {
|
|
134
|
+
const res: Interval[] = [];
|
|
135
|
+
|
|
136
|
+
const startTime = fromTimeFormat(workhour.start);
|
|
137
|
+
const endTime = fromTimeFormat(workhour.end);
|
|
138
|
+
|
|
139
|
+
if (endTime > startTime) {
|
|
140
|
+
res.push(Interval.fromDateTimes(startTime, endTime));
|
|
141
|
+
} else {
|
|
142
|
+
// if end is before start, then it means that end is on the next day
|
|
143
|
+
// so count only to the end of current day
|
|
144
|
+
res.push(Interval.fromDateTimes(startTime, startTime.endOf("day")));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const prevIndex = index === 0 ? self.length - 1 : index - 1;
|
|
148
|
+
|
|
149
|
+
const prevStartTime = fromTimeFormat(self[prevIndex].start);
|
|
150
|
+
const prevEndTime = fromTimeFormat(self[prevIndex].end);
|
|
151
|
+
|
|
152
|
+
// if prevStartTime > prevEndTime then it means that prevEndTime is on the current day
|
|
153
|
+
// so we need to add interval from start of current day to prevEndTime
|
|
154
|
+
if (prevStartTime > prevEndTime) {
|
|
155
|
+
res.push(Interval.fromDateTimes(prevEndTime.startOf("day"), prevEndTime));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return res;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// if length === 0 or length === 7 then all workhours are selected, no need to filter
|
|
162
|
+
if (![0, 7].includes(byWeekDay.length)) {
|
|
163
|
+
intervalsByDay = intervalsByDay.filter((_, index) =>
|
|
164
|
+
byWeekDay.find(({ weekday }) => weekday === index),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
validate: (_time: string) => {
|
|
170
|
+
// workaround for issue with form values
|
|
171
|
+
// default values and entered values have different formats
|
|
172
|
+
const time = fromTimeFormat(_time).isValid
|
|
173
|
+
? fromTimeFormat(_time)
|
|
174
|
+
: fromTimeFullFormat(_time);
|
|
175
|
+
|
|
176
|
+
const notFittingIntervalsByDay = intervalsByDay.reduce<Interval[][]>(
|
|
177
|
+
(acc, intervalsByDay) => {
|
|
178
|
+
if (!intervalsByDay.some((interval) => interval.contains(time))) {
|
|
179
|
+
acc.push(intervalsByDay);
|
|
180
|
+
}
|
|
181
|
+
return acc;
|
|
182
|
+
},
|
|
183
|
+
[],
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
const notFittingIntervals = notFittingIntervalsByDay
|
|
187
|
+
.flat()
|
|
188
|
+
.filter((interval) => !interval.contains(time));
|
|
189
|
+
|
|
190
|
+
const attribute = notFittingIntervals
|
|
191
|
+
.map((interval) => interval.toFormat("HH:mm"))
|
|
192
|
+
.join(", ");
|
|
193
|
+
|
|
194
|
+
if (notFittingIntervalsByDay.length !== 0) {
|
|
195
|
+
return t("outsideWorkingHours", { attribute }) as string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return true;
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
};
|
|
@@ -19,6 +19,7 @@ export const SettingFormComponent: Story<AdminSettingFormProps> = (args) => (
|
|
|
19
19
|
</Container>
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
+
|
|
22
23
|
export const PaymentFeeFormComponent: Story<PaymentFeeFormProps> = (args) => {
|
|
23
24
|
const form = useForm<PaymentFeeFormFieldValues>({
|
|
24
25
|
defaultValues: args.defaultValues,
|
|
@@ -10,7 +10,7 @@ import Row from "react-bootstrap/Row";
|
|
|
10
10
|
import Col from "react-bootstrap/Col";
|
|
11
11
|
import { Link } from "react-router-dom";
|
|
12
12
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
13
|
-
import {
|
|
13
|
+
import { ProvidableType } from "@licklist/core/dist/DataMapper/Provider/ProvidableDataMapper";
|
|
14
14
|
import { FaCommentAlt } from "react-icons/fa";
|
|
15
15
|
import { PaymentFeeForm, PaymentFeeFormFieldValues } from "./PaymentFeeForm";
|
|
16
16
|
import { Currency } from "../../types/currency";
|
|
@@ -32,7 +32,7 @@ export interface AdminSettingFormProps extends HasPermissionProp {
|
|
|
32
32
|
providerMetadata: {
|
|
33
33
|
country?: string;
|
|
34
34
|
providableId?: number;
|
|
35
|
-
providerType?:
|
|
35
|
+
providerType?: ProvidableType;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -307,6 +307,7 @@ export function Preview({
|
|
|
307
307
|
productCategoryId: 57,
|
|
308
308
|
productGroupId: null,
|
|
309
309
|
availableQuantity: 980,
|
|
310
|
+
zoneId: null,
|
|
310
311
|
name: "Cofee",
|
|
311
312
|
description: "",
|
|
312
313
|
price: 15,
|
|
@@ -315,6 +316,8 @@ export function Preview({
|
|
|
315
316
|
maxQuantity: 15,
|
|
316
317
|
totalQuantity: 980,
|
|
317
318
|
type: "sale" as const,
|
|
319
|
+
capacity: 0,
|
|
320
|
+
duration: 0,
|
|
318
321
|
weight: 0,
|
|
319
322
|
isAvailable: true,
|
|
320
323
|
isSoldOut: false,
|
|
@@ -333,6 +336,7 @@ export function Preview({
|
|
|
333
336
|
productCategoryId: 57,
|
|
334
337
|
productGroupId: null,
|
|
335
338
|
availableQuantity: 980,
|
|
339
|
+
zoneId: null,
|
|
336
340
|
name: "Cofee 2",
|
|
337
341
|
description: "",
|
|
338
342
|
price: 15,
|
|
@@ -341,6 +345,8 @@ export function Preview({
|
|
|
341
345
|
maxQuantity: 15,
|
|
342
346
|
totalQuantity: 980,
|
|
343
347
|
type: "sale" as const,
|
|
348
|
+
capacity: 0,
|
|
349
|
+
duration: 0,
|
|
344
350
|
weight: 0,
|
|
345
351
|
isAvailable: true,
|
|
346
352
|
isSoldOut: false,
|