ordering-ui-react-native 0.10.3 → 0.11.3
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 +2 -1
- package/themes/business/index.tsx +12 -12
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +49 -43
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +4 -10
- package/themes/business/src/components/Chat/index.tsx +97 -60
- package/themes/business/src/components/DriverMap/index.tsx +196 -183
- package/themes/business/src/components/FloatingButton/index.tsx +61 -43
- package/themes/business/src/components/FloatingButton/styles.tsx +2 -5
- package/themes/business/src/components/GoogleMap/index.tsx +10 -8
- package/themes/business/src/components/Home/index.tsx +2 -5
- package/themes/business/src/components/Home/styles.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -3
- package/themes/business/src/components/MessagesOption/index.tsx +13 -18
- package/themes/business/src/components/MessagesOption/styles.tsx +3 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +642 -0
- package/themes/business/src/components/OrderDetails/Delivery.tsx +436 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +378 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +16 -74
- package/themes/business/src/components/OrderMessage/index.tsx +5 -2
- package/themes/business/src/components/OrdersOption/index.tsx +344 -302
- package/themes/business/src/components/OrdersOption/styles.tsx +4 -2
- package/themes/business/src/components/PreviousMessages/index.tsx +15 -8
- package/themes/business/src/components/PreviousOrders/index.tsx +86 -141
- package/themes/business/src/components/PreviousOrders/styles.tsx +4 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +73 -6
- package/themes/business/src/components/UserProfileForm/styles.tsx +0 -2
- package/themes/business/src/components/shared/OModal.tsx +9 -7
- package/themes/business/src/components/shared/OTextarea.tsx +2 -1
- package/themes/business/src/layouts/SafeAreaContainer.tsx +2 -2
- package/themes/business/src/types/index.tsx +24 -13
- package/themes/business/src/utils/index.tsx +160 -0
- package/themes/business/src/components/OrderDetails/index.tsx +0 -1262
- package/themes/business/src/components/OrderDetailsDelivery/index.tsx +0 -1056
- package/themes/business/src/components/OrderDetailsDelivery/styles.tsx +0 -142
|
@@ -1,1056 +0,0 @@
|
|
|
1
|
-
//React & React Native
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { StyleSheet, View, Platform } from 'react-native';
|
|
4
|
-
|
|
5
|
-
// Thirds
|
|
6
|
-
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
-
|
|
8
|
-
//OrderingComponent
|
|
9
|
-
import {
|
|
10
|
-
useLanguage,
|
|
11
|
-
OrderDetails as OrderDetailsConTableoller,
|
|
12
|
-
useUtils,
|
|
13
|
-
useConfig,
|
|
14
|
-
useToast,
|
|
15
|
-
useSession,
|
|
16
|
-
ToastType,
|
|
17
|
-
} from 'ordering-components/native';
|
|
18
|
-
|
|
19
|
-
//Components
|
|
20
|
-
import Alert from '../../providers/AlertProvider';
|
|
21
|
-
import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
|
|
22
|
-
import { Chat } from '../Chat';
|
|
23
|
-
import { FloatingButton } from '../FloatingButton';
|
|
24
|
-
import { DriverMap } from '../DriverMap';
|
|
25
|
-
import { OButton, OText, OIconButton, OLink } from '../shared';
|
|
26
|
-
import { OModal } from '../shared';
|
|
27
|
-
import { OrderDetailsParams } from '../../types';
|
|
28
|
-
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
29
|
-
import { USER_TYPE } from '../../config/constants';
|
|
30
|
-
import { useTheme } from 'styled-components/native';
|
|
31
|
-
import { verifyDecimals } from '../../utils';
|
|
32
|
-
import { NotFoundSource } from '../NotFoundSource';
|
|
33
|
-
|
|
34
|
-
//Styles
|
|
35
|
-
import {
|
|
36
|
-
Actions,
|
|
37
|
-
OrderDetailsContainer,
|
|
38
|
-
Header,
|
|
39
|
-
OrderContent,
|
|
40
|
-
OrderBusiness,
|
|
41
|
-
OrderCustomer,
|
|
42
|
-
OrderHeader,
|
|
43
|
-
OrderProducts,
|
|
44
|
-
Table,
|
|
45
|
-
OrderBill,
|
|
46
|
-
Total,
|
|
47
|
-
Pickup,
|
|
48
|
-
} from './styles';
|
|
49
|
-
|
|
50
|
-
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
51
|
-
const {
|
|
52
|
-
navigation,
|
|
53
|
-
messages,
|
|
54
|
-
setMessages,
|
|
55
|
-
readMessages,
|
|
56
|
-
messagesReadList,
|
|
57
|
-
handleChangeOrderStatus,
|
|
58
|
-
permissions,
|
|
59
|
-
askLocationPermission,
|
|
60
|
-
driverLocation,
|
|
61
|
-
actions,
|
|
62
|
-
updateDriverPosition,
|
|
63
|
-
driverUpdateLocation,
|
|
64
|
-
setDriverUpdateLocation,
|
|
65
|
-
titleAccept,
|
|
66
|
-
titleReject,
|
|
67
|
-
appTitle,
|
|
68
|
-
} = props;
|
|
69
|
-
|
|
70
|
-
const [, { showToast }] = useToast();
|
|
71
|
-
const { order, loading, error } = props.order;
|
|
72
|
-
const theme = useTheme();
|
|
73
|
-
const [, t] = useLanguage();
|
|
74
|
-
const [session] = useSession();
|
|
75
|
-
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
76
|
-
const [{ configs }] = useConfig();
|
|
77
|
-
const [actionOrder, setActionOrder] = useState('');
|
|
78
|
-
const [unreadAlert, setUnreadAlert] = useState({
|
|
79
|
-
business: false,
|
|
80
|
-
driver: false,
|
|
81
|
-
});
|
|
82
|
-
const [openModalForMapView, setOpenModalForMapView] = useState(false);
|
|
83
|
-
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
84
|
-
const [openModalForAccept, setOpenModalForAccept] = useState(false);
|
|
85
|
-
const [alertState, setAlertState] = useState<{
|
|
86
|
-
open: boolean;
|
|
87
|
-
content: Array<string>;
|
|
88
|
-
key?: string | null;
|
|
89
|
-
}>({ open: false, content: [], key: null });
|
|
90
|
-
|
|
91
|
-
const getOrderStatus = (s: string) => {
|
|
92
|
-
const status = parseInt(s);
|
|
93
|
-
const orderStatus = [
|
|
94
|
-
{
|
|
95
|
-
key: 0,
|
|
96
|
-
value: t('PENDING', 'Pending'),
|
|
97
|
-
slug: 'PENDING',
|
|
98
|
-
percentage: 0.25,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
key: 1,
|
|
102
|
-
value: t('COMPLETED', 'Completed'),
|
|
103
|
-
slug: 'COMPLETED',
|
|
104
|
-
percentage: 1,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
key: 2,
|
|
108
|
-
value: t('REJECTED', 'Rejected'),
|
|
109
|
-
slug: 'REJECTED',
|
|
110
|
-
percentage: 0,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
key: 3,
|
|
114
|
-
value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
|
|
115
|
-
slug: 'DRIVER_IN_BUSINESS',
|
|
116
|
-
percentage: 0.6,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
key: 4,
|
|
120
|
-
value: t('READY_FOR_PICKUP', 'Ready for pickup'),
|
|
121
|
-
slug: 'PREPARATION_COMPLETED',
|
|
122
|
-
percentage: 0.7,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
key: 5,
|
|
126
|
-
value: t('REJECTED', 'Rejected'),
|
|
127
|
-
slug: 'REJECTED_BY_BUSINESS',
|
|
128
|
-
percentage: 0,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
key: 6,
|
|
132
|
-
value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
|
|
133
|
-
slug: 'REJECTED_BY_DRIVER',
|
|
134
|
-
percentage: 0,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
key: 7,
|
|
138
|
-
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
139
|
-
slug: 'ACCEPTED_BY_BUSINESS',
|
|
140
|
-
percentage: 0.35,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
key: 8,
|
|
144
|
-
value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
|
|
145
|
-
slug: 'ACCEPTED_BY_DRIVER',
|
|
146
|
-
percentage: 0.45,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
key: 9,
|
|
150
|
-
value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
|
|
151
|
-
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
152
|
-
percentage: 0.8,
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: 10,
|
|
156
|
-
value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
|
|
157
|
-
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
158
|
-
percentage: 0,
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: 11,
|
|
162
|
-
value: t(
|
|
163
|
-
'DELIVERY_COMPLETED_BY_DRIVER',
|
|
164
|
-
'Delivery completed by driver',
|
|
165
|
-
),
|
|
166
|
-
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
167
|
-
percentage: 1,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
key: 12,
|
|
171
|
-
value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
|
|
172
|
-
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
173
|
-
percentage: 0,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
key: 13,
|
|
177
|
-
value: t('PREORDER', 'PreOrder'),
|
|
178
|
-
slug: 'PREORDER',
|
|
179
|
-
percentage: 0,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
key: 14,
|
|
183
|
-
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
184
|
-
slug: 'ORDER_NOT_READY',
|
|
185
|
-
percentage: 0,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
key: 15,
|
|
189
|
-
value: t(
|
|
190
|
-
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
191
|
-
'Order picked up completed by customer',
|
|
192
|
-
),
|
|
193
|
-
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
194
|
-
percentage: 100,
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
key: 16,
|
|
198
|
-
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
199
|
-
slug: 'CANCELLED_BY_CUSTOMER',
|
|
200
|
-
percentage: 0,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
key: 17,
|
|
204
|
-
value: t(
|
|
205
|
-
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
206
|
-
'Order not picked up by customer',
|
|
207
|
-
),
|
|
208
|
-
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
209
|
-
percentage: 0,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
key: 18,
|
|
213
|
-
value: t(
|
|
214
|
-
'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
215
|
-
'Driver almost arrived to business',
|
|
216
|
-
),
|
|
217
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
218
|
-
percentage: 0.15,
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
key: 19,
|
|
222
|
-
value: t(
|
|
223
|
-
'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
224
|
-
'Driver almost arrived to customer',
|
|
225
|
-
),
|
|
226
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
227
|
-
percentage: 0.9,
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
key: 20,
|
|
231
|
-
value: t(
|
|
232
|
-
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
233
|
-
'Customer almost arrived to business',
|
|
234
|
-
),
|
|
235
|
-
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
236
|
-
percentage: 90,
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
key: 21,
|
|
240
|
-
value: t(
|
|
241
|
-
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
242
|
-
'Customer arrived to business',
|
|
243
|
-
),
|
|
244
|
-
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
245
|
-
percentage: 95,
|
|
246
|
-
},
|
|
247
|
-
];
|
|
248
|
-
|
|
249
|
-
const objectStatus = orderStatus.find(o => o.key === status);
|
|
250
|
-
|
|
251
|
-
return objectStatus && objectStatus;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const showFloatButtonsPickUp: any = {
|
|
255
|
-
8: true,
|
|
256
|
-
3: true,
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const showFloatButtonsAcceptOrReject: any = {
|
|
260
|
-
0: true,
|
|
261
|
-
7: true,
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
const marginContainer: any = {
|
|
265
|
-
0: true,
|
|
266
|
-
3: true,
|
|
267
|
-
7: true,
|
|
268
|
-
8: true,
|
|
269
|
-
9: true,
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const handleOpenMessagesForBusiness = () => {
|
|
273
|
-
setOpenModalForBusiness(true);
|
|
274
|
-
readMessages && readMessages();
|
|
275
|
-
setUnreadAlert({ ...unreadAlert, business: false });
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
const handleOpenMapView = async () => {
|
|
279
|
-
if (permissions.locationStatus === 'granted') {
|
|
280
|
-
setOpenModalForMapView(!openModalForMapView);
|
|
281
|
-
} else if (permissions.locationStatus === 'blocked') {
|
|
282
|
-
// redirectToSettings();
|
|
283
|
-
showToast(
|
|
284
|
-
ToastType.Error,
|
|
285
|
-
t(
|
|
286
|
-
'GEOLOCATION_SERVICE_PERMISSION_BLOCKED',
|
|
287
|
-
'Geolocation service permissions blocked.',
|
|
288
|
-
),
|
|
289
|
-
);
|
|
290
|
-
} else {
|
|
291
|
-
const response = await askLocationPermission();
|
|
292
|
-
if (response === 'granted') {
|
|
293
|
-
setOpenModalForMapView(!openModalForMapView);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
const handleViewActionOrder = (action: string) => {
|
|
299
|
-
if (openModalForMapView) {
|
|
300
|
-
setOpenModalForMapView(false);
|
|
301
|
-
}
|
|
302
|
-
setActionOrder(action);
|
|
303
|
-
setOpenModalForAccept(true);
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
useEffect(() => {
|
|
307
|
-
if (permissions.locationStatus !== 'granted' && openModalForMapView) {
|
|
308
|
-
setOpenModalForMapView(false);
|
|
309
|
-
}
|
|
310
|
-
}, [permissions.locationStatus]);
|
|
311
|
-
|
|
312
|
-
useEffect(() => {
|
|
313
|
-
if (openModalForAccept) {
|
|
314
|
-
setOpenModalForAccept(false);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (openModalForBusiness) {
|
|
318
|
-
setOpenModalForBusiness(false);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (openModalForMapView) {
|
|
322
|
-
setOpenModalForMapView(false);
|
|
323
|
-
}
|
|
324
|
-
}, [loading]);
|
|
325
|
-
|
|
326
|
-
const handleCloseModal = () => {
|
|
327
|
-
setOpenModalForBusiness(false);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const colors: any = {
|
|
331
|
-
//BLUE
|
|
332
|
-
0: theme.colors.statusOrderBlue,
|
|
333
|
-
3: theme.colors.statusOrderBlue,
|
|
334
|
-
4: theme.colors.statusOrderBlue,
|
|
335
|
-
7: theme.colors.statusOrderBlue,
|
|
336
|
-
8: theme.colors.statusOrderBlue,
|
|
337
|
-
9: theme.colors.statusOrderBlue,
|
|
338
|
-
13: theme.colors.statusOrderBlue,
|
|
339
|
-
14: theme.colors.statusOrderBlue,
|
|
340
|
-
18: theme.colors.statusOrderBlue,
|
|
341
|
-
19: theme.colors.statusOrderBlue,
|
|
342
|
-
20: theme.colors.statusOrderBlue,
|
|
343
|
-
21: theme.colors.statusOrderBlue,
|
|
344
|
-
//GREEN
|
|
345
|
-
1: theme.colors.statusOrderGreen,
|
|
346
|
-
11: theme.colors.statusOrderGreen,
|
|
347
|
-
15: theme.colors.statusOrderGreen,
|
|
348
|
-
//RED
|
|
349
|
-
2: theme.colors.statusOrderRed,
|
|
350
|
-
5: theme.colors.statusOrderRed,
|
|
351
|
-
6: theme.colors.statusOrderRed,
|
|
352
|
-
10: theme.colors.statusOrderRed,
|
|
353
|
-
12: theme.colors.statusOrderRed,
|
|
354
|
-
16: theme.colors.statusOrderRed,
|
|
355
|
-
17: theme.colors.statusOrderRed,
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const handleArrowBack: any = () => {
|
|
359
|
-
navigation?.canGoBack() && navigation.goBack();
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
useEffect(() => {
|
|
363
|
-
if (order?.driver === null && session?.user?.level === 4) {
|
|
364
|
-
setAlertState({
|
|
365
|
-
open: true,
|
|
366
|
-
content: [
|
|
367
|
-
t(
|
|
368
|
-
'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
|
|
369
|
-
'You have been removed from the order',
|
|
370
|
-
),
|
|
371
|
-
],
|
|
372
|
-
key: null,
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}, [order?.driver]);
|
|
376
|
-
|
|
377
|
-
useEffect(() => {
|
|
378
|
-
if (messagesReadList?.length) {
|
|
379
|
-
openModalForBusiness
|
|
380
|
-
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
381
|
-
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
382
|
-
}
|
|
383
|
-
}, [messagesReadList]);
|
|
384
|
-
|
|
385
|
-
const locations = [
|
|
386
|
-
{
|
|
387
|
-
...order?.business?.location,
|
|
388
|
-
title: order?.business?.name,
|
|
389
|
-
icon: order?.business?.logo || theme.images.dummies.businessLogo,
|
|
390
|
-
type: 'Business',
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
...order?.customer?.location,
|
|
394
|
-
title: order?.customer?.name,
|
|
395
|
-
icon:
|
|
396
|
-
order?.customer?.photo ||
|
|
397
|
-
'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
|
|
398
|
-
type: 'Customer',
|
|
399
|
-
},
|
|
400
|
-
];
|
|
401
|
-
|
|
402
|
-
useEffect(() => {
|
|
403
|
-
if (driverLocation) {
|
|
404
|
-
locations[0] = driverLocation;
|
|
405
|
-
}
|
|
406
|
-
}, [driverLocation]);
|
|
407
|
-
|
|
408
|
-
const styles = StyleSheet.create({
|
|
409
|
-
rowDirection: {
|
|
410
|
-
flexDirection: 'row',
|
|
411
|
-
},
|
|
412
|
-
statusBar: {
|
|
413
|
-
height: 10,
|
|
414
|
-
},
|
|
415
|
-
logo: {
|
|
416
|
-
width: 75,
|
|
417
|
-
height: 75,
|
|
418
|
-
borderRadius: 10,
|
|
419
|
-
},
|
|
420
|
-
textBold: {
|
|
421
|
-
fontWeight: '600',
|
|
422
|
-
},
|
|
423
|
-
btnPickUp: {
|
|
424
|
-
borderWidth: 0,
|
|
425
|
-
backgroundColor: theme.colors.btnBGWhite,
|
|
426
|
-
borderRadius: 8,
|
|
427
|
-
},
|
|
428
|
-
btnBackArrow: {
|
|
429
|
-
borderWidth: 0,
|
|
430
|
-
backgroundColor: theme.colors.backgroundLight,
|
|
431
|
-
borderColor: theme.colors.primary,
|
|
432
|
-
shadowColor: theme.colors.primary,
|
|
433
|
-
alignItems: 'flex-start',
|
|
434
|
-
justifyContent: 'flex-start',
|
|
435
|
-
paddingLeft: 0,
|
|
436
|
-
height: 14,
|
|
437
|
-
},
|
|
438
|
-
icons: {
|
|
439
|
-
maxWidth: 40,
|
|
440
|
-
height: 25,
|
|
441
|
-
},
|
|
442
|
-
linkWithIcons: {
|
|
443
|
-
flexDirection: 'row',
|
|
444
|
-
alignItems: 'center',
|
|
445
|
-
justifyContent: 'space-between',
|
|
446
|
-
marginBottom: 5,
|
|
447
|
-
flex: 1,
|
|
448
|
-
},
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
let locationMarker;
|
|
452
|
-
let isToFollow = false;
|
|
453
|
-
let isBusinessMarker = false;
|
|
454
|
-
|
|
455
|
-
if (order?.status === 7 || order?.status === 8) {
|
|
456
|
-
const markerBusiness = 'Business';
|
|
457
|
-
isBusinessMarker = true;
|
|
458
|
-
locationMarker = locations.find(
|
|
459
|
-
(location: any) => location.type === markerBusiness,
|
|
460
|
-
);
|
|
461
|
-
|
|
462
|
-
if (order?.status === 8) {
|
|
463
|
-
isToFollow = true;
|
|
464
|
-
}
|
|
465
|
-
} else if (order?.status === 3 || order?.status === 9) {
|
|
466
|
-
const markerCustomer = 'Customer';
|
|
467
|
-
isToFollow = true;
|
|
468
|
-
isBusinessMarker = false;
|
|
469
|
-
locationMarker = locations.find(
|
|
470
|
-
(location: any) => location.type === markerCustomer,
|
|
471
|
-
);
|
|
472
|
-
} else {
|
|
473
|
-
const markerBusiness = 'Business';
|
|
474
|
-
locationMarker = locations.find(
|
|
475
|
-
(location: any) => location.type === markerBusiness,
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
return (
|
|
480
|
-
<>
|
|
481
|
-
{(!order || Object.keys(order).length === 0) &&
|
|
482
|
-
(error?.length < 1 || !error) && (
|
|
483
|
-
<View
|
|
484
|
-
style={{
|
|
485
|
-
padding: 20,
|
|
486
|
-
backgroundColor: theme.colors.backgroundLight,
|
|
487
|
-
}}>
|
|
488
|
-
{[...Array(6)].map((item, i) => (
|
|
489
|
-
<Placeholder key={i} Animation={Fade}>
|
|
490
|
-
<View style={{ flexDirection: 'row', marginBottom: 30 }}>
|
|
491
|
-
<Placeholder>
|
|
492
|
-
<PlaceholderLine width={90} />
|
|
493
|
-
<PlaceholderLine width={50} />
|
|
494
|
-
<PlaceholderLine width={20} />
|
|
495
|
-
<PlaceholderLine width={10} />
|
|
496
|
-
</Placeholder>
|
|
497
|
-
</View>
|
|
498
|
-
</Placeholder>
|
|
499
|
-
))}
|
|
500
|
-
</View>
|
|
501
|
-
)}
|
|
502
|
-
|
|
503
|
-
{(!!error || error) && (
|
|
504
|
-
<NotFoundSource
|
|
505
|
-
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
506
|
-
content={
|
|
507
|
-
props.order.error[0] ||
|
|
508
|
-
props.order.error ||
|
|
509
|
-
t('NETWORK_ERROR', 'Network Error')
|
|
510
|
-
}
|
|
511
|
-
onClickButton={() => navigation.navigate('Orders')}
|
|
512
|
-
/>
|
|
513
|
-
)}
|
|
514
|
-
{order && Object.keys(order).length > 0 && (error?.length < 1 || !error) && (
|
|
515
|
-
<>
|
|
516
|
-
<Header>
|
|
517
|
-
<OIconButton
|
|
518
|
-
icon={theme.images.general.arrow_left}
|
|
519
|
-
iconStyle={{ width: 20, height: 20 }}
|
|
520
|
-
borderColor={theme.colors.clear}
|
|
521
|
-
style={{ ...styles.icons, justifyContent: 'flex-end' }}
|
|
522
|
-
onClick={() => handleArrowBack()}
|
|
523
|
-
/>
|
|
524
|
-
|
|
525
|
-
<Actions>
|
|
526
|
-
<OIconButton
|
|
527
|
-
icon={theme.images.general.map}
|
|
528
|
-
iconStyle={{
|
|
529
|
-
width: 20,
|
|
530
|
-
height: 20,
|
|
531
|
-
tintColor: theme.colors.backArrow,
|
|
532
|
-
}}
|
|
533
|
-
borderColor={theme.colors.clear}
|
|
534
|
-
style={styles.icons}
|
|
535
|
-
onClick={() => handleOpenMapView()}
|
|
536
|
-
/>
|
|
537
|
-
|
|
538
|
-
<OIconButton
|
|
539
|
-
icon={theme.images.general.messages}
|
|
540
|
-
iconStyle={{
|
|
541
|
-
width: 20,
|
|
542
|
-
height: 20,
|
|
543
|
-
tintColor: theme.colors.backArrow,
|
|
544
|
-
}}
|
|
545
|
-
borderColor={theme.colors.clear}
|
|
546
|
-
style={styles.icons}
|
|
547
|
-
onClick={() => handleOpenMessagesForBusiness()}
|
|
548
|
-
/>
|
|
549
|
-
</Actions>
|
|
550
|
-
</Header>
|
|
551
|
-
<OrderHeader>
|
|
552
|
-
<OText size={13} style={{ marginBottom: 5 }}>
|
|
553
|
-
{order?.delivery_datetime_utc
|
|
554
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
555
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
556
|
-
</OText>
|
|
557
|
-
|
|
558
|
-
<OText numberOfLines={2} size={20} weight="600">
|
|
559
|
-
<>
|
|
560
|
-
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} ${t(
|
|
561
|
-
'IS',
|
|
562
|
-
'is',
|
|
563
|
-
)} `}
|
|
564
|
-
<OText
|
|
565
|
-
size={20}
|
|
566
|
-
weight="600"
|
|
567
|
-
color={colors[order?.status] || theme.colors.primary}>
|
|
568
|
-
{getOrderStatus(order?.status)?.value}
|
|
569
|
-
</OText>
|
|
570
|
-
</>
|
|
571
|
-
</OText>
|
|
572
|
-
<OText size={13}>
|
|
573
|
-
{`${order?.paymethod?.name} - ${
|
|
574
|
-
order.delivery_type === 1
|
|
575
|
-
? t('DELIVERY', 'Delivery')
|
|
576
|
-
: order.delivery_type === 2
|
|
577
|
-
? t('PICKUP', 'Pickup')
|
|
578
|
-
: order.delivery_type === 3
|
|
579
|
-
? t('EAT_IN', 'Eat in')
|
|
580
|
-
: order.delivery_type === 4
|
|
581
|
-
? t('CURBSIDE', 'Curbside')
|
|
582
|
-
: t('DRIVER_THRU', 'Driver thru')
|
|
583
|
-
}`}
|
|
584
|
-
</OText>
|
|
585
|
-
</OrderHeader>
|
|
586
|
-
<OrderDetailsContainer
|
|
587
|
-
style={{
|
|
588
|
-
marginBottom: marginContainer[order?.status] ? 60 : 0,
|
|
589
|
-
}}
|
|
590
|
-
keyboardShouldPersistTaps="handled">
|
|
591
|
-
<>
|
|
592
|
-
<OrderContent>
|
|
593
|
-
<OrderBusiness>
|
|
594
|
-
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
595
|
-
{t('BUSINESS_DETAILS', 'Business details')}
|
|
596
|
-
</OText>
|
|
597
|
-
|
|
598
|
-
<OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
|
|
599
|
-
{order?.business?.name}
|
|
600
|
-
</OText>
|
|
601
|
-
|
|
602
|
-
{!!order?.business?.email && (
|
|
603
|
-
<View style={styles.linkWithIcons}>
|
|
604
|
-
<OLink
|
|
605
|
-
PressStyle={styles.linkWithIcons}
|
|
606
|
-
url={`mailto:${order?.business?.email}`}
|
|
607
|
-
shorcut={order?.business?.email}
|
|
608
|
-
type="email"
|
|
609
|
-
/>
|
|
610
|
-
</View>
|
|
611
|
-
)}
|
|
612
|
-
|
|
613
|
-
{!!order?.business?.cellphone && (
|
|
614
|
-
<View style={styles.linkWithIcons}>
|
|
615
|
-
<OLink
|
|
616
|
-
PressStyle={styles.linkWithIcons}
|
|
617
|
-
url={`tel:${order?.business?.cellphone}`}
|
|
618
|
-
shorcut={`${order?.business?.cellphone}`}
|
|
619
|
-
type="telephone"
|
|
620
|
-
/>
|
|
621
|
-
</View>
|
|
622
|
-
)}
|
|
623
|
-
|
|
624
|
-
{!!order?.business?.phone && (
|
|
625
|
-
<View style={styles.linkWithIcons}>
|
|
626
|
-
<OLink
|
|
627
|
-
PressStyle={styles.linkWithIcons}
|
|
628
|
-
url={`tel:${order?.business?.phone}`}
|
|
629
|
-
shorcut={order?.business?.phone}
|
|
630
|
-
type="telephone"
|
|
631
|
-
/>
|
|
632
|
-
</View>
|
|
633
|
-
)}
|
|
634
|
-
|
|
635
|
-
{!!order?.business?.address && (
|
|
636
|
-
<View style={styles.linkWithIcons}>
|
|
637
|
-
<OLink
|
|
638
|
-
PressStyle={styles.linkWithIcons}
|
|
639
|
-
url={Platform.select({
|
|
640
|
-
ios: `maps:0,0?q=${order?.business?.address}`,
|
|
641
|
-
android: `geo:0,0?q=${order?.business?.address}`,
|
|
642
|
-
})}
|
|
643
|
-
shorcut={order?.business?.address}
|
|
644
|
-
type="location"
|
|
645
|
-
/>
|
|
646
|
-
</View>
|
|
647
|
-
)}
|
|
648
|
-
</OrderBusiness>
|
|
649
|
-
|
|
650
|
-
<OrderCustomer>
|
|
651
|
-
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
652
|
-
{t('CUSTOMER_DETAILS', 'Customer details')}
|
|
653
|
-
</OText>
|
|
654
|
-
|
|
655
|
-
<View style={{ flexDirection: 'row' }}>
|
|
656
|
-
<OText
|
|
657
|
-
numberOfLines={1}
|
|
658
|
-
mBottom={4}
|
|
659
|
-
ellipsizeMode="tail"
|
|
660
|
-
space>
|
|
661
|
-
{order?.customer?.name}
|
|
662
|
-
</OText>
|
|
663
|
-
|
|
664
|
-
<OText
|
|
665
|
-
numberOfLines={1}
|
|
666
|
-
mBottom={4}
|
|
667
|
-
ellipsizeMode="tail"
|
|
668
|
-
space>
|
|
669
|
-
{order?.customer?.middle_name}
|
|
670
|
-
</OText>
|
|
671
|
-
|
|
672
|
-
<OText
|
|
673
|
-
numberOfLines={1}
|
|
674
|
-
mBottom={4}
|
|
675
|
-
ellipsizeMode="tail"
|
|
676
|
-
space>
|
|
677
|
-
{order?.customer?.lastname}
|
|
678
|
-
</OText>
|
|
679
|
-
|
|
680
|
-
<OText
|
|
681
|
-
numberOfLines={1}
|
|
682
|
-
mBottom={4}
|
|
683
|
-
ellipsizeMode="tail"
|
|
684
|
-
space>
|
|
685
|
-
{order?.customer?.second_lastname}
|
|
686
|
-
</OText>
|
|
687
|
-
</View>
|
|
688
|
-
|
|
689
|
-
{!!order?.customer?.email && (
|
|
690
|
-
<View style={styles.linkWithIcons}>
|
|
691
|
-
<OLink
|
|
692
|
-
PressStyle={styles.linkWithIcons}
|
|
693
|
-
url={`mailto:${order?.customer?.email}`}
|
|
694
|
-
shorcut={order?.customer?.email}
|
|
695
|
-
type="email"
|
|
696
|
-
/>
|
|
697
|
-
</View>
|
|
698
|
-
)}
|
|
699
|
-
|
|
700
|
-
{!!order?.customer?.cellphone && (
|
|
701
|
-
<View style={styles.linkWithIcons}>
|
|
702
|
-
<OLink
|
|
703
|
-
PressStyle={styles.linkWithIcons}
|
|
704
|
-
url={`tel:${order?.customer?.cellphone}`}
|
|
705
|
-
shorcut={order?.customer?.cellphone}
|
|
706
|
-
type="telephone"
|
|
707
|
-
/>
|
|
708
|
-
</View>
|
|
709
|
-
)}
|
|
710
|
-
{!!order?.customer?.phone && (
|
|
711
|
-
<View style={styles.linkWithIcons}>
|
|
712
|
-
<OLink
|
|
713
|
-
PressStyle={styles.linkWithIcons}
|
|
714
|
-
url={`tel:${order?.customer?.phone}`}
|
|
715
|
-
shorcut={order?.customer?.phone}
|
|
716
|
-
type="telephone"
|
|
717
|
-
/>
|
|
718
|
-
</View>
|
|
719
|
-
)}
|
|
720
|
-
|
|
721
|
-
{!!order?.customer?.address && (
|
|
722
|
-
<View style={styles.linkWithIcons}>
|
|
723
|
-
<OLink
|
|
724
|
-
PressStyle={styles.linkWithIcons}
|
|
725
|
-
url={Platform.select({
|
|
726
|
-
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
727
|
-
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
728
|
-
})}
|
|
729
|
-
shorcut={order?.customer?.address}
|
|
730
|
-
type="location"
|
|
731
|
-
/>
|
|
732
|
-
</View>
|
|
733
|
-
)}
|
|
734
|
-
|
|
735
|
-
{!!order?.customer?.internal_number && (
|
|
736
|
-
<OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
|
|
737
|
-
{order?.customer?.internal_number}
|
|
738
|
-
</OText>
|
|
739
|
-
)}
|
|
740
|
-
|
|
741
|
-
{!!order?.customer?.address_notes && (
|
|
742
|
-
<OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
|
|
743
|
-
{order?.customer?.address_notes}
|
|
744
|
-
</OText>
|
|
745
|
-
)}
|
|
746
|
-
|
|
747
|
-
{!!order?.customer.zipcode && (
|
|
748
|
-
<OText numberOfLines={1} mBottom={4} ellipsizeMode="tail">
|
|
749
|
-
{order?.customer?.zipcode}
|
|
750
|
-
</OText>
|
|
751
|
-
)}
|
|
752
|
-
</OrderCustomer>
|
|
753
|
-
|
|
754
|
-
<OrderProducts>
|
|
755
|
-
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
756
|
-
{t('ORDER_DETAILS', 'Order Details')}
|
|
757
|
-
</OText>
|
|
758
|
-
|
|
759
|
-
{order?.products?.length &&
|
|
760
|
-
order?.products.map((product: any, i: number) => (
|
|
761
|
-
<ProductItemAccordion
|
|
762
|
-
key={product?.id || i}
|
|
763
|
-
product={product}
|
|
764
|
-
/>
|
|
765
|
-
))}
|
|
766
|
-
</OrderProducts>
|
|
767
|
-
|
|
768
|
-
<OrderBill>
|
|
769
|
-
<Table>
|
|
770
|
-
<OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
771
|
-
|
|
772
|
-
<OText mBottom={4}>
|
|
773
|
-
{order.tax_type === 1
|
|
774
|
-
? parsePrice(
|
|
775
|
-
(order?.summary?.subtotal || order?.subtotal) +
|
|
776
|
-
(order?.summary?.tax || order?.tax) || 0,
|
|
777
|
-
)
|
|
778
|
-
: parsePrice(
|
|
779
|
-
order?.summary?.subtotal || order?.subtotal || 0,
|
|
780
|
-
)}
|
|
781
|
-
</OText>
|
|
782
|
-
</Table>
|
|
783
|
-
|
|
784
|
-
{order?.tax_type !== 1 && (
|
|
785
|
-
<Table>
|
|
786
|
-
<OText mBottom={4}>
|
|
787
|
-
{t('TAX', 'Tax')}
|
|
788
|
-
{`(${verifyDecimals(order?.tax, parseNumber)}%)`}
|
|
789
|
-
</OText>
|
|
790
|
-
|
|
791
|
-
<OText mBottom={4}>
|
|
792
|
-
{parsePrice(order?.summary?.tax || order?.totalTax)}
|
|
793
|
-
</OText>
|
|
794
|
-
</Table>
|
|
795
|
-
)}
|
|
796
|
-
|
|
797
|
-
{(order?.summary?.discount > 0 || order?.discount > 0) && (
|
|
798
|
-
<Table>
|
|
799
|
-
{order?.offer_type === 1 ? (
|
|
800
|
-
<OText mBottom={4}>
|
|
801
|
-
<OText>{t('DISCOUNT', 'Discount')}</OText>
|
|
802
|
-
|
|
803
|
-
<OText>
|
|
804
|
-
{`(${verifyDecimals(
|
|
805
|
-
order?.offer_rate,
|
|
806
|
-
parsePrice,
|
|
807
|
-
)}%)`}
|
|
808
|
-
</OText>
|
|
809
|
-
</OText>
|
|
810
|
-
) : (
|
|
811
|
-
<OText mBottom={4}>{t('DISCOUNT', 'Discount')}</OText>
|
|
812
|
-
)}
|
|
813
|
-
|
|
814
|
-
<OText mBottom={4}>
|
|
815
|
-
-{' '}
|
|
816
|
-
{parsePrice(
|
|
817
|
-
order?.summary?.discount || order?.discount,
|
|
818
|
-
)}
|
|
819
|
-
</OText>
|
|
820
|
-
</Table>
|
|
821
|
-
)}
|
|
822
|
-
|
|
823
|
-
{order?.summary?.subtotal_with_discount > 0 &&
|
|
824
|
-
order?.summary?.discount > 0 &&
|
|
825
|
-
order?.summary?.total >= 0 && (
|
|
826
|
-
<Table>
|
|
827
|
-
<OText mBottom={4}>
|
|
828
|
-
{t(
|
|
829
|
-
'SUBTOTAL_WITH_DISCOUNT',
|
|
830
|
-
'Subtotal with discount',
|
|
831
|
-
)}
|
|
832
|
-
</OText>
|
|
833
|
-
{order?.tax_type === 1 ? (
|
|
834
|
-
<OText mBottom={4}>
|
|
835
|
-
{parsePrice(
|
|
836
|
-
order?.summary?.subtotal_with_discount +
|
|
837
|
-
(order?.summary?.tax || order?.tax) || 0,
|
|
838
|
-
)}
|
|
839
|
-
</OText>
|
|
840
|
-
) : (
|
|
841
|
-
<OText mBottom={4}>
|
|
842
|
-
{parsePrice(
|
|
843
|
-
order?.summary?.subtotal_with_discount || 0,
|
|
844
|
-
)}
|
|
845
|
-
</OText>
|
|
846
|
-
)}
|
|
847
|
-
</Table>
|
|
848
|
-
)}
|
|
849
|
-
|
|
850
|
-
{(order?.summary?.delivery_price > 0 ||
|
|
851
|
-
order?.deliveryFee > 0) && (
|
|
852
|
-
<Table>
|
|
853
|
-
<OText mBottom={4}>
|
|
854
|
-
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
855
|
-
</OText>
|
|
856
|
-
|
|
857
|
-
<OText mBottom={4}>
|
|
858
|
-
{parsePrice(
|
|
859
|
-
order?.summary?.delivery_price || order?.deliveryFee,
|
|
860
|
-
)}
|
|
861
|
-
</OText>
|
|
862
|
-
</Table>
|
|
863
|
-
)}
|
|
864
|
-
|
|
865
|
-
<Table>
|
|
866
|
-
<OText mBottom={4}>
|
|
867
|
-
{t('DRIVER_TIP', 'Driver tip')}
|
|
868
|
-
{(order?.summary?.driver_tip > 0 ||
|
|
869
|
-
order?.driver_tip > 0) &&
|
|
870
|
-
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
871
|
-
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
872
|
-
`(${verifyDecimals(order?.driver_tip, parseNumber)}%)`}
|
|
873
|
-
</OText>
|
|
874
|
-
|
|
875
|
-
<OText mBottom={4}>
|
|
876
|
-
{parsePrice(
|
|
877
|
-
order?.summary?.driver_tip || order?.totalDriverTip,
|
|
878
|
-
)}
|
|
879
|
-
</OText>
|
|
880
|
-
</Table>
|
|
881
|
-
|
|
882
|
-
<Table>
|
|
883
|
-
<OText mBottom={4}>
|
|
884
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
885
|
-
{`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
|
|
886
|
-
</OText>
|
|
887
|
-
|
|
888
|
-
<OText mBottom={4}>
|
|
889
|
-
{parsePrice(
|
|
890
|
-
order?.summary?.service_fee || order?.serviceFee || 0,
|
|
891
|
-
)}
|
|
892
|
-
</OText>
|
|
893
|
-
</Table>
|
|
894
|
-
|
|
895
|
-
<Total>
|
|
896
|
-
<Table>
|
|
897
|
-
<OText mBottom={4} style={styles.textBold}>
|
|
898
|
-
{t('TOTAL', 'Total')}
|
|
899
|
-
</OText>
|
|
900
|
-
|
|
901
|
-
<OText
|
|
902
|
-
mBottom={4}
|
|
903
|
-
style={styles.textBold}
|
|
904
|
-
color={theme.colors.primary}>
|
|
905
|
-
{parsePrice(order?.summary?.total || order?.total)}
|
|
906
|
-
</OText>
|
|
907
|
-
</Table>
|
|
908
|
-
</Total>
|
|
909
|
-
</OrderBill>
|
|
910
|
-
</OrderContent>
|
|
911
|
-
|
|
912
|
-
{order?.status === 8 && order?.delivery_type === 1 && (
|
|
913
|
-
<Pickup>
|
|
914
|
-
<OButton
|
|
915
|
-
style={styles.btnPickUp}
|
|
916
|
-
textStyle={{ color: theme.colors.primary }}
|
|
917
|
-
text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
|
|
918
|
-
onClick={() =>
|
|
919
|
-
handleChangeOrderStatus && handleChangeOrderStatus(3)
|
|
920
|
-
}
|
|
921
|
-
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
922
|
-
/>
|
|
923
|
-
</Pickup>
|
|
924
|
-
)}
|
|
925
|
-
</>
|
|
926
|
-
|
|
927
|
-
<OModal
|
|
928
|
-
open={openModalForBusiness}
|
|
929
|
-
order={order}
|
|
930
|
-
title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
|
|
931
|
-
entireModal
|
|
932
|
-
onClose={() => handleCloseModal()}>
|
|
933
|
-
<Chat
|
|
934
|
-
type={
|
|
935
|
-
openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
|
|
936
|
-
}
|
|
937
|
-
orderId={order?.id}
|
|
938
|
-
messages={messages}
|
|
939
|
-
order={order}
|
|
940
|
-
setMessages={setMessages}
|
|
941
|
-
/>
|
|
942
|
-
</OModal>
|
|
943
|
-
|
|
944
|
-
<OModal
|
|
945
|
-
open={openModalForAccept}
|
|
946
|
-
onClose={() => setOpenModalForAccept(false)}
|
|
947
|
-
entireModal
|
|
948
|
-
customClose>
|
|
949
|
-
<AcceptOrRejectOrder
|
|
950
|
-
handleUpdateOrder={handleChangeOrderStatus}
|
|
951
|
-
closeModal={setOpenModalForAccept}
|
|
952
|
-
customerCellphone={order?.customer?.cellphone}
|
|
953
|
-
loading={loading}
|
|
954
|
-
action={actionOrder}
|
|
955
|
-
orderId={order?.id}
|
|
956
|
-
notShowCustomerPhone
|
|
957
|
-
actions={actions}
|
|
958
|
-
titleAccept={titleAccept}
|
|
959
|
-
titleReject={titleReject}
|
|
960
|
-
appTitle={appTitle}
|
|
961
|
-
/>
|
|
962
|
-
</OModal>
|
|
963
|
-
|
|
964
|
-
<OModal
|
|
965
|
-
open={openModalForMapView}
|
|
966
|
-
onClose={() => handleOpenMapView()}
|
|
967
|
-
entireModal
|
|
968
|
-
customClose>
|
|
969
|
-
<DriverMap
|
|
970
|
-
navigation={navigation}
|
|
971
|
-
order={order}
|
|
972
|
-
orderStatus={getOrderStatus(order?.status)?.value || ''}
|
|
973
|
-
location={locationMarker}
|
|
974
|
-
readOnly
|
|
975
|
-
updateDriverPosition={updateDriverPosition}
|
|
976
|
-
driverUpdateLocation={driverUpdateLocation}
|
|
977
|
-
setDriverUpdateLocation={setDriverUpdateLocation}
|
|
978
|
-
handleViewActionOrder={handleViewActionOrder}
|
|
979
|
-
isBusinessMarker={isBusinessMarker}
|
|
980
|
-
isToFollow={isToFollow}
|
|
981
|
-
showAcceptOrReject={
|
|
982
|
-
showFloatButtonsAcceptOrReject[order?.status]
|
|
983
|
-
}
|
|
984
|
-
handleOpenMapView={handleOpenMapView}
|
|
985
|
-
/>
|
|
986
|
-
</OModal>
|
|
987
|
-
|
|
988
|
-
<View style={{ height: 30 }} />
|
|
989
|
-
</OrderDetailsContainer>
|
|
990
|
-
|
|
991
|
-
{showFloatButtonsPickUp[order?.status] && (
|
|
992
|
-
<FloatingButton
|
|
993
|
-
disabled={loading}
|
|
994
|
-
btnText={t('FAILED', 'Failed')}
|
|
995
|
-
isSecondaryBtn={false}
|
|
996
|
-
secondButtonClick={() =>
|
|
997
|
-
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
998
|
-
}
|
|
999
|
-
firstButtonClick={() =>
|
|
1000
|
-
handleChangeOrderStatus && handleChangeOrderStatus(12)
|
|
1001
|
-
}
|
|
1002
|
-
secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
1003
|
-
secondButton={true}
|
|
1004
|
-
firstColorCustom={theme.colors.red}
|
|
1005
|
-
secondColorCustom={theme.colors.green}
|
|
1006
|
-
/>
|
|
1007
|
-
)}
|
|
1008
|
-
{order?.status === 9 && (
|
|
1009
|
-
<FloatingButton
|
|
1010
|
-
disabled={loading}
|
|
1011
|
-
btnText={t('FAILED', 'Failed')}
|
|
1012
|
-
isSecondaryBtn={false}
|
|
1013
|
-
secondButtonClick={() =>
|
|
1014
|
-
handleChangeOrderStatus && handleChangeOrderStatus(11)
|
|
1015
|
-
}
|
|
1016
|
-
firstButtonClick={() =>
|
|
1017
|
-
handleChangeOrderStatus && handleChangeOrderStatus(12)
|
|
1018
|
-
}
|
|
1019
|
-
secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
1020
|
-
secondButton={true}
|
|
1021
|
-
firstColorCustom={theme.colors.red}
|
|
1022
|
-
secondColorCustom={theme.colors.green}
|
|
1023
|
-
/>
|
|
1024
|
-
)}
|
|
1025
|
-
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
1026
|
-
<FloatingButton
|
|
1027
|
-
btnText={t('REJECT', 'Reject')}
|
|
1028
|
-
isSecondaryBtn={false}
|
|
1029
|
-
secondButtonClick={() => handleViewActionOrder('accept')}
|
|
1030
|
-
firstButtonClick={() => handleViewActionOrder('reject')}
|
|
1031
|
-
secondBtnText={t('ACCEPT', 'Accept')}
|
|
1032
|
-
secondButton={true}
|
|
1033
|
-
firstColorCustom={theme.colors.red}
|
|
1034
|
-
secondColorCustom={theme.colors.green}
|
|
1035
|
-
/>
|
|
1036
|
-
)}
|
|
1037
|
-
<Alert
|
|
1038
|
-
open={alertState.open}
|
|
1039
|
-
onAccept={handleArrowBack}
|
|
1040
|
-
onClose={handleArrowBack}
|
|
1041
|
-
content={alertState.content}
|
|
1042
|
-
title={t('ERROR', 'Error')}
|
|
1043
|
-
/>
|
|
1044
|
-
</>
|
|
1045
|
-
)}
|
|
1046
|
-
</>
|
|
1047
|
-
);
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
export const OrderDetailsDelivery = (props: OrderDetailsParams) => {
|
|
1051
|
-
const orderDetailsProps = {
|
|
1052
|
-
...props,
|
|
1053
|
-
UIComponent: OrderDetailsUI,
|
|
1054
|
-
};
|
|
1055
|
-
return <OrderDetailsConTableoller {...orderDetailsProps} />;
|
|
1056
|
-
};
|