ordering-ui-external 1.9.3 → 1.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{0.ordering-ui.ea0875b41af5b7f1d809.js → 0.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{1.ordering-ui.ea0875b41af5b7f1d809.js → 1.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{2.ordering-ui.ea0875b41af5b7f1d809.js → 2.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{4.ordering-ui.ea0875b41af5b7f1d809.js → 4.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{5.ordering-ui.ea0875b41af5b7f1d809.js → 5.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{6.ordering-ui.ea0875b41af5b7f1d809.js → 6.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js → 7.ordering-ui.55652fab015bca672f9d.js} +1 -1
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → 7.ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.ea0875b41af5b7f1d809.js → 8.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{9.ordering-ui.ea0875b41af5b7f1d809.js → 9.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/ordering-ui.55652fab015bca672f9d.js +2 -0
- package/_bundles/{ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessesListing/index.js +1 -3
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +17 -2
- package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -6
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +24 -60
- package/_modules/themes/five/src/components/Cart/index.js +52 -96
- package/_modules/themes/five/src/components/CartContent/index.js +25 -72
- package/_modules/themes/five/src/components/MultiCheckout/index.js +2 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +7 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +2 -1
- package/_modules/utils/index.js +136 -2
- package/package.json +2 -2
- package/src/components/BusinessesListing/index.js +1 -3
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +13 -2
- package/src/components/VerticalOrdersLayout/styles.js +8 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +4 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +218 -261
- package/src/themes/five/src/components/Cart/index.js +44 -54
- package/src/themes/five/src/components/CartContent/index.js +23 -41
- package/src/themes/five/src/components/MultiCheckout/index.js +1 -7
- package/src/themes/five/src/components/MultiOrdersDetails/index.js +19 -13
- package/src/themes/five/src/components/OrdersOption/index.js +2 -1
- package/src/utils/index.js +35 -1
- package/template/app.js +178 -65
- package/template/components/ListenPageChanges/index.js +1 -1
- package/template/pages/MultiCart/index.js +6 -0
- package/_bundles/ordering-ui.ea0875b41af5b7f1d809.js +0 -2
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useUtils,
|
|
8
8
|
useValidationFields,
|
|
9
9
|
useConfig,
|
|
10
|
-
useOrderingTheme,
|
|
11
10
|
useSite,
|
|
12
11
|
useCustomer
|
|
13
12
|
} from 'ordering-components-external'
|
|
@@ -24,7 +23,6 @@ import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
|
24
23
|
import { TaxInformation } from '../TaxInformation'
|
|
25
24
|
import { TextArea } from '../../styles/Inputs'
|
|
26
25
|
import { SpinnerLoader } from '../../../../../components/SpinnerLoader'
|
|
27
|
-
import { CartStoresListing } from '../../../../franchise/src/components/CartStoresListing'
|
|
28
26
|
import { DriverTips } from '../DriverTips'
|
|
29
27
|
import { ServiceForm } from '../ServiceForm'
|
|
30
28
|
import {
|
|
@@ -56,7 +54,6 @@ const CartUI = (props) => {
|
|
|
56
54
|
onClickCheckout,
|
|
57
55
|
isCheckout,
|
|
58
56
|
useKioskApp,
|
|
59
|
-
isMultiCheckout,
|
|
60
57
|
isCartPending,
|
|
61
58
|
isCartPopover,
|
|
62
59
|
isForceOpenCart,
|
|
@@ -78,7 +75,6 @@ const CartUI = (props) => {
|
|
|
78
75
|
const [orderState] = useOrder()
|
|
79
76
|
const [events] = useEvent()
|
|
80
77
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils()
|
|
81
|
-
const [orderingTheme] = useOrderingTheme()
|
|
82
78
|
const [validationFields] = useValidationFields()
|
|
83
79
|
const [{ configs }] = useConfig()
|
|
84
80
|
const [{ site }] = useSite()
|
|
@@ -96,17 +92,16 @@ const CartUI = (props) => {
|
|
|
96
92
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
97
93
|
const [openTaxModal, setOpenTaxModal] = useState({ open: false, tax: null })
|
|
98
94
|
const [isUpselling, setIsUpselling] = useState(false)
|
|
99
|
-
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
95
|
+
// const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
100
96
|
|
|
101
97
|
const businessUrlTemplate = site?.business_url_template || '/store/:business_slug'
|
|
102
98
|
|
|
103
99
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const cart = orderState?.carts?.[`businessId:${props.cart.business_id}`]
|
|
100
|
+
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
101
|
+
const cart = cartMulticart || orderState?.carts?.[`businessId:${props.cart?.business_id}`]
|
|
108
102
|
const viewString = isStore ? 'business_view' : 'header'
|
|
109
|
-
const hideCartComments =
|
|
103
|
+
const hideCartComments = theme?.[viewString]?.components?.cart?.components?.comments?.hidden
|
|
104
|
+
const hideCartDiscount = theme?.[viewString]?.components?.cart?.components?.discount?.hidden
|
|
110
105
|
const walletName = {
|
|
111
106
|
cash: {
|
|
112
107
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
@@ -137,37 +132,30 @@ const CartUI = (props) => {
|
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
const handleClickCheckout = () => {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (cartsGroupLength > 1 && checkoutMultiBusinessEnabled) {
|
|
144
|
-
events.emit('go_to_page', { page: 'multi_checkout', params: { cartUuid: cart?.group?.uuid } })
|
|
145
|
-
events.emit('cart_popover_closed')
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
const cartGroupsCount = {}
|
|
149
|
-
// eslint-disable-next-line no-unused-expressions
|
|
150
|
-
Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach(_cart => {
|
|
151
|
-
if (cartGroupsCount[_cart?.group?.uuid]) {
|
|
152
|
-
cartGroupsCount[_cart?.group?.uuid] += 1
|
|
153
|
-
} else {
|
|
154
|
-
cartGroupsCount[_cart?.group?.uuid] = 1
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
let groupForTheCart
|
|
158
|
-
const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
|
|
159
|
-
const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
|
|
160
|
-
const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
|
|
161
|
-
if (indexes?.length > 1) {
|
|
162
|
-
groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
|
|
135
|
+
const cartsAvailable = Object.values(orderState?.carts)?.filter(cart => cart?.valid && cart?.status !== 2)
|
|
136
|
+
if (cartsAvailable.length === 1) {
|
|
137
|
+
events.emit('go_to_page', { page: 'checkout', params: { cartUuid: cartsAvailable[0]?.uuid } })
|
|
163
138
|
} else {
|
|
164
|
-
|
|
165
|
-
|
|
139
|
+
const groupKeys = {}
|
|
140
|
+
cartsAvailable.forEach(_cart => {
|
|
141
|
+
groupKeys[_cart?.group?.uuid]
|
|
142
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
143
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
144
|
+
})
|
|
166
145
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
if (
|
|
147
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
148
|
+
Object.keys(groupKeys).length > 1
|
|
149
|
+
) {
|
|
150
|
+
events.emit('go_to_page', { page: 'multi_cart' })
|
|
151
|
+
} else {
|
|
152
|
+
events.emit('go_to_page', {
|
|
153
|
+
page: 'multi_checkout',
|
|
154
|
+
params: {
|
|
155
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
}
|
|
171
159
|
}
|
|
172
160
|
events.emit('cart_popover_closed')
|
|
173
161
|
onClickCheckout && onClickCheckout()
|
|
@@ -221,7 +209,7 @@ const CartUI = (props) => {
|
|
|
221
209
|
|
|
222
210
|
const getIncludedTaxes = () => {
|
|
223
211
|
if (cart?.taxes === null) {
|
|
224
|
-
return cart
|
|
212
|
+
return cart?.business.tax_type === 1 ? cart?.tax : 0
|
|
225
213
|
} else {
|
|
226
214
|
return cart?.taxes.reduce((taxIncluded, tax) => {
|
|
227
215
|
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
@@ -245,9 +233,9 @@ const CartUI = (props) => {
|
|
|
245
233
|
})
|
|
246
234
|
}
|
|
247
235
|
|
|
248
|
-
const handleChangeStore = () => {
|
|
249
|
-
|
|
250
|
-
}
|
|
236
|
+
// const handleChangeStore = () => {
|
|
237
|
+
// setOpenChangeStore(true)
|
|
238
|
+
// }
|
|
251
239
|
|
|
252
240
|
useEffect(() => {
|
|
253
241
|
if (isCustomMode) setIsUpselling(true)
|
|
@@ -284,7 +272,7 @@ const CartUI = (props) => {
|
|
|
284
272
|
handleClickCheckout={handleClickCheckout}
|
|
285
273
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
|
|
286
274
|
setPreorderBusiness={setPreorderBusiness}
|
|
287
|
-
handleChangeStore={!useKioskApp && handleChangeStore}
|
|
275
|
+
// handleChangeStore={!useKioskApp && handleChangeStore}
|
|
288
276
|
isMultiCheckout={isMultiCheckout}
|
|
289
277
|
>
|
|
290
278
|
{cart?.products?.length > 0 && cart?.products.map(product => (
|
|
@@ -292,6 +280,7 @@ const CartUI = (props) => {
|
|
|
292
280
|
key={product.code}
|
|
293
281
|
isCartPending={isCartPending}
|
|
294
282
|
isCartProduct
|
|
283
|
+
isDisabledEdit={!cart?.business_id}
|
|
295
284
|
product={product}
|
|
296
285
|
isCheckout={isCheckout}
|
|
297
286
|
changeQuantity={changeQuantity}
|
|
@@ -300,6 +289,7 @@ const CartUI = (props) => {
|
|
|
300
289
|
onDeleteProduct={handleDeleteClick}
|
|
301
290
|
onEditProduct={handleEditProduct}
|
|
302
291
|
isStore={isStore}
|
|
292
|
+
viewString={viewString}
|
|
303
293
|
/>
|
|
304
294
|
))}
|
|
305
295
|
{!cart?.valid_products && (
|
|
@@ -413,11 +403,11 @@ const CartUI = (props) => {
|
|
|
413
403
|
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
|
|
414
404
|
<tr>
|
|
415
405
|
<td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
|
|
416
|
-
<td>{parsePrice(cart?.delivery_price)}</td>
|
|
406
|
+
<td>{parsePrice(cart?.delivery_price_with_discount ?? cart?.delivery_price)}</td>
|
|
417
407
|
</tr>
|
|
418
408
|
)}
|
|
419
409
|
{
|
|
420
|
-
cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
|
|
410
|
+
!hideCartDiscount && cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
|
|
421
411
|
<tr key={offer.id}>
|
|
422
412
|
<td className='icon'>
|
|
423
413
|
{offer.name}
|
|
@@ -451,11 +441,11 @@ const CartUI = (props) => {
|
|
|
451
441
|
)}
|
|
452
442
|
</tbody>
|
|
453
443
|
</table>
|
|
454
|
-
{isCouponEnabled && !isCartPending && ((isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover)) && (
|
|
444
|
+
{isCouponEnabled && !isCartPending && ((isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover)) && !hideCartDiscount && (
|
|
455
445
|
<CouponContainer>
|
|
456
446
|
<CouponControl
|
|
457
|
-
businessId={cart
|
|
458
|
-
price={cart
|
|
447
|
+
businessId={cart?.business_id}
|
|
448
|
+
price={cart?.total}
|
|
459
449
|
/>
|
|
460
450
|
</CouponContainer>
|
|
461
451
|
)}
|
|
@@ -570,7 +560,7 @@ const CartUI = (props) => {
|
|
|
570
560
|
)}
|
|
571
561
|
</OrderBill>
|
|
572
562
|
)}
|
|
573
|
-
{(onClickCheckout || isForceOpenCart) && !isCheckout && cart?.valid_products && (
|
|
563
|
+
{(onClickCheckout || isForceOpenCart) && !isCheckout && cart?.valid_products && (!isMultiCheckout || isStore) && (
|
|
574
564
|
<CheckoutAction>
|
|
575
565
|
<p>{cart?.total >= 1 && parsePrice(cart?.total)}</p>
|
|
576
566
|
<Button
|
|
@@ -645,17 +635,17 @@ const CartUI = (props) => {
|
|
|
645
635
|
<TaxInformation
|
|
646
636
|
type={openTaxModal.type}
|
|
647
637
|
data={openTaxModal.data}
|
|
648
|
-
products={cart
|
|
638
|
+
products={cart?.products}
|
|
649
639
|
useKioskApp={useKioskApp}
|
|
650
640
|
/>
|
|
651
641
|
</Modal>
|
|
652
642
|
{(openUpselling || isUpselling) && (
|
|
653
643
|
<UpsellingPage
|
|
654
644
|
useKioskApp={useKioskApp}
|
|
655
|
-
businessId={cart
|
|
645
|
+
businessId={cart?.business_id}
|
|
656
646
|
isCustomMode={isCustomMode}
|
|
657
|
-
cartProducts={cart
|
|
658
|
-
business={cart
|
|
647
|
+
cartProducts={cart?.products}
|
|
648
|
+
business={cart?.business}
|
|
659
649
|
handleUpsellingPage={handleUpsellingPage}
|
|
660
650
|
openUpselling={openUpselling}
|
|
661
651
|
canOpenUpselling={canOpenUpselling}
|
|
@@ -25,16 +25,6 @@ export const CartContent = (props) => {
|
|
|
25
25
|
|
|
26
26
|
const [currentCartUuid, setCurrentCartUuid] = useState(null)
|
|
27
27
|
const checkoutMultiBusinessEnabled = configs?.checkout_multi_business_enabled?.value === '1'
|
|
28
|
-
const openCarts = (Object.values(orderState?.carts)?.filter(cart => cart?.products &&
|
|
29
|
-
cart?.products?.length &&
|
|
30
|
-
cart?.status !== 2 &&
|
|
31
|
-
cart?.valid_schedule &&
|
|
32
|
-
cart?.valid_products &&
|
|
33
|
-
cart?.valid_address &&
|
|
34
|
-
cart?.valid_maximum &&
|
|
35
|
-
cart?.valid_minimum &&
|
|
36
|
-
!cart?.wallets
|
|
37
|
-
) || null) || []
|
|
38
28
|
|
|
39
29
|
const handleAddProduct = (product, cart) => {
|
|
40
30
|
setCurrentCartUuid(cart?.uuid)
|
|
@@ -46,38 +36,30 @@ export const CartContent = (props) => {
|
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
const handleClickCheckout = () => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter(_cart => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
|
|
53
|
-
if (cartsGroupLength > 1 && checkoutMultiBusinessEnabled) {
|
|
54
|
-
events.emit('go_to_page', { page: 'multi_checkout', params: { cartUuid: cart?.group?.uuid } })
|
|
55
|
-
events.emit('cart_popover_closed')
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
const cartGroupsCount = {}
|
|
59
|
-
// eslint-disable-next-line no-unused-expressions
|
|
60
|
-
Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach(_cart => {
|
|
61
|
-
if (cartGroupsCount[_cart?.group?.uuid]) {
|
|
62
|
-
cartGroupsCount[_cart?.group?.uuid] += 1
|
|
63
|
-
} else {
|
|
64
|
-
cartGroupsCount[_cart?.group?.uuid] = 1
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
let groupForTheCart
|
|
68
|
-
const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
|
|
69
|
-
const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
|
|
70
|
-
const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
|
|
71
|
-
if (indexes?.length > 1) {
|
|
72
|
-
groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
|
|
39
|
+
const cartsAvailable = Object.values(orderState?.carts)?.filter(cart => cart?.valid && cart?.status !== 2)
|
|
40
|
+
if (cartsAvailable.length === 1) {
|
|
41
|
+
events.emit('go_to_page', { page: 'checkout', params: { cartUuid: cartsAvailable[0]?.uuid } })
|
|
73
42
|
} else {
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
const groupKeys = {}
|
|
44
|
+
cartsAvailable.forEach(_cart => {
|
|
45
|
+
groupKeys[_cart?.group?.uuid]
|
|
46
|
+
? groupKeys[_cart?.group?.uuid] += 1
|
|
47
|
+
: groupKeys[_cart?.group?.uuid ?? 'null'] = 1
|
|
48
|
+
})
|
|
76
49
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
50
|
+
if (
|
|
51
|
+
(Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
|
|
52
|
+
Object.keys(groupKeys).length > 1
|
|
53
|
+
) {
|
|
54
|
+
events.emit('go_to_page', { page: 'multi_cart' })
|
|
55
|
+
} else {
|
|
56
|
+
events.emit('go_to_page', {
|
|
57
|
+
page: 'multi_checkout',
|
|
58
|
+
params: {
|
|
59
|
+
cartUuid: cartsAvailable[0]?.group?.uuid
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
81
63
|
}
|
|
82
64
|
events.emit('cart_popover_closed')
|
|
83
65
|
props.onClose && props.onClose()
|
|
@@ -98,7 +80,7 @@ export const CartContent = (props) => {
|
|
|
98
80
|
{!isSlideBar && (
|
|
99
81
|
<WrapperContainer>
|
|
100
82
|
<Title>{t('YOUR_CART', 'Your cart')}</Title>
|
|
101
|
-
{checkoutMultiBusinessEnabled && (
|
|
83
|
+
{checkoutMultiBusinessEnabled && carts?.length > 0 && (
|
|
102
84
|
<Button onClick={handleClickCheckout} color='primary'>{t('CHECKOUT', 'Checkout')}</Button>
|
|
103
85
|
)}
|
|
104
86
|
</WrapperContainer>
|
|
@@ -78,8 +78,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
78
78
|
const [userErrors, setUserErrors] = useState([])
|
|
79
79
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(null)
|
|
80
80
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
81
|
-
const
|
|
82
|
-
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
81
|
+
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
83
82
|
const walletCarts = (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
|
|
84
83
|
const isMultiDriverTips = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
85
84
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -294,11 +293,6 @@ const MultiCheckoutUI = (props) => {
|
|
|
294
293
|
{placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order')}
|
|
295
294
|
</Button>
|
|
296
295
|
</WrapperPlaceOrderButton>
|
|
297
|
-
{openCarts.length > maximumCarts && (
|
|
298
|
-
<WarningText>
|
|
299
|
-
{t('WARNING_MAXIMUM_CARTS', 'You can only pay for a maximum of 5 carts, please discard one or more to continue.')}
|
|
300
|
-
</WarningText>
|
|
301
|
-
)}
|
|
302
296
|
</WrapperRightContainer>
|
|
303
297
|
|
|
304
298
|
<Alert
|
|
@@ -35,6 +35,8 @@ const MultiOrdersDetailsUI = (props) => {
|
|
|
35
35
|
const [{ parsePrice }] = useUtils()
|
|
36
36
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
37
37
|
|
|
38
|
+
const isTaxIncludedOnPrice = orders.every(_order => _order.taxes?.length ? _order.taxes?.every(_tax => _tax.type === 1) : true)
|
|
39
|
+
|
|
38
40
|
const walletName = {
|
|
39
41
|
cash: {
|
|
40
42
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
@@ -124,19 +126,23 @@ const MultiOrdersDetailsUI = (props) => {
|
|
|
124
126
|
))}
|
|
125
127
|
</tbody>
|
|
126
128
|
</table>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
{!isTaxIncludedOnPrice && (
|
|
130
|
+
<>
|
|
131
|
+
<Divider />
|
|
132
|
+
<table>
|
|
133
|
+
<tbody>
|
|
134
|
+
<tr>
|
|
135
|
+
<td>{t('TOTAL_BEFORE_TAX', 'Total before tax')}:</td>
|
|
136
|
+
<td>{parsePrice(ordersSummary?.subtotal)}</td>
|
|
137
|
+
</tr>
|
|
138
|
+
<tr>
|
|
139
|
+
<td>{t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:</td>
|
|
140
|
+
<td>{parsePrice(ordersSummary?.tax)}</td>
|
|
141
|
+
</tr>
|
|
142
|
+
</tbody>
|
|
143
|
+
</table>
|
|
144
|
+
</>
|
|
145
|
+
)}
|
|
140
146
|
<Divider />
|
|
141
147
|
<table>
|
|
142
148
|
<tbody>
|
|
@@ -368,6 +368,7 @@ const OrdersOptionUI = (props) => {
|
|
|
368
368
|
reorderLoading={reorderState?.loading}
|
|
369
369
|
orders={orders.filter(order => orderStatus.includes(order.status)).sort((a, b) => moment(b?.delivery_datetime_utc).valueOf() - moment(a?.delivery_datetime_utc).valueOf())}
|
|
370
370
|
pagination={pagination}
|
|
371
|
+
customArray={customArray}
|
|
371
372
|
loadMoreOrders={loadMoreOrders}
|
|
372
373
|
onRedirectPage={onRedirectPage}
|
|
373
374
|
getOrderStatus={getOrderStatus}
|
|
@@ -409,7 +410,7 @@ export const OrdersOption = (props) => {
|
|
|
409
410
|
useDefualtSessionManager: true,
|
|
410
411
|
paginationSettings: {
|
|
411
412
|
initialPage: 1,
|
|
412
|
-
pageSize:
|
|
413
|
+
pageSize: (getAllOrders || props.activeOrders) ? 30 : 10,
|
|
413
414
|
controlType: 'infinity'
|
|
414
415
|
}
|
|
415
416
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useTheme } from 'styled-components'
|
|
|
4
4
|
export const getIconCard = (brand = '') => {
|
|
5
5
|
const value = brand.toLowerCase()
|
|
6
6
|
const theme = useTheme()
|
|
7
|
-
|
|
7
|
+
return theme.images?.general?.[value] ?? theme.images?.general?.credit
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -616,3 +616,37 @@ export const getStarWidth = (qualification) => {
|
|
|
616
616
|
return '0%'
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
+
|
|
620
|
+
export const getOrderStatus = (s) => {
|
|
621
|
+
const [, t] = useLanguage()
|
|
622
|
+
const theme = useTheme()
|
|
623
|
+
const status = parseInt(s)
|
|
624
|
+
const orderStatus = [
|
|
625
|
+
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
|
|
626
|
+
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
|
|
627
|
+
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
|
|
628
|
+
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
|
|
629
|
+
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
|
|
630
|
+
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
|
|
631
|
+
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
|
|
632
|
+
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
|
|
633
|
+
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
|
|
634
|
+
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 80 },
|
|
635
|
+
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0 },
|
|
636
|
+
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
|
|
637
|
+
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0 },
|
|
638
|
+
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
|
|
639
|
+
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
|
|
640
|
+
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
|
|
641
|
+
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer'), slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER', percentage: 0 },
|
|
642
|
+
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0 },
|
|
643
|
+
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', percentage: 55 },
|
|
644
|
+
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', percentage: 90 },
|
|
645
|
+
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
|
|
646
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
|
|
647
|
+
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
648
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
649
|
+
]
|
|
650
|
+
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
651
|
+
return objectStatus && objectStatus
|
|
652
|
+
}
|