@licklist/design 0.68.5-dev.0 → 0.68.5
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.js +1 -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 +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/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 +0 -2
- 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/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 +6 -8
- 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 +4 -4
- 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/event/event-card/IframeEventCard.tsx +29 -30
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +0 -1
- 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/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 +14 -40
- 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
|
@@ -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,16 +138,15 @@ export function IframeEventCard({
|
|
|
138
138
|
/>
|
|
139
139
|
</Card.Text>
|
|
140
140
|
)}
|
|
141
|
-
{!!snippetSetting
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)}
|
|
141
|
+
{!!snippetSetting.displayBookingButtonOnEventList && showMoreInfo && (
|
|
142
|
+
<Button
|
|
143
|
+
className="step-save-btn w-25 mt-4"
|
|
144
|
+
type="button"
|
|
145
|
+
onClick={onClick}
|
|
146
|
+
>
|
|
147
|
+
{t('book')}
|
|
148
|
+
</Button>
|
|
149
|
+
)}
|
|
151
150
|
</div>
|
|
152
151
|
</Card.Body>
|
|
153
152
|
</Card>
|
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}
|
|
@@ -3,7 +3,6 @@ import { SmsTemplate } from '@licklist/core/dist/DataMapper/Notification/SmsTemp
|
|
|
3
3
|
import { TFunction } from 'react-i18next'
|
|
4
4
|
import { UseFormSetError } from 'react-hook-form'
|
|
5
5
|
import { checkIfZoneCategory } from '@licklist/plugins'
|
|
6
|
-
import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper'
|
|
7
6
|
import { TemplateItem } from '../control/ProductSetControl'
|
|
8
7
|
import { ProductSetFormValues } from '../form/ProductSetForm'
|
|
9
8
|
|
|
@@ -13,11 +12,6 @@ interface CheckAvailableTimesErrors {
|
|
|
13
12
|
t: TFunction
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export interface MenuTypeheadItem {
|
|
17
|
-
id: number
|
|
18
|
-
label: string
|
|
19
|
-
value: number
|
|
20
|
-
}
|
|
21
15
|
export const moveArrayElements = <T>(
|
|
22
16
|
array: T[],
|
|
23
17
|
prevIndex: number,
|
|
@@ -89,8 +83,3 @@ export const checkAvailableTimesErrors = ({
|
|
|
89
83
|
})
|
|
90
84
|
return hasError
|
|
91
85
|
}
|
|
92
|
-
|
|
93
|
-
export const getTypeHeadItemsFromMenus = (
|
|
94
|
-
menus?: (ProductSet | ProductSetFormValues)[],
|
|
95
|
-
): MenuTypeheadItem[] =>
|
|
96
|
-
menus?.map((menu) => ({ id: menu.id, value: menu.id, label: menu.name }))
|
|
@@ -307,7 +307,6 @@ export function Preview({
|
|
|
307
307
|
productCategoryId: 57,
|
|
308
308
|
productGroupId: null,
|
|
309
309
|
availableQuantity: 980,
|
|
310
|
-
zoneId: null,
|
|
311
310
|
name: 'Cofee',
|
|
312
311
|
description: '',
|
|
313
312
|
price: 15,
|
|
@@ -316,8 +315,6 @@ export function Preview({
|
|
|
316
315
|
maxQuantity: 15,
|
|
317
316
|
totalQuantity: 980,
|
|
318
317
|
type: 'sale' as const,
|
|
319
|
-
capacity: 0,
|
|
320
|
-
duration: 0,
|
|
321
318
|
weight: 0,
|
|
322
319
|
isAvailable: true,
|
|
323
320
|
isSoldOut: false,
|
|
@@ -336,7 +333,6 @@ export function Preview({
|
|
|
336
333
|
productCategoryId: 57,
|
|
337
334
|
productGroupId: null,
|
|
338
335
|
availableQuantity: 980,
|
|
339
|
-
zoneId: null,
|
|
340
336
|
name: 'Cofee 2',
|
|
341
337
|
description: '',
|
|
342
338
|
price: 15,
|
|
@@ -345,8 +341,6 @@ export function Preview({
|
|
|
345
341
|
maxQuantity: 15,
|
|
346
342
|
totalQuantity: 980,
|
|
347
343
|
type: 'sale' as const,
|
|
348
|
-
capacity: 0,
|
|
349
|
-
duration: 0,
|
|
350
344
|
weight: 0,
|
|
351
345
|
isAvailable: true,
|
|
352
346
|
isSoldOut: false,
|
|
@@ -33,7 +33,6 @@ export interface SortableTreeItemProps {
|
|
|
33
33
|
body: ReactNode
|
|
34
34
|
children?: ReactNode
|
|
35
35
|
preItem?: ReactNode
|
|
36
|
-
itemButton?: ReactNode
|
|
37
36
|
postItem?: ReactNode
|
|
38
37
|
sortableItems?: string[]
|
|
39
38
|
isExpanded?: boolean
|
|
@@ -83,7 +82,6 @@ export function SortableTreeItem({
|
|
|
83
82
|
secondaryBadge,
|
|
84
83
|
setIsExpanded,
|
|
85
84
|
isOverride,
|
|
86
|
-
itemButton,
|
|
87
85
|
}: SortableTreeItemProps) {
|
|
88
86
|
const [expanded, setExpanded] = useState(isExpanded)
|
|
89
87
|
const [isModalVisible, setIsModalVisible] = useState(isNewAdded)
|
|
@@ -289,13 +287,9 @@ export function SortableTreeItem({
|
|
|
289
287
|
className={clsx(
|
|
290
288
|
'sortable-tree-item-title',
|
|
291
289
|
modalLabel && 'sortable-tree-product-set-element-title',
|
|
292
|
-
'd-flex justify-content-between',
|
|
293
290
|
)}
|
|
294
291
|
>
|
|
295
292
|
{title}
|
|
296
|
-
<div className="sortable-tree-item-subtitle">
|
|
297
|
-
{itemButton}
|
|
298
|
-
</div>
|
|
299
293
|
</span>
|
|
300
294
|
{!expanded && (
|
|
301
295
|
<span className="sortable-tree-item-subtitle">
|