@licklist/design 0.78.5-dev.0 → 0.78.5-dev.13
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/CustomDatePicker/CustomDatePicker.d.ts +10 -0
- package/dist/CustomDatePicker/CustomDatePicker.d.ts.map +1 -0
- package/dist/auth/Layout/UserNavDropDownToggle.js +3 -0
- package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts +2 -2
- package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts.map +1 -1
- package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
- package/dist/events/event-card/EventCard.d.ts +1 -1
- package/dist/events/event-card/EventCard.d.ts.map +1 -1
- package/dist/events/event-card/EventCard.js +1 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
- package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts +2 -2
- package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts.map +1 -1
- package/dist/file-upload/FileUpload.d.ts +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +1 -2
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +2 -2
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +2 -2
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.d.ts.map +1 -1
- package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts +2 -2
- package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +0 -5
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +81 -80
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts +1 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
- package/dist/modals/dialog/Dialog.d.ts.map +1 -1
- package/dist/modals/dialog/Dialog.js +39 -41
- package/dist/modals/dialog/DialogContext.d.ts +2 -2
- package/dist/modals/dialog/DialogContext.d.ts.map +1 -1
- package/dist/notification/email-template/card/EmailTemplateCard.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts +1 -0
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +4 -4
- package/dist/notification/email-template/form/EmailTemplateForm.d.ts +2 -1
- package/dist/notification/email-template/form/EmailTemplateForm.d.ts.map +1 -1
- package/dist/notification/email-template/form/EmailTemplateForm.js +2 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -1
- package/dist/product-set/utils/index.d.ts +1 -1
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.js +1 -1
- package/dist/setting/dashboard/payments/payments-modal/PaymentsModal.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +14 -20
- package/package.json +20 -18
- package/src/CustomDatePicker/CustomDatePicker.tsx +252 -0
- package/src/auth/Layout/UserNavDropDownToggle.tsx +1 -1
- package/src/custom-fields/field-set/providers/CustomFieldSetsProvider.tsx +2 -2
- package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -0
- package/src/events/event-card/EventCard.tsx +10 -8
- package/src/events/event-statistic-modal/EventStatisticModal.tsx +1 -0
- package/src/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.tsx +2 -2
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +13 -8
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +12 -4
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +10 -6
- package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +18 -20
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +3 -5
- package/src/iframe/order-process/components/PaymentCard/PaymentCard.tsx +3 -3
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +103 -109
- package/src/iframe/payment/payment-page/PaymentPage.tsx +1 -1
- package/src/iframe/ryft/utils/ryft-form.ts +1 -1
- package/src/modals/dialog/Dialog.tsx +35 -36
- package/src/modals/dialog/DialogContext.tsx +8 -2
- package/src/notification/email-template/card/EmailTemplateCard.tsx +0 -2
- package/src/notification/email-template/control/EmailTemplateControl.tsx +7 -5
- package/src/notification/email-template/form/EmailTemplateForm.tsx +3 -0
- package/src/product-set/form/ProductSetForm.tsx +2 -1
- package/src/product-set/utils/index.ts +15 -14
- package/src/recurrence-input/RecurrenceInput.tsx +4 -3
- package/src/setting/dashboard/payments/payments-modal/PaymentsModal.tsx +1 -0
- package/src/snippet/snippet-template/preview/Preview.tsx +6 -9
- package/yarn.lock +694 -724
|
@@ -33,7 +33,7 @@ export interface EventCardProps extends HasPermissionProp {
|
|
|
33
33
|
onPreview: () => void
|
|
34
34
|
onEdit: () => void
|
|
35
35
|
onCopy: () => void
|
|
36
|
-
onRemove
|
|
36
|
+
onRemove?: () => void
|
|
37
37
|
onOpenQrCode: () => void
|
|
38
38
|
eventStatistic?: EventStatistic | null
|
|
39
39
|
eventMetadata?: EventMetadata | null
|
|
@@ -212,13 +212,15 @@ export function EventCard({
|
|
|
212
212
|
>
|
|
213
213
|
<FaCopy />
|
|
214
214
|
</button>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
{onRemove && (
|
|
216
|
+
<button
|
|
217
|
+
type='button'
|
|
218
|
+
className='event-card-link-button'
|
|
219
|
+
onClick={onRemove}
|
|
220
|
+
>
|
|
221
|
+
<FaTrashAlt />
|
|
222
|
+
</button>
|
|
223
|
+
)}
|
|
222
224
|
</>
|
|
223
225
|
)}
|
|
224
226
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from 'react'
|
|
2
2
|
|
|
3
|
-
export const DropdownWrapper
|
|
3
|
+
export const DropdownWrapper = ({ children }: PropsWithChildren) => (
|
|
4
4
|
<div className='canvas-dropdown-wrapper'>
|
|
5
5
|
<div className='arrow' />
|
|
6
6
|
<div className='children-container'>{children}</div>
|
|
@@ -5,13 +5,15 @@ import { isEmpty, uniqBy } from 'lodash'
|
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { useIntl } from 'react-intl'
|
|
7
7
|
import { Currency } from '@licklist/core/dist/Config'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
MenuStep,
|
|
10
|
+
Product,
|
|
11
|
+
} from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
9
12
|
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
10
|
-
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
11
13
|
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
12
|
-
import { NumberInputHorizontal } from 'src/sales'
|
|
13
14
|
import clsx from 'clsx'
|
|
14
15
|
import { ProductCategory } from 'dist/product-set/types'
|
|
16
|
+
import { NumberInputHorizontal } from '../../../sales'
|
|
15
17
|
import { MAX_PRODUCT_NUMBER } from '../../order-process/components/CategoryProduct/constants'
|
|
16
18
|
import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
|
|
17
19
|
import { getOrderProductModifiersPrice } from '../../order-process/components/BookingSummary/utils'
|
|
@@ -63,20 +65,23 @@ export const ProductWithModifierSetForm = ({
|
|
|
63
65
|
const defaultProductQuantity = editOrderModifier?.productQuantity ?? 0
|
|
64
66
|
|
|
65
67
|
const valuesOrder = watch()
|
|
66
|
-
const productQuantity =
|
|
68
|
+
const productQuantity =
|
|
69
|
+
valuesOrder?.product?.quantity ?? defaultProductQuantity
|
|
67
70
|
|
|
68
71
|
const orderModifiersSets =
|
|
69
72
|
valuesOrder[`${product.id}`]?.orderProductModifiers || []
|
|
70
73
|
|
|
71
74
|
const filteredOrderModifiers = filteredOrderModifierSets(orderModifiersSets)
|
|
72
75
|
|
|
73
|
-
const orderModifierSets: OrderModifierByProduct[] = useMemo(
|
|
76
|
+
const orderModifierSets: OrderModifierByProduct[] = useMemo(
|
|
77
|
+
() => [
|
|
74
78
|
{
|
|
75
79
|
productQuantity: productQuantity ?? 1,
|
|
76
80
|
modifiers: filteredOrderModifiers,
|
|
77
81
|
},
|
|
78
|
-
]
|
|
79
|
-
|
|
82
|
+
],
|
|
83
|
+
[filteredOrderModifiers, productQuantity],
|
|
84
|
+
)
|
|
80
85
|
|
|
81
86
|
const onSubmit = (event) => {
|
|
82
87
|
event.preventDefault()
|
|
@@ -180,7 +185,7 @@ export const ProductWithModifierSetForm = ({
|
|
|
180
185
|
isLoading={isSubmitting}
|
|
181
186
|
/>
|
|
182
187
|
</div>
|
|
183
|
-
<div className='
|
|
188
|
+
<div className='d-flex flex-column align-items-center justify-content-center'>
|
|
184
189
|
<div className='modifier-price pb-4 pl-5'>
|
|
185
190
|
{formatToCurrency(product.price)}
|
|
186
191
|
</div>
|
package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useDialogContext, DialogContextProvider } from 'src/modals'
|
|
2
1
|
import { Modal } from 'react-bootstrap'
|
|
3
2
|
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
4
3
|
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
5
|
-
import { TicketDescription } from 'src/iframe/event'
|
|
6
4
|
import clsx from 'clsx'
|
|
7
5
|
import { ProductCategory } from 'dist/product-set/types'
|
|
6
|
+
import { useDialogContext, DialogContextProvider } from '../../../modals'
|
|
7
|
+
import { TicketDescription } from '../../event'
|
|
8
8
|
import { FormOrderItem } from '../../order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput'
|
|
9
9
|
import { useOnWindowUnmount } from '../../order-process/components/utils/useOnWindowUnmount'
|
|
10
10
|
import { ProductWithModifierSetForm } from './ProductWithModifierSetForm'
|
|
@@ -48,12 +48,20 @@ export const ProductWithModifierSetModal = ({
|
|
|
48
48
|
</button>
|
|
49
49
|
</div>
|
|
50
50
|
<div className='right-block' id='select-event-container'>
|
|
51
|
-
<div
|
|
51
|
+
<div
|
|
52
|
+
className={clsx(
|
|
53
|
+
'manual-booking-container',
|
|
54
|
+
!product.images.length && 'tw-mt-8',
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
52
57
|
<div className='manual-booking-header'>
|
|
53
58
|
<TicketDescription
|
|
54
59
|
title={product.name}
|
|
55
60
|
description={product.description}
|
|
56
|
-
className={clsx(
|
|
61
|
+
className={clsx(
|
|
62
|
+
'iframe-event__product-description',
|
|
63
|
+
!product.images.length && 'mt-6',
|
|
64
|
+
)}
|
|
57
65
|
classNameProductModal='d-block'
|
|
58
66
|
images={product.images}
|
|
59
67
|
isRequired={product.isRequired}
|
package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx
CHANGED
|
@@ -10,8 +10,8 @@ import { xor } from 'lodash'
|
|
|
10
10
|
import clsx from 'clsx'
|
|
11
11
|
import { Currency } from '@licklist/core/dist/Config'
|
|
12
12
|
import { useIntl } from 'react-intl'
|
|
13
|
-
import { MAX_PRODUCT_NUMBER } from '
|
|
14
|
-
import { NumberInputHorizontal } from '
|
|
13
|
+
import { MAX_PRODUCT_NUMBER } from '../../../order-process/components/CategoryProduct/constants'
|
|
14
|
+
import { NumberInputHorizontal } from '../../../../sales'
|
|
15
15
|
import { selectModifierType } from '../../utils'
|
|
16
16
|
|
|
17
17
|
interface ModifiersSetControllProps {
|
|
@@ -125,9 +125,11 @@ export const ModifiersSetControl = ({
|
|
|
125
125
|
)
|
|
126
126
|
}, [isEditMode])
|
|
127
127
|
|
|
128
|
-
const radioButtonDefaultModifier = currentOrderModifiersSets
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const radioButtonDefaultModifier = currentOrderModifiersSets
|
|
129
|
+
.find((modifier) =>
|
|
130
|
+
modifierSet.modifiers.some((rl) => rl.id === modifier.modifierId),
|
|
131
|
+
)
|
|
132
|
+
?.modifierId.toString()
|
|
131
133
|
|
|
132
134
|
return (
|
|
133
135
|
<>
|
|
@@ -167,7 +169,9 @@ export const ModifiersSetControl = ({
|
|
|
167
169
|
inline
|
|
168
170
|
id={modifier.id.toString()}
|
|
169
171
|
defaultChecked={!!selectedOrderModifierId}
|
|
170
|
-
defaultValue={
|
|
172
|
+
defaultValue={
|
|
173
|
+
selectedOrderModifierId || modifier.id.toString()
|
|
174
|
+
}
|
|
171
175
|
checked={field.value === modifier.id.toString()}
|
|
172
176
|
onChange={onChange}
|
|
173
177
|
type='radio'
|
|
@@ -2,7 +2,7 @@ import { useEffect } from 'react'
|
|
|
2
2
|
import { useFormContext, Controller } from 'react-hook-form'
|
|
3
3
|
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
4
4
|
import { Product } from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
5
|
-
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { ModifiersSetControl } from './ModifierSetControll'
|
|
7
7
|
import { orderProductModifiersQuantity } from '../../utils'
|
|
8
8
|
|
|
@@ -69,25 +69,23 @@ export const ProductControl = ({
|
|
|
69
69
|
return true
|
|
70
70
|
},
|
|
71
71
|
}}
|
|
72
|
-
render={({ fieldState: { error } }) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)
|
|
90
|
-
}}
|
|
72
|
+
render={({ fieldState: { error } }) => (
|
|
73
|
+
<>
|
|
74
|
+
<ModifiersSetControl
|
|
75
|
+
modifierSet={modifierSet}
|
|
76
|
+
productId={product.id}
|
|
77
|
+
modifiers={modifierSet.modifiers}
|
|
78
|
+
isEditMode={!!editOrderModifier?.modifiers}
|
|
79
|
+
orderProductModifierSets={editOrderModifier?.modifiers}
|
|
80
|
+
isLoading={isLoading}
|
|
81
|
+
/>
|
|
82
|
+
{error?.message && (
|
|
83
|
+
<div className='invalid-feedback d-flex pl-4'>
|
|
84
|
+
{error?.message}!
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
</>
|
|
88
|
+
)}
|
|
91
89
|
/>
|
|
92
90
|
</div>
|
|
93
91
|
)
|
|
@@ -10,10 +10,8 @@ import {
|
|
|
10
10
|
Product,
|
|
11
11
|
ProductCategory,
|
|
12
12
|
} from '@licklist/plugins/dist/types/context/sale/menuSteps'
|
|
13
|
-
import { Button } from 'react-bootstrap'
|
|
14
|
-
import { FaTrashAlt } from 'react-icons/fa'
|
|
15
|
-
import { ProductWithModifierSetModal } from 'src/iframe/ProductWithModifierModal'
|
|
16
13
|
import { OrderModifierByProduct } from '@licklist/core/dist/DataMapper/Order/OrderModifiierByProduct'
|
|
14
|
+
import { ProductWithModifierSetModal } from '../../../ProductWithModifierModal'
|
|
17
15
|
import { TicketDescription } from '../../../event/ticket-description'
|
|
18
16
|
import { ProductQuantityInput } from './components/ProductQuantityInput'
|
|
19
17
|
import { FormOrderItem } from './components/ProductQuantityInput/ProductQuantityInput'
|
|
@@ -160,8 +158,8 @@ export const CategoryProduct = ({
|
|
|
160
158
|
).orderModifiersSets
|
|
161
159
|
?.filter((_, index) => index !== modifierIndex)
|
|
162
160
|
.concat(value.orderModifiersSets)
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
|
|
162
|
+
onChange({
|
|
165
163
|
...value,
|
|
166
164
|
orderModifiersSets: editedOrderModifiersSets,
|
|
167
165
|
quantity: editedOrderModifiersSets.reduce(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { useIntl } from 'react-intl'
|
|
4
4
|
import * as Config from '@licklist/core/dist/Config'
|
|
@@ -15,14 +15,14 @@ export type PaymentCardProps = {
|
|
|
15
15
|
isFreePayment?: boolean
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const PaymentCard
|
|
18
|
+
export const PaymentCard = ({
|
|
19
19
|
order,
|
|
20
20
|
totalWithDiscount,
|
|
21
21
|
recalculatedFee,
|
|
22
22
|
discountBlock,
|
|
23
23
|
paymentDetail,
|
|
24
24
|
isFreePayment,
|
|
25
|
-
}) => {
|
|
25
|
+
}: PropsWithChildren<PaymentCardProps>) => {
|
|
26
26
|
const { t } = useTranslation(['Design'])
|
|
27
27
|
const { formatNumber } = useIntl()
|
|
28
28
|
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
-
import { uniqueId, flatMap, flatten
|
|
2
|
+
import { uniqueId, flatMap, flatten } 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
6
|
import { OrderModifier } from '@licklist/core/dist/DataMapper/Order/OrderModifierDataMapper'
|
|
7
|
+
import { OrderProduct } from '@licklist/core/dist/DataMapper/Order/OrderProductDataMapper'
|
|
7
8
|
import {
|
|
8
9
|
PAYMENT_TYPE_VAT,
|
|
9
10
|
PAYMENT_TYPE_FEE,
|
|
10
11
|
PAYMENT_TYPE_NET_PROFIT,
|
|
11
12
|
} from '@licklist/core/dist/DataMapper/Order/PaymentDataMapper'
|
|
12
13
|
import { StaticTableData } from '../../../../table'
|
|
13
|
-
import {
|
|
14
|
+
import { getTotalSumByCategory } from '../utils'
|
|
14
15
|
import { OrderItemsTableProps, SummaryItem } from '../types'
|
|
15
16
|
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
17
|
|
|
21
18
|
const CURRENCY_DEFAULT = 'GBP'
|
|
19
|
+
|
|
22
20
|
export const PAYMENT_TYPE_TRANSLATE_KEYS = {
|
|
23
21
|
[PAYMENT_TYPE_NET_PROFIT]: 'netAmount',
|
|
24
22
|
[PAYMENT_TYPE_FEE]: 'bookeditFee',
|
|
@@ -41,43 +39,62 @@ export const useTableData = ({
|
|
|
41
39
|
})
|
|
42
40
|
|
|
43
41
|
const wrapLabelContent = (string: string) => (
|
|
44
|
-
<div className=
|
|
42
|
+
<div className="label">{string}</div>
|
|
45
43
|
)
|
|
46
44
|
|
|
47
45
|
const renderCategoryItem = (products: Product[]) => ({
|
|
48
46
|
key: uniqueId('category-id-'),
|
|
49
|
-
name: wrapLabelContent(products[0]
|
|
47
|
+
name: wrapLabelContent(products[0]?.productCategory?.name ?? ''),
|
|
50
48
|
quantity: '',
|
|
51
49
|
price: wrapLabelContent(
|
|
52
50
|
`${t('total')}: ${formatPrice(
|
|
53
|
-
getTotalSumByCategory(order.orderProducts, products),
|
|
51
|
+
getTotalSumByCategory(order.orderProducts ?? [], products),
|
|
54
52
|
)}`,
|
|
55
53
|
),
|
|
56
54
|
})
|
|
57
55
|
|
|
58
|
-
const reworkProductStructure = (order: OrderProduct) =>
|
|
59
|
-
order
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
const reworkProductStructure = (order: OrderProduct) => {
|
|
57
|
+
if (!order) return []
|
|
58
|
+
|
|
59
|
+
const groups: any[] = (order as any)?.orderProductModifiersGroups ?? []
|
|
60
|
+
if (!Array.isArray(groups) || !groups.length) return [order]
|
|
61
|
+
|
|
62
|
+
return groups.flatMap((modGroup, idx) => ({
|
|
63
|
+
deletedAt: order.deletedAt ?? null,
|
|
64
|
+
id: `${order.id}-${idx + 1}`,
|
|
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:
|
|
71
|
+
(modGroup?.modifiers ?? []).map((mod: any) => ({
|
|
72
|
+
modifierId: mod?.modifierId ?? '',
|
|
73
|
+
price: mod?.price ?? 0,
|
|
74
|
+
productId: mod?.productId ?? '',
|
|
75
|
+
quantity: mod?.quantity ?? 1,
|
|
76
|
+
modifierSetId: mod?.modifierSetId ?? '',
|
|
77
|
+
modifier: mod?.modifier ?? null,
|
|
78
|
+
})) ?? [],
|
|
79
|
+
}))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const renderModifierItem = (orderModifier: OrderModifier) => {
|
|
83
|
+
if (!orderModifier || orderModifier.quantity === 0) return null
|
|
84
|
+
const { quantity, modifier, modifierId, price } = orderModifier
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
key: modifierId,
|
|
88
|
+
name: ` - ${modifier?.name || ''}`,
|
|
89
|
+
quantity: (
|
|
90
|
+
<div className="quantity">
|
|
91
|
+
<div className="multiplier">x</div>
|
|
92
|
+
{quantity}
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
95
|
+
price: formatPrice(price ?? 0),
|
|
96
|
+
}
|
|
97
|
+
}
|
|
81
98
|
|
|
82
99
|
const renderProductItem = ({
|
|
83
100
|
product,
|
|
@@ -86,43 +103,26 @@ export const useTableData = ({
|
|
|
86
103
|
product: OrderProduct
|
|
87
104
|
productsForCategory: Product[]
|
|
88
105
|
}) => {
|
|
89
|
-
if (product.quantity === 0)
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
106
|
+
if (!product || product.quantity === 0) return null
|
|
107
|
+
|
|
93
108
|
const name =
|
|
94
|
-
productsForCategory.find((item) => item.id === product.productId)?.name ||
|
|
109
|
+
productsForCategory.find((item) => item.id === product.productId)?.name ||
|
|
110
|
+
''
|
|
95
111
|
|
|
96
112
|
return {
|
|
97
113
|
key: product.id,
|
|
98
114
|
name,
|
|
99
115
|
quantity: (
|
|
100
|
-
<div className=
|
|
101
|
-
<div className=
|
|
116
|
+
<div className="quantity">
|
|
117
|
+
<div className="multiplier">x</div>
|
|
102
118
|
{product.quantity}
|
|
103
119
|
</div>
|
|
104
120
|
),
|
|
105
|
-
price: formatPrice(product.price),
|
|
106
|
-
modifier:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const renderModifierItem = (orderModifier: OrderModifier) => {
|
|
111
|
-
const { quantity, modifier, modifierId, price } = orderModifier
|
|
112
|
-
if (quantity === 0) {
|
|
113
|
-
return null
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
key: modifierId,
|
|
118
|
-
name: ` - ${modifier?.name || ''}`,
|
|
119
|
-
quantity: (
|
|
120
|
-
<div className='quantity'>
|
|
121
|
-
<div className='multiplier'>x</div>
|
|
122
|
-
{quantity}
|
|
123
|
-
</div>
|
|
124
|
-
),
|
|
125
|
-
price: formatPrice(price),
|
|
121
|
+
price: formatPrice(product.price ?? 0),
|
|
122
|
+
modifier:
|
|
123
|
+
(product?.orderProductModifiers?.map(renderModifierItem) ?? []).filter(
|
|
124
|
+
Boolean,
|
|
125
|
+
),
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -132,41 +132,40 @@ export const useTableData = ({
|
|
|
132
132
|
]
|
|
133
133
|
|
|
134
134
|
return productCategories.reduce(
|
|
135
|
-
(
|
|
136
|
-
const productsForCategory =
|
|
137
|
-
(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
if (!products.length) {
|
|
147
|
-
return previousValues
|
|
148
|
-
}
|
|
135
|
+
(acc: StaticTableData[], categoryId) => {
|
|
136
|
+
const productsForCategory =
|
|
137
|
+
order?.products.filter((p) => p.productCategoryId === categoryId) ?? []
|
|
138
|
+
|
|
139
|
+
const products =
|
|
140
|
+
order?.orderProducts?.filter((el) =>
|
|
141
|
+
productsForCategory.map((p) => p.id).includes(el.productId),
|
|
142
|
+
) ?? []
|
|
143
|
+
|
|
144
|
+
if (!products.length) return acc
|
|
145
|
+
|
|
149
146
|
const productsWithReworkedModifier = products.map((product) => {
|
|
150
|
-
if (!product
|
|
147
|
+
if (!product?.orderProductModifiers?.length) return product
|
|
151
148
|
return reworkProductStructure(product)
|
|
152
149
|
})
|
|
153
150
|
|
|
154
|
-
const filteredProducts =
|
|
155
|
-
(
|
|
156
|
-
renderProductItem({
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
const filteredProducts = flatten(productsWithReworkedModifier)
|
|
152
|
+
.map((p) =>
|
|
153
|
+
renderProductItem({
|
|
154
|
+
product: p as OrderProduct,
|
|
155
|
+
productsForCategory,
|
|
156
|
+
}),
|
|
157
|
+
)
|
|
158
|
+
.filter((row): row is NonNullable<typeof row> => Boolean(row))
|
|
159
|
+
|
|
160
|
+
if (!filteredProducts.length) return acc
|
|
163
161
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
const productWithModifier = flatMap(filteredProducts, (row) => [
|
|
163
|
+
row,
|
|
164
|
+
...(row.modifier ?? []),
|
|
165
|
+
])
|
|
167
166
|
|
|
168
167
|
return [
|
|
169
|
-
...
|
|
168
|
+
...acc,
|
|
170
169
|
renderCategoryItem(productsForCategory),
|
|
171
170
|
...productWithModifier,
|
|
172
171
|
]
|
|
@@ -183,26 +182,21 @@ export const useTableData = ({
|
|
|
183
182
|
price: wrapLabelContent(formatPrice(price)),
|
|
184
183
|
}))
|
|
185
184
|
|
|
186
|
-
const data = useMemo(
|
|
187
|
-
()
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
]
|
|
203
|
-
},
|
|
204
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
205
|
-
[order, externalDiscount, isPaymentProcessed],
|
|
206
|
-
)
|
|
185
|
+
const data = useMemo(() => {
|
|
186
|
+
if (!order) return []
|
|
187
|
+
|
|
188
|
+
return [
|
|
189
|
+
...renderProductsContent(),
|
|
190
|
+
...renderSummaryItems(
|
|
191
|
+
getOrderSummaryItems({
|
|
192
|
+
order,
|
|
193
|
+
paymentDetail,
|
|
194
|
+
isPaymentProcessed,
|
|
195
|
+
externalDiscount,
|
|
196
|
+
}),
|
|
197
|
+
),
|
|
198
|
+
]
|
|
199
|
+
}, [order, externalDiscount, isPaymentProcessed, paymentDetail])
|
|
200
|
+
|
|
207
201
|
return data
|
|
208
202
|
}
|
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
|
|
|
4
4
|
import { Button, Col } from 'react-bootstrap'
|
|
5
5
|
import { PaymentSessionContext } from '@licklist/plugins/dist/context/payment/PaymentSessionContext'
|
|
6
6
|
import { PaymentLinkResponse } from '@licklist/plugins/dist/hooks/Api/usePaymentApi'
|
|
7
|
-
import { BookingSummaryProps } from '
|
|
7
|
+
import { BookingSummaryProps } from '../../order-process/components/BookingSummary/types'
|
|
8
8
|
// eslint-disable-next-line max-len
|
|
9
9
|
import { SummaryTotalBlock } from '../../order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock'
|
|
10
10
|
import { LoaderIndicator } from '../../../static'
|