@licklist/design 0.68.2-dev.2 → 0.68.2
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/affiliate/form/AffiliateForm.d.ts.map +1 -1
- package/dist/assets/iframe/selectArrow.svg.js +17 -0
- package/dist/auth/Login/LoginComponent.js +1 -2
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +40 -35
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -7
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -0
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +23 -24
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -0
- 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 +0 -2
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/layout/DropDown.d.ts +1 -2
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts +1 -3
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +8 -172
- package/dist/product-set/card/ProductSetCard.d.ts +2 -6
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +11 -30
- package/dist/product-set/control/DateInput.d.ts.map +1 -1
- package/dist/product-set/control/DateInput.js +2 -2
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +2 -48
- package/dist/product-set/form/ProductSetForm.d.ts +1 -4
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -59
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +2 -0
- package/dist/product-set/form/SelectCategoryModal.d.ts +0 -12
- package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
- package/dist/product-set/form/SelectCategoryModal.js +1 -1
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +3 -0
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +3 -0
- package/dist/product-set/form/index.d.ts +0 -1
- package/dist/product-set/form/index.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/utils/index.d.ts +0 -7
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +1 -10
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +2 -0
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +0 -6
- package/dist/sortable-tree/SortableTreeItem.d.ts +1 -2
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +4 -10
- package/dist/styles/iframe-events/Calendar.scss +1 -0
- package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/dist/styles/iframe-page/PageBody.scss +1 -1
- package/dist/styles/product-set/ProductSetForm.scss +0 -22
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts +1 -1
- package/dist/tiptap-editor/TipTapMenu/extensions/utils.d.ts.map +1 -1
- package/dist/tiptap-editor/TipTapMenu/extensions/utils.js +1 -3
- package/dist/typeahead/Typeahead.d.ts +1 -5
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +2 -9
- package/package.json +7 -9
- package/src/affiliate/form/AffiliateForm.tsx +0 -1
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +28 -29
- package/src/events/edit-event-modal/IntervalInput.tsx +1 -8
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +1 -0
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +85 -82
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +1 -0
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +0 -1
- package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +1 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -1
- package/src/layout/DropDown.tsx +1 -2
- package/src/modals/confirmation/ConfirmModal.tsx +3 -19
- package/src/product-set/card/ProductSetCard.tsx +8 -47
- package/src/product-set/control/DateInput.tsx +1 -2
- package/src/product-set/form/ProductCategoriesControl.tsx +1 -37
- package/src/product-set/form/ProductSetForm.tsx +2 -17
- package/src/product-set/form/ProductZonesControl.tsx +4 -1
- package/src/product-set/form/SelectCategoryModal.tsx +2 -2
- package/src/product-set/form/SubProductsControl.tsx +3 -0
- package/src/product-set/form/VenueMapsControl.tsx +3 -0
- package/src/product-set/form/index.ts +0 -1
- package/src/product-set/product/ProductControl.tsx +1 -0
- package/src/product-set/product/advanced-options/AdvancedOptions.tsx +1 -1
- package/src/product-set/product-zone/ProductZoneControl.tsx +1 -1
- package/src/product-set/utils/index.ts +0 -11
- package/src/sales/booking/results/components/ResultCard.tsx +2 -0
- package/src/snippet/snippet-template/preview/Preview.tsx +0 -6
- package/src/sortable-tree/SortableTreeItem.tsx +0 -6
- package/src/styles/iframe-events/Calendar.scss +1 -0
- package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/src/styles/iframe-page/PageBody.scss +1 -1
- package/src/styles/product-set/ProductSetForm.scss +0 -22
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/tiptap-editor/TipTapMenu/extensions/utils.ts +1 -4
- package/src/typeahead/Typeahead.tsx +1 -15
- package/yarn.lock +33 -59
- package/dist/product-set/form/ProductSetNameControl.d.ts +0 -6
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +0 -1
- package/dist/product-set/form/ProductSetNameControl.js +0 -35
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts +0 -2
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts.map +0 -1
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.js +0 -3
- package/src/product-set/form/ProductSetNameControl.tsx +0 -27
- package/src/tiptap-editor/TipTapMenu/extensions/constants.ts +0 -1
|
@@ -89,13 +89,6 @@ export function IntervalInput({
|
|
|
89
89
|
trigger('end')
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const onChangeRecurrent = (checked: boolean) => {
|
|
93
|
-
setRecurrent(checked)
|
|
94
|
-
if (!checked) {
|
|
95
|
-
setValue('rrule', null)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
92
|
return (
|
|
100
93
|
<>
|
|
101
94
|
<Form.Row className="interval-container">
|
|
@@ -151,7 +144,7 @@ export function IntervalInput({
|
|
|
151
144
|
custom
|
|
152
145
|
checked={recurrent}
|
|
153
146
|
onChange={({ target: { checked } }) => {
|
|
154
|
-
|
|
147
|
+
setRecurrent(checked)
|
|
155
148
|
}}
|
|
156
149
|
disabled={disabled || Boolean(editedProductSet)}
|
|
157
150
|
/>
|
package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx
CHANGED
|
@@ -5,11 +5,9 @@ import { useId } from '@react-aria/utils'
|
|
|
5
5
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
6
6
|
import { HasPermissionProp } from '@licklist/plugins/dist/types/permission/Permission'
|
|
7
7
|
import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper'
|
|
8
|
-
import { getTypeHeadItemsFromMenus } from '../../../../product-set/utils'
|
|
9
8
|
import { ConfirmModal } from '../../../../modals/confirmation/ConfirmModal'
|
|
10
9
|
import { EditEventFormValues } from '../EditEventForm/EditEventForm'
|
|
11
10
|
import { EditEventProductSet } from './component/EditEventProductSet'
|
|
12
|
-
import { Typeahead } from '../../../../typeahead'
|
|
13
11
|
|
|
14
12
|
interface SelectEventProductSetProps extends HasPermissionProp {
|
|
15
13
|
productSets?: ProductSet[]
|
|
@@ -44,21 +42,6 @@ export const SelectEventProductSet = ({
|
|
|
44
42
|
const productSetId = watch('productSetId')
|
|
45
43
|
const editedProductSet = watch('editedProductSet')
|
|
46
44
|
|
|
47
|
-
const typeheadValues = getTypeHeadItemsFromMenus(
|
|
48
|
-
editedProductSet
|
|
49
|
-
? productSets.map((productSet) => {
|
|
50
|
-
if (productSet.id === editedProductSet.id) {
|
|
51
|
-
return editedProductSet
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return productSet
|
|
55
|
-
})
|
|
56
|
-
: productSets,
|
|
57
|
-
)
|
|
58
|
-
const selectedProductSetTypeheadValue = productSetId
|
|
59
|
-
? typeheadValues?.find((typeheadValue) => typeheadValue.id === productSetId)
|
|
60
|
-
: undefined
|
|
61
|
-
|
|
62
45
|
const onEditProductSet = useCallback(
|
|
63
46
|
() => {
|
|
64
47
|
setEditProductSetId(String(productSetId))
|
|
@@ -112,7 +95,6 @@ export const SelectEventProductSet = ({
|
|
|
112
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
96
|
const onSubmit = (value: EditEventFormValues['editedProductSet']) => {
|
|
114
97
|
setShowEditProductSet(false)
|
|
115
|
-
setValue('productSetId', value.id)
|
|
116
98
|
setValue('editedProductSet', value)
|
|
117
99
|
}
|
|
118
100
|
|
|
@@ -128,72 +110,93 @@ export const SelectEventProductSet = ({
|
|
|
128
110
|
<Controller
|
|
129
111
|
control={control}
|
|
130
112
|
name="productSetId"
|
|
131
|
-
render={() =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
113
|
+
render={({ field }) => {
|
|
114
|
+
const fieldValue = String(field.value)
|
|
115
|
+
return (
|
|
116
|
+
<>
|
|
117
|
+
<div className="d-flex align-items-center flex-row w-100">
|
|
118
|
+
<ConfirmModal>
|
|
119
|
+
{(confirm) => (
|
|
120
|
+
<Form.Control
|
|
121
|
+
as="select"
|
|
122
|
+
onChange={(e) =>
|
|
123
|
+
onChangeProductSet(Number(e.target.value), confirm)
|
|
124
|
+
}
|
|
125
|
+
isInvalid={Boolean(errors.productSetId)}
|
|
126
|
+
value={fieldValue}
|
|
127
|
+
>
|
|
128
|
+
<option value="" hidden>
|
|
129
|
+
{t('Design:chooseProductSet')}
|
|
130
|
+
</option>
|
|
131
|
+
{productSets?.map((productSet) => {
|
|
132
|
+
const isCurrentEditedProductSet =
|
|
133
|
+
editedProductSet &&
|
|
134
|
+
editedProductSet?.id === productSet?.id
|
|
135
|
+
return (
|
|
136
|
+
<option key={productSet.id} value={productSet.id}>
|
|
137
|
+
{isCurrentEditedProductSet ||
|
|
138
|
+
productSet.isOverride
|
|
139
|
+
? `[${t('edited')}] ${
|
|
140
|
+
isCurrentEditedProductSet
|
|
141
|
+
? editedProductSet?.name
|
|
142
|
+
: productSet.name
|
|
143
|
+
}`
|
|
144
|
+
: productSet.name}
|
|
145
|
+
</option>
|
|
146
|
+
)
|
|
147
|
+
})}
|
|
148
|
+
</Form.Control>
|
|
149
|
+
)}
|
|
150
|
+
</ConfirmModal>
|
|
151
|
+
|
|
152
|
+
<div className="buttons-container">
|
|
153
|
+
{!showEditProductSet && !editedProductSet && (
|
|
154
|
+
<Button
|
|
155
|
+
variant=""
|
|
156
|
+
className="btn product-set-button mr-4"
|
|
157
|
+
onClick={handleCreateProductSet}
|
|
158
|
+
>
|
|
159
|
+
{t('addNewProductSet')}
|
|
160
|
+
</Button>
|
|
161
|
+
)}
|
|
162
|
+
{showOverrideProductSet && (
|
|
163
|
+
<Button
|
|
164
|
+
variant=""
|
|
165
|
+
className="btn product-set-button "
|
|
166
|
+
onClick={onEditProductSet}
|
|
167
|
+
>
|
|
168
|
+
{isOverrideProductSet
|
|
169
|
+
? t('editOverrides')
|
|
170
|
+
: t('editProductSet')}
|
|
171
|
+
</Button>
|
|
172
|
+
)}
|
|
173
|
+
{showEditProductSet && (
|
|
174
|
+
<Button
|
|
175
|
+
variant=""
|
|
176
|
+
className="btn product-set-button"
|
|
177
|
+
onClick={revertEditProductSet}
|
|
178
|
+
>
|
|
179
|
+
{t('cancelAndRevert')}
|
|
180
|
+
</Button>
|
|
181
|
+
)}
|
|
182
|
+
{!showEditProductSet && editedProductSet && (
|
|
183
|
+
<Button
|
|
184
|
+
variant=""
|
|
185
|
+
className="btn product-set-button ml-4 text-danger"
|
|
186
|
+
onClick={revertEditProductSet}
|
|
187
|
+
>
|
|
188
|
+
{t('undoChanges')}
|
|
189
|
+
</Button>
|
|
190
|
+
)}
|
|
191
|
+
</div>
|
|
189
192
|
</div>
|
|
190
|
-
</div>
|
|
191
193
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
<Form.Control.Feedback type="invalid">
|
|
195
|
+
{errors?.productSetId?.message}
|
|
196
|
+
</Form.Control.Feedback>
|
|
197
|
+
</>
|
|
198
|
+
)
|
|
199
|
+
}}
|
|
197
200
|
/>
|
|
198
201
|
</Form.Group>
|
|
199
202
|
</div>
|
package/src/layout/DropDown.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
2
|
|
|
3
3
|
interface Props {
|
|
4
4
|
children?: React.ReactNode | React.ReactNode[]
|
|
@@ -24,5 +24,4 @@ const DropDown = forwardRef((props: Props, ref: any) => {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
DropDown.displayName = 'DropDown'
|
|
27
|
-
|
|
28
27
|
export default DropDown
|
|
@@ -20,9 +20,6 @@ export type ConfirmModalTypes =
|
|
|
20
20
|
export interface ConfirmModalProps {
|
|
21
21
|
type?: ConfirmModalTypes
|
|
22
22
|
children?: (confirm: (action: ConfirmAction) => void) => ReactNode
|
|
23
|
-
// confirm function memoize the callback function. It's an alternative function
|
|
24
|
-
confirmationHandler?: () => Promise<boolean | undefined>
|
|
25
|
-
disabledButtons?: boolean
|
|
26
23
|
title?: string
|
|
27
24
|
content?: string | ReactNode
|
|
28
25
|
onClose?: () => void
|
|
@@ -40,9 +37,7 @@ export function ConfirmModal({
|
|
|
40
37
|
type = 'default',
|
|
41
38
|
children,
|
|
42
39
|
onClose,
|
|
43
|
-
confirmationHandler,
|
|
44
40
|
title,
|
|
45
|
-
disabledButtons,
|
|
46
41
|
content,
|
|
47
42
|
hideButtons = false,
|
|
48
43
|
}: ConfirmModalProps) {
|
|
@@ -57,16 +52,10 @@ export function ConfirmModal({
|
|
|
57
52
|
setIsOpen(() => true)
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
const handleConfirmation =
|
|
55
|
+
const handleConfirmation = (e) => {
|
|
61
56
|
e.stopPropagation()
|
|
62
|
-
if (!actionRef.current
|
|
63
|
-
|
|
64
|
-
const res = await confirmationHandler()
|
|
65
|
-
if (res) {
|
|
66
|
-
setIsOpen(() => false)
|
|
67
|
-
}
|
|
68
|
-
return
|
|
69
|
-
}
|
|
57
|
+
if (!actionRef.current) return
|
|
58
|
+
|
|
70
59
|
actionRef.current()
|
|
71
60
|
setIsOpen(() => false)
|
|
72
61
|
}
|
|
@@ -99,7 +88,6 @@ export function ConfirmModal({
|
|
|
99
88
|
<Button
|
|
100
89
|
variant="danger"
|
|
101
90
|
className="btn-sm rounded"
|
|
102
|
-
disabled={disabledButtons}
|
|
103
91
|
onClick={handleClose}
|
|
104
92
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
105
93
|
>
|
|
@@ -117,14 +105,12 @@ export function ConfirmModal({
|
|
|
117
105
|
variant="outline"
|
|
118
106
|
className="cancel-button"
|
|
119
107
|
onClick={handleClose}
|
|
120
|
-
disabled={disabledButtons}
|
|
121
108
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
122
109
|
>
|
|
123
110
|
{t('cancel')}
|
|
124
111
|
</Button>
|
|
125
112
|
<Button
|
|
126
113
|
variant="danger"
|
|
127
|
-
disabled={disabledButtons}
|
|
128
114
|
onClick={handleConfirmation}
|
|
129
115
|
data-id={CONFIRM_MODAL_ACTION_CONFIRM}
|
|
130
116
|
>
|
|
@@ -135,7 +121,6 @@ export function ConfirmModal({
|
|
|
135
121
|
<>
|
|
136
122
|
<Button
|
|
137
123
|
variant="danger"
|
|
138
|
-
disabled={disabledButtons}
|
|
139
124
|
onClick={handleClose}
|
|
140
125
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
141
126
|
>
|
|
@@ -143,7 +128,6 @@ export function ConfirmModal({
|
|
|
143
128
|
</Button>
|
|
144
129
|
<Button
|
|
145
130
|
variant="success"
|
|
146
|
-
disabled={disabledButtons}
|
|
147
131
|
onClick={handleConfirmation}
|
|
148
132
|
data-id={CONFIRM_MODAL_ACTION_CONFIRM}
|
|
149
133
|
>
|
|
@@ -9,20 +9,15 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
|
|
|
9
9
|
import { FaEllipsisH, FaEye, FaTrashAlt } from 'react-icons/fa'
|
|
10
10
|
import { ConfirmModal } from '../../modals'
|
|
11
11
|
import { MenuButton } from '../../table/MenuButton'
|
|
12
|
-
import { ProductSetNameControl } from '../form/ProductSetNameControl'
|
|
13
12
|
|
|
14
13
|
export interface ProductSetCardProps extends HasPermissionProp {
|
|
15
14
|
name: string
|
|
16
15
|
rrule?: string
|
|
17
16
|
href: string
|
|
18
|
-
|
|
19
|
-
onChangeDuplicateProductSetName: (value: string) => void
|
|
20
|
-
onCopy: () => Promise<boolean | undefined>
|
|
17
|
+
onCopy: () => void
|
|
21
18
|
onRemove: () => void
|
|
22
|
-
isLoading?: boolean
|
|
23
19
|
className?: string
|
|
24
20
|
override?: number
|
|
25
|
-
duplicateProductSetError?: string
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
export function ProductSetCard({
|
|
@@ -31,10 +26,6 @@ export function ProductSetCard({
|
|
|
31
26
|
href,
|
|
32
27
|
onCopy,
|
|
33
28
|
onRemove,
|
|
34
|
-
onChangeDuplicateProductSetName,
|
|
35
|
-
duplicateProductSetName,
|
|
36
|
-
duplicateProductSetError,
|
|
37
|
-
isLoading,
|
|
38
29
|
className = '',
|
|
39
30
|
hasPermission = true,
|
|
40
31
|
override = 0,
|
|
@@ -44,23 +35,19 @@ export function ProductSetCard({
|
|
|
44
35
|
const productSetCardClasses = `product-set-card ${className}`
|
|
45
36
|
const [isOverlayVisibile, setIsOverlayVisible] = useState(false)
|
|
46
37
|
|
|
47
|
-
const onCardClick = () => {
|
|
48
|
-
RouteService.redirectTo(href)
|
|
49
|
-
}
|
|
50
38
|
return (
|
|
51
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
52
39
|
<div
|
|
53
40
|
role="button"
|
|
54
41
|
tabIndex={0}
|
|
55
42
|
className="border-0 product-set-card-wrapper w-100 pb-0"
|
|
56
|
-
onClick={
|
|
43
|
+
onClick={() => RouteService.redirectTo(href)}
|
|
44
|
+
onKeyUp={() => RouteService.redirectTo(href)}
|
|
57
45
|
>
|
|
58
46
|
<div className={productSetCardClasses}>
|
|
59
47
|
<div className="product-set-card-link">
|
|
60
48
|
<div className="d-flex flex-column">
|
|
61
49
|
<div>
|
|
62
|
-
{name}
|
|
63
|
-
{rrule && `(${RRule.fromString(rrule).toText()})`}
|
|
50
|
+
{name} {rrule && `(${RRule.fromString(rrule).toText()})`}
|
|
64
51
|
</div>
|
|
65
52
|
{!!override && (
|
|
66
53
|
<div className="h6 bold ml-1">
|
|
@@ -92,33 +79,14 @@ export function ProductSetCard({
|
|
|
92
79
|
>
|
|
93
80
|
{hasPermission && (
|
|
94
81
|
<>
|
|
95
|
-
<ListGroup.Item
|
|
96
|
-
action
|
|
97
|
-
as="div"
|
|
98
|
-
role="button"
|
|
99
|
-
tabIndex={0}
|
|
100
|
-
onClick={(e) => e.stopPropagation()}
|
|
101
|
-
>
|
|
82
|
+
<ListGroup.Item action as="div">
|
|
102
83
|
{Boolean(onCopy) && (
|
|
103
|
-
<ConfirmModal
|
|
104
|
-
// confirm function memoize the callback function and it leads to bugs
|
|
105
|
-
confirmationHandler={onCopy}
|
|
106
|
-
disabledButtons={isLoading}
|
|
107
|
-
content={
|
|
108
|
-
<ProductSetNameControl
|
|
109
|
-
value={duplicateProductSetName}
|
|
110
|
-
onChange={onChangeDuplicateProductSetName}
|
|
111
|
-
error={duplicateProductSetError}
|
|
112
|
-
/>
|
|
113
|
-
}
|
|
114
|
-
>
|
|
84
|
+
<ConfirmModal>
|
|
115
85
|
{(confirm) => (
|
|
116
86
|
<MenuButton
|
|
117
87
|
onClick={() => {
|
|
118
88
|
setIsOverlayVisible(false)
|
|
119
|
-
|
|
120
|
-
// confirm function memoize the callback function and it leads to bugs
|
|
121
|
-
confirm(() => {})
|
|
89
|
+
confirm(onCopy)
|
|
122
90
|
}}
|
|
123
91
|
name={t('duplicate')}
|
|
124
92
|
className="product-set-card-menu-item-text"
|
|
@@ -127,14 +95,7 @@ export function ProductSetCard({
|
|
|
127
95
|
</ConfirmModal>
|
|
128
96
|
)}
|
|
129
97
|
</ListGroup.Item>
|
|
130
|
-
<ListGroup.Item
|
|
131
|
-
action
|
|
132
|
-
className="text-danger"
|
|
133
|
-
as="div"
|
|
134
|
-
role="button"
|
|
135
|
-
tabIndex={0}
|
|
136
|
-
onClick={(e) => e.stopPropagation()}
|
|
137
|
-
>
|
|
98
|
+
<ListGroup.Item action className="text-danger" as="div">
|
|
138
99
|
{Boolean(onRemove) && (
|
|
139
100
|
<ConfirmModal>
|
|
140
101
|
{(confirm) => (
|
|
@@ -247,8 +247,7 @@ export const DateInput = ({
|
|
|
247
247
|
menuRecurrence={menuRecurrence}
|
|
248
248
|
onEdit={() => handleOnEdit(menuRecurrence, index)}
|
|
249
249
|
errorMessage={
|
|
250
|
-
errors?.menuRecurrences?.[`${index}`]?.availableTimes
|
|
251
|
-
?.message || errors?.menuRecurrences?.[`${index}`]?.message
|
|
250
|
+
errors?.menuRecurrences?.[`${index}`]?.availableTimes?.message
|
|
252
251
|
}
|
|
253
252
|
/>
|
|
254
253
|
))}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
useFormContext,
|
|
9
9
|
useWatch,
|
|
10
10
|
} from 'react-hook-form'
|
|
11
|
-
import { FaBars, FaBowlingBall, FaCalendar, FaTicketAlt } from 'react-icons/fa'
|
|
12
11
|
import { useTranslation } from 'react-i18next'
|
|
13
12
|
import { useSensor, MouseSensor } from '@dnd-kit/core'
|
|
14
13
|
import {
|
|
@@ -26,11 +25,7 @@ import { ProductCategoryControl } from '../product-category'
|
|
|
26
25
|
import { ProductCategory } from '../types'
|
|
27
26
|
import { ProductsControl } from './ProductsControl'
|
|
28
27
|
import { ProductSetFormValues, WithIsLoading } from './ProductSetForm'
|
|
29
|
-
import {
|
|
30
|
-
SelectCategoryModal,
|
|
31
|
-
CATEGORY_TYPES_NAMES,
|
|
32
|
-
CategoryConfig,
|
|
33
|
-
} from './SelectCategoryModal'
|
|
28
|
+
import { SelectCategoryModal } from './SelectCategoryModal'
|
|
34
29
|
import { ProductSetLoadingContext } from './context'
|
|
35
30
|
import { VenueMapSetModal } from './VenueMapSetModal'
|
|
36
31
|
import { moveArrayElements, sortArrayByIndex } from '../utils'
|
|
@@ -38,29 +33,6 @@ import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
|
|
|
38
33
|
// @TODO not for first release
|
|
39
34
|
// import Popover from "./ProductSetFormPopover";
|
|
40
35
|
|
|
41
|
-
const CATEGORIES_TYPE: Partial<Record<CategoryType, CategoryConfig>> = {
|
|
42
|
-
[CATEGORY_TYPES_NAMES.tickets]: {
|
|
43
|
-
label: 'tickets',
|
|
44
|
-
icon: <FaTicketAlt color="#0e8ce2" size={10} />,
|
|
45
|
-
},
|
|
46
|
-
[CATEGORY_TYPES_NAMES.bookings]: {
|
|
47
|
-
label: 'bookings',
|
|
48
|
-
icon: <FaCalendar color="#0e8ce2" size={10} />,
|
|
49
|
-
},
|
|
50
|
-
[CATEGORY_TYPES_NAMES.menuItems]: {
|
|
51
|
-
label: 'menuItems',
|
|
52
|
-
icon: <FaBars color="#0e8ce2" size={10} />,
|
|
53
|
-
},
|
|
54
|
-
[CATEGORY_TYPES_NAMES.game]: {
|
|
55
|
-
label: 'game',
|
|
56
|
-
icon: <FaBowlingBall color="#0e8ce2" size={10} />,
|
|
57
|
-
},
|
|
58
|
-
[CATEGORY_TYPES_NAMES.fixedDuration]: {
|
|
59
|
-
label: 'fixedDuration',
|
|
60
|
-
icon: <FaCalendar color="#0e8ce2" size={10} />,
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
|
|
64
36
|
interface ProductCategoriesControlProps extends WithIsLoading {
|
|
65
37
|
stepIndex: number
|
|
66
38
|
isOverrides?: boolean
|
|
@@ -256,8 +228,6 @@ export function ProductCategoriesControl({
|
|
|
256
228
|
setIsExpanded(productCategoryId)
|
|
257
229
|
}
|
|
258
230
|
|
|
259
|
-
const categoryType = CATEGORIES_TYPE[productCategory.type]
|
|
260
|
-
|
|
261
231
|
return (
|
|
262
232
|
<Controller
|
|
263
233
|
key={`product-category-${productCategory._id}`}
|
|
@@ -302,12 +272,6 @@ export function ProductCategoriesControl({
|
|
|
302
272
|
)}
|
|
303
273
|
modalClass={ProductSetModalClasses.category}
|
|
304
274
|
isNewAdded={showCategoryModal}
|
|
305
|
-
itemButton={
|
|
306
|
-
<div className="btn-outline-primary item-icon sm border border-primary rounded-sm">
|
|
307
|
-
{categoryType.icon}
|
|
308
|
-
<span className="ml-2">{t(categoryType.label)}</span>
|
|
309
|
-
</div>
|
|
310
|
-
}
|
|
311
275
|
body={
|
|
312
276
|
<ProductCategoryControl
|
|
313
277
|
isLoading={isLoading}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
2
|
import { FormValues } from '@licklist/plugins/dist/types/services/Form/hook-form-service'
|
|
3
3
|
import { Button, Form, Col, Row } from 'react-bootstrap'
|
|
4
4
|
import { FormProvider, useForm } from 'react-hook-form'
|
|
@@ -22,21 +22,16 @@ import { Step } from '../types'
|
|
|
22
22
|
import { ProductSetContextProvider, ProductSetLoadingContext } from './context'
|
|
23
23
|
import { SelectItem } from '../../types/generic/SelectItem'
|
|
24
24
|
import { checkAvailableTimesErrors, getFilteredTemplates } from '../utils'
|
|
25
|
-
import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
|
|
26
25
|
|
|
27
26
|
export interface WithIsLoading {
|
|
28
27
|
isLoading: boolean
|
|
29
28
|
}
|
|
30
|
-
export interface WithIdOptional {
|
|
31
|
-
id?: number
|
|
32
|
-
}
|
|
33
|
-
|
|
34
29
|
export interface WithId {
|
|
35
30
|
id: number
|
|
36
31
|
}
|
|
37
32
|
export interface ProductSetFormValues
|
|
38
33
|
extends FormValues,
|
|
39
|
-
|
|
34
|
+
WithId,
|
|
40
35
|
ProductSetControlValues {
|
|
41
36
|
steps: Step[]
|
|
42
37
|
isOverrides?: boolean
|
|
@@ -89,7 +84,6 @@ export function ProductSetForm({
|
|
|
89
84
|
onApproveDialog,
|
|
90
85
|
onDeclineDialog,
|
|
91
86
|
} = useDialogContext()
|
|
92
|
-
const [errorMessage, setErrorMessage] = useState('')
|
|
93
87
|
|
|
94
88
|
const form = useForm<ProductSetFormValues>({
|
|
95
89
|
defaultValues,
|
|
@@ -127,9 +121,6 @@ export function ProductSetForm({
|
|
|
127
121
|
if (!serverErrors) {
|
|
128
122
|
return
|
|
129
123
|
}
|
|
130
|
-
if (Array.isArray(serverErrors) && serverErrors[0]) {
|
|
131
|
-
setErrorMessage(serverErrors[0])
|
|
132
|
-
}
|
|
133
124
|
FormErrorService.handleServerErrors(serverErrors, setError)
|
|
134
125
|
}, [serverErrors, setError])
|
|
135
126
|
|
|
@@ -165,12 +156,6 @@ export function ProductSetForm({
|
|
|
165
156
|
onDecline={onDeclineDialog}
|
|
166
157
|
/>
|
|
167
158
|
|
|
168
|
-
<ErrorModal
|
|
169
|
-
message={errorMessage}
|
|
170
|
-
isOpen={!!errorMessage}
|
|
171
|
-
onClose={() => setErrorMessage('')}
|
|
172
|
-
/>
|
|
173
|
-
|
|
174
159
|
<FormProvider {...form}>
|
|
175
160
|
<Form onSubmit={form.handleSubmit(submitHandler(onSubmitAndRedirect))}>
|
|
176
161
|
<ProductSetLoadingContext.Consumer>
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from 'react-icons/fa'
|
|
26
26
|
import { ProductSetLoadingContext } from './context'
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const CATEGORY_TYPES_NAMES = {
|
|
29
29
|
menuItems: CATEGORY_TYPE_MENU_ITEMS,
|
|
30
30
|
tickets: CATEGORY_TYPE_TICKETS,
|
|
31
31
|
bookings: CATEGORY_TYPE_BOOKINGS,
|
|
@@ -33,7 +33,7 @@ export const CATEGORY_TYPES_NAMES = {
|
|
|
33
33
|
fixedDuration: CATEGORY_TYPE_FIXED_DURATION,
|
|
34
34
|
} as const
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
type CategoryConfig = { label: string; icon: ReactElement }
|
|
37
37
|
|
|
38
38
|
const MAIN_CATEGORIES: Partial<Record<CategoryType, CategoryConfig>> = {
|
|
39
39
|
[CATEGORY_TYPES_NAMES.tickets]: {
|
|
@@ -70,6 +70,9 @@ export function SubProductsControl({
|
|
|
70
70
|
images: subProducts[index]?.images as Image[],
|
|
71
71
|
}
|
|
72
72
|
// @ts-expect-error TS2345
|
|
73
|
+
// @TODO fix prod type error
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
|
+
// @ts-ignore
|
|
73
76
|
append(subProductCopy)
|
|
74
77
|
}}
|
|
75
78
|
/>
|
|
@@ -46,6 +46,9 @@ export const VenueMapsControl = ({
|
|
|
46
46
|
url={image.url}
|
|
47
47
|
name={name}
|
|
48
48
|
points={points}
|
|
49
|
+
// @TODO fix prod type error
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
51
|
+
// @ts-ignore
|
|
49
52
|
products={products}
|
|
50
53
|
pointProducts={pointProducts}
|
|
51
54
|
onPointProductsChange={onPointProductsChange}
|