@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.
Files changed (71) hide show
  1. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  2. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
  3. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  4. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/layout/DropDown.d.ts.map +1 -1
  7. package/dist/layout/DropDown.js +1 -1
  8. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  9. package/dist/product-set/control/ProductSetControl.js +1 -1
  10. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  11. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  12. package/dist/product-set/form/ProductZonesControl.d.ts +10 -0
  13. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -0
  14. package/dist/product-set/form/ProductZonesControl.js +1 -0
  15. package/dist/product-set/form/ProductsControl.d.ts +1 -3
  16. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  17. package/dist/product-set/form/ProductsControl.js +1 -1
  18. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  19. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  20. package/dist/product-set/product/ProductControl.d.ts +5 -8
  21. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  22. package/dist/product-set/product/ProductControl.js +1 -1
  23. package/dist/product-set/product/advanced-options/AdvancedOptions.d.ts +9 -0
  24. package/dist/product-set/product/advanced-options/AdvancedOptions.d.ts.map +1 -0
  25. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -0
  26. package/dist/product-set/product/advanced-options/index.d.ts +2 -0
  27. package/dist/product-set/product/advanced-options/index.d.ts.map +1 -0
  28. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
  29. package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -2
  30. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  31. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  32. package/dist/product-set/product-zone/ProductZoneControl.d.ts +16 -0
  33. package/dist/product-set/product-zone/ProductZoneControl.d.ts.map +1 -0
  34. package/dist/product-set/product-zone/ProductZoneControl.js +1 -0
  35. package/dist/product-set/product-zone/index.d.ts +2 -0
  36. package/dist/product-set/product-zone/index.d.ts.map +1 -0
  37. package/dist/product-set/utils/index.d.ts.map +1 -1
  38. package/dist/product-set/utils/index.js +1 -1
  39. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  40. package/dist/snippet/snippet-template/preview/Preview.js +1 -1
  41. package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
  42. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  43. package/dist/sortable-tree/SortableTreeItem.js +1 -1
  44. package/dist/styles/product-set/CreateProductSetItem.scss +8 -0
  45. package/dist/styles/product-set/EditZoneSettingModal.scss +16 -0
  46. package/dist/styles/product-set/ProductSetForm.scss +14 -1
  47. package/dist/styles/product-set/_index.scss +2 -1
  48. package/package.json +4 -4
  49. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +2 -4
  50. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +0 -1
  51. package/src/layout/DropDown.tsx +1 -1
  52. package/src/product-set/control/ProductSetControl.tsx +11 -6
  53. package/src/product-set/form/ProductCategoriesControl.tsx +0 -3
  54. package/src/product-set/form/ProductZonesControl.tsx +181 -0
  55. package/src/product-set/form/ProductsControl.tsx +8 -24
  56. package/src/product-set/form/SubProductsControl.tsx +3 -0
  57. package/src/product-set/form/VenueMapsControl.tsx +3 -0
  58. package/src/product-set/product/ProductControl.tsx +23 -268
  59. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +168 -0
  60. package/src/product-set/product/advanced-options/index.ts +1 -0
  61. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +1 -1
  62. package/src/product-set/product-category/ProductCategoryControl.tsx +1 -60
  63. package/src/product-set/product-zone/ProductZoneControl.tsx +247 -0
  64. package/src/product-set/product-zone/index.ts +1 -0
  65. package/src/product-set/utils/index.ts +9 -5
  66. package/src/snippet/snippet-template/preview/Preview.tsx +0 -6
  67. package/src/sortable-tree/SortableTreeItem.tsx +59 -45
  68. package/src/styles/product-set/CreateProductSetItem.scss +8 -0
  69. package/src/styles/product-set/EditZoneSettingModal.scss +16 -0
  70. package/src/styles/product-set/ProductSetForm.scss +14 -1
  71. package/src/styles/product-set/_index.scss +2 -1
@@ -1,16 +1,11 @@
1
1
  import {
2
2
  CategoryType,
3
3
  QuantityType,
4
- CATEGORY_TYPE_FIXED_DURATION,
5
- CATEGORY_TYPE_GAME,
6
4
  QUANTITY_TYPE_CONSTANT,
7
5
  QUANTITY_TYPE_LIST_DTO,
8
6
  QUANTITY_TYPE_RECHARGING,
9
7
  } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
10
- import {
11
- ProductType,
12
- PRODUCT_DEfAULT_COLORS,
13
- } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
8
+ import { ProductType } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
14
9
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
15
10
  import {
16
11
  FieldNamePrefixPath,
@@ -44,16 +39,14 @@ import {
44
39
  Image,
45
40
  IMAGE_TYPE_IMAGE,
46
41
  } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
47
-
42
+ import { checkIfZoneCategory } from "@licklist/plugins";
48
43
  import { FileUpload } from "../../file-upload";
49
- import { BooleanSwitch, FormNumberInput } from "../../static";
50
- import Icon from "../../static/Icon";
44
+ import { BooleanSwitch, Icon } from "../../static";
51
45
  import { SelectItem } from "../../types/generic/SelectItem";
52
46
  import { ProductSetLoadingContext } from "../form/context";
53
47
  import {
54
48
  ProductBookingManagementControl,
55
49
  ProductBookingManagementControlProps,
56
- ProductBookingManagementControlValues,
57
50
  } from "./booking-management/ProductBookingManagementControl";
58
51
  import {
59
52
  ProductDepositControl,
@@ -64,20 +57,19 @@ import {
64
57
  ProductQuantityControl,
65
58
  ProductQuantityRechargingControl,
66
59
  } from "./quantity";
67
- import { PropertyControl } from "../../snippet";
68
60
  import { TipTapEditor } from "../../tiptap-editor";
69
61
  import { IsDeletableEvent } from "../types";
70
- import { FixedDurationOptions } from "./fixed-duration-fields";
71
- import { ProductDurationControl } from "./duration";
72
62
  import { ProductPriceControl } from "./price";
73
63
  import { MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH } from "./constants";
64
+ import { ProductZoneControlValues } from "../product-zone";
65
+ import { AdvancedOptions } from "./advanced-options";
66
+ import { ProductZonesControl } from "../form/ProductZonesControl";
74
67
 
75
68
  // TO DO refactor this file
76
69
  // and add correct types
77
70
  export interface ProductControlValues
78
71
  extends FormValues,
79
- ProductDepositControlValues,
80
- ProductBookingManagementControlValues {
72
+ ProductDepositControlValues {
81
73
  name: string;
82
74
  productGroupId: number;
83
75
  description: string;
@@ -100,12 +92,9 @@ export interface ProductControlValues
100
92
  tierId?: number;
101
93
  images: Image[] | null;
102
94
  uuid: string;
103
- subSlots: number;
104
- pause: number;
105
- offset: number;
106
- serviceTime: number;
107
95
  sort: number | null;
108
96
  color?: string;
97
+ productZones?: ProductZoneControlValues[];
109
98
  }
110
99
 
111
100
  export interface ProductControlProps<T>
@@ -122,7 +111,6 @@ export interface ProductControlProps<T>
122
111
  hasTicket?: boolean;
123
112
  categoryType?: CategoryType;
124
113
  isOverrides?: boolean;
125
- zoneDuration?: number;
126
114
  }
127
115
 
128
116
  export function ProductControl<T extends FormValues>({
@@ -136,7 +124,6 @@ export function ProductControl<T extends FormValues>({
136
124
  productName,
137
125
  hasTicket,
138
126
  categoryType,
139
- zoneDuration,
140
127
  isOverrides = false,
141
128
  }: ProductControlProps<T>) {
142
129
  const {
@@ -146,11 +133,9 @@ export function ProductControl<T extends FormValues>({
146
133
  setValue,
147
134
  getValues,
148
135
  watch,
149
- trigger,
150
- clearErrors,
151
136
  } = useFormContext<T>();
152
137
 
153
- const { setLoading, productGroupList } = useContext(ProductSetLoadingContext);
138
+ const { setLoading } = useContext(ProductSetLoadingContext);
154
139
  const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
155
140
  const [expanded, setExpanded] = useState(false);
156
141
  const [initialImages, setInitialImages] = useState<Image[] | null>(null);
@@ -158,21 +143,16 @@ export function ProductControl<T extends FormValues>({
158
143
  const isUnlimited = Boolean(
159
144
  watch(`${fieldNamePrefix}.isUnlimited` as Path<T>)
160
145
  );
161
- const capacity = watch(`${fieldNamePrefix}.capacity` as Path<T>);
162
- const disabledDuration = capacity === "0" || !capacity;
163
146
  const advancedId = useId();
164
147
  const nameId = useId();
165
148
 
166
- const productGroupId = useId();
167
149
  const descriptionId = useId();
168
- const termsAndConditionsId = useId();
169
150
  const isAvailableId = useId();
170
151
  const isSoldOutId = useId();
171
- const isRequiredId = useId();
172
152
  const quantitySelectorId = useId();
173
- const hasSpecialNotesId = useId();
174
153
  const unlimitedQuantityId = useId();
175
- const minSpendId = useId();
154
+
155
+ const isZoneCategory = checkIfZoneCategory(categoryType);
176
156
 
177
157
  const quantitySelectorList: SelectItem[] = [
178
158
  { id: 1, value: t("quantitySelector") },
@@ -202,17 +182,6 @@ export function ProductControl<T extends FormValues>({
202
182
  },
203
183
  [handleImageUploading]
204
184
  );
205
-
206
- const onChangeGameCapacity = (value: number) => {
207
- if (!zoneDuration) {
208
- return;
209
- }
210
- setValue(
211
- `${fieldNamePrefix}.duration` as Path<T>,
212
- (value * zoneDuration) as UnpackNestedValue<PathValue<T, Path<T>>>
213
- );
214
- };
215
-
216
185
  const onImageRemove = useCallback(
217
186
  (id, path) => {
218
187
  handleImageRemove(String(id), path);
@@ -240,19 +209,6 @@ export function ProductControl<T extends FormValues>({
240
209
  }
241
210
  }, [images, fieldNamePrefix, setValue]);
242
211
 
243
- useEffect(() => {
244
- if (!disabledDuration) {
245
- trigger(`${fieldNamePrefix}.duration` as Path<T>);
246
- return;
247
- }
248
- setValue(
249
- `${fieldNamePrefix}.duration` as Path<T>,
250
- 0 as UnpackNestedValue<PathValue<T, Path<T>>>
251
- );
252
- clearErrors(`${fieldNamePrefix}.duration` as Path<T>);
253
- // eslint-disable-next-line react-hooks/exhaustive-deps
254
- }, [disabledDuration]);
255
-
256
212
  const quantitySelector = quantityValue ?? "1";
257
213
  const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
258
214
  return (
@@ -395,164 +351,17 @@ export function ProductControl<T extends FormValues>({
395
351
  )}
396
352
  </Form.Control.Feedback>
397
353
  </Form.Group>
398
-
399
- <PropertyControl<T>
400
- item={`${fieldNamePrefix}.color` as Path<T>}
401
- label={t("ProductSet:selectColor")}
402
- isDisabled={isOverrides}
403
- isRequired={false}
404
- defaultColors={PRODUCT_DEfAULT_COLORS}
405
- />
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
354
  </Col>
436
355
  </Row>
437
356
 
438
- {categoryType === CATEGORY_TYPE_FIXED_DURATION && (
439
- <Row className="align-items-start duration-capacity-container">
440
- <ProductDurationControl
357
+ <Row className="my-4 mx-0 d-flex flex-column">
358
+ {isZoneCategory && (
359
+ <ProductZonesControl
360
+ isOverrides={isOverrides}
441
361
  fieldNamePrefix={fieldNamePrefix}
442
- disabled={disabledDuration || isOverrides}
362
+ categoryType={categoryType}
443
363
  />
444
-
445
- <Col lg={4} md={4}>
446
- <FormNumberInput
447
- fieldName={`${fieldNamePrefix}.capacity`}
448
- label={t("capacity")}
449
- disabled={isOverrides}
450
- rules={{
451
- min: {
452
- value: 0,
453
- message: t("Validation:fieldMinNumber", {
454
- attribute: t("capacity"),
455
- min: 0,
456
- }) as string,
457
- },
458
- }}
459
- />
460
- </Col>
461
- {disabledDuration && (
462
- <div className="duration-hint duration-capacity-container">
463
- {t("Design:forDurationEditing")}
464
- </div>
465
- )}
466
- </Row>
467
- )}
468
-
469
- {categoryType === CATEGORY_TYPE_GAME && (
470
- <>
471
- <Row className="align-items-start duration-capacity-container">
472
- <Col lg={4} md={4}>
473
- <FormNumberInput
474
- fieldName={`${fieldNamePrefix}.capacity`}
475
- label={t("capacity")}
476
- onChange={onChangeGameCapacity}
477
- disabled={isOverrides}
478
- rules={{
479
- min: {
480
- value: 0,
481
- message: t("Validation:fieldMinNumber", {
482
- attribute: t("capacity"),
483
- min: 1,
484
- }) as string,
485
- },
486
- }}
487
- />
488
- </Col>
489
- <Col lg={4} md={4}>
490
- <FormNumberInput
491
- fieldName={`${fieldNamePrefix}.duration`}
492
- label={t("durationMinutes")}
493
- disabled={disabledDuration || isOverrides}
494
- rules={{
495
- min: {
496
- value: 0,
497
- message: t("Validation:fieldMinNumber", {
498
- attribute: t("duration"),
499
- min: 0,
500
- }) as string,
501
- },
502
- validate: (val) => {
503
- if (!disabledDuration && (!val || val < 1)) {
504
- return t("Validation:fieldRequired", {
505
- attribute: t("duration"),
506
- }) as string;
507
- }
508
- return true;
509
- },
510
- }}
511
- />
512
- </Col>
513
- </Row>
514
- {disabledDuration && (
515
- <div className="duration-hint pl-0">
516
- {t("Design:forDurationEditing")}
517
- </div>
518
- )}
519
- </>
520
- )}
521
-
522
- <Row className="mt-4">
523
- <Col lg={8} md={8}>
524
- <Form.Group controlId={termsAndConditionsId}>
525
- <Form.Label>{t("productTermsConditions")}</Form.Label>
526
-
527
- <Controller
528
- render={({ field: { value, onChange, name, ref } }) => (
529
- <Form.Control
530
- ref={ref}
531
- as="textarea"
532
- rows={3}
533
- value={value as string}
534
- onChange={onChange}
535
- isInvalid={HookFormService.isInvalid<T>(
536
- `${fieldNamePrefix}.termsAndConditions` as Path<T>,
537
- errors
538
- )}
539
- disabled={isLoading || isOverrides}
540
- name={name}
541
- />
542
- )}
543
- control={control}
544
- name={`${fieldNamePrefix}.termsAndConditions` as Path<T>}
545
- />
546
-
547
- <Form.Control.Feedback type="invalid">
548
- {HookFormService.getErrors<T>(
549
- `${fieldNamePrefix}.termsAndConditions` as Path<T>,
550
- errors
551
- )}
552
- </Form.Control.Feedback>
553
- </Form.Group>
554
- </Col>
555
-
364
+ )}
556
365
  <Col
557
366
  lg={4}
558
367
  md={4}
@@ -639,67 +448,13 @@ export function ProductControl<T extends FormValues>({
639
448
 
640
449
  <Col lg={12} md={12} xl className="p-0">
641
450
  <Collapse in={expanded}>
451
+ {/* Div should be here not in component, otherwise component will be always collapsed */}
642
452
  <div>
643
- <Form.Group
644
- controlId={isRequiredId}
645
- className="advanced-switch-container"
646
- >
647
- <Form.Label>{t("isRequired")}</Form.Label>
648
-
649
- <Controller
650
- render={({ field: { value, onChange, name } }) => (
651
- <BooleanSwitch
652
- name={name}
653
- value={Boolean(value)}
654
- onChange={onChange}
655
- disabled={isLoading || isOverrides}
656
- />
657
- )}
658
- control={control}
659
- name={`${fieldNamePrefix}.isRequired` as Path<T>}
660
- />
661
- </Form.Group>
662
-
663
- <Form.Group
664
- controlId={hasSpecialNotesId}
665
- className="advanced-switch-container"
666
- >
667
- <Form.Label>{t("hasSpecialNotes")}</Form.Label>
668
-
669
- <Controller
670
- render={({ field: { value, onChange, name } }) => (
671
- <BooleanSwitch
672
- name={name}
673
- value={Boolean(value)}
674
- onChange={onChange}
675
- disabled={isLoading || isOverrides}
676
- />
677
- )}
678
- control={control}
679
- name={`${fieldNamePrefix}.hasSpecialNotes` as Path<T>}
680
- />
681
- </Form.Group>
682
- {[CATEGORY_TYPE_GAME, CATEGORY_TYPE_FIXED_DURATION].includes(
683
- categoryType
684
- ) && (
685
- <FixedDurationOptions
686
- fieldNamePrefix={fieldNamePrefix}
687
- isOverrides={isOverrides}
688
- />
689
- )}
690
- <Form.Group
691
- controlId={minSpendId}
692
- className="advanced-switch-container"
693
- >
694
- <ProductPriceControl
695
- title={t("minSpend")}
696
- isRequired={false}
697
- isMoreThanZero
698
- allowDeposits={false}
699
- isLoading={isLoading || isOverrides}
700
- fieldNamePrefix={`${fieldNamePrefix}.minSpend` as Path<T>}
701
- />
702
- </Form.Group>
453
+ <AdvancedOptions
454
+ isOverrides={isOverrides}
455
+ fieldNamePrefix={fieldNamePrefix}
456
+ isLoading={isLoading}
457
+ />
703
458
  </div>
704
459
  </Collapse>
705
460
 
@@ -0,0 +1,168 @@
1
+ import React, { useContext } from "react";
2
+ import { Col, Form } from "react-bootstrap";
3
+ import { Controller, Path, useFormContext } from "react-hook-form";
4
+ import { HookFormService } from "@licklist/plugins";
5
+ import { useId } from "@react-aria/utils";
6
+ import { useTranslation } from "react-i18next";
7
+ import { PRODUCT_DEfAULT_COLORS } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
8
+ import {
9
+ FieldNamePrefixPath,
10
+ FormValues,
11
+ } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
12
+ import { ProductPriceControl } from "../price/ProductPriceControl";
13
+ import { PropertyControl } from "../../../snippet";
14
+
15
+ import { BooleanSwitch } from "../../../static";
16
+ import { ProductSetLoadingContext } from "../../form/context";
17
+
18
+ interface AdvancedOptionsProps<T> extends FieldNamePrefixPath<T> {
19
+ isOverrides: boolean;
20
+ isLoading: boolean;
21
+ }
22
+
23
+ export const AdvancedOptions = <T extends FormValues>({
24
+ fieldNamePrefix,
25
+ isOverrides,
26
+ isLoading,
27
+ }: AdvancedOptionsProps<T>) => {
28
+ const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
29
+
30
+ const {
31
+ register,
32
+ control,
33
+ formState: { errors },
34
+ } = useFormContext<T>();
35
+
36
+ const { productGroupList } = useContext(ProductSetLoadingContext);
37
+
38
+ const isRequiredId = useId();
39
+ const productGroupId = useId();
40
+ const termsAndConditionsId = useId();
41
+ const hasSpecialNotesId = useId();
42
+ const minSpendId = useId();
43
+
44
+ return (
45
+ <>
46
+ <Form.Group
47
+ controlId={isRequiredId}
48
+ className="advanced-switch-container"
49
+ >
50
+ <Form.Label>{t("isRequired")}</Form.Label>
51
+
52
+ <Controller
53
+ render={({ field: { value, onChange, name } }) => (
54
+ <BooleanSwitch
55
+ name={name}
56
+ value={Boolean(value)}
57
+ onChange={onChange}
58
+ disabled={isLoading || isOverrides}
59
+ />
60
+ )}
61
+ control={control}
62
+ name={`${fieldNamePrefix}.isRequired` as Path<T>}
63
+ />
64
+ </Form.Group>
65
+
66
+ <Form.Group
67
+ controlId={hasSpecialNotesId}
68
+ className="advanced-switch-container"
69
+ >
70
+ <Form.Label>{t("hasSpecialNotes")}</Form.Label>
71
+
72
+ <Controller
73
+ render={({ field: { value, onChange, name } }) => (
74
+ <BooleanSwitch
75
+ name={name}
76
+ value={Boolean(value)}
77
+ onChange={onChange}
78
+ disabled={isLoading || isOverrides}
79
+ />
80
+ )}
81
+ control={control}
82
+ name={`${fieldNamePrefix}.hasSpecialNotes` as Path<T>}
83
+ />
84
+ </Form.Group>
85
+
86
+ <PropertyControl<T>
87
+ item={`${fieldNamePrefix}.color` as Path<T>}
88
+ label={t("ProductSet:selectColor")}
89
+ isDisabled={isOverrides}
90
+ isRequired={false}
91
+ defaultColors={PRODUCT_DEfAULT_COLORS}
92
+ />
93
+
94
+ <Form.Group controlId={productGroupId}>
95
+ <Form.Label>{t("productGroup")}</Form.Label>
96
+ <Form.Control
97
+ as="select"
98
+ {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
99
+ isInvalid={HookFormService.isInvalid<T>(
100
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
101
+ errors
102
+ )}
103
+ disabled={isLoading || isOverrides}
104
+ defaultValue=""
105
+ >
106
+ <option value="">{t("Design:selectProductGroup")}</option>
107
+ {productGroupList.map((productGroup) => {
108
+ return (
109
+ <option value={productGroup.id} key={productGroup.id}>
110
+ {productGroup.value}
111
+ </option>
112
+ );
113
+ })}
114
+ </Form.Control>
115
+ <Form.Control.Feedback type="invalid">
116
+ {HookFormService.getErrors<T>(
117
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
118
+ errors
119
+ )}
120
+ </Form.Control.Feedback>
121
+ </Form.Group>
122
+
123
+ <Col lg={8} md={8} className="pl-0">
124
+ <Form.Group controlId={termsAndConditionsId}>
125
+ <Form.Label>{t("productTermsConditions")}</Form.Label>
126
+
127
+ <Controller
128
+ render={({ field: { value, onChange, name, ref } }) => (
129
+ <Form.Control
130
+ ref={ref}
131
+ as="textarea"
132
+ rows={3}
133
+ value={value as string}
134
+ onChange={onChange}
135
+ isInvalid={HookFormService.isInvalid<T>(
136
+ `${fieldNamePrefix}.termsAndConditions` as Path<T>,
137
+ errors
138
+ )}
139
+ disabled={isLoading || isOverrides}
140
+ name={name}
141
+ />
142
+ )}
143
+ control={control}
144
+ name={`${fieldNamePrefix}.termsAndConditions` as Path<T>}
145
+ />
146
+
147
+ <Form.Control.Feedback type="invalid">
148
+ {HookFormService.getErrors<T>(
149
+ `${fieldNamePrefix}.termsAndConditions` as Path<T>,
150
+ errors
151
+ )}
152
+ </Form.Control.Feedback>
153
+ </Form.Group>
154
+ </Col>
155
+
156
+ <Form.Group controlId={minSpendId} className="advanced-switch-container">
157
+ <ProductPriceControl
158
+ title={t("minSpend")}
159
+ isRequired={false}
160
+ isMoreThanZero
161
+ allowDeposits={false}
162
+ isLoading={isLoading || isOverrides}
163
+ fieldNamePrefix={`${fieldNamePrefix}.minSpend` as Path<T>}
164
+ />
165
+ </Form.Group>
166
+ </>
167
+ );
168
+ };
@@ -0,0 +1 @@
1
+ export * from "./AdvancedOptions";
@@ -19,7 +19,7 @@ export const FixedDurationOptions = <T,>({
19
19
 
20
20
  return (
21
21
  <>
22
- <Row>
22
+ <Row className="mt-4">
23
23
  <Col lg={4} md={4} sm={6}>
24
24
  <FormNumberInput
25
25
  fieldName={`${fieldNamePrefix}.subSlots`}
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useContext, useEffect, useState } from "react";
1
+ import React, { useCallback, useEffect, useState } from "react";
2
2
  import { Form, Col, Collapse, InputGroup, Row } from "react-bootstrap";
3
3
  import { Controller, useFormContext, useWatch } from "react-hook-form";
4
4
  import { useTranslation } from "react-i18next";
@@ -13,12 +13,10 @@ import {
13
13
  CATEGORY_TYPE_TICKETS,
14
14
  CATEGORY_TYPE_FIXED_DURATION,
15
15
  } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
16
- import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
17
16
  import { Switch, BooleanSwitch } from "../../static";
18
17
  import { ProductSetFormValues } from "../form/ProductSetForm";
19
18
  import { IsDeletableEvent, ProductCategory } from "../types";
20
19
  import { ReactComponent as IncrementIcon } from "../../assets/dashboard/increment.svg";
21
- import { ProductSetLoadingContext } from "../form/context";
22
20
 
23
21
  export interface ProductCategoryControlValues extends FormValues {
24
22
  id: number;
@@ -39,7 +37,6 @@ export interface ProductCategoryControlValues extends FormValues {
39
37
  weight?: number;
40
38
  isReusable?: boolean;
41
39
  termsAndConditions?: string;
42
- zoneId?: Zone["id"];
43
40
  sort: number | null;
44
41
  }
45
42
 
@@ -102,14 +99,10 @@ export function ProductCategoryControl({
102
99
  const isTimeRelatedId = useId();
103
100
  const collectUserInfoId = useId();
104
101
  const hasTicketId = useId();
105
- const zoneId = useId();
106
102
  const overallQuantityId = useId();
107
103
 
108
104
  const allowDepositsId = useId();
109
105
  const remainderExpireAfterId = useId();
110
- const { providerHasBookingManagement, zones = [] } = useContext(
111
- ProductSetLoadingContext
112
- );
113
106
 
114
107
  // @TODO not for first release
115
108
  // const hasBookingManagementId = useId();
@@ -129,10 +122,6 @@ export function ProductCategoryControl({
129
122
  // eslint-disable-next-line react-hooks/exhaustive-deps
130
123
  }, [maxSubItems, fieldNamePrefix]);
131
124
 
132
- const isZoneCategory =
133
- category.type === CATEGORY_TYPE_FIXED_DURATION ||
134
- category.type === CATEGORY_TYPE_GAME;
135
-
136
125
  return (
137
126
  <>
138
127
  <Col md={12} xl className="p-0">
@@ -387,54 +376,6 @@ export function ProductCategoryControl({
387
376
  </Form.Group>
388
377
  </Col>
389
378
  </Row>
390
-
391
- {isZoneCategory && (
392
- <>
393
- <Row>
394
- <Col>
395
- <Form.Group controlId={zoneId}>
396
- <Form.Label>{t("Design:zone")}</Form.Label>
397
- <Controller
398
- control={control}
399
- name={`${fieldNamePrefix}.zoneId`}
400
- render={({ field }) => (
401
- <Form.Control
402
- as="select"
403
- disabled={isOverride}
404
- isInvalid={HookFormService.isInvalid<ProductSetFormValues>(
405
- `${fieldNamePrefix}.zoneId`,
406
- errors
407
- )}
408
- {...field}
409
- >
410
- <option value={null}>{t("Design:choose")}</option>
411
- {zones.map((zone) => (
412
- <option key={zone.id} value={zone.id}>
413
- {zone.name}
414
- </option>
415
- ))}
416
- </Form.Control>
417
- )}
418
- rules={{
419
- required: {
420
- value: providerHasBookingManagement,
421
- message: t("Validation:fieldRequired", {
422
- attribute: t("zone"),
423
- }),
424
- },
425
- }}
426
- />
427
- <Form.Control.Feedback type="invalid">
428
- {HookFormService.getErrors<ProductSetFormValues>(
429
- `${fieldNamePrefix}.zoneId`,
430
- errors
431
- )}
432
- </Form.Control.Feedback>
433
- </Form.Group>
434
- </Col>
435
- </Row>
436
- </>
437
- )}
438
379
  </Col>
439
380
 
440
381
  <Col md={12} xl className="p-0">