ordering-ui-react-native 0.17.83 → 0.17.85
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 +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +1 -1
- package/themes/original/src/components/Cart/index.tsx +27 -4
- package/themes/original/src/components/CartContent/index.tsx +5 -1
- package/themes/original/src/components/FavoriteList/index.tsx +1 -35
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/MessageListing/index.tsx +1 -34
- package/themes/original/src/components/MultiCheckout/index.tsx +87 -64
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +31 -2
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +5 -3
- package/themes/original/src/components/OrderDetails/index.tsx +1 -200
- package/themes/original/src/components/OrderProgress/index.tsx +2 -34
- package/themes/original/src/components/OrdersOption/index.tsx +1 -34
- package/themes/original/src/components/Wallets/index.tsx +44 -10
- package/themes/original/src/utils/index.tsx +203 -1
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
useLanguage,
|
|
4
4
|
useEvent,
|
|
5
5
|
useUtils,
|
|
6
|
+
useConfig,
|
|
6
7
|
OrderDetails as OrderDetailsController
|
|
7
8
|
} from 'ordering-components/native'
|
|
8
9
|
import { View, StyleSheet, TouchableOpacity, Linking } from 'react-native'
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
StaturBar,
|
|
16
17
|
Icons
|
|
17
18
|
} from './styles'
|
|
19
|
+
import { getOrderStatus } from '../../utils'
|
|
18
20
|
|
|
19
21
|
const SingleOrderCardUI = (props: any) => {
|
|
20
22
|
const {
|
|
@@ -23,13 +25,17 @@ const SingleOrderCardUI = (props: any) => {
|
|
|
23
25
|
readMessages,
|
|
24
26
|
messages,
|
|
25
27
|
setMessages,
|
|
26
|
-
handleGoToOrderDetails
|
|
28
|
+
handleGoToOrderDetails,
|
|
29
|
+
showProgressBar
|
|
27
30
|
} = props
|
|
28
31
|
|
|
29
32
|
const { order } = props.order
|
|
30
33
|
const theme = useTheme()
|
|
31
34
|
const [, t] = useLanguage()
|
|
32
35
|
const [{ parseDate, parsePrice }] = useUtils()
|
|
36
|
+
const [{ configs }] = useConfig()
|
|
37
|
+
|
|
38
|
+
const hideIndividualButton = configs.multi_business_checkout_remove_individual_buttons?.value === '1'
|
|
33
39
|
|
|
34
40
|
const styles = StyleSheet.create({
|
|
35
41
|
statusBar: {
|
|
@@ -37,205 +43,6 @@ const SingleOrderCardUI = (props: any) => {
|
|
|
37
43
|
}
|
|
38
44
|
})
|
|
39
45
|
|
|
40
|
-
const getOrderStatus = (s: string) => {
|
|
41
|
-
const status = parseInt(s);
|
|
42
|
-
const orderStatus = [
|
|
43
|
-
{
|
|
44
|
-
key: 0,
|
|
45
|
-
value: t('PENDING', 'Pending'),
|
|
46
|
-
slug: 'PENDING',
|
|
47
|
-
percentage: 0.25,
|
|
48
|
-
image: theme.images.order.status0,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: 1,
|
|
52
|
-
value: t('COMPLETED', 'Completed'),
|
|
53
|
-
slug: 'COMPLETED',
|
|
54
|
-
percentage: 1,
|
|
55
|
-
image: theme.images.order.status1,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
key: 2,
|
|
59
|
-
value: t('REJECTED', 'Rejected'),
|
|
60
|
-
slug: 'REJECTED',
|
|
61
|
-
percentage: 0,
|
|
62
|
-
image: theme.images.order.status2,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
key: 3,
|
|
66
|
-
value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
|
|
67
|
-
slug: 'DRIVER_IN_BUSINESS',
|
|
68
|
-
percentage: 0.6,
|
|
69
|
-
image: theme.images.order.status3,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
key: 4,
|
|
73
|
-
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
74
|
-
slug: 'PREPARATION_COMPLETED',
|
|
75
|
-
percentage: 0.7,
|
|
76
|
-
image: theme.images.order.status4,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
key: 5,
|
|
80
|
-
value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
|
|
81
|
-
slug: 'REJECTED_BY_BUSINESS',
|
|
82
|
-
percentage: 0,
|
|
83
|
-
image: theme.images.order.status5,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
key: 6,
|
|
87
|
-
value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
|
|
88
|
-
slug: 'REJECTED_BY_DRIVER',
|
|
89
|
-
percentage: 0,
|
|
90
|
-
image: theme.images.order.status6,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
key: 7,
|
|
94
|
-
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
95
|
-
slug: 'ACCEPTED_BY_BUSINESS',
|
|
96
|
-
percentage: 0.35,
|
|
97
|
-
image: theme.images.order.status7,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
key: 8,
|
|
101
|
-
value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
|
|
102
|
-
slug: 'ACCEPTED_BY_DRIVER',
|
|
103
|
-
percentage: 0.45,
|
|
104
|
-
image: theme.images.order.status8,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
key: 9,
|
|
108
|
-
value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
|
|
109
|
-
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
110
|
-
percentage: 0.8,
|
|
111
|
-
image: theme.images.order.status9,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key: 10,
|
|
115
|
-
value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
|
|
116
|
-
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
117
|
-
percentage: 0,
|
|
118
|
-
image: theme.images.order.status10,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
key: 11,
|
|
122
|
-
value: t(
|
|
123
|
-
'DELIVERY_COMPLETED_BY_DRIVER',
|
|
124
|
-
'Delivery completed by driver',
|
|
125
|
-
),
|
|
126
|
-
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
127
|
-
percentage: 1,
|
|
128
|
-
image: theme.images.order.status11,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
key: 12,
|
|
132
|
-
value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
|
|
133
|
-
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
134
|
-
percentage: 0,
|
|
135
|
-
image: theme.images.order.status12,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
key: 13,
|
|
139
|
-
value: t('PREORDER', 'PreOrder'),
|
|
140
|
-
slug: 'PREORDER',
|
|
141
|
-
percentage: 0,
|
|
142
|
-
image: theme.images.order.status13,
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: 14,
|
|
146
|
-
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
147
|
-
slug: 'ORDER_NOT_READY',
|
|
148
|
-
percentage: 0,
|
|
149
|
-
image: theme.images.order.status13,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
key: 15,
|
|
153
|
-
value: t(
|
|
154
|
-
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
155
|
-
'Order picked up completed by customer',
|
|
156
|
-
),
|
|
157
|
-
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
158
|
-
percentage: 100,
|
|
159
|
-
image: theme.images.order.status1,
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
key: 16,
|
|
163
|
-
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
164
|
-
slug: 'CANCELLED_BY_CUSTOMER',
|
|
165
|
-
percentage: 0,
|
|
166
|
-
image: theme.images.order.status2,
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
key: 17,
|
|
170
|
-
value: t(
|
|
171
|
-
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
172
|
-
'Order not picked up by customer',
|
|
173
|
-
),
|
|
174
|
-
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
175
|
-
percentage: 0,
|
|
176
|
-
image: theme.images.order.status2,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
key: 18,
|
|
180
|
-
value: t(
|
|
181
|
-
'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
182
|
-
'Driver almost arrived to business',
|
|
183
|
-
),
|
|
184
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
185
|
-
percentage: 0.15,
|
|
186
|
-
image: theme.images.order.status3,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
key: 19,
|
|
190
|
-
value: t(
|
|
191
|
-
'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
192
|
-
'Driver almost arrived to customer',
|
|
193
|
-
),
|
|
194
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
195
|
-
percentage: 0.9,
|
|
196
|
-
image: theme.images.order.status11,
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
key: 20,
|
|
200
|
-
value: t(
|
|
201
|
-
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
202
|
-
'Customer almost arrived to business',
|
|
203
|
-
),
|
|
204
|
-
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
205
|
-
percentage: 90,
|
|
206
|
-
image: theme.images.order.status7,
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
key: 21,
|
|
210
|
-
value: t(
|
|
211
|
-
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
212
|
-
'Customer arrived to business',
|
|
213
|
-
),
|
|
214
|
-
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
215
|
-
percentage: 95,
|
|
216
|
-
image: theme.images.order.status7,
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
key: 22,
|
|
220
|
-
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
221
|
-
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
222
|
-
percentage: 35,
|
|
223
|
-
image: theme.images.order.status8
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
key: 23,
|
|
227
|
-
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
228
|
-
slug: 'ORDER_DRIVER_ON_WAY',
|
|
229
|
-
percentage: 45,
|
|
230
|
-
image: theme.images.order.status8
|
|
231
|
-
}
|
|
232
|
-
];
|
|
233
|
-
|
|
234
|
-
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
235
|
-
|
|
236
|
-
return objectStatus && objectStatus;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
46
|
const handleGoToMessages = (type: string) => {
|
|
240
47
|
readMessages && readMessages();
|
|
241
48
|
navigation.navigate(
|
|
@@ -275,14 +82,16 @@ const SingleOrderCardUI = (props: any) => {
|
|
|
275
82
|
</View>
|
|
276
83
|
</View>
|
|
277
84
|
</View>
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
85
|
+
{!hideIndividualButton && (
|
|
86
|
+
<OButton
|
|
87
|
+
onClick={() => handleGoToOrderDetails(order?.uuid)}
|
|
88
|
+
textStyle={{ color: theme.colors.primary, textAlign: 'center', fontSize: 14 }}
|
|
89
|
+
style={{ flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0, paddingLeft: 5, paddingRight: 5, height: 44 }}
|
|
90
|
+
text={t('ORDER_DETAILS', 'Order Details')}
|
|
91
|
+
bgColor={theme.colors.white}
|
|
92
|
+
borderColor={theme.colors.primary}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
286
95
|
</View>
|
|
287
96
|
<OText size={16} lineHeight={24} mBottom={17} weight={'500'} color={theme.colors.textNormal}>
|
|
288
97
|
{t('FROM', 'From')}
|
|
@@ -324,25 +133,29 @@ const SingleOrderCardUI = (props: any) => {
|
|
|
324
133
|
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
325
134
|
{order?.business?.cellphone}
|
|
326
135
|
</OText>
|
|
327
|
-
)}
|
|
136
|
+
)}
|
|
328
137
|
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
329
138
|
{order?.business?.address}
|
|
330
139
|
</OText>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
140
|
+
{showProgressBar && (
|
|
141
|
+
<>
|
|
142
|
+
<StaturBar>
|
|
143
|
+
<LinearGradient
|
|
144
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
145
|
+
end={{
|
|
146
|
+
x: getOrderStatus(order?.status)?.percentage || 0,
|
|
147
|
+
y: 0,
|
|
148
|
+
}}
|
|
149
|
+
locations={[0.9999, 0.9999]}
|
|
150
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray100]}
|
|
151
|
+
style={styles.statusBar}
|
|
152
|
+
/>
|
|
153
|
+
</StaturBar>
|
|
154
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
155
|
+
{getOrderStatus(order?.status)?.value}
|
|
156
|
+
</OText>
|
|
157
|
+
</>
|
|
158
|
+
)}
|
|
346
159
|
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', marginTop: 20 }}>
|
|
347
160
|
<OText size={16} lineHeight={24} weight={'600'} color={theme.colors.textNormal}>
|
|
348
161
|
{t('EXPORT_ORDER_TOTAL', 'Order total')}: {parsePrice(order?.summary?.total ?? order?.total)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, useUtils, useToast, ToastType, useConfig, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
|
|
3
3
|
import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
|
|
4
4
|
import { useTheme } from 'styled-components/native'
|
|
5
5
|
import { OText, OButton } from '../shared'
|
|
@@ -7,6 +7,7 @@ import { Container } from '../../layouts/Container'
|
|
|
7
7
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
8
8
|
import { SingleOrderCard } from './SingleOrderCard'
|
|
9
9
|
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
10
|
+
import { getOrderStatus } from '../../utils'
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
OrdersDetailsContainer,
|
|
@@ -17,9 +18,11 @@ import {
|
|
|
17
18
|
InfoBlock,
|
|
18
19
|
Row,
|
|
19
20
|
OrdersSummary,
|
|
20
|
-
BorderLine
|
|
21
|
+
BorderLine,
|
|
22
|
+
StaturBar
|
|
21
23
|
} from './styles'
|
|
22
24
|
import { NotFoundSource } from '../NotFoundSource'
|
|
25
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
23
26
|
|
|
24
27
|
export const MultiOrdersDetailsUI = (props: any) => {
|
|
25
28
|
const {
|
|
@@ -39,12 +42,20 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
39
42
|
padding: 0,
|
|
40
43
|
marginLeft: -20
|
|
41
44
|
},
|
|
45
|
+
statusBar: {
|
|
46
|
+
height: 12,
|
|
47
|
+
}
|
|
42
48
|
})
|
|
43
49
|
|
|
44
50
|
const { loading, orders, error } = props.ordersList
|
|
45
51
|
const [, t] = useLanguage()
|
|
46
52
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
47
53
|
const [, { showToast }] = useToast();
|
|
54
|
+
const [{ configs }] = useConfig()
|
|
55
|
+
|
|
56
|
+
const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
|
|
57
|
+
const showBarInOrder = ['group', 'both']
|
|
58
|
+
const showBarInIndividual = ['individual', 'both']
|
|
48
59
|
|
|
49
60
|
const walletName: any = {
|
|
50
61
|
cash: {
|
|
@@ -186,6 +197,23 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
186
197
|
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
|
|
187
198
|
{t('ORDER_SUMMARY', 'Order summary')}
|
|
188
199
|
</OText>
|
|
200
|
+
{(showBarInOrder.includes(progressBarStyle)) && (
|
|
201
|
+
<StaturBar isOrderDetails>
|
|
202
|
+
<LinearGradient
|
|
203
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
204
|
+
end={{
|
|
205
|
+
x: getOrderStatus(orders[0]?.status)?.percentage || 0,
|
|
206
|
+
y: 0,
|
|
207
|
+
}}
|
|
208
|
+
locations={[0.9999, 0.9999]}
|
|
209
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray100]}
|
|
210
|
+
style={styles.statusBar}
|
|
211
|
+
/>
|
|
212
|
+
</StaturBar>
|
|
213
|
+
)}
|
|
214
|
+
<OText size={14} lineHeight={18} weight={'400'} color={theme.colors.textNormal} mBottom={10}>
|
|
215
|
+
{getOrderStatus(orders[0]?.status)?.value}
|
|
216
|
+
</OText>
|
|
189
217
|
{orders.map((order: any) => (
|
|
190
218
|
<Row key={order.id}>
|
|
191
219
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
@@ -243,6 +271,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
243
271
|
navigation={navigation}
|
|
244
272
|
order={order}
|
|
245
273
|
handleGoToOrderDetails={handleGoToOrderDetails}
|
|
274
|
+
showProgressBar={showBarInIndividual.includes(progressBarStyle)}
|
|
246
275
|
/>
|
|
247
276
|
<Divider />
|
|
248
277
|
</React.Fragment>
|
|
@@ -41,7 +41,7 @@ export const SingleOrderContainer = styled.View`
|
|
|
41
41
|
padding: 40px 0;
|
|
42
42
|
`
|
|
43
43
|
export const StaturBar = styled.View`
|
|
44
|
-
margin-top: 30px;
|
|
44
|
+
margin-top: ${(props: any) => props.isOrderDetails ? '10px' : '30px'};
|
|
45
45
|
margin-bottom: 10px;
|
|
46
46
|
`
|
|
47
47
|
export const Icons = styled.View`
|
|
@@ -37,6 +37,7 @@ export const MyOrders = (props: any) => {
|
|
|
37
37
|
]
|
|
38
38
|
const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
|
|
39
39
|
const showNavbar = theme?.bar_menu?.components?.orders?.hidden
|
|
40
|
+
const hideOrdersTheme = theme?.bar_menu?.components?.orders?.hidden
|
|
40
41
|
|
|
41
42
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
42
43
|
|
|
@@ -87,7 +88,7 @@ export const MyOrders = (props: any) => {
|
|
|
87
88
|
},
|
|
88
89
|
...props.titleStyle
|
|
89
90
|
}}>
|
|
90
|
-
{!props.hideBackBtn && !isChewLayout && (
|
|
91
|
+
{(!props.hideBackBtn || !hideOrdersTheme) && !isChewLayout && (
|
|
91
92
|
<OButton
|
|
92
93
|
imgLeftStyle={{ width: 18 }}
|
|
93
94
|
imgRightSrc={null}
|
|
@@ -99,7 +100,8 @@ export const MyOrders = (props: any) => {
|
|
|
99
100
|
borderColor: '#FFF',
|
|
100
101
|
shadowColor: '#FFF',
|
|
101
102
|
paddingLeft: 0,
|
|
102
|
-
paddingRight: 0
|
|
103
|
+
paddingRight: 0,
|
|
104
|
+
marginTop: 50,
|
|
103
105
|
}}
|
|
104
106
|
onClick={goToBack}
|
|
105
107
|
icon={AntDesignIcon}
|
|
@@ -109,7 +111,7 @@ export const MyOrders = (props: any) => {
|
|
|
109
111
|
}}
|
|
110
112
|
/>
|
|
111
113
|
)}
|
|
112
|
-
<HeaderTitle ph={
|
|
114
|
+
<HeaderTitle ph={10} text={t('MY_ORDERS', 'My Orders')} />
|
|
113
115
|
</View>
|
|
114
116
|
)}
|
|
115
117
|
{!hideOrders && !isChewLayout && !showNavbar && (
|
|
@@ -40,7 +40,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
|
40
40
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
41
41
|
import { OrderDetailsParams } from '../../types';
|
|
42
42
|
import { GoogleMap } from '../GoogleMap';
|
|
43
|
-
import { verifyDecimals } from '../../utils';
|
|
43
|
+
import { verifyDecimals, getOrderStatus } from '../../utils';
|
|
44
44
|
import { OSRow } from '../OrderSummary/styles';
|
|
45
45
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
46
46
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -133,205 +133,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
const getOrderStatus = (s: string) => {
|
|
137
|
-
const status = parseInt(s);
|
|
138
|
-
const orderStatus = [
|
|
139
|
-
{
|
|
140
|
-
key: 0,
|
|
141
|
-
value: t('PENDING', 'Pending'),
|
|
142
|
-
slug: 'PENDING',
|
|
143
|
-
percentage: 0.25,
|
|
144
|
-
image: theme.images.order.status0,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
key: 1,
|
|
148
|
-
value: t('COMPLETED', 'Completed'),
|
|
149
|
-
slug: 'COMPLETED',
|
|
150
|
-
percentage: 1,
|
|
151
|
-
image: theme.images.order.status1,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
key: 2,
|
|
155
|
-
value: t('REJECTED', 'Rejected'),
|
|
156
|
-
slug: 'REJECTED',
|
|
157
|
-
percentage: 0,
|
|
158
|
-
image: theme.images.order.status2,
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: 3,
|
|
162
|
-
value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
|
|
163
|
-
slug: 'DRIVER_IN_BUSINESS',
|
|
164
|
-
percentage: 0.6,
|
|
165
|
-
image: theme.images.order.status3,
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
key: 4,
|
|
169
|
-
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
170
|
-
slug: 'PREPARATION_COMPLETED',
|
|
171
|
-
percentage: 0.7,
|
|
172
|
-
image: theme.images.order.status4,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
key: 5,
|
|
176
|
-
value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
|
|
177
|
-
slug: 'REJECTED_BY_BUSINESS',
|
|
178
|
-
percentage: 0,
|
|
179
|
-
image: theme.images.order.status5,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
key: 6,
|
|
183
|
-
value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
|
|
184
|
-
slug: 'REJECTED_BY_DRIVER',
|
|
185
|
-
percentage: 0,
|
|
186
|
-
image: theme.images.order.status6,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
key: 7,
|
|
190
|
-
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
191
|
-
slug: 'ACCEPTED_BY_BUSINESS',
|
|
192
|
-
percentage: 0.35,
|
|
193
|
-
image: theme.images.order.status7,
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
key: 8,
|
|
197
|
-
value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
|
|
198
|
-
slug: 'ACCEPTED_BY_DRIVER',
|
|
199
|
-
percentage: 0.45,
|
|
200
|
-
image: theme.images.order.status8,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
key: 9,
|
|
204
|
-
value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
|
|
205
|
-
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
206
|
-
percentage: 0.8,
|
|
207
|
-
image: theme.images.order.status9,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
key: 10,
|
|
211
|
-
value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
|
|
212
|
-
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
213
|
-
percentage: 0,
|
|
214
|
-
image: theme.images.order.status10,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
key: 11,
|
|
218
|
-
value: t(
|
|
219
|
-
'DELIVERY_COMPLETED_BY_DRIVER',
|
|
220
|
-
'Delivery completed by driver',
|
|
221
|
-
),
|
|
222
|
-
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
223
|
-
percentage: 1,
|
|
224
|
-
image: theme.images.order.status11,
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
key: 12,
|
|
228
|
-
value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
|
|
229
|
-
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
230
|
-
percentage: 0,
|
|
231
|
-
image: theme.images.order.status12,
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
key: 13,
|
|
235
|
-
value: t('PREORDER', 'PreOrder'),
|
|
236
|
-
slug: 'PREORDER',
|
|
237
|
-
percentage: 0,
|
|
238
|
-
image: theme.images.order.status13,
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
key: 14,
|
|
242
|
-
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
243
|
-
slug: 'ORDER_NOT_READY',
|
|
244
|
-
percentage: 0,
|
|
245
|
-
image: theme.images.order.status13,
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
key: 15,
|
|
249
|
-
value: t(
|
|
250
|
-
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
251
|
-
'Order picked up completed by customer',
|
|
252
|
-
),
|
|
253
|
-
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
254
|
-
percentage: 100,
|
|
255
|
-
image: theme.images.order.status1,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
key: 16,
|
|
259
|
-
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
260
|
-
slug: 'CANCELLED_BY_CUSTOMER',
|
|
261
|
-
percentage: 0,
|
|
262
|
-
image: theme.images.order.status2,
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
key: 17,
|
|
266
|
-
value: t(
|
|
267
|
-
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
268
|
-
'Order not picked up by customer',
|
|
269
|
-
),
|
|
270
|
-
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
271
|
-
percentage: 0,
|
|
272
|
-
image: theme.images.order.status2,
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
key: 18,
|
|
276
|
-
value: t(
|
|
277
|
-
'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
278
|
-
'Driver almost arrived to business',
|
|
279
|
-
),
|
|
280
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
281
|
-
percentage: 0.15,
|
|
282
|
-
image: theme.images.order.status3,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
key: 19,
|
|
286
|
-
value: t(
|
|
287
|
-
'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
288
|
-
'Driver almost arrived to customer',
|
|
289
|
-
),
|
|
290
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
291
|
-
percentage: 0.9,
|
|
292
|
-
image: theme.images.order.status11,
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
key: 20,
|
|
296
|
-
value: t(
|
|
297
|
-
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
298
|
-
'Customer almost arrived to business',
|
|
299
|
-
),
|
|
300
|
-
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
301
|
-
percentage: 90,
|
|
302
|
-
image: theme.images.order.status7,
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
key: 21,
|
|
306
|
-
value: t(
|
|
307
|
-
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
308
|
-
'Customer arrived to business',
|
|
309
|
-
),
|
|
310
|
-
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
311
|
-
percentage: 95,
|
|
312
|
-
image: theme.images.order.status7,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
key: 22,
|
|
316
|
-
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
317
|
-
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
318
|
-
percentage: 35,
|
|
319
|
-
image: theme.images.order.status8
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
key: 23,
|
|
323
|
-
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
324
|
-
slug: 'ORDER_DRIVER_ON_WAY',
|
|
325
|
-
percentage: 45,
|
|
326
|
-
image: theme.images.order.status8
|
|
327
|
-
}
|
|
328
|
-
];
|
|
329
|
-
|
|
330
|
-
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
331
|
-
|
|
332
|
-
return objectStatus && objectStatus;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
136
|
const handleGoToMessages = (type: string) => {
|
|
336
137
|
readMessages && readMessages();
|
|
337
138
|
navigation.navigate(
|