ordering-ui-react-native 0.12.44 → 0.12.45

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +56 -23
  3. package/src/components/OrderDetails/index.tsx +90 -35
  4. package/src/components/OrderSummary/index.tsx +59 -27
  5. package/src/components/OrderSummary/styles.tsx +6 -0
  6. package/src/components/SingleProductCard/index.tsx +1 -1
  7. package/src/components/TaxInformation/index.tsx +51 -0
  8. package/src/components/TaxInformation/styles.tsx +9 -0
  9. package/src/types/index.tsx +1 -1
  10. package/themes/doordash/src/components/Cart/index.tsx +55 -22
  11. package/themes/doordash/src/components/OrderDetails/index.tsx +444 -386
  12. package/themes/doordash/src/components/OrderSummary/index.tsx +252 -221
  13. package/themes/doordash/src/components/OrderSummary/styles.tsx +6 -0
  14. package/themes/doordash/src/components/SingleProductCard/index.tsx +1 -1
  15. package/themes/doordash/src/components/TaxInformation/index.tsx +51 -0
  16. package/themes/doordash/src/components/TaxInformation/styles.tsx +9 -0
  17. package/themes/franchises/src/components/Cart/index.tsx +55 -23
  18. package/themes/franchises/src/components/OrderDetails/index.tsx +77 -23
  19. package/themes/franchises/src/components/OrderSummary/index.tsx +58 -24
  20. package/themes/franchises/src/components/OrderSummary/styles.tsx +6 -0
  21. package/themes/franchises/src/components/SingleProductCard/index.tsx +1 -1
  22. package/themes/franchises/src/components/TaxInformation/index.tsx +51 -0
  23. package/themes/franchises/src/components/TaxInformation/styles.tsx +9 -0
  24. package/themes/instacart/src/components/Cart/index.tsx +57 -17
  25. package/themes/instacart/src/components/OrderDetails/index.tsx +490 -433
  26. package/themes/instacart/src/components/OrderSummary/index.tsx +236 -194
  27. package/themes/instacart/src/components/OrderSummary/styles.tsx +6 -0
  28. package/themes/instacart/src/components/SingleProductCard/index.tsx +2 -2
  29. package/themes/instacart/src/components/TaxInformation/index.tsx +51 -0
  30. package/themes/instacart/src/components/TaxInformation/styles.tsx +9 -0
  31. package/themes/original/src/components/Cart/index.tsx +55 -13
  32. package/themes/original/src/components/OrderDetails/index.tsx +76 -23
  33. package/themes/original/src/components/OrderSummary/index.tsx +208 -173
  34. package/themes/original/src/components/OrderSummary/styles.tsx +6 -0
  35. package/themes/original/src/components/SingleProductCard/index.tsx +1 -1
  36. package/themes/original/src/components/TaxInformation/index.tsx +51 -0
  37. package/themes/original/src/components/TaxInformation/styles.tsx +9 -0
  38. package/themes/single-business/src/components/Cart/index.tsx +57 -24
  39. package/themes/single-business/src/components/OrderDetails/index.tsx +77 -23
  40. package/themes/single-business/src/components/OrderSummary/index.tsx +58 -24
  41. package/themes/single-business/src/components/OrderSummary/styles.tsx +6 -0
  42. package/themes/single-business/src/components/SingleProductCard/index.tsx +1 -1
  43. package/themes/single-business/src/components/TaxInformation/index.tsx +51 -0
  44. package/themes/single-business/src/components/TaxInformation/styles.tsx +9 -0
  45. package/themes/uber-eats/src/components/Cart/index.tsx +56 -14
  46. package/themes/uber-eats/src/components/OrderDetails/index.tsx +81 -22
  47. package/themes/uber-eats/src/components/OrderSummary/index.tsx +56 -23
  48. package/themes/uber-eats/src/components/OrderSummary/styles.tsx +6 -0
  49. package/themes/uber-eats/src/components/SingleProductCard/index.tsx +1 -1
  50. package/themes/uber-eats/src/components/TaxInformation/index.tsx +51 -0
  51. package/themes/uber-eats/src/components/TaxInformation/styles.tsx +9 -0
@@ -2,41 +2,42 @@ import React, { useState, useEffect } from 'react'
2
2
  import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager, Image } from 'react-native'
3
3
  import Spinner from 'react-native-loading-spinner-overlay'
4
4
  import LinearGradient from 'react-native-linear-gradient'
5
- import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
6
5
  import { Messages } from '../Messages'
6
+ import AntIcon from 'react-native-vector-icons/AntDesign'
7
+
7
8
  import {
8
- useLanguage,
9
- OrderDetails as OrderDetailsConTableoller,
10
- useUtils,
11
- useConfig,
12
- useSession,
13
- useOrder
9
+ useLanguage,
10
+ OrderDetails as OrderDetailsConTableoller,
11
+ useUtils,
12
+ useConfig,
13
+ useSession,
14
+ useOrder
14
15
  } from 'ordering-components/native'
15
16
  import {
16
- OrderDetailsContainer,
17
- Header,
18
- OrderContent,
19
- OrderBusiness,
20
- Logo,
21
- OrderData,
22
- OrderInfo,
23
- OrderStatus,
24
- StatusBar,
25
- StatusImage,
26
- OrderCustomer,
27
- CustomerPhoto,
28
- InfoBlock,
29
- HeaderInfo,
30
- Customer,
31
- OrderProducts,
32
- Table,
33
- OrderBill,
34
- Total,
35
- Icons,
36
- OrderDriver,
37
- Map,
38
- DivideView,
39
- ShareDelivery
17
+ OrderDetailsContainer,
18
+ Header,
19
+ OrderContent,
20
+ OrderBusiness,
21
+ Logo,
22
+ OrderData,
23
+ OrderInfo,
24
+ OrderStatus,
25
+ StatusBar,
26
+ StatusImage,
27
+ OrderCustomer,
28
+ CustomerPhoto,
29
+ InfoBlock,
30
+ HeaderInfo,
31
+ Customer,
32
+ OrderProducts,
33
+ Table,
34
+ OrderBill,
35
+ Total,
36
+ Icons,
37
+ OrderDriver,
38
+ Map,
39
+ DivideView,
40
+ ShareDelivery
40
41
  } from './styles'
41
42
  import { OButton, OIcon, OModal, OText } from '../shared'
42
43
  import { ProductItemAccordion } from '../ProductItemAccordion'
@@ -49,416 +50,472 @@ import { FloatingButton } from '../FloatingButton'
49
50
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
50
51
  import moment from 'moment'
51
52
  import SocialShareFav from '../SocialShare'
52
-
53
+ import { OSRow } from '../OrderSummary/styles'
54
+ import { TaxInformation } from '../TaxInformation';
53
55
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
54
- const {
55
- navigation,
56
- messages,
57
- setMessages,
58
- readMessages,
59
- messagesReadList,
60
- isFromCheckout,
61
- isFromRoot,
62
- driverLocation,
63
- goToBusinessList
64
- } = props
65
-
66
- const theme = useTheme()
67
-
68
- const styles = StyleSheet.create({
69
- rowDirection: {
70
- flexDirection: 'row'
71
- },
72
- statusBar: {
73
- transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
74
- height: 10,
75
- borderRadius: 10,
76
- },
77
- logo: {
78
- width: 59,
79
- height: 59,
80
- },
81
- textBold: {
82
- fontWeight: 'bold'
83
- },
84
- btnBackArrow: {
85
- borderWidth: 0,
86
- backgroundColor: theme.colors.primary,
87
- borderColor: theme.colors.primary,
88
- shadowColor: theme.colors.primary,
89
- alignItems: 'flex-start',
90
- justifyContent: 'flex-start',
91
- paddingLeft: 0,
92
- height: 30
93
- },
94
- })
95
-
96
- const [, t] = useLanguage()
97
- const [{ parsePrice, parseNumber, parseDate }] = useUtils()
98
- const [{ user }] = useSession()
99
- const [{ configs }] = useConfig()
100
- const [, { refreshOrderOptions }] = useOrder()
101
- const [openModalForBusiness, setOpenModalForBusiness] = useState(false)
102
- const [openModalForDriver, setOpenModalForDriver] = useState(false)
103
- const [unreadAlert, setUnreadAlert] = useState({ business: false, driver: false })
104
- const { order, businessData } = props.order
105
- const { bottom } = useSafeAreaInsets();
106
-
107
-
108
- const getOrderStatus = (s: string) => {
109
- const status = parseInt(s)
110
- const orderStatus = [
111
- { key: 0, value: t('PENDING', 'Pending'), slug: 'PENDING', percentage: 0.25, image: theme.images.order.status0 },
112
- { key: 1, value: t('COMPLETED', 'Completed'), slug: 'COMPLETED', percentage: 1, image: theme.images.order.status1 },
113
- { key: 2, value: t('REJECTED', 'Rejected'), slug: 'REJECTED', percentage: 0, image: theme.images.order.status2 },
114
- { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 0.60, image: theme.images.order.status3 },
115
- { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 0.70, image: theme.images.order.status4 },
116
- { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0, image: theme.images.order.status5 },
117
- { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0, image: theme.images.order.status6 },
118
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 0.35, image: theme.images.order.status7 },
119
- { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 0.45, image: theme.images.order.status8 },
120
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 0.80, image: theme.images.order.status9 },
121
- { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0, image: theme.images.order.status10 },
122
- { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 1, image: theme.images.order.status11 },
123
- { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0, image: theme.images.order.status12 },
124
- { key: 13, value: t('PREORDER', 'PreOrder'), slug: 'PREORDER', percentage: 0, image: theme.images.order.status13 },
125
- { key: 14, value: t('ORDER_NOT_READY', 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 0, image: theme.images.order.status14 },
126
- { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100, image: theme.images.order.status15 },
127
- { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'), slug: 'CANCELLED_BY_CUSTOMER', percentage: 0, image: theme.images.order.status16 },
128
- { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0, image: theme.images.order.status17 },
129
- { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business'), slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS', percentage: 0.15, image: theme.images.order.status18 },
130
- { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer'), slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', percentage: 0.90, image: theme.images.order.status19 },
131
- { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90, image: theme.images.order.status20 },
132
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95, image: theme.images.order.status21 }
133
- ]
134
-
135
-
136
- const objectStatus = orderStatus.find((o) => o.key === status)
137
-
138
- return objectStatus && objectStatus
139
- }
140
-
141
- const handleOpenMessagesForBusiness = () => {
142
- setOpenModalForBusiness(true)
143
- readMessages && readMessages()
144
- setUnreadAlert({ ...unreadAlert, business: false })
145
- }
146
-
147
- const handleOpenMessagesForDriver = () => {
148
- setOpenModalForDriver(true)
149
- readMessages && readMessages()
150
- setUnreadAlert({ ...unreadAlert, driver: false })
151
- }
152
-
153
- const unreadMessages = () => {
154
- const length = messages?.messages.length
155
- const unreadLength = order?.unread_count
156
- const unreadedMessages = messages.messages.slice(length - unreadLength, length)
157
- const business = unreadedMessages.some((message: any) => message?.can_see?.includes(2))
158
- const driver = unreadedMessages.some((message: any) => message?.can_see?.includes(4))
159
- setUnreadAlert({ business, driver })
160
- }
161
-
162
- const handleCloseModal = () => {
163
- setOpenModalForBusiness(false)
164
- setOpenModalForDriver(false)
165
- }
166
-
167
- const handleArrowBack: any = () => {
168
- if ((!isFromCheckout && !goToBusinessList) || isFromRoot) {
169
- navigation?.canGoBack() && navigation.goBack();
170
- return
171
- }
172
- if (goToBusinessList) {
173
- refreshOrderOptions()
174
- }
175
- navigation.navigate('BottomTab');
176
- }
177
-
178
- useEffect(() => {
179
- BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
180
- return () => {
181
- BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
182
- }
183
- }, [])
184
-
185
- useEffect(() => {
186
- if (messagesReadList?.length) {
187
- openModalForBusiness ? setUnreadAlert({ ...unreadAlert, business: false }) : setUnreadAlert({ ...unreadAlert, driver: false })
188
- }
189
- }, [messagesReadList])
190
-
191
- const locations = [
192
- { ...order?.driver?.location, title: t('DRIVER', 'Driver'), icon: order?.driver?.photo || 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png' },
193
- { ...order?.business?.location, title: order?.business?.name, icon: order?.business?.logo || theme.images.dummies.businessLogo },
194
- { ...order?.customer?.location, title: t('YOUR_LOCATION', 'Your Location'), icon: order?.customer?.photo || 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png' }
195
- ]
196
-
197
- useEffect(() => {
198
- if (driverLocation) {
199
- locations[0] = driverLocation
200
- }
201
- }, [driverLocation])
202
-
203
- return (
204
- <>
205
- <OrderDetailsContainer keyboardShouldPersistTaps='handled' showsVerticalScrollIndicator={false} style={{ marginBottom: 70 }}>
206
- <Spinner visible={!order || Object.keys(order).length === 0} />
207
- {order && Object.keys(order).length > 0 && (
208
- <>
209
- <Header>
210
- <OButton
211
- imgLeftSrc={theme.images.general.arrow_left}
212
- imgRightSrc={null}
213
- bgColor={theme.colors.white}
214
- style={styles.btnBackArrow}
215
- onClick={() => handleArrowBack()}
216
- imgLeftStyle={{ tintColor: theme.colors.primary }}
217
- />
218
- <OText style={{ ...theme.labels.button, flex: 1, textAlign: 'center' }}>{`${t('ORDER_NO', 'Order No')}.${order?.id}`}</OText>
219
- </Header>
220
- <HeaderInfo>
221
- <Logo>
222
- <OIcon
223
- url={order?.business?.logo}
224
- style={styles.logo}
225
- />
226
- </Logo>
227
- <StatusBar>
228
- <LinearGradient
229
- start={{ x: 0.0, y: 0.0 }}
230
- end={{ x: getOrderStatus(order?.status)?.percentage || 0, y: 0 }}
231
- locations={[.9999, .9999]}
232
- colors={[theme.colors.success, theme.colors.white]}
233
- style={styles.statusBar}
234
- />
235
- </StatusBar>
236
-
237
- <OText style={theme.labels.button} color={theme.colors.white}>{getOrderStatus(order?.status)?.value}</OText>
238
-
239
- <OText color={theme.colors.white} style={{ ...theme.labels.small, textAlign: 'center' }}>
240
- {order?.customer?.name} {t('THANKS_ORDER', 'thanks for your order!')}
241
- </OText>
242
-
243
- <Icons>
244
- <TouchableOpacity onPress={() => props.navigation.navigate('Business', { store: businessData?.slug })} style={{ marginEnd: 10 }}>
245
- <OIcon
246
- src={theme.images.general.call}
247
- width={16}
248
- color={theme.colors.white}
249
- />
250
- </TouchableOpacity>
251
- <TouchableOpacity onPress={() => handleOpenMessagesForBusiness()}>
252
- <OIcon
253
- src={theme.images.general.chat}
254
- width={16}
255
- color={theme.colors.white}
256
- />
257
- </TouchableOpacity>
258
- </Icons>
259
- {/* <OText color={theme.colors.white}>{t('ORDER_MESSAGE_HEADER_TEXT', 'Once business accepts your order, we will send you an email, thank you!')}</OText>
56
+ const {
57
+ navigation,
58
+ messages,
59
+ setMessages,
60
+ readMessages,
61
+ messagesReadList,
62
+ isFromCheckout,
63
+ isFromRoot,
64
+ driverLocation,
65
+ goToBusinessList
66
+ } = props
67
+
68
+ const theme = useTheme()
69
+
70
+ const styles = StyleSheet.create({
71
+ rowDirection: {
72
+ flexDirection: 'row'
73
+ },
74
+ statusBar: {
75
+ transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
76
+ height: 10,
77
+ borderRadius: 10,
78
+ },
79
+ logo: {
80
+ width: 59,
81
+ height: 59,
82
+ },
83
+ textBold: {
84
+ fontWeight: 'bold'
85
+ },
86
+ btnBackArrow: {
87
+ borderWidth: 0,
88
+ backgroundColor: theme.colors.primary,
89
+ borderColor: theme.colors.primary,
90
+ shadowColor: theme.colors.primary,
91
+ alignItems: 'flex-start',
92
+ justifyContent: 'flex-start',
93
+ paddingLeft: 0,
94
+ height: 30
95
+ },
96
+ })
97
+
98
+ const [, t] = useLanguage()
99
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils()
100
+ const [{ user }] = useSession()
101
+ const [{ configs }] = useConfig()
102
+ const [, { refreshOrderOptions }] = useOrder()
103
+ const [openModalForBusiness, setOpenModalForBusiness] = useState(false)
104
+ const [openModalForDriver, setOpenModalForDriver] = useState(false)
105
+ const [unreadAlert, setUnreadAlert] = useState({ business: false, driver: false })
106
+ const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
107
+
108
+ const { order, businessData } = props.order
109
+ const { bottom } = useSafeAreaInsets();
110
+
111
+
112
+ const getOrderStatus = (s: string) => {
113
+ const status = parseInt(s)
114
+ const orderStatus = [
115
+ { key: 0, value: t('PENDING', 'Pending'), slug: 'PENDING', percentage: 0.25, image: theme.images.order.status0 },
116
+ { key: 1, value: t('COMPLETED', 'Completed'), slug: 'COMPLETED', percentage: 1, image: theme.images.order.status1 },
117
+ { key: 2, value: t('REJECTED', 'Rejected'), slug: 'REJECTED', percentage: 0, image: theme.images.order.status2 },
118
+ { key: 3, value: t('DRIVER_IN_BUSINESS', 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 0.60, image: theme.images.order.status3 },
119
+ { key: 4, value: t('PREPARATION_COMPLETED', 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 0.70, image: theme.images.order.status4 },
120
+ { key: 5, value: t('REJECTED_BY_BUSINESS', 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0, image: theme.images.order.status5 },
121
+ { key: 6, value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0, image: theme.images.order.status6 },
122
+ { key: 7, value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 0.35, image: theme.images.order.status7 },
123
+ { key: 8, value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 0.45, image: theme.images.order.status8 },
124
+ { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 0.80, image: theme.images.order.status9 },
125
+ { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0, image: theme.images.order.status10 },
126
+ { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 1, image: theme.images.order.status11 },
127
+ { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0, image: theme.images.order.status12 },
128
+ { key: 13, value: t('PREORDER', 'PreOrder'), slug: 'PREORDER', percentage: 0, image: theme.images.order.status13 },
129
+ { key: 14, value: t('ORDER_NOT_READY', 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 0, image: theme.images.order.status14 },
130
+ { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100, image: theme.images.order.status15 },
131
+ { key: 16, value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'), slug: 'CANCELLED_BY_CUSTOMER', percentage: 0, image: theme.images.order.status16 },
132
+ { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0, image: theme.images.order.status17 },
133
+ { key: 18, value: t('DRIVER_ALMOST_ARRIVED_TO_BUSINESS', 'Driver almost arrived to business'), slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS', percentage: 0.15, image: theme.images.order.status18 },
134
+ { key: 19, value: t('DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', 'Driver almost arrived to customer'), slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', percentage: 0.90, image: theme.images.order.status19 },
135
+ { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90, image: theme.images.order.status20 },
136
+ { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95, image: theme.images.order.status21 }
137
+ ]
138
+
139
+
140
+ const objectStatus = orderStatus.find((o) => o.key === status)
141
+
142
+ return objectStatus && objectStatus
143
+ }
144
+
145
+ const handleOpenMessagesForBusiness = () => {
146
+ setOpenModalForBusiness(true)
147
+ readMessages && readMessages()
148
+ setUnreadAlert({ ...unreadAlert, business: false })
149
+ }
150
+
151
+ const handleOpenMessagesForDriver = () => {
152
+ setOpenModalForDriver(true)
153
+ readMessages && readMessages()
154
+ setUnreadAlert({ ...unreadAlert, driver: false })
155
+ }
156
+
157
+ const unreadMessages = () => {
158
+ const length = messages?.messages.length
159
+ const unreadLength = order?.unread_count
160
+ const unreadedMessages = messages.messages.slice(length - unreadLength, length)
161
+ const business = unreadedMessages.some((message: any) => message?.can_see?.includes(2))
162
+ const driver = unreadedMessages.some((message: any) => message?.can_see?.includes(4))
163
+ setUnreadAlert({ business, driver })
164
+ }
165
+
166
+ const handleCloseModal = () => {
167
+ setOpenModalForBusiness(false)
168
+ setOpenModalForDriver(false)
169
+ }
170
+
171
+ const handleArrowBack: any = () => {
172
+ if ((!isFromCheckout && !goToBusinessList) || isFromRoot) {
173
+ navigation?.canGoBack() && navigation.goBack();
174
+ return
175
+ }
176
+ if (goToBusinessList) {
177
+ refreshOrderOptions()
178
+ }
179
+ navigation.navigate('BottomTab');
180
+ }
181
+
182
+ const getIncludedTaxes = () => {
183
+ if (order?.taxes?.length === 0) {
184
+ return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
185
+ } else {
186
+ return order?.taxes.reduce((taxIncluded: number, tax: any) => {
187
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
188
+ }, 0)
189
+ }
190
+ }
191
+
192
+ useEffect(() => {
193
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
194
+ return () => {
195
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
196
+ }
197
+ }, [])
198
+
199
+ useEffect(() => {
200
+ if (messagesReadList?.length) {
201
+ openModalForBusiness ? setUnreadAlert({ ...unreadAlert, business: false }) : setUnreadAlert({ ...unreadAlert, driver: false })
202
+ }
203
+ }, [messagesReadList])
204
+
205
+ const locations = [
206
+ { ...order?.driver?.location, title: t('DRIVER', 'Driver'), icon: order?.driver?.photo || 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png' },
207
+ { ...order?.business?.location, title: order?.business?.name, icon: order?.business?.logo || theme.images.dummies.businessLogo },
208
+ { ...order?.customer?.location, title: t('YOUR_LOCATION', 'Your Location'), icon: order?.customer?.photo || 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png' }
209
+ ]
210
+
211
+ useEffect(() => {
212
+ if (driverLocation) {
213
+ locations[0] = driverLocation
214
+ }
215
+ }, [driverLocation])
216
+
217
+ return (
218
+ <>
219
+ <OrderDetailsContainer keyboardShouldPersistTaps='handled' showsVerticalScrollIndicator={false} style={{ marginBottom: 70 }}>
220
+ <Spinner visible={!order || Object.keys(order).length === 0} />
221
+ {order && Object.keys(order).length > 0 && (
222
+ <>
223
+ <Header>
224
+ <OButton
225
+ imgLeftSrc={theme.images.general.arrow_left}
226
+ imgRightSrc={null}
227
+ bgColor={theme.colors.white}
228
+ style={styles.btnBackArrow}
229
+ onClick={() => handleArrowBack()}
230
+ imgLeftStyle={{ tintColor: theme.colors.primary }}
231
+ />
232
+ <OText style={{ ...theme.labels.button, flex: 1, textAlign: 'center' }}>{`${t('ORDER_NO', 'Order No')}.${order?.id}`}</OText>
233
+ </Header>
234
+ <HeaderInfo>
235
+ <Logo>
236
+ <OIcon
237
+ url={order?.business?.logo}
238
+ style={styles.logo}
239
+ />
240
+ </Logo>
241
+ <StatusBar>
242
+ <LinearGradient
243
+ start={{ x: 0.0, y: 0.0 }}
244
+ end={{ x: getOrderStatus(order?.status)?.percentage || 0, y: 0 }}
245
+ locations={[.9999, .9999]}
246
+ colors={[theme.colors.success, theme.colors.white]}
247
+ style={styles.statusBar}
248
+ />
249
+ </StatusBar>
250
+
251
+ <OText style={theme.labels.button} color={theme.colors.white}>{getOrderStatus(order?.status)?.value}</OText>
252
+
253
+ <OText color={theme.colors.white} style={{ ...theme.labels.small, textAlign: 'center' }}>
254
+ {order?.customer?.name} {t('THANKS_ORDER', 'thanks for your order!')}
255
+ </OText>
256
+
257
+ <Icons>
258
+ <TouchableOpacity onPress={() => props.navigation.navigate('Business', { store: businessData?.slug })} style={{ marginEnd: 10 }}>
259
+ <OIcon
260
+ src={theme.images.general.call}
261
+ width={16}
262
+ color={theme.colors.white}
263
+ />
264
+ </TouchableOpacity>
265
+ <TouchableOpacity onPress={() => handleOpenMessagesForBusiness()}>
266
+ <OIcon
267
+ src={theme.images.general.chat}
268
+ width={16}
269
+ color={theme.colors.white}
270
+ />
271
+ </TouchableOpacity>
272
+ </Icons>
273
+ {/* <OText color={theme.colors.white}>{t('ORDER_MESSAGE_HEADER_TEXT', 'Once business accepts your order, we will send you an email, thank you!')}</OText>
260
274
  <View style={{ ...styles.rowDirection, justifyContent: 'space-between' }}>
261
275
  <OText size={20} color={theme.colors.white} space>
262
276
  {t('TOTAL', 'Total')}
263
277
  </OText>
264
278
  <OText size={20} color={theme.colors.white}>{parsePrice(order?.summary?.total || order?.total)}</OText>
265
279
  </View> */}
266
- </HeaderInfo>
267
-
268
- <DivideView />
269
-
270
- <OrderCustomer style={{overflow: 'visible', zIndex: 9999}}>
271
- <View style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 15, borderBottomWidth: 1, borderBottomColor: theme.colors.border }}>
272
- <OIcon
273
- src={theme.images.general.clock}
274
- width={16}
275
- height={16}
276
- color={theme.colors.textSecondary}
277
- style={{marginEnd: 15}}
278
- />
279
- <OText size={14} weight={'400'}>
280
- {
281
- order?.delivery_datetime_utc
282
- ? moment(order?.delivery_datetime_utc).format('dddd, MMMM D, yyyy h:m A')
283
- : moment(order?.delivery_datetime).utc().format('dddd, MMMM D, yyyy h:m A')
284
- }
285
- </OText>
286
- </View>
287
- <Customer>
288
- <OIcon
289
- src={theme.images.general.user}
290
- width={16}
291
- height={16}
292
- color={theme.colors.textSecondary}
293
- style={{marginTop: 2}}
294
- />
295
- <InfoBlock>
296
- <OText size={14}>{order?.customer?.name} {order?.customer?.lastname}</OText>
297
- <OText style={{ ...theme.labels.normal, marginVertical: 4 }} color={theme.colors.textSecondary}>{order?.customer?.address}</OText>
298
- <OText style={theme.labels.normal} color={theme.colors.textSecondary}>{order?.customer?.cellphone}</OText>
299
- </InfoBlock>
300
- </Customer>
301
- {order?.driver && (
302
- <OrderDriver>
303
- <Customer>
304
- <OIcon
305
- url={order?.driver?.photo || theme.images.dummies.driverPhoto}
306
- style={{width: 36, height: 36, borderRadius: 7.6, marginTop: 2}}
307
- />
308
- <InfoBlock style={{ marginStart: 7, flex: 1 }}>
309
- <OText size={14}>{order?.driver?.name} {order?.driver?.lastname}</OText>
310
- <OText style={{ ...theme.labels.normal, marginTop: 4 }} color={theme.colors.textSecondary}>{t('DRIVER', 'Driver')}</OText>
311
- </InfoBlock>
312
- <View style={{flexDirection: 'row', alignItems: 'center'}}>
313
- <TouchableOpacity onPress={() => { }} style={{ marginEnd: 10 }}>
314
- <OIcon
315
- src={theme.images.general.call}
316
- width={16}
317
- color={theme.colors.primary}
318
- />
319
- </TouchableOpacity>
320
- <TouchableOpacity onPress={() => handleOpenMessagesForDriver()}>
321
- <OIcon
322
- src={theme.images.general.chat}
323
- width={16}
324
- color={theme.colors.primary}
325
- />
326
- </TouchableOpacity>
327
- </View>
328
- </Customer>
329
- {order?.driver?.location && parseInt(order?.status) === 9 && (
330
- <Map>
331
- <GoogleMap
332
- location={order?.driver?.location}
333
- locations={locations}
334
- readOnly
335
- />
336
- </Map>
337
- )}
338
- </OrderDriver>
339
- )}
340
- <ShareDelivery style={{overflow: 'visible'}}>
341
- <View style={{ flex: 1 }}>
342
- <OText size={14}>{t('SHARE_THIS_DELIVERY', 'Share this delivery')}</OText>
343
- <OText style={{ ...theme.labels.normal, marginTop: 4 }} color={theme.colors.textSecondary}>{t('LET_SOMEONE_FOLLOW_ALONG', 'Let someone follow along')}</OText>
344
- </View>
345
- <View style={{alignItems: 'center', overflow: 'visible'}}>
346
- <SocialShareFav icon={theme.images.general.share} style={{width: 16}} />
347
- </View>
348
- </ShareDelivery>
349
- </OrderCustomer>
350
-
351
- <DivideView />
352
-
353
- <OrderContent>
354
-
355
- <OrderProducts>
356
- <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 10 }}>
357
- <OIcon src={theme.images.general.shop_bag} style={{ marginEnd: 15 }} width={16} color={theme.colors.textSecondary} />
358
- <OText size={14}>{`${order?.products?.length || 0} ${t('ITEMS', 'Items')}`}</OText>
359
- </View>
360
- {order?.products?.length && order?.products.map((product: any, i: number) => (
361
- <ProductItemAccordion
362
- key={product?.id || i}
363
- product={product}
364
- isExpanded
365
- />
366
- ))}
367
- </OrderProducts>
368
- <OrderBill>
369
- <Table style={{ borderTopWidth: 1, borderTopColor: theme.colors.border, paddingTop: 20 }}>
370
- <OText size={12} color={theme.colors.textPrimary}>{t('SUBTOTAL', 'Subtotal')}</OText>
371
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.subtotal || order?.subtotal)}</OText>
372
- </Table>
373
- {(order?.summary?.discount > 0 || order?.discount > 0) && (
374
- <Table>
375
- {order?.offer_type === 1 ? (
376
- <OText size={12} color={theme.colors.textPrimary}>
377
- {t('DISCOUNT', 'Discount')}
378
- <OText size={12} color={theme.colors.textPrimary}>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
379
- </OText>
380
- ) : (
381
- <OText size={12} color={theme.colors.textPrimary}>{t('DISCOUNT', 'Discount')}</OText>
382
- )}
383
- <OText size={12} color={theme.colors.textPrimary}>- {parsePrice(order?.summary?.discount || order?.discount)}</OText>
384
- </Table>
385
- )}
386
- {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
387
- <Table>
388
- <OText size={12} color={theme.colors.textPrimary}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
389
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.subtotal_with_discount || 0)}</OText>
390
- </Table>
391
- )}
392
- {order?.tax_type !== 1 && (
393
- <Table>
394
- <OText size={12} color={theme.colors.textPrimary}>
395
- {t('TAX', 'Tax')}
396
- {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
397
- </OText>
398
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.tax || order?.totalTax)}</OText>
399
- </Table>
400
- )}
401
- {(order?.summary?.delivery_price > 0 || order?.deliveryFee > 0) && (
402
- <Table>
403
- <OText size={12} color={theme.colors.textPrimary}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
404
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.delivery_price || order?.deliveryFee)}</OText>
405
- </Table>
406
- )}
407
- <Table>
408
- <OText size={12} color={theme.colors.textPrimary}>
409
- {t('DRIVER_TIP', 'Driver tip')}
410
- {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
411
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
412
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
413
- (
414
- `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
415
- )}
416
- </OText>
417
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.driver_tip || order?.totalDriverTip)}</OText>
418
- </Table>
419
- <Table>
420
- <OText size={12} color={theme.colors.textPrimary}>
421
- {t('SERVICE_FEE', 'Service Fee')}
422
- {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
423
- </OText>
424
- <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.service_fee || order?.serviceFee || 0)}</OText>
425
- </Table>
426
- <Table>
427
- <OText style={{ ...theme.labels.normal, fontWeight: '600', color: theme.colors.textPrimary }}>{t('TOTAL', 'Total')}</OText>
428
- <OText style={{ ...theme.labels.normal, fontWeight: '600', color: theme.colors.textPrimary }}>{parsePrice(order?.summary?.total || order?.total)}</OText>
429
- </Table>
430
- </OrderBill>
431
- </OrderContent>
432
- </>
433
- )}
434
-
435
- <OModal open={openModalForBusiness || openModalForDriver} entireModal onClose={() => handleCloseModal()}>
436
- <Messages
437
- type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
438
- orderId={order?.id}
439
- messages={messages}
440
- order={order}
441
- setMessages={setMessages}
442
- />
443
- </OModal>
444
-
445
- </OrderDetailsContainer>
446
- <FloatingButton
447
- btnText={t('GO_TO_MY_ORDERS', 'Go to my orders')}
448
- btnRightValue={''}
449
- handleClick={() => handleArrowBack()}
450
- />
451
- </>
452
- )
280
+ </HeaderInfo>
281
+
282
+ <DivideView />
283
+
284
+ <OrderCustomer style={{ overflow: 'visible', zIndex: 9999 }}>
285
+ <View style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 15, borderBottomWidth: 1, borderBottomColor: theme.colors.border }}>
286
+ <OIcon
287
+ src={theme.images.general.clock}
288
+ width={16}
289
+ height={16}
290
+ color={theme.colors.textSecondary}
291
+ style={{ marginEnd: 15 }}
292
+ />
293
+ <OText size={14} weight={'400'}>
294
+ {
295
+ order?.delivery_datetime_utc
296
+ ? moment(order?.delivery_datetime_utc).format('dddd, MMMM D, yyyy h:m A')
297
+ : moment(order?.delivery_datetime).utc().format('dddd, MMMM D, yyyy h:m A')
298
+ }
299
+ </OText>
300
+ </View>
301
+ <Customer>
302
+ <OIcon
303
+ src={theme.images.general.user}
304
+ width={16}
305
+ height={16}
306
+ color={theme.colors.textSecondary}
307
+ style={{ marginTop: 2 }}
308
+ />
309
+ <InfoBlock>
310
+ <OText size={14}>{order?.customer?.name} {order?.customer?.lastname}</OText>
311
+ <OText style={{ ...theme.labels.normal, marginVertical: 4 }} color={theme.colors.textSecondary}>{order?.customer?.address}</OText>
312
+ <OText style={theme.labels.normal} color={theme.colors.textSecondary}>{order?.customer?.cellphone}</OText>
313
+ </InfoBlock>
314
+ </Customer>
315
+ {order?.driver && (
316
+ <OrderDriver>
317
+ <Customer>
318
+ <OIcon
319
+ url={order?.driver?.photo || theme.images.dummies.driverPhoto}
320
+ style={{ width: 36, height: 36, borderRadius: 7.6, marginTop: 2 }}
321
+ />
322
+ <InfoBlock style={{ marginStart: 7, flex: 1 }}>
323
+ <OText size={14}>{order?.driver?.name} {order?.driver?.lastname}</OText>
324
+ <OText style={{ ...theme.labels.normal, marginTop: 4 }} color={theme.colors.textSecondary}>{t('DRIVER', 'Driver')}</OText>
325
+ </InfoBlock>
326
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
327
+ <TouchableOpacity onPress={() => { }} style={{ marginEnd: 10 }}>
328
+ <OIcon
329
+ src={theme.images.general.call}
330
+ width={16}
331
+ color={theme.colors.primary}
332
+ />
333
+ </TouchableOpacity>
334
+ <TouchableOpacity onPress={() => handleOpenMessagesForDriver()}>
335
+ <OIcon
336
+ src={theme.images.general.chat}
337
+ width={16}
338
+ color={theme.colors.primary}
339
+ />
340
+ </TouchableOpacity>
341
+ </View>
342
+ </Customer>
343
+ {order?.driver?.location && parseInt(order?.status) === 9 && (
344
+ <Map>
345
+ <GoogleMap
346
+ location={order?.driver?.location}
347
+ locations={locations}
348
+ readOnly
349
+ />
350
+ </Map>
351
+ )}
352
+ </OrderDriver>
353
+ )}
354
+ <ShareDelivery style={{ overflow: 'visible' }}>
355
+ <View style={{ flex: 1 }}>
356
+ <OText size={14}>{t('SHARE_THIS_DELIVERY', 'Share this delivery')}</OText>
357
+ <OText style={{ ...theme.labels.normal, marginTop: 4 }} color={theme.colors.textSecondary}>{t('LET_SOMEONE_FOLLOW_ALONG', 'Let someone follow along')}</OText>
358
+ </View>
359
+ <View style={{ alignItems: 'center', overflow: 'visible' }}>
360
+ <SocialShareFav icon={theme.images.general.share} style={{ width: 16 }} />
361
+ </View>
362
+ </ShareDelivery>
363
+ </OrderCustomer>
364
+
365
+ <DivideView />
366
+
367
+ <OrderContent>
368
+
369
+ <OrderProducts>
370
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 10 }}>
371
+ <OIcon src={theme.images.general.shop_bag} style={{ marginEnd: 15 }} width={16} color={theme.colors.textSecondary} />
372
+ <OText size={14}>{`${order?.products?.length || 0} ${t('ITEMS', 'Items')}`}</OText>
373
+ </View>
374
+ {order?.products?.length && order?.products.map((product: any, i: number) => (
375
+ <ProductItemAccordion
376
+ key={product?.id || i}
377
+ product={product}
378
+ isExpanded
379
+ />
380
+ ))}
381
+ </OrderProducts>
382
+ <OrderBill>
383
+ <Table style={{ borderTopWidth: 1, borderTopColor: theme.colors.border, paddingTop: 20 }}>
384
+ <OText size={12} color={theme.colors.textPrimary}>{t('SUBTOTAL', 'Subtotal')}</OText>
385
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(((order?.summary?.subtotal || order?.subtotal) + getIncludedTaxes()))}</OText>
386
+ </Table>
387
+ {(order?.summary?.discount > 0 || order?.discount > 0) && (
388
+ <Table>
389
+ {order?.offer_type === 1 ? (
390
+ <OText size={12} color={theme.colors.textPrimary}>
391
+ {t('DISCOUNT', 'Discount')}
392
+ <OText size={12} color={theme.colors.textPrimary}>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
393
+ </OText>
394
+ ) : (
395
+ <OText size={12} color={theme.colors.textPrimary}>{t('DISCOUNT', 'Discount')}</OText>
396
+ )}
397
+ <OText size={12} color={theme.colors.textPrimary}>- {parsePrice(order?.summary?.discount || order?.discount)}</OText>
398
+ </Table>
399
+ )}
400
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
401
+ <Table>
402
+ <OText size={12} color={theme.colors.textPrimary}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
403
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.subtotal_with_discount || 0)}</OText>
404
+ </Table>
405
+ )}
406
+ {
407
+ order?.taxes?.length === 0 && order?.tax_type === 2 && (
408
+ <Table>
409
+ <OText size={12} color={theme.colors.textPrimary}>
410
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
411
+ </OText>
412
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.tax || 0)}</OText>
413
+ </Table>
414
+ )
415
+ }
416
+ {
417
+ order?.fees?.length === 0 && (
418
+ <Table>
419
+ <OText size={12} color={theme.colors.textPrimary}>
420
+ {t('SERVICE_FEE', 'Service fee')}
421
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
422
+ </OText>
423
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
424
+ </Table>
425
+ )
426
+ }
427
+ {
428
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
429
+ <Table key={tax.id}>
430
+ <OSRow>
431
+ <OText size={12} color={theme.colors.textPrimary} numberOfLines={1}>
432
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
433
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
434
+ </OText>
435
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax })}>
436
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
437
+ </TouchableOpacity>
438
+ </OSRow>
439
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(tax?.summary?.tax || 0)}</OText>
440
+ </Table>
441
+ ))
442
+ }
443
+ {
444
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
445
+ <Table key={fee.id}>
446
+ <OSRow>
447
+ <OText size={12} color={theme.colors.textPrimary} numberOfLines={1}>
448
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
449
+ ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
450
+ </OText>
451
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })}>
452
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
453
+ </TouchableOpacity>
454
+ </OSRow>
455
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(fee?.fixed + fee?.summary?.percentage || 0)}</OText>
456
+ </Table>
457
+ ))
458
+ }
459
+ {(order?.summary?.delivery_price > 0 || order?.deliveryFee > 0) && (
460
+ <Table>
461
+ <OText size={12} color={theme.colors.textPrimary}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
462
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.delivery_price || order?.deliveryFee)}</OText>
463
+ </Table>
464
+ )}
465
+ <Table>
466
+ <OText size={12} color={theme.colors.textPrimary}>
467
+ {t('DRIVER_TIP', 'Driver tip')}
468
+ {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
469
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
470
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
471
+ (
472
+ `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
473
+ )}
474
+ </OText>
475
+ <OText size={12} color={theme.colors.textPrimary}>{parsePrice(order?.summary?.driver_tip || order?.totalDriverTip)}</OText>
476
+ </Table>
477
+ <Table>
478
+ <OText style={{ ...theme.labels.normal, fontWeight: '600', color: theme.colors.textPrimary }}>{t('TOTAL', 'Total')}</OText>
479
+ <OText style={{ ...theme.labels.normal, fontWeight: '600', color: theme.colors.textPrimary }}>{parsePrice(order?.summary?.total || order?.total)}</OText>
480
+ </Table>
481
+ </OrderBill>
482
+ </OrderContent>
483
+ </>
484
+ )}
485
+
486
+ <OModal open={openModalForBusiness || openModalForDriver} entireModal onClose={() => handleCloseModal()}>
487
+ <Messages
488
+ type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
489
+ orderId={order?.id}
490
+ messages={messages}
491
+ order={order}
492
+ setMessages={setMessages}
493
+ />
494
+ </OModal>
495
+ <OModal
496
+ open={openTaxModal.open}
497
+ onClose={() => setOpenTaxModal({ open: false, data: null })}
498
+ entireModal
499
+ >
500
+ <TaxInformation data={openTaxModal.data} products={order?.products} />
501
+ </OModal>
502
+ </OrderDetailsContainer>
503
+ <FloatingButton
504
+ btnText={t('GO_TO_MY_ORDERS', 'Go to my orders')}
505
+ btnRightValue={''}
506
+ handleClick={() => handleArrowBack()}
507
+ />
508
+ </>
509
+ )
453
510
  }
454
511
 
455
512
  export const OrderDetails = (props: OrderDetailsParams) => {
456
- const orderDetailsProps = {
457
- ...props,
458
- UIComponent: OrderDetailsUI
459
- }
460
-
461
- return (
462
- <OrderDetailsConTableoller {...orderDetailsProps} />
463
- )
513
+ const orderDetailsProps = {
514
+ ...props,
515
+ UIComponent: OrderDetailsUI
516
+ }
517
+
518
+ return (
519
+ <OrderDetailsConTableoller {...orderDetailsProps} />
520
+ )
464
521
  }