ordering-ui-react-native 0.16.28 → 0.16.29-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 +8 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +15 -0
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +2 -20
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +335 -365
- 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 +15 -0
- package/src/components/SingleProductReview/index.tsx +8 -5
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/utils/index.tsx +0 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +42 -34
- package/themes/business/src/components/DriverMap/index.tsx +7 -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 +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +65 -21
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- 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/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OModal.tsx +40 -37
- package/themes/business/src/types/index.tsx +15 -9
- package/themes/business/src/utils/index.tsx +10 -0
- 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/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- 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/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +12 -0
- package/themes/original/src/components/AddressDetails/index.tsx +1 -1
- package/themes/original/src/components/AddressForm/index.tsx +139 -135
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +190 -113
- package/themes/original/src/components/BusinessController/styles.tsx +0 -7
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +81 -128
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +293 -177
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +23 -11
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
- package/themes/original/src/components/Cart/index.tsx +44 -12
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +22 -16
- package/themes/original/src/components/Checkout/index.tsx +101 -61
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +32 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
- package/themes/original/src/components/HelpGuide/index.tsx +9 -8
- package/themes/original/src/components/HelpOrder/index.tsx +9 -8
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
- package/themes/original/src/components/LoginForm/index.tsx +83 -45
- package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentOption/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 +92 -92
- package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
- package/themes/original/src/components/MyOrders/index.tsx +70 -6
- package/themes/original/src/components/NavBar/index.tsx +15 -9
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +17 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +190 -35
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrderSummary/index.tsx +3 -36
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
- package/themes/original/src/components/OrdersOption/index.tsx +71 -55
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
- package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +633 -664
- package/themes/original/src/components/ProductForm/styles.tsx +9 -8
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
- package/themes/original/src/components/ReviewProducts/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 +5 -3
- package/themes/original/src/components/ServiceForm/index.tsx +637 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +350 -206
- package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
- package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
- package/themes/original/src/components/SingleProductCard/index.tsx +199 -110
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -10
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
- package/themes/original/src/components/UserDetails/index.tsx +31 -17
- package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
- package/themes/original/src/components/UserProfile/index.tsx +54 -29
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +176 -164
- package/themes/original/src/components/Wallets/styles.tsx +12 -8
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +121 -30
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -165,6 +165,12 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
165
165
|
|
|
166
166
|
const handleOpenRecaptcha = () => {
|
|
167
167
|
setRecaptchaVerified(false)
|
|
168
|
+
|
|
169
|
+
if (recaptchaVerified) {
|
|
170
|
+
handleReCaptcha && handleReCaptcha('')
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
|
|
168
174
|
if (!recaptchaConfig?.siteKey) {
|
|
169
175
|
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
170
176
|
return
|
|
@@ -385,6 +391,15 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
385
391
|
baseUrl={recaptchaConfig?.baseUrl}
|
|
386
392
|
onVerify={onRecaptchaVerify}
|
|
387
393
|
onExpire={() => setRecaptchaVerified(false)}
|
|
394
|
+
footerComponent={<OButton
|
|
395
|
+
onClick={() => recaptchaRef.current.close()}
|
|
396
|
+
style={{ borderRadius: 0 }}
|
|
397
|
+
text={t('CLOSE', 'Close')}
|
|
398
|
+
bgColor={theme.colors.primary}
|
|
399
|
+
borderColor={theme.colors.primary}
|
|
400
|
+
textStyle={{ color: 'white' }}
|
|
401
|
+
imgRightSrc={null}
|
|
402
|
+
/>}
|
|
388
403
|
/>
|
|
389
404
|
</>
|
|
390
405
|
)}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useTheme } from 'styled-components/native';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import {
|
|
5
|
+
openSettings,
|
|
6
|
+
checkNotifications
|
|
7
|
+
} from 'react-native-permissions';
|
|
8
|
+
import { useLanguage } from 'ordering-components/native'
|
|
9
|
+
import { OBottomPopup, OButton, OText } from '../shared';
|
|
10
|
+
interface NotificationSettingPropsParams {
|
|
11
|
+
checkNotificationStatus: { open: boolean, checked: boolean };
|
|
12
|
+
setCheckNotificationStatus: (notificationStatus: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export const NotificationSetting = (props: NotificationSettingPropsParams) => {
|
|
15
|
+
const { checkNotificationStatus, setCheckNotificationStatus } = props
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const [, t] = useLanguage();
|
|
18
|
+
|
|
19
|
+
const requestLocationPermission = async () => {
|
|
20
|
+
const notificationStatus = await checkNotifications()
|
|
21
|
+
if (notificationStatus?.status === 'blocked') {
|
|
22
|
+
setCheckNotificationStatus({ open: true, checked: false })
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
setCheckNotificationStatus({ open: false, checked: true })
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const callOpenSettings = () => {
|
|
29
|
+
openSettings().catch(() => console.warn('cannot open settings'));
|
|
30
|
+
setCheckNotificationStatus({ open: false, checked: true })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
requestLocationPermission()
|
|
35
|
+
}, [])
|
|
36
|
+
return (
|
|
37
|
+
<OBottomPopup
|
|
38
|
+
open={checkNotificationStatus?.open}
|
|
39
|
+
onClose={() => setCheckNotificationStatus({ open: false, checked: true })}
|
|
40
|
+
title={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
|
|
41
|
+
titleStyle={{ textAlign: 'center' }}
|
|
42
|
+
containerStyle={{ borderRadius: 10, borderTopRightRadius: 10, borderTopLeftRadius: 10 }}
|
|
43
|
+
>
|
|
44
|
+
<View style={styles.container}>
|
|
45
|
+
<View style={styles.textContainer}>
|
|
46
|
+
<OText style={{ textAlign: 'center' }}>
|
|
47
|
+
{t('ACTIVE_NOTIFICATION_TO_RECEIVE_INFORMATION', 'Activate notifications to receive information about your orders')}
|
|
48
|
+
</OText>
|
|
49
|
+
</View>
|
|
50
|
+
<OButton
|
|
51
|
+
text={t('ENABLE_NOTIFICATIONS', 'Enable notifications')}
|
|
52
|
+
bgColor={theme.colors.primary}
|
|
53
|
+
borderColor={theme.colors.primary}
|
|
54
|
+
parentStyle={styles.parentStyle}
|
|
55
|
+
style={styles.button}
|
|
56
|
+
textStyle={{ color: 'white' }}
|
|
57
|
+
onClick={() => callOpenSettings()}
|
|
58
|
+
/>
|
|
59
|
+
</View>
|
|
60
|
+
</OBottomPopup>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const styles = StyleSheet.create({
|
|
65
|
+
container: {
|
|
66
|
+
width: '100%',
|
|
67
|
+
textAlign: 'center'
|
|
68
|
+
},
|
|
69
|
+
textContainer: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
paddingHorizontal: 25,
|
|
72
|
+
paddingBottom: 20
|
|
73
|
+
},
|
|
74
|
+
parentStyle: {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
width: '70%',
|
|
77
|
+
marginLeft: 'auto',
|
|
78
|
+
marginRight: 'auto',
|
|
79
|
+
marginBottom: 25
|
|
80
|
+
|
|
81
|
+
},
|
|
82
|
+
button: {
|
|
83
|
+
borderRadius: 5
|
|
84
|
+
}
|
|
85
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -109,7 +109,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
109
109
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
110
110
|
const [openOrderCreating, setOpenOrderCreating] = useState(false)
|
|
111
111
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
112
|
-
const appState = useRef(AppState.currentState)
|
|
113
112
|
|
|
114
113
|
const { order, loading, businessData, error } = props.order
|
|
115
114
|
|
|
@@ -259,23 +258,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
259
258
|
})
|
|
260
259
|
}, [])
|
|
261
260
|
|
|
262
|
-
useEffect(() => {
|
|
263
|
-
const onFocusApp = (nextAppState: any) => {
|
|
264
|
-
if (
|
|
265
|
-
appState.current.match(/inactive|background/) &&
|
|
266
|
-
nextAppState === "active"
|
|
267
|
-
) {
|
|
268
|
-
getOrder && getOrder()
|
|
269
|
-
}
|
|
270
|
-
appState.current = nextAppState;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
AppState.addEventListener("change", onFocusApp);
|
|
274
|
-
return () => {
|
|
275
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
276
|
-
};
|
|
277
|
-
}, [])
|
|
278
|
-
|
|
279
261
|
return (
|
|
280
262
|
<OrderDetailsContainer keyboardShouldPersistTaps='handled'>
|
|
281
263
|
{order && order?.id && !error && !loading && (
|
|
@@ -102,46 +102,71 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
useEffect(() => {
|
|
105
|
+
const length = orders.filter((order : any) => orderStatus.includes(order.status)).length
|
|
106
|
+
|
|
105
107
|
setOrdersLength && setOrdersLength({
|
|
106
108
|
...ordersLength,
|
|
107
|
-
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']:
|
|
109
|
+
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: length
|
|
108
110
|
})
|
|
109
|
-
|
|
111
|
+
ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] = length
|
|
112
|
+
}, [orders])
|
|
110
113
|
|
|
111
114
|
useEffect(() => {
|
|
112
|
-
setOrdersFiltered(filterForOrders === 'preorders'
|
|
115
|
+
setOrdersFiltered(filterForOrders === 'preorders'
|
|
116
|
+
? orders.filter((order : any) => order.status === 13)
|
|
117
|
+
: orders.filter((order : any) => orderStatus.includes(order.status) && order.status !== 13)
|
|
118
|
+
)
|
|
113
119
|
}, [filterForOrders, orders])
|
|
114
120
|
|
|
115
121
|
return (
|
|
116
|
-
|
|
122
|
+
<View style={{ marginBottom: 20 }}>
|
|
117
123
|
<OptionTitle>
|
|
118
|
-
{(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</OText>
|
|
132
|
-
</TouchableOpacity>
|
|
133
|
-
)}
|
|
134
|
-
</>
|
|
124
|
+
<TouchableOpacity onPress={() => setFilterForOrders('active-orders')}>
|
|
125
|
+
<OText size={16} color={filterForOrders === 'active-orders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} mRight={10} >
|
|
126
|
+
{titleContent || (activeOrders
|
|
127
|
+
? t('ACTIVE_ORDERS', 'Active Orders')
|
|
128
|
+
: t('PREVIOUS_ORDERS', 'Previous Orders'))}
|
|
129
|
+
</OText>
|
|
130
|
+
</TouchableOpacity>
|
|
131
|
+
{activeOrders && orders.filter((order : any) => order.status === 13)?.length > 0 && (
|
|
132
|
+
<TouchableOpacity onPress={() => setFilterForOrders('preorders')}>
|
|
133
|
+
<OText size={16} color={filterForOrders === 'preorders' ? theme.colors.black : theme.colors.textSecondary} mBottom={10} >
|
|
134
|
+
{t('PREORDERS', 'Preorders')}
|
|
135
|
+
</OText>
|
|
136
|
+
</TouchableOpacity>
|
|
135
137
|
)}
|
|
136
138
|
</OptionTitle>
|
|
137
|
-
{!loading && orders.length
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
{!loading && !error && orders.length > 0 && !isLoadingFirstRender && (
|
|
140
|
+
activeOrders ? (
|
|
141
|
+
<ActiveOrders
|
|
142
|
+
orders={ordersFiltered}
|
|
143
|
+
pagination={pagination}
|
|
144
|
+
loadMoreOrders={loadMoreOrders}
|
|
145
|
+
reorderLoading={reorderLoading}
|
|
146
|
+
customArray={customArray}
|
|
147
|
+
getOrderStatus={getOrderStatus}
|
|
148
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
149
|
+
setScreen={setScreen}
|
|
150
|
+
screen={screen}
|
|
151
|
+
isPreorders={filterForOrders === 'preorders'}
|
|
152
|
+
preordersLength={orders.filter((order : any) => order.status === 13)?.length}
|
|
153
|
+
/>
|
|
154
|
+
) : (
|
|
155
|
+
<PreviousOrders
|
|
156
|
+
reorderLoading={reorderLoading}
|
|
157
|
+
orders={ordersFiltered}
|
|
158
|
+
pagination={pagination}
|
|
159
|
+
loadMoreOrders={loadMoreOrders}
|
|
160
|
+
getOrderStatus={getOrderStatus}
|
|
161
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
162
|
+
handleReorder={handleReorder}
|
|
163
|
+
/>
|
|
164
|
+
)
|
|
143
165
|
)}
|
|
144
|
-
{!loading &&
|
|
166
|
+
{!loading &&
|
|
167
|
+
!isLoadingFirstRender &&
|
|
168
|
+
ordersLength[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength'] === 0 &&
|
|
169
|
+
(
|
|
145
170
|
<NotFoundSource
|
|
146
171
|
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
147
172
|
image={imageFails}
|
|
@@ -179,34 +204,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
179
204
|
)}
|
|
180
205
|
</>
|
|
181
206
|
)}
|
|
182
|
-
|
|
183
|
-
activeOrders ? (
|
|
184
|
-
<ActiveOrders
|
|
185
|
-
orders={ordersFiltered}
|
|
186
|
-
pagination={pagination}
|
|
187
|
-
loadMoreOrders={loadMoreOrders}
|
|
188
|
-
reorderLoading={reorderLoading}
|
|
189
|
-
customArray={customArray}
|
|
190
|
-
getOrderStatus={getOrderStatus}
|
|
191
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
192
|
-
setScreen={setScreen}
|
|
193
|
-
screen={screen}
|
|
194
|
-
isPreorders={filterForOrders === 'preorders'}
|
|
195
|
-
preordersLength={orders.filter((order : any) => order.status === 13)?.length}
|
|
196
|
-
/>
|
|
197
|
-
) : (
|
|
198
|
-
<PreviousOrders
|
|
199
|
-
reorderLoading={reorderLoading}
|
|
200
|
-
orders={ordersFiltered}
|
|
201
|
-
pagination={pagination}
|
|
202
|
-
loadMoreOrders={loadMoreOrders}
|
|
203
|
-
getOrderStatus={getOrderStatus}
|
|
204
|
-
onNavigationRedirect={onNavigationRedirect}
|
|
205
|
-
handleReorder={handleReorder}
|
|
206
|
-
/>
|
|
207
|
-
)
|
|
208
|
-
)}
|
|
209
|
-
</>
|
|
207
|
+
</View>
|
|
210
208
|
)
|
|
211
209
|
}
|
|
212
210
|
|