ordering-ui-react-native 0.15.67 → 0.15.69-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 +7 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +1 -1
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessInformation/index.tsx +14 -0
- package/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +6 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +7 -21
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +22 -24
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/index.tsx +2 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -2
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +51 -91
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
- package/themes/business/src/components/OrdersOption/index.tsx +16 -4
- package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/OModal.tsx +41 -38
- package/themes/business/src/types/index.tsx +14 -7
- 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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +11 -12
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +1 -0
- package/themes/original/index.tsx +32 -8
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +7 -6
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +6 -8
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +304 -158
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +201 -96
- package/themes/original/src/components/BusinessController/styles.tsx +5 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +70 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +323 -155
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +33 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +104 -458
- package/themes/original/src/components/Cart/index.tsx +93 -43
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/Checkout/index.tsx +90 -39
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/NavBar/index.tsx +4 -4
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +148 -63
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderSummary/index.tsx +6 -6
- package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +137 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +718 -679
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/Promotions/index.tsx +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +13 -5
- package/themes/original/src/components/ServiceForm/index.tsx +579 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +237 -126
- package/themes/original/src/components/SingleOrderCard/index.tsx +310 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +214 -90
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +32 -18
- package/themes/original/src/components/UserFormDetails/index.tsx +102 -66
- package/themes/original/src/components/UserProfile/index.tsx +11 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +32 -25
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/Wallets/index.tsx +25 -12
- package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/components/shared/OModal.tsx +4 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +203 -35
- package/themes/original/src/utils/index.tsx +94 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,56 +1,144 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useLanguage } from 'ordering-components/native';
|
|
3
|
-
import { View, StyleSheet,
|
|
3
|
+
import { View, StyleSheet, RefreshControl } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { OrdersOption } from '../OrdersOption'
|
|
6
|
-
import { OText } from '../shared'
|
|
6
|
+
import { HeaderTitle, OText } from '../shared'
|
|
7
7
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { Tab } from './styles'
|
|
9
|
+
import { useTheme } from 'styled-components/native';
|
|
10
|
+
import { Container } from '../../layouts/Container';
|
|
10
11
|
|
|
11
12
|
export const MyOrders = (props: any) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const {
|
|
14
|
+
hideOrders,
|
|
15
|
+
businessesSearchList
|
|
16
|
+
} = props
|
|
17
|
+
const [, t] = useLanguage()
|
|
18
|
+
const theme = useTheme()
|
|
19
|
+
const [refreshing] = useState(false);
|
|
20
|
+
const [refreshOrders, setRefreshOrders] = useState(false)
|
|
21
|
+
const [isEmptyBusinesses, setIsEmptyBusinesses] = useState(false)
|
|
22
|
+
const [businessOrderIds, setBusinessOrderIds] = useState([])
|
|
15
23
|
const [ordersLength, setOrdersLength] = useState({
|
|
16
24
|
activeOrdersLength: 0,
|
|
17
25
|
previousOrdersLength: 0,
|
|
18
26
|
});
|
|
27
|
+
const [selectedOption, setSelectedOption] = useState(!hideOrders ? 'orders' : 'business')
|
|
28
|
+
|
|
29
|
+
const notOrderOptions = ['business', 'products']
|
|
30
|
+
const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
|
|
31
|
+
const MyOrdersMenu = [
|
|
32
|
+
{ key: 'orders', value: t('ORDERS', 'Orders') },
|
|
33
|
+
{ key: 'business', value: t('BUSINESS', 'Business') },
|
|
34
|
+
{ key: 'products', value: t('PRODUCTS', 'Products') }
|
|
35
|
+
]
|
|
19
36
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
const handleOnRefresh = () => {
|
|
38
|
+
setRefreshOrders(true);
|
|
39
|
+
}
|
|
23
40
|
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
paddingVertical: 5,
|
|
44
|
+
borderColor: theme.colors.clear,
|
|
45
|
+
backgroundColor: '#FFF'
|
|
46
|
+
},
|
|
47
|
+
featuredStyle: {
|
|
48
|
+
display: 'none',
|
|
49
|
+
},
|
|
50
|
+
tabStyle: {
|
|
51
|
+
marginTop: 10,
|
|
52
|
+
height: 4,
|
|
53
|
+
borderTopStartRadius: 4,
|
|
54
|
+
borderTopEndRadius: 4,
|
|
55
|
+
backgroundColor: theme.colors.textPrimary,
|
|
56
|
+
},
|
|
57
|
+
tabDeactived: {
|
|
58
|
+
marginTop: 10,
|
|
59
|
+
height: 4
|
|
26
60
|
}
|
|
27
|
-
|
|
61
|
+
});
|
|
28
62
|
|
|
29
63
|
return (
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
<Container noPadding refreshControl={
|
|
65
|
+
<RefreshControl
|
|
66
|
+
refreshing={refreshing}
|
|
67
|
+
onRefresh={() => handleOnRefresh()}
|
|
68
|
+
/>
|
|
69
|
+
}>
|
|
70
|
+
{!hideOrders && (
|
|
71
|
+
<HeaderTitle text={t('MY_ORDERS', 'My Orders')} />
|
|
72
|
+
)}
|
|
73
|
+
{!allEmpty && (
|
|
74
|
+
<ScrollView
|
|
75
|
+
horizontal
|
|
76
|
+
style={{ ...styles.container, borderBottomWidth: 1 }}
|
|
77
|
+
contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 40 }}
|
|
78
|
+
showsHorizontalScrollIndicator={false}
|
|
79
|
+
scrollEventThrottle={16}
|
|
80
|
+
>
|
|
81
|
+
{MyOrdersMenu.filter(option => !hideOrders || option.key !== 'orders').map(option => (
|
|
82
|
+
<Tab
|
|
83
|
+
key={option.key}
|
|
84
|
+
onPress={() => setSelectedOption(option.key)}
|
|
85
|
+
style={
|
|
86
|
+
{
|
|
87
|
+
borderBottomColor:
|
|
88
|
+
selectedOption === option.key
|
|
89
|
+
? theme.colors.textNormal
|
|
90
|
+
: theme.colors.border,
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
<OText>{option?.value}</OText>
|
|
95
|
+
</Tab>
|
|
96
|
+
))}
|
|
97
|
+
</ScrollView>
|
|
98
|
+
)}
|
|
99
|
+
{selectedOption === 'orders' && (
|
|
100
|
+
<>
|
|
101
|
+
<View style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
102
|
+
<OrdersOption
|
|
103
|
+
{...props}
|
|
104
|
+
activeOrders
|
|
105
|
+
ordersLength={ordersLength}
|
|
106
|
+
setOrdersLength={setOrdersLength}
|
|
107
|
+
setRefreshOrders={setRefreshOrders}
|
|
108
|
+
refreshOrders={refreshOrders}
|
|
109
|
+
/>
|
|
110
|
+
</View>
|
|
111
|
+
<View style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
112
|
+
<OrdersOption
|
|
113
|
+
{...props}
|
|
114
|
+
ordersLength={ordersLength}
|
|
115
|
+
setOrdersLength={setOrdersLength}
|
|
116
|
+
setRefreshOrders={setRefreshOrders}
|
|
117
|
+
refreshOrders={refreshOrders}
|
|
118
|
+
/>
|
|
119
|
+
</View>
|
|
120
|
+
</>
|
|
121
|
+
)}
|
|
122
|
+
{notOrderOptions.includes(selectedOption) && (
|
|
38
123
|
<OrdersOption
|
|
39
124
|
{...props}
|
|
125
|
+
titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
|
|
126
|
+
hideOrders
|
|
127
|
+
horizontal
|
|
128
|
+
isBusiness={selectedOption === 'business'}
|
|
129
|
+
isProducts={selectedOption === 'products'}
|
|
40
130
|
activeOrders
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<View style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
48
|
-
<OrdersOption
|
|
49
|
-
{...props}
|
|
131
|
+
pastOrders
|
|
132
|
+
preOrders
|
|
133
|
+
businessesSearchList={businessesSearchList}
|
|
134
|
+
setIsEmptyBusinesses={setIsEmptyBusinesses}
|
|
135
|
+
businessOrderIds={businessOrderIds}
|
|
136
|
+
setBusinessOrderIds={setBusinessOrderIds}
|
|
50
137
|
ordersLength={ordersLength}
|
|
51
138
|
setOrdersLength={setOrdersLength}
|
|
52
139
|
/>
|
|
53
|
-
|
|
54
|
-
</
|
|
140
|
+
)}
|
|
141
|
+
</Container>
|
|
142
|
+
|
|
55
143
|
)
|
|
56
144
|
}
|
|
@@ -3,4 +3,11 @@ import styled, { css } from 'styled-components/native'
|
|
|
3
3
|
export const Wrapper = styled.View`
|
|
4
4
|
flex: 1;
|
|
5
5
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
6
|
-
`
|
|
6
|
+
`
|
|
7
|
+
|
|
8
|
+
export const Tab = styled.TouchableOpacity`
|
|
9
|
+
padding-horizontal: 10px;
|
|
10
|
+
padding-vertical: 10px;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
border-bottom-width: 1px;
|
|
13
|
+
`
|
|
@@ -62,7 +62,7 @@ const NavBar = (props: Props) => {
|
|
|
62
62
|
<Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
|
|
63
63
|
<OButton
|
|
64
64
|
imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
|
|
65
|
-
imgLeftStyle={{width: 18}}
|
|
65
|
+
imgLeftStyle={{ width: 18 }}
|
|
66
66
|
imgRightSrc={null}
|
|
67
67
|
style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
|
|
68
68
|
onClick={props?.onActionLeft}
|
|
@@ -126,9 +126,9 @@ NavBar.defaultProps = {
|
|
|
126
126
|
textAlign: 'center'
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
const areEqual=(prevProps: { route?: any; }, nextProps: { route?: any; })=>{
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const areEqual = (prevProps: { route?: any; }, nextProps: { route?: any; }) => {
|
|
130
|
+
return prevProps.route === nextProps.route
|
|
131
|
+
return true
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export default React.memo(NavBar, areEqual);
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
4
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
5
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
+
import { OText, OButton } from '../shared'
|
|
7
|
+
|
|
8
|
+
export const OrderHistory = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
order,
|
|
11
|
+
messages,
|
|
12
|
+
enableReview,
|
|
13
|
+
onClose,
|
|
14
|
+
handleTriggerReview
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const [, t] = useLanguage()
|
|
18
|
+
const [{ parseDate }] = useUtils()
|
|
19
|
+
const theme = useTheme()
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
historyItem: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
borderBottomWidth: 1,
|
|
27
|
+
borderColor: theme.colors.border
|
|
28
|
+
},
|
|
29
|
+
detailWrapper: {
|
|
30
|
+
marginLeft: 20,
|
|
31
|
+
paddingHorizontal: 13,
|
|
32
|
+
paddingVertical: 16
|
|
33
|
+
},
|
|
34
|
+
container: {
|
|
35
|
+
paddingHorizontal: 40,
|
|
36
|
+
paddingVertical: 15
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const ORDER_STATUS: any = {
|
|
41
|
+
0: 'ORDER_STATUS_PENDING',
|
|
42
|
+
1: 'ORDERS_COMPLETED',
|
|
43
|
+
2: 'ORDER_REJECTED',
|
|
44
|
+
3: 'ORDER_STATUS_IN_BUSINESS',
|
|
45
|
+
4: 'ORDER_READY',
|
|
46
|
+
5: 'ORDER_REJECTED_RESTAURANT',
|
|
47
|
+
6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
|
|
48
|
+
7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
|
|
49
|
+
8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
|
|
50
|
+
9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
|
|
51
|
+
10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
|
|
52
|
+
11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
|
|
53
|
+
12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
|
|
54
|
+
13: 'PREORDER',
|
|
55
|
+
14: 'ORDER_NOT_READY',
|
|
56
|
+
15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
57
|
+
16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
|
|
58
|
+
17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
59
|
+
18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
|
|
60
|
+
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
61
|
+
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
62
|
+
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
63
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
64
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const getLogisticTagStatus = (status: any) => {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case 0:
|
|
70
|
+
return t('PENDING', 'Pending')
|
|
71
|
+
case 1:
|
|
72
|
+
return t('IN_PROGRESS', 'In Progress')
|
|
73
|
+
case 2:
|
|
74
|
+
return t('IN_QUEUE', 'In Queue')
|
|
75
|
+
case 3:
|
|
76
|
+
return t('EXPIRED', 'Logistic expired')
|
|
77
|
+
case 4:
|
|
78
|
+
return t('RESOLVED', 'Resolved')
|
|
79
|
+
default:
|
|
80
|
+
return status
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleReview = () => {
|
|
85
|
+
if (enableReview) handleTriggerReview()
|
|
86
|
+
else onClose()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<ScrollView contentContainerStyle={styles.container}>
|
|
91
|
+
<OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
92
|
+
{t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
|
|
93
|
+
</OText>
|
|
94
|
+
{!messages?.loading && order && (
|
|
95
|
+
<View style={styles.historyItem}>
|
|
96
|
+
<MaterialCommunityIcons
|
|
97
|
+
name="checkbox-marked-circle"
|
|
98
|
+
size={20}
|
|
99
|
+
color={theme.colors.primary}
|
|
100
|
+
/>
|
|
101
|
+
<View style={styles.detailWrapper}>
|
|
102
|
+
<OText
|
|
103
|
+
size={14}
|
|
104
|
+
weight='bold'
|
|
105
|
+
numberOfLines={1}
|
|
106
|
+
ellipsizeMode='tail'
|
|
107
|
+
>
|
|
108
|
+
{t('ORDER_PLACED', 'Order placed')} {' '}
|
|
109
|
+
{t('VIA', 'Via')}{' '}
|
|
110
|
+
{order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
|
|
111
|
+
</OText>
|
|
112
|
+
<OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
)}
|
|
116
|
+
{messages && messages?.messages.map((message: any, i: number) => message.type === 1 && (
|
|
117
|
+
<View
|
|
118
|
+
style={styles.historyItem}
|
|
119
|
+
key={i}
|
|
120
|
+
>
|
|
121
|
+
<MaterialCommunityIcons
|
|
122
|
+
name="checkbox-marked-circle"
|
|
123
|
+
size={20}
|
|
124
|
+
color={theme.colors.primary}
|
|
125
|
+
/>
|
|
126
|
+
<View style={styles.detailWrapper}>
|
|
127
|
+
{message.change?.attribute !== 'driver_id' ? (
|
|
128
|
+
<OText
|
|
129
|
+
size={14}
|
|
130
|
+
weight='bold'
|
|
131
|
+
numberOfLines={1}
|
|
132
|
+
ellipsizeMode='tail'
|
|
133
|
+
>
|
|
134
|
+
{message.change?.attribute === 'logistic_status'
|
|
135
|
+
? getLogisticTagStatus(parseInt(message.change.new, 10))
|
|
136
|
+
: t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
137
|
+
}
|
|
138
|
+
</OText>
|
|
139
|
+
) : (
|
|
140
|
+
<OText
|
|
141
|
+
size={14}
|
|
142
|
+
weight='bold'
|
|
143
|
+
numberOfLines={1}
|
|
144
|
+
ellipsizeMode='tail'
|
|
145
|
+
>
|
|
146
|
+
{message.change.new
|
|
147
|
+
? (`${message.driver?.name} ${!!message.driver?.lastname ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}`)
|
|
148
|
+
: t('DRIVER_UNASSIGNED', 'Driver unassigned')}
|
|
149
|
+
</OText>
|
|
150
|
+
)}
|
|
151
|
+
<OText size={12}>{parseDate(message?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
152
|
+
</View>
|
|
153
|
+
</View>
|
|
154
|
+
))}
|
|
155
|
+
<OButton
|
|
156
|
+
text={enableReview ? t('REVIEW_ORDER', 'Review order') : t('CONTINUE', 'Continue')}
|
|
157
|
+
textStyle={{ fontSize: 14, color: theme.colors.white }}
|
|
158
|
+
imgRightSrc={theme.images.general.arrow_right}
|
|
159
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
160
|
+
borderColor='transparent'
|
|
161
|
+
bgColor={theme.colors.primary}
|
|
162
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginBottom: 30, marginTop: 20 }}
|
|
163
|
+
onClick={() => handleReview()}
|
|
164
|
+
/>
|
|
165
|
+
</ScrollView>
|
|
166
|
+
)
|
|
167
|
+
}
|