ordering-ui-react-native 0.12.8 → 0.12.12
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 +2 -1
- package/src/assets/images/business_list_banner.jpg +0 -0
- package/src/components/Account/index.tsx +2 -2
- package/src/config.json +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
- package/themes/business/src/components/OrdersOption/index.tsx +30 -23
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +7 -0
- package/themes/original/src/components/BusinessesListing/styles.tsx +6 -1
- package/themes/original/src/components/OrderProgress/index.tsx +208 -0
- package/themes/original/src/components/OrderProgress/styles.tsx +30 -0
- package/themes/original/src/components/ProductForm/index.tsx +159 -56
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/single-business/src/components/ActiveOrders/index.tsx +20 -19
- package/themes/single-business/src/components/BusinessProductsListing/index.tsx +4 -4
- package/themes/single-business/src/components/Cart/index.tsx +39 -47
- package/themes/single-business/src/components/Cart/styles.tsx +1 -0
- package/themes/single-business/src/components/LoginForm/index.tsx +147 -89
- package/themes/single-business/src/components/LoginForm/styles.tsx +33 -28
- package/themes/single-business/src/components/OrderDetails/index.tsx +32 -12
- package/themes/single-business/src/components/OrdersOption/index.tsx +50 -50
- package/themes/single-business/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/single-business/src/components/PreviousOrders/index.tsx +97 -83
- package/themes/single-business/src/components/PromotionCard/index.tsx +10 -2
- package/themes/single-business/src/components/Promotions/index.tsx +1 -1
- package/themes/single-business/src/components/ReviewOrder/index.tsx +299 -274
- package/themes/single-business/src/components/ReviewOrder/styles.tsx +23 -26
- package/themes/single-business/src/components/UpsellingProducts/index.tsx +230 -189
- package/themes/single-business/src/components/UpsellingProducts/styles.tsx +24 -18
- package/themes/single-business/src/types/index.tsx +10 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { Pressable, StyleSheet, View, Keyboard } from 'react-native';
|
|
2
|
+
import { Pressable, StyleSheet, View, Keyboard, ScrollView } from 'react-native';
|
|
3
3
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
4
4
|
import { useForm, Controller } from 'react-hook-form';
|
|
5
5
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
OrSeparator,
|
|
30
30
|
LineSeparator,
|
|
31
31
|
SkeletonWrapper,
|
|
32
|
+
TabsContainer,
|
|
32
33
|
} from './styles';
|
|
33
34
|
|
|
34
35
|
import NavBar from '../NavBar';
|
|
@@ -76,6 +77,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
76
77
|
});
|
|
77
78
|
|
|
78
79
|
const theme = useTheme();
|
|
80
|
+
const scrollRefTab = useRef() as React.MutableRefObject<ScrollView>;
|
|
79
81
|
|
|
80
82
|
const loginStyle = StyleSheet.create({
|
|
81
83
|
btnOutline: {
|
|
@@ -95,6 +97,45 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
95
97
|
flexGrow: 1,
|
|
96
98
|
marginBottom: 7,
|
|
97
99
|
},
|
|
100
|
+
btnTab: {
|
|
101
|
+
flex: 1,
|
|
102
|
+
minWidth: 88,
|
|
103
|
+
alignItems: 'flex-start',
|
|
104
|
+
borderBottomWidth: 1,
|
|
105
|
+
},
|
|
106
|
+
btnTabText: {
|
|
107
|
+
fontFamily: 'Poppins',
|
|
108
|
+
fontStyle: 'normal',
|
|
109
|
+
fontSize: 14,
|
|
110
|
+
marginBottom: 10,
|
|
111
|
+
paddingLeft: 8,
|
|
112
|
+
paddingRight: 8,
|
|
113
|
+
},
|
|
114
|
+
btn: {
|
|
115
|
+
borderRadius: 7.6,
|
|
116
|
+
height: 44,
|
|
117
|
+
},
|
|
118
|
+
btnText: {
|
|
119
|
+
color: theme.colors.inputTextColor,
|
|
120
|
+
fontFamily: 'Poppins',
|
|
121
|
+
fontStyle: 'normal',
|
|
122
|
+
fontWeight: 'normal',
|
|
123
|
+
fontSize: 18,
|
|
124
|
+
},
|
|
125
|
+
btnFlag: {
|
|
126
|
+
width: 79,
|
|
127
|
+
borderWidth: 1,
|
|
128
|
+
borderRadius: 7.6,
|
|
129
|
+
marginRight: 9,
|
|
130
|
+
borderColor: theme.colors.inputSignup,
|
|
131
|
+
},
|
|
132
|
+
textForgot: {
|
|
133
|
+
color: theme.colors.arrowColor,
|
|
134
|
+
fontFamily: 'Poppins',
|
|
135
|
+
fontStyle: 'normal',
|
|
136
|
+
fontWeight: 'normal',
|
|
137
|
+
fontSize: 16,
|
|
138
|
+
},
|
|
98
139
|
});
|
|
99
140
|
|
|
100
141
|
const inputRef = useRef<any>({});
|
|
@@ -102,6 +143,14 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
102
143
|
const handleChangeTab = (val: string) => {
|
|
103
144
|
props.handleChangeTab(val);
|
|
104
145
|
setPasswordSee(false);
|
|
146
|
+
|
|
147
|
+
if (loginTab === 'email') {
|
|
148
|
+
scrollRefTab.current?.scrollToEnd({ animated: true });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (loginTab === 'cellphone') {
|
|
152
|
+
scrollRefTab.current?.scrollTo({ animated: true });
|
|
153
|
+
}
|
|
105
154
|
};
|
|
106
155
|
|
|
107
156
|
const onSubmit = (values: any) => {
|
|
@@ -222,56 +271,64 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
222
271
|
isVertical={true}
|
|
223
272
|
/>
|
|
224
273
|
<FormSide>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
{(useLoginByEmail || useLoginByCellphone) && (
|
|
275
|
+
<LoginWith>
|
|
276
|
+
<ScrollView
|
|
277
|
+
ref={scrollRefTab}
|
|
278
|
+
showsVerticalScrollIndicator={false}
|
|
279
|
+
showsHorizontalScrollIndicator={false}
|
|
280
|
+
horizontal
|
|
281
|
+
style={{
|
|
282
|
+
borderBottomColor: theme.colors.border,
|
|
283
|
+
borderBottomWidth: 2
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
<TabsContainer>
|
|
287
|
+
{useLoginByEmail && (
|
|
288
|
+
<Pressable
|
|
289
|
+
style={{
|
|
290
|
+
...loginStyle.btnTab,
|
|
291
|
+
borderBottomWidth: loginTab === 'email' ? 2 : 0,
|
|
292
|
+
borderBottomColor: theme.colors.textNormal,
|
|
293
|
+
}}
|
|
294
|
+
onPress={() => handleChangeTab('email')}>
|
|
295
|
+
<OText
|
|
296
|
+
style={loginStyle.btnTabText}
|
|
297
|
+
color={
|
|
298
|
+
loginTab === 'email'
|
|
299
|
+
? theme.colors.textNormal
|
|
300
|
+
: theme.colors.border
|
|
301
|
+
}
|
|
302
|
+
weight={loginTab === 'email' ? '600' : 'normal'}>
|
|
303
|
+
{t('BY_EMAIL', 'by Email')}
|
|
304
|
+
</OText>
|
|
305
|
+
</Pressable>
|
|
306
|
+
)}
|
|
307
|
+
|
|
308
|
+
{useLoginByCellphone && (
|
|
309
|
+
<Pressable
|
|
310
|
+
style={{
|
|
311
|
+
...loginStyle.btnTab,
|
|
312
|
+
borderBottomWidth: loginTab === 'cellphone' ? 2 : 0,
|
|
313
|
+
borderBottomColor: theme.colors.textNormal
|
|
314
|
+
}}
|
|
315
|
+
onPress={() => handleChangeTab('cellphone')}>
|
|
316
|
+
<OText
|
|
317
|
+
style={loginStyle.btnTabText}
|
|
318
|
+
color={
|
|
319
|
+
loginTab === 'cellphone'
|
|
320
|
+
? theme.colors.textNormal
|
|
321
|
+
: theme.colors.border
|
|
322
|
+
}
|
|
323
|
+
weight={loginTab === 'cellphone' ? '600' : 'normal'}>
|
|
324
|
+
{t('BY_PHONE', 'by Phone')}
|
|
325
|
+
</OText>
|
|
326
|
+
</Pressable>
|
|
327
|
+
)}
|
|
328
|
+
</TabsContainer>
|
|
329
|
+
</ScrollView>
|
|
330
|
+
</LoginWith>
|
|
331
|
+
)}
|
|
275
332
|
|
|
276
333
|
{(useLoginByCellphone || useLoginByEmail) && (
|
|
277
334
|
<FormInput>
|
|
@@ -418,48 +475,49 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
418
475
|
</>
|
|
419
476
|
)}
|
|
420
477
|
|
|
421
|
-
<View
|
|
422
|
-
style={{
|
|
423
|
-
flexDirection: 'row',
|
|
424
|
-
width: '100%',
|
|
425
|
-
justifyContent: 'space-between',
|
|
426
|
-
alignItems: 'center',
|
|
427
|
-
marginVertical: 30
|
|
428
|
-
}}>
|
|
429
|
-
<View style={loginStyle.line} />
|
|
430
|
-
<OText
|
|
431
|
-
size={14}
|
|
432
|
-
mBottom={10}
|
|
433
|
-
style={{ paddingHorizontal: 19 }}
|
|
434
|
-
color={theme.colors.disabled}>
|
|
435
|
-
{t('OR', 'or')}
|
|
436
|
-
</OText>
|
|
437
|
-
<View style={loginStyle.line} />
|
|
438
|
-
</View>
|
|
439
|
-
|
|
440
478
|
{configs && Object.keys(configs).length > 0 ? (
|
|
441
479
|
(configs?.facebook_login?.value === 'true' ||
|
|
442
480
|
configs?.facebook_login?.value === '1') &&
|
|
443
481
|
configs?.facebook_id?.value && (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
482
|
+
<>
|
|
483
|
+
<View
|
|
484
|
+
style={{
|
|
485
|
+
flexDirection: 'row',
|
|
486
|
+
width: '100%',
|
|
487
|
+
justifyContent: 'space-between',
|
|
488
|
+
alignItems: 'center',
|
|
489
|
+
marginVertical: 30
|
|
490
|
+
}}>
|
|
491
|
+
<View style={loginStyle.line} />
|
|
492
|
+
<OText
|
|
493
|
+
size={14}
|
|
494
|
+
mBottom={10}
|
|
495
|
+
style={{ paddingHorizontal: 19 }}
|
|
496
|
+
color={theme.colors.disabled}>
|
|
497
|
+
{t('OR', 'or')}
|
|
498
|
+
</OText>
|
|
499
|
+
<View style={loginStyle.line} />
|
|
500
|
+
</View>
|
|
501
|
+
<ButtonsWrapper>
|
|
502
|
+
<SocialButtons>
|
|
503
|
+
<FacebookLogin
|
|
504
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
505
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
506
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
507
|
+
/>
|
|
508
|
+
<GoogleLogin
|
|
509
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
510
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
511
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
512
|
+
/>
|
|
513
|
+
<AppleLogin
|
|
514
|
+
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
515
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
516
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
517
|
+
/>
|
|
518
|
+
</SocialButtons>
|
|
519
|
+
</ButtonsWrapper>
|
|
520
|
+
</>
|
|
463
521
|
)
|
|
464
522
|
) : (
|
|
465
523
|
<SkeletonWrapper>
|
|
@@ -4,34 +4,17 @@ export const Container = styled.View`
|
|
|
4
4
|
padding-bottom: 40px;
|
|
5
5
|
`
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const LoginWith = styled.View`
|
|
8
8
|
display: flex;
|
|
9
9
|
width: 100%;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
margin: auto;
|
|
10
|
+
/* border-bottom-width: 2px;
|
|
11
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border}; */
|
|
13
12
|
`;
|
|
14
13
|
|
|
15
|
-
export const
|
|
14
|
+
export const TabsContainer = styled.View`
|
|
15
|
+
width: auto;
|
|
16
|
+
display: flex;
|
|
16
17
|
flex-direction: row;
|
|
17
|
-
width: 100%;
|
|
18
|
-
flex-wrap: wrap;
|
|
19
|
-
justify-content: flex-start;
|
|
20
|
-
margin-bottom: -1px;
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
export const OTab = styled.View`
|
|
24
|
-
padding-bottom: 10px;
|
|
25
|
-
border-bottom-width: 1px;
|
|
26
|
-
margin-end: 14px;
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const LoginWith = styled.View`
|
|
30
|
-
font-size: 14px;
|
|
31
|
-
width: 100%;
|
|
32
|
-
align-items: flex-start;
|
|
33
|
-
border-bottom-width: 1px;
|
|
34
|
-
border-bottom-color: ${(props: any) => props.theme.colors.border}
|
|
35
18
|
`;
|
|
36
19
|
|
|
37
20
|
export const FormInput = styled.View`
|
|
@@ -52,11 +35,6 @@ export const ButtonsWrapper = styled.View`
|
|
|
52
35
|
`}
|
|
53
36
|
`
|
|
54
37
|
|
|
55
|
-
export const SocialButtons = styled.View`
|
|
56
|
-
width: 100%;
|
|
57
|
-
margin: 0px auto 20px;
|
|
58
|
-
`
|
|
59
|
-
|
|
60
38
|
export const OrSeparator = styled.View`
|
|
61
39
|
width: 90%;
|
|
62
40
|
display: flex;
|
|
@@ -66,6 +44,33 @@ export const OrSeparator = styled.View`
|
|
|
66
44
|
margin-bottom: 20px;
|
|
67
45
|
`
|
|
68
46
|
|
|
47
|
+
export const FormSide = styled.View`
|
|
48
|
+
display: flex;
|
|
49
|
+
width: 100%;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: center;
|
|
52
|
+
margin: auto;
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export const OTabs = styled.View`
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
width: 100%;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
justify-content: flex-start;
|
|
60
|
+
margin-bottom: -1px;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export const OTab = styled.View`
|
|
64
|
+
padding-bottom: 5px;
|
|
65
|
+
border-bottom-width: 1px;
|
|
66
|
+
margin-end: 14px;
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const SocialButtons = styled.View`
|
|
70
|
+
width: 100%;
|
|
71
|
+
margin: 0px auto 20px;
|
|
72
|
+
`
|
|
73
|
+
|
|
69
74
|
export const LineSeparator = styled.View`
|
|
70
75
|
width: 40%;
|
|
71
76
|
height: 1px;
|
|
@@ -53,6 +53,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
53
53
|
messagesReadList,
|
|
54
54
|
isFromCheckout,
|
|
55
55
|
driverLocation,
|
|
56
|
+
onNavigationRedirect
|
|
56
57
|
} = props;
|
|
57
58
|
|
|
58
59
|
const theme = useTheme();
|
|
@@ -92,6 +93,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
92
93
|
|
|
93
94
|
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
94
95
|
const [openModalForDriver, setOpenModalForDriver] = useState(false);
|
|
96
|
+
const [isReviewed, setIsReviewed] = useState(false)
|
|
95
97
|
const [unreadAlert, setUnreadAlert] = useState({
|
|
96
98
|
business: false,
|
|
97
99
|
driver: false,
|
|
@@ -394,18 +396,36 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
394
396
|
? parseDate(order?.delivery_datetime_utc)
|
|
395
397
|
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
396
398
|
</OText>
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
399
|
+
{(
|
|
400
|
+
parseInt(order?.status, 10) === 1 ||
|
|
401
|
+
parseInt(order?.status, 10) === 11 ||
|
|
402
|
+
parseInt(order?.status, 10) === 15
|
|
403
|
+
) && !order.review && !isReviewed && (
|
|
404
|
+
<TouchableOpacity
|
|
405
|
+
activeOpacity={0.7}
|
|
406
|
+
style={{ marginTop: 6 }}
|
|
407
|
+
onPress={() => onNavigationRedirect('ReviewOrder', {
|
|
408
|
+
order: {
|
|
409
|
+
id: order?.id,
|
|
410
|
+
business_id: order?.business_id,
|
|
411
|
+
logo: order.business?.logo,
|
|
412
|
+
driver: order?.driver,
|
|
413
|
+
products: order?.products,
|
|
414
|
+
review: order?.review,
|
|
415
|
+
user_review: order?.user_review
|
|
416
|
+
},
|
|
417
|
+
setIsReviewed
|
|
418
|
+
})}
|
|
419
|
+
>
|
|
420
|
+
<OText
|
|
421
|
+
size={10}
|
|
422
|
+
lineHeight={15}
|
|
423
|
+
color={theme.colors.textSecondary}
|
|
424
|
+
style={{ textDecorationLine: 'underline' }}>
|
|
425
|
+
{t('REVIEW_ORDER', 'Review order')}
|
|
426
|
+
</OText>
|
|
427
|
+
</TouchableOpacity>
|
|
428
|
+
)}
|
|
409
429
|
|
|
410
430
|
<StaturBar>
|
|
411
431
|
<LinearGradient
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
|
|
3
|
-
import { useFocusEffect } from '@react-navigation/native'
|
|
4
3
|
import { OText } from '../shared'
|
|
5
4
|
import { NotFoundSource } from '../NotFoundSource'
|
|
6
5
|
import { ActiveOrders } from '../ActiveOrders'
|
|
@@ -32,7 +31,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
32
31
|
ordersLength,
|
|
33
32
|
setOrdersLength,
|
|
34
33
|
businessId,
|
|
35
|
-
preOrders
|
|
34
|
+
preOrders,
|
|
35
|
+
sortOrders
|
|
36
36
|
} = props
|
|
37
37
|
|
|
38
38
|
const theme = useTheme()
|
|
@@ -45,7 +45,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
45
45
|
? theme.images.general.emptyActiveOrders
|
|
46
46
|
: theme.images.general.emptyPastOrders
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
let [orders, setOrders] = useState(values)
|
|
49
49
|
|
|
50
50
|
const [reorderLoading, setReorderLoading] = useState(false)
|
|
51
51
|
const [isLoadingFirstRender, setIsLoadingFirstRender] = useState(false)
|
|
@@ -99,44 +99,44 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
99
99
|
return objectStatus && objectStatus
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
useFocusEffect(
|
|
103
|
-
React.useCallback(() => {
|
|
104
|
-
loadOrders && loadOrders()
|
|
105
|
-
setIsLoadingFirstRender(false)
|
|
106
|
-
return () => {
|
|
107
|
-
setIsLoadingFirstRender(true)
|
|
108
|
-
}
|
|
109
|
-
}, [navigation])
|
|
110
|
-
)
|
|
111
|
-
|
|
112
102
|
useEffect(() => {
|
|
113
103
|
setOrdersLength && setOrdersLength({
|
|
114
104
|
...ordersLength,
|
|
115
|
-
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']:
|
|
105
|
+
[activeOrders ? 'activeOrdersLength' : 'previousOrdersLength']: values.length
|
|
116
106
|
})
|
|
117
|
-
}, [
|
|
107
|
+
}, [values.length])
|
|
118
108
|
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
setOrders(
|
|
111
|
+
sortOrders(
|
|
112
|
+
values.filter((order: any) => orderStatus.includes(order.status))
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
}, [values])
|
|
119
116
|
|
|
120
117
|
return (
|
|
121
118
|
<>
|
|
122
119
|
<OptionTitle>
|
|
123
|
-
{
|
|
124
|
-
<OText
|
|
120
|
+
{orders.length > 0 && !isLoadingFirstRender && (
|
|
121
|
+
<OText
|
|
122
|
+
size={16}
|
|
123
|
+
color={theme.colors.textPrimary}
|
|
124
|
+
mBottom={10}
|
|
125
|
+
style={activeOrders ? { paddingHorizontal: 0 } : {}}
|
|
126
|
+
>
|
|
125
127
|
{titleContent || (
|
|
126
|
-
preOrders ? t('UPCOMING', '
|
|
128
|
+
preOrders ? t('UPCOMING', 'Upcoming')
|
|
127
129
|
: activeOrders ? t('ACTIVE', 'Active')
|
|
128
130
|
: t('PAST', 'Past'))}
|
|
129
131
|
</OText>
|
|
130
132
|
)}
|
|
131
133
|
</OptionTitle>
|
|
132
|
-
{!loading &&
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)}
|
|
139
|
-
{!loading && orders.length === 0 && !isLoadingFirstRender && ordersLength.previousOrdersLength === 0 && (
|
|
134
|
+
{!loading &&
|
|
135
|
+
orders.length === 0 &&
|
|
136
|
+
!isLoadingFirstRender &&
|
|
137
|
+
ordersLength.previousOrdersLength === 0 &&
|
|
138
|
+
ordersLength.activeOrdersLength === 0 &&
|
|
139
|
+
(
|
|
140
140
|
<NotFoundSource
|
|
141
141
|
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
142
142
|
image={imageFails}
|
|
@@ -191,31 +191,31 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
191
191
|
setScreen={setScreen}
|
|
192
192
|
screen={screen}
|
|
193
193
|
/>
|
|
194
|
-
|
|
194
|
+
) : (
|
|
195
195
|
<>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
196
|
+
{preOrders ?
|
|
197
|
+
<ActiveOrders
|
|
198
|
+
orders={orders.filter((order: any) => businessId !== null ? order?.business_id === parseInt(businessId) : true)}
|
|
199
|
+
pagination={pagination}
|
|
200
|
+
loadMoreOrders={loadMoreOrders}
|
|
201
|
+
reorderLoading={reorderLoading}
|
|
202
|
+
customArray={customArray}
|
|
203
|
+
getOrderStatus={getOrderStatus}
|
|
204
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
205
|
+
setScreen={setScreen}
|
|
206
|
+
screen={screen}
|
|
207
|
+
isPreorders
|
|
208
|
+
/>
|
|
209
|
+
: <PreviousOrders
|
|
210
|
+
reorderLoading={reorderLoading}
|
|
211
|
+
orders={orders.filter((order: any) => businessId !== null ? order?.business_id === parseInt(businessId) : true)}
|
|
212
|
+
pagination={pagination}
|
|
213
|
+
loadMoreOrders={loadMoreOrders}
|
|
214
|
+
getOrderStatus={getOrderStatus}
|
|
215
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
216
|
+
handleReorder={handleReorder}
|
|
217
|
+
/>
|
|
218
|
+
}
|
|
219
219
|
</>
|
|
220
220
|
)
|
|
221
221
|
)}
|