@licklist/design 0.71.18-dev.18 → 0.71.18-dev.3
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/IntervalInput.d.ts +1 -3
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +4 -11
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -3
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -14
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +0 -1
- package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts +1 -5
- package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
- package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.js +3 -5
- package/dist/events/event-statistic-modal/utils/index.js +3 -3
- package/dist/iframe/event/ticket-description/TicketDescription.d.ts +1 -3
- package/dist/iframe/event/ticket-description/TicketDescription.d.ts.map +1 -1
- package/dist/iframe/event/ticket-description/TicketDescription.js +7 -10
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -2
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +1 -5
- 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 +1 -12
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts +0 -4
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +2 -29
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +2 -106
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -3
- 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 +1 -95
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +10 -83
- package/dist/iframe/payment/order-items-table/utils/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/utils/index.js +0 -15
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +2 -2
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -4
- package/dist/index.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts +1 -3
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +4 -6
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +5 -24
- package/dist/product-set/form/context.d.ts +1 -3
- package/dist/product-set/form/context.d.ts.map +1 -1
- package/dist/product-set/form/context.js +1 -2
- package/dist/product-set/product/ProductControl.d.ts +0 -8
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -25
- package/dist/product-set/utils/index.d.ts +0 -88
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +1 -19
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/sales/coupon/utils/index.d.ts +1 -2
- package/dist/sales/coupon/utils/index.d.ts.map +1 -1
- package/dist/styles/date-time-button/DateTimeButton.scss +0 -7
- package/dist/styles/events/EditEventModal.scss +0 -2
- package/dist/styles/iframe-page/Page.scss +0 -16
- package/dist/styles/iframe-page/PageBody.scss +0 -4
- package/dist/styles/modals/Modals.scss +0 -16
- package/dist/styles/product-set/EditProductSetElement.scss +0 -1
- package/dist/styles/product-set/ProductSetForm.scss +0 -11
- package/dist/styles/sales/ManualBooking.scss +0 -6
- package/dist/styles/themes/bookedit/index.scss +0 -19
- package/package.json +6 -6
- package/src/events/edit-event-modal/IntervalInput.tsx +3 -13
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +1 -16
- package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -9
- package/src/events/event-statistic-modal/utils/index.ts +4 -4
- package/src/iframe/event/ticket-description/TicketDescription.tsx +4 -11
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +2 -24
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +1 -42
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +75 -155
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -58
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +14 -84
- package/src/iframe/payment/order-items-table/utils/index.ts +0 -23
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +2 -2
- package/src/iframe/payment/payment-page/PaymentPage.tsx +10 -8
- package/src/product-set/form/ProductSetForm.tsx +3 -11
- package/src/product-set/form/ProductsControl.tsx +15 -33
- package/src/product-set/form/context.tsx +0 -5
- package/src/product-set/product/ProductControl.tsx +1 -37
- package/src/product-set/utils/index.ts +0 -19
- package/src/recurrence-input/RecurrenceInput.tsx +5 -3
- package/src/sales/coupon/utils/index.ts +3 -5
- package/src/styles/date-time-button/DateTimeButton.scss +0 -7
- package/src/styles/events/EditEventModal.scss +0 -2
- package/src/styles/iframe-page/Page.scss +0 -16
- package/src/styles/iframe-page/PageBody.scss +0 -4
- package/src/styles/modals/Modals.scss +0 -16
- package/src/styles/product-set/EditProductSetElement.scss +0 -1
- package/src/styles/product-set/ProductSetForm.scss +0 -11
- package/src/styles/sales/ManualBooking.scss +0 -6
- package/src/styles/themes/bookedit/index.scss +0 -19
- package/yarn.lock +376 -377
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +0 -18
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +0 -295
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts +0 -15
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +0 -90
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts +0 -14
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +0 -404
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts +0 -10
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.js +0 -87
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts +0 -2
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/index.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/index.d.ts +0 -2
- package/dist/iframe/ProductWithModifierModal/index.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/utils.d.ts +0 -5
- package/dist/iframe/ProductWithModifierModal/utils.d.ts.map +0 -1
- package/dist/iframe/ProductWithModifierModal/utils.js +0 -21
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts +0 -23
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.d.ts.map +0 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.js +0 -62
- package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts +0 -2
- package/dist/iframe/order-process/components/CategoryProduct/constants.d.ts.map +0 -1
- package/dist/iframe/order-process/components/CategoryProduct/constants.js +0 -4
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts +0 -6
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.d.ts.map +0 -1
- package/dist/iframe/order-process/components/utils/useOnWindowUnmount.js +0 -18
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +0 -212
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +0 -76
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +0 -393
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +0 -98
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/index.ts +0 -1
- package/src/iframe/ProductWithModifierModal/index.ts +0 -1
- package/src/iframe/ProductWithModifierModal/utils.ts +0 -29
- package/src/iframe/order-process/components/CategoryProduct/components/ProductWithModifier/ProductWithModifier.tsx +0 -86
- package/src/iframe/order-process/components/CategoryProduct/constants.ts +0 -1
- package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +0 -25
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/CategoryProduct/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,SAAS,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type UseOnWindowUnmountProps = {
|
|
2
|
-
onBeforeUnload: (event: Event) => void;
|
|
3
|
-
onPopState: (event: Event) => void;
|
|
4
|
-
};
|
|
5
|
-
export declare const useOnWindowUnmount: ({ onBeforeUnload, onPopState, }: UseOnWindowUnmountProps) => any;
|
|
6
|
-
//# sourceMappingURL=useOnWindowUnmount.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnWindowUnmount.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/utils/useOnWindowUnmount.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,kBAAkB,oCAG5B,uBAAuB,QAczB,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
var useOnWindowUnmount = function(param) {
|
|
4
|
-
var onBeforeUnload = param.onBeforeUnload, onPopState = param.onPopState;
|
|
5
|
-
useEffect(function() {
|
|
6
|
-
window.history.pushState(null, '', window.location.pathname);
|
|
7
|
-
window.addEventListener('beforeunload', onBeforeUnload);
|
|
8
|
-
window.addEventListener('popstate', onPopState);
|
|
9
|
-
return function() {
|
|
10
|
-
window.removeEventListener('beforeunload', onBeforeUnload);
|
|
11
|
-
window.removeEventListener('popstate', onPopState);
|
|
12
|
-
};
|
|
13
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
}, []);
|
|
15
|
-
return null;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useOnWindowUnmount };
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { Controller, FormProvider, useForm } from 'react-hook-form'
|
|
3
|
-
import { Button, Form } from 'react-bootstrap'
|
|
4
|
-
import { isEmpty, uniqBy } from 'lodash'
|
|
5
|
-
import { useTranslation } from 'react-i18next'
|
|
6
|
-
import { useIntl } from 'react-intl'
|
|
7
|
-
import { Currency } from '@licklist/core/dist/Config'
|
|
8
|
-
import { MenuStep } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
9
|
-
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
10
|
-
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
11
|
-
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
12
|
-
import { NumberInputHorizontal } from 'src/sales'
|
|
13
|
-
import clsx from 'clsx'
|
|
14
|
-
import { ProductCategory } from 'dist/product-set/types'
|
|
15
|
-
import { MAX_PRODUCT_NUMBER } from '../../order-process/components/CategoryProduct/constants'
|
|
16
|
-
import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
|
|
17
|
-
import { getOrderProductModifiersPrice } from '../../order-process/components/BookingSummary/utils'
|
|
18
|
-
import { ProductControl } from './controll/ProductControll'
|
|
19
|
-
|
|
20
|
-
export interface ManualBookingFormValues {
|
|
21
|
-
steps: MenuStep[]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ProductWithModifierSetFormProps {
|
|
25
|
-
onHide: () => void
|
|
26
|
-
product: Product
|
|
27
|
-
category: ProductCategory
|
|
28
|
-
editOrderModifier?: OrderModifierByProduct
|
|
29
|
-
onChange: (product: FormOrderItem) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const filteredOrderModifierSets = (
|
|
33
|
-
modifiersSet: OrderModifier[],
|
|
34
|
-
): OrderModifier[] => {
|
|
35
|
-
if (!modifiersSet) return []
|
|
36
|
-
const orderModifier = modifiersSet
|
|
37
|
-
?.flat()
|
|
38
|
-
.filter((modifier) => !!modifier?.quantity)
|
|
39
|
-
|
|
40
|
-
const filteredOrderModifier = uniqBy(
|
|
41
|
-
orderModifier,
|
|
42
|
-
(item) => `${item.modifierId}-${item.modifierSetId}`,
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
return filteredOrderModifier || []
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const ProductWithModifierSetForm = ({
|
|
49
|
-
product,
|
|
50
|
-
category,
|
|
51
|
-
editOrderModifier,
|
|
52
|
-
onChange,
|
|
53
|
-
}: ProductWithModifierSetFormProps) => {
|
|
54
|
-
const form = useForm({ mode: 'onChange' })
|
|
55
|
-
const { t } = useTranslation(['App', 'Sale', 'Validation'])
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
formState: { errors, isSubmitting, isValid },
|
|
59
|
-
control,
|
|
60
|
-
trigger,
|
|
61
|
-
watch,
|
|
62
|
-
} = form
|
|
63
|
-
const defaultProductQuantity = editOrderModifier?.productQuantity ?? 0
|
|
64
|
-
|
|
65
|
-
const valuesOrder = watch()
|
|
66
|
-
const productQuantity = valuesOrder?.product?.quantity ?? defaultProductQuantity
|
|
67
|
-
|
|
68
|
-
const orderModifiersSets =
|
|
69
|
-
valuesOrder[`${product.id}`]?.orderProductModifiers || []
|
|
70
|
-
|
|
71
|
-
const filteredOrderModifiers = filteredOrderModifierSets(orderModifiersSets)
|
|
72
|
-
|
|
73
|
-
const orderModifierSets: OrderModifierByProduct[] = useMemo(() => [
|
|
74
|
-
{
|
|
75
|
-
productQuantity: productQuantity ?? 1,
|
|
76
|
-
modifiers: filteredOrderModifiers,
|
|
77
|
-
},
|
|
78
|
-
]
|
|
79
|
-
, [filteredOrderModifiers, productQuantity])
|
|
80
|
-
|
|
81
|
-
const onSubmit = (event) => {
|
|
82
|
-
event.preventDefault()
|
|
83
|
-
trigger(`${product.id}`)
|
|
84
|
-
|
|
85
|
-
if (!isValid) return undefined
|
|
86
|
-
const productOrder: FormOrderItem = {
|
|
87
|
-
id: product.id,
|
|
88
|
-
name: product.name,
|
|
89
|
-
deposit: product?.deposit,
|
|
90
|
-
hasDeposit: category.allowDeposits && product?.deposit < product.price,
|
|
91
|
-
price: product.price,
|
|
92
|
-
productCategoryId: category.id,
|
|
93
|
-
quantity: productQuantity,
|
|
94
|
-
capacity: product?.capacity,
|
|
95
|
-
orderModifiersSets: orderModifierSets,
|
|
96
|
-
}
|
|
97
|
-
if (productOrder) {
|
|
98
|
-
return onChange(productOrder)
|
|
99
|
-
}
|
|
100
|
-
return undefined
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const handleProductQuantityChange = (
|
|
104
|
-
value: number,
|
|
105
|
-
onChange: (val: number) => void,
|
|
106
|
-
) => {
|
|
107
|
-
if (value < 0) {
|
|
108
|
-
onChange(0)
|
|
109
|
-
} else if (value > MAX_PRODUCT_NUMBER) {
|
|
110
|
-
onChange(MAX_PRODUCT_NUMBER)
|
|
111
|
-
} else {
|
|
112
|
-
onChange(value)
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const disabledAddButton = useMemo(() => {
|
|
117
|
-
if (defaultProductQuantity) return false
|
|
118
|
-
return !productQuantity || !isEmpty(errors)
|
|
119
|
-
}, [defaultProductQuantity, productQuantity, errors])
|
|
120
|
-
|
|
121
|
-
const modifierPrice = getOrderProductModifiersPrice(orderModifierSets[0])
|
|
122
|
-
const productWithModifierPrice =
|
|
123
|
-
(product.price * productQuantity || 0) + modifierPrice
|
|
124
|
-
const { formatNumber } = useIntl()
|
|
125
|
-
const formatToCurrency = (value: number) =>
|
|
126
|
-
formatNumber(value, { style: 'currency', currency: Currency.GBP })
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<FormProvider {...form}>
|
|
130
|
-
<Form>
|
|
131
|
-
<div className='manual-booking-form'>
|
|
132
|
-
<ProductControl
|
|
133
|
-
product={product}
|
|
134
|
-
editOrderModifier={editOrderModifier}
|
|
135
|
-
/>
|
|
136
|
-
<div className='bg-light m-2 p-2 rounded'>
|
|
137
|
-
<Controller
|
|
138
|
-
control={control}
|
|
139
|
-
name='product.quantity'
|
|
140
|
-
rules={{
|
|
141
|
-
min: {
|
|
142
|
-
value: 1,
|
|
143
|
-
message: t('Validation:fieldMinNumber', {
|
|
144
|
-
attribute: t('product'),
|
|
145
|
-
min: 1,
|
|
146
|
-
}) as string,
|
|
147
|
-
},
|
|
148
|
-
max: {
|
|
149
|
-
value: !product.isUnlimited
|
|
150
|
-
? product.maxQuantity
|
|
151
|
-
: MAX_PRODUCT_NUMBER,
|
|
152
|
-
message: t('Validation:fieldMaxNumber', {
|
|
153
|
-
attribute: t('product'),
|
|
154
|
-
max: product.maxQuantity,
|
|
155
|
-
}) as string,
|
|
156
|
-
},
|
|
157
|
-
}}
|
|
158
|
-
render={({
|
|
159
|
-
field: { onChange, value, ref },
|
|
160
|
-
fieldState: { invalid, error },
|
|
161
|
-
}) => (
|
|
162
|
-
<div className='mb-8 d-flex flex-column'>
|
|
163
|
-
<div className='quantity-container-product w-100'>
|
|
164
|
-
<NumberInputHorizontal
|
|
165
|
-
ref={ref}
|
|
166
|
-
size='big'
|
|
167
|
-
onChange={(val) =>
|
|
168
|
-
handleProductQuantityChange(val, onChange)
|
|
169
|
-
}
|
|
170
|
-
onMinusClick={(val) =>
|
|
171
|
-
handleProductQuantityChange(val, onChange)
|
|
172
|
-
}
|
|
173
|
-
onPlusClick={(val) => {
|
|
174
|
-
handleProductQuantityChange(val, onChange)
|
|
175
|
-
}}
|
|
176
|
-
min={0}
|
|
177
|
-
max={100}
|
|
178
|
-
value={value || defaultProductQuantity}
|
|
179
|
-
className={clsx(invalid && 'error')}
|
|
180
|
-
isLoading={isSubmitting}
|
|
181
|
-
/>
|
|
182
|
-
</div>
|
|
183
|
-
<div className=' d-flex flex-column align-items-center justify-content-center'>
|
|
184
|
-
<div className='modifier-price pb-4 pl-5'>
|
|
185
|
-
{formatToCurrency(product.price)}
|
|
186
|
-
</div>
|
|
187
|
-
{error?.message && (
|
|
188
|
-
<div className='d-flex justify-content-center mt-3 w-100'>
|
|
189
|
-
<p className='iframe-event__message-error'>
|
|
190
|
-
{error.message}
|
|
191
|
-
</p>
|
|
192
|
-
</div>
|
|
193
|
-
)}
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
)}
|
|
197
|
-
/>
|
|
198
|
-
<Button
|
|
199
|
-
as='button'
|
|
200
|
-
variant='primary'
|
|
201
|
-
className='w-100'
|
|
202
|
-
disabled={disabledAddButton}
|
|
203
|
-
onClick={onSubmit}
|
|
204
|
-
>
|
|
205
|
-
{`${t('Design:add')}${modifierPrice ? ` (${formatToCurrency(productWithModifierPrice)})` : ''}`}
|
|
206
|
-
</Button>
|
|
207
|
-
</div>
|
|
208
|
-
</div>
|
|
209
|
-
</Form>
|
|
210
|
-
</FormProvider>
|
|
211
|
-
)
|
|
212
|
-
}
|
package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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={clsx('manual-booking-container', !product.images.length && 'tw-mt-8')}>
|
|
52
|
-
<div className='manual-booking-header'>
|
|
53
|
-
<TicketDescription
|
|
54
|
-
title={product.name}
|
|
55
|
-
description={product.description}
|
|
56
|
-
className={clsx('iframe-event__product-description', !product.images.length && 'mt-6')}
|
|
57
|
-
classNameProductModal='d-block'
|
|
58
|
-
images={product.images}
|
|
59
|
-
isRequired={product.isRequired}
|
|
60
|
-
canExpand
|
|
61
|
-
isModal
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
<ProductWithModifierSetForm
|
|
65
|
-
product={product}
|
|
66
|
-
onHide={onHide}
|
|
67
|
-
editOrderModifier={editOrderModifier}
|
|
68
|
-
onChange={onChange}
|
|
69
|
-
category={category}
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</Modal>
|
|
74
|
-
</DialogContextProvider>
|
|
75
|
-
)
|
|
76
|
-
}
|