@licklist/design 0.63.1-dev.6 → 0.63.1
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/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.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.d.ts.map +1 -1
- 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 -1
- package/dist/product-set/control/DateInput.js +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts +2 -3
- 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 -3
- 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 +2 -6
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +1 -3
- 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 -3
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +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/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/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 -6
- 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/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/iframe-page/PageBody.scss +1 -0
- 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/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 +37 -12
- 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/SelectEventProductSet/SelectEventProductSet.tsx +9 -14
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +0 -2
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -1
- package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -3
- package/src/product-set/control/DateInput.tsx +2 -2
- package/src/product-set/control/ProductSetControl.tsx +4 -11
- package/src/product-set/form/ProductCategoriesControl.tsx +4 -15
- package/src/product-set/form/ProductSetForm.tsx +2 -13
- package/src/product-set/form/ProductsControl.tsx +77 -93
- package/src/product-set/form/StepsControl.tsx +7 -15
- package/src/product-set/product/ProductControl.tsx +39 -39
- 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/RecurringDatePickerInput.stories.tsx +7 -13
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -12
- package/src/recurring-date-picker-input/utils.ts +1 -82
- package/src/sales/booking/results/components/ResultCard.tsx +3 -0
- 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 +3 -0
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/iframe-page/PageBody.scss +1 -0
- 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/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/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/sales/coupon/utils/index.ts +0 -13
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 { useTranslation } from "react-i18next";
|
|
1
|
+
import { DateTime } from "luxon";
|
|
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,79 +109,3 @@ export const parseAndValidateRRule = ({
|
|
|
114
109
|
until: options.until,
|
|
115
110
|
} as ParsedRRuleOptions;
|
|
116
111
|
};
|
|
117
|
-
|
|
118
|
-
export const useWorkHoursValidation = (
|
|
119
|
-
byWeekDay: Weekday[] = [],
|
|
120
|
-
workHours: WorkHour[] | undefined
|
|
121
|
-
) => {
|
|
122
|
-
const { t } = useTranslation("Validation");
|
|
123
|
-
if (!workHours) return {};
|
|
124
|
-
|
|
125
|
-
const fromTimeFormat = fromFormat(TIME_FORMAT);
|
|
126
|
-
|
|
127
|
-
// map every day to array of intervals describing workhours for that day
|
|
128
|
-
let intervalsByDay = workHours.map((workhour, index, self) => {
|
|
129
|
-
const res: Interval[] = [];
|
|
130
|
-
|
|
131
|
-
const startTime = fromTimeFormat(workhour.start);
|
|
132
|
-
const endTime = fromTimeFormat(workhour.end);
|
|
133
|
-
|
|
134
|
-
if (endTime > startTime) {
|
|
135
|
-
res.push(Interval.fromDateTimes(startTime, endTime));
|
|
136
|
-
} else {
|
|
137
|
-
// if end is before start, then it means that end is on the next day
|
|
138
|
-
// so count only to the end of current day
|
|
139
|
-
res.push(Interval.fromDateTimes(startTime, startTime.endOf("day")));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const prevIndex = index === 0 ? self.length - 1 : index - 1;
|
|
143
|
-
|
|
144
|
-
const prevStartTime = fromTimeFormat(self[prevIndex].start);
|
|
145
|
-
const prevEndTime = fromTimeFormat(self[prevIndex].end);
|
|
146
|
-
|
|
147
|
-
// if prevStartTime > prevEndTime then it means that prevEndTime is on the current day
|
|
148
|
-
// so we need to add interval from start of current day to prevEndTime
|
|
149
|
-
if (prevStartTime > prevEndTime) {
|
|
150
|
-
res.push(Interval.fromDateTimes(prevEndTime.startOf("day"), prevEndTime));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return res;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// if length === 0 or length === 7 then all workhours are selected, no need to filter
|
|
157
|
-
if (![0, 7].includes(byWeekDay.length)) {
|
|
158
|
-
intervalsByDay = intervalsByDay.filter((_, index) =>
|
|
159
|
-
byWeekDay.find(({ weekday }) => weekday === index)
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
validate: (_time: string) => {
|
|
165
|
-
const time = fromTimeFormat(_time);
|
|
166
|
-
|
|
167
|
-
const notFittingIntervalsByDay = intervalsByDay.reduce<Interval[][]>(
|
|
168
|
-
(acc, intervalsByDay) => {
|
|
169
|
-
if (!intervalsByDay.some((interval) => interval.contains(time))) {
|
|
170
|
-
acc.push(intervalsByDay);
|
|
171
|
-
}
|
|
172
|
-
return acc;
|
|
173
|
-
},
|
|
174
|
-
[]
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const notFittingIntervals = notFittingIntervalsByDay
|
|
178
|
-
.flat()
|
|
179
|
-
.filter((interval) => !interval.contains(time));
|
|
180
|
-
|
|
181
|
-
if (notFittingIntervalsByDay.length !== 0) {
|
|
182
|
-
return t("outsideWorkingHours", {
|
|
183
|
-
attribute: notFittingIntervals
|
|
184
|
-
.map((interval) => interval.toFormat("HH:mm"))
|
|
185
|
-
.join(", "),
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return true;
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
};
|
|
@@ -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,
|
|
@@ -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);
|
|
@@ -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
|
|
|
@@ -16,7 +16,6 @@ export interface TypeaheadProps {
|
|
|
16
16
|
isMultipleChoise?: boolean;
|
|
17
17
|
noOptionsMessage: string;
|
|
18
18
|
isInvalid?: boolean;
|
|
19
|
-
isCouponForm?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
function Typeahead({
|
|
@@ -25,25 +24,13 @@ function Typeahead({
|
|
|
25
24
|
isRequired = false,
|
|
26
25
|
isMultipleChoise,
|
|
27
26
|
name = "",
|
|
28
|
-
isCouponForm = false,
|
|
29
27
|
noOptionsMessage = "",
|
|
30
28
|
isInvalid,
|
|
31
29
|
}: TypeaheadProps) {
|
|
32
30
|
const { control } = useFormContext();
|
|
33
31
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
? {
|
|
37
|
-
borderRadius: "1rem",
|
|
38
|
-
minHeight: "3rem",
|
|
39
|
-
}
|
|
40
|
-
: {};
|
|
41
|
-
return isInvalid
|
|
42
|
-
? { borderColor: "red", ...couponFormStyle }
|
|
43
|
-
: {
|
|
44
|
-
...couponFormStyle,
|
|
45
|
-
};
|
|
46
|
-
};
|
|
32
|
+
const getErrorStyle = (): CSSObjectWithLabel =>
|
|
33
|
+
isInvalid ? { borderColor: "red" } : {};
|
|
47
34
|
|
|
48
35
|
return (
|
|
49
36
|
<>
|
|
@@ -59,7 +46,7 @@ function Typeahead({
|
|
|
59
46
|
styles={{
|
|
60
47
|
control: (base) => ({
|
|
61
48
|
...base,
|
|
62
|
-
...
|
|
49
|
+
...getErrorStyle(),
|
|
63
50
|
}),
|
|
64
51
|
}}
|
|
65
52
|
onChange={(value) => {
|
|
@@ -13,7 +13,7 @@ export type ZoneFormProps = {
|
|
|
13
13
|
onSubmit: (values: Partial<Zone>) => void;
|
|
14
14
|
serverErrors?: ServerError;
|
|
15
15
|
isLoading?: boolean;
|
|
16
|
-
workHours
|
|
16
|
+
workHours?: WorkHour[];
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export type ZoneFormValues = Partial<Zone> & {
|
|
@@ -25,7 +25,6 @@ export const ZoneForm = ({
|
|
|
25
25
|
onSubmit,
|
|
26
26
|
serverErrors,
|
|
27
27
|
isLoading = false,
|
|
28
|
-
workHours,
|
|
29
28
|
}: ZoneFormProps) => {
|
|
30
29
|
const { t } = useTranslation("Design");
|
|
31
30
|
const form = useForm<ZoneFormValues>({
|
|
@@ -55,7 +54,7 @@ export const ZoneForm = ({
|
|
|
55
54
|
return (
|
|
56
55
|
<FormProvider {...form}>
|
|
57
56
|
<Form onSubmit={handleSubmit(onFormSubmit)}>
|
|
58
|
-
<ZoneControl isLoading={isLoading}
|
|
57
|
+
<ZoneControl isLoading={isLoading} />
|
|
59
58
|
<Row>
|
|
60
59
|
<Col md={6} sm={12} />
|
|
61
60
|
<Col
|
|
@@ -11,15 +11,15 @@ import { GameDurationControl } from "./GameDurationControl";
|
|
|
11
11
|
|
|
12
12
|
export type ZoneControlProps = {
|
|
13
13
|
isLoading: boolean;
|
|
14
|
-
workHours
|
|
14
|
+
workHours?: WorkHour[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const ZoneControl = ({ isLoading
|
|
17
|
+
export const ZoneControl = ({ isLoading }: ZoneControlProps) => {
|
|
18
18
|
return (
|
|
19
19
|
<Row>
|
|
20
20
|
<Col md={6} sm={12} className="pr-5">
|
|
21
21
|
<NameControl isLoading={isLoading} />
|
|
22
|
-
<ZoneRecurrencesControl
|
|
22
|
+
<ZoneRecurrencesControl />
|
|
23
23
|
<hr />
|
|
24
24
|
<Row>
|
|
25
25
|
<Col md={6} sm={6}>
|
|
@@ -25,13 +25,12 @@ export interface DateAndRecurrenceInputValues {
|
|
|
25
25
|
zoneRecurrences?: Partial<ZoneRecurrence>[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
type ZoneRecurrenceControlProps = {
|
|
29
|
-
workHours
|
|
28
|
+
export type ZoneRecurrenceControlProps = {
|
|
29
|
+
workHours?: WorkHour[];
|
|
30
|
+
isLoading?: boolean;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export const ZoneRecurrencesControl = ({
|
|
33
|
-
workHours,
|
|
34
|
-
}: ZoneRecurrenceControlProps) => {
|
|
33
|
+
export const ZoneRecurrencesControl = () => {
|
|
35
34
|
const {
|
|
36
35
|
control,
|
|
37
36
|
register,
|
|
@@ -70,7 +69,7 @@ export const ZoneRecurrencesControl = ({
|
|
|
70
69
|
clearEditState();
|
|
71
70
|
});
|
|
72
71
|
|
|
73
|
-
const popoverId = useId()
|
|
72
|
+
const popoverId = useId()!;
|
|
74
73
|
|
|
75
74
|
const { t } = useTranslation(["Design", "Validation"]);
|
|
76
75
|
|
|
@@ -167,7 +166,6 @@ export const ZoneRecurrencesControl = ({
|
|
|
167
166
|
onChange={handleRecurringDateChange}
|
|
168
167
|
onDelete={handleDelete}
|
|
169
168
|
setInitialStartDateAfterSelect
|
|
170
|
-
workHours={workHours}
|
|
171
169
|
/>
|
|
172
170
|
</Popover.Content>
|
|
173
171
|
</Popover>
|
|
@@ -53,17 +53,18 @@ export const getCheckboxesByWorkHours = (workHours?: WorkHour[]) => {
|
|
|
53
53
|
if (!workHours || !workHours.length)
|
|
54
54
|
return getTimeCheckboxRanges(DEFAULT_START_DAY_TIME, DEFAULT_END_DAY_TIME);
|
|
55
55
|
|
|
56
|
-
const providerWorkHoursByWeek = workHours.reduce
|
|
57
|
-
{ start: string; end: string }[]
|
|
58
|
-
|
|
59
|
-
const { start, end } = currentWorkHour;
|
|
56
|
+
const providerWorkHoursByWeek = workHours.reduce(
|
|
57
|
+
(workHoursNextArray: { start: string; end: string }[], currentWorkHour) => {
|
|
58
|
+
const { start, end } = currentWorkHour;
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
if (start && end) {
|
|
61
|
+
return [...workHoursNextArray, { start, end }];
|
|
62
|
+
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
return workHoursNextArray;
|
|
65
|
+
},
|
|
66
|
+
[]
|
|
67
|
+
);
|
|
67
68
|
|
|
68
69
|
// If venue has filled only 1 work day from wee
|
|
69
70
|
// For another days we use default 00:00 and 23:59
|