ordering-ui-react-native 0.17.98 → 0.17.99-release
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/package.json +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +19 -18
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +60 -47
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
- package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
- package/themes/business/src/components/StoresList/index.tsx +3 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +24 -10
- package/themes/business/src/utils/index.tsx +29 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/Checkout/index.tsx +323 -42
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +12 -4
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -5
- package/themes/original/src/components/GPSButton/index.tsx +6 -4
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/MomentOption/index.tsx +44 -39
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +346 -68
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +12 -1
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
- package/themes/original/src/components/OrderDetails/index.tsx +50 -38
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/index.tsx +43 -20
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/index.tsx +65 -34
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
- package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
- package/themes/original/src/components/Promotions/index.tsx +2 -2
- package/themes/original/src/components/Promotions/styles.tsx +3 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +40 -20
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +3 -8
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +7 -25
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +51 -61
- package/themes/original/src/components/Wallets/styles.tsx +2 -4
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/types/index.tsx +30 -7
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
import * as React from 'react'
|
|
2
5
|
import styled, { useTheme } from 'styled-components/native'
|
|
3
6
|
import { OButton, OIcon, OText } from '../shared'
|
|
@@ -9,7 +12,6 @@ const TitleWrapper = styled.View`
|
|
|
9
12
|
padding-horizontal: 10px;
|
|
10
13
|
`
|
|
11
14
|
const TitleTopWrapper = styled.View`
|
|
12
|
-
flex: 1;
|
|
13
15
|
flex-direction: row;
|
|
14
16
|
align-items: center;
|
|
15
17
|
`
|
|
@@ -17,8 +19,10 @@ const TitleTopWrapper = styled.View`
|
|
|
17
19
|
const btnBackArrow = {
|
|
18
20
|
borderWidth: 0,
|
|
19
21
|
backgroundColor: '#FFF',
|
|
20
|
-
borderColor: '#
|
|
21
|
-
shadowColor: '#FFF'
|
|
22
|
+
borderColor: '#fff',
|
|
23
|
+
shadowColor: '#FFF',
|
|
24
|
+
paddingLeft: 30,
|
|
25
|
+
paddingRight: 30
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
interface Props {
|
|
@@ -42,6 +46,7 @@ interface Props {
|
|
|
42
46
|
paddingTop?: number,
|
|
43
47
|
isVertical?: boolean,
|
|
44
48
|
noMargin?: any
|
|
49
|
+
hideArrowLeft?: boolean
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
const NavBar = (props: Props) => {
|
|
@@ -52,8 +57,6 @@ const NavBar = (props: Props) => {
|
|
|
52
57
|
background-color: ${theme.colors.white};
|
|
53
58
|
padding: 10px 20px 20px 0px;
|
|
54
59
|
flex-direction: row;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
align-items: center;
|
|
57
60
|
position: relative;
|
|
58
61
|
`
|
|
59
62
|
|
|
@@ -62,13 +65,18 @@ const NavBar = (props: Props) => {
|
|
|
62
65
|
}
|
|
63
66
|
return (
|
|
64
67
|
<Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
{!props.hideArrowLeft && (
|
|
69
|
+
<OButton
|
|
70
|
+
iconProps={{
|
|
71
|
+
name: 'arrowleft',
|
|
72
|
+
size: 26
|
|
73
|
+
}}
|
|
74
|
+
icon={AntDesignIcon}
|
|
75
|
+
imgRightSrc={null}
|
|
76
|
+
style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
|
|
77
|
+
onClick={props?.onActionLeft}
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
72
80
|
<TitleTopWrapper>
|
|
73
81
|
{props.withIcon
|
|
74
82
|
? (
|
|
@@ -87,7 +95,6 @@ const NavBar = (props: Props) => {
|
|
|
87
95
|
<TitleWrapper style={{ ...{ paddingHorizontal: props.isVertical ? 0 : 10 }, ...props.titleWrapStyle }}>
|
|
88
96
|
<OText
|
|
89
97
|
size={20}
|
|
90
|
-
lineHeight={36}
|
|
91
98
|
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
92
99
|
style={
|
|
93
100
|
{
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { View } from 'react-native'
|
|
3
|
-
import { OButton,
|
|
3
|
+
import { OButton, OText } from '../shared'
|
|
4
4
|
import { NotFoundSourceParams } from '../../types'
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
6
|
+
import Foundation from 'react-native-vector-icons/Foundation'
|
|
6
7
|
import {
|
|
7
8
|
NotFound,
|
|
8
9
|
NotFoundImage
|
|
@@ -10,34 +11,37 @@ import {
|
|
|
10
11
|
|
|
11
12
|
export const NotFoundSource = (props: NotFoundSourceParams) => {
|
|
12
13
|
const {
|
|
13
|
-
|
|
14
|
+
hideImage,
|
|
14
15
|
content,
|
|
15
16
|
btnTitle,
|
|
17
|
+
btnStyle,
|
|
16
18
|
conditioned,
|
|
17
19
|
onClickButton
|
|
18
20
|
} = props
|
|
19
21
|
|
|
20
22
|
const theme = useTheme();
|
|
21
23
|
|
|
22
|
-
const errorImage = image || theme.images.general.notFound
|
|
23
|
-
const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
|
|
24
|
-
|
|
25
24
|
return (
|
|
26
25
|
<NotFound>
|
|
27
|
-
{
|
|
26
|
+
{!hideImage && (
|
|
28
27
|
<NotFoundImage>
|
|
29
|
-
<
|
|
28
|
+
<Foundation
|
|
29
|
+
name='page-search'
|
|
30
|
+
color={theme.colors.primary}
|
|
31
|
+
size={60}
|
|
32
|
+
style={{ marginBottom: 10 }}
|
|
33
|
+
/>
|
|
30
34
|
</NotFoundImage>
|
|
31
35
|
)}
|
|
32
|
-
{content && conditioned &&
|
|
33
|
-
{content && !conditioned && <OText color={theme.colors.disabled} size={
|
|
36
|
+
{content && conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
|
|
37
|
+
{content && !conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
|
|
34
38
|
{!onClickButton && props.children && (
|
|
35
39
|
props.children
|
|
36
40
|
)}
|
|
37
41
|
{onClickButton && (
|
|
38
42
|
<View style={{ marginTop: 10, width: '100%' }}>
|
|
39
43
|
<OButton
|
|
40
|
-
style={{ width: '100%', height: 50 }}
|
|
44
|
+
style={{ width: '100%', height: 50, ...btnStyle }}
|
|
41
45
|
bgColor={theme.colors.primary}
|
|
42
46
|
borderColor={theme.colors.primary}
|
|
43
47
|
onClick={() => onClickButton()}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useUtils } from 'ordering-components/native'
|
|
3
|
+
import moment from 'moment'
|
|
4
|
+
|
|
5
|
+
export const OrderEta = (props: any) => {
|
|
6
|
+
const {
|
|
7
|
+
order,
|
|
8
|
+
outputFormat
|
|
9
|
+
} = props
|
|
10
|
+
|
|
11
|
+
const [{ parseDate }] = useUtils()
|
|
12
|
+
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
|
+
|
|
14
|
+
const getEstimatedDeliveryTime = () => {
|
|
15
|
+
let estimatedUtcTime = null
|
|
16
|
+
let totalEta = 0
|
|
17
|
+
if (order?.delivered_in) totalEta += order?.delivered_in
|
|
18
|
+
if (order?.prepared_in) totalEta += order?.prepared_in
|
|
19
|
+
if (order?.delivery_type === 1 && order?.eta_drive_time) {
|
|
20
|
+
totalEta += order?.eta_drive_time
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const _delivery = order?.delivery_datetime_utc
|
|
24
|
+
? order?.delivery_datetime_utc
|
|
25
|
+
: order?.delivery_datetime
|
|
26
|
+
|
|
27
|
+
if (order?.eta_current_status_time) {
|
|
28
|
+
const currentStatueEta = order?.eta_current_status_time
|
|
29
|
+
totalEta += currentStatueEta
|
|
30
|
+
let previousStatusTimes = 0
|
|
31
|
+
if (order?.eta_previous_status_times) {
|
|
32
|
+
Object.keys(order.eta_previous_status_times).map(key => {
|
|
33
|
+
if (!key.includes('status_penalty')) {
|
|
34
|
+
previousStatusTimes += order.eta_previous_status_times[key]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
totalEta += previousStatusTimes
|
|
39
|
+
|
|
40
|
+
let nextStatusTimes = 0
|
|
41
|
+
if (order?.eta_next_status_times) {
|
|
42
|
+
Object.keys(order.eta_next_status_times).map(key => {
|
|
43
|
+
if (!key.includes('status_penalty')) {
|
|
44
|
+
nextStatusTimes += order.eta_next_status_times[key]
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
totalEta += nextStatusTimes
|
|
49
|
+
|
|
50
|
+
const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
|
|
51
|
+
const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
|
|
52
|
+
if (diffTimeAsMinutes <= 0) {
|
|
53
|
+
totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
totalEta = order?.eta_time + totalEta
|
|
57
|
+
}
|
|
58
|
+
estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
|
|
59
|
+
const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
|
|
60
|
+
setEstimatedDeliveryTime(_estimatedTime)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
getEstimatedDeliveryTime()
|
|
65
|
+
const interval = setInterval(() => {
|
|
66
|
+
getEstimatedDeliveryTime()
|
|
67
|
+
}, 1000)
|
|
68
|
+
return () => clearInterval(interval)
|
|
69
|
+
}, [order, outputFormat])
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{estimatedDeliveryTime}
|
|
74
|
+
</>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -4,6 +4,7 @@ import { ScrollView, StyleSheet, View } from 'react-native'
|
|
|
4
4
|
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
5
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
6
|
import { OText, OButton } from '../shared'
|
|
7
|
+
import { formatSeconds } from '../../utils'
|
|
7
8
|
|
|
8
9
|
export const OrderHistory = (props: any) => {
|
|
9
10
|
const {
|
|
@@ -61,7 +62,7 @@ export const OrderHistory = (props: any) => {
|
|
|
61
62
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
62
63
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
63
64
|
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
64
|
-
|
|
65
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
const getLogisticTagStatus = (status: any) => {
|
|
@@ -106,8 +107,12 @@ export const OrderHistory = (props: any) => {
|
|
|
106
107
|
ellipsizeMode='tail'
|
|
107
108
|
>
|
|
108
109
|
{t('ORDER_PLACED', 'Order placed')} {' '}
|
|
109
|
-
{
|
|
110
|
-
|
|
110
|
+
{!props.hideViaText && (
|
|
111
|
+
<>
|
|
112
|
+
{t('VIA', 'Via')}{' '}
|
|
113
|
+
{order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
111
116
|
</OText>
|
|
112
117
|
<OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
113
118
|
</View>
|
|
@@ -128,12 +133,23 @@ export const OrderHistory = (props: any) => {
|
|
|
128
133
|
<OText
|
|
129
134
|
size={14}
|
|
130
135
|
weight='bold'
|
|
131
|
-
numberOfLines={1}
|
|
136
|
+
numberOfLines={message.change?.attribute.includes(['delivered_in', 'prepared_in']) ? 2 : 1}
|
|
132
137
|
ellipsizeMode='tail'
|
|
133
138
|
>
|
|
134
139
|
{message.change?.attribute === 'logistic_status'
|
|
135
140
|
? getLogisticTagStatus(parseInt(message.change.new, 10))
|
|
136
|
-
:
|
|
141
|
+
: message.change?.attribute === 'delivered_in' ? (
|
|
142
|
+
<>
|
|
143
|
+
{t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}{'\n'}
|
|
144
|
+
{formatSeconds(parseInt(message.change.new, 10))}
|
|
145
|
+
</>
|
|
146
|
+
)
|
|
147
|
+
: message.change?.attribute === 'prepared_in' ? (
|
|
148
|
+
<>
|
|
149
|
+
{t('TIME_ADDED_BY_BUSINESS', 'Time added by business')}{'\n'}
|
|
150
|
+
{formatSeconds(parseInt(message.change.new, 10))}
|
|
151
|
+
</>
|
|
152
|
+
) : t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
137
153
|
}
|
|
138
154
|
</OText>
|
|
139
155
|
) : (
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
OrderDetails as OrderDetailsConTableoller,
|
|
8
8
|
useUtils,
|
|
9
9
|
useOrder,
|
|
10
|
-
useConfig
|
|
10
|
+
useConfig,
|
|
11
|
+
useToast,
|
|
12
|
+
ToastType
|
|
11
13
|
} from 'ordering-components/native';
|
|
12
14
|
import { useTheme } from 'styled-components/native';
|
|
13
15
|
import { showLocation } from 'react-native-map-link';
|
|
@@ -40,7 +42,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
|
40
42
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
41
43
|
import { OrderDetailsParams } from '../../types';
|
|
42
44
|
import { GoogleMap } from '../GoogleMap';
|
|
43
|
-
import { verifyDecimals, getOrderStatus } from '../../utils';
|
|
45
|
+
import { verifyDecimals, getOrderStatus, getOrderStatuPickUp } from '../../utils';
|
|
44
46
|
import { OSRow } from '../OrderSummary/styles';
|
|
45
47
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
46
48
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -49,6 +51,7 @@ import NavBar from '../NavBar'
|
|
|
49
51
|
import { OrderHistory } from './OrderHistory';
|
|
50
52
|
import { PlaceSpot } from '../PlaceSpot'
|
|
51
53
|
import { SendGiftCard } from '../GiftCard/SendGiftCard'
|
|
54
|
+
import { OrderEta } from './OrderEta'
|
|
52
55
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
53
56
|
const {
|
|
54
57
|
navigation,
|
|
@@ -64,7 +67,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
64
67
|
} = props;
|
|
65
68
|
|
|
66
69
|
const theme = useTheme();
|
|
67
|
-
|
|
70
|
+
const [, { showToast }] = useToast()
|
|
68
71
|
const styles = StyleSheet.create({
|
|
69
72
|
rowDirection: {
|
|
70
73
|
flexDirection: 'row',
|
|
@@ -120,7 +123,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
120
123
|
const mapValidStatuses = [9, 19, 23]
|
|
121
124
|
const placeSpotTypes = [3, 4, 5]
|
|
122
125
|
const directionTypes = [2, 3, 4, 5]
|
|
123
|
-
const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
126
|
+
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
127
|
+
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
128
|
+
const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
|
|
124
129
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
125
130
|
const isGiftCardOrder = !order?.business_id
|
|
126
131
|
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
@@ -134,6 +139,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
134
139
|
const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
|
|
135
140
|
const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
|
|
136
141
|
const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
|
|
142
|
+
const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
|
|
137
143
|
const walletName: any = {
|
|
138
144
|
cash: {
|
|
139
145
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
@@ -191,7 +197,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
191
197
|
order: {
|
|
192
198
|
id: order?.id,
|
|
193
199
|
business_id: order?.business_id,
|
|
194
|
-
logo: order.business?.logo,
|
|
200
|
+
logo: order.business?.logo || theme.images.dummies.businessLogo,
|
|
195
201
|
driver: order?.driver,
|
|
196
202
|
products: order?.products,
|
|
197
203
|
review: order?.review,
|
|
@@ -335,6 +341,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
335
341
|
}
|
|
336
342
|
}, [driverLocation]);
|
|
337
343
|
|
|
344
|
+
useEffect(() => {
|
|
345
|
+
if (props?.order?.error && !props?.order?.loading) {
|
|
346
|
+
showToast(ToastType.Error, props?.order?.error)
|
|
347
|
+
navigation.navigate('BusinessList')
|
|
348
|
+
}
|
|
349
|
+
}, [props?.order?.error, props?.order?.loading])
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
if (!order?.delivery_type) return
|
|
354
|
+
setIsPickup(order?.delivery_type === 2)
|
|
355
|
+
}, [order?.delivery_type])
|
|
356
|
+
|
|
338
357
|
return (
|
|
339
358
|
<OrderDetailsContainer
|
|
340
359
|
keyboardShouldPersistTaps="handled"
|
|
@@ -410,13 +429,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
410
429
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
411
430
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
412
431
|
subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
413
|
-
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
: parseDate(order?.delivery_datetime, { utc: false })
|
|
419
|
-
}
|
|
432
|
+
{activeStatus.includes(order?.status) ? (
|
|
433
|
+
<OrderEta order={order} />
|
|
434
|
+
) : (
|
|
435
|
+
parseDate(order?.reporting_data?.at[`status:${order.status}`])
|
|
436
|
+
)}
|
|
420
437
|
</OText>}
|
|
421
438
|
/>
|
|
422
439
|
{enabledPoweredByOrdering && (
|
|
@@ -472,7 +489,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
472
489
|
<LinearGradient
|
|
473
490
|
start={{ x: 0.0, y: 0.0 }}
|
|
474
491
|
end={{
|
|
475
|
-
x:
|
|
492
|
+
x: progressBarObjt(order?.status)?.percentage || 0,
|
|
476
493
|
y: 0,
|
|
477
494
|
}}
|
|
478
495
|
locations={[0.9999, 0.9999]}
|
|
@@ -485,7 +502,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
485
502
|
lineHeight={24}
|
|
486
503
|
weight={'600'}
|
|
487
504
|
color={theme.colors.textNormal}>
|
|
488
|
-
{
|
|
505
|
+
{progressBarObjt(order?.status)?.value}
|
|
489
506
|
</OText>
|
|
490
507
|
</>
|
|
491
508
|
)}
|
|
@@ -783,25 +800,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
783
800
|
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
784
801
|
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
785
802
|
/>
|
|
786
|
-
{(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
798
|
-
imgRightSrc={null}
|
|
799
|
-
borderColor='transparent'
|
|
800
|
-
bgColor={theme.colors.primary + 10}
|
|
801
|
-
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
802
|
-
onClick={() => handleReorder && handleReorder(order.id)}
|
|
803
|
-
/>
|
|
804
|
-
)}
|
|
803
|
+
{(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && !isGiftCardOrder && (
|
|
804
|
+
<OButton
|
|
805
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
806
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
807
|
+
imgRightSrc={null}
|
|
808
|
+
borderColor='transparent'
|
|
809
|
+
bgColor={theme.colors.primary + 10}
|
|
810
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
811
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
812
|
+
/>
|
|
813
|
+
)}
|
|
805
814
|
</OrderAction>
|
|
806
815
|
</HeaderInfo>
|
|
807
816
|
<OrderProducts>
|
|
@@ -935,7 +944,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
935
944
|
</Table>
|
|
936
945
|
))
|
|
937
946
|
}
|
|
938
|
-
{order?.summary?.delivery_price
|
|
947
|
+
{typeof order?.summary?.delivery_price === 'number' && (
|
|
939
948
|
<Table>
|
|
940
949
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
941
950
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
|
|
@@ -1010,16 +1019,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1010
1019
|
<OText>
|
|
1011
1020
|
{event?.wallet_event
|
|
1012
1021
|
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
1013
|
-
: event?.paymethod?.name}
|
|
1022
|
+
: t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
|
|
1014
1023
|
</OText>
|
|
1015
|
-
{event?.data?.charge_id && (
|
|
1024
|
+
{/* {event?.data?.charge_id && (
|
|
1016
1025
|
<OText>
|
|
1017
1026
|
{`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
|
|
1018
1027
|
</OText>
|
|
1019
|
-
)}
|
|
1028
|
+
)} */}
|
|
1020
1029
|
</View>
|
|
1021
1030
|
<OText>
|
|
1022
|
-
|
|
1031
|
+
{configs.currency_position?.value === 'left'
|
|
1032
|
+
? `${configs.format_number_currency?.value} -${parseNumber(event.amount, { isTruncable: true })}`
|
|
1033
|
+
: `-${parsePrice(event.amount, { isTruncable: true })}`}
|
|
1023
1034
|
</OText>
|
|
1024
1035
|
</View>
|
|
1025
1036
|
))}
|
|
@@ -1065,6 +1076,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1065
1076
|
>
|
|
1066
1077
|
<OrderHistory
|
|
1067
1078
|
order={order}
|
|
1079
|
+
hideViaText={props.hideViaText}
|
|
1068
1080
|
messages={messages}
|
|
1069
1081
|
enableReview={(
|
|
1070
1082
|
parseInt(order?.status) === 1 ||
|
|
@@ -20,7 +20,8 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
20
20
|
currentCart,
|
|
21
21
|
handleUpdateProducts,
|
|
22
22
|
navigation,
|
|
23
|
-
searchValue
|
|
23
|
+
searchValue,
|
|
24
|
+
businessSingleId
|
|
24
25
|
} = props
|
|
25
26
|
|
|
26
27
|
const [, t] = useLanguage()
|
|
@@ -65,6 +66,7 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
|
|
|
65
66
|
handleUpdateProducts={handleUpdateProducts}
|
|
66
67
|
navigation={navigation}
|
|
67
68
|
isPreviously
|
|
69
|
+
businessSingleId={businessSingleId}
|
|
68
70
|
/>
|
|
69
71
|
</ProductWrapper>
|
|
70
72
|
))}
|
|
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
OrderList,
|
|
4
4
|
useLanguage,
|
|
5
|
-
useUtils
|
|
5
|
+
useUtils,
|
|
6
|
+
useConfig
|
|
6
7
|
} from 'ordering-components/native'
|
|
7
8
|
import { useTheme } from 'styled-components/native';
|
|
8
9
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
@@ -12,6 +13,7 @@ import { NotFoundSource } from '../NotFoundSource'
|
|
|
12
13
|
import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native'
|
|
13
14
|
import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
|
|
14
15
|
import FastImage from 'react-native-fast-image'
|
|
16
|
+
import { OrderEta } from '../OrderDetails/OrderEta'
|
|
15
17
|
import {
|
|
16
18
|
ProgressContentWrapper,
|
|
17
19
|
ProgressBar,
|
|
@@ -20,7 +22,7 @@ import {
|
|
|
20
22
|
OrderInfoWrapper,
|
|
21
23
|
OrderProgressWrapper
|
|
22
24
|
} from './styles'
|
|
23
|
-
import { getOrderStatus } from '../../utils'
|
|
25
|
+
import { getOrderStatuPickUp, getOrderStatus } from '../../utils'
|
|
24
26
|
|
|
25
27
|
const OrderProgressUI = (props: any) => {
|
|
26
28
|
const {
|
|
@@ -33,10 +35,12 @@ const OrderProgressUI = (props: any) => {
|
|
|
33
35
|
const theme = useTheme();
|
|
34
36
|
|
|
35
37
|
const [, t] = useLanguage()
|
|
36
|
-
const [{ optimizeImage,
|
|
38
|
+
const [{ optimizeImage, parseTime, parseDate }] = useUtils()
|
|
39
|
+
const [{ configs }] = useConfig()
|
|
37
40
|
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
38
41
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
39
42
|
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
43
|
+
const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
40
44
|
|
|
41
45
|
const styles = StyleSheet.create({
|
|
42
46
|
main: {
|
|
@@ -76,15 +80,6 @@ const OrderProgressUI = (props: any) => {
|
|
|
76
80
|
}
|
|
77
81
|
});
|
|
78
82
|
|
|
79
|
-
const convertDiffToHours = (order: any) => {
|
|
80
|
-
const minute = order?.eta_time
|
|
81
|
-
const deliveryTime = order?.delivery_datetime_utc
|
|
82
|
-
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
83
|
-
: parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
84
|
-
const returnedDate = moment(deliveryTime).add(minute, 'minutes').format('hh:mm A')
|
|
85
|
-
return returnedDate
|
|
86
|
-
}
|
|
87
|
-
|
|
88
83
|
const handleGoToOrder = (index: string) => {
|
|
89
84
|
navigation && navigation.navigate(index)
|
|
90
85
|
}
|
|
@@ -92,7 +87,15 @@ const OrderProgressUI = (props: any) => {
|
|
|
92
87
|
useEffect(() => {
|
|
93
88
|
if (orderList?.orders.length > 0) {
|
|
94
89
|
const sortedOrders = orderList.orders.sort((a: any, b: any) => a.id > b.id ? -1 : 1)
|
|
95
|
-
|
|
90
|
+
const orderInProgress = sortedOrders.find((order: any) => (statusToShow.includes(order.status)))
|
|
91
|
+
|
|
92
|
+
let _lastOrder = null
|
|
93
|
+
if (orderInProgress) {
|
|
94
|
+
_lastOrder = orderInProgress
|
|
95
|
+
} else {
|
|
96
|
+
_lastOrder = sortedOrders[0]
|
|
97
|
+
}
|
|
98
|
+
setLastOrder(_lastOrder)
|
|
96
99
|
}
|
|
97
100
|
}, [orderList?.orders])
|
|
98
101
|
|
|
@@ -107,6 +110,8 @@ const OrderProgressUI = (props: any) => {
|
|
|
107
110
|
setInitialLoaded(true)
|
|
108
111
|
}, [orderList.loading, initialLoaded])
|
|
109
112
|
|
|
113
|
+
const progressBarObjt = lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
|
|
114
|
+
|
|
110
115
|
return (
|
|
111
116
|
<>
|
|
112
117
|
{(orderList?.loading && !initialLoaded) && (
|
|
@@ -125,11 +130,11 @@ const OrderProgressUI = (props: any) => {
|
|
|
125
130
|
<View style={styles.logoWrapper}>
|
|
126
131
|
<FastImage
|
|
127
132
|
style={{ width: 50, height: 50 }}
|
|
128
|
-
source={{
|
|
133
|
+
source={orderList?.orders.length === 1 ? {
|
|
129
134
|
uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
|
|
130
135
|
priority: FastImage.priority.normal,
|
|
131
|
-
}}
|
|
132
|
-
resizeMode={FastImage.resizeMode.
|
|
136
|
+
} : theme.images.logos.logotype}
|
|
137
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
133
138
|
/>
|
|
134
139
|
</View>
|
|
135
140
|
<View style={{
|
|
@@ -143,8 +148,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
143
148
|
fontWeight: 'bold',
|
|
144
149
|
marginBottom: 3
|
|
145
150
|
}}
|
|
146
|
-
>{t('ORDER_IN_PROGRESS', 'Order in progress')}</OText>
|
|
147
|
-
<OText size={11} numberOfLines={1} ellipsizeMode='tail'>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</OText>
|
|
151
|
+
>{statusToShow.includes(lastOrder?.status) ? t('ORDER_IN_PROGRESS', 'Order in progress') : t('ORDER', 'Order')}</OText>
|
|
148
152
|
<TouchableOpacity onPress={() => handleGoToOrder('MyOrders')}>
|
|
149
153
|
<View style={styles.navigationButton}>
|
|
150
154
|
<OText size={11} color={theme.colors.primary}>{t('GO_TO_MY_ORDERS', 'Go to my orders')}</OText>
|
|
@@ -160,18 +164,22 @@ const OrderProgressUI = (props: any) => {
|
|
|
160
164
|
</OrderInfoWrapper>
|
|
161
165
|
<View style={{ flex: 1 }}>
|
|
162
166
|
<ProgressContentWrapper>
|
|
163
|
-
<ProgressBar style={{ width:
|
|
167
|
+
<ProgressBar style={{ width: progressBarObjt(lastOrder.status)?.percentage ? `${(progressBarObjt(lastOrder.status) as any).percentage * 100}%` : '0%' }} />
|
|
164
168
|
</ProgressContentWrapper>
|
|
165
169
|
<ProgressTextWrapper>
|
|
166
|
-
<OText size={12} style={{ width: '50%' }}>{
|
|
170
|
+
<OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
|
|
167
171
|
<TimeWrapper>
|
|
168
|
-
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
172
|
+
<OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
169
173
|
<OText size={11}>
|
|
170
174
|
{lastOrder?.delivery_datetime_utc
|
|
171
|
-
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: '
|
|
175
|
+
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
|
|
172
176
|
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
173
177
|
-
|
|
174
|
-
{
|
|
178
|
+
{statusToShow.includes(lastOrder?.status) ? (
|
|
179
|
+
<OrderEta order={lastOrder} outputFormat={configs?.general_hour_format?.value || 'HH:mm'} />
|
|
180
|
+
) : (
|
|
181
|
+
parseDate(lastOrder?.reporting_data?.at[`status:${lastOrder.status}`], { outputFormat: configs?.general_hour_format?.value })
|
|
182
|
+
)}
|
|
175
183
|
</OText>
|
|
176
184
|
</TimeWrapper>
|
|
177
185
|
</ProgressTextWrapper>
|
|
@@ -198,9 +206,10 @@ export const OrderProgress = (props: any) => {
|
|
|
198
206
|
useDefualtSessionManager: true,
|
|
199
207
|
paginationSettings: {
|
|
200
208
|
initialPage: 1,
|
|
201
|
-
pageSize:
|
|
209
|
+
pageSize: 10,
|
|
202
210
|
controlType: 'infinity'
|
|
203
|
-
}
|
|
211
|
+
},
|
|
212
|
+
noGiftCardOrders: true
|
|
204
213
|
}
|
|
205
214
|
|
|
206
215
|
return <OrderList {...orderProgressProps} />
|