@licklist/design 0.66.0-dev.0 → 0.66.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/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/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.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 -5
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts.map +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.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/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/date-time-button/DateTimeButton.scss +0 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/zones/ZoneForm.scss +1 -2
- 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/package.json +5 -3
- 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 +4 -3
- package/src/product-set/control/DateInput.tsx +2 -2
- package/src/product-set/control/ProductSetControl.tsx +5 -17
- 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 +5 -8
- 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/RecurrenceIntervalAndFrequencyInput.tsx +21 -49
- 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 -90
- package/src/report/ReportRunnerModal/ReportRunnerModal.tsx +14 -24
- package/src/sales/booking/results/components/ResultCard.tsx +3 -0
- package/src/setting/admin/AdminSettingForm.tsx +2 -2
- package/src/sortable-tree/SortableTreeItem.tsx +3 -0
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/date-time-button/DateTimeButton.scss +0 -1
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/zones/ZoneForm.scss +1 -2
- 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/src/report/ReportRunnerModal/ReportRunnerModal.stories.tsx +0 -307
package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx
CHANGED
|
@@ -40,10 +40,6 @@ export const SelectEventProductSet = ({
|
|
|
40
40
|
const productSetId = watch("productSetId");
|
|
41
41
|
const editedProductSet = watch("editedProductSet");
|
|
42
42
|
|
|
43
|
-
const selectedProductSet = productSets.find(
|
|
44
|
-
(productSet) => productSet.id === productSetId
|
|
45
|
-
)?.parentMenuId;
|
|
46
|
-
|
|
47
43
|
const onEditProductSet = useCallback(
|
|
48
44
|
() => {
|
|
49
45
|
setEditProductSetId(String(productSetId));
|
|
@@ -88,9 +84,6 @@ export const SelectEventProductSet = ({
|
|
|
88
84
|
setValue("productSetId", value);
|
|
89
85
|
};
|
|
90
86
|
|
|
91
|
-
const showOverrideProductSet =
|
|
92
|
-
!showEditProductSet && productSetId && !selectedProductSet;
|
|
93
|
-
|
|
94
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
88
|
const onSubmit = (value: EditEventFormValues["editedProductSet"]) => {
|
|
96
89
|
setShowEditProductSet(false);
|
|
@@ -166,7 +159,7 @@ export const SelectEventProductSet = ({
|
|
|
166
159
|
{t("addNewProductSet")}
|
|
167
160
|
</Button>
|
|
168
161
|
)}
|
|
169
|
-
{
|
|
162
|
+
{!showEditProductSet && productSetId && (
|
|
170
163
|
<Button
|
|
171
164
|
variant=""
|
|
172
165
|
className="btn product-set-button "
|
|
@@ -206,12 +199,14 @@ export const SelectEventProductSet = ({
|
|
|
206
199
|
</Form.Group>
|
|
207
200
|
</div>
|
|
208
201
|
{showEditProductSet && productSetId && (
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
202
|
+
<>
|
|
203
|
+
<EditEventProductSet
|
|
204
|
+
onSubmit={onSubmit}
|
|
205
|
+
defaultValues={
|
|
206
|
+
productSetId === editedProductSet?.id && editedProductSet
|
|
207
|
+
}
|
|
208
|
+
/>
|
|
209
|
+
</>
|
|
215
210
|
)}
|
|
216
211
|
</>
|
|
217
212
|
);
|
|
@@ -28,13 +28,15 @@ import {
|
|
|
28
28
|
AvailableTimesControlRef,
|
|
29
29
|
} from "../../zone/form/components/AvailableTimesControl";
|
|
30
30
|
|
|
31
|
+
// eslint-disable-next-line max-len
|
|
32
|
+
|
|
31
33
|
export interface DateAndRecurrenceInputValues {
|
|
32
34
|
menuRecurrences?: Partial<ProductSetRecurrence>[];
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
interface DateAndRecurrenceInputProps {
|
|
36
38
|
isEventEditProductSet?: boolean;
|
|
37
|
-
workHours
|
|
39
|
+
workHours?: WorkHour[];
|
|
38
40
|
providerHasBookingManagement: boolean;
|
|
39
41
|
isLoading?: boolean;
|
|
40
42
|
}
|
|
@@ -88,7 +90,7 @@ export const DateAndRecurrenceInput = ({
|
|
|
88
90
|
clearEditState();
|
|
89
91
|
});
|
|
90
92
|
|
|
91
|
-
const popoverId = useId()
|
|
93
|
+
const popoverId = useId()!;
|
|
92
94
|
|
|
93
95
|
const { t } = useTranslation("Design");
|
|
94
96
|
|
|
@@ -226,7 +228,6 @@ export const DateAndRecurrenceInput = ({
|
|
|
226
228
|
defaultValues={editState.values}
|
|
227
229
|
onChange={handleRecurringDateChange}
|
|
228
230
|
onDelete={handleDelete}
|
|
229
|
-
workHours={workHours}
|
|
230
231
|
>
|
|
231
232
|
{providerHasBookingManagement && (
|
|
232
233
|
<AvailableTimesControl
|
|
@@ -5,7 +5,7 @@ import { Form, OverlayTrigger, Popover } from "react-bootstrap";
|
|
|
5
5
|
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
7
|
import { useClickAway } from "react-use";
|
|
8
|
-
import {
|
|
8
|
+
import { TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
|
|
9
9
|
import { ProductSetRecurrence } from "@licklist/core/dist/DataMapper/Product/ProductSetRecurrenceDataMapper";
|
|
10
10
|
import { DateTime } from "luxon";
|
|
11
11
|
import RRule, { Frequency } from "rrule";
|
|
@@ -136,7 +136,7 @@ export const DateInput = ({
|
|
|
136
136
|
until: (start as DateTime).toJSDate(),
|
|
137
137
|
byweekday: [],
|
|
138
138
|
freq: Frequency.DAILY,
|
|
139
|
-
tzid:
|
|
139
|
+
tzid: TIMEZONE,
|
|
140
140
|
interval: 1,
|
|
141
141
|
}).replace("RRULE:", "");
|
|
142
142
|
|
|
@@ -85,10 +85,9 @@ export interface ProductSetControlProps {
|
|
|
85
85
|
fieldSets?: FieldSet[];
|
|
86
86
|
showEmailTemplate?: boolean;
|
|
87
87
|
showSmsTemplate?: boolean;
|
|
88
|
-
workHours
|
|
88
|
+
workHours?: WorkHour[];
|
|
89
89
|
providerHasBookingManagement?: boolean;
|
|
90
90
|
isOverrides?: boolean;
|
|
91
|
-
isCreateNewOverrides?: boolean;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
export function ProductSetControl({
|
|
@@ -105,7 +104,6 @@ export function ProductSetControl({
|
|
|
105
104
|
workHours,
|
|
106
105
|
providerHasBookingManagement = false,
|
|
107
106
|
isOverrides = false,
|
|
108
|
-
isCreateNewOverrides = false,
|
|
109
107
|
}: ProductSetControlProps) {
|
|
110
108
|
const { t } = useTranslation(["Design", "Validation", "Notification"]);
|
|
111
109
|
const {
|
|
@@ -125,11 +123,6 @@ export function ProductSetControl({
|
|
|
125
123
|
|
|
126
124
|
const showSmsTemplateSelector = showSmsTemplate && !isOverrides;
|
|
127
125
|
const showEmailTemplateSelector = showEmailTemplate && !isOverrides;
|
|
128
|
-
const showDateSelector = !isEventEditProductSet && isOverrides;
|
|
129
|
-
|
|
130
|
-
const isZoneAdded = steps.some(({ productCategories }) =>
|
|
131
|
-
productCategories.some(({ zoneId }) => zoneId)
|
|
132
|
-
);
|
|
133
126
|
|
|
134
127
|
return (
|
|
135
128
|
<Row
|
|
@@ -172,9 +165,9 @@ export function ProductSetControl({
|
|
|
172
165
|
</Form.Control.Feedback>
|
|
173
166
|
</Form.Group>
|
|
174
167
|
|
|
175
|
-
{
|
|
168
|
+
{isOverrides ? (
|
|
176
169
|
<DateInput
|
|
177
|
-
workHours={
|
|
170
|
+
workHours={workHours}
|
|
178
171
|
isLoading={isLoading}
|
|
179
172
|
providerHasBookingManagement={providerHasBookingManagement}
|
|
180
173
|
/>
|
|
@@ -183,7 +176,7 @@ export function ProductSetControl({
|
|
|
183
176
|
{isCreateAction && (
|
|
184
177
|
<DateAndRecurrenceInput
|
|
185
178
|
isEventEditProductSet={isEventEditProductSet}
|
|
186
|
-
workHours={
|
|
179
|
+
workHours={workHours}
|
|
187
180
|
isLoading={isLoading}
|
|
188
181
|
providerHasBookingManagement={providerHasBookingManagement}
|
|
189
182
|
/>
|
|
@@ -195,12 +188,7 @@ export function ProductSetControl({
|
|
|
195
188
|
|
|
196
189
|
<TutorialGifCard isOverrides={isOverrides} />
|
|
197
190
|
|
|
198
|
-
<StepsControl
|
|
199
|
-
isLoading={isLoading}
|
|
200
|
-
isEventEditProductSet={isEventEditProductSet}
|
|
201
|
-
isOverrides={isOverrides}
|
|
202
|
-
isCreateNewOverrides={isCreateNewOverrides}
|
|
203
|
-
/>
|
|
191
|
+
<StepsControl isLoading={isLoading} isOverrides={isOverrides} />
|
|
204
192
|
</Col>
|
|
205
193
|
<Col md={6} sm={12}>
|
|
206
194
|
<div className="second-column">
|
|
@@ -36,8 +36,6 @@ import { useSortableTreeFunctions } from "../hooks/useSortableTreeFunctions";
|
|
|
36
36
|
interface ProductCategoriesControlProps extends WithIsLoading {
|
|
37
37
|
stepIndex: number;
|
|
38
38
|
isOverrides?: boolean;
|
|
39
|
-
isEventEditProductSet?: boolean;
|
|
40
|
-
isCreateNewOverrides?: boolean;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
const getCategoryDefaultValue = (
|
|
@@ -69,8 +67,6 @@ export function ProductCategoriesControl({
|
|
|
69
67
|
isLoading,
|
|
70
68
|
stepIndex,
|
|
71
69
|
isOverrides,
|
|
72
|
-
isEventEditProductSet,
|
|
73
|
-
isCreateNewOverrides,
|
|
74
70
|
}: ProductCategoriesControlProps) {
|
|
75
71
|
const { t } = useTranslation("Design");
|
|
76
72
|
const {
|
|
@@ -218,11 +214,6 @@ export function ProductCategoriesControl({
|
|
|
218
214
|
? String(productCategory.id)
|
|
219
215
|
: productCategory.uniqueId;
|
|
220
216
|
|
|
221
|
-
const isOverridesCategory = productCategory.products.some((product) =>
|
|
222
|
-
isEventEditProductSet ? !!product.id : !!product.originalProductId
|
|
223
|
-
);
|
|
224
|
-
const isNewOverridesCategory =
|
|
225
|
-
isCreateNewOverrides && !!productCategory.id;
|
|
226
217
|
const onSetIsExpanded = () => {
|
|
227
218
|
setIsExpanded(productCategoryId);
|
|
228
219
|
};
|
|
@@ -278,10 +269,7 @@ export function ProductCategoriesControl({
|
|
|
278
269
|
categoryName={value}
|
|
279
270
|
stepIndex={stepIndex}
|
|
280
271
|
productCategoryIndex={index}
|
|
281
|
-
isOverride={
|
|
282
|
-
isNewOverridesCategory ||
|
|
283
|
-
(isOverrides && isOverridesCategory)
|
|
284
|
-
}
|
|
272
|
+
isOverride={isOverrides}
|
|
285
273
|
/>
|
|
286
274
|
}
|
|
287
275
|
isOverride={isOverrides}
|
|
@@ -308,8 +296,6 @@ export function ProductCategoriesControl({
|
|
|
308
296
|
productCategoryIndex={index}
|
|
309
297
|
categoryType={productCategory.type}
|
|
310
298
|
isOverrides={isOverrides}
|
|
311
|
-
isEventEditProductSet={isEventEditProductSet}
|
|
312
|
-
isCreateNewOverrides={isCreateNewOverrides}
|
|
313
299
|
/>
|
|
314
300
|
</SortableTree.Item>
|
|
315
301
|
)}
|
|
@@ -319,7 +305,9 @@ export function ProductCategoriesControl({
|
|
|
319
305
|
</SortableTree>
|
|
320
306
|
<CreateProductSetItem
|
|
321
307
|
title={t("addCategory")}
|
|
308
|
+
isOverride={isOverrides}
|
|
322
309
|
onClick={() => {
|
|
310
|
+
if (isOverrides) return;
|
|
323
311
|
setIsSelectCategoryVisible(true);
|
|
324
312
|
}}
|
|
325
313
|
/>
|
|
@@ -328,6 +316,7 @@ export function ProductCategoriesControl({
|
|
|
328
316
|
isVisible={isSelectCategoryVisible}
|
|
329
317
|
onHide={() => setIsSelectCategoryVisible(false)}
|
|
330
318
|
onCategorySelect={(categoryType) => {
|
|
319
|
+
if (isOverrides) return;
|
|
331
320
|
append(getCategoryDefaultValue(categoryType, fields.length));
|
|
332
321
|
setShowCategoryModal(true);
|
|
333
322
|
if (
|
|
@@ -26,16 +26,12 @@ import { checkAvailableTimesErrors, getFilteredTemplates } from "../utils";
|
|
|
26
26
|
export interface WithIsLoading {
|
|
27
27
|
isLoading: boolean;
|
|
28
28
|
}
|
|
29
|
-
export interface WithIdOptional {
|
|
30
|
-
id?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
export interface WithId {
|
|
34
30
|
id: number;
|
|
35
31
|
}
|
|
36
32
|
export interface ProductSetFormValues
|
|
37
33
|
extends FormValues,
|
|
38
|
-
|
|
34
|
+
WithId,
|
|
39
35
|
ProductSetControlValues {
|
|
40
36
|
steps: Step[];
|
|
41
37
|
isOverrides?: boolean;
|
|
@@ -57,7 +53,6 @@ export interface ProductSetFormProps
|
|
|
57
53
|
isCreateAction?: boolean;
|
|
58
54
|
isOverrides?: boolean;
|
|
59
55
|
workHours?: WorkHour[];
|
|
60
|
-
isCreateNewOverrides?: boolean;
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
export function ProductSetForm({
|
|
@@ -75,7 +70,6 @@ export function ProductSetForm({
|
|
|
75
70
|
isCreateAction,
|
|
76
71
|
workHours,
|
|
77
72
|
isOverrides,
|
|
78
|
-
isCreateNewOverrides,
|
|
79
73
|
...shared
|
|
80
74
|
}: ProductSetFormProps) {
|
|
81
75
|
const { t } = useTranslation("Design");
|
|
@@ -121,11 +115,7 @@ export function ProductSetForm({
|
|
|
121
115
|
}, [serverErrors, setError]);
|
|
122
116
|
|
|
123
117
|
useEffect(() => {
|
|
124
|
-
window.history.pushState(
|
|
125
|
-
null,
|
|
126
|
-
"",
|
|
127
|
-
window.location.pathname + window.location.search
|
|
128
|
-
);
|
|
118
|
+
window.history.pushState(null, "", window.location.pathname);
|
|
129
119
|
window.addEventListener("beforeunload", onBeforeUnload);
|
|
130
120
|
window.addEventListener("popstate", onPopState);
|
|
131
121
|
|
|
@@ -176,7 +166,6 @@ export function ProductSetForm({
|
|
|
176
166
|
workHours={workHours}
|
|
177
167
|
providerHasBookingManagement={providerHasBookingManagement}
|
|
178
168
|
isOverrides={isOverrides}
|
|
179
|
-
isCreateNewOverrides={isCreateNewOverrides}
|
|
180
169
|
/>
|
|
181
170
|
<Row>
|
|
182
171
|
<Col md={6} sm={12} />
|
|
@@ -35,8 +35,6 @@ interface ProductsControlProps extends WithIsLoading {
|
|
|
35
35
|
categoryType: CategoryType;
|
|
36
36
|
zones?: Zone[];
|
|
37
37
|
isOverrides?: boolean;
|
|
38
|
-
isEventEditProductSet?: boolean;
|
|
39
|
-
isCreateNewOverrides?: boolean;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
const getDefaultProductValue = (sort: number): Product => ({
|
|
@@ -59,7 +57,6 @@ const getDefaultProductValue = (sort: number): Product => ({
|
|
|
59
57
|
quantitySelector: 1,
|
|
60
58
|
hasSpecialNotes: false,
|
|
61
59
|
weight: 0,
|
|
62
|
-
originalProductId: null,
|
|
63
60
|
type: DEFAULT_PRODUCT_TYPE,
|
|
64
61
|
tierId: Number(uniqueId()),
|
|
65
62
|
zoneId: null,
|
|
@@ -82,8 +79,6 @@ export function ProductsControl({
|
|
|
82
79
|
categoryType,
|
|
83
80
|
zones,
|
|
84
81
|
isOverrides,
|
|
85
|
-
isEventEditProductSet,
|
|
86
|
-
isCreateNewOverrides,
|
|
87
82
|
}: ProductsControlProps) {
|
|
88
83
|
const { t } = useTranslation("Design");
|
|
89
84
|
const form = useFormContext<ProductSetFormValues>();
|
|
@@ -208,101 +203,90 @@ export function ProductsControl({
|
|
|
208
203
|
onDragEnd={handleDragEnd}
|
|
209
204
|
sensors={[mouseSensor]}
|
|
210
205
|
>
|
|
211
|
-
{fields.map((product, index) =>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
</span>
|
|
259
|
-
</div>
|
|
260
|
-
}
|
|
261
|
-
modalLabel={t("addNewProduct")}
|
|
262
|
-
modalClass={ProductSetModalClasses.product}
|
|
263
|
-
isNewAdded={showProductModal}
|
|
264
|
-
body={
|
|
265
|
-
<ProductControl<ProductSetFormValues>
|
|
266
|
-
isLoading={isLoading}
|
|
267
|
-
quantityType={quantityType}
|
|
268
|
-
allowDeposits={allowDeposits}
|
|
269
|
-
hasBookingManagement={false}
|
|
270
|
-
fieldNamePrefix={
|
|
271
|
-
`${productControlFieldName}.${index}` as const
|
|
272
|
-
}
|
|
273
|
-
productName={value}
|
|
274
|
-
onProductNameChange={onChange}
|
|
275
|
-
hasTicket={hasTicket}
|
|
276
|
-
categoryType={categoryType}
|
|
277
|
-
zoneDuration={catergoryZone?.defaultDuration}
|
|
278
|
-
isOverrides={
|
|
279
|
-
isNewProductOverrides || isOverridesProductSet
|
|
280
|
-
}
|
|
281
|
-
/>
|
|
282
|
-
}
|
|
283
|
-
onDelete={() => onProductRemove(index)}
|
|
284
|
-
validate={() =>
|
|
285
|
-
trigger(`${productControlFieldName}.${index}`)
|
|
286
|
-
}
|
|
287
|
-
saveValidField={saveValidField}
|
|
288
|
-
// preItem={<Popover className="d-none d-sm-block" />}
|
|
289
|
-
>
|
|
290
|
-
<SubProductsControl
|
|
206
|
+
{fields.map((product, index) => (
|
|
207
|
+
<Controller
|
|
208
|
+
key={product._id}
|
|
209
|
+
control={control}
|
|
210
|
+
name={`${productControlFieldName}.${index}.name` as const}
|
|
211
|
+
rules={{
|
|
212
|
+
required: t("Validation:fieldRequired", {
|
|
213
|
+
attribute: t("name"),
|
|
214
|
+
}) as string,
|
|
215
|
+
}}
|
|
216
|
+
render={({ field: { value, onChange } }) => (
|
|
217
|
+
<SortableTree.Item
|
|
218
|
+
key={`product-${product._id}`}
|
|
219
|
+
id={String(product._id)}
|
|
220
|
+
isExpanded={isFirstProductAdded}
|
|
221
|
+
isInvalid={!!categoryProductErrors}
|
|
222
|
+
title={value}
|
|
223
|
+
isOverride={isOverrides}
|
|
224
|
+
badge={<Badge className="product-badge">{t("product")}</Badge>}
|
|
225
|
+
isIconInHeader={false}
|
|
226
|
+
cancelChanges={() => cancelChanges(index)}
|
|
227
|
+
edit={() => edit(index)}
|
|
228
|
+
isProduct
|
|
229
|
+
secondaryBadge={getBadgeConfig(categoryType, t(categoryType))}
|
|
230
|
+
subTitle={
|
|
231
|
+
<div className="product-set-badges-container">
|
|
232
|
+
<div className="product-set-subtitle-dot product-set-subtitle-product-dot" />
|
|
233
|
+
<span>
|
|
234
|
+
{`£${prices[index]} ${t("each")} - ${t("qty")}:${
|
|
235
|
+
!isUnlimitedQuantities[index]
|
|
236
|
+
? ` ${quantities[index]}`
|
|
237
|
+
: t(" unlimited")
|
|
238
|
+
} ${
|
|
239
|
+
!isUnlimitedQuantities[index]
|
|
240
|
+
? ` - ${t("possibleRevenue")} £${
|
|
241
|
+
prices[index] * quantities[index]
|
|
242
|
+
}`
|
|
243
|
+
: ""
|
|
244
|
+
} `}
|
|
245
|
+
</span>
|
|
246
|
+
</div>
|
|
247
|
+
}
|
|
248
|
+
modalLabel={t("addNewProduct")}
|
|
249
|
+
modalClass={ProductSetModalClasses.product}
|
|
250
|
+
isNewAdded={showProductModal}
|
|
251
|
+
body={
|
|
252
|
+
<ProductControl<ProductSetFormValues>
|
|
291
253
|
isLoading={isLoading}
|
|
292
254
|
quantityType={quantityType}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
255
|
+
allowDeposits={allowDeposits}
|
|
256
|
+
hasBookingManagement={false}
|
|
257
|
+
fieldNamePrefix={
|
|
258
|
+
`${productControlFieldName}.${index}` as const
|
|
259
|
+
}
|
|
260
|
+
productName={value}
|
|
261
|
+
onProductNameChange={onChange}
|
|
262
|
+
hasTicket={hasTicket}
|
|
263
|
+
categoryType={categoryType}
|
|
264
|
+
zoneDuration={catergoryZone?.defaultDuration}
|
|
265
|
+
isOverrides={isOverrides}
|
|
296
266
|
/>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
267
|
+
}
|
|
268
|
+
onDelete={() => onProductRemove(index)}
|
|
269
|
+
validate={() => trigger(`${productControlFieldName}.${index}`)}
|
|
270
|
+
saveValidField={saveValidField}
|
|
271
|
+
// preItem={<Popover className="d-none d-sm-block" />}
|
|
272
|
+
>
|
|
273
|
+
<SubProductsControl
|
|
274
|
+
isLoading={isLoading}
|
|
275
|
+
quantityType={quantityType}
|
|
276
|
+
stepIndex={stepIndex}
|
|
277
|
+
productCategoryIndex={productCategoryIndex}
|
|
278
|
+
productIndex={index}
|
|
279
|
+
/>
|
|
280
|
+
</SortableTree.Item>
|
|
281
|
+
)}
|
|
282
|
+
/>
|
|
283
|
+
))}
|
|
302
284
|
</SortableTree>
|
|
303
285
|
<CreateProductSetItem
|
|
304
286
|
title={t("addProduct")}
|
|
287
|
+
isOverride={isOverrides}
|
|
305
288
|
onClick={() => {
|
|
289
|
+
if (isOverrides) return;
|
|
306
290
|
append(getDefaultProductValue(fields.length));
|
|
307
291
|
setShowProductModal(true);
|
|
308
292
|
|
|
@@ -19,16 +19,9 @@ import { ProductSetFormValues } from "./ProductSetForm";
|
|
|
19
19
|
interface StepsControlProps {
|
|
20
20
|
isLoading: boolean;
|
|
21
21
|
isOverrides?: boolean;
|
|
22
|
-
isEventEditProductSet?: boolean;
|
|
23
|
-
isCreateNewOverrides?: boolean;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
export function StepsControl({
|
|
27
|
-
isLoading,
|
|
28
|
-
isOverrides,
|
|
29
|
-
isEventEditProductSet,
|
|
30
|
-
isCreateNewOverrides,
|
|
31
|
-
}: StepsControlProps) {
|
|
24
|
+
export function StepsControl({ isLoading, isOverrides }: StepsControlProps) {
|
|
32
25
|
const form = useFormContext<ProductSetFormValues>();
|
|
33
26
|
const { t } = useTranslation("Design");
|
|
34
27
|
const [showStepModal, setShowStepModal] = useState(false);
|
|
@@ -75,9 +68,9 @@ export function StepsControl({
|
|
|
75
68
|
<>
|
|
76
69
|
{fields.map((step, index) => {
|
|
77
70
|
const stepFieldName = `steps.${index}` as const;
|
|
71
|
+
|
|
78
72
|
const stepData = getValues(stepFieldName);
|
|
79
|
-
|
|
80
|
-
(isOverrides || isCreateNewOverrides) && !!step.id;
|
|
73
|
+
|
|
81
74
|
return (
|
|
82
75
|
<Controller
|
|
83
76
|
key={`step-${step._id}`}
|
|
@@ -99,9 +92,9 @@ export function StepsControl({
|
|
|
99
92
|
modalLabel={t("addNewStep")}
|
|
100
93
|
modalClass={ProductSetModalClasses.step}
|
|
101
94
|
isNewAdded={showStepModal}
|
|
102
|
-
edit={() => edit(index)}
|
|
95
|
+
edit={() => !isOverrides && edit(index)}
|
|
103
96
|
cancelChanges={() => cancelChanges(index)}
|
|
104
|
-
isOverride={
|
|
97
|
+
isOverride={isOverrides}
|
|
105
98
|
subTitle={
|
|
106
99
|
<div className="product-set-badges-container">
|
|
107
100
|
<div className="product-set-subtitle-dot product-set-subtitle-step-dot" />
|
|
@@ -117,7 +110,6 @@ export function StepsControl({
|
|
|
117
110
|
stepIndex={index}
|
|
118
111
|
stepName={value}
|
|
119
112
|
onStepNameChange={onChange}
|
|
120
|
-
isOverrides={isOverrideStep}
|
|
121
113
|
/>
|
|
122
114
|
}
|
|
123
115
|
onDelete={() => remove(index)}
|
|
@@ -148,8 +140,6 @@ export function StepsControl({
|
|
|
148
140
|
isLoading={isLoading}
|
|
149
141
|
stepIndex={index}
|
|
150
142
|
isOverrides={isOverrides}
|
|
151
|
-
isCreateNewOverrides={isCreateNewOverrides}
|
|
152
|
-
isEventEditProductSet={isEventEditProductSet}
|
|
153
143
|
/>
|
|
154
144
|
</SortableTree.Item>
|
|
155
145
|
)}
|
|
@@ -159,7 +149,9 @@ export function StepsControl({
|
|
|
159
149
|
|
|
160
150
|
<CreateProductSetItem
|
|
161
151
|
title={t("addStep")}
|
|
152
|
+
isOverride={isOverrides}
|
|
162
153
|
onClick={() => {
|
|
154
|
+
if (isOverrides) return;
|
|
163
155
|
append(getDefaultStepsValues());
|
|
164
156
|
setShowStepModal(true);
|
|
165
157
|
if (errors.steps?.type === HookFormService.manualErrorType) {
|
|
@@ -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;
|
|
@@ -160,6 +156,7 @@ 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
162
|
|
|
@@ -413,7 +410,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
413
410
|
`${fieldNamePrefix}.productGroupId` as Path<T>,
|
|
414
411
|
errors
|
|
415
412
|
)}
|
|
416
|
-
disabled={isLoading
|
|
413
|
+
disabled={isLoading}
|
|
417
414
|
defaultValue=""
|
|
418
415
|
>
|
|
419
416
|
<option value="">{t("Design:selectProductGroup")}</option>
|
|
@@ -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}
|