@licklist/design 0.68.4 → 0.68.5-dev.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/affiliate/form/AffiliateForm.d.ts.map +1 -1
- package/dist/auth/Login/LoginComponent.js +2 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +35 -40
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +7 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +0 -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 +24 -23
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
- package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.js +2 -2
- 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 +2 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/layout/DropDown.d.ts +2 -1
- package/dist/layout/DropDown.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +172 -8
- package/dist/product-set/card/ProductSetCard.d.ts +6 -2
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +30 -11
- 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 +48 -2
- package/dist/product-set/form/ProductSetForm.d.ts +4 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +59 -1
- package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductSetNameControl.js +35 -0
- package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductZonesControl.js +0 -2
- package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
- 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 +0 -3
- package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
- package/dist/product-set/form/VenueMapsControl.js +0 -3
- package/dist/product-set/form/index.d.ts +1 -0
- 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 +7 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +10 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +0 -2
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +6 -0
- 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 +10 -4
- package/dist/styles/iframe-events/Calendar.scss +0 -1
- package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/dist/styles/product-set/ProductSetForm.scss +22 -0
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts +2 -0
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.d.ts.map +1 -0
- package/dist/tiptap-editor/TipTapMenu/extensions/constants.js +3 -0
- 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 +3 -1
- package/dist/typeahead/Typeahead.d.ts +5 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +9 -2
- package/package.json +9 -7
- package/src/affiliate/form/AffiliateForm.tsx +1 -0
- package/src/auth/Login/LoginComponent.tsx +1 -1
- package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +29 -28
- package/src/events/edit-event-modal/IntervalInput.tsx +8 -1
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +0 -1
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +82 -85
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
- package/src/iframe/event/event-card/IframeEventCard.tsx +30 -29
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
- package/src/layout/DropDown.tsx +2 -1
- package/src/modals/confirmation/ConfirmModal.tsx +19 -3
- package/src/product-set/card/ProductSetCard.tsx +47 -8
- package/src/product-set/control/DateInput.tsx +2 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
- package/src/product-set/form/ProductSetForm.tsx +17 -2
- package/src/product-set/form/ProductSetNameControl.tsx +27 -0
- package/src/product-set/form/ProductZonesControl.tsx +1 -4
- package/src/product-set/form/SelectCategoryModal.tsx +2 -2
- package/src/product-set/form/SubProductsControl.tsx +0 -3
- package/src/product-set/form/VenueMapsControl.tsx +0 -3
- package/src/product-set/form/index.ts +1 -0
- package/src/product-set/product/ProductControl.tsx +0 -1
- 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 +11 -0
- package/src/sales/booking/results/components/ResultCard.tsx +0 -2
- package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
- package/src/sortable-tree/SortableTreeItem.tsx +6 -0
- package/src/styles/iframe-events/Calendar.scss +0 -1
- package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
- package/src/styles/product-set/ProductSetForm.scss +22 -0
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/tiptap-editor/TipTapMenu/extensions/constants.ts +1 -0
- package/src/tiptap-editor/TipTapMenu/extensions/utils.ts +4 -1
- package/src/typeahead/Typeahead.tsx +15 -1
- package/yarn.lock +40 -14
- package/dist/assets/iframe/selectArrow.svg.js +0 -17
package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx
CHANGED
|
@@ -5,9 +5,11 @@ 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'
|
|
8
9
|
import { ConfirmModal } from '../../../../modals/confirmation/ConfirmModal'
|
|
9
10
|
import { EditEventFormValues } from '../EditEventForm/EditEventForm'
|
|
10
11
|
import { EditEventProductSet } from './component/EditEventProductSet'
|
|
12
|
+
import { Typeahead } from '../../../../typeahead'
|
|
11
13
|
|
|
12
14
|
interface SelectEventProductSetProps extends HasPermissionProp {
|
|
13
15
|
productSets?: ProductSet[]
|
|
@@ -42,6 +44,21 @@ export const SelectEventProductSet = ({
|
|
|
42
44
|
const productSetId = watch('productSetId')
|
|
43
45
|
const editedProductSet = watch('editedProductSet')
|
|
44
46
|
|
|
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
|
+
|
|
45
62
|
const onEditProductSet = useCallback(
|
|
46
63
|
() => {
|
|
47
64
|
setEditProductSetId(String(productSetId))
|
|
@@ -95,6 +112,7 @@ export const SelectEventProductSet = ({
|
|
|
95
112
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
113
|
const onSubmit = (value: EditEventFormValues['editedProductSet']) => {
|
|
97
114
|
setShowEditProductSet(false)
|
|
115
|
+
setValue('productSetId', value.id)
|
|
98
116
|
setValue('editedProductSet', value)
|
|
99
117
|
}
|
|
100
118
|
|
|
@@ -110,93 +128,72 @@ export const SelectEventProductSet = ({
|
|
|
110
128
|
<Controller
|
|
111
129
|
control={control}
|
|
112
130
|
name="productSetId"
|
|
113
|
-
render={(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
</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>
|
|
131
|
+
render={() => (
|
|
132
|
+
<>
|
|
133
|
+
<div className="d-flex align-items-center flex-row w-100">
|
|
134
|
+
<ConfirmModal>
|
|
135
|
+
{(confirm) => (
|
|
136
|
+
<Typeahead
|
|
137
|
+
name="productSetId"
|
|
138
|
+
value={selectedProductSetTypeheadValue}
|
|
139
|
+
containerStyles={{ width: '100%' }}
|
|
140
|
+
onChangeValue={(typeheadValue) => {
|
|
141
|
+
onChangeProductSet(Number(typeheadValue.id), confirm)
|
|
142
|
+
}}
|
|
143
|
+
options={typeheadValues}
|
|
144
|
+
placeholder={t('Design:choose')}
|
|
145
|
+
noOptionsMessage={t('Design:noAvailableProductSets')}
|
|
146
|
+
/>
|
|
147
|
+
)}
|
|
148
|
+
</ConfirmModal>
|
|
149
|
+
|
|
150
|
+
<div className="buttons-container">
|
|
151
|
+
{!showEditProductSet && !editedProductSet && (
|
|
152
|
+
<Button
|
|
153
|
+
variant=""
|
|
154
|
+
className="btn product-set-button mr-4"
|
|
155
|
+
onClick={handleCreateProductSet}
|
|
156
|
+
>
|
|
157
|
+
{t('addNewProductSet')}
|
|
158
|
+
</Button>
|
|
159
|
+
)}
|
|
160
|
+
{showOverrideProductSet && (
|
|
161
|
+
<Button
|
|
162
|
+
variant=""
|
|
163
|
+
className="btn product-set-button "
|
|
164
|
+
onClick={onEditProductSet}
|
|
165
|
+
>
|
|
166
|
+
{isOverrideProductSet
|
|
167
|
+
? t('editOverrides')
|
|
168
|
+
: t('editProductSet')}
|
|
169
|
+
</Button>
|
|
170
|
+
)}
|
|
171
|
+
{showEditProductSet && (
|
|
172
|
+
<Button
|
|
173
|
+
variant=""
|
|
174
|
+
className="btn product-set-button"
|
|
175
|
+
onClick={revertEditProductSet}
|
|
176
|
+
>
|
|
177
|
+
{t('cancelAndRevert')}
|
|
178
|
+
</Button>
|
|
179
|
+
)}
|
|
180
|
+
{!showEditProductSet && editedProductSet && (
|
|
181
|
+
<Button
|
|
182
|
+
variant=""
|
|
183
|
+
className="btn product-set-button ml-4 text-danger"
|
|
184
|
+
onClick={revertEditProductSet}
|
|
185
|
+
>
|
|
186
|
+
{t('undoChanges')}
|
|
187
|
+
</Button>
|
|
188
|
+
)}
|
|
192
189
|
</div>
|
|
190
|
+
</div>
|
|
193
191
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}}
|
|
192
|
+
<Form.Control.Feedback type="invalid">
|
|
193
|
+
{errors?.productSetId?.message}
|
|
194
|
+
</Form.Control.Feedback>
|
|
195
|
+
</>
|
|
196
|
+
)}
|
|
200
197
|
/>
|
|
201
198
|
</Form.Group>
|
|
202
199
|
</div>
|
|
@@ -71,56 +71,56 @@ export function IframeEventCard({
|
|
|
71
71
|
className,
|
|
72
72
|
)}
|
|
73
73
|
onClick={
|
|
74
|
-
goToDetails || !snippetSetting
|
|
74
|
+
goToDetails || !snippetSetting?.displayBookingButtonOnEventList
|
|
75
75
|
? onClick
|
|
76
76
|
: undefined
|
|
77
77
|
}
|
|
78
78
|
>
|
|
79
|
-
{showMoreInfo && <div className=
|
|
79
|
+
{showMoreInfo && <div className='iframe-event-card__info-icon'>i</div>}
|
|
80
80
|
{imageSrc && (
|
|
81
81
|
<Card.Img
|
|
82
82
|
className={imageClassName ?? 'card-image'}
|
|
83
|
-
variant=
|
|
84
|
-
as=
|
|
83
|
+
variant='top'
|
|
84
|
+
as='div'
|
|
85
85
|
style={{ backgroundImage: `url("${imageSrc}")` }}
|
|
86
86
|
/>
|
|
87
87
|
)}
|
|
88
88
|
<Card.Body
|
|
89
89
|
className={clsx('d-flex', 'flex-column', !imageSrc && 'no-image')}
|
|
90
90
|
>
|
|
91
|
-
<Card.Title className=
|
|
91
|
+
<Card.Title className='iframe-event-card__title' id={titleId}>
|
|
92
92
|
{title}
|
|
93
93
|
</Card.Title>
|
|
94
94
|
|
|
95
|
-
<div className=
|
|
96
|
-
<Card.Text as=
|
|
97
|
-
<div className=
|
|
98
|
-
<div className=
|
|
95
|
+
<div className='flex-grow-1 iframe-event-card__description'>
|
|
96
|
+
<Card.Text as='div'>
|
|
97
|
+
<div className='d-flex align-items-center mb-3'>
|
|
98
|
+
<div className='icon-wrapper'>
|
|
99
99
|
<CalendarSvg />
|
|
100
100
|
</div>
|
|
101
|
-
<p className=
|
|
102
|
-
<p className=
|
|
101
|
+
<p className='m-0 list-view-hided'>{date}</p>
|
|
102
|
+
<p className='m-0 grid-view-hided'>{shortDate}</p>
|
|
103
103
|
</div>
|
|
104
104
|
</Card.Text>
|
|
105
105
|
|
|
106
106
|
{type && (
|
|
107
|
-
<Card.Text as=
|
|
108
|
-
<div className=
|
|
109
|
-
<div className=
|
|
107
|
+
<Card.Text as='div' className='list-view-hided'>
|
|
108
|
+
<div className='d-flex align-items-center mb-3'>
|
|
109
|
+
<div className='icon-wrapper'>
|
|
110
110
|
<ClockSvg />
|
|
111
111
|
</div>
|
|
112
|
-
<p className=
|
|
112
|
+
<p className='m-0'>{type}</p>
|
|
113
113
|
</div>
|
|
114
114
|
</Card.Text>
|
|
115
115
|
)}
|
|
116
116
|
|
|
117
117
|
{typeof cost === 'number' && (
|
|
118
|
-
<Card.Text as=
|
|
119
|
-
<div className=
|
|
120
|
-
<div className=
|
|
118
|
+
<Card.Text as='div'>
|
|
119
|
+
<div className='d-flex align-items-center mb-3'>
|
|
120
|
+
<div className='icon-wrapper'>
|
|
121
121
|
<TicketSvg />
|
|
122
122
|
</div>
|
|
123
|
-
<p className=
|
|
123
|
+
<p className='m-0'>
|
|
124
124
|
{t('from')}{' '}
|
|
125
125
|
{formatNumber(cost, { style: 'currency', currency: 'GBP' })}
|
|
126
126
|
</p>
|
|
@@ -129,7 +129,7 @@ export function IframeEventCard({
|
|
|
129
129
|
)}
|
|
130
130
|
|
|
131
131
|
{description && (
|
|
132
|
-
<Card.Text as=
|
|
132
|
+
<Card.Text as='div' className='list-view-hided'>
|
|
133
133
|
<TipTapEditor
|
|
134
134
|
viewMode
|
|
135
135
|
disabled
|
|
@@ -138,15 +138,16 @@ export function IframeEventCard({
|
|
|
138
138
|
/>
|
|
139
139
|
</Card.Text>
|
|
140
140
|
)}
|
|
141
|
-
{!!snippetSetting
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
141
|
+
{!!snippetSetting?.displayBookingButtonOnEventList &&
|
|
142
|
+
showMoreInfo && (
|
|
143
|
+
<Button
|
|
144
|
+
className='step-save-btn w-25 mt-4'
|
|
145
|
+
type='button'
|
|
146
|
+
onClick={onClick}
|
|
147
|
+
>
|
|
148
|
+
{t('book')}
|
|
149
|
+
</Button>
|
|
150
|
+
)}
|
|
150
151
|
</div>
|
|
151
152
|
</Card.Body>
|
|
152
153
|
</Card>
|
package/src/layout/DropDown.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef } from 'react'
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
3
|
interface Props {
|
|
4
4
|
children?: React.ReactNode | React.ReactNode[]
|
|
@@ -24,4 +24,5 @@ const DropDown = forwardRef((props: Props, ref: any) => {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
DropDown.displayName = 'DropDown'
|
|
27
|
+
|
|
27
28
|
export default DropDown
|
|
@@ -20,6 +20,9 @@ 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
|
|
23
26
|
title?: string
|
|
24
27
|
content?: string | ReactNode
|
|
25
28
|
onClose?: () => void
|
|
@@ -37,7 +40,9 @@ export function ConfirmModal({
|
|
|
37
40
|
type = 'default',
|
|
38
41
|
children,
|
|
39
42
|
onClose,
|
|
43
|
+
confirmationHandler,
|
|
40
44
|
title,
|
|
45
|
+
disabledButtons,
|
|
41
46
|
content,
|
|
42
47
|
hideButtons = false,
|
|
43
48
|
}: ConfirmModalProps) {
|
|
@@ -52,10 +57,16 @@ export function ConfirmModal({
|
|
|
52
57
|
setIsOpen(() => true)
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
const handleConfirmation = (e) => {
|
|
60
|
+
const handleConfirmation = async (e) => {
|
|
56
61
|
e.stopPropagation()
|
|
57
|
-
if (!actionRef.current) return
|
|
58
|
-
|
|
62
|
+
if (!actionRef.current && !confirmationHandler) return
|
|
63
|
+
if (confirmationHandler) {
|
|
64
|
+
const res = await confirmationHandler()
|
|
65
|
+
if (res) {
|
|
66
|
+
setIsOpen(() => false)
|
|
67
|
+
}
|
|
68
|
+
return
|
|
69
|
+
}
|
|
59
70
|
actionRef.current()
|
|
60
71
|
setIsOpen(() => false)
|
|
61
72
|
}
|
|
@@ -88,6 +99,7 @@ export function ConfirmModal({
|
|
|
88
99
|
<Button
|
|
89
100
|
variant="danger"
|
|
90
101
|
className="btn-sm rounded"
|
|
102
|
+
disabled={disabledButtons}
|
|
91
103
|
onClick={handleClose}
|
|
92
104
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
93
105
|
>
|
|
@@ -105,12 +117,14 @@ export function ConfirmModal({
|
|
|
105
117
|
variant="outline"
|
|
106
118
|
className="cancel-button"
|
|
107
119
|
onClick={handleClose}
|
|
120
|
+
disabled={disabledButtons}
|
|
108
121
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
109
122
|
>
|
|
110
123
|
{t('cancel')}
|
|
111
124
|
</Button>
|
|
112
125
|
<Button
|
|
113
126
|
variant="danger"
|
|
127
|
+
disabled={disabledButtons}
|
|
114
128
|
onClick={handleConfirmation}
|
|
115
129
|
data-id={CONFIRM_MODAL_ACTION_CONFIRM}
|
|
116
130
|
>
|
|
@@ -121,6 +135,7 @@ export function ConfirmModal({
|
|
|
121
135
|
<>
|
|
122
136
|
<Button
|
|
123
137
|
variant="danger"
|
|
138
|
+
disabled={disabledButtons}
|
|
124
139
|
onClick={handleClose}
|
|
125
140
|
data-id={CONFIRM_MODAL_ACTION_DECLINE}
|
|
126
141
|
>
|
|
@@ -128,6 +143,7 @@ export function ConfirmModal({
|
|
|
128
143
|
</Button>
|
|
129
144
|
<Button
|
|
130
145
|
variant="success"
|
|
146
|
+
disabled={disabledButtons}
|
|
131
147
|
onClick={handleConfirmation}
|
|
132
148
|
data-id={CONFIRM_MODAL_ACTION_CONFIRM}
|
|
133
149
|
>
|
|
@@ -9,15 +9,20 @@ 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'
|
|
12
13
|
|
|
13
14
|
export interface ProductSetCardProps extends HasPermissionProp {
|
|
14
15
|
name: string
|
|
15
16
|
rrule?: string
|
|
16
17
|
href: string
|
|
17
|
-
|
|
18
|
+
duplicateProductSetName: string
|
|
19
|
+
onChangeDuplicateProductSetName: (value: string) => void
|
|
20
|
+
onCopy: () => Promise<boolean | undefined>
|
|
18
21
|
onRemove: () => void
|
|
22
|
+
isLoading?: boolean
|
|
19
23
|
className?: string
|
|
20
24
|
override?: number
|
|
25
|
+
duplicateProductSetError?: string
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
export function ProductSetCard({
|
|
@@ -26,6 +31,10 @@ export function ProductSetCard({
|
|
|
26
31
|
href,
|
|
27
32
|
onCopy,
|
|
28
33
|
onRemove,
|
|
34
|
+
onChangeDuplicateProductSetName,
|
|
35
|
+
duplicateProductSetName,
|
|
36
|
+
duplicateProductSetError,
|
|
37
|
+
isLoading,
|
|
29
38
|
className = '',
|
|
30
39
|
hasPermission = true,
|
|
31
40
|
override = 0,
|
|
@@ -35,19 +44,23 @@ export function ProductSetCard({
|
|
|
35
44
|
const productSetCardClasses = `product-set-card ${className}`
|
|
36
45
|
const [isOverlayVisibile, setIsOverlayVisible] = useState(false)
|
|
37
46
|
|
|
47
|
+
const onCardClick = () => {
|
|
48
|
+
RouteService.redirectTo(href)
|
|
49
|
+
}
|
|
38
50
|
return (
|
|
51
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
39
52
|
<div
|
|
40
53
|
role="button"
|
|
41
54
|
tabIndex={0}
|
|
42
55
|
className="border-0 product-set-card-wrapper w-100 pb-0"
|
|
43
|
-
onClick={
|
|
44
|
-
onKeyUp={() => RouteService.redirectTo(href)}
|
|
56
|
+
onClick={onCardClick}
|
|
45
57
|
>
|
|
46
58
|
<div className={productSetCardClasses}>
|
|
47
59
|
<div className="product-set-card-link">
|
|
48
60
|
<div className="d-flex flex-column">
|
|
49
61
|
<div>
|
|
50
|
-
{name}
|
|
62
|
+
{name}
|
|
63
|
+
{rrule && `(${RRule.fromString(rrule).toText()})`}
|
|
51
64
|
</div>
|
|
52
65
|
{!!override && (
|
|
53
66
|
<div className="h6 bold ml-1">
|
|
@@ -79,14 +92,33 @@ export function ProductSetCard({
|
|
|
79
92
|
>
|
|
80
93
|
{hasPermission && (
|
|
81
94
|
<>
|
|
82
|
-
<ListGroup.Item
|
|
95
|
+
<ListGroup.Item
|
|
96
|
+
action
|
|
97
|
+
as="div"
|
|
98
|
+
role="button"
|
|
99
|
+
tabIndex={0}
|
|
100
|
+
onClick={(e) => e.stopPropagation()}
|
|
101
|
+
>
|
|
83
102
|
{Boolean(onCopy) && (
|
|
84
|
-
<ConfirmModal
|
|
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
|
+
>
|
|
85
115
|
{(confirm) => (
|
|
86
116
|
<MenuButton
|
|
87
117
|
onClick={() => {
|
|
88
118
|
setIsOverlayVisible(false)
|
|
89
|
-
|
|
119
|
+
onChangeDuplicateProductSetName(name)
|
|
120
|
+
// confirm function memoize the callback function and it leads to bugs
|
|
121
|
+
confirm(() => {})
|
|
90
122
|
}}
|
|
91
123
|
name={t('duplicate')}
|
|
92
124
|
className="product-set-card-menu-item-text"
|
|
@@ -95,7 +127,14 @@ export function ProductSetCard({
|
|
|
95
127
|
</ConfirmModal>
|
|
96
128
|
)}
|
|
97
129
|
</ListGroup.Item>
|
|
98
|
-
<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
|
+
>
|
|
99
138
|
{Boolean(onRemove) && (
|
|
100
139
|
<ConfirmModal>
|
|
101
140
|
{(confirm) => (
|
|
@@ -247,7 +247,8 @@ export const DateInput = ({
|
|
|
247
247
|
menuRecurrence={menuRecurrence}
|
|
248
248
|
onEdit={() => handleOnEdit(menuRecurrence, index)}
|
|
249
249
|
errorMessage={
|
|
250
|
-
errors?.menuRecurrences?.[`${index}`]?.availableTimes
|
|
250
|
+
errors?.menuRecurrences?.[`${index}`]?.availableTimes
|
|
251
|
+
?.message || errors?.menuRecurrences?.[`${index}`]?.message
|
|
251
252
|
}
|
|
252
253
|
/>
|
|
253
254
|
))}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useFormContext,
|
|
9
9
|
useWatch,
|
|
10
10
|
} from 'react-hook-form'
|
|
11
|
+
import { FaBars, FaBowlingBall, FaCalendar, FaTicketAlt } from 'react-icons/fa'
|
|
11
12
|
import { useTranslation } from 'react-i18next'
|
|
12
13
|
import { useSensor, MouseSensor } from '@dnd-kit/core'
|
|
13
14
|
import {
|
|
@@ -25,7 +26,11 @@ import { ProductCategoryControl } from '../product-category'
|
|
|
25
26
|
import { ProductCategory } from '../types'
|
|
26
27
|
import { ProductsControl } from './ProductsControl'
|
|
27
28
|
import { ProductSetFormValues, WithIsLoading } from './ProductSetForm'
|
|
28
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
SelectCategoryModal,
|
|
31
|
+
CATEGORY_TYPES_NAMES,
|
|
32
|
+
CategoryConfig,
|
|
33
|
+
} from './SelectCategoryModal'
|
|
29
34
|
import { ProductSetLoadingContext } from './context'
|
|
30
35
|
import { VenueMapSetModal } from './VenueMapSetModal'
|
|
31
36
|
import { moveArrayElements, sortArrayByIndex } from '../utils'
|
|
@@ -33,6 +38,29 @@ import { useSortableTreeFunctions } from '../hooks/useSortableTreeFunctions'
|
|
|
33
38
|
// @TODO not for first release
|
|
34
39
|
// import Popover from "./ProductSetFormPopover";
|
|
35
40
|
|
|
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
|
+
|
|
36
64
|
interface ProductCategoriesControlProps extends WithIsLoading {
|
|
37
65
|
stepIndex: number
|
|
38
66
|
isOverrides?: boolean
|
|
@@ -228,6 +256,8 @@ export function ProductCategoriesControl({
|
|
|
228
256
|
setIsExpanded(productCategoryId)
|
|
229
257
|
}
|
|
230
258
|
|
|
259
|
+
const categoryType = CATEGORIES_TYPE[productCategory.type]
|
|
260
|
+
|
|
231
261
|
return (
|
|
232
262
|
<Controller
|
|
233
263
|
key={`product-category-${productCategory._id}`}
|
|
@@ -272,6 +302,12 @@ export function ProductCategoriesControl({
|
|
|
272
302
|
)}
|
|
273
303
|
modalClass={ProductSetModalClasses.category}
|
|
274
304
|
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
|
+
}
|
|
275
311
|
body={
|
|
276
312
|
<ProductCategoryControl
|
|
277
313
|
isLoading={isLoading}
|