@licklist/design 0.66.12 → 0.66.13
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/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -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 +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/layout/DropDown.js +1 -1
- 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.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductZonesControl.d.ts +10 -0
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductZonesControl.js +1 -0
- 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/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts +5 -8
- 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/advanced-options/AdvancedOptions.d.ts +9 -0
- package/dist/product-set/product/advanced-options/AdvancedOptions.d.ts.map +1 -0
- package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -0
- package/dist/product-set/product/advanced-options/index.d.ts +2 -0
- package/dist/product-set/product/advanced-options/index.d.ts.map +1 -0
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -2
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/product-set/product-zone/ProductZoneControl.d.ts +16 -0
- package/dist/product-set/product-zone/ProductZoneControl.d.ts.map +1 -0
- package/dist/product-set/product-zone/ProductZoneControl.js +1 -0
- package/dist/product-set/product-zone/index.d.ts +2 -0
- package/dist/product-set/product-zone/index.d.ts.map +1 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +1 -1
- package/dist/styles/product-set/CreateProductSetItem.scss +8 -0
- package/dist/styles/product-set/EditZoneSettingModal.scss +16 -0
- package/dist/styles/product-set/ProductSetForm.scss +14 -1
- package/dist/styles/product-set/_index.scss +2 -1
- package/package.json +4 -4
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +2 -4
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +0 -1
- package/src/layout/DropDown.tsx +1 -1
- package/src/product-set/control/ProductSetControl.tsx +11 -6
- package/src/product-set/form/ProductCategoriesControl.tsx +0 -3
- package/src/product-set/form/ProductZonesControl.tsx +181 -0
- package/src/product-set/form/ProductsControl.tsx +8 -24
- package/src/product-set/form/SubProductsControl.tsx +3 -0
- package/src/product-set/form/VenueMapsControl.tsx +3 -0
- package/src/product-set/product/ProductControl.tsx +23 -268
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +168 -0
- package/src/product-set/product/advanced-options/index.ts +1 -0
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +1 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +1 -60
- package/src/product-set/product-zone/ProductZoneControl.tsx +247 -0
- package/src/product-set/product-zone/index.ts +1 -0
- package/src/product-set/utils/index.ts +9 -5
- package/src/snippet/snippet-template/preview/Preview.tsx +0 -6
- package/src/sortable-tree/SortableTreeItem.tsx +59 -45
- package/src/styles/product-set/CreateProductSetItem.scss +8 -0
- package/src/styles/product-set/EditZoneSettingModal.scss +16 -0
- package/src/styles/product-set/ProductSetForm.scss +14 -1
- package/src/styles/product-set/_index.scss +2 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useMemo } from "react";
|
|
2
|
+
import { Col, Form, Row } from "react-bootstrap";
|
|
3
|
+
import {
|
|
4
|
+
ArrayPath,
|
|
5
|
+
Controller,
|
|
6
|
+
Path,
|
|
7
|
+
PathValue,
|
|
8
|
+
UnpackNestedValue,
|
|
9
|
+
useFormContext,
|
|
10
|
+
useWatch,
|
|
11
|
+
} from "react-hook-form";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
|
+
import {
|
|
14
|
+
CategoryType,
|
|
15
|
+
CATEGORY_TYPE_FIXED_DURATION,
|
|
16
|
+
CATEGORY_TYPE_GAME,
|
|
17
|
+
} from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
|
|
18
|
+
import {
|
|
19
|
+
FieldNamePrefixPath,
|
|
20
|
+
FormValues,
|
|
21
|
+
} from "@licklist/plugins/dist/types/services/Form/hook-form-service";
|
|
22
|
+
import { HookFormService } from "@licklist/plugins";
|
|
23
|
+
import { ProductZone } from "@licklist/core/dist/DataMapper/Product/ProductZoneDataMapper";
|
|
24
|
+
import { ProductDurationControl } from "../product/duration/ProductDurationControl";
|
|
25
|
+
import { FormNumberInput } from "../../static/form-number-input";
|
|
26
|
+
import { FixedDurationOptions } from "../product/fixed-duration-fields";
|
|
27
|
+
import { ProductSetLoadingContext } from "../form/context";
|
|
28
|
+
|
|
29
|
+
export interface ProductZoneControlValues extends FormValues, ProductZone {
|
|
30
|
+
id: number | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ProductZoneProps<T> extends FieldNamePrefixPath<T> {
|
|
34
|
+
isOverrides: boolean;
|
|
35
|
+
categoryType?: CategoryType;
|
|
36
|
+
productZonesFieldName: ArrayPath<T>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ProductZoneControl = <T extends FormValues>({
|
|
40
|
+
isOverrides,
|
|
41
|
+
categoryType,
|
|
42
|
+
fieldNamePrefix,
|
|
43
|
+
productZonesFieldName,
|
|
44
|
+
}: ProductZoneProps<T>) => {
|
|
45
|
+
const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
|
|
46
|
+
const {
|
|
47
|
+
trigger,
|
|
48
|
+
control,
|
|
49
|
+
setValue,
|
|
50
|
+
clearErrors,
|
|
51
|
+
formState: { errors },
|
|
52
|
+
} = useFormContext();
|
|
53
|
+
|
|
54
|
+
const productZones = useWatch({
|
|
55
|
+
control,
|
|
56
|
+
name: productZonesFieldName,
|
|
57
|
+
}) as ProductZoneControlValues[];
|
|
58
|
+
|
|
59
|
+
const { capacity, zoneId } = useWatch({
|
|
60
|
+
control,
|
|
61
|
+
name: `${fieldNamePrefix}`,
|
|
62
|
+
});
|
|
63
|
+
const disabledDuration = capacity === "0" || !capacity;
|
|
64
|
+
|
|
65
|
+
const { providerHasBookingManagement, zones = [] } = useContext(
|
|
66
|
+
ProductSetLoadingContext
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const currentZoneData = zones.find((zone) => zone.id === Number(zoneId));
|
|
70
|
+
|
|
71
|
+
const availableZones = useMemo(
|
|
72
|
+
() =>
|
|
73
|
+
zones.filter(
|
|
74
|
+
(zone) =>
|
|
75
|
+
!productZones.find(
|
|
76
|
+
(productZone) =>
|
|
77
|
+
Number(productZone.zoneId) === zone.id &&
|
|
78
|
+
productZone.zoneId !== zoneId
|
|
79
|
+
)
|
|
80
|
+
),
|
|
81
|
+
[zones, productZones, zoneId]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!disabledDuration) {
|
|
86
|
+
trigger(`${fieldNamePrefix}.duration` as Path<T>);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setValue(
|
|
90
|
+
`${fieldNamePrefix}.duration` as Path<T>,
|
|
91
|
+
/* @ts-expect-error 6385 */
|
|
92
|
+
0 as UnpackNestedValue<PathValue<T, Path<T>>>
|
|
93
|
+
);
|
|
94
|
+
clearErrors(`${fieldNamePrefix}.duration` as Path<T>);
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, [disabledDuration]);
|
|
97
|
+
|
|
98
|
+
const onChangeGameCapacity = (value: number) => {
|
|
99
|
+
if (!currentZoneData?.defaultDuration) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setValue(
|
|
103
|
+
`${fieldNamePrefix}.duration` as Path<T>,
|
|
104
|
+
/* @ts-expect-error 6385 */
|
|
105
|
+
(value * currentZoneData?.defaultDuration) as UnpackNestedValue<
|
|
106
|
+
PathValue<T, Path<T>>
|
|
107
|
+
>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<>
|
|
113
|
+
<Row>
|
|
114
|
+
<Col>
|
|
115
|
+
<Form.Group>
|
|
116
|
+
<Form.Label>{t("Design:zone")}</Form.Label>
|
|
117
|
+
<Controller
|
|
118
|
+
control={control}
|
|
119
|
+
name={`${fieldNamePrefix}.zoneId`}
|
|
120
|
+
render={({ field }) => (
|
|
121
|
+
<Form.Control
|
|
122
|
+
as="select"
|
|
123
|
+
disabled={isOverrides}
|
|
124
|
+
isInvalid={HookFormService.isInvalid(
|
|
125
|
+
`${fieldNamePrefix}.zoneId`,
|
|
126
|
+
errors
|
|
127
|
+
)}
|
|
128
|
+
{...field}
|
|
129
|
+
>
|
|
130
|
+
<option value={null}>{t("Design:choose")}</option>
|
|
131
|
+
{availableZones.map((zone) => (
|
|
132
|
+
<option key={zone.id} value={zone.id}>
|
|
133
|
+
{zone.name}
|
|
134
|
+
</option>
|
|
135
|
+
))}
|
|
136
|
+
</Form.Control>
|
|
137
|
+
)}
|
|
138
|
+
rules={{
|
|
139
|
+
required: {
|
|
140
|
+
value: providerHasBookingManagement,
|
|
141
|
+
message: t("Validation:fieldRequired", {
|
|
142
|
+
attribute: t("zone"),
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
<Form.Control.Feedback type="invalid">
|
|
148
|
+
{HookFormService.getErrors(
|
|
149
|
+
`${fieldNamePrefix}.zoneId` as Path<T>,
|
|
150
|
+
errors
|
|
151
|
+
)}
|
|
152
|
+
</Form.Control.Feedback>
|
|
153
|
+
</Form.Group>
|
|
154
|
+
</Col>
|
|
155
|
+
</Row>
|
|
156
|
+
</>
|
|
157
|
+
{categoryType === CATEGORY_TYPE_FIXED_DURATION && (
|
|
158
|
+
<Row className="align-items-start duration-capacity-container">
|
|
159
|
+
<ProductDurationControl
|
|
160
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
161
|
+
disabled={disabledDuration || isOverrides}
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<Col lg={4} md={4}>
|
|
165
|
+
<FormNumberInput
|
|
166
|
+
fieldName={`${fieldNamePrefix}.capacity`}
|
|
167
|
+
label={t("capacity")}
|
|
168
|
+
disabled={isOverrides}
|
|
169
|
+
rules={{
|
|
170
|
+
min: {
|
|
171
|
+
value: 0,
|
|
172
|
+
message: t("Validation:fieldMinNumber", {
|
|
173
|
+
attribute: t("capacity"),
|
|
174
|
+
min: 0,
|
|
175
|
+
}) as string,
|
|
176
|
+
},
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
</Col>
|
|
180
|
+
{disabledDuration && (
|
|
181
|
+
<div className="duration-hint duration-capacity-container">
|
|
182
|
+
{t("Design:forDurationEditing")}
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</Row>
|
|
186
|
+
)}
|
|
187
|
+
|
|
188
|
+
{categoryType === CATEGORY_TYPE_GAME && (
|
|
189
|
+
<>
|
|
190
|
+
<Row className="align-items-start duration-capacity-container">
|
|
191
|
+
<Col lg={4} md={4}>
|
|
192
|
+
<FormNumberInput
|
|
193
|
+
fieldName={`${fieldNamePrefix}.capacity`}
|
|
194
|
+
label={t("capacity")}
|
|
195
|
+
onChange={onChangeGameCapacity}
|
|
196
|
+
disabled={isOverrides}
|
|
197
|
+
rules={{
|
|
198
|
+
min: {
|
|
199
|
+
value: 0,
|
|
200
|
+
message: t("Validation:fieldMinNumber", {
|
|
201
|
+
attribute: t("capacity"),
|
|
202
|
+
min: 1,
|
|
203
|
+
}) as string,
|
|
204
|
+
},
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
</Col>
|
|
208
|
+
<Col lg={4} md={4}>
|
|
209
|
+
<FormNumberInput
|
|
210
|
+
fieldName={`${fieldNamePrefix}.duration`}
|
|
211
|
+
label={t("durationMinutes")}
|
|
212
|
+
disabled={disabledDuration || isOverrides}
|
|
213
|
+
rules={{
|
|
214
|
+
min: {
|
|
215
|
+
value: 0,
|
|
216
|
+
message: t("Validation:fieldMinNumber", {
|
|
217
|
+
attribute: t("duration"),
|
|
218
|
+
min: 0,
|
|
219
|
+
}) as string,
|
|
220
|
+
},
|
|
221
|
+
validate: (val) => {
|
|
222
|
+
if (!disabledDuration && (!val || val < 1)) {
|
|
223
|
+
return t("Validation:fieldRequired", {
|
|
224
|
+
attribute: t("duration"),
|
|
225
|
+
}) as string;
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
},
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
</Col>
|
|
232
|
+
</Row>
|
|
233
|
+
{disabledDuration && (
|
|
234
|
+
<div className="duration-hint pl-0">
|
|
235
|
+
{t("Design:forDurationEditing")}
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
238
|
+
</>
|
|
239
|
+
)}
|
|
240
|
+
|
|
241
|
+
<FixedDurationOptions
|
|
242
|
+
fieldNamePrefix={fieldNamePrefix}
|
|
243
|
+
isOverrides={isOverrides}
|
|
244
|
+
/>
|
|
245
|
+
</>
|
|
246
|
+
);
|
|
247
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ProductZoneControl";
|
|
@@ -2,6 +2,7 @@ import { EmailTemplate } from "@licklist/core/dist/DataMapper/Notification/Email
|
|
|
2
2
|
import { SmsTemplate } from "@licklist/core/dist/DataMapper/Notification/SmsTemplateDataMapper";
|
|
3
3
|
import { TFunction } from "i18next";
|
|
4
4
|
import { UseFormSetError } from "react-hook-form";
|
|
5
|
+
import { checkIfZoneCategory } from "@licklist/plugins";
|
|
5
6
|
import { TemplateItem } from "../control/ProductSetControl";
|
|
6
7
|
import { ProductSetFormValues } from "../form/ProductSetForm";
|
|
7
8
|
|
|
@@ -14,7 +15,7 @@ interface CheckAvailableTimesErrors {
|
|
|
14
15
|
export const moveArrayElements = <T>(
|
|
15
16
|
array: T[],
|
|
16
17
|
prevIndex: number,
|
|
17
|
-
nextIndex: number
|
|
18
|
+
nextIndex: number,
|
|
18
19
|
) => {
|
|
19
20
|
const nextArray = [...array];
|
|
20
21
|
// We move there elements in array
|
|
@@ -30,7 +31,7 @@ export const sortArrayByIndex = <T>(array: T[]) => {
|
|
|
30
31
|
|
|
31
32
|
export const getFilteredTemplates = (
|
|
32
33
|
templates?: EmailTemplate[] | SmsTemplate[],
|
|
33
|
-
formTemplates?: TemplateItem[]
|
|
34
|
+
formTemplates?: TemplateItem[],
|
|
34
35
|
): TemplateItem[] | undefined => {
|
|
35
36
|
if (!templates) {
|
|
36
37
|
return undefined;
|
|
@@ -42,8 +43,8 @@ export const getFilteredTemplates = (
|
|
|
42
43
|
template.notification.isActive &&
|
|
43
44
|
!formTemplates?.find(
|
|
44
45
|
(formTemplate) =>
|
|
45
|
-
formTemplate.value.notification.type === template.notification.type
|
|
46
|
-
)
|
|
46
|
+
formTemplate.value.notification.type === template.notification.type,
|
|
47
|
+
),
|
|
47
48
|
)
|
|
48
49
|
?.map((template) => ({
|
|
49
50
|
id: template?.id,
|
|
@@ -60,7 +61,10 @@ export const checkAvailableTimesErrors = ({
|
|
|
60
61
|
let hasError = false;
|
|
61
62
|
|
|
62
63
|
const hasCategoryWithZone = values?.steps?.some(
|
|
63
|
-
(step) =>
|
|
64
|
+
(step) =>
|
|
65
|
+
!!step?.productCategories.some((category) =>
|
|
66
|
+
checkIfZoneCategory(category.type),
|
|
67
|
+
),
|
|
64
68
|
);
|
|
65
69
|
if (!hasCategoryWithZone) {
|
|
66
70
|
return hasError;
|
|
@@ -303,7 +303,6 @@ export function Preview({
|
|
|
303
303
|
productCategoryId: 57,
|
|
304
304
|
productGroupId: null,
|
|
305
305
|
availableQuantity: 980,
|
|
306
|
-
zoneId: null,
|
|
307
306
|
name: "Cofee",
|
|
308
307
|
description: "",
|
|
309
308
|
price: 15,
|
|
@@ -312,8 +311,6 @@ export function Preview({
|
|
|
312
311
|
maxQuantity: 15,
|
|
313
312
|
totalQuantity: 980,
|
|
314
313
|
type: "sale" as const,
|
|
315
|
-
capacity: 0,
|
|
316
|
-
duration: 0,
|
|
317
314
|
weight: 0,
|
|
318
315
|
isAvailable: true,
|
|
319
316
|
isSoldOut: false,
|
|
@@ -332,7 +329,6 @@ export function Preview({
|
|
|
332
329
|
productCategoryId: 57,
|
|
333
330
|
productGroupId: null,
|
|
334
331
|
availableQuantity: 980,
|
|
335
|
-
zoneId: null,
|
|
336
332
|
name: "Cofee 2",
|
|
337
333
|
description: "",
|
|
338
334
|
price: 15,
|
|
@@ -341,8 +337,6 @@ export function Preview({
|
|
|
341
337
|
maxQuantity: 15,
|
|
342
338
|
totalQuantity: 980,
|
|
343
339
|
type: "sale" as const,
|
|
344
|
-
capacity: 0,
|
|
345
|
-
duration: 0,
|
|
346
340
|
weight: 0,
|
|
347
341
|
isAvailable: true,
|
|
348
342
|
isSoldOut: false,
|
|
@@ -20,6 +20,7 @@ export const ProductSetModalClasses = {
|
|
|
20
20
|
step: "edit-product-step",
|
|
21
21
|
category: "edit-product-category",
|
|
22
22
|
product: "edit-product",
|
|
23
|
+
productZones: "edit-product-zone",
|
|
23
24
|
} as const;
|
|
24
25
|
|
|
25
26
|
export type ProductSetModalClassesType =
|
|
@@ -36,6 +37,7 @@ export interface SortableTreeItemProps {
|
|
|
36
37
|
postItem?: ReactNode;
|
|
37
38
|
sortableItems?: string[];
|
|
38
39
|
isExpanded?: boolean;
|
|
40
|
+
shouldExpand?: boolean;
|
|
39
41
|
isInvalid?: boolean;
|
|
40
42
|
isIconInHeader?: boolean;
|
|
41
43
|
treeLineIconColor?: string;
|
|
@@ -66,6 +68,7 @@ export function SortableTreeItem({
|
|
|
66
68
|
postItem,
|
|
67
69
|
sortableItems,
|
|
68
70
|
isExpanded = false,
|
|
71
|
+
shouldExpand = true,
|
|
69
72
|
isInvalid = false,
|
|
70
73
|
isIconInHeader = true,
|
|
71
74
|
treeLineIconColor = "",
|
|
@@ -100,11 +103,14 @@ export function SortableTreeItem({
|
|
|
100
103
|
transform: dragTransform,
|
|
101
104
|
} = useDraggable({
|
|
102
105
|
id,
|
|
103
|
-
disabled: isOverride,
|
|
106
|
+
disabled: isOverride || !shouldExpand,
|
|
104
107
|
});
|
|
105
108
|
|
|
106
109
|
const onHandleExpand = useCallback(
|
|
107
110
|
(event) => {
|
|
111
|
+
if (!shouldExpand) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
108
114
|
const deltaX = event.pageX - position.pageX;
|
|
109
115
|
const deltaY = event.pageY - position.pageY;
|
|
110
116
|
const euclidean = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
@@ -120,14 +126,20 @@ export function SortableTreeItem({
|
|
|
120
126
|
|
|
121
127
|
setExpanded((expanded) => !expanded);
|
|
122
128
|
},
|
|
123
|
-
[position, setIsExpanded]
|
|
129
|
+
[position, shouldExpand, setIsExpanded]
|
|
124
130
|
);
|
|
125
131
|
|
|
126
132
|
const isVisibleDeleteButton = Boolean(onDelete) && !isOverride;
|
|
127
133
|
|
|
128
|
-
const onButtonMouseDown = useCallback(
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
const onButtonMouseDown = useCallback(
|
|
135
|
+
(event) => {
|
|
136
|
+
if (!shouldExpand) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
setPosition({ pageX: event.pageX, pageY: event.pageY });
|
|
140
|
+
},
|
|
141
|
+
[shouldExpand]
|
|
142
|
+
);
|
|
131
143
|
|
|
132
144
|
const onHide = async () => {
|
|
133
145
|
if (!validate) setIsModalVisible(false);
|
|
@@ -197,47 +209,49 @@ export function SortableTreeItem({
|
|
|
197
209
|
: null
|
|
198
210
|
}
|
|
199
211
|
>
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{expanded ? (
|
|
208
|
-
<Icon type="minus" width=".7rem" />
|
|
209
|
-
) : (
|
|
210
|
-
<div className="expand-icon-container">
|
|
211
|
-
<div />
|
|
212
|
-
<div />
|
|
213
|
-
<div />
|
|
214
|
-
</div>
|
|
215
|
-
)}
|
|
216
|
-
</Button>
|
|
217
|
-
|
|
218
|
-
{expanded && (
|
|
219
|
-
<svg
|
|
220
|
-
className="sortable-tree-line-icon"
|
|
221
|
-
version="1.1"
|
|
222
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
223
|
-
width="100%"
|
|
224
|
-
height="100%"
|
|
225
|
-
viewBox="0 0 100 100"
|
|
226
|
-
preserveAspectRatio="none"
|
|
212
|
+
{shouldExpand && (
|
|
213
|
+
<div className="sortable-tree-line">
|
|
214
|
+
<Button
|
|
215
|
+
variant="link"
|
|
216
|
+
size="sm"
|
|
217
|
+
onMouseDown={onButtonMouseDown}
|
|
218
|
+
onMouseUp={onHandleExpand}
|
|
227
219
|
>
|
|
228
|
-
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
220
|
+
{expanded ? (
|
|
221
|
+
<Icon type="minus" width=".7rem" />
|
|
222
|
+
) : (
|
|
223
|
+
<div className="expand-icon-container">
|
|
224
|
+
<div />
|
|
225
|
+
<div />
|
|
226
|
+
<div />
|
|
227
|
+
</div>
|
|
228
|
+
)}
|
|
229
|
+
</Button>
|
|
230
|
+
|
|
231
|
+
{expanded && (
|
|
232
|
+
<svg
|
|
233
|
+
className="sortable-tree-line-icon"
|
|
234
|
+
version="1.1"
|
|
235
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
236
|
+
width="100%"
|
|
237
|
+
height="100%"
|
|
238
|
+
viewBox="0 0 100 100"
|
|
239
|
+
preserveAspectRatio="none"
|
|
240
|
+
>
|
|
241
|
+
<g>
|
|
242
|
+
<path
|
|
243
|
+
className={clsx(
|
|
244
|
+
"sortable-tree-line-icon-path",
|
|
245
|
+
treeLineIconColor && "sortable-tree-line-product-element"
|
|
246
|
+
)}
|
|
247
|
+
style={{ stroke: treeLineIconColor }}
|
|
248
|
+
d="M 50 0 V 100"
|
|
249
|
+
/>
|
|
250
|
+
</g>
|
|
251
|
+
</svg>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
241
255
|
|
|
242
256
|
<div className="sortable-tree-item-wrapper">
|
|
243
257
|
<div
|
|
@@ -17,6 +17,14 @@ $product-set-item-hover-bg-color: #d9efff !default;
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.product-set-item-wrapper-zone {
|
|
21
|
+
color:#84269B;
|
|
22
|
+
background-color: rgba($color: #84269B, $alpha: 0.1);
|
|
23
|
+
.product-set-item-icon {
|
|
24
|
+
background-color: #84269B;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
.product-set-item-wrapper-category {
|
|
21
29
|
color: #1A93AA;
|
|
22
30
|
background-color: rgba($color: #1A93AA, $alpha: 0.1);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.edit-right-form-modal.edit-product-zone {
|
|
2
|
+
padding: 0;
|
|
3
|
+
.top-label-container {
|
|
4
|
+
background-color: #EFE9F5;
|
|
5
|
+
span {
|
|
6
|
+
color:#84269B;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@include media-breakpoint-down(sm) {
|
|
10
|
+
top: 5%;
|
|
11
|
+
.step-save-btn {
|
|
12
|
+
margin-top: 1rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
.step-badge,
|
|
52
52
|
.category-badge,
|
|
53
|
-
.product-badge
|
|
53
|
+
.product-badge {
|
|
54
54
|
font-size: 0.875rem;
|
|
55
55
|
font-weight: 600;
|
|
56
56
|
}
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
background-color: #e9f5ea;
|
|
68
68
|
color: #269b36;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
.product-set-mobile-footer {
|
|
@@ -174,3 +176,14 @@
|
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
.sortable-tree-item-toggle {
|
|
182
|
+
|
|
183
|
+
.product-zone-badge {
|
|
184
|
+
background-color: #EFE9F5;
|
|
185
|
+
color:#84269B;
|
|
186
|
+
font-size: 0.875rem;
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
}
|
|
189
|
+
}
|