@licklist/design 0.71.18-dev.17 → 0.71.18-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events/edit-event-modal/IntervalInput.d.ts +1 -2
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +4 -4
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +1 -2
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +2 -12
- 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 +2 -2
- 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/report/ReportRunnerModal/ReportRunnerModal.d.ts +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.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/sales/modals/refund-modal/RefundModal.d.ts +2 -6
- package/dist/sales/modals/refund-modal/RefundModal.d.ts.map +1 -1
- package/dist/sales/modals/refund-modal/RefundModal.js +4 -8
- package/dist/sales/modals/refund-modal/index.d.ts +2 -2
- package/dist/sales/modals/refund-modal/index.d.ts.map +1 -1
- package/dist/styles/date-time-button/DateTimeButton.scss +1 -8
- 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 -8
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +1 -13
- 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/report/ReportRunnerModal/ReportRunnerModal.tsx +2 -2
- package/src/sales/coupon/utils/index.ts +3 -5
- package/src/sales/modals/refund-modal/RefundModal.tsx +6 -15
- package/src/sales/modals/refund-modal/index.ts +2 -7
- package/src/styles/date-time-button/DateTimeButton.scss +1 -8
- 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,19 +1,14 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
1
|
import clsx from 'clsx'
|
|
3
2
|
import { Button } from 'react-bootstrap'
|
|
4
|
-
import { isEmpty } from 'lodash'
|
|
5
3
|
import { useTranslation } from 'react-i18next'
|
|
6
4
|
import { FieldValues, RefCallBack, UseFormClearErrors } from 'react-hook-form'
|
|
7
5
|
import {
|
|
8
6
|
Product,
|
|
9
7
|
ProductCategory,
|
|
10
8
|
} from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
11
|
-
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
12
9
|
import { NumberInput } from '../NumberInput'
|
|
13
|
-
// eslint-disable-next-line
|
|
14
|
-
import { ProductWithModifierSetModal } from '../../../../../ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal'
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
interface FormOrderItem {
|
|
17
12
|
id: number
|
|
18
13
|
name: string
|
|
19
14
|
price: number
|
|
@@ -22,7 +17,6 @@ export interface FormOrderItem {
|
|
|
22
17
|
deposit?: number | null
|
|
23
18
|
quantity: number
|
|
24
19
|
capacity?: number | null
|
|
25
|
-
orderModifiersSets?: OrderModifierByProduct[] | null
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
interface ProductQuantityInputProps {
|
|
@@ -46,7 +40,6 @@ export const ProductQuantityInput = ({
|
|
|
46
40
|
invalid,
|
|
47
41
|
}: ProductQuantityInputProps) => {
|
|
48
42
|
const { t } = useTranslation('Design')
|
|
49
|
-
const [open, handleOpenModal] = useState(false)
|
|
50
43
|
|
|
51
44
|
const onChange = (quantity: number | null) => {
|
|
52
45
|
_onChange({
|
|
@@ -55,35 +48,12 @@ export const ProductQuantityInput = ({
|
|
|
55
48
|
deposit: product?.deposit,
|
|
56
49
|
hasDeposit: category.allowDeposits && product?.deposit < product.price,
|
|
57
50
|
price: product.price,
|
|
58
|
-
orderModifiersSets: [],
|
|
59
51
|
productCategoryId: category.id,
|
|
60
52
|
quantity,
|
|
61
53
|
capacity: product?.capacity,
|
|
62
54
|
})
|
|
63
55
|
}
|
|
64
56
|
|
|
65
|
-
const onChangeWithModifierSets = (productOrder: FormOrderItem) => {
|
|
66
|
-
if (isEmpty(productInfo)) {
|
|
67
|
-
_onChange(productOrder)
|
|
68
|
-
return handleOpenModal(false)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_onChange({
|
|
72
|
-
id: productInfo.id,
|
|
73
|
-
name: productInfo.name,
|
|
74
|
-
deposit: productInfo?.deposit,
|
|
75
|
-
hasDeposit: productInfo.hasDeposit,
|
|
76
|
-
price: productInfo.price,
|
|
77
|
-
orderModifiersSets: productInfo.orderModifiersSets?.concat(
|
|
78
|
-
productOrder.orderModifiersSets,
|
|
79
|
-
),
|
|
80
|
-
productCategoryId: category.id,
|
|
81
|
-
quantity: productInfo.quantity + productOrder.quantity,
|
|
82
|
-
capacity: productInfo?.capacity,
|
|
83
|
-
})
|
|
84
|
-
return handleOpenModal(false)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
57
|
if (product.isSoldOut) {
|
|
88
58
|
return (
|
|
89
59
|
<div className='iframe-event__sold-out-wrapper'>
|
|
@@ -92,33 +62,6 @@ export const ProductQuantityInput = ({
|
|
|
92
62
|
)
|
|
93
63
|
}
|
|
94
64
|
|
|
95
|
-
if ((product as Product).modifiersSet.length) {
|
|
96
|
-
return (
|
|
97
|
-
<>
|
|
98
|
-
<Button
|
|
99
|
-
ref={refCallback}
|
|
100
|
-
disabled={product.isSoldOut}
|
|
101
|
-
className={clsx(
|
|
102
|
-
`iframe-event__${
|
|
103
|
-
productInfo?.quantity ? 'unselect-product' : 'select-product'
|
|
104
|
-
}`,
|
|
105
|
-
invalid && 'error',
|
|
106
|
-
)}
|
|
107
|
-
onClick={() => handleOpenModal(true)}
|
|
108
|
-
>
|
|
109
|
-
+
|
|
110
|
-
</Button>
|
|
111
|
-
<ProductWithModifierSetModal
|
|
112
|
-
show={open}
|
|
113
|
-
onHide={() => handleOpenModal(false)}
|
|
114
|
-
onChange={onChangeWithModifierSets}
|
|
115
|
-
product={product}
|
|
116
|
-
category={category}
|
|
117
|
-
/>
|
|
118
|
-
</>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
65
|
if (product?.maxAmount === 1) {
|
|
123
66
|
return (
|
|
124
67
|
<Button
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
-
import { uniqueId
|
|
2
|
+
import { uniqueId } from 'lodash'
|
|
3
3
|
import { useIntl } from 'react-intl'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
5
5
|
import { Product } from '@licklist/core/dist/DataMapper/Product/ProductDataMapper'
|
|
6
|
-
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
7
6
|
import {
|
|
8
7
|
PAYMENT_TYPE_VAT,
|
|
9
8
|
PAYMENT_TYPE_FEE,
|
|
@@ -13,10 +12,6 @@ import { StaticTableData } from '../../../../table'
|
|
|
13
12
|
import { getProductQuantityAndPrice, getTotalSumByCategory } from '../utils'
|
|
14
13
|
import { OrderItemsTableProps, SummaryItem } from '../types'
|
|
15
14
|
import { getOrderSummaryItems } from '../utils/paymentSummary'
|
|
16
|
-
import { Order } from '@licklist/core/dist/DataMapper'
|
|
17
|
-
import { OrderPayment } from '@licklist/core/dist/DataMapper/Order/OrderPaymentDataMapper'
|
|
18
|
-
import { OrderProduct } from '@licklist/core/dist/DataMapper/Order/OrderProductDataMapper'
|
|
19
|
-
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
20
15
|
|
|
21
16
|
const CURRENCY_DEFAULT = 'GBP'
|
|
22
17
|
export const PAYMENT_TYPE_TRANSLATE_KEYS = {
|
|
@@ -55,67 +50,19 @@ export const useTableData = ({
|
|
|
55
50
|
),
|
|
56
51
|
})
|
|
57
52
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
deletedAt: order.deletedAt ?? null,
|
|
64
|
-
id: `${order.id}-${idx + 1}`, // Ensuring uniqueness with string concatenation
|
|
65
|
-
orderId: order.orderId ?? null,
|
|
66
|
-
price: order.price ?? 0,
|
|
67
|
-
productId: order.productId ?? '',
|
|
68
|
-
quantity: modGroup.productQuantity ?? 1,
|
|
69
|
-
deposit: order.deposit ?? 0,
|
|
70
|
-
orderProductModifiers: modGroup.modifiers.map((mod) => ({
|
|
71
|
-
modifierId: mod.modifierId ?? '',
|
|
72
|
-
price: mod.price ?? 0,
|
|
73
|
-
productId: mod.productId ?? '',
|
|
74
|
-
quantity: mod.quantity ?? 1,
|
|
75
|
-
modifierSetId: mod.modifierSetId ?? '',
|
|
76
|
-
modifier: mod.modifier ?? null,
|
|
77
|
-
})),
|
|
78
|
-
}))
|
|
79
|
-
})
|
|
80
|
-
: []
|
|
81
|
-
|
|
82
|
-
const renderProductItem = ({
|
|
83
|
-
product,
|
|
84
|
-
productsForCategory,
|
|
85
|
-
}: {
|
|
86
|
-
product: OrderProduct
|
|
87
|
-
productsForCategory: Product[]
|
|
88
|
-
}) => {
|
|
89
|
-
if (product.quantity === 0) {
|
|
90
|
-
return null
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const name =
|
|
94
|
-
productsForCategory.find((item) => item.id === product.productId)?.name || ''
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
key: product.id,
|
|
98
|
-
name,
|
|
99
|
-
quantity: (
|
|
100
|
-
<div className='quantity'>
|
|
101
|
-
<div className='multiplier'>x</div>
|
|
102
|
-
{product.quantity}
|
|
103
|
-
</div>
|
|
104
|
-
),
|
|
105
|
-
price: formatPrice(product.price),
|
|
106
|
-
modifier: product?.orderProductModifiers?.map(renderModifierItem) || [],
|
|
107
|
-
}
|
|
108
|
-
}
|
|
53
|
+
const renderProductItem = (product: Product) => {
|
|
54
|
+
const { quantity, price } = getProductQuantityAndPrice(
|
|
55
|
+
order.orderProducts,
|
|
56
|
+
product,
|
|
57
|
+
)
|
|
109
58
|
|
|
110
|
-
const renderModifierItem = (orderModifier: OrderModifier) => {
|
|
111
|
-
const { quantity, modifier, modifierId, price } = orderModifier
|
|
112
59
|
if (quantity === 0) {
|
|
113
60
|
return null
|
|
114
61
|
}
|
|
115
62
|
|
|
116
63
|
return {
|
|
117
|
-
key:
|
|
118
|
-
name:
|
|
64
|
+
key: product.id,
|
|
65
|
+
name: product.name,
|
|
119
66
|
quantity: (
|
|
120
67
|
<div className='quantity'>
|
|
121
68
|
<div className='multiplier'>x</div>
|
|
@@ -133,33 +80,15 @@ export const useTableData = ({
|
|
|
133
80
|
|
|
134
81
|
return productCategories.reduce(
|
|
135
82
|
(previousValues: StaticTableData[], categoryId) => {
|
|
136
|
-
const
|
|
83
|
+
const products = order.products.filter(
|
|
137
84
|
(product) => product.productCategoryId === categoryId,
|
|
138
85
|
)
|
|
139
86
|
|
|
140
|
-
const products = order.orderProducts.filter((el) =>
|
|
141
|
-
productsForCategory
|
|
142
|
-
.map((product) => product.id)
|
|
143
|
-
.includes(el.productId),
|
|
144
|
-
)
|
|
145
|
-
|
|
146
87
|
if (!products.length) {
|
|
147
88
|
return previousValues
|
|
148
89
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return reworkProductStructure(product)
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
const filteredProducts = flatten(productsWithReworkedModifier).map(
|
|
155
|
-
(product) =>
|
|
156
|
-
renderProductItem({ product , productsForCategory }),
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
const productWithModifier = flatMap(filteredProducts, (item) => [
|
|
160
|
-
item,
|
|
161
|
-
...item.modifier,
|
|
162
|
-
])
|
|
90
|
+
|
|
91
|
+
const filteredProducts = products.map(renderProductItem).filter(Boolean)
|
|
163
92
|
|
|
164
93
|
if (!filteredProducts.length) {
|
|
165
94
|
return previousValues
|
|
@@ -167,8 +96,8 @@ export const useTableData = ({
|
|
|
167
96
|
|
|
168
97
|
return [
|
|
169
98
|
...previousValues,
|
|
170
|
-
renderCategoryItem(
|
|
171
|
-
...
|
|
99
|
+
renderCategoryItem(products),
|
|
100
|
+
...filteredProducts,
|
|
172
101
|
]
|
|
173
102
|
},
|
|
174
103
|
[],
|
|
@@ -204,5 +133,6 @@ export const useTableData = ({
|
|
|
204
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
205
134
|
[order, externalDiscount, isPaymentProcessed],
|
|
206
135
|
)
|
|
136
|
+
|
|
207
137
|
return data
|
|
208
138
|
}
|
|
@@ -6,7 +6,6 @@ import { Product } from '@licklist/core/dist/DataMapper/Product/ProductDataMappe
|
|
|
6
6
|
import { PAYMENT_TYPE_DISCOUNT } from '@licklist/core/dist/DataMapper/Order/PaymentDataMapper'
|
|
7
7
|
import { PaymentDetail } from '@licklist/core/dist/DataMapper/Order/PaymentDetailDataMapper'
|
|
8
8
|
import { PAYMENT_TYPE_TRANSLATE_KEYS } from '../hooks/useTableData'
|
|
9
|
-
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
10
9
|
|
|
11
10
|
const TRANSLATE_KEYS = {
|
|
12
11
|
totalAmount: 'totalPaid',
|
|
@@ -29,7 +28,6 @@ export const calculateTotalPrice = (
|
|
|
29
28
|
order: Order,
|
|
30
29
|
externalPaymentDetails?: ExternalPaymnetDetail[],
|
|
31
30
|
) => {
|
|
32
|
-
|
|
33
31
|
const totalPrice =
|
|
34
32
|
order?.orderProducts?.reduce(
|
|
35
33
|
(total: number, product) =>
|
|
@@ -127,26 +125,5 @@ export const getTotalSumByCategory = (
|
|
|
127
125
|
product,
|
|
128
126
|
)
|
|
129
127
|
|
|
130
|
-
const modifierFromProduct = orderProducts.find(
|
|
131
|
-
(orderProduct) => orderProduct.productId === product.id,
|
|
132
|
-
)?.orderProductModifiers
|
|
133
|
-
if (modifierFromProduct) {
|
|
134
|
-
const modifierPrice = modifierFromProduct.reduce(
|
|
135
|
-
(prevSum: number, { modifiers }) => {
|
|
136
|
-
const modifiersPrices = modifiers.reduce(
|
|
137
|
-
(prevSumModifier: number, modifier: OrderModifier) =>
|
|
138
|
-
prevSumModifier + modifier.price * modifier.quantity,
|
|
139
|
-
0,
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
return prevSum + modifiersPrices
|
|
143
|
-
},
|
|
144
|
-
0,
|
|
145
|
-
)
|
|
146
|
-
const priceWithModifier = price + modifierPrice
|
|
147
|
-
|
|
148
|
-
return prevSum + priceWithModifier * quantity
|
|
149
|
-
}
|
|
150
|
-
|
|
151
128
|
return prevSum + price * quantity
|
|
152
129
|
}, 0)
|
|
@@ -23,7 +23,7 @@ const paymentNotProcessedSummary = ({
|
|
|
23
23
|
? getExternalPaymentDetail(paymentDetail)
|
|
24
24
|
: undefined
|
|
25
25
|
|
|
26
|
-
const total =
|
|
26
|
+
const total = calculateTotalPrice(order, externalPaymentDetail)
|
|
27
27
|
|
|
28
28
|
const summaryItems: SummaryItem[] = [
|
|
29
29
|
{
|
|
@@ -58,7 +58,7 @@ const processedPaymentSummary = ({
|
|
|
58
58
|
price: getPaymentValueByType(order.payments, key),
|
|
59
59
|
}))
|
|
60
60
|
|
|
61
|
-
const total =
|
|
61
|
+
const total = calculateTotalPrice(order, externalPaymentDetail)
|
|
62
62
|
|
|
63
63
|
const totalDiscount = calculateTotalDiscount(order.payments)
|
|
64
64
|
|
|
@@ -131,12 +131,6 @@ export const PaymentPage = ({
|
|
|
131
131
|
const totalPaidWithRemainingToPay =
|
|
132
132
|
data?.amount_to_pay && !!Number(data?.amount_to_pay)
|
|
133
133
|
|
|
134
|
-
const totalBooked = paymentMetadata
|
|
135
|
-
? paymentMetadata.paid
|
|
136
|
-
? paymentMetadata.total - paymentMetadata.paid
|
|
137
|
-
: paymentMetadata.total
|
|
138
|
-
: orderTotalAmountByFormValues + (bookingSummaryProps?.transactionFee ?? 0)
|
|
139
|
-
|
|
140
134
|
return (
|
|
141
135
|
<Page className='payment_link'>
|
|
142
136
|
{/* TODO wait for Brad's design for close and go back buttons */}
|
|
@@ -162,8 +156,16 @@ export const PaymentPage = ({
|
|
|
162
156
|
<BookingSummary
|
|
163
157
|
{...bookingSummaryProps}
|
|
164
158
|
isPaymentPage
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
headerComponent={
|
|
160
|
+
<SummaryTotalBlock
|
|
161
|
+
amount={
|
|
162
|
+
paymentMetadata
|
|
163
|
+
? paymentMetadata.total
|
|
164
|
+
: orderTotalAmountByFormValues +
|
|
165
|
+
(bookingSummaryProps?.transactionFee || 0)
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
}
|
|
167
169
|
footer={
|
|
168
170
|
<div className='d-flex flex-column justify-content-between'>
|
|
169
171
|
{paymentMetadata ? (
|
|
@@ -6,7 +6,6 @@ import { TFunction, useTranslation } from 'react-i18next'
|
|
|
6
6
|
import { VenueMapSet } from '@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper'
|
|
7
7
|
import { ServerError } from '@licklist/plugins/dist/hooks/Api/useHttpQuery'
|
|
8
8
|
import FormErrorService from '@licklist/plugins/dist/services/Form/FormErrorService'
|
|
9
|
-
import { ModifierSet } from '@licklist/core/dist/DataMapper/Product/ModifierSetDataMapper'
|
|
10
9
|
|
|
11
10
|
import { isEqual } from 'lodash'
|
|
12
11
|
// eslint-disable-next-line max-len
|
|
@@ -23,11 +22,7 @@ import {
|
|
|
23
22
|
import { Step } from '../types'
|
|
24
23
|
import { ProductSetContextProvider, ProductSetLoadingContext } from './context'
|
|
25
24
|
import { SelectItem } from '../../types/generic/SelectItem'
|
|
26
|
-
import {
|
|
27
|
-
checkAvailableTimesErrors,
|
|
28
|
-
updateModifiersSetAtProductSetForm,
|
|
29
|
-
getFilteredTemplates,
|
|
30
|
-
} from '../utils'
|
|
25
|
+
import { checkAvailableTimesErrors, getFilteredTemplates } from '../utils'
|
|
31
26
|
import { ErrorModal } from '../../iframe/order-process/components/ErrorModal'
|
|
32
27
|
|
|
33
28
|
export interface WithIsLoading {
|
|
@@ -67,7 +62,6 @@ export interface ProductSetFormProps
|
|
|
67
62
|
saleDeadline?: number
|
|
68
63
|
isCreateNewOverrides?: boolean
|
|
69
64
|
timeZone: string
|
|
70
|
-
modifiersSetList?: ModifierSet[]
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
export function ProductSetForm({
|
|
@@ -77,7 +71,6 @@ export function ProductSetForm({
|
|
|
77
71
|
onSubmitAndRedirect,
|
|
78
72
|
onSubmitNoRedirect,
|
|
79
73
|
productGroupList,
|
|
80
|
-
modifiersSetList,
|
|
81
74
|
serverErrors,
|
|
82
75
|
providerHasMap = false,
|
|
83
76
|
venueMapSets = [],
|
|
@@ -102,7 +95,7 @@ export function ProductSetForm({
|
|
|
102
95
|
const [errorMessage, setErrorMessage] = useState('')
|
|
103
96
|
|
|
104
97
|
const form = useForm<ProductSetFormValues>({
|
|
105
|
-
defaultValues
|
|
98
|
+
defaultValues,
|
|
106
99
|
mode: 'onChange',
|
|
107
100
|
})
|
|
108
101
|
|
|
@@ -129,7 +122,7 @@ export function ProductSetForm({
|
|
|
129
122
|
if (!defaultValues || isEqual(defaultValues, formValues)) {
|
|
130
123
|
return
|
|
131
124
|
}
|
|
132
|
-
reset(
|
|
125
|
+
reset(defaultValues)
|
|
133
126
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
127
|
}, [defaultValues])
|
|
135
128
|
|
|
@@ -169,7 +162,6 @@ export function ProductSetForm({
|
|
|
169
162
|
<ProductSetContextProvider
|
|
170
163
|
productGroupList={productGroupList}
|
|
171
164
|
providerHasMap={providerHasMap}
|
|
172
|
-
modifiersSetList={modifiersSetList}
|
|
173
165
|
venueMapSets={venueMapSets}
|
|
174
166
|
providerHasBookingManagement={providerHasBookingManagement}
|
|
175
167
|
zones={zones}
|
|
@@ -49,8 +49,6 @@ const getDefaultProductValue = (sort: number): Product => ({
|
|
|
49
49
|
maxQuantity: null,
|
|
50
50
|
totalQuantity: 0,
|
|
51
51
|
isAvailable: true,
|
|
52
|
-
modifiersSet: [],
|
|
53
|
-
modifiersSetsId: [],
|
|
54
52
|
isSoldOut: false,
|
|
55
53
|
isRequired: false,
|
|
56
54
|
isUnlimited: false,
|
|
@@ -141,16 +139,6 @@ export function ProductsControl({
|
|
|
141
139
|
],
|
|
142
140
|
})
|
|
143
141
|
|
|
144
|
-
const modifierSets = useWatch({
|
|
145
|
-
control,
|
|
146
|
-
name: [
|
|
147
|
-
...fields.map(
|
|
148
|
-
(_, index) =>
|
|
149
|
-
`${productControlFieldName}.${index}.modifiersSet` as const,
|
|
150
|
-
),
|
|
151
|
-
],
|
|
152
|
-
})
|
|
153
|
-
|
|
154
142
|
const categoryProductErrors =
|
|
155
143
|
errors?.steps?.[stepIndex]?.productCategories?.[productCategoryIndex]
|
|
156
144
|
?.products
|
|
@@ -211,7 +199,6 @@ export function ProductsControl({
|
|
|
211
199
|
: isOverrides && !!product.originalProductId
|
|
212
200
|
|
|
213
201
|
const isNewProductOverrides = isCreateNewOverrides && !!product.id
|
|
214
|
-
const modifiersSets = modifierSets[index]?.length || 0
|
|
215
202
|
|
|
216
203
|
return (
|
|
217
204
|
<Controller
|
|
@@ -239,26 +226,21 @@ export function ProductsControl({
|
|
|
239
226
|
edit={() => edit(index)}
|
|
240
227
|
secondaryBadge={getBadgeConfig(categoryType, t(categoryType))}
|
|
241
228
|
subTitle={
|
|
242
|
-
<div className='
|
|
243
|
-
<div className='product-set-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
</span>
|
|
258
|
-
</div>
|
|
259
|
-
{!!modifiersSets && (
|
|
260
|
-
<Badge className='modifier-badge'>{`${modifiersSets} ${t('modifiersSets')}`}</Badge>
|
|
261
|
-
)}
|
|
229
|
+
<div className='product-set-badges-container'>
|
|
230
|
+
<div className='product-set-subtitle-dot product-set-subtitle-product-dot' />
|
|
231
|
+
<span>
|
|
232
|
+
{`£${prices[index]} ${t('each')} - ${t('qty')}:${
|
|
233
|
+
!isUnlimitedQuantities[index]
|
|
234
|
+
? ` ${quantities[index]}`
|
|
235
|
+
: t(' unlimited')
|
|
236
|
+
} ${
|
|
237
|
+
!isUnlimitedQuantities[index]
|
|
238
|
+
? ` - ${t('possibleRevenue')} £${
|
|
239
|
+
prices[index] * quantities[index]
|
|
240
|
+
}`
|
|
241
|
+
: ''
|
|
242
|
+
} `}
|
|
243
|
+
</span>
|
|
262
244
|
</div>
|
|
263
245
|
}
|
|
264
246
|
modalLabel={t('addNewProduct')}
|
|
@@ -7,18 +7,15 @@ import {
|
|
|
7
7
|
Dispatch,
|
|
8
8
|
} from 'react'
|
|
9
9
|
import { VenueMapSet } from '@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper'
|
|
10
|
-
import { ModifierSet } from '@licklist/core/dist/DataMapper/Product/ModifierSetDataMapper'
|
|
11
10
|
// eslint-disable-next-line max-len
|
|
12
11
|
import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
|
|
13
12
|
import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
|
|
14
13
|
import { SelectItem } from '../../types/generic/SelectItem'
|
|
15
14
|
|
|
16
|
-
|
|
17
15
|
interface LoadingContext {
|
|
18
16
|
isLoading: boolean
|
|
19
17
|
setLoading: (loading: boolean) => void
|
|
20
18
|
productGroupList?: SelectItem[]
|
|
21
|
-
modifiersSetList?: ModifierSet[] | null
|
|
22
19
|
providerHasMap?: boolean | null
|
|
23
20
|
venueMapSets?: VenueMapSet[]
|
|
24
21
|
providerHasBookingManagement?: ProviderBookingManagementSetting['hasBookingManagement']
|
|
@@ -46,7 +43,6 @@ type ProductSetContextProviderProps = PropsWithChildren<
|
|
|
46
43
|
export function ProductSetContextProvider({
|
|
47
44
|
children,
|
|
48
45
|
productGroupList = [],
|
|
49
|
-
modifiersSetList =[],
|
|
50
46
|
providerHasMap = false,
|
|
51
47
|
venueMapSets = [],
|
|
52
48
|
providerHasBookingManagement,
|
|
@@ -66,7 +62,6 @@ export function ProductSetContextProvider({
|
|
|
66
62
|
isLoading: loading,
|
|
67
63
|
setLoading,
|
|
68
64
|
productGroupList,
|
|
69
|
-
modifiersSetList,
|
|
70
65
|
providerHasMap,
|
|
71
66
|
venueMapSets,
|
|
72
67
|
providerHasBookingManagement,
|
|
@@ -39,8 +39,6 @@ import {
|
|
|
39
39
|
IMAGE_TYPE_IMAGE,
|
|
40
40
|
} from '@licklist/core/dist/DataMapper/Media/ImageDataMapper'
|
|
41
41
|
import { FaClipboard } from 'react-icons/fa'
|
|
42
|
-
import { Typeahead } from 'src/typeahead'
|
|
43
|
-
import { convertToTypeaheadOptions } from 'src/sales/coupon/utils'
|
|
44
42
|
import { checkIfZoneCategory } from '@licklist/plugins'
|
|
45
43
|
import { FileUpload } from '../../file-upload'
|
|
46
44
|
import { BooleanSwitch } from '../../static'
|
|
@@ -67,14 +65,6 @@ import { ProductZoneControlValues } from '../product-zone'
|
|
|
67
65
|
import { AdvancedOptions } from './advanced-options'
|
|
68
66
|
import { ProductZonesControl } from '../form/ProductZonesControl'
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
export interface ModifiersSet {
|
|
72
|
-
id: number
|
|
73
|
-
value?: string
|
|
74
|
-
name?: string
|
|
75
|
-
label?: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
68
|
// TO DO refactor this file
|
|
79
69
|
// and add correct types
|
|
80
70
|
export interface ProductControlValues
|
|
@@ -98,8 +88,6 @@ export interface ProductControlValues
|
|
|
98
88
|
hasSpecialNotes: boolean
|
|
99
89
|
minSpend?: number | null
|
|
100
90
|
type?: ProductType
|
|
101
|
-
modifiersSetsId?: Array<ModifiersSet>
|
|
102
|
-
modifiersSet?: Array<ModifiersSet>
|
|
103
91
|
weight?: number
|
|
104
92
|
tierId?: number
|
|
105
93
|
images: Image[] | null
|
|
@@ -123,7 +111,6 @@ export interface ProductControlProps<T>
|
|
|
123
111
|
hasTicket?: boolean
|
|
124
112
|
categoryType?: CategoryType
|
|
125
113
|
isOverrides?: boolean
|
|
126
|
-
|
|
127
114
|
}
|
|
128
115
|
|
|
129
116
|
export function ProductControl<T extends FormValues>({
|
|
@@ -139,7 +126,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
139
126
|
categoryType,
|
|
140
127
|
isOverrides = false,
|
|
141
128
|
}: ProductControlProps<T>) {
|
|
142
|
-
|
|
143
129
|
const {
|
|
144
130
|
register,
|
|
145
131
|
control,
|
|
@@ -149,16 +135,14 @@ export function ProductControl<T extends FormValues>({
|
|
|
149
135
|
watch,
|
|
150
136
|
} = useFormContext<T>()
|
|
151
137
|
|
|
152
|
-
const { setLoading
|
|
138
|
+
const { setLoading } = useContext(ProductSetLoadingContext)
|
|
153
139
|
const { t } = useTranslation(['Design', 'Validation', 'ProductSet'])
|
|
154
140
|
const [expanded, setExpanded] = useState(false)
|
|
155
|
-
|
|
156
141
|
const [initialImages, setInitialImages] = useState<Image[] | null>(null)
|
|
157
142
|
// @TODO: After checking "isUnlimited" checkbox need to reset field totalQuantity
|
|
158
143
|
const isUnlimited = Boolean(
|
|
159
144
|
watch(`${fieldNamePrefix}.isUnlimited` as Path<T>),
|
|
160
145
|
)
|
|
161
|
-
|
|
162
146
|
const advancedId = useId()
|
|
163
147
|
const nameId = useId()
|
|
164
148
|
|
|
@@ -216,7 +200,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
216
200
|
setInitialImages(formImages as Image[])
|
|
217
201
|
}, [getValues, setInitialImages, fieldNamePrefix])
|
|
218
202
|
|
|
219
|
-
|
|
220
203
|
useEffect(() => {
|
|
221
204
|
if (Array.isArray(images)) {
|
|
222
205
|
setValue(
|
|
@@ -229,9 +212,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
229
212
|
|
|
230
213
|
const quantitySelector = quantityValue ?? '1'
|
|
231
214
|
const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string]
|
|
232
|
-
|
|
233
|
-
const modifierList = convertToTypeaheadOptions(modifiersSetList)
|
|
234
|
-
|
|
235
215
|
return (
|
|
236
216
|
<>
|
|
237
217
|
<Row>
|
|
@@ -374,22 +354,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
374
354
|
</Form.Group>
|
|
375
355
|
</Col>
|
|
376
356
|
</Row>
|
|
377
|
-
<Row>
|
|
378
|
-
<Col>
|
|
379
|
-
<Form.Group className='mb-3'>
|
|
380
|
-
<Form.Label>{t('Design:addModifierSet')}</Form.Label>
|
|
381
|
-
<Typeahead
|
|
382
|
-
name='modifierList'
|
|
383
|
-
options={modifierList}
|
|
384
|
-
{...register(`${fieldNamePrefix}.modifiersSet` as Path<T>)}
|
|
385
|
-
isMultipleChoise
|
|
386
|
-
isCouponForm
|
|
387
|
-
placeholder={t('Design:choose')}
|
|
388
|
-
noOptionsMessage={t('Design:noSelectedModifier')}
|
|
389
|
-
/>
|
|
390
|
-
</Form.Group>
|
|
391
|
-
</Col>
|
|
392
|
-
</Row>
|
|
393
357
|
|
|
394
358
|
<Row className='my-4 mx-0 d-flex flex-column'>
|
|
395
359
|
{isZoneCategory && (
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EmailTemplate } from '@licklist/core/dist/DataMapper/Notification/EmailTemplateDataMapper'
|
|
2
2
|
import { SmsTemplate } from '@licklist/core/dist/DataMapper/Notification/SmsTemplateDataMapper'
|
|
3
|
-
import { ModifierSet } from '@licklist/core/dist/DataMapper/Product/ModifierSetDataMapper'
|
|
4
|
-
import { convertToTypeaheadOptions } from 'src/sales/coupon/utils'
|
|
5
3
|
import { TFunction } from 'react-i18next'
|
|
6
4
|
import { UseFormSetError } from 'react-hook-form'
|
|
7
5
|
import { checkIfZoneCategory } from '@licklist/plugins'
|
|
@@ -9,7 +7,6 @@ import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDat
|
|
|
9
7
|
import { TemplateItem } from '../control/ProductSetControl'
|
|
10
8
|
import { ProductSetFormValues } from '../form/ProductSetForm'
|
|
11
9
|
|
|
12
|
-
|
|
13
10
|
interface CheckAvailableTimesErrors {
|
|
14
11
|
values: ProductSetFormValues
|
|
15
12
|
setError: UseFormSetError<ProductSetFormValues>
|
|
@@ -61,22 +58,6 @@ export const getFilteredTemplates = (
|
|
|
61
58
|
}))
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
export const updateModifiersSetAtProductSetForm = (data: ProductSetFormValues) => ({
|
|
65
|
-
...data,
|
|
66
|
-
steps: data.steps.map(step => ({
|
|
67
|
-
...step,
|
|
68
|
-
productCategories: step.productCategories.map(category => ({
|
|
69
|
-
...category,
|
|
70
|
-
products: category.products.map(product => ({
|
|
71
|
-
...product,
|
|
72
|
-
modifiersSet: product?.modifiersSet
|
|
73
|
-
? convertToTypeaheadOptions(product.modifiersSet as ModifierSet[])
|
|
74
|
-
: [],
|
|
75
|
-
})),
|
|
76
|
-
})),
|
|
77
|
-
})),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
61
|
export const checkAvailableTimesErrors = ({
|
|
81
62
|
values,
|
|
82
63
|
setError,
|