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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"react-native-snap-carousel": "^3.9.1",
|
|
101
101
|
"react-native-sound": "^0.11.1",
|
|
102
102
|
"react-native-swipe-gestures": "^1.0.5",
|
|
103
|
+
"react-native-swiper": "^1.6.0",
|
|
103
104
|
"react-native-uuid": "^2.0.1",
|
|
104
105
|
"react-native-vector-icons": "^7.1.0",
|
|
105
106
|
"react-native-webview": "^11.6.4",
|
|
Binary file
|
|
@@ -73,8 +73,8 @@ const AccountUI = (props: AccountParams) => {
|
|
|
73
73
|
console.log('ImagePicker Error: ', response.errorMessage);
|
|
74
74
|
showToast(ToastType.Error, response.errorMessage);
|
|
75
75
|
} else {
|
|
76
|
-
if (response
|
|
77
|
-
const url = `data:${response.type};base64,${response.base64}`
|
|
76
|
+
if (response?.assets) {
|
|
77
|
+
const url = `data:${response.assets[0].type};base64,${response.assets[0].base64}`
|
|
78
78
|
handleButtonUpdateClick(null, true, url);
|
|
79
79
|
} else {
|
|
80
80
|
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
package/src/config.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"app_id": "react-native-app",
|
|
3
3
|
"notification_app": "orderingapp",
|
|
4
4
|
"app_name": "Ordering",
|
|
5
|
-
"project": "
|
|
5
|
+
"project": "jorgev4",
|
|
6
6
|
"api": {
|
|
7
|
-
"url": "https://apiv4.ordering.co",
|
|
7
|
+
"url": "https://apiv4-staging.ordering.co",
|
|
8
8
|
"language": "en",
|
|
9
9
|
"version": "v400"
|
|
10
10
|
},
|
|
@@ -75,12 +75,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
75
75
|
const showFloatButtonsPickUp: any = {
|
|
76
76
|
8: true,
|
|
77
77
|
3: true,
|
|
78
|
-
4: true,
|
|
79
78
|
18: true
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
const showFloatButtonsAcceptOrReject: any = {
|
|
83
82
|
0: true,
|
|
83
|
+
4: true,
|
|
84
84
|
7: true,
|
|
85
85
|
};
|
|
86
86
|
|
|
@@ -382,7 +382,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
382
382
|
{showFloatButtonsPickUp[order?.status] && (
|
|
383
383
|
<FloatingButton
|
|
384
384
|
disabled={loading}
|
|
385
|
-
btnText={t('
|
|
385
|
+
btnText={t('PICKUP_FAILED', 'Pickup failed')}
|
|
386
386
|
isSecondaryBtn={false}
|
|
387
387
|
secondButtonClick={() =>
|
|
388
388
|
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
@@ -401,7 +401,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
401
401
|
<>
|
|
402
402
|
<FloatingButton
|
|
403
403
|
disabled={loading}
|
|
404
|
-
btnText={t('
|
|
404
|
+
btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
405
405
|
isSecondaryBtn={false}
|
|
406
406
|
secondButtonClick={() =>
|
|
407
407
|
handleChangeOrderStatus && handleChangeOrderStatus(11)
|
|
@@ -41,10 +41,11 @@ const tabsList: any = {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const tabsListText: any = {
|
|
44
|
-
1: '
|
|
45
|
-
2: '
|
|
46
|
-
3: '
|
|
47
|
-
4: '
|
|
44
|
+
1: 'logistic_pending',
|
|
45
|
+
2: 'pending',
|
|
46
|
+
3: 'inProgress',
|
|
47
|
+
4: 'completed',
|
|
48
|
+
5: 'cancelled'
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
const swipeConfig = {
|
|
@@ -86,7 +87,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
86
87
|
type: ''
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
console.log('ORDERS', ordersGroup)
|
|
90
91
|
const theme = useTheme();
|
|
91
92
|
const [, t] = useLanguage();
|
|
92
93
|
const [{ parseDate }] = useUtils()
|
|
@@ -167,7 +168,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
167
168
|
|
|
168
169
|
const [tagsState, setTags] = useState<any>({ values: [] })
|
|
169
170
|
|
|
170
|
-
const tagsList = ordersGroup[currentTabSelected]
|
|
171
|
+
const tagsList = ordersGroup[currentTabSelected]?.defaultFilter ?? []
|
|
171
172
|
const currentOrdersGroup = ordersGroup[currentTabSelected]
|
|
172
173
|
|
|
173
174
|
const isEqual = (array1: any, array2: any) => {
|
|
@@ -441,8 +442,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
441
442
|
/>
|
|
442
443
|
}
|
|
443
444
|
>
|
|
444
|
-
{!currentOrdersGroup
|
|
445
|
-
currentOrdersGroup
|
|
445
|
+
{!currentOrdersGroup?.error?.length &&
|
|
446
|
+
currentOrdersGroup?.orders?.length > 0 &&
|
|
446
447
|
(
|
|
447
448
|
<PreviousOrders
|
|
448
449
|
orders={currentOrdersGroup.orders}
|
|
@@ -452,8 +453,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
452
453
|
/>
|
|
453
454
|
)}
|
|
454
455
|
|
|
455
|
-
{(currentOrdersGroup
|
|
456
|
-
currentOrdersGroup
|
|
456
|
+
{(currentOrdersGroup?.loading ||
|
|
457
|
+
currentOrdersGroup?.pagination?.total === null) &&
|
|
457
458
|
(
|
|
458
459
|
<>
|
|
459
460
|
<View>
|
|
@@ -486,11 +487,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
486
487
|
</>
|
|
487
488
|
)}
|
|
488
489
|
|
|
489
|
-
{!currentOrdersGroup
|
|
490
|
-
!currentOrdersGroup
|
|
491
|
-
currentOrdersGroup
|
|
492
|
-
currentOrdersGroup
|
|
493
|
-
currentOrdersGroup
|
|
490
|
+
{!currentOrdersGroup?.error?.length &&
|
|
491
|
+
!currentOrdersGroup?.loading &&
|
|
492
|
+
currentOrdersGroup?.pagination?.totalPages &&
|
|
493
|
+
currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
|
|
494
|
+
currentOrdersGroup?.orders?.length > 0 &&
|
|
494
495
|
(
|
|
495
496
|
<OButton
|
|
496
497
|
onClick={handleLoadMore}
|
|
@@ -503,13 +504,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
503
504
|
/>
|
|
504
505
|
)}
|
|
505
506
|
|
|
506
|
-
{!currentOrdersGroup
|
|
507
|
-
(currentOrdersGroup
|
|
508
|
-
currentOrdersGroup
|
|
507
|
+
{!currentOrdersGroup?.loading &&
|
|
508
|
+
(currentOrdersGroup?.error?.length ||
|
|
509
|
+
currentOrdersGroup?.orders?.length === 0) &&
|
|
509
510
|
(
|
|
510
511
|
<NotFoundSource
|
|
511
512
|
content={
|
|
512
|
-
!currentOrdersGroup
|
|
513
|
+
!currentOrdersGroup?.error?.length
|
|
513
514
|
? t('NO_RESULTS_FOUND', 'Sorry, no results found')
|
|
514
515
|
: currentOrdersGroup?.error[0]?.message ||
|
|
515
516
|
currentOrdersGroup?.error[0] ||
|
|
@@ -686,24 +687,30 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
686
687
|
tabs: [
|
|
687
688
|
{
|
|
688
689
|
key: 0,
|
|
690
|
+
text: t('Logistics', 'Logistics'),
|
|
691
|
+
tags: [0],
|
|
692
|
+
title: 'Logistics'
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
key: 1,
|
|
689
696
|
text: t('PENDING', 'Pending'),
|
|
690
|
-
tags: props?.orderGroupStatusCustom?.
|
|
697
|
+
tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
|
|
691
698
|
title: 'pending'
|
|
692
699
|
},
|
|
693
700
|
{
|
|
694
|
-
key:
|
|
701
|
+
key: 2,
|
|
695
702
|
text: t('IN_PROGRESS', 'In Progress'),
|
|
696
703
|
tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21],
|
|
697
704
|
title: 'inProgress',
|
|
698
705
|
},
|
|
699
706
|
{
|
|
700
|
-
key:
|
|
707
|
+
key: 3,
|
|
701
708
|
text: t('COMPLETED', 'Completed'),
|
|
702
709
|
tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
|
|
703
710
|
title: 'completed',
|
|
704
711
|
},
|
|
705
712
|
{
|
|
706
|
-
key:
|
|
713
|
+
key: 4,
|
|
707
714
|
text: t('CANCELLED', 'Cancelled'),
|
|
708
715
|
tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
|
|
709
716
|
title: 'cancelled',
|
|
@@ -14,6 +14,7 @@ import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
|
|
|
14
14
|
import { MomentOption } from './src/components/MomentOption';
|
|
15
15
|
import { OrdersOption } from './src/components/OrdersOption';
|
|
16
16
|
import { OrderDetails } from './src/components/OrderDetails';
|
|
17
|
+
import { OrderProgress } from './src/components/OrderProgress';
|
|
17
18
|
import { UserProfileForm } from './src/components/UserProfileForm';
|
|
18
19
|
import { ReviewOrder } from './src/components/ReviewOrder';
|
|
19
20
|
import { UserProfile } from './src/components/UserProfile';
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
MomentOption,
|
|
68
69
|
OrdersOption,
|
|
69
70
|
OrderDetails,
|
|
71
|
+
OrderProgress,
|
|
70
72
|
UserProfileForm,
|
|
71
73
|
ReviewOrder,
|
|
72
74
|
UserProfile,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
HeaderWrapper,
|
|
26
26
|
ListWrapper,
|
|
27
27
|
FeaturedWrapper,
|
|
28
|
+
OrderProgressWrapper
|
|
28
29
|
} from './styles';
|
|
29
30
|
|
|
30
31
|
import { SearchBar } from '../SearchBar';
|
|
@@ -38,6 +39,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
38
39
|
import { BusinessFeaturedController } from '../BusinessFeaturedController';
|
|
39
40
|
import { HighestRatedBusinesses } from '../HighestRatedBusinesses';
|
|
40
41
|
import { getTypesText } from '../../utils';
|
|
42
|
+
import { OrderProgress } from '../OrderProgress';
|
|
41
43
|
|
|
42
44
|
const PIXELS_TO_SCROLL = 1000;
|
|
43
45
|
|
|
@@ -224,6 +226,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
224
226
|
</View>
|
|
225
227
|
</OrderControlContainer>
|
|
226
228
|
</HeaderWrapper>
|
|
229
|
+
<OrderProgressWrapper>
|
|
230
|
+
<OrderProgress
|
|
231
|
+
{...props}
|
|
232
|
+
/>
|
|
233
|
+
</OrderProgressWrapper>
|
|
227
234
|
{featuredBusiness && featuredBusiness.length > 0 && (
|
|
228
235
|
<FeaturedWrapper>
|
|
229
236
|
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
|
|
@@ -67,4 +67,9 @@ export const FeaturedWrapper = styled.View`
|
|
|
67
67
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
68
68
|
height: 220px;
|
|
69
69
|
paddingVertical: 30px;
|
|
70
|
-
`;
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
export const OrderProgressWrapper = styled.View`
|
|
73
|
+
margin-top: 37px;
|
|
74
|
+
padding-horizontal: 40px;
|
|
75
|
+
`
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
OrderList,
|
|
4
|
+
useLanguage,
|
|
5
|
+
useUtils
|
|
6
|
+
} from 'ordering-components/native'
|
|
7
|
+
import { useTheme } from 'styled-components/native';
|
|
8
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
9
|
+
import moment from 'moment';
|
|
10
|
+
import { OText } from '../shared'
|
|
11
|
+
import { NotFoundSource } from '../NotFoundSource'
|
|
12
|
+
import { View, StyleSheet, TouchableOpacity } from 'react-native'
|
|
13
|
+
import { Placeholder, Fade } from "rn-placeholder";
|
|
14
|
+
import FastImage from 'react-native-fast-image'
|
|
15
|
+
import {
|
|
16
|
+
ProgressContentWrapper,
|
|
17
|
+
ProgressBar,
|
|
18
|
+
TimeWrapper,
|
|
19
|
+
ProgressTextWrapper,
|
|
20
|
+
OrderInfoWrapper
|
|
21
|
+
} from './styles'
|
|
22
|
+
|
|
23
|
+
const OrderProgressUI = (props: any) => {
|
|
24
|
+
const {
|
|
25
|
+
orderList,
|
|
26
|
+
navigation
|
|
27
|
+
} = props
|
|
28
|
+
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
|
|
31
|
+
const [, t] = useLanguage()
|
|
32
|
+
const { loading, error, orders: values } = orderList
|
|
33
|
+
const [{ optimizeImage, parseDate, parseTime }] = useUtils()
|
|
34
|
+
const imageFails = theme.images.general.emptyActiveOrders
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
main: {
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
backgroundColor: '#FFFFFF',
|
|
40
|
+
flex: 1,
|
|
41
|
+
padding: 15,
|
|
42
|
+
borderRadius: 8,
|
|
43
|
+
shadowOffset: {
|
|
44
|
+
width: 1,
|
|
45
|
+
height: 1
|
|
46
|
+
},
|
|
47
|
+
shadowColor: '#000',
|
|
48
|
+
shadowOpacity: 0.1,
|
|
49
|
+
shadowRadius: 1,
|
|
50
|
+
elevation: 2
|
|
51
|
+
},
|
|
52
|
+
logoWrapper: {
|
|
53
|
+
overflow: 'hidden',
|
|
54
|
+
backgroundColor: 'white',
|
|
55
|
+
borderRadius: 8,
|
|
56
|
+
shadowColor: '#000000',
|
|
57
|
+
shadowOffset: { width: 1, height: 1 },
|
|
58
|
+
shadowOpacity: 0.1,
|
|
59
|
+
shadowRadius: 1,
|
|
60
|
+
elevation: 3
|
|
61
|
+
},
|
|
62
|
+
logo: {
|
|
63
|
+
width: 50,
|
|
64
|
+
height: 50,
|
|
65
|
+
borderRadius: 8,
|
|
66
|
+
resizeMode: 'stretch',
|
|
67
|
+
},
|
|
68
|
+
navigationButton: {
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const getOrderStatus = (s: any) => {
|
|
75
|
+
const status = parseInt(s)
|
|
76
|
+
const orderStatus = [
|
|
77
|
+
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
|
|
78
|
+
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
|
|
79
|
+
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
|
|
80
|
+
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
|
|
81
|
+
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
|
|
82
|
+
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
|
|
83
|
+
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
|
|
84
|
+
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
|
|
85
|
+
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
|
|
86
|
+
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 80 },
|
|
87
|
+
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0 },
|
|
88
|
+
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
|
|
89
|
+
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0 },
|
|
90
|
+
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
|
|
91
|
+
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
|
|
92
|
+
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
|
|
93
|
+
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer'), slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER', percentage: 0 },
|
|
94
|
+
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0 },
|
|
95
|
+
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', percentage: 55 },
|
|
96
|
+
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', percentage: 90 },
|
|
97
|
+
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
|
|
98
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 }
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
102
|
+
|
|
103
|
+
return objectStatus && objectStatus
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const convertDiffToHours = (time: any, order: any) => {
|
|
107
|
+
const deliveryTime = order?.delivery_datetime_utc
|
|
108
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
109
|
+
: parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
110
|
+
const [hour, minute] = time.split(':')
|
|
111
|
+
const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
|
|
112
|
+
const returnedDate = moment(new Date(deliveryTime)).add(result, 'minutes').format('hh:mm A')
|
|
113
|
+
return returnedDate
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const handleGoToOrder = (index: string) => {
|
|
117
|
+
navigation && navigation.navigate(index)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<>
|
|
122
|
+
{orderList?.loading && <Placeholder height={150} Animation={Fade} />}
|
|
123
|
+
{!orderList?.loading && orderList?.orders?.length > 0 && orderList?.orders.map((order: any) => (
|
|
124
|
+
<View style={styles.main} key={order.id}>
|
|
125
|
+
<OrderInfoWrapper style={{ flex: 1 }}>
|
|
126
|
+
<View style={styles.logoWrapper}>
|
|
127
|
+
<FastImage
|
|
128
|
+
style={{ width: 50, height: 50 }}
|
|
129
|
+
source={{
|
|
130
|
+
uri: optimizeImage(order?.business?.logo, 'h_50,c_limit'),
|
|
131
|
+
priority: FastImage.priority.normal,
|
|
132
|
+
}}
|
|
133
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
134
|
+
/>
|
|
135
|
+
</View>
|
|
136
|
+
<View style={{
|
|
137
|
+
paddingHorizontal: 10,
|
|
138
|
+
flex: 1
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<OText
|
|
142
|
+
size={13}
|
|
143
|
+
style={{
|
|
144
|
+
fontWeight: 'bold',
|
|
145
|
+
marginBottom: 3
|
|
146
|
+
}}
|
|
147
|
+
>{t('ORDER_IN_PROGRESS', 'Order in progress')}</OText>
|
|
148
|
+
<OText size={11} numberOfLines={1} ellipsizeMode='tail'>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</OText>
|
|
149
|
+
<TouchableOpacity onPress={() => handleGoToOrder('MyOrders')}>
|
|
150
|
+
<View style={styles.navigationButton}>
|
|
151
|
+
<OText size={11} color={theme.colors.primary}>{t('GO_TO_MY_ORDERS', 'Go to my orders')}</OText>
|
|
152
|
+
<IconAntDesign
|
|
153
|
+
name='arrowright'
|
|
154
|
+
color={theme.colors.primary}
|
|
155
|
+
size={13}
|
|
156
|
+
style={{ marginHorizontal: 5 }}
|
|
157
|
+
/>
|
|
158
|
+
</View>
|
|
159
|
+
</TouchableOpacity>
|
|
160
|
+
</View>
|
|
161
|
+
</OrderInfoWrapper>
|
|
162
|
+
<View style={{ flex: 1 }}>
|
|
163
|
+
<ProgressContentWrapper>
|
|
164
|
+
<ProgressBar style={{ width: getOrderStatus(order.status)?.percentage ? `${getOrderStatus(order.status)?.percentage}%` : '0%' }} />
|
|
165
|
+
</ProgressContentWrapper>
|
|
166
|
+
<ProgressTextWrapper>
|
|
167
|
+
<OText size={12}>{getOrderStatus(order.status)?.value}</OText>
|
|
168
|
+
<TimeWrapper>
|
|
169
|
+
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
170
|
+
<OText size={11}>
|
|
171
|
+
{order?.delivery_datetime_utc
|
|
172
|
+
? parseTime(order?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
|
|
173
|
+
: parseTime(order?.delivery_datetime, { utc: false })}
|
|
174
|
+
-
|
|
175
|
+
{convertDiffToHours(order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time, order)}
|
|
176
|
+
</OText>
|
|
177
|
+
</TimeWrapper>
|
|
178
|
+
</ProgressTextWrapper>
|
|
179
|
+
</View>
|
|
180
|
+
</View>
|
|
181
|
+
))}
|
|
182
|
+
{!orderList?.loading && orderList?.orders?.length === 0 && (
|
|
183
|
+
<NotFoundSource
|
|
184
|
+
image={imageFails}
|
|
185
|
+
content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
|
|
186
|
+
conditioned
|
|
187
|
+
/>
|
|
188
|
+
)}
|
|
189
|
+
</>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const OrderProgress = (props: any) => {
|
|
194
|
+
const orderProgressProps = {
|
|
195
|
+
...props,
|
|
196
|
+
UIComponent: OrderProgressUI,
|
|
197
|
+
orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 15, 18, 19, 20, 21],
|
|
198
|
+
useDefualtSessionManager: true,
|
|
199
|
+
paginationSettings: {
|
|
200
|
+
initialPage: 1,
|
|
201
|
+
pageSize: 1,
|
|
202
|
+
controlType: 'infinity'
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return <OrderList {...orderProgressProps} />
|
|
207
|
+
|
|
208
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const ProgressContentWrapper = styled.View`
|
|
4
|
+
height: 12px;
|
|
5
|
+
background: #F8F9FA;
|
|
6
|
+
flex: 1;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
export const ProgressBar = styled.View`
|
|
10
|
+
height: 12px;
|
|
11
|
+
background: ${(props: any) => props.theme.colors.primary};
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
export const TimeWrapper = styled.View`
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export const ProgressTextWrapper = styled.View`
|
|
19
|
+
margin-top: 7px;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const OrderInfoWrapper = styled.View`
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
width: 100%;
|
|
28
|
+
align-items: center;
|
|
29
|
+
margin-bottom: 15px;
|
|
30
|
+
`
|