ordering-ui-react-native 0.16.14 → 0.16.15
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/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/themes/original/index.tsx +6 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +3 -2
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +0 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +14 -7
- package/themes/original/src/components/Cart/index.tsx +17 -8
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +291 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +370 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +250 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +150 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +51 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +102 -28
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UserDetails/index.tsx +1 -1
- package/themes/original/src/types/index.tsx +43 -19
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
useEvent,
|
|
5
|
+
useUtils,
|
|
6
|
+
OrderDetails as OrderDetailsController
|
|
7
|
+
} from 'ordering-components/native'
|
|
8
|
+
import { View, StyleSheet, TouchableOpacity, Linking } from 'react-native'
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
10
|
+
import { OText, OButton, OIcon } from '../shared'
|
|
11
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
SingleOrderContainer,
|
|
15
|
+
StaturBar,
|
|
16
|
+
Icons
|
|
17
|
+
} from './styles'
|
|
18
|
+
|
|
19
|
+
const SingleOrderCardUI = (props: any) => {
|
|
20
|
+
const {
|
|
21
|
+
navigation,
|
|
22
|
+
orderTypes,
|
|
23
|
+
readMessages,
|
|
24
|
+
messages,
|
|
25
|
+
setMessages,
|
|
26
|
+
handleGoToOrderDetails
|
|
27
|
+
} = props
|
|
28
|
+
|
|
29
|
+
const { order } = props.order
|
|
30
|
+
const theme = useTheme()
|
|
31
|
+
const [, t] = useLanguage()
|
|
32
|
+
const [{ parseDate, parsePrice }] = useUtils()
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
statusBar: {
|
|
36
|
+
height: 12,
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
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
|
+
const handleGoToMessages = (type: string) => {
|
|
240
|
+
readMessages && readMessages();
|
|
241
|
+
navigation.navigate(
|
|
242
|
+
'MessageDetails',
|
|
243
|
+
{
|
|
244
|
+
type,
|
|
245
|
+
order,
|
|
246
|
+
messages,
|
|
247
|
+
setMessages,
|
|
248
|
+
orderId: order?.id,
|
|
249
|
+
business: type === 'business',
|
|
250
|
+
driver: type === 'driver',
|
|
251
|
+
onClose: () => navigation?.canGoBack()
|
|
252
|
+
? navigation.goBack()
|
|
253
|
+
: navigation.navigate('BottomTab', { screen: 'MyOrders' }),
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<SingleOrderContainer>
|
|
260
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 35 }}>
|
|
261
|
+
<View>
|
|
262
|
+
<OText size={16} lineHeight={24} mBottom={5} weight={'500'} color={theme.colors.textNormal}>
|
|
263
|
+
{t('ORDER', 'Order')} #{order.id}
|
|
264
|
+
</OText>
|
|
265
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
266
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>{orderTypes?.find((type: any) => order?.delivery_type === type?.value)?.text}:</OText>
|
|
267
|
+
<OText mLeft={10} size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
268
|
+
{
|
|
269
|
+
order?.delivery_datetime_utc
|
|
270
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
271
|
+
: parseDate(order?.delivery_datetime, { utc: false })
|
|
272
|
+
}
|
|
273
|
+
</OText>
|
|
274
|
+
</View>
|
|
275
|
+
</View>
|
|
276
|
+
<OButton
|
|
277
|
+
onClick={() => handleGoToOrderDetails(order?.uuid)}
|
|
278
|
+
textStyle={{ color: theme.colors.primary, textAlign: 'center' }}
|
|
279
|
+
style={{ flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
280
|
+
text={t('ORDER_DETAILS', 'Order Details')}
|
|
281
|
+
bgColor={theme.colors.white}
|
|
282
|
+
borderColor={theme.colors.primary}
|
|
283
|
+
/>
|
|
284
|
+
</View>
|
|
285
|
+
<OText size={16} lineHeight={24} mBottom={17} weight={'500'} color={theme.colors.textNormal}>
|
|
286
|
+
{t('FROM', 'From')}
|
|
287
|
+
</OText>
|
|
288
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
|
|
289
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
290
|
+
{order?.business?.name}
|
|
291
|
+
</OText>
|
|
292
|
+
<Icons>
|
|
293
|
+
{!!order?.business?.cellphone && (
|
|
294
|
+
<TouchableOpacity
|
|
295
|
+
onPress={() => order?.business?.cellphone &&
|
|
296
|
+
Linking.openURL(`tel:${order?.business?.cellphone}`)
|
|
297
|
+
}
|
|
298
|
+
style={{ paddingEnd: 5 }}
|
|
299
|
+
>
|
|
300
|
+
<OIcon
|
|
301
|
+
src={theme.images.general.phone}
|
|
302
|
+
width={16}
|
|
303
|
+
color={theme.colors.disabled}
|
|
304
|
+
/>
|
|
305
|
+
</TouchableOpacity>
|
|
306
|
+
)}
|
|
307
|
+
<TouchableOpacity
|
|
308
|
+
style={{ paddingStart: 5 }}
|
|
309
|
+
onPress={() => handleGoToMessages('business')}>
|
|
310
|
+
<OIcon
|
|
311
|
+
src={theme.images.general.chat}
|
|
312
|
+
width={16}
|
|
313
|
+
color={theme.colors.disabled}
|
|
314
|
+
/>
|
|
315
|
+
</TouchableOpacity>
|
|
316
|
+
</Icons>
|
|
317
|
+
</View>
|
|
318
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
319
|
+
{order?.business?.email}
|
|
320
|
+
</OText>
|
|
321
|
+
{!!order?.business?.cellphone && (
|
|
322
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
323
|
+
{order?.business?.cellphone}
|
|
324
|
+
</OText>
|
|
325
|
+
)}
|
|
326
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
327
|
+
{order?.business?.address}
|
|
328
|
+
</OText>
|
|
329
|
+
<StaturBar>
|
|
330
|
+
<LinearGradient
|
|
331
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
332
|
+
end={{
|
|
333
|
+
x: getOrderStatus(order?.status)?.percentage || 0,
|
|
334
|
+
y: 0,
|
|
335
|
+
}}
|
|
336
|
+
locations={[0.9999, 0.9999]}
|
|
337
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray100]}
|
|
338
|
+
style={styles.statusBar}
|
|
339
|
+
/>
|
|
340
|
+
</StaturBar>
|
|
341
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
342
|
+
{getOrderStatus(order?.status)?.value}
|
|
343
|
+
</OText>
|
|
344
|
+
<View style={{ flexDirection: 'row', justifyContent: 'flex-end', marginTop: 20 }}>
|
|
345
|
+
<OText size={16} lineHeight={24} weight={'600'} color={theme.colors.textNormal}>
|
|
346
|
+
{t('EXPORT_ORDER_TOTAL', 'Order total')}: {parsePrice(order?.summary?.total ?? order?.total)}
|
|
347
|
+
</OText>
|
|
348
|
+
</View>
|
|
349
|
+
</SingleOrderContainer>
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export const SingleOrderCard = (props: any) => {
|
|
354
|
+
const [, t] = useLanguage()
|
|
355
|
+
const orderDetailsProps = {
|
|
356
|
+
...props,
|
|
357
|
+
orderTypes: props.orderTypes || [
|
|
358
|
+
{ value: 1, text: t('DELIVERY', 'Delivery') },
|
|
359
|
+
{ value: 2, text: t('PICKUP', 'Pickup') },
|
|
360
|
+
{ value: 3, text: t('EAT_IN', 'Eat in') },
|
|
361
|
+
{ value: 4, text: t('CURBSIDE', 'Curbside') },
|
|
362
|
+
{ value: 5, text: t('DRIVE_THRU', 'Drive thru') }
|
|
363
|
+
],
|
|
364
|
+
UIComponent: SingleOrderCardUI
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return (
|
|
368
|
+
<OrderDetailsController {...orderDetailsProps} />
|
|
369
|
+
)
|
|
370
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
|
|
3
|
+
import { View, StyleSheet } from 'react-native'
|
|
4
|
+
import { useTheme } from 'styled-components/native'
|
|
5
|
+
import { OText, OButton } from '../shared'
|
|
6
|
+
import { Container } from '../../layouts/Container'
|
|
7
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
8
|
+
import { SingleOrderCard } from './SingleOrderCard'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
OrdersDetailsContainer,
|
|
12
|
+
Header,
|
|
13
|
+
Divider,
|
|
14
|
+
Section,
|
|
15
|
+
Customer,
|
|
16
|
+
InfoBlock,
|
|
17
|
+
Row,
|
|
18
|
+
OrdersSummary,
|
|
19
|
+
BorderLine
|
|
20
|
+
} from './styles'
|
|
21
|
+
|
|
22
|
+
export const MultiOrdersDetailsUI = (props: any) => {
|
|
23
|
+
const {
|
|
24
|
+
navigation,
|
|
25
|
+
customer,
|
|
26
|
+
paymentEvents,
|
|
27
|
+
ordersSummary,
|
|
28
|
+
isFromMultiCheckout
|
|
29
|
+
} = props
|
|
30
|
+
|
|
31
|
+
const theme = useTheme()
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
btnBackArrow: {
|
|
34
|
+
borderWidth: 0,
|
|
35
|
+
backgroundColor: theme.colors.clear,
|
|
36
|
+
shadowColor: theme.colors.clear,
|
|
37
|
+
padding: 0,
|
|
38
|
+
marginLeft: -20
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const { loading, orders, error } = props.ordersList
|
|
43
|
+
const [, t] = useLanguage()
|
|
44
|
+
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
45
|
+
const [, { showToast }] = useToast();
|
|
46
|
+
|
|
47
|
+
const walletName: any = {
|
|
48
|
+
cash: {
|
|
49
|
+
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
50
|
+
},
|
|
51
|
+
credit_point: {
|
|
52
|
+
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const handleBackNavigation = () => {
|
|
57
|
+
if (!isFromMultiCheckout) {
|
|
58
|
+
navigation?.canGoBack() && navigation.goBack();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
navigation.navigate('BottomTab');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleGoToOrderDetails = (uuid: any) => {
|
|
65
|
+
navigation.navigate('OrderDetails', { orderId: uuid })
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (error) {
|
|
70
|
+
showToast(ToastType.Error, error)
|
|
71
|
+
}
|
|
72
|
+
}, [error])
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
|
|
76
|
+
<View style={{ flexDirection: 'row' }}>
|
|
77
|
+
<OButton
|
|
78
|
+
imgLeftSrc={theme.images.general.arrow_left}
|
|
79
|
+
imgRightSrc={null}
|
|
80
|
+
style={styles.btnBackArrow}
|
|
81
|
+
onClick={() => handleBackNavigation()}
|
|
82
|
+
imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
|
|
83
|
+
/>
|
|
84
|
+
</View>
|
|
85
|
+
<Header>
|
|
86
|
+
{loading ? (
|
|
87
|
+
<Placeholder Animation={Fade}>
|
|
88
|
+
<PlaceholderLine
|
|
89
|
+
width={20}
|
|
90
|
+
height={30}
|
|
91
|
+
noMargin
|
|
92
|
+
style={{ borderRadius: 10, marginBottom: 8 }}
|
|
93
|
+
/>
|
|
94
|
+
<PlaceholderLine
|
|
95
|
+
height={18}
|
|
96
|
+
noMargin
|
|
97
|
+
style={{ borderRadius: 10 }}
|
|
98
|
+
/>
|
|
99
|
+
</Placeholder>
|
|
100
|
+
) : (
|
|
101
|
+
<>
|
|
102
|
+
<OText size={20} lineHeight={30} mBottom={8} color={theme.colors.textNormal}>
|
|
103
|
+
{t('HEY', 'Hey')} <OText size={20} lineHeight={30} weight={700} mLeft={10} color={theme.colors.textNormal}>{customer?.name} {customer?.lastname}</OText>
|
|
104
|
+
</OText>
|
|
105
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>{t('ORDER_MESSAGE_HEADER_TEXT', 'Once business accepts your order, we will send you an email, thank you!')}</OText>
|
|
106
|
+
</>
|
|
107
|
+
)}
|
|
108
|
+
</Header>
|
|
109
|
+
<Divider />
|
|
110
|
+
<Section>
|
|
111
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
|
|
112
|
+
{t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
113
|
+
</OText>
|
|
114
|
+
{loading ? (
|
|
115
|
+
<Customer>
|
|
116
|
+
<PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
|
|
117
|
+
<PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
|
|
118
|
+
<PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
|
|
119
|
+
</Customer>
|
|
120
|
+
) : (
|
|
121
|
+
<Customer>
|
|
122
|
+
<InfoBlock>
|
|
123
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
124
|
+
{customer?.name} {customer?.lastname}
|
|
125
|
+
</OText>
|
|
126
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
127
|
+
{customer?.address}
|
|
128
|
+
</OText>
|
|
129
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
130
|
+
{customer?.cellphone}
|
|
131
|
+
</OText>
|
|
132
|
+
</InfoBlock>
|
|
133
|
+
</Customer>
|
|
134
|
+
)}
|
|
135
|
+
</Section>
|
|
136
|
+
<Divider />
|
|
137
|
+
<Section>
|
|
138
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={16}>
|
|
139
|
+
{t('PAYMETHOD', 'Payment method')}
|
|
140
|
+
</OText>
|
|
141
|
+
{paymentEvents.map((event: any) => (
|
|
142
|
+
<OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
143
|
+
{event?.wallet_event
|
|
144
|
+
? walletName[event?.wallet_event?.wallet?.type]?.name
|
|
145
|
+
: event?.paymethod?.name}
|
|
146
|
+
</OText>
|
|
147
|
+
))}
|
|
148
|
+
</Section>
|
|
149
|
+
<Divider />
|
|
150
|
+
<Section>
|
|
151
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
|
|
152
|
+
{t('DELIVERYA_V21', 'Delivery address')}
|
|
153
|
+
</OText>
|
|
154
|
+
{loading ? (
|
|
155
|
+
<PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
|
|
156
|
+
) : (
|
|
157
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
158
|
+
{customer?.address}
|
|
159
|
+
</OText>
|
|
160
|
+
)}
|
|
161
|
+
</Section>
|
|
162
|
+
<Divider />
|
|
163
|
+
{loading ? (
|
|
164
|
+
<Placeholder Animation={Fade}>
|
|
165
|
+
<PlaceholderLine
|
|
166
|
+
height={300}
|
|
167
|
+
noMargin
|
|
168
|
+
style={{ borderRadius: 10, marginBottom: 8 }}
|
|
169
|
+
/>
|
|
170
|
+
</Placeholder>
|
|
171
|
+
) : (
|
|
172
|
+
<OrdersSummary>
|
|
173
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
|
|
174
|
+
{t('ORDER_SUMMARY', 'Order summary')}
|
|
175
|
+
</OText>
|
|
176
|
+
{orders.map((order: any) => (
|
|
177
|
+
<Row key={order.id}>
|
|
178
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
179
|
+
{t('ORDER', 'Order')} #{order.id}
|
|
180
|
+
</OText>
|
|
181
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
182
|
+
{parsePrice(order?.summary?.total ?? order?.total)}
|
|
183
|
+
</OText>
|
|
184
|
+
</Row>
|
|
185
|
+
))}
|
|
186
|
+
<BorderLine />
|
|
187
|
+
<Row>
|
|
188
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
189
|
+
{t('TOTAL_BEFORE_TAX', 'Total before tax')}:
|
|
190
|
+
</OText>
|
|
191
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
192
|
+
{parsePrice(ordersSummary?.subtotal)}
|
|
193
|
+
</OText>
|
|
194
|
+
</Row>
|
|
195
|
+
<Row>
|
|
196
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
197
|
+
{t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
|
|
198
|
+
</OText>
|
|
199
|
+
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
|
|
200
|
+
{parsePrice(ordersSummary?.tax)}
|
|
201
|
+
</OText>
|
|
202
|
+
</Row>
|
|
203
|
+
<BorderLine />
|
|
204
|
+
<Row style={{ marginTop: 10 }}>
|
|
205
|
+
<OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
|
|
206
|
+
{t('PAYMENT_TOTAL', 'Payment total')}:
|
|
207
|
+
</OText>
|
|
208
|
+
<OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
|
|
209
|
+
{parsePrice(ordersSummary?.total)}
|
|
210
|
+
</OText>
|
|
211
|
+
</Row>
|
|
212
|
+
</OrdersSummary>
|
|
213
|
+
)}
|
|
214
|
+
|
|
215
|
+
{loading ? (
|
|
216
|
+
[...Array(3).keys()].map(i => (
|
|
217
|
+
<Placeholder Animation={Fade} key={i}>
|
|
218
|
+
<PlaceholderLine
|
|
219
|
+
height={300}
|
|
220
|
+
noMargin
|
|
221
|
+
style={{ borderRadius: 10, marginBottom: 8 }}
|
|
222
|
+
/>
|
|
223
|
+
</Placeholder>
|
|
224
|
+
))
|
|
225
|
+
) : (
|
|
226
|
+
<>
|
|
227
|
+
{orders.map((order: any) => (
|
|
228
|
+
<React.Fragment key={order.id}>
|
|
229
|
+
<SingleOrderCard
|
|
230
|
+
navigation={navigation}
|
|
231
|
+
order={order}
|
|
232
|
+
handleGoToOrderDetails={handleGoToOrderDetails}
|
|
233
|
+
/>
|
|
234
|
+
<Divider />
|
|
235
|
+
</React.Fragment>
|
|
236
|
+
))}
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
<Divider />
|
|
240
|
+
</OrdersDetailsContainer>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export const MultiOrdersDetails = (props: any) => {
|
|
245
|
+
const MultiOrdersDetails = {
|
|
246
|
+
...props,
|
|
247
|
+
UIComponent: MultiOrdersDetailsUI
|
|
248
|
+
}
|
|
249
|
+
return <MultiOrdersDetailsController {...MultiOrdersDetails} />
|
|
250
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const OrdersDetailsContainer = styled.ScrollView`
|
|
4
|
+
`
|
|
5
|
+
export const Header = styled.View`
|
|
6
|
+
padding: 10px 0 24px 0;
|
|
7
|
+
`
|
|
8
|
+
export const Divider = styled.View`
|
|
9
|
+
height: 8px;
|
|
10
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
11
|
+
margin-horizontal: -40px;
|
|
12
|
+
`
|
|
13
|
+
export const Section = styled.View`
|
|
14
|
+
padding: 24px 0px;
|
|
15
|
+
`
|
|
16
|
+
export const Customer = styled.View`
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-items: center;
|
|
19
|
+
`
|
|
20
|
+
export const InfoBlock = styled.View`
|
|
21
|
+
width: 100%;
|
|
22
|
+
`
|
|
23
|
+
export const Row = styled.View`
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
flex: 1;
|
|
27
|
+
align-items: center;
|
|
28
|
+
padding-bottom: 10px;
|
|
29
|
+
`
|
|
30
|
+
export const OrdersSummary = styled.View`
|
|
31
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray100};
|
|
32
|
+
margin-horizontal: -40px;
|
|
33
|
+
padding: 25px 40px;
|
|
34
|
+
`
|
|
35
|
+
export const BorderLine = styled.View`
|
|
36
|
+
height: 1px;
|
|
37
|
+
background-color: ${(props: any) => props.theme.colors.backgroundGray200};
|
|
38
|
+
margin-vertical: 6px;
|
|
39
|
+
`
|
|
40
|
+
export const SingleOrderContainer = styled.View`
|
|
41
|
+
padding: 40px 0;
|
|
42
|
+
`
|
|
43
|
+
export const StaturBar = styled.View`
|
|
44
|
+
margin-top: 30px;
|
|
45
|
+
margin-bottom: 10px;
|
|
46
|
+
`
|
|
47
|
+
export const Icons = styled.View`
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
align-items: center;
|
|
50
|
+
`
|