ordering-ui-external 2.0.0 → 2.0.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/_modules/themes/five/src/components/BusinessProductsList/index.js +7 -6
- package/_modules/themes/five/src/components/BusinessProductsList/layouts/groceries/index.js +4 -4
- package/_modules/themes/five/src/components/Cart/index.js +3 -3
- package/_modules/themes/five/src/components/FavoriteList/index.js +2 -83
- package/_modules/themes/five/src/components/MessagesListing/index.js +2 -82
- package/_modules/themes/five/src/components/MultiCheckout/index.js +5 -6
- package/_modules/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +11 -134
- package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +14 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +5 -3
- package/_modules/themes/five/src/components/OrderDetails/index.js +11 -140
- package/_modules/themes/five/src/components/OrderProgress/index.js +3 -131
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +11 -14
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +1 -2
- package/package.json +1 -1
- package/src/themes/five/src/components/BusinessProductsList/index.js +7 -6
- package/src/themes/five/src/components/BusinessProductsList/layouts/groceries/index.js +4 -4
- package/src/themes/five/src/components/Cart/index.js +6 -0
- package/src/themes/five/src/components/FavoriteList/index.js +1 -35
- package/src/themes/five/src/components/MessagesListing/index.js +1 -34
- package/src/themes/five/src/components/MultiCheckout/index.js +4 -5
- package/src/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +23 -44
- package/src/themes/five/src/components/MultiOrdersDetails/index.js +15 -2
- package/src/themes/five/src/components/MultiOrdersDetails/styles.js +8 -0
- package/src/themes/five/src/components/OrderDetails/index.js +1 -35
- package/src/themes/five/src/components/OrderProgress/index.js +1 -34
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
- package/src/themes/five/src/components/SingleOrderCard/index.js +1 -2
|
@@ -48,7 +48,8 @@ const BusinessProductsListUI = (props) => {
|
|
|
48
48
|
subcategoriesSelected,
|
|
49
49
|
onClickCategory,
|
|
50
50
|
handleUpdateProducts,
|
|
51
|
-
isSearchMode
|
|
51
|
+
isSearchMode,
|
|
52
|
+
business
|
|
52
53
|
} = props
|
|
53
54
|
|
|
54
55
|
const [, t] = useLanguage()
|
|
@@ -193,7 +194,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
193
194
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
194
195
|
/>
|
|
195
196
|
))}
|
|
196
|
-
{!categoryState?.loading && categoryState?.products?.length > 9 && (
|
|
197
|
+
{!business?.food && !categoryState?.loading && categoryState?.products?.length > 9 && (
|
|
197
198
|
<SingleProductCard
|
|
198
199
|
useCustomFunctionality
|
|
199
200
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -266,7 +267,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
266
267
|
<ProductsListing isSubcategorySearch={isSubcategorySearch}>
|
|
267
268
|
{isSearchMode && category?.subcategories?.length > 0 ? (
|
|
268
269
|
<>
|
|
269
|
-
{products?.filter((product, i) => i < 9 && product?.category_id === category?.id)?.map((product, i) => (
|
|
270
|
+
{products?.filter((product, i) => (i < 9 && product?.category_id === category?.id) || business?.food)?.map((product, i) => (
|
|
270
271
|
<SingleProductCard
|
|
271
272
|
key={i}
|
|
272
273
|
isSoldOut={product.inventoried && !product.quantity}
|
|
@@ -279,7 +280,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
279
280
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
280
281
|
/>
|
|
281
282
|
))}
|
|
282
|
-
{!categoryState?.loading && products?.length > 9 && (
|
|
283
|
+
{!business?.food && !categoryState?.loading && products?.length > 9 && (
|
|
283
284
|
<SingleProductCard
|
|
284
285
|
useCustomFunctionality
|
|
285
286
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -296,7 +297,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
296
297
|
) : (
|
|
297
298
|
<>
|
|
298
299
|
{
|
|
299
|
-
products.filter((_, i) => i < 9).map((product, i) => (
|
|
300
|
+
products.filter((_, i) => i < 9 || business?.food).map((product, i) => (
|
|
300
301
|
<SingleProductCard
|
|
301
302
|
key={i}
|
|
302
303
|
isSoldOut={product.inventoried && !product.quantity}
|
|
@@ -310,7 +311,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
310
311
|
/>
|
|
311
312
|
))
|
|
312
313
|
}
|
|
313
|
-
{!categoryState?.loading && products?.length > 9 && (
|
|
314
|
+
{!business?.food && !categoryState?.loading && products?.length > 9 && (
|
|
314
315
|
<SingleProductCard
|
|
315
316
|
useCustomFunctionality
|
|
316
317
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -119,7 +119,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
119
119
|
)}
|
|
120
120
|
</div>
|
|
121
121
|
<ProductsListing>
|
|
122
|
-
{featProducts?.filter((p, index) => index < 9)?.map((product, i) => product.featured && (
|
|
122
|
+
{featProducts?.filter((p, index) => business?.food || index < 9)?.map((product, i) => product.featured && (
|
|
123
123
|
<SingleProductCard
|
|
124
124
|
key={i}
|
|
125
125
|
isSoldOut={(product?.inventoried && !product?.quantity)}
|
|
@@ -131,7 +131,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
131
131
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
132
132
|
/>
|
|
133
133
|
))}
|
|
134
|
-
{!categoryState?.loading && featProducts?.length > 9 && (
|
|
134
|
+
{!business?.food && !categoryState?.loading && featProducts?.length > 9 && (
|
|
135
135
|
<SingleProductCard
|
|
136
136
|
useCustomFunctionality
|
|
137
137
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -206,7 +206,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
206
206
|
</div>
|
|
207
207
|
<ProductsListing>
|
|
208
208
|
{
|
|
209
|
-
products.filter((p, index) => index < 9).map((product, i) => (
|
|
209
|
+
products.filter((p, index) => index < 9 || business?.food).map((product, i) => (
|
|
210
210
|
<SingleProductCard
|
|
211
211
|
key={i}
|
|
212
212
|
isSoldOut={product?.inventoried && !product?.quantity}
|
|
@@ -219,7 +219,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
219
219
|
/>
|
|
220
220
|
))
|
|
221
221
|
}
|
|
222
|
-
{!categoryState?.loading && products?.length > 9 && (
|
|
222
|
+
{!business?.food && !categoryState?.loading && products?.length > 9 && (
|
|
223
223
|
<SingleProductCard
|
|
224
224
|
useCustomFunctionality
|
|
225
225
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -429,6 +429,12 @@ const CartUI = (props) => {
|
|
|
429
429
|
</tr>
|
|
430
430
|
))
|
|
431
431
|
}
|
|
432
|
+
{orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
|
|
433
|
+
<tr>
|
|
434
|
+
<td>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</td>
|
|
435
|
+
<td>{parsePrice(cart?.delivery_price_with_discount)}</td>
|
|
436
|
+
</tr>
|
|
437
|
+
)}
|
|
432
438
|
{cart?.driver_tip > 0 && !hideDriverTip && (
|
|
433
439
|
<tr>
|
|
434
440
|
<td>
|
|
@@ -10,7 +10,7 @@ import { AutoScroll } from '../AutoScroll'
|
|
|
10
10
|
import { SingleProductCard } from '../SingleProductCard'
|
|
11
11
|
import { useTheme } from 'styled-components'
|
|
12
12
|
import { SingleOrderCard } from '../SingleOrderCard'
|
|
13
|
-
import { checkSiteUrl } from '../../../../../utils'
|
|
13
|
+
import { checkSiteUrl, getOrderStatus } from '../../../../../utils'
|
|
14
14
|
import { SingleProfessionalCard } from '../SingleProfessionalCard'
|
|
15
15
|
|
|
16
16
|
import {
|
|
@@ -71,40 +71,6 @@ const FavoriteListUI = (props) => {
|
|
|
71
71
|
setPreorderBusiness(null)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const getOrderStatus = (s) => {
|
|
75
|
-
const status = parseInt(s)
|
|
76
|
-
const orderStatus = [
|
|
77
|
-
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
|
|
78
|
-
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
|
|
79
|
-
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
|
|
80
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
|
|
81
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
|
|
82
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
|
|
83
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
|
|
84
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
|
|
85
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
|
|
86
|
-
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
|
|
87
|
-
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
|
|
88
|
-
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
|
|
89
|
-
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
|
|
90
|
-
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
|
|
91
|
-
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
|
|
92
|
-
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
|
|
93
|
-
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
|
|
94
|
-
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
|
|
95
|
-
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
|
|
96
|
-
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
|
|
97
|
-
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
|
|
98
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
|
|
99
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
|
|
100
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
|
|
101
|
-
]
|
|
102
|
-
|
|
103
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
104
|
-
|
|
105
|
-
return objectStatus && objectStatus
|
|
106
|
-
}
|
|
107
|
-
|
|
108
74
|
const onRedirectPage = (data) => {
|
|
109
75
|
events.emit('go_to_page', data)
|
|
110
76
|
}
|
|
@@ -5,6 +5,7 @@ import { useTheme } from 'styled-components'
|
|
|
5
5
|
import Skeleton from 'react-loading-skeleton'
|
|
6
6
|
import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
|
|
7
7
|
import { NotFoundSource } from '../../../../../components/NotFoundSource'
|
|
8
|
+
import { getOrderStatus } from '../../../../../utils'
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
MessagesListingContainer,
|
|
@@ -51,40 +52,6 @@ const OrdersListingUI = (props) => {
|
|
|
51
52
|
const [events] = useEvent()
|
|
52
53
|
const [{ parseDate, optimizeImage }] = useUtils()
|
|
53
54
|
|
|
54
|
-
const getOrderStatus = (s) => {
|
|
55
|
-
const status = parseInt(s)
|
|
56
|
-
const orderStatus = [
|
|
57
|
-
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
|
|
58
|
-
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
|
|
59
|
-
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
|
|
60
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
|
|
61
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
|
|
62
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
|
|
63
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
|
|
64
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
|
|
65
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
|
|
66
|
-
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
|
|
67
|
-
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
|
|
68
|
-
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
|
|
69
|
-
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
|
|
70
|
-
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
|
|
71
|
-
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
|
|
72
|
-
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
|
|
73
|
-
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
|
|
74
|
-
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
|
|
75
|
-
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
|
|
76
|
-
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
|
|
77
|
-
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
|
|
78
|
-
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
|
|
79
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
|
|
80
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
84
|
-
|
|
85
|
-
return objectStatus && objectStatus
|
|
86
|
-
}
|
|
87
|
-
|
|
88
55
|
const handleOrderClick = (e, order) => {
|
|
89
56
|
const isInvalid = e.target.closest('.view-details') || e.target.closest('.driver-selector')
|
|
90
57
|
if (isInvalid) return
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useHistory } from 'react-router-dom'
|
|
3
|
-
import { useTheme } from 'styled-components'
|
|
4
3
|
import {
|
|
5
4
|
useLanguage,
|
|
6
5
|
useUtils,
|
|
@@ -66,7 +65,6 @@ const MultiCheckoutUI = (props) => {
|
|
|
66
65
|
handleSearchRedirect
|
|
67
66
|
} = props
|
|
68
67
|
|
|
69
|
-
const theme = useTheme()
|
|
70
68
|
const [, t] = useLanguage()
|
|
71
69
|
const [{ configs }] = useConfig()
|
|
72
70
|
const [{ parsePrice }] = useUtils()
|
|
@@ -81,7 +79,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
81
79
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
82
80
|
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
83
81
|
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
|
-
const isMultiDriverTips =
|
|
82
|
+
const isMultiDriverTips = configs?.checkout_multi_business_enabled?.value === '1'
|
|
85
83
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
86
84
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
87
85
|
: configs?.driver_tip_options?.value || []
|
|
@@ -201,6 +199,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
201
199
|
<PaymentMethodContainer>
|
|
202
200
|
<h1>{t('PAYMENT_METHODS', 'Payment Methods')}</h1>
|
|
203
201
|
<MultiCartsPaymethodsAndWallets
|
|
202
|
+
userId={props.userId}
|
|
204
203
|
openCarts={openCarts}
|
|
205
204
|
paymethodSelected={paymethodSelected}
|
|
206
205
|
handleSelectPaymethod={handleSelectPaymethod}
|
|
@@ -247,7 +246,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
247
246
|
<Cart
|
|
248
247
|
isCartPending={cart?.status === 2}
|
|
249
248
|
cart={cart}
|
|
250
|
-
isMultiCheckout
|
|
249
|
+
isMultiCheckout
|
|
251
250
|
isProducts={cart?.products?.length || 0}
|
|
252
251
|
hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
|
|
253
252
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
@@ -262,7 +261,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
262
261
|
)}
|
|
263
262
|
{openCarts.length > 0 && (
|
|
264
263
|
<MultiCartPriceContainer totalFeeEnabled={totalFeeEnabled}>
|
|
265
|
-
{totalCartsFee &&
|
|
264
|
+
{!!totalCartsFee &&
|
|
266
265
|
configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' &&
|
|
267
266
|
(
|
|
268
267
|
<span>
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
useLanguage,
|
|
4
4
|
useEvent,
|
|
5
5
|
useUtils,
|
|
6
|
-
OrderDetails as OrderDetailsController
|
|
6
|
+
OrderDetails as OrderDetailsController,
|
|
7
|
+
useConfig
|
|
7
8
|
} from 'ordering-components-external'
|
|
8
9
|
import { useTheme } from 'styled-components'
|
|
9
10
|
import { Messages } from '../../../../../components/Messages'
|
|
@@ -30,7 +31,9 @@ const SingleOrderCardUI = (props) => {
|
|
|
30
31
|
orderTypes,
|
|
31
32
|
readMessages,
|
|
32
33
|
messages,
|
|
33
|
-
setMessages
|
|
34
|
+
setMessages,
|
|
35
|
+
showProgressBar,
|
|
36
|
+
getOrderStatus
|
|
34
37
|
} = props
|
|
35
38
|
|
|
36
39
|
const { order } = props.order
|
|
@@ -39,40 +42,10 @@ const SingleOrderCardUI = (props) => {
|
|
|
39
42
|
const [, t] = useLanguage()
|
|
40
43
|
const [events] = useEvent()
|
|
41
44
|
const [{ parsePrice, parseDate }] = useUtils()
|
|
45
|
+
const [{ configs }] = useConfig()
|
|
42
46
|
const [openMessages, setOpenMessages] = useState({ business: false, driver: false })
|
|
43
47
|
const [unreadAlert, setUnreadAlert] = useState({ business: false, driver: false })
|
|
44
|
-
|
|
45
|
-
const getOrderStatus = (s) => {
|
|
46
|
-
const status = parseInt(s)
|
|
47
|
-
const orderStatus = [
|
|
48
|
-
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
|
|
49
|
-
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
|
|
50
|
-
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
|
|
51
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
|
|
52
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
|
|
53
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
|
|
54
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
|
|
55
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
|
|
56
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
|
|
57
|
-
{ 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 },
|
|
58
|
-
{ 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 },
|
|
59
|
-
{ 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 },
|
|
60
|
-
{ 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 },
|
|
61
|
-
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
|
|
62
|
-
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
|
|
63
|
-
{ 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 },
|
|
64
|
-
{ 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 },
|
|
65
|
-
{ 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 },
|
|
66
|
-
{ 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 },
|
|
67
|
-
{ 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 },
|
|
68
|
-
{ 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 },
|
|
69
|
-
{ 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 },
|
|
70
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
71
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
72
|
-
]
|
|
73
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
74
|
-
return objectStatus && objectStatus
|
|
75
|
-
}
|
|
48
|
+
const hideIndividualButton = configs.multi_business_checkout_remove_individual_buttons?.value === '1'
|
|
76
49
|
|
|
77
50
|
const handleGoToOrderDetails = (uuid) => {
|
|
78
51
|
events.emit('go_to_page', { page: 'order_detail', params: { orderId: uuid }, replace: !props.isMultiOrders })
|
|
@@ -119,13 +92,15 @@ const SingleOrderCardUI = (props) => {
|
|
|
119
92
|
</p>
|
|
120
93
|
</div>
|
|
121
94
|
</div>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
95
|
+
{!hideIndividualButton && (
|
|
96
|
+
<Button
|
|
97
|
+
outline
|
|
98
|
+
color='primary'
|
|
99
|
+
onClick={() => handleGoToOrderDetails(order?.uuid)}
|
|
100
|
+
>
|
|
101
|
+
{t('ORDER_DETAILS', 'Order Details')}
|
|
102
|
+
</Button>
|
|
103
|
+
)}
|
|
129
104
|
</SingleOrderHeader>
|
|
130
105
|
<OrderBusinessDetails>
|
|
131
106
|
<OrderBusinessWrapper>
|
|
@@ -155,8 +130,12 @@ const SingleOrderCardUI = (props) => {
|
|
|
155
130
|
</MessagesIcon>
|
|
156
131
|
</ActionsBlock>
|
|
157
132
|
</OrderBusinessDetails>
|
|
158
|
-
|
|
159
|
-
|
|
133
|
+
{showProgressBar && (
|
|
134
|
+
<>
|
|
135
|
+
<StatusBar percentage={getOrderStatus(order?.status)?.percentage} />
|
|
136
|
+
<p className='order-status'>{getOrderStatus(order?.status)?.value}</p>
|
|
137
|
+
</>
|
|
138
|
+
)}
|
|
160
139
|
<p className='order-total'>{t('EXPORT_ORDER_TOTAL', 'Order total')}: {parsePrice(order?.summary?.total ?? order?.total)}</p>
|
|
161
140
|
|
|
162
141
|
{openMessages.business && (
|
|
@@ -164,7 +143,7 @@ const SingleOrderCardUI = (props) => {
|
|
|
164
143
|
open={openMessages.business}
|
|
165
144
|
onClose={() => setOpenMessages({ driver: false, business: false })}
|
|
166
145
|
width='70%'
|
|
167
|
-
|
|
146
|
+
// padding='0'
|
|
168
147
|
>
|
|
169
148
|
<Messages
|
|
170
149
|
orderId={order?.id}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { useLanguage, useUtils, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components-external'
|
|
2
|
+
import { useLanguage, useUtils, MultiOrdersDetails as MultiOrdersDetailsController, useConfig } from 'ordering-components-external'
|
|
3
3
|
import { Image } from '../../../../../components/Image'
|
|
4
4
|
import Skeleton from 'react-loading-skeleton'
|
|
5
5
|
import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
|
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
PhotoWrapper,
|
|
16
16
|
OrderSummary,
|
|
17
17
|
SingleOrderContainer,
|
|
18
|
-
Divider
|
|
18
|
+
Divider,
|
|
19
|
+
StatusBar,
|
|
20
|
+
StatusBarContainer
|
|
19
21
|
} from './styles'
|
|
20
22
|
import { NotFoundSource } from '../NotFoundSource'
|
|
21
23
|
import { useTheme } from 'styled-components'
|
|
@@ -33,7 +35,11 @@ const MultiOrdersDetailsUI = (props) => {
|
|
|
33
35
|
const theme = useTheme()
|
|
34
36
|
const [, t] = useLanguage()
|
|
35
37
|
const [{ parsePrice }] = useUtils()
|
|
38
|
+
const [{ configs }] = useConfig()
|
|
36
39
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
40
|
+
const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
|
|
41
|
+
const showBarInOrder = ['group', 'both']
|
|
42
|
+
const showBarInIndividual = ['individual', 'both']
|
|
37
43
|
|
|
38
44
|
const isTaxIncludedOnPrice = orders.every(_order => _order.taxes?.length ? _order.taxes?.every(_tax => _tax.type === 1) : true)
|
|
39
45
|
|
|
@@ -116,6 +122,12 @@ const MultiOrdersDetailsUI = (props) => {
|
|
|
116
122
|
) : (
|
|
117
123
|
<OrderSummary>
|
|
118
124
|
<h3>{t('ORDER_SUMMARY', 'Order summary')}</h3>
|
|
125
|
+
{(showBarInOrder.includes(progressBarStyle)) && (
|
|
126
|
+
<StatusBarContainer>
|
|
127
|
+
<StatusBar percentage={getOrderStatus(orders[0]?.status)?.percentage} />
|
|
128
|
+
<p className='order-status'>{getOrderStatus(orders[0]?.status)?.value}</p>
|
|
129
|
+
</StatusBarContainer>
|
|
130
|
+
)}
|
|
119
131
|
<table>
|
|
120
132
|
<tbody>
|
|
121
133
|
{orders.map(order => (
|
|
@@ -171,6 +183,7 @@ const MultiOrdersDetailsUI = (props) => {
|
|
|
171
183
|
isMultiOrders
|
|
172
184
|
getOrderStatus={getOrderStatus}
|
|
173
185
|
order={order}
|
|
186
|
+
showProgressBar={showBarInIndividual.includes(progressBarStyle)}
|
|
174
187
|
/>
|
|
175
188
|
))}
|
|
176
189
|
</>
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
import { useTheme } from 'styled-components'
|
|
75
75
|
import { TaxInformation } from '../TaxInformation'
|
|
76
76
|
|
|
77
|
-
import { getGoogleMapImage } from '../../../../../utils'
|
|
77
|
+
import { getGoogleMapImage, getOrderStatus } from '../../../../../utils'
|
|
78
78
|
import { OrderHistory } from './OrderHistory'
|
|
79
79
|
import { ReviewProfessional } from '../ReviewProfessional'
|
|
80
80
|
import { OrderActionsSection } from './OrderActionsSection'
|
|
@@ -148,40 +148,6 @@ const OrderDetailsUI = (props) => {
|
|
|
148
148
|
const showCustomerEmail = !orderingTheme?.theme?.confirmation?.components?.customer?.components?.email?.hidden
|
|
149
149
|
const showCustomerPhoto = !orderingTheme?.theme?.confirmation?.components?.customer?.components?.photo?.hidden
|
|
150
150
|
|
|
151
|
-
const getOrderStatus = (s) => {
|
|
152
|
-
const status = parseInt(s)
|
|
153
|
-
const orderStatus = [
|
|
154
|
-
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
|
|
155
|
-
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
|
|
156
|
-
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
|
|
157
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
|
|
158
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
|
|
159
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
|
|
160
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
|
|
161
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
|
|
162
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
|
|
163
|
-
{ 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 },
|
|
164
|
-
{ 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 },
|
|
165
|
-
{ 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 },
|
|
166
|
-
{ 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 },
|
|
167
|
-
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
|
|
168
|
-
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
|
|
169
|
-
{ 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 },
|
|
170
|
-
{ 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 },
|
|
171
|
-
{ 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 },
|
|
172
|
-
{ 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 },
|
|
173
|
-
{ 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 },
|
|
174
|
-
{ 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 },
|
|
175
|
-
{ 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 },
|
|
176
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
177
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
178
|
-
]
|
|
179
|
-
|
|
180
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
181
|
-
|
|
182
|
-
return objectStatus && objectStatus
|
|
183
|
-
}
|
|
184
|
-
|
|
185
151
|
const validTrackingStatus = [9, 19, 23]
|
|
186
152
|
const mapConfigs = { zoom: 15 }
|
|
187
153
|
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
TimeWrapper,
|
|
24
24
|
OrderProgressWrapper
|
|
25
25
|
} from './styles'
|
|
26
|
+
import { getOrderStatus } from '../../../../../utils'
|
|
26
27
|
|
|
27
28
|
const OrderProgressUI = (props) => {
|
|
28
29
|
const {
|
|
@@ -35,40 +36,6 @@ const OrderProgressUI = (props) => {
|
|
|
35
36
|
const [events] = useEvent()
|
|
36
37
|
const [lastOrder, setLastOrder] = useState(null)
|
|
37
38
|
|
|
38
|
-
const getOrderStatus = (s) => {
|
|
39
|
-
const status = parseInt(s)
|
|
40
|
-
const orderStatus = [
|
|
41
|
-
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
|
|
42
|
-
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
|
|
43
|
-
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
|
|
44
|
-
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
|
|
45
|
-
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
|
|
46
|
-
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
|
|
47
|
-
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
|
|
48
|
-
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
|
|
49
|
-
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
|
|
50
|
-
{ 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 },
|
|
51
|
-
{ 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 },
|
|
52
|
-
{ 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 },
|
|
53
|
-
{ 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 },
|
|
54
|
-
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
|
|
55
|
-
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
|
|
56
|
-
{ 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 },
|
|
57
|
-
{ 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 },
|
|
58
|
-
{ 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 },
|
|
59
|
-
{ 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 },
|
|
60
|
-
{ 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 },
|
|
61
|
-
{ 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 },
|
|
62
|
-
{ 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 },
|
|
63
|
-
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
64
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
68
|
-
|
|
69
|
-
return objectStatus && objectStatus
|
|
70
|
-
}
|
|
71
|
-
|
|
72
39
|
const convertDiffToHours = (time) => {
|
|
73
40
|
if (!time) return
|
|
74
41
|
const deliveryTime = lastOrder?.delivery_datetime_utc
|
|
@@ -6,7 +6,7 @@ import { ReviewProduct } from '../ReviewProduct'
|
|
|
6
6
|
import { ReviewDriver } from '../ReviewDriver'
|
|
7
7
|
|
|
8
8
|
import { useTheme } from 'styled-components'
|
|
9
|
-
import { getGoogleMapImage } from '../../../../../utils'
|
|
9
|
+
import { getGoogleMapImage, getOrderStatus } from '../../../../../utils'
|
|
10
10
|
import BsDot from '@meronex/icons/bs/BsDot'
|
|
11
11
|
import { Button } from '../../styles/Buttons'
|
|
12
12
|
import Skeleton from 'react-loading-skeleton'
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
const SingleOrderCardUI = (props) => {
|
|
34
34
|
const {
|
|
35
35
|
order,
|
|
36
|
-
getOrderStatus,
|
|
37
36
|
isBusinessesPage,
|
|
38
37
|
handleReorder,
|
|
39
38
|
customArray,
|