ordering-ui-react-native 0.12.53 → 0.12.57

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 (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +11 -9
  7. package/themes/business/src/components/OrderDetails/styles.tsx +1 -0
  8. package/themes/business/src/layouts/Container.tsx +3 -1
  9. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  10. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  11. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  12. package/themes/doordash/src/layouts/Container.tsx +1 -1
  13. package/themes/franchises/src/components/Cart/index.tsx +257 -223
  14. package/themes/franchises/src/components/OrderDetails/index.tsx +723 -715
  15. package/themes/franchises/src/components/OrderSummary/index.tsx +188 -154
  16. package/themes/franchises/src/layouts/Container.tsx +1 -1
  17. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  18. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  19. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  20. package/themes/instacart/src/layouts/Container.tsx +1 -1
  21. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  22. package/themes/original/src/components/Cart/index.tsx +268 -234
  23. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  24. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  25. package/themes/original/src/layouts/Container.tsx +1 -1
  26. package/themes/single-business/src/components/Cart/index.tsx +1 -1
  27. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
  28. package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
  29. package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
  30. package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
  31. package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
  32. package/themes/single-business/src/layouts/Container.tsx +1 -1
  33. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  34. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  35. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  36. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
@@ -4,37 +4,37 @@ 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
- useLanguage,
8
- OrderDetails as OrderDetailsConTableoller,
9
- useUtils,
10
- useConfig,
11
- useSession,
7
+ useLanguage,
8
+ OrderDetails as OrderDetailsConTableoller,
9
+ useUtils,
10
+ useConfig,
11
+ useSession,
12
12
  } from 'ordering-components/native';
13
13
  import { useTheme } from 'styled-components/native';
14
14
  import {
15
- OrderDetailsContainer,
16
- Header,
17
- OrderContent,
18
- OrderBusiness,
19
- Logo,
20
- OrderData,
21
- OrderInfo,
22
- OrderStatus,
23
- StaturBar,
24
- StatusImage,
25
- OrderCustomer,
26
- CustomerPhoto,
27
- InfoBlock,
28
- HeaderInfo,
29
- Customer,
30
- OrderProducts,
31
- Table,
32
- OrderBill,
33
- Total,
34
- NavBack,
35
- Icons,
36
- OrderDriver,
37
- Map,
15
+ OrderDetailsContainer,
16
+ Header,
17
+ OrderContent,
18
+ OrderBusiness,
19
+ Logo,
20
+ OrderData,
21
+ OrderInfo,
22
+ OrderStatus,
23
+ StaturBar,
24
+ StatusImage,
25
+ OrderCustomer,
26
+ CustomerPhoto,
27
+ InfoBlock,
28
+ HeaderInfo,
29
+ Customer,
30
+ OrderProducts,
31
+ Table,
32
+ OrderBill,
33
+ Total,
34
+ NavBack,
35
+ Icons,
36
+ OrderDriver,
37
+ Map,
38
38
  } from './styles';
39
39
  import { OButton, OIcon, OModal, OText } from '../shared';
40
40
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -48,286 +48,286 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
48
48
  import { TaxInformation } from '../TaxInformation';
49
49
 
50
50
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
51
- const {
52
- navigation,
53
- messages,
54
- setMessages,
55
- readMessages,
56
- messagesReadList,
57
- isFromCheckout,
58
- driverLocation,
59
- } = props;
51
+ const {
52
+ navigation,
53
+ messages,
54
+ setMessages,
55
+ readMessages,
56
+ messagesReadList,
57
+ isFromCheckout,
58
+ driverLocation,
59
+ } = props;
60
60
 
61
- const theme = useTheme();
61
+ const theme = useTheme();
62
62
 
63
- const styles = StyleSheet.create({
64
- rowDirection: {
65
- flexDirection: 'row',
66
- },
67
- statusBar: {
68
- height: 12,
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: 0,
86
- height: 30,
87
- width: 40,
88
- },
89
- });
63
+ const styles = StyleSheet.create({
64
+ rowDirection: {
65
+ flexDirection: 'row',
66
+ },
67
+ statusBar: {
68
+ height: 12,
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: 0,
86
+ height: 30,
87
+ width: 40,
88
+ },
89
+ });
90
90
 
91
- const [, t] = useLanguage();
92
- const [{ parsePrice, parseNumber, parseDate }] = useUtils();
93
- const [{ user }] = useSession();
94
- const [{ configs }] = useConfig();
91
+ const [, t] = useLanguage();
92
+ const [{ parsePrice, parseNumber, parseDate }] = useUtils();
93
+ const [{ user }] = useSession();
94
+ const [{ configs }] = useConfig();
95
95
 
96
- const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
97
- const [openModalForDriver, setOpenModalForDriver] = useState(false);
98
- const [unreadAlert, setUnreadAlert] = useState({
99
- business: false,
100
- driver: false,
101
- });
96
+ const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
97
+ const [openModalForDriver, setOpenModalForDriver] = useState(false);
98
+ const [unreadAlert, setUnreadAlert] = useState({
99
+ business: false,
100
+ driver: false,
101
+ });
102
102
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
103
103
 
104
- const { order, businessData } = props.order;
104
+ const { order, businessData } = props.order;
105
105
 
106
- const getOrderStatus = (s: string) => {
107
- const status = parseInt(s);
108
- const orderStatus = [
109
- {
110
- key: 0,
111
- value: t('PENDING', 'Pending'),
112
- slug: 'PENDING',
113
- percentage: 0.25,
114
- image: theme.images.order.status0,
115
- },
116
- {
117
- key: 1,
118
- value: t('COMPLETED', 'Completed'),
119
- slug: 'COMPLETED',
120
- percentage: 1,
121
- image: theme.images.order.status1,
122
- },
123
- {
124
- key: 2,
125
- value: t('REJECTED', 'Rejected'),
126
- slug: 'REJECTED',
127
- percentage: 0,
128
- image: theme.images.order.status2,
129
- },
130
- {
131
- key: 3,
132
- value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
133
- slug: 'DRIVER_IN_BUSINESS',
134
- percentage: 0.6,
135
- image: theme.images.order.status3,
136
- },
137
- {
138
- key: 4,
139
- value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
140
- slug: 'PREPARATION_COMPLETED',
141
- percentage: 0.7,
142
- image: theme.images.order.status4,
143
- },
144
- {
145
- key: 5,
146
- value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
147
- slug: 'REJECTED_BY_BUSINESS',
148
- percentage: 0,
149
- image: theme.images.order.status5,
150
- },
151
- {
152
- key: 6,
153
- value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
154
- slug: 'REJECTED_BY_DRIVER',
155
- percentage: 0,
156
- image: theme.images.order.status6,
157
- },
158
- {
159
- key: 7,
160
- value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
161
- slug: 'ACCEPTED_BY_BUSINESS',
162
- percentage: 0.35,
163
- image: theme.images.order.status7,
164
- },
165
- {
166
- key: 8,
167
- value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
168
- slug: 'ACCEPTED_BY_DRIVER',
169
- percentage: 0.45,
170
- image: theme.images.order.status8,
171
- },
172
- {
173
- key: 9,
174
- value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
175
- slug: 'PICK_UP_COMPLETED_BY_DRIVER',
176
- percentage: 0.8,
177
- image: theme.images.order.status9,
178
- },
179
- {
180
- key: 10,
181
- value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
182
- slug: 'PICK_UP_FAILED_BY_DRIVER',
183
- percentage: 0,
184
- image: theme.images.order.status10,
185
- },
186
- {
187
- key: 11,
188
- value: t(
189
- 'DELIVERY_COMPLETED_BY_DRIVER',
190
- 'Delivery completed by driver',
191
- ),
192
- slug: 'DELIVERY_COMPLETED_BY_DRIVER',
193
- percentage: 1,
194
- image: theme.images.order.status11,
195
- },
196
- {
197
- key: 12,
198
- value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
199
- slug: 'DELIVERY_FAILED_BY_DRIVER',
200
- percentage: 0,
201
- image: theme.images.order.status12,
202
- },
203
- {
204
- key: 13,
205
- value: t('PREORDER', 'PreOrder'),
206
- slug: 'PREORDER',
207
- percentage: 0,
208
- image: theme.images.order.status13,
209
- },
210
- {
211
- key: 14,
212
- value: t('ORDER_NOT_READY', 'Order not ready'),
213
- slug: 'ORDER_NOT_READY',
214
- percentage: 0,
215
- image: theme.images.order.status13,
216
- },
217
- {
218
- key: 15,
219
- value: t(
220
- 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
221
- 'Order picked up completed by customer',
222
- ),
223
- slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
224
- percentage: 100,
225
- image: theme.images.order.status1,
226
- },
227
- {
228
- key: 16,
229
- value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
230
- slug: 'CANCELLED_BY_CUSTOMER',
231
- percentage: 0,
232
- image: theme.images.order.status2,
233
- },
234
- {
235
- key: 17,
236
- value: t(
237
- 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
238
- 'Order not picked up by customer',
239
- ),
240
- slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
241
- percentage: 0,
242
- image: theme.images.order.status2,
243
- },
244
- {
245
- key: 18,
246
- value: t(
247
- 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
248
- 'Driver almost arrived to business',
249
- ),
250
- slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
251
- percentage: 0.15,
252
- image: theme.images.order.status3,
253
- },
254
- {
255
- key: 19,
256
- value: t(
257
- 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
258
- 'Driver almost arrived to customer',
259
- ),
260
- slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
261
- percentage: 0.9,
262
- image: theme.images.order.status11,
263
- },
264
- {
265
- key: 20,
266
- value: t(
267
- 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
268
- 'Customer almost arrived to business',
269
- ),
270
- slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
271
- percentage: 90,
272
- image: theme.images.order.status7,
273
- },
274
- {
275
- key: 21,
276
- value: t(
277
- 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
278
- 'Customer arrived to business',
279
- ),
280
- slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
281
- percentage: 95,
282
- image: theme.images.order.status7,
283
- },
284
- ];
106
+ const getOrderStatus = (s: string) => {
107
+ const status = parseInt(s);
108
+ const orderStatus = [
109
+ {
110
+ key: 0,
111
+ value: t('PENDING', 'Pending'),
112
+ slug: 'PENDING',
113
+ percentage: 0.25,
114
+ image: theme.images.order.status0,
115
+ },
116
+ {
117
+ key: 1,
118
+ value: t('COMPLETED', 'Completed'),
119
+ slug: 'COMPLETED',
120
+ percentage: 1,
121
+ image: theme.images.order.status1,
122
+ },
123
+ {
124
+ key: 2,
125
+ value: t('REJECTED', 'Rejected'),
126
+ slug: 'REJECTED',
127
+ percentage: 0,
128
+ image: theme.images.order.status2,
129
+ },
130
+ {
131
+ key: 3,
132
+ value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
133
+ slug: 'DRIVER_IN_BUSINESS',
134
+ percentage: 0.6,
135
+ image: theme.images.order.status3,
136
+ },
137
+ {
138
+ key: 4,
139
+ value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
140
+ slug: 'PREPARATION_COMPLETED',
141
+ percentage: 0.7,
142
+ image: theme.images.order.status4,
143
+ },
144
+ {
145
+ key: 5,
146
+ value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
147
+ slug: 'REJECTED_BY_BUSINESS',
148
+ percentage: 0,
149
+ image: theme.images.order.status5,
150
+ },
151
+ {
152
+ key: 6,
153
+ value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
154
+ slug: 'REJECTED_BY_DRIVER',
155
+ percentage: 0,
156
+ image: theme.images.order.status6,
157
+ },
158
+ {
159
+ key: 7,
160
+ value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
161
+ slug: 'ACCEPTED_BY_BUSINESS',
162
+ percentage: 0.35,
163
+ image: theme.images.order.status7,
164
+ },
165
+ {
166
+ key: 8,
167
+ value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
168
+ slug: 'ACCEPTED_BY_DRIVER',
169
+ percentage: 0.45,
170
+ image: theme.images.order.status8,
171
+ },
172
+ {
173
+ key: 9,
174
+ value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
175
+ slug: 'PICK_UP_COMPLETED_BY_DRIVER',
176
+ percentage: 0.8,
177
+ image: theme.images.order.status9,
178
+ },
179
+ {
180
+ key: 10,
181
+ value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
182
+ slug: 'PICK_UP_FAILED_BY_DRIVER',
183
+ percentage: 0,
184
+ image: theme.images.order.status10,
185
+ },
186
+ {
187
+ key: 11,
188
+ value: t(
189
+ 'DELIVERY_COMPLETED_BY_DRIVER',
190
+ 'Delivery completed by driver',
191
+ ),
192
+ slug: 'DELIVERY_COMPLETED_BY_DRIVER',
193
+ percentage: 1,
194
+ image: theme.images.order.status11,
195
+ },
196
+ {
197
+ key: 12,
198
+ value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
199
+ slug: 'DELIVERY_FAILED_BY_DRIVER',
200
+ percentage: 0,
201
+ image: theme.images.order.status12,
202
+ },
203
+ {
204
+ key: 13,
205
+ value: t('PREORDER', 'PreOrder'),
206
+ slug: 'PREORDER',
207
+ percentage: 0,
208
+ image: theme.images.order.status13,
209
+ },
210
+ {
211
+ key: 14,
212
+ value: t('ORDER_NOT_READY', 'Order not ready'),
213
+ slug: 'ORDER_NOT_READY',
214
+ percentage: 0,
215
+ image: theme.images.order.status13,
216
+ },
217
+ {
218
+ key: 15,
219
+ value: t(
220
+ 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
221
+ 'Order picked up completed by customer',
222
+ ),
223
+ slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
224
+ percentage: 100,
225
+ image: theme.images.order.status1,
226
+ },
227
+ {
228
+ key: 16,
229
+ value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
230
+ slug: 'CANCELLED_BY_CUSTOMER',
231
+ percentage: 0,
232
+ image: theme.images.order.status2,
233
+ },
234
+ {
235
+ key: 17,
236
+ value: t(
237
+ 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
238
+ 'Order not picked up by customer',
239
+ ),
240
+ slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
241
+ percentage: 0,
242
+ image: theme.images.order.status2,
243
+ },
244
+ {
245
+ key: 18,
246
+ value: t(
247
+ 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
248
+ 'Driver almost arrived to business',
249
+ ),
250
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
251
+ percentage: 0.15,
252
+ image: theme.images.order.status3,
253
+ },
254
+ {
255
+ key: 19,
256
+ value: t(
257
+ 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
258
+ 'Driver almost arrived to customer',
259
+ ),
260
+ slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
261
+ percentage: 0.9,
262
+ image: theme.images.order.status11,
263
+ },
264
+ {
265
+ key: 20,
266
+ value: t(
267
+ 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
268
+ 'Customer almost arrived to business',
269
+ ),
270
+ slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
271
+ percentage: 90,
272
+ image: theme.images.order.status7,
273
+ },
274
+ {
275
+ key: 21,
276
+ value: t(
277
+ 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
278
+ 'Customer arrived to business',
279
+ ),
280
+ slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
281
+ percentage: 95,
282
+ image: theme.images.order.status7,
283
+ },
284
+ ];
285
285
 
286
- const objectStatus = orderStatus.find((o) => o.key === status);
286
+ const objectStatus = orderStatus.find((o) => o.key === status);
287
287
 
288
- return objectStatus && objectStatus;
289
- };
288
+ return objectStatus && objectStatus;
289
+ };
290
290
 
291
- const handleOpenMessagesForBusiness = () => {
292
- setOpenModalForBusiness(true);
293
- readMessages && readMessages();
294
- setUnreadAlert({ ...unreadAlert, business: false });
295
- };
291
+ const handleOpenMessagesForBusiness = () => {
292
+ setOpenModalForBusiness(true);
293
+ readMessages && readMessages();
294
+ setUnreadAlert({ ...unreadAlert, business: false });
295
+ };
296
296
 
297
- const handleOpenMessagesForDriver = () => {
298
- setOpenModalForDriver(true);
299
- readMessages && readMessages();
300
- setUnreadAlert({ ...unreadAlert, driver: false });
301
- };
297
+ const handleOpenMessagesForDriver = () => {
298
+ setOpenModalForDriver(true);
299
+ readMessages && readMessages();
300
+ setUnreadAlert({ ...unreadAlert, driver: false });
301
+ };
302
302
 
303
- const unreadMessages = () => {
304
- const length = messages?.messages.length;
305
- const unreadLength = order?.unread_count;
306
- const unreadedMessages = messages.messages.slice(
307
- length - unreadLength,
308
- length,
309
- );
310
- const business = unreadedMessages.some((message: any) =>
311
- message?.can_see?.includes(2),
312
- );
313
- const driver = unreadedMessages.some((message: any) =>
314
- message?.can_see?.includes(4),
315
- );
316
- setUnreadAlert({ business, driver });
317
- };
303
+ const unreadMessages = () => {
304
+ const length = messages?.messages.length;
305
+ const unreadLength = order?.unread_count;
306
+ const unreadedMessages = messages.messages.slice(
307
+ length - unreadLength,
308
+ length,
309
+ );
310
+ const business = unreadedMessages.some((message: any) =>
311
+ message?.can_see?.includes(2),
312
+ );
313
+ const driver = unreadedMessages.some((message: any) =>
314
+ message?.can_see?.includes(4),
315
+ );
316
+ setUnreadAlert({ business, driver });
317
+ };
318
318
 
319
- const handleCloseModal = () => {
320
- setOpenModalForBusiness(false);
321
- setOpenModalForDriver(false);
322
- };
319
+ const handleCloseModal = () => {
320
+ setOpenModalForBusiness(false);
321
+ setOpenModalForDriver(false);
322
+ };
323
323
 
324
- const handleArrowBack: any = () => {
325
- if (!isFromCheckout) {
326
- navigation?.canGoBack() && navigation.goBack();
327
- return;
328
- }
329
- navigation.navigate('BottomTab');
330
- };
324
+ const handleArrowBack: any = () => {
325
+ if (!isFromCheckout) {
326
+ navigation?.canGoBack() && navigation.goBack();
327
+ return;
328
+ }
329
+ navigation.navigate('BottomTab');
330
+ };
331
331
 
332
332
  const getIncludedTaxes = () => {
333
333
  if (order?.taxes?.length === 0) {
@@ -339,362 +339,362 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
339
339
  }
340
340
  }
341
341
 
342
- useEffect(() => {
343
- BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
344
- return () => {
345
- BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
346
- };
347
- }, []);
342
+ useEffect(() => {
343
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
344
+ return () => {
345
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack);
346
+ };
347
+ }, []);
348
348
 
349
- useEffect(() => {
350
- if (messagesReadList?.length) {
351
- openModalForBusiness
352
- ? setUnreadAlert({ ...unreadAlert, business: false })
353
- : setUnreadAlert({ ...unreadAlert, driver: false });
354
- }
355
- }, [messagesReadList]);
349
+ useEffect(() => {
350
+ if (messagesReadList?.length) {
351
+ openModalForBusiness
352
+ ? setUnreadAlert({ ...unreadAlert, business: false })
353
+ : setUnreadAlert({ ...unreadAlert, driver: false });
354
+ }
355
+ }, [messagesReadList]);
356
356
 
357
- const locations = [
358
- {
359
- ...order?.driver?.location,
360
- title: t('DRIVER', 'Driver'),
361
- icon:
362
- order?.driver?.photo ||
363
- 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
364
- },
365
- {
366
- ...order?.business?.location,
367
- title: order?.business?.name,
368
- icon: order?.business?.logo || theme.images.dummies.businessLogo,
369
- },
370
- {
371
- ...order?.customer?.location,
372
- title: t('YOUR_LOCATION', 'Your Location'),
373
- icon:
374
- order?.customer?.photo ||
375
- 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
376
- },
377
- ];
357
+ const locations = [
358
+ {
359
+ ...order?.driver?.location,
360
+ title: t('DRIVER', 'Driver'),
361
+ icon:
362
+ order?.driver?.photo ||
363
+ 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
364
+ },
365
+ {
366
+ ...order?.business?.location,
367
+ title: order?.business?.name,
368
+ icon: order?.business?.logo || theme.images.dummies.businessLogo,
369
+ },
370
+ {
371
+ ...order?.customer?.location,
372
+ title: t('YOUR_LOCATION', 'Your Location'),
373
+ icon:
374
+ order?.customer?.photo ||
375
+ 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
376
+ },
377
+ ];
378
378
 
379
- useEffect(() => {
380
- if (driverLocation) {
381
- locations[0] = driverLocation;
382
- }
383
- }, [driverLocation]);
379
+ useEffect(() => {
380
+ if (driverLocation) {
381
+ locations[0] = driverLocation;
382
+ }
383
+ }, [driverLocation]);
384
384
 
385
- return (
386
- <OrderDetailsContainer keyboardShouldPersistTaps="handled">
387
- <Spinner visible={!order || Object.keys(order).length === 0} />
388
- {order && Object.keys(order).length > 0 && (
389
- <>
390
- <Header>
391
- <OButton
392
- imgLeftSrc={theme.images.general.arrow_left}
393
- imgRightSrc={null}
394
- style={styles.btnBackArrow}
395
- onClick={() => handleArrowBack()}
396
- imgLeftStyle={{ tintColor: theme.colors.disabled }}
397
- />
398
- <OrderInfo>
399
- <OrderData>
400
- <OText
401
- size={20}
402
- lineHeight={30}
403
- weight={'600'}
404
- color={theme.colors.textNormal}>
405
- {t('ORDER', 'Order')} #{order?.id}
406
- </OText>
407
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
408
- {order?.delivery_datetime_utc
409
- ? parseDate(order?.delivery_datetime_utc)
410
- : parseDate(order?.delivery_datetime, { utc: false })}
411
- </OText>
412
- <TouchableOpacity
413
- activeOpacity={0.7}
414
- style={{ marginTop: 6 }}
415
- onPress={() => { }}>
416
- <OText
417
- size={10}
418
- lineHeight={15}
419
- color={theme.colors.textSecondary}
420
- style={{ textDecorationLine: 'underline' }}>
421
- {t('REVIEW_ORDER', 'Review order')}
422
- </OText>
423
- </TouchableOpacity>
385
+ return (
386
+ <OrderDetailsContainer keyboardShouldPersistTaps="handled">
387
+ <Spinner visible={!order || Object.keys(order).length === 0} />
388
+ {order && Object.keys(order).length > 0 && (
389
+ <>
390
+ <Header>
391
+ <OButton
392
+ imgLeftSrc={theme.images.general.arrow_left}
393
+ imgRightSrc={null}
394
+ style={styles.btnBackArrow}
395
+ onClick={() => handleArrowBack()}
396
+ imgLeftStyle={{ tintColor: theme.colors.disabled }}
397
+ />
398
+ <OrderInfo>
399
+ <OrderData>
400
+ <OText
401
+ size={20}
402
+ lineHeight={30}
403
+ weight={'600'}
404
+ color={theme.colors.textNormal}>
405
+ {t('ORDER', 'Order')} #{order?.id}
406
+ </OText>
407
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
408
+ {order?.delivery_datetime_utc
409
+ ? parseDate(order?.delivery_datetime_utc)
410
+ : parseDate(order?.delivery_datetime, { utc: false })}
411
+ </OText>
412
+ <TouchableOpacity
413
+ activeOpacity={0.7}
414
+ style={{ marginTop: 6 }}
415
+ onPress={() => { }}>
416
+ <OText
417
+ size={10}
418
+ lineHeight={15}
419
+ color={theme.colors.textSecondary}
420
+ style={{ textDecorationLine: 'underline' }}>
421
+ {t('REVIEW_ORDER', 'Review order')}
422
+ </OText>
423
+ </TouchableOpacity>
424
424
 
425
- <StaturBar>
426
- <LinearGradient
427
- start={{ x: 0.0, y: 0.0 }}
428
- end={{
429
- x: getOrderStatus(order?.status)?.percentage || 0,
430
- y: 0,
431
- }}
432
- locations={[0.9999, 0.9999]}
433
- colors={[theme.colors.primary, theme.colors.backgroundGray100]}
434
- style={styles.statusBar}
435
- />
436
- </StaturBar>
437
- <OText
438
- size={16}
439
- lineHeight={24}
440
- weight={'600'}
441
- color={theme.colors.textNormal}>
442
- {getOrderStatus(order?.status)?.value}
443
- </OText>
444
- </OrderData>
445
- <View
446
- style={{
447
- height: 8,
448
- backgroundColor: theme.colors.backgroundGray100,
449
- marginTop: 18,
450
- marginHorizontal: -40,
451
- }}
452
- />
453
- </OrderInfo>
454
- </Header>
455
- <OrderContent>
456
- <OrderBusiness>
457
- <OText
458
- size={16}
459
- lineHeight={24}
460
- weight={'500'}
461
- color={theme.colors.textNormal}
462
- mBottom={12}>
463
- {t('FROM', 'From')}
464
- </OText>
465
- <View
466
- style={{
467
- display: 'flex',
468
- flexDirection: 'column',
469
- alignItems: 'flex-start',
470
- }}>
471
- <View
472
- style={{
473
- flexDirection: 'row',
474
- alignItems: 'center',
475
- justifyContent: 'space-between',
476
- }}>
477
- <OText
478
- size={13}
479
- lineHeight={20}
480
- color={theme.colors.textNormal}
481
- style={{ flexGrow: 1, flexBasis: '80%' }}>
482
- {order?.business?.name}
483
- </OText>
484
- <Icons>
485
- <TouchableOpacity
486
- onPress={() =>
487
- props.navigation.navigate('Business', {
488
- store: businessData?.slug,
489
- })
490
- }
491
- style={{ paddingEnd: 5 }}>
492
- <OIcon
493
- src={theme.images.general.phone}
494
- width={16}
495
- color={theme.colors.disabled}
496
- />
497
- </TouchableOpacity>
498
- <TouchableOpacity
499
- style={{ paddingStart: 5 }}
500
- onPress={() => handleOpenMessagesForBusiness()}>
501
- <OIcon
502
- src={theme.images.general.chat}
503
- width={16}
504
- color={theme.colors.disabled}
505
- />
506
- </TouchableOpacity>
507
- </Icons>
508
- </View>
509
- <OText
510
- size={12}
511
- lineHeight={18}
512
- color={theme.colors.textNormal}
513
- mBottom={2}>
514
- {order?.business?.email}
515
- </OText>
516
- <OText
517
- size={12}
518
- lineHeight={18}
519
- color={theme.colors.textNormal}
520
- mBottom={2}>
521
- {order?.business?.cellphone}
522
- </OText>
523
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
524
- {order?.business?.address}
525
- </OText>
526
- </View>
527
- </OrderBusiness>
528
- <View
529
- style={{
530
- height: 8,
531
- backgroundColor: theme.colors.backgroundGray100,
532
- marginTop: 18,
533
- marginHorizontal: -40,
534
- }}
535
- />
536
- <OrderCustomer>
537
- <OText
538
- size={16}
539
- lineHeight={24}
540
- weight={'500'}
541
- color={theme.colors.textNormal}
542
- mBottom={12}>
543
- {t('TO', 'To')}
544
- </OText>
545
- <Customer>
546
- <InfoBlock>
547
- <OText
548
- size={12}
549
- lineHeight={18}
550
- color={theme.colors.textNormal}
551
- mBottom={2}>
552
- {order?.customer?.name} {order?.customer?.lastname}
553
- </OText>
554
- <OText
555
- size={12}
556
- lineHeight={18}
557
- color={theme.colors.textNormal}
558
- mBottom={2}>
559
- {order?.customer?.address}
560
- </OText>
561
- <OText
562
- size={12}
563
- lineHeight={18}
564
- color={theme.colors.textNormal}
565
- mBottom={2}>
566
- {order?.customer?.cellphone}
567
- </OText>
568
- </InfoBlock>
569
- </Customer>
570
- {order?.driver && (
571
- <>
572
- {order?.driver?.location && parseInt(order?.status) === 9 && (
573
- <Map>
574
- <GoogleMap
575
- location={order?.driver?.location}
576
- locations={locations}
577
- readOnly
578
- />
579
- </Map>
580
- )}
581
- </>
582
- )}
583
- </OrderCustomer>
584
- {order?.driver && (
585
- <>
586
- <View
587
- style={{
588
- height: 8,
589
- backgroundColor: theme.colors.backgroundGray100,
590
- marginTop: 18,
591
- marginHorizontal: -40,
592
- }}
593
- />
594
- <OrderDriver>
595
- <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
596
- <Customer>
597
- <InfoBlock>
598
- <View
599
- style={{
600
- flexDirection: 'row',
601
- alignItems: 'center',
602
- justifyContent: 'space-between',
603
- }}>
604
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
605
- {order?.driver?.name} {order?.driver?.lastname}
606
- </OText>
607
- <Icons>
608
- <TouchableOpacity
609
- onPress={() => handleOpenMessagesForDriver()}>
610
- <OIcon
611
- src={theme.images.general.chat}
612
- width={16}
613
- color={theme.colors.disabled}
614
- />
615
- </TouchableOpacity>
616
- </Icons>
617
- </View>
618
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
619
- {order?.driver?.cellphone}
620
- </OText>
621
- </InfoBlock>
622
- </Customer>
623
- </OrderDriver>
624
- </>
625
- )}
626
- <View
627
- style={{
628
- height: 8,
629
- backgroundColor: theme.colors.backgroundGray100,
630
- marginTop: 18,
631
- marginHorizontal: -40,
632
- }}
633
- />
634
- <HeaderInfo>
635
- <OText
636
- size={24}
637
- color={theme.colors.textNormal}
638
- style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
639
- {t(
640
- 'YOUR_ORDER_HAS_BEEN_RECEIVED',
641
- 'Your Order has been received',
642
- )}
643
- </OText>
644
- <OText color={theme.colors.textNormal} size={14} weight={'500'}>
645
- {t(
646
- 'ORDER_MESSAGE_HEADER_TEXT',
647
- 'Once business accepts your order, we will send you an email, thank you!',
648
- )}
649
- </OText>
650
- <OButton
651
- text={t('YOUR_ORDERS', 'Your Orders')}
652
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
653
- imgRightSrc={null}
654
- borderColor={theme.colors.primary}
655
- bgColor={theme.colors.clear}
656
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
657
- parentStyle={{ marginTop: 29, width: '50%' }}
658
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
659
- />
660
- </HeaderInfo>
661
- <OrderProducts>
662
- {order?.products?.length &&
663
- order?.products.map((product: any, i: number) => (
664
- <ProductItemAccordion
665
- key={product?.id || i}
666
- product={product}
667
- isFromCheckout
668
- />
669
- ))}
670
- </OrderProducts>
671
- <OrderBill>
672
- <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
673
- <Table>
674
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
675
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
425
+ <StaturBar>
426
+ <LinearGradient
427
+ start={{ x: 0.0, y: 0.0 }}
428
+ end={{
429
+ x: getOrderStatus(order?.status)?.percentage || 0,
430
+ y: 0,
431
+ }}
432
+ locations={[0.9999, 0.9999]}
433
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
434
+ style={styles.statusBar}
435
+ />
436
+ </StaturBar>
437
+ <OText
438
+ size={16}
439
+ lineHeight={24}
440
+ weight={'600'}
441
+ color={theme.colors.textNormal}>
442
+ {getOrderStatus(order?.status)?.value}
443
+ </OText>
444
+ </OrderData>
445
+ <View
446
+ style={{
447
+ height: 8,
448
+ backgroundColor: theme.colors.backgroundGray100,
449
+ marginTop: 18,
450
+ marginHorizontal: -40,
451
+ }}
452
+ />
453
+ </OrderInfo>
454
+ </Header>
455
+ <OrderContent>
456
+ <OrderBusiness>
457
+ <OText
458
+ size={16}
459
+ lineHeight={24}
460
+ weight={'500'}
461
+ color={theme.colors.textNormal}
462
+ mBottom={12}>
463
+ {t('FROM', 'From')}
464
+ </OText>
465
+ <View
466
+ style={{
467
+ display: 'flex',
468
+ flexDirection: 'column',
469
+ alignItems: 'flex-start',
470
+ }}>
471
+ <View
472
+ style={{
473
+ flexDirection: 'row',
474
+ alignItems: 'center',
475
+ justifyContent: 'space-between',
476
+ }}>
477
+ <OText
478
+ size={13}
479
+ lineHeight={20}
480
+ color={theme.colors.textNormal}
481
+ style={{ flexGrow: 1, flexBasis: '80%' }}>
482
+ {order?.business?.name}
483
+ </OText>
484
+ <Icons>
485
+ <TouchableOpacity
486
+ onPress={() =>
487
+ props.navigation.navigate('Business', {
488
+ store: businessData?.slug,
489
+ })
490
+ }
491
+ style={{ paddingEnd: 5 }}>
492
+ <OIcon
493
+ src={theme.images.general.phone}
494
+ width={16}
495
+ color={theme.colors.disabled}
496
+ />
497
+ </TouchableOpacity>
498
+ <TouchableOpacity
499
+ style={{ paddingStart: 5 }}
500
+ onPress={() => handleOpenMessagesForBusiness()}>
501
+ <OIcon
502
+ src={theme.images.general.chat}
503
+ width={16}
504
+ color={theme.colors.disabled}
505
+ />
506
+ </TouchableOpacity>
507
+ </Icons>
508
+ </View>
509
+ <OText
510
+ size={12}
511
+ lineHeight={18}
512
+ color={theme.colors.textNormal}
513
+ mBottom={2}>
514
+ {order?.business?.email}
515
+ </OText>
516
+ <OText
517
+ size={12}
518
+ lineHeight={18}
519
+ color={theme.colors.textNormal}
520
+ mBottom={2}>
521
+ {order?.business?.cellphone}
522
+ </OText>
523
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
524
+ {order?.business?.address}
525
+ </OText>
526
+ </View>
527
+ </OrderBusiness>
528
+ <View
529
+ style={{
530
+ height: 8,
531
+ backgroundColor: theme.colors.backgroundGray100,
532
+ marginTop: 18,
533
+ marginHorizontal: -40,
534
+ }}
535
+ />
536
+ <OrderCustomer>
537
+ <OText
538
+ size={16}
539
+ lineHeight={24}
540
+ weight={'500'}
541
+ color={theme.colors.textNormal}
542
+ mBottom={12}>
543
+ {t('TO', 'To')}
544
+ </OText>
545
+ <Customer>
546
+ <InfoBlock>
547
+ <OText
548
+ size={12}
549
+ lineHeight={18}
550
+ color={theme.colors.textNormal}
551
+ mBottom={2}>
552
+ {order?.customer?.name} {order?.customer?.lastname}
553
+ </OText>
554
+ <OText
555
+ size={12}
556
+ lineHeight={18}
557
+ color={theme.colors.textNormal}
558
+ mBottom={2}>
559
+ {order?.customer?.address}
560
+ </OText>
561
+ <OText
562
+ size={12}
563
+ lineHeight={18}
564
+ color={theme.colors.textNormal}
565
+ mBottom={2}>
566
+ {order?.customer?.cellphone}
567
+ </OText>
568
+ </InfoBlock>
569
+ </Customer>
570
+ {order?.driver && (
571
+ <>
572
+ {order?.driver?.location && parseInt(order?.status) === 9 && (
573
+ <Map>
574
+ <GoogleMap
575
+ location={order?.driver?.location}
576
+ locations={locations}
577
+ readOnly
578
+ />
579
+ </Map>
580
+ )}
581
+ </>
582
+ )}
583
+ </OrderCustomer>
584
+ {order?.driver && (
585
+ <>
586
+ <View
587
+ style={{
588
+ height: 8,
589
+ backgroundColor: theme.colors.backgroundGray100,
590
+ marginTop: 18,
591
+ marginHorizontal: -40,
592
+ }}
593
+ />
594
+ <OrderDriver>
595
+ <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
596
+ <Customer>
597
+ <InfoBlock>
598
+ <View
599
+ style={{
600
+ flexDirection: 'row',
601
+ alignItems: 'center',
602
+ justifyContent: 'space-between',
603
+ }}>
604
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
605
+ {order?.driver?.name} {order?.driver?.lastname}
606
+ </OText>
607
+ <Icons>
608
+ <TouchableOpacity
609
+ onPress={() => handleOpenMessagesForDriver()}>
610
+ <OIcon
611
+ src={theme.images.general.chat}
612
+ width={16}
613
+ color={theme.colors.disabled}
614
+ />
615
+ </TouchableOpacity>
616
+ </Icons>
617
+ </View>
618
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
619
+ {order?.driver?.cellphone}
620
+ </OText>
621
+ </InfoBlock>
622
+ </Customer>
623
+ </OrderDriver>
624
+ </>
625
+ )}
626
+ <View
627
+ style={{
628
+ height: 8,
629
+ backgroundColor: theme.colors.backgroundGray100,
630
+ marginTop: 18,
631
+ marginHorizontal: -40,
632
+ }}
633
+ />
634
+ <HeaderInfo>
635
+ <OText
636
+ size={24}
637
+ color={theme.colors.textNormal}
638
+ style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
639
+ {t(
640
+ 'YOUR_ORDER_HAS_BEEN_RECEIVED',
641
+ 'Your Order has been received',
642
+ )}
643
+ </OText>
644
+ <OText color={theme.colors.textNormal} size={14} weight={'500'}>
645
+ {t(
646
+ 'ORDER_MESSAGE_HEADER_TEXT',
647
+ 'Once business accepts your order, we will send you an email, thank you!',
648
+ )}
649
+ </OText>
650
+ <OButton
651
+ text={t('YOUR_ORDERS', 'Your Orders')}
652
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
653
+ imgRightSrc={null}
654
+ borderColor={theme.colors.primary}
655
+ bgColor={theme.colors.clear}
656
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
657
+ parentStyle={{ marginTop: 29, width: '50%' }}
658
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
659
+ />
660
+ </HeaderInfo>
661
+ <OrderProducts>
662
+ {order?.products?.length &&
663
+ order?.products.map((product: any, i: number) => (
664
+ <ProductItemAccordion
665
+ key={product?.id || i}
666
+ product={product}
667
+ isFromCheckout
668
+ />
669
+ ))}
670
+ </OrderProducts>
671
+ <OrderBill>
672
+ <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
673
+ <Table>
674
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
675
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
676
676
  {parsePrice(((order?.summary?.subtotal || order?.subtotal) + getIncludedTaxes()))}
677
- </OText>
678
- </Table>
679
- {(order?.summary?.discount > 0 || order?.discount > 0) && (
680
- <Table>
681
- {order?.offer_type === 1 ? (
682
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
683
- {t('DISCOUNT', 'Discount')}
684
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
685
- order?.offer_rate,
686
- parsePrice,
687
- )}%)`}</OText>
688
- </OText>
689
- ) : (
690
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
691
- )}
692
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
693
- - {parsePrice(order?.summary?.discount || order?.discount)}
694
- </OText>
695
- </Table>
696
- )}
697
- {
677
+ </OText>
678
+ </Table>
679
+ {(order?.summary?.discount > 0 || order?.discount > 0) && (
680
+ <Table>
681
+ {order?.offer_type === 1 ? (
682
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
683
+ {t('DISCOUNT', 'Discount')}
684
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
685
+ order?.offer_rate,
686
+ parsePrice,
687
+ )}%)`}</OText>
688
+ </OText>
689
+ ) : (
690
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
691
+ )}
692
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
693
+ - {parsePrice(order?.summary?.discount || order?.discount)}
694
+ </OText>
695
+ </Table>
696
+ )}
697
+ {
698
698
  order?.taxes?.length === 0 && order?.tax_type === 2 && (
699
699
  <Table>
700
700
  <OText size={12}>
@@ -732,72 +732,80 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
732
732
  ))
733
733
  }
734
734
  {
735
- order?.fees?.length > 0 && order?.fees?.filter((fee : any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
736
- <Table key={fee.id}>
737
- <OSRow>
738
- <OText size={12} numberOfLines={1}>
739
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
740
- ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
741
- </OText>
742
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })}>
743
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
744
- </TouchableOpacity>
745
- </OSRow>
746
- <OText size={12}>{parsePrice(fee?.fixed + fee?.summary?.percentage || 0)}</OText>
747
- </Table>
735
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
736
+ <Table key={fee.id}>
737
+ <OSRow>
738
+ <OText size={12} numberOfLines={1}>
739
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
740
+ ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
741
+ </OText>
742
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })}>
743
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
744
+ </TouchableOpacity>
745
+ </OSRow>
746
+ <OText size={12}>{parsePrice(fee?.fixed + fee?.summary?.percentage || 0)}</OText>
747
+ </Table>
748
748
  ))
749
749
  }
750
- {(order?.summary?.delivery_price > 0 ||
751
- order?.deliveryFee > 0) && (
752
- <Table>
753
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
754
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
755
- {parsePrice(
756
- order?.summary?.delivery_price || order?.deliveryFee,
757
- )}
758
- </OText>
759
- </Table>
760
- )}
761
- <Table>
762
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
763
- {t('DRIVER_TIP', 'Driver tip')}
764
- {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
765
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
766
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
767
- `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`}
768
- </OText>
769
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
770
- {parsePrice(
771
- order?.summary?.driver_tip || order?.totalDriverTip,
772
- )}
773
- </OText>
774
- </Table>
775
- <Total>
776
- <Table>
777
- <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
778
- <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>
779
- {parsePrice(order?.summary?.total || order?.total)}
780
- </OText>
781
- </Table>
782
- </Total>
783
- </OrderBill>
784
- </OrderContent>
785
- </>
786
- )}
787
- <OModal
788
- open={openModalForBusiness || openModalForDriver}
789
- entireModal
790
- customClose
791
- onClose={() => handleCloseModal()}>
792
- <Messages
793
- type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
794
- orderId={order?.id}
795
- messages={messages}
796
- order={order}
797
- setMessages={setMessages}
798
- onClose={handleCloseModal}
799
- />
800
- </OModal>
750
+ {(order?.summary?.delivery_price > 0 ||
751
+ order?.deliveryFee > 0) && (
752
+ <Table>
753
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
754
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
755
+ {parsePrice(
756
+ order?.summary?.delivery_price || order?.deliveryFee,
757
+ )}
758
+ </OText>
759
+ </Table>
760
+ )}
761
+ <Table>
762
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
763
+ {t('DRIVER_TIP', 'Driver tip')}
764
+ {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) &&
765
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
766
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
767
+ `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`}
768
+ </OText>
769
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
770
+ {parsePrice(
771
+ order?.summary?.driver_tip || order?.totalDriverTip,
772
+ )}
773
+ </OText>
774
+ </Table>
775
+ <Total>
776
+ <Table>
777
+ <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
778
+ <OText size={20} lineHeight={30} weight={'600'} color={theme.colors.textNormal}>
779
+ {parsePrice(order?.summary?.total || order?.total)}
780
+ </OText>
781
+ </Table>
782
+ </Total>
783
+ {order?.comment && (
784
+ <Table>
785
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
786
+ <OText style={{ maxWidth: '70%' }}>
787
+ {order?.comment}
788
+ </OText>
789
+ </Table>
790
+ )}
791
+ </OrderBill>
792
+ </OrderContent>
793
+ </>
794
+ )}
795
+ <OModal
796
+ open={openModalForBusiness || openModalForDriver}
797
+ entireModal
798
+ customClose
799
+ onClose={() => handleCloseModal()}>
800
+ <Messages
801
+ type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
802
+ orderId={order?.id}
803
+ messages={messages}
804
+ order={order}
805
+ setMessages={setMessages}
806
+ onClose={handleCloseModal}
807
+ />
808
+ </OModal>
801
809
  <OModal
802
810
  open={openTaxModal.open}
803
811
  onClose={() => setOpenTaxModal({ open: false, data: null })}
@@ -805,15 +813,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
805
813
  >
806
814
  <TaxInformation data={openTaxModal.data} products={order?.products} />
807
815
  </OModal>
808
- </OrderDetailsContainer>
809
- );
816
+ </OrderDetailsContainer>
817
+ );
810
818
  };
811
819
 
812
820
  export const OrderDetails = (props: OrderDetailsParams) => {
813
- const orderDetailsProps = {
814
- ...props,
815
- UIComponent: OrderDetailsUI,
816
- };
821
+ const orderDetailsProps = {
822
+ ...props,
823
+ UIComponent: OrderDetailsUI,
824
+ };
817
825
 
818
- return <OrderDetailsConTableoller {...orderDetailsProps} />;
826
+ return <OrderDetailsConTableoller {...orderDetailsProps} />;
819
827
  };