@licklist/design 0.63.0-dev.1 → 0.63.0
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/bitbucket-pipelines.yml +8 -0
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -3
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +1 -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 +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +1 -3
- 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 +1 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts +5 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
- package/dist/product-set/control/DateInput.d.ts.map +1 -1
- package/dist/product-set/control/DateInput.js +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts +3 -4
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts +1 -2
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts +1 -4
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +1 -2
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/form/StepsControl.d.ts +1 -2
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts +0 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
- package/dist/product-set/step/StepControl.d.ts +1 -2
- package/dist/product-set/step/StepControl.d.ts.map +1 -1
- package/dist/product-set/step/StepControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -3
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/recurring-date-picker-input/utils.d.ts +0 -12
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sales/coupon/control/CouponFormControl.d.ts +1 -2
- package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +1 -1
- package/dist/sales/coupon/form/CouponFrom.d.ts +2 -2
- package/dist/sales/coupon/form/CouponFrom.d.ts.map +1 -1
- package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
- package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.d.ts +0 -1
- package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.js +1 -1
- 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 +1 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/typeahead/Typeahead.d.ts +1 -2
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +1 -1
- 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 +1 -1
- package/dist/zone/form/components/AvailableTimesControl.d.ts +2 -0
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/jest.config.js +29 -0
- package/package.json +35 -10
- package/src/date-time-button/DateTimeButton.stories.tsx +1 -2
- package/src/date-time-button/DateTimeButton.tsx +5 -7
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +0 -4
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +9 -18
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +0 -5
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
- package/src/product-set/control/DateAndRecurrenceInput.tsx +14 -48
- package/src/product-set/control/DateInput.tsx +4 -2
- package/src/product-set/control/ProductSetControl.stories.tsx +1 -1
- package/src/product-set/control/ProductSetControl.tsx +11 -12
- package/src/product-set/form/ProductCategoriesControl.tsx +4 -8
- package/src/product-set/form/ProductSetForm.stories.tsx +2 -1
- package/src/product-set/form/ProductSetForm.tsx +1 -5
- package/src/product-set/form/ProductsControl.tsx +77 -87
- package/src/product-set/form/StepsControl.tsx +6 -11
- package/src/product-set/hooks/useSortableTreeFunctions.ts +0 -2
- package/src/product-set/product/ProductControl.tsx +39 -39
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +2 -0
- package/src/product-set/step/StepControl.tsx +3 -4
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
- package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +1 -0
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -11
- package/src/recurring-date-picker-input/utils.ts +0 -77
- package/src/sales/booking/results/BookingResults.stories.tsx +2 -3
- package/src/sales/booking/results/components/ResultCard.tsx +5 -2
- package/src/sales/coupon/control/CouponFormControl.tsx +51 -28
- package/src/sales/coupon/form/CouponFrom.tsx +15 -5
- package/src/setting/admin/AdminSettingForm.tsx +2 -2
- package/src/setting/dashboard/DashboardSettingForm.tsx +0 -13
- package/src/sortable-tree/SortableTreeItem.tsx +4 -1
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/typeahead/Typeahead.tsx +3 -16
- package/src/zone/form/ZoneForm.tsx +2 -3
- package/src/zone/form/components/AvailableTimesControl.tsx +2 -0
- package/src/zone/form/components/ZoneControl.tsx +3 -3
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +5 -7
- package/src/zone/form/utils/dates.ts +10 -9
- package/tests/Auth/Authorizer.test.tsx +194 -0
- package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
- package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
- package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
- package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
- package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
- package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
- package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
- package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
- package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
- package/tests/FileUpload/FileUpload.test.tsx +42 -0
- package/tests/Notification/EmailTemplate.test.tsx +82 -0
- package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
- package/tests/Report/Report.test.tsx +48 -0
- package/tests/Sales/Coupon.test.tsx +51 -0
- package/tests/Sales/SalesAndVIews.test.tsx +63 -0
- package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
- package/tests/Table/FilterHelperComponent.test.tsx +88 -0
- package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
- package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
- package/tests/Table/TableHelperComponent.test.tsx +295 -0
- package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
- package/tests/__mock__/hooks/useAuthApi.ts +13 -0
- package/tests/__mock__/hooks/useAuthMock.ts +13 -0
- package/tests/__mock__/hooks/useFormMock.ts +27 -0
- package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
- package/tests/__mock__/hooks/useQueryMock.ts +16 -0
- package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
- package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
- package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
- package/tests/__mock__/hooks/useUserMock.ts +13 -0
- package/tests/__mock__/styleMock.js +1 -0
- package/tests/__mock__/windowMock.ts +5 -0
- package/tests/packages/react-query.tsx +28 -0
- package/tests/setupTests.ts +10 -0
- package/dist/product-set/control/utils.d.ts +0 -5
- package/dist/product-set/control/utils.d.ts.map +0 -1
- package/dist/product-set/control/utils.js +0 -1
- package/dist/sales/coupon/utils/index.d.ts +0 -7
- package/dist/sales/coupon/utils/index.d.ts.map +0 -1
- package/dist/sales/coupon/utils/index.js +0 -1
- package/src/product-set/control/utils.ts +0 -25
- package/src/sales/coupon/utils/index.ts +0 -13
|
@@ -7,17 +7,14 @@ import {
|
|
|
7
7
|
QUANTITY_TYPE_LIST_DTO,
|
|
8
8
|
QUANTITY_TYPE_RECHARGING,
|
|
9
9
|
} from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
|
|
10
|
-
import {
|
|
11
|
-
ProductType,
|
|
12
|
-
PRODUCT_DEfAULT_COLORS,
|
|
13
|
-
} from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
10
|
+
import { ProductType } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
14
11
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
15
|
-
import clsx from "clsx";
|
|
16
12
|
import {
|
|
17
13
|
FieldNamePrefixPath,
|
|
18
14
|
FormValues,
|
|
19
15
|
} from "@licklist/plugins/dist/types/services/Form/hook-form-service";
|
|
20
16
|
import { useId } from "@react-aria/utils";
|
|
17
|
+
import clsx from "clsx";
|
|
21
18
|
import React, {
|
|
22
19
|
ChangeEvent,
|
|
23
20
|
useCallback,
|
|
@@ -39,7 +36,7 @@ import {
|
|
|
39
36
|
} from "react-hook-form";
|
|
40
37
|
import { useTranslation } from "react-i18next";
|
|
41
38
|
import { useImages } from "@licklist/plugins/dist/hooks/Media/useImages";
|
|
42
|
-
|
|
39
|
+
import { PRODUCT_DEfAULT_COLORS } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
43
40
|
import {
|
|
44
41
|
Image,
|
|
45
42
|
IMAGE_TYPE_IMAGE,
|
|
@@ -89,7 +86,6 @@ export interface ProductControlValues
|
|
|
89
86
|
totalQuantity: number;
|
|
90
87
|
isAvailable: boolean;
|
|
91
88
|
isSoldOut: boolean;
|
|
92
|
-
originalProductId: number | null;
|
|
93
89
|
isUnlimited: boolean;
|
|
94
90
|
isRequired: boolean;
|
|
95
91
|
quantitySelector: number;
|
|
@@ -150,7 +146,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
150
146
|
clearErrors,
|
|
151
147
|
} = useFormContext<T>();
|
|
152
148
|
|
|
153
|
-
const { setLoading
|
|
149
|
+
const { setLoading } = useContext(ProductSetLoadingContext);
|
|
154
150
|
const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
|
|
155
151
|
const [expanded, setExpanded] = useState(false);
|
|
156
152
|
const [initialImages, setInitialImages] = useState<Image[] | null>(null);
|
|
@@ -160,10 +156,11 @@ export function ProductControl<T extends FormValues>({
|
|
|
160
156
|
);
|
|
161
157
|
const capacity = watch(`${fieldNamePrefix}.capacity` as Path<T>);
|
|
162
158
|
const disabledDuration = capacity === "0" || !capacity;
|
|
159
|
+
|
|
163
160
|
const advancedId = useId();
|
|
164
161
|
const nameId = useId();
|
|
165
|
-
|
|
166
|
-
const productGroupId = useId();
|
|
162
|
+
// @TODO: no need for v1 release
|
|
163
|
+
// const productGroupId = useId();
|
|
167
164
|
const descriptionId = useId();
|
|
168
165
|
const termsAndConditionsId = useId();
|
|
169
166
|
const isAvailableId = useId();
|
|
@@ -403,35 +400,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
403
400
|
isRequired={false}
|
|
404
401
|
defaultColors={PRODUCT_DEfAULT_COLORS}
|
|
405
402
|
/>
|
|
406
|
-
|
|
407
|
-
<Form.Group controlId={productGroupId}>
|
|
408
|
-
<Form.Label>{t("productGroup")}</Form.Label>
|
|
409
|
-
<Form.Control
|
|
410
|
-
as="select"
|
|
411
|
-
{...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
|
|
412
|
-
isInvalid={HookFormService.isInvalid<T>(
|
|
413
|
-
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
414
|
-
errors
|
|
415
|
-
)}
|
|
416
|
-
disabled={isLoading || isOverrides}
|
|
417
|
-
defaultValue=""
|
|
418
|
-
>
|
|
419
|
-
<option value="">{t("Design:selectProductGroup")}</option>
|
|
420
|
-
{productGroupList.map((productGroup) => {
|
|
421
|
-
return (
|
|
422
|
-
<option value={productGroup.id} key={productGroup.id}>
|
|
423
|
-
{productGroup.value}
|
|
424
|
-
</option>
|
|
425
|
-
);
|
|
426
|
-
})}
|
|
427
|
-
</Form.Control>
|
|
428
|
-
<Form.Control.Feedback type="invalid">
|
|
429
|
-
{HookFormService.getErrors<T>(
|
|
430
|
-
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
431
|
-
errors
|
|
432
|
-
)}
|
|
433
|
-
</Form.Control.Feedback>
|
|
434
|
-
</Form.Group>
|
|
435
403
|
</Col>
|
|
436
404
|
</Row>
|
|
437
405
|
|
|
@@ -704,6 +672,38 @@ export function ProductControl<T extends FormValues>({
|
|
|
704
672
|
</Collapse>
|
|
705
673
|
|
|
706
674
|
<Row>
|
|
675
|
+
{/* @TODO: no need for v1 release
|
|
676
|
+
<Col xs={12} sm={6}>
|
|
677
|
+
<Form.Group controlId={productGroupId}>
|
|
678
|
+
<Form.Label>{t("productGroup")}</Form.Label>
|
|
679
|
+
<Form.Control
|
|
680
|
+
as="select"
|
|
681
|
+
{...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
|
|
682
|
+
isInvalid={HookFormService.isInvalid<T>(
|
|
683
|
+
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
684
|
+
errors
|
|
685
|
+
)}
|
|
686
|
+
disabled={isLoading}
|
|
687
|
+
defaultValue=""
|
|
688
|
+
>
|
|
689
|
+
<option value="">{t("Design:selectProductGroup")}</option>
|
|
690
|
+
{productGroupList.map((productGroup) => {
|
|
691
|
+
return (
|
|
692
|
+
<option value={productGroup.id} key={productGroup.id}>
|
|
693
|
+
{productGroup.value}
|
|
694
|
+
</option>
|
|
695
|
+
);
|
|
696
|
+
})}
|
|
697
|
+
</Form.Control>
|
|
698
|
+
<Form.Control.Feedback type="invalid">
|
|
699
|
+
{HookFormService.getErrors<T>(
|
|
700
|
+
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
701
|
+
errors
|
|
702
|
+
)}
|
|
703
|
+
</Form.Control.Feedback>
|
|
704
|
+
</Form.Group>
|
|
705
|
+
</Col> */}
|
|
706
|
+
|
|
707
707
|
<Col xs={12}>
|
|
708
708
|
{hasBookingManagement && (
|
|
709
709
|
<ProductBookingManagementControl<T>
|
|
@@ -5,6 +5,8 @@ import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/
|
|
|
5
5
|
import { useWatch } from "react-hook-form";
|
|
6
6
|
import { FormNumberInput } from "../../../static";
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
|
|
8
10
|
interface FixedDurationOptionsProps<T> extends FieldNamePrefixPath<T> {
|
|
9
11
|
isOverrides?: boolean;
|
|
10
12
|
}
|
|
@@ -26,7 +26,6 @@ export interface StepControlProps extends IsDeletableEvent {
|
|
|
26
26
|
stepIndex: number;
|
|
27
27
|
stepName: string;
|
|
28
28
|
onStepNameChange: (args: any) => void;
|
|
29
|
-
isOverrides?: boolean;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
export function StepControl({
|
|
@@ -34,7 +33,6 @@ export function StepControl({
|
|
|
34
33
|
stepIndex,
|
|
35
34
|
stepName,
|
|
36
35
|
onStepNameChange,
|
|
37
|
-
isOverrides = false,
|
|
38
36
|
}: StepControlProps) {
|
|
39
37
|
const { providerHasMap } = useContext(ProductSetLoadingContext);
|
|
40
38
|
const {
|
|
@@ -44,6 +42,7 @@ export function StepControl({
|
|
|
44
42
|
watch,
|
|
45
43
|
} = useFormContext<ProductSetFormValues>();
|
|
46
44
|
const { t } = useTranslation("Design");
|
|
45
|
+
|
|
47
46
|
const fieldName = `steps.${stepIndex}.name` as const;
|
|
48
47
|
const productCategoriesFieldName =
|
|
49
48
|
`steps.${stepIndex}.productCategories` as const;
|
|
@@ -72,7 +71,7 @@ export function StepControl({
|
|
|
72
71
|
fieldName,
|
|
73
72
|
errors
|
|
74
73
|
)}
|
|
75
|
-
disabled={isLoading
|
|
74
|
+
disabled={isLoading}
|
|
76
75
|
/>
|
|
77
76
|
)}
|
|
78
77
|
control={control}
|
|
@@ -115,7 +114,7 @@ export function StepControl({
|
|
|
115
114
|
name={name}
|
|
116
115
|
value={Boolean(value)}
|
|
117
116
|
onChange={onChange}
|
|
118
|
-
disabled={isLoading
|
|
117
|
+
disabled={isLoading}
|
|
119
118
|
/>
|
|
120
119
|
)}
|
|
121
120
|
control={control}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Col, Row } from "react-bootstrap";
|
|
3
4
|
import { useFormContext } from "react-hook-form";
|
|
4
5
|
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
5
7
|
import { WorkingHoursInputValues } from ".";
|
|
6
8
|
import { useWeekdays } from "./utils";
|
|
7
9
|
|
|
@@ -23,10 +25,22 @@ export function WorkingHoursInputDescription() {
|
|
|
23
25
|
<Row key={i}>
|
|
24
26
|
<Col xs="auto">{weekdays[i]}:</Col>
|
|
25
27
|
<Col>
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
{weekday?.end
|
|
29
|
+
? weekday.start
|
|
30
|
+
? t("timeInterval", {
|
|
31
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
32
|
+
TIME_FORMAT
|
|
33
|
+
),
|
|
34
|
+
end: DateTime.fromISO(weekday.start).toFormat(
|
|
35
|
+
TIME_FORMAT
|
|
36
|
+
),
|
|
37
|
+
})
|
|
38
|
+
: t("timeFrom", {
|
|
39
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
40
|
+
TIME_FORMAT
|
|
41
|
+
),
|
|
42
|
+
})
|
|
43
|
+
: null}
|
|
30
44
|
</Col>
|
|
31
45
|
</Row>
|
|
32
46
|
);
|
|
@@ -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
|
-
useWorkHoursValidationRules,
|
|
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,7 +26,6 @@ export interface RecurringDatePickerInputProps {
|
|
|
31
26
|
initialFrequency?: Frequency;
|
|
32
27
|
setInitialStartDateAfterSelect?: boolean;
|
|
33
28
|
minDate?: string;
|
|
34
|
-
workHours: WorkHour[] | undefined;
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
export interface RecurringDatePickerInputValues {
|
|
@@ -57,7 +51,6 @@ export function RecurringDatePickerInput({
|
|
|
57
51
|
setInitialStartDateAfterSelect = false,
|
|
58
52
|
children,
|
|
59
53
|
minDate,
|
|
60
|
-
workHours,
|
|
61
54
|
}: PropsWithChildren<RecurringDatePickerInputProps>) {
|
|
62
55
|
const { t } = useTranslation(["Design"]);
|
|
63
56
|
|
|
@@ -91,8 +84,6 @@ export function RecurringDatePickerInput({
|
|
|
91
84
|
byWeekDay,
|
|
92
85
|
});
|
|
93
86
|
|
|
94
|
-
const validationRules = useWorkHoursValidationRules(byWeekDay, workHours);
|
|
95
|
-
|
|
96
87
|
const onSubmit = (nextState: RecurringDatePickerInputValues) => {
|
|
97
88
|
const end = getDateTimeObject(endDate, endTime || "23:59:59");
|
|
98
89
|
|
|
@@ -197,7 +188,6 @@ export function RecurringDatePickerInput({
|
|
|
197
188
|
<RecurrenceIntervalAndFrequencyInput
|
|
198
189
|
disabled={disabled}
|
|
199
190
|
minDate={minDate}
|
|
200
|
-
{...validationRules}
|
|
201
191
|
/>
|
|
202
192
|
|
|
203
193
|
{children}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
2
|
-
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
3
|
-
import { dateTimesSortFn } from "@licklist/plugins/dist/utils/dateTime";
|
|
4
1
|
import { DateTime } from "luxon";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
2
|
import RRule, { Frequency, Weekday } from "rrule";
|
|
7
3
|
|
|
8
4
|
export const getWeekdayForFrequency = ({
|
|
@@ -15,7 +11,6 @@ export const getWeekdayForFrequency = ({
|
|
|
15
11
|
const parsedDate = DateTime.fromISO(date);
|
|
16
12
|
return new Weekday(
|
|
17
13
|
parsedDate.weekday - 1,
|
|
18
|
-
// eslint-disable-next-line no-nested-ternary
|
|
19
14
|
frequency !== Frequency.MONTHLY
|
|
20
15
|
? undefined
|
|
21
16
|
: parsedDate.day + 7 > parsedDate.daysInMonth
|
|
@@ -114,75 +109,3 @@ export const parseAndValidateRRule = ({
|
|
|
114
109
|
until: options.until,
|
|
115
110
|
} as ParsedRRuleOptions;
|
|
116
111
|
};
|
|
117
|
-
|
|
118
|
-
export const useWorkHoursValidationRules = (
|
|
119
|
-
byWeekDay: Weekday[] = [],
|
|
120
|
-
workHours: WorkHour[] | undefined
|
|
121
|
-
) => {
|
|
122
|
-
const { t } = useTranslation("Validation");
|
|
123
|
-
if (!workHours) return {};
|
|
124
|
-
|
|
125
|
-
// workhours of selected days, all if no days selected
|
|
126
|
-
const selectedWorkHours = byWeekDay.length
|
|
127
|
-
? byWeekDay.map(({ weekday }) =>
|
|
128
|
-
workHours.find(({ day }) => day === weekday)
|
|
129
|
-
)
|
|
130
|
-
: workHours;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* start time
|
|
134
|
-
*/
|
|
135
|
-
const startTimes = selectedWorkHours
|
|
136
|
-
.map((workhour) => DateTime.fromFormat(workhour.start, TIME_FORMAT))
|
|
137
|
-
.sort(dateTimesSortFn("desc"));
|
|
138
|
-
|
|
139
|
-
const latestStartTime = startTimes[0];
|
|
140
|
-
|
|
141
|
-
const startTimeRules = {
|
|
142
|
-
validate: (date: string) => {
|
|
143
|
-
const selectedDate = DateTime.fromFormat(date, TIME_FORMAT);
|
|
144
|
-
if (selectedDate >= latestStartTime) return true;
|
|
145
|
-
|
|
146
|
-
return t("fieldTimeAfter", {
|
|
147
|
-
attribute: t("Design:startTimeSmall"),
|
|
148
|
-
time: latestStartTime.toFormat(TIME_FORMAT),
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* end time
|
|
155
|
-
*/
|
|
156
|
-
const endTimes = selectedWorkHours
|
|
157
|
-
.map<string>(({ start, end }) => {
|
|
158
|
-
const startDateTime = DateTime.fromFormat(start, TIME_FORMAT);
|
|
159
|
-
const endDateTime = DateTime.fromFormat(end, TIME_FORMAT);
|
|
160
|
-
|
|
161
|
-
if (startDateTime <= endDateTime) return end;
|
|
162
|
-
|
|
163
|
-
// if end is before start, then it means that end is on the next day
|
|
164
|
-
// so count only to the end of current day
|
|
165
|
-
return "23:59";
|
|
166
|
-
})
|
|
167
|
-
.map((workhour) => DateTime.fromFormat(workhour, TIME_FORMAT))
|
|
168
|
-
.sort(dateTimesSortFn("asc"));
|
|
169
|
-
|
|
170
|
-
const earliestEndTime = endTimes[0];
|
|
171
|
-
|
|
172
|
-
const endTimeRules = {
|
|
173
|
-
validate: (date: string) => {
|
|
174
|
-
const selectedDate = DateTime.fromFormat(date, TIME_FORMAT);
|
|
175
|
-
if (selectedDate <= earliestEndTime) return true;
|
|
176
|
-
|
|
177
|
-
return t("fieldTimeBefore", {
|
|
178
|
-
attribute: t("Design:endTimeSmall"),
|
|
179
|
-
time: earliestEndTime.toFormat(TIME_FORMAT),
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
startTimeRules,
|
|
186
|
-
endTimeRules,
|
|
187
|
-
};
|
|
188
|
-
};
|
|
@@ -3,12 +3,11 @@ import { Meta } from "@storybook/react";
|
|
|
3
3
|
import { Event } from "@licklist/core/dist/DataMapper/Provider/EventDataMapper";
|
|
4
4
|
import { User } from "@licklist/core/dist/DataMapper/User/UserDataMapper";
|
|
5
5
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
6
|
+
import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
6
7
|
import {
|
|
7
|
-
Order,
|
|
8
8
|
ORDER_SOURCE_IFRAME,
|
|
9
9
|
ORDER_SOURCE_MANUAL,
|
|
10
|
-
} from "@licklist/core/
|
|
11
|
-
|
|
10
|
+
} from "@licklist/core/src/DataMapper/Order/OrderDataMapper";
|
|
12
11
|
import { BookingResults } from "./BookingResults";
|
|
13
12
|
|
|
14
13
|
export default {
|
|
@@ -12,6 +12,7 @@ import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
|
12
12
|
import * as Config from "@licklist/core/dist/Config";
|
|
13
13
|
import { formatDateStringForEvent } from "@licklist/plugins/dist/utils/formatDate";
|
|
14
14
|
import { getOrderSourceTitle } from "@licklist/plugins/dist/utils/sourceTitle";
|
|
15
|
+
|
|
15
16
|
import Icon from "../../../../static/Icon";
|
|
16
17
|
|
|
17
18
|
export type ResultCardProps = {
|
|
@@ -21,6 +22,8 @@ export type ResultCardProps = {
|
|
|
21
22
|
onCardClick?: (id: number) => void;
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
// @TODO integrate when API will be available
|
|
26
|
+
// activity and staff keys
|
|
24
27
|
export const ResultCard = ({
|
|
25
28
|
order,
|
|
26
29
|
className,
|
|
@@ -38,10 +41,10 @@ export const ResultCard = ({
|
|
|
38
41
|
startDate,
|
|
39
42
|
products,
|
|
40
43
|
source,
|
|
44
|
+
totalAmount,
|
|
41
45
|
event,
|
|
42
46
|
menu,
|
|
43
47
|
remainingToPay,
|
|
44
|
-
paidAmount,
|
|
45
48
|
} = order;
|
|
46
49
|
|
|
47
50
|
const productList = products.map((product) => product.name)?.join(", ") || "";
|
|
@@ -105,7 +108,7 @@ export const ResultCard = ({
|
|
|
105
108
|
)}
|
|
106
109
|
<p>
|
|
107
110
|
{t("paidAmount")}:{" "}
|
|
108
|
-
{formatNumber(
|
|
111
|
+
{formatNumber(totalAmount, {
|
|
109
112
|
style: "currency",
|
|
110
113
|
currency: Config.Currency.GBP,
|
|
111
114
|
})}
|
|
@@ -21,14 +21,12 @@ import couponCodeRules from "@licklist/plugins/dist/validation/Rules/couponCodeR
|
|
|
21
21
|
// import { useId } from "@react-aria/utils";
|
|
22
22
|
|
|
23
23
|
import HTMLInputDateElement from "../../../types/static/HTMLInputDateElement";
|
|
24
|
-
import { Typeahead, TypeaheadOptions } from "../../../typeahead";
|
|
25
|
-
import { convertToTypeaheadOptions } from "../utils";
|
|
26
24
|
|
|
27
25
|
export interface CouponFormValues {
|
|
28
26
|
name?: string;
|
|
29
27
|
code: string;
|
|
30
28
|
discountType: CouponType;
|
|
31
|
-
productGroupIds:
|
|
29
|
+
productGroupIds: string[];
|
|
32
30
|
discount: number;
|
|
33
31
|
totalType: CouponTotalType;
|
|
34
32
|
startFrom: string;
|
|
@@ -60,9 +58,9 @@ export const CouponFormControl = ({
|
|
|
60
58
|
watch,
|
|
61
59
|
} = useFormContext<CouponFormValues>();
|
|
62
60
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
63
|
-
const [selectedProductGroups, setSelectedProductGroups] = useState<
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const [selectedProductGroups, setSelectedProductGroups] = useState<string[]>(
|
|
62
|
+
[]
|
|
63
|
+
);
|
|
66
64
|
/* TODO: Show Recurrent date, when reccurent date bugs are fixed */
|
|
67
65
|
// const rrule = watch("rrule");
|
|
68
66
|
// const [recurrent, setRecurrent] = useState(Boolean(rrule));
|
|
@@ -87,20 +85,15 @@ export const CouponFormControl = ({
|
|
|
87
85
|
[COUPON_TOTAL_TYPE_TOTAL]: t("Design:depositTotal"),
|
|
88
86
|
};
|
|
89
87
|
|
|
88
|
+
// Set pre-selected Product Groups
|
|
90
89
|
useEffect(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
setSelectedProductGroups(
|
|
94
|
-
convertToTypeaheadOptions(defaultProductGroup as ProductGroup[])
|
|
95
|
-
);
|
|
90
|
+
setSelectedProductGroups(getValues("productGroupIds"));
|
|
96
91
|
}, [getValues]);
|
|
97
92
|
|
|
98
93
|
useEffect(() => {
|
|
99
94
|
setValue("productGroupIds", selectedProductGroups);
|
|
100
95
|
}, [getValues, setValue, selectedProductGroups]);
|
|
101
96
|
|
|
102
|
-
const productGroupList = convertToTypeaheadOptions(productGroups);
|
|
103
|
-
|
|
104
97
|
/* TODO: Show Recurrent date, when reccurent date bugs are fixed */
|
|
105
98
|
// useEffect(() => {
|
|
106
99
|
// if (!recurrent && rrule) {
|
|
@@ -258,21 +251,51 @@ export const CouponFormControl = ({
|
|
|
258
251
|
</Form.Group>
|
|
259
252
|
</Col>
|
|
260
253
|
</Row>
|
|
261
|
-
|
|
262
|
-
<
|
|
263
|
-
<
|
|
264
|
-
<
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
254
|
+
{productGroups && productGroups?.length > 0 && (
|
|
255
|
+
<Row>
|
|
256
|
+
<Col md={12}>
|
|
257
|
+
<h5 className="mt-4">{t("Design:productGroups")}</h5>
|
|
258
|
+
<Form.Group className="d-flex flex-wrap justify-content-between mt-4 mb-5">
|
|
259
|
+
{productGroups?.map((productGroup) => {
|
|
260
|
+
const isGroupSelected =
|
|
261
|
+
getValues("productGroupIds")?.includes(
|
|
262
|
+
String(productGroup.id)
|
|
263
|
+
) ?? false;
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<Form.Check
|
|
267
|
+
key={productGroup.id}
|
|
268
|
+
label={productGroup.name}
|
|
269
|
+
defaultChecked={isGroupSelected}
|
|
270
|
+
disabled={isLoading}
|
|
271
|
+
onChange={(e) => {
|
|
272
|
+
if (e.target.checked) {
|
|
273
|
+
setSelectedProductGroups((prevGroups) =>
|
|
274
|
+
Array.from(
|
|
275
|
+
new Set([...prevGroups, String(productGroup.id)])
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
} else {
|
|
279
|
+
setSelectedProductGroups((prevGroups) => {
|
|
280
|
+
return prevGroups.filter(
|
|
281
|
+
(id) => String(productGroup.id) !== id
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
);
|
|
288
|
+
})}
|
|
289
|
+
<Form.Control
|
|
290
|
+
{...register("productGroupIds")}
|
|
291
|
+
hidden
|
|
292
|
+
value={selectedProductGroups}
|
|
293
|
+
disabled={isLoading}
|
|
294
|
+
/>
|
|
295
|
+
</Form.Group>
|
|
296
|
+
</Col>
|
|
297
|
+
</Row>
|
|
298
|
+
)}
|
|
276
299
|
|
|
277
300
|
{/* TODO: Show Recurrent date, when reccurent date bugs are fixed */}
|
|
278
301
|
{/* {startFromValue && (
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import {
|
|
3
|
-
ProductGroup,
|
|
4
|
-
ProductGroupDTO,
|
|
5
|
-
} from "@licklist/core/dist/DataMapper/Product/ProductGroupDataMapper";
|
|
2
|
+
import { ProductGroup } from "@licklist/core/dist/DataMapper/Product/ProductGroupDataMapper";
|
|
6
3
|
import {
|
|
7
4
|
CouponTotalType,
|
|
8
5
|
CouponType,
|
|
@@ -19,7 +16,7 @@ export interface CouponFormValues {
|
|
|
19
16
|
name?: string;
|
|
20
17
|
code: string;
|
|
21
18
|
discountType: CouponType;
|
|
22
|
-
productGroupIds:
|
|
19
|
+
productGroupIds: string[];
|
|
23
20
|
discount: number;
|
|
24
21
|
totalType: CouponTotalType;
|
|
25
22
|
startFrom: string;
|
|
@@ -57,6 +54,19 @@ export const CouponForm = ({
|
|
|
57
54
|
const { setError } = form;
|
|
58
55
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
59
56
|
|
|
57
|
+
// @TODO: dont need for v1 release
|
|
58
|
+
// const [selectedProductGroups, setSelectedProductGroups] = useState<string[]>(
|
|
59
|
+
// []
|
|
60
|
+
// );
|
|
61
|
+
// Set pre-selected Product Groups
|
|
62
|
+
// useEffect(() => {
|
|
63
|
+
// setSelectedProductGroups(getValues("productGroupIds"));
|
|
64
|
+
// }, [getValues]);
|
|
65
|
+
|
|
66
|
+
// useEffect(() => {
|
|
67
|
+
// setValue("productGroupIds", selectedProductGroups);
|
|
68
|
+
// }, [getValues, setValue, selectedProductGroups]);
|
|
69
|
+
|
|
60
70
|
useEffect(() => {
|
|
61
71
|
FormErrorService.handleServerErrors(serverErrors, setError);
|
|
62
72
|
}, [serverErrors, setError]);
|
|
@@ -11,7 +11,7 @@ import Row from "react-bootstrap/Row";
|
|
|
11
11
|
import Col from "react-bootstrap/Col";
|
|
12
12
|
import { Link } from "react-router-dom";
|
|
13
13
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
14
|
-
import {
|
|
14
|
+
import { ProviderType } from "@licklist/core/dist/DataMapper/Provider/ProvidableDataMapper";
|
|
15
15
|
import Icon from "../../static/Icon";
|
|
16
16
|
import { PaymentFeeForm, PaymentFeeFormFieldValues } from "./PaymentFeeForm";
|
|
17
17
|
import { Currency } from "../../types/currency";
|
|
@@ -33,7 +33,7 @@ export interface AdminSettingFormProps extends HasPermissionProp {
|
|
|
33
33
|
providerMetadata: {
|
|
34
34
|
country?: string;
|
|
35
35
|
providableId?: number;
|
|
36
|
-
providerType?:
|
|
36
|
+
providerType?: ProviderType;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -31,7 +31,6 @@ export type DashboardSettingFormFieldValues = {
|
|
|
31
31
|
isEnquiryOnly: boolean;
|
|
32
32
|
hasUserVerification: boolean;
|
|
33
33
|
metaPixelId?: number;
|
|
34
|
-
eventDeadlineErrorMessage?: string;
|
|
35
34
|
} & EventSettingFormFieldValues &
|
|
36
35
|
ProviderSettingFormFieldValues;
|
|
37
36
|
|
|
@@ -82,7 +81,6 @@ export const DashboardSettingForm = ({
|
|
|
82
81
|
const orderReportFormatId = useId();
|
|
83
82
|
const userVerificationId = useId();
|
|
84
83
|
const metaPixelId = useId();
|
|
85
|
-
const eventDeadlineErrorMessageId = useId();
|
|
86
84
|
|
|
87
85
|
const orderReportFormatList: SelectItem[] = [
|
|
88
86
|
{ id: 1, value: t("groupItemsByOrder") },
|
|
@@ -236,17 +234,6 @@ export const DashboardSettingForm = ({
|
|
|
236
234
|
<EventSettingForm isLoading={isLoading} />
|
|
237
235
|
|
|
238
236
|
<ProviderSettingForm isLoading={isLoading} />
|
|
239
|
-
<Form.Group controlId={eventDeadlineErrorMessageId}>
|
|
240
|
-
<Form.Label>{t("eventDeadlineErrorMessage")}</Form.Label>
|
|
241
|
-
<Form.Control
|
|
242
|
-
{...register("eventDeadlineErrorMessage")}
|
|
243
|
-
isInvalid={Boolean(errors.eventDeadlineErrorMessage)}
|
|
244
|
-
disabled={isLoading}
|
|
245
|
-
/>
|
|
246
|
-
<Form.Control.Feedback type="invalid">
|
|
247
|
-
{errors.eventDeadlineErrorMessage?.message}
|
|
248
|
-
</Form.Control.Feedback>
|
|
249
|
-
</Form.Group>
|
|
250
237
|
</FormProvider>
|
|
251
238
|
{hasPermission && (
|
|
252
239
|
<Button
|
|
@@ -53,6 +53,7 @@ export interface SortableTreeItemProps {
|
|
|
53
53
|
};
|
|
54
54
|
setIsExpanded?: () => void;
|
|
55
55
|
isOverride?: boolean;
|
|
56
|
+
isProduct?: boolean;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export function SortableTreeItem({
|
|
@@ -80,6 +81,7 @@ export function SortableTreeItem({
|
|
|
80
81
|
secondaryBadge,
|
|
81
82
|
setIsExpanded,
|
|
82
83
|
isOverride,
|
|
84
|
+
isProduct = false,
|
|
83
85
|
}: SortableTreeItemProps) {
|
|
84
86
|
const [expanded, setExpanded] = useState(isExpanded);
|
|
85
87
|
const [isModalVisible, setIsModalVisible] = useState(isNewAdded);
|
|
@@ -150,6 +152,7 @@ export function SortableTreeItem({
|
|
|
150
152
|
};
|
|
151
153
|
|
|
152
154
|
const onEdit = (e) => {
|
|
155
|
+
if (isOverride && !isProduct) return;
|
|
153
156
|
e.stopPropagation();
|
|
154
157
|
if (edit && !isModalVisible) edit();
|
|
155
158
|
setIsModalVisible(true);
|
|
@@ -371,7 +374,7 @@ export function SortableTreeItem({
|
|
|
371
374
|
items={sortableItems}
|
|
372
375
|
strategy={verticalListSortingStrategy}
|
|
373
376
|
>
|
|
374
|
-
<Collapse
|
|
377
|
+
<Collapse in={expanded}>
|
|
375
378
|
<div className="ml-0">{children}</div>
|
|
376
379
|
</Collapse>
|
|
377
380
|
</SortableContext>
|
|
@@ -23,7 +23,7 @@ export function BooleanSwitch({
|
|
|
23
23
|
const { t } = useTranslation("Design");
|
|
24
24
|
|
|
25
25
|
const options: SelectItem[] = [
|
|
26
|
-
{ id: 1, value: firstValueTitle ??
|
|
26
|
+
{ id: 1, value: firstValueTitle ?? t("yes") },
|
|
27
27
|
{ id: 0, value: secondValueTitle ?? t("no") },
|
|
28
28
|
];
|
|
29
29
|
|