@licklist/design 0.71.18-dev.3 → 0.71.18-dev.4
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/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +18 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +1 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +281 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts +15 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +1 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +89 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts +16 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +447 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts +12 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +45 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts +2 -0
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts.map +1 -0
- package/dist/iframe/ProductWithModifierModal/index.d.ts +2 -0
- package/dist/iframe/ProductWithModifierModal/index.d.ts.map +1 -0
- package/dist/iframe/event/ticket-description/TicketDescription.d.ts +2 -1
- package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
- package/dist/iframe/event/ticket-description/TicketDescription.js +4 -3
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +29 -2
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +4 -0
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +27 -2
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +106 -2
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +3 -1
- 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 +95 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts +22 -0
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts.map +1 -0
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.js +62 -0
- package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts +2 -0
- package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts.map +1 -0
- package/dist/iframe/order-process/components/CategoryProduct/constants.js +4 -0
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts +6 -0
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts.map +1 -0
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.js +18 -0
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +83 -10
- package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/utils/index.js +15 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +2 -2
- package/dist/product-set/form/ProductSetForm.d.ts +3 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +6 -4
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +17 -5
- package/dist/product-set/form/context.d.ts +3 -1
- package/dist/product-set/form/context.d.ts.map +1 -1
- package/dist/product-set/form/context.js +2 -1
- package/dist/product-set/product/ProductControl.d.ts +8 -0
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +25 -1
- package/dist/product-set/utils/index.d.ts +88 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +19 -1
- package/dist/sales/coupon/utils/index.d.ts +2 -1
- package/dist/sales/coupon/utils/index.d.ts.map +1 -1
- package/dist/styles/iframe-page/Page.scss +16 -0
- package/dist/styles/iframe-page/PageBody.scss +4 -0
- package/dist/styles/modals/Modals.scss +16 -0
- package/dist/styles/product-set/ProductSetForm.scss +10 -0
- package/dist/styles/sales/ManualBooking.scss +6 -0
- package/dist/styles/themes/bookedit/index.scss +14 -0
- package/package.json +6 -6
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +205 -0
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +75 -0
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +471 -0
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +55 -0
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts +1 -0
- package/src/iframe/ProductWithModifierModal/index.ts +1 -0
- package/src/iframe/event/ticket-description/TicketDescription.tsx +5 -3
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +32 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +45 -1
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +155 -75
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +58 -1
- package/src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx +84 -0
- package/src/iframe/order-process/components/CategoryProduct/constants.ts +1 -0
- package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +25 -0
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +84 -14
- package/src/iframe/payment/order-items-table/utils/index.ts +23 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +2 -2
- package/src/product-set/form/ProductSetForm.tsx +11 -3
- package/src/product-set/form/ProductsControl.tsx +24 -15
- package/src/product-set/form/context.tsx +5 -0
- package/src/product-set/product/ProductControl.tsx +37 -1
- package/src/product-set/utils/index.ts +19 -0
- package/src/sales/coupon/utils/index.ts +5 -3
- package/src/styles/iframe-page/Page.scss +16 -0
- package/src/styles/iframe-page/PageBody.scss +4 -0
- package/src/styles/modals/Modals.scss +16 -0
- package/src/styles/product-set/ProductSetForm.scss +10 -0
- package/src/styles/sales/ManualBooking.scss +6 -0
- package/src/styles/themes/bookedit/index.scss +14 -0
- package/yarn.lock +171 -199
|
@@ -24,6 +24,22 @@
|
|
|
24
24
|
min-width: auto;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
.manual-booking-form-modal {
|
|
28
|
+
width: 40vw !important;
|
|
29
|
+
left: 60vh;
|
|
30
|
+
|
|
31
|
+
.modal-content {
|
|
32
|
+
height: 96vh;
|
|
33
|
+
margin-left: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include media-breakpoint-down(sm) {
|
|
37
|
+
width: 100vw !important;
|
|
38
|
+
left: 0;
|
|
39
|
+
top: 10% !important;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
.header-block {
|
|
28
44
|
margin-bottom: 1rem;
|
|
29
45
|
}
|
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
z-index: 1080;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.manual-booking-form-modal {
|
|
10
|
+
width: 40vw !important;
|
|
11
|
+
left: 66vw;
|
|
12
|
+
|
|
13
|
+
.modal-content {
|
|
14
|
+
min-height: 95vh;
|
|
15
|
+
margin-left: auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@include media-breakpoint-down(sm) {
|
|
19
|
+
width: 100vw !important;
|
|
20
|
+
left: 0;
|
|
21
|
+
top: 10% !important;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
.confirm-modal {
|
|
10
26
|
z-index: 1081;
|
|
11
27
|
}
|
|
@@ -58,6 +58,11 @@
|
|
|
58
58
|
font-weight: 600;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
.modifier-badge {
|
|
62
|
+
font-size: 0.5rem;
|
|
63
|
+
font-weight: 400;
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
.step-badge {
|
|
62
67
|
background-color: #ffdbdb;
|
|
63
68
|
color: #d52902;
|
|
@@ -81,6 +86,11 @@
|
|
|
81
86
|
background-color: #e9f5ea;
|
|
82
87
|
color: #269b36;
|
|
83
88
|
}
|
|
89
|
+
|
|
90
|
+
.modifier-badge {
|
|
91
|
+
background-color: #e9f5ea;
|
|
92
|
+
color: #269b36;
|
|
93
|
+
}
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
.product-set-mobile-footer {
|
|
@@ -51,6 +51,20 @@
|
|
|
51
51
|
border-bottom: 1px solid #f0f0f0;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
.modifier-header {
|
|
55
|
+
background-color: color('white');
|
|
56
|
+
padding: 0 2.5rem;
|
|
57
|
+
z-index: 2;
|
|
58
|
+
margin-top: 1rem;
|
|
59
|
+
min-height: 2rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.modifier-container {
|
|
63
|
+
background-color: color('white');
|
|
64
|
+
border-bottom: 2px solid #f0f0f0;
|
|
65
|
+
padding-bottom: 1rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
54
68
|
.header-user-image {
|
|
55
69
|
width: 3rem;
|
|
56
70
|
height: 3rem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.71.18-dev.
|
|
3
|
+
"version": "0.71.18-dev.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@licklist/core": "0.31.2-dev.
|
|
45
|
+
"@licklist/core": "0.31.2-dev.10",
|
|
46
46
|
"@licklist/eslint-config": "0.5.6",
|
|
47
|
-
"@licklist/plugins": "0.35.1-dev.
|
|
47
|
+
"@licklist/plugins": "0.35.1-dev.8",
|
|
48
48
|
"lodash": "4.17.21",
|
|
49
49
|
"luxon": "3.5.0",
|
|
50
50
|
"react": "17.0.2",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@dnd-kit/utilities": "2.0.0",
|
|
62
62
|
"@fortawesome/fontawesome-svg-core": "1.2.34",
|
|
63
63
|
"@fortawesome/free-solid-svg-icons": "5.15.2",
|
|
64
|
-
"@licklist/core": "0.31.2-dev.
|
|
64
|
+
"@licklist/core": "0.31.2-dev.10",
|
|
65
65
|
"@licklist/eslint-config": "0.5.6",
|
|
66
|
-
"@licklist/plugins": "0.35.1-dev.
|
|
66
|
+
"@licklist/plugins": "0.35.1-dev.8",
|
|
67
67
|
"@mantine/core": "6.0.22",
|
|
68
68
|
"@mantine/hooks": "6.0.22",
|
|
69
69
|
"@mdx-js/react": "1.6.22",
|
|
@@ -208,4 +208,4 @@
|
|
|
208
208
|
"yarn": "4.4.0"
|
|
209
209
|
},
|
|
210
210
|
"stableVersion": "0.71.4-dev.1"
|
|
211
|
-
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Controller, FormProvider, useForm } from 'react-hook-form'
|
|
2
|
+
import { Button, Form } from 'react-bootstrap'
|
|
3
|
+
import { isEmpty, uniqBy } from 'lodash'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { useIntl } from 'react-intl'
|
|
6
|
+
import { Currency } from '@licklist/core/dist/Config'
|
|
7
|
+
import { MenuStep } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
8
|
+
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
9
|
+
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
10
|
+
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
11
|
+
import { NumberInputHorizontal } from 'src/sales'
|
|
12
|
+
import clsx from 'clsx'
|
|
13
|
+
import { ProductCategory } from 'dist/product-set/types'
|
|
14
|
+
import { MAX_PRODUCT_NUMBER } from '../../order-process/components/CategoryProduct/constants'
|
|
15
|
+
import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
|
|
16
|
+
import { getOrderProductModifiersPrice } from '../../order-process/components/BookingSummary/utils'
|
|
17
|
+
import { ProductControl } from './controll/ProductControll'
|
|
18
|
+
|
|
19
|
+
export interface ManualBookingFormValues {
|
|
20
|
+
steps: MenuStep[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ProductWithModifierSetFormProps {
|
|
24
|
+
onHide: () => void
|
|
25
|
+
product: Product
|
|
26
|
+
category: ProductCategory
|
|
27
|
+
editOrderModifier?: OrderModifierByProduct
|
|
28
|
+
onChange: (product: FormOrderItem) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const filteredOrderModifierSets = (
|
|
32
|
+
modifiersSet: OrderModifier[],
|
|
33
|
+
): OrderModifier[] => {
|
|
34
|
+
if (!modifiersSet) return []
|
|
35
|
+
const orderModifier = modifiersSet
|
|
36
|
+
?.flat()
|
|
37
|
+
.filter((modifier) => !!modifier?.quantity)
|
|
38
|
+
|
|
39
|
+
const filteredOrderModifier = uniqBy(
|
|
40
|
+
orderModifier,
|
|
41
|
+
(item) => `${item.modifierId}-${item.modifierSetId}`,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return filteredOrderModifier || []
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ProductWithModifierSetForm = ({
|
|
48
|
+
product,
|
|
49
|
+
category,
|
|
50
|
+
editOrderModifier,
|
|
51
|
+
onChange,
|
|
52
|
+
}: ProductWithModifierSetFormProps) => {
|
|
53
|
+
const form = useForm({ mode: 'onChange' })
|
|
54
|
+
const { t } = useTranslation(['App', 'Sale', 'Validation'])
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
formState: { errors, isSubmitting },
|
|
58
|
+
control,
|
|
59
|
+
trigger,
|
|
60
|
+
watch,
|
|
61
|
+
} = form
|
|
62
|
+
const defaultProductQuantity = editOrderModifier?.productQuantity ?? 0
|
|
63
|
+
|
|
64
|
+
const valuesOrder = watch()
|
|
65
|
+
const productQuantity = valuesOrder?.product?.quantity
|
|
66
|
+
|
|
67
|
+
const orderModifiersSets =
|
|
68
|
+
valuesOrder[`${product.id}`]?.orderProductModifiers || []
|
|
69
|
+
|
|
70
|
+
const filteredOrderModifiers = filteredOrderModifierSets(orderModifiersSets)
|
|
71
|
+
|
|
72
|
+
const orderModifierSets: OrderModifierByProduct[] = [
|
|
73
|
+
{
|
|
74
|
+
productQuantity: productQuantity ?? 1,
|
|
75
|
+
modifiers: filteredOrderModifiers,
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
const onSubmit = (event) => {
|
|
80
|
+
event.preventDefault()
|
|
81
|
+
trigger()
|
|
82
|
+
|
|
83
|
+
const productOrder: FormOrderItem = {
|
|
84
|
+
id: product.id,
|
|
85
|
+
name: product.name,
|
|
86
|
+
deposit: product?.deposit,
|
|
87
|
+
hasDeposit: category.allowDeposits && product?.deposit < product.price,
|
|
88
|
+
price: product.price,
|
|
89
|
+
productCategoryId: category.id,
|
|
90
|
+
quantity: productQuantity,
|
|
91
|
+
capacity: product?.capacity,
|
|
92
|
+
orderModifiersSets: orderModifierSets,
|
|
93
|
+
}
|
|
94
|
+
if (productOrder) {
|
|
95
|
+
return onChange(productOrder)
|
|
96
|
+
}
|
|
97
|
+
return undefined
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const handleProductQuantityChange = (
|
|
101
|
+
value: number,
|
|
102
|
+
onChange: (val: number) => void,
|
|
103
|
+
) => {
|
|
104
|
+
if (value < 0) {
|
|
105
|
+
onChange(0)
|
|
106
|
+
} else if (value > MAX_PRODUCT_NUMBER) {
|
|
107
|
+
onChange(MAX_PRODUCT_NUMBER)
|
|
108
|
+
} else {
|
|
109
|
+
onChange(value)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const modifierPrice = getOrderProductModifiersPrice(orderModifierSets[0])
|
|
114
|
+
const productWithModifierPrice =
|
|
115
|
+
(product.price * productQuantity || 0) + modifierPrice
|
|
116
|
+
const { formatNumber } = useIntl()
|
|
117
|
+
const formatToCurrency = (value: number) =>
|
|
118
|
+
formatNumber(value, { style: 'currency', currency: Currency.GBP })
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<FormProvider {...form}>
|
|
122
|
+
<Form>
|
|
123
|
+
<div className='manual-booking-form'>
|
|
124
|
+
<ProductControl
|
|
125
|
+
product={product}
|
|
126
|
+
errors={errors}
|
|
127
|
+
editOrderModifier={editOrderModifier}
|
|
128
|
+
/>
|
|
129
|
+
<div className='bg-light m-2 p-2 rounded'>
|
|
130
|
+
<Controller
|
|
131
|
+
control={control}
|
|
132
|
+
name='product.quantity'
|
|
133
|
+
rules={{
|
|
134
|
+
min: {
|
|
135
|
+
value: 1,
|
|
136
|
+
message: t('Validation:fieldMinNumber', {
|
|
137
|
+
attribute: t('minItems'),
|
|
138
|
+
min: 1,
|
|
139
|
+
}) as string,
|
|
140
|
+
},
|
|
141
|
+
max: {
|
|
142
|
+
value: !product.isUnlimited
|
|
143
|
+
? product.maxQuantity
|
|
144
|
+
: MAX_PRODUCT_NUMBER,
|
|
145
|
+
message: t('Validation:fieldMaxNumber', {
|
|
146
|
+
attribute: t('maxItems'),
|
|
147
|
+
max: product.maxQuantity,
|
|
148
|
+
}) as string,
|
|
149
|
+
},
|
|
150
|
+
}}
|
|
151
|
+
render={({
|
|
152
|
+
field: { onChange, value, ref },
|
|
153
|
+
fieldState: { invalid, error },
|
|
154
|
+
}) => (
|
|
155
|
+
<div className='mb-8 d-flex flex-column'>
|
|
156
|
+
<div className='quantity-container-product w-100'>
|
|
157
|
+
<NumberInputHorizontal
|
|
158
|
+
ref={ref}
|
|
159
|
+
size='big'
|
|
160
|
+
onChange={(val) =>
|
|
161
|
+
handleProductQuantityChange(val, onChange)
|
|
162
|
+
}
|
|
163
|
+
onMinusClick={(val) =>
|
|
164
|
+
handleProductQuantityChange(val, onChange)
|
|
165
|
+
}
|
|
166
|
+
onPlusClick={(val) => {
|
|
167
|
+
handleProductQuantityChange(val, onChange)
|
|
168
|
+
}}
|
|
169
|
+
min={0}
|
|
170
|
+
max={100}
|
|
171
|
+
value={value || defaultProductQuantity}
|
|
172
|
+
className={clsx(invalid && 'error')}
|
|
173
|
+
isLoading={isSubmitting}
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
<div className=' d-flex justify-content-center'>
|
|
177
|
+
<div className='price pl-5'>
|
|
178
|
+
{formatToCurrency(product.price)}
|
|
179
|
+
</div>
|
|
180
|
+
{error?.message && (
|
|
181
|
+
<div className='d-flex justify-content-center mt-3 w-100'>
|
|
182
|
+
<p className='iframe-event__message-error'>
|
|
183
|
+
{error.message}
|
|
184
|
+
</p>
|
|
185
|
+
</div>
|
|
186
|
+
)}
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
)}
|
|
190
|
+
/>
|
|
191
|
+
<Button
|
|
192
|
+
as='button'
|
|
193
|
+
variant='primary'
|
|
194
|
+
className='w-100'
|
|
195
|
+
disabled={!productQuantity || !isEmpty(errors)}
|
|
196
|
+
onClick={onSubmit}
|
|
197
|
+
>
|
|
198
|
+
{`${t('App:add')}${modifierPrice ? ` (${formatToCurrency(productWithModifierPrice)})` : ''}`}
|
|
199
|
+
</Button>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</Form>
|
|
203
|
+
</FormProvider>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useDialogContext, DialogContextProvider } from 'src/modals'
|
|
2
|
+
import { Modal } from 'react-bootstrap'
|
|
3
|
+
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
4
|
+
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
5
|
+
import { TicketDescription } from 'src/iframe/event'
|
|
6
|
+
import clsx from 'clsx'
|
|
7
|
+
import { ProductCategory } from 'dist/product-set/types'
|
|
8
|
+
import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
|
|
9
|
+
import { useOnWindowUnmount } from '../../order-process/components/utils/useOnWindowUnmount'
|
|
10
|
+
import { ProductWithModifierSetForm } from './ProductWithModifierSetForm'
|
|
11
|
+
|
|
12
|
+
interface ProductWithModifierSetModalProps {
|
|
13
|
+
show: boolean
|
|
14
|
+
onHide: () => void
|
|
15
|
+
product: Product
|
|
16
|
+
category: ProductCategory
|
|
17
|
+
editOrderModifier?: OrderModifierByProduct
|
|
18
|
+
onChange: (product: FormOrderItem) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const ProductWithModifierSetModal = ({
|
|
22
|
+
show,
|
|
23
|
+
onHide,
|
|
24
|
+
product,
|
|
25
|
+
category,
|
|
26
|
+
onChange,
|
|
27
|
+
editOrderModifier,
|
|
28
|
+
}: ProductWithModifierSetModalProps) => {
|
|
29
|
+
const { onBeforeUnload, onPopState } = useDialogContext()
|
|
30
|
+
useOnWindowUnmount({ onBeforeUnload, onPopState })
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<DialogContextProvider>
|
|
34
|
+
<Modal
|
|
35
|
+
onHide={onHide}
|
|
36
|
+
show={show}
|
|
37
|
+
className='m-0 manual-booking-form-modal mt-0 h-100 p-0'
|
|
38
|
+
dialogClassName='manual-booking-dialog mt-0'
|
|
39
|
+
>
|
|
40
|
+
<div className='close-button'>
|
|
41
|
+
<button
|
|
42
|
+
type='button'
|
|
43
|
+
onClick={onHide}
|
|
44
|
+
onKeyPress={onHide}
|
|
45
|
+
className='btn btn-light rounded-circle position-absolute top-0 end-0 m-2'
|
|
46
|
+
>
|
|
47
|
+
×
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
<div className='right-block' id='select-event-container'>
|
|
51
|
+
<div className='manual-booking-container'>
|
|
52
|
+
<div className='manual-booking-header'>
|
|
53
|
+
<TicketDescription
|
|
54
|
+
title={product.name}
|
|
55
|
+
description={product.description}
|
|
56
|
+
className={clsx('iframe-event__product-description')}
|
|
57
|
+
classNameProductModal='d-block'
|
|
58
|
+
images={product.images}
|
|
59
|
+
isRequired={product.isRequired}
|
|
60
|
+
canExpand
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
<ProductWithModifierSetForm
|
|
64
|
+
product={product}
|
|
65
|
+
onHide={onHide}
|
|
66
|
+
editOrderModifier={editOrderModifier}
|
|
67
|
+
onChange={onChange}
|
|
68
|
+
category={category}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</Modal>
|
|
73
|
+
</DialogContextProvider>
|
|
74
|
+
)
|
|
75
|
+
}
|