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