ordering-ui-react-native 0.12.51 → 0.12.55
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/themes/business/src/components/GoogleMap/index.tsx +78 -4
- package/themes/business/src/components/OrderDetails/Business.tsx +11 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -101
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +57 -48
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +7 -7
- package/themes/business/src/components/OrderDetails/styles.tsx +11 -2
- package/themes/business/src/components/OrdersOption/index.tsx +5 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +41 -26
- package/themes/single-business/src/components/Cart/index.tsx +1 -1
- package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
- package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
- package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
- package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
- package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { Dimensions, StyleSheet, View, SafeAreaView } from 'react-native';
|
|
3
|
-
import MapView, { PROVIDER_GOOGLE, Marker, Region } from 'react-native-maps';
|
|
3
|
+
import MapView, { PROVIDER_GOOGLE, Marker, Region, Callout } from 'react-native-maps';
|
|
4
4
|
import Geocoder from 'react-native-geocoding';
|
|
5
5
|
import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
|
|
6
6
|
import { GoogleMapsParams } from '../../types';
|
|
7
7
|
import Alert from '../../providers/AlertProvider';
|
|
8
|
-
import { OIconButton, OIcon } from '../shared';
|
|
8
|
+
import { OIconButton, OIcon, OText, OButton } from '../shared';
|
|
9
9
|
import { FloatingButton } from '../FloatingButton';
|
|
10
10
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
|
+
import { useLocation } from '../../hooks/useLocation';
|
|
14
|
+
import { showLocation } from 'react-native-map-link';
|
|
13
15
|
|
|
14
16
|
export const GoogleMap = (props: GoogleMapsParams) => {
|
|
15
17
|
const {
|
|
@@ -30,6 +32,15 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
30
32
|
navigation,
|
|
31
33
|
} = props;
|
|
32
34
|
|
|
35
|
+
const {
|
|
36
|
+
hasLocation,
|
|
37
|
+
initialPosition,
|
|
38
|
+
followUserLocation,
|
|
39
|
+
getCurrentLocation,
|
|
40
|
+
userLocation,
|
|
41
|
+
stopFollowUserLocation,
|
|
42
|
+
} = useLocation();
|
|
43
|
+
|
|
33
44
|
const { top } = useSafeAreaInsets();
|
|
34
45
|
const theme = useTheme();
|
|
35
46
|
const [, t] = useLanguage();
|
|
@@ -64,7 +75,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
64
75
|
ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to',
|
|
65
76
|
};
|
|
66
77
|
|
|
67
|
-
|
|
78
|
+
let MARKERS =
|
|
68
79
|
locations &&
|
|
69
80
|
locations.map((location: { lat: number; lng: number; level: number }) => {
|
|
70
81
|
return location.level === 4 && driverLocation?.lat
|
|
@@ -221,6 +232,18 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
221
232
|
fitAllMarkers();
|
|
222
233
|
}
|
|
223
234
|
}, [isMapReady]);
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
if (!locations) return
|
|
237
|
+
MARKERS = locations.map((location: { lat: number; lng: number; level: number }) => {
|
|
238
|
+
return location.level === 4 && driverLocation?.lat
|
|
239
|
+
? {
|
|
240
|
+
latitude: driverLocation?.lat,
|
|
241
|
+
longitude: driverLocation?.lng,
|
|
242
|
+
}
|
|
243
|
+
: { latitude: location.lat, longitude: location.lng };
|
|
244
|
+
})
|
|
245
|
+
fitAllMarkers();
|
|
246
|
+
}, [driverLocation])
|
|
224
247
|
|
|
225
248
|
const styles = StyleSheet.create({
|
|
226
249
|
map: {
|
|
@@ -279,7 +302,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
279
302
|
i: number,
|
|
280
303
|
) => (
|
|
281
304
|
<React.Fragment key={i}>
|
|
282
|
-
<Marker
|
|
305
|
+
<Marker
|
|
306
|
+
coordinate={location}
|
|
307
|
+
onPress={() => {
|
|
308
|
+
mapRef.current?.animateCamera({
|
|
309
|
+
center: { latitude: location.latitude, longitude:location.longitude },
|
|
310
|
+
})}}
|
|
311
|
+
>
|
|
283
312
|
<Icon
|
|
284
313
|
name="map-marker"
|
|
285
314
|
size={50}
|
|
@@ -296,6 +325,51 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
296
325
|
height={25}
|
|
297
326
|
/>
|
|
298
327
|
</View>
|
|
328
|
+
<Callout
|
|
329
|
+
onPress={() => {
|
|
330
|
+
showLocation({
|
|
331
|
+
latitude: location.latitude,
|
|
332
|
+
longitude: location.longitude,
|
|
333
|
+
sourceLatitude: userLocation.latitude,
|
|
334
|
+
sourceLongitude: userLocation.longitude,
|
|
335
|
+
naverCallerName: 'com.businessapp',
|
|
336
|
+
dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
|
|
337
|
+
dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
|
|
338
|
+
cancelText: t('CANCEL', 'Cancel'),
|
|
339
|
+
})
|
|
340
|
+
}}
|
|
341
|
+
>
|
|
342
|
+
<View style={{flex: 1,width: 250, paddingRight: 10, paddingLeft: 10, justifyContent:'space-between' }}>
|
|
343
|
+
<View style={{flex: 1, marginBottom: 20}}>
|
|
344
|
+
<OText size={16} weight={'bold'} style={{paddingTop: 10, marginBottom: 10}}>{locations[i]?.title}</OText>
|
|
345
|
+
{ locations[i]?.address && (
|
|
346
|
+
<>
|
|
347
|
+
<OText size={16} >{locations[i]?.address.addressName}</OText>
|
|
348
|
+
<OText size={16} >{locations[i]?.address.zipcode}</OText>
|
|
349
|
+
</>
|
|
350
|
+
)}
|
|
351
|
+
</View>
|
|
352
|
+
<OButton
|
|
353
|
+
text={t('GO_TO_THIS_LOCATION', 'Go to this location')}
|
|
354
|
+
imgRightSrc={null}
|
|
355
|
+
textStyle={{
|
|
356
|
+
color: theme.colors.white,
|
|
357
|
+
fontFamily: 'Poppins',
|
|
358
|
+
fontStyle: 'normal',
|
|
359
|
+
fontWeight: 'normal',
|
|
360
|
+
fontSize: 16
|
|
361
|
+
}}
|
|
362
|
+
style={{
|
|
363
|
+
alignContent:'center',
|
|
364
|
+
borderRadius: 10,
|
|
365
|
+
height: 35,
|
|
366
|
+
bottom:10
|
|
367
|
+
}}
|
|
368
|
+
bgColor={theme.colors.primary}
|
|
369
|
+
borderColor={theme.colors.primary}
|
|
370
|
+
/>
|
|
371
|
+
</View>
|
|
372
|
+
</Callout>
|
|
299
373
|
</Marker>
|
|
300
374
|
</React.Fragment>
|
|
301
375
|
),
|
|
@@ -319,10 +319,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
319
319
|
}
|
|
320
320
|
}, [messagesReadList]);
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
let locations = [
|
|
323
323
|
{
|
|
324
324
|
...order?.driver?.location,
|
|
325
|
-
title: t('DRIVER', 'Driver'),
|
|
325
|
+
title: order?.driver?.name ?? t('DRIVER', 'Driver'),
|
|
326
326
|
icon:
|
|
327
327
|
order?.driver?.photo ||
|
|
328
328
|
'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
|
|
@@ -331,12 +331,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
331
331
|
{
|
|
332
332
|
...order?.business?.location,
|
|
333
333
|
title: order?.business?.name,
|
|
334
|
+
address: {
|
|
335
|
+
addressName: order?.business?.address,
|
|
336
|
+
zipcode: order?.business?.zipcode
|
|
337
|
+
},
|
|
334
338
|
icon: order?.business?.logo || theme.images.dummies.businessLogo,
|
|
335
339
|
level: 2,
|
|
336
340
|
},
|
|
337
341
|
{
|
|
338
342
|
...order?.customer?.location,
|
|
339
|
-
title: t('CUSTOMER', 'Customer'),
|
|
343
|
+
title: order?.customer?.name ?? t('CUSTOMER', 'Customer'),
|
|
344
|
+
address: {
|
|
345
|
+
addressName: order?.customer?.address,
|
|
346
|
+
zipcode: order?.customer?.zipcode
|
|
347
|
+
},
|
|
340
348
|
icon:
|
|
341
349
|
order?.customer?.photo ||
|
|
342
350
|
'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//React & React Native
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { StyleSheet, View, Platform } from 'react-native';
|
|
3
|
+
import { StyleSheet, View, Platform, ScrollView } from 'react-native';
|
|
4
4
|
|
|
5
5
|
// Thirds
|
|
6
6
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
@@ -50,9 +50,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
50
50
|
setDriverUpdateLocation,
|
|
51
51
|
orderTitle,
|
|
52
52
|
appTitle,
|
|
53
|
-
handleClickLogisticOrder
|
|
54
|
-
} = props;
|
|
53
|
+
handleClickLogisticOrder,
|
|
55
54
|
|
|
55
|
+
} = props;
|
|
56
56
|
const [, { showToast }] = useToast();
|
|
57
57
|
const { order } = props.order
|
|
58
58
|
const theme = useTheme();
|
|
@@ -141,6 +141,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
141
141
|
handleArrowBack()
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
const handleAcceptLogisticOrder = (order : any) => {
|
|
145
|
+
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
146
|
+
if(order?.order_group){
|
|
147
|
+
handleArrowBack()
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
144
151
|
const locations = [
|
|
145
152
|
{
|
|
146
153
|
...order?.business?.location,
|
|
@@ -243,107 +250,54 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
243
250
|
);
|
|
244
251
|
}
|
|
245
252
|
|
|
246
|
-
const OrderDetailsInformation = (
|
|
247
|
-
const {
|
|
253
|
+
const OrderDetailsInformation = (props : {order: any, isOrderGroup?: boolean, lastOrder?: boolean}) => {
|
|
254
|
+
const {
|
|
255
|
+
order,
|
|
256
|
+
isOrderGroup,
|
|
257
|
+
lastOrder,
|
|
258
|
+
} = props
|
|
248
259
|
return (
|
|
249
260
|
<>
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
<OrderContentComponent
|
|
262
|
+
order={order}
|
|
263
|
+
logisticOrderStatus={logisticOrderStatus}
|
|
264
|
+
isOrderGroup={isOrderGroup}
|
|
265
|
+
lastOrder={lastOrder}
|
|
266
|
+
/>
|
|
267
|
+
{(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
|
|
268
|
+
<Pickup>
|
|
269
|
+
<OButton
|
|
270
|
+
style={styles.btnPickUp}
|
|
271
|
+
textStyle={{ color: theme.colors.primary }}
|
|
272
|
+
text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
|
|
273
|
+
onClick={() =>
|
|
274
|
+
handleChangeOrderStatus && handleChangeOrderStatus(3)
|
|
275
|
+
}
|
|
276
|
+
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
259
277
|
/>
|
|
260
|
-
|
|
261
|
-
<Pickup>
|
|
262
|
-
<OButton
|
|
263
|
-
style={styles.btnPickUp}
|
|
264
|
-
textStyle={{ color: theme.colors.primary }}
|
|
265
|
-
text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
|
|
266
|
-
onClick={() =>
|
|
267
|
-
handleChangeOrderStatus && handleChangeOrderStatus(3)
|
|
268
|
-
}
|
|
269
|
-
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
270
|
-
/>
|
|
271
|
-
</Pickup>
|
|
272
|
-
)}
|
|
273
|
-
{order?.status === 3 && order?.delivery_type === 1 && (
|
|
274
|
-
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
275
|
-
<OButton
|
|
276
|
-
style={styles.btnPickUp}
|
|
277
|
-
textStyle={{ color: theme.colors.white }}
|
|
278
|
-
text={t('ORDER_NOT_READY', 'Order not ready')}
|
|
279
|
-
onClick={() =>
|
|
280
|
-
handleViewActionOrder && handleViewActionOrder('notReady')
|
|
281
|
-
}
|
|
282
|
-
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
283
|
-
bgColor={theme.colors.red}
|
|
284
|
-
/>
|
|
285
|
-
</View>
|
|
286
|
-
)}
|
|
287
|
-
</>
|
|
288
|
-
<View
|
|
289
|
-
style={{
|
|
290
|
-
height:
|
|
291
|
-
order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
|
|
292
|
-
}}
|
|
293
|
-
/>
|
|
294
|
-
</OrderDetailsContainer>
|
|
295
|
-
|
|
296
|
-
{showFloatButtonsPickUp[order?.status] && (
|
|
297
|
-
<FloatingButton
|
|
298
|
-
disabled={props.order?.loading}
|
|
299
|
-
btnText={t('PICKUP_FAILED', 'Pickup failed')}
|
|
300
|
-
isSecondaryBtn={false}
|
|
301
|
-
secondButtonClick={() =>
|
|
302
|
-
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
303
|
-
}
|
|
304
|
-
firstButtonClick={() =>
|
|
305
|
-
handleViewActionOrder && handleViewActionOrder('pickupFailed')
|
|
306
|
-
}
|
|
307
|
-
secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
308
|
-
secondButton={true}
|
|
309
|
-
firstColorCustom={theme.colors.red}
|
|
310
|
-
secondColorCustom={theme.colors.green}
|
|
311
|
-
widthButton={'45%'}
|
|
312
|
-
/>
|
|
278
|
+
</Pickup>
|
|
313
279
|
)}
|
|
314
|
-
{
|
|
315
|
-
|
|
316
|
-
<
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
280
|
+
{order?.status === 3 && order?.delivery_type === 1 && (
|
|
281
|
+
<View style={{ paddingVertical: 20, marginBottom: 20 }}>
|
|
282
|
+
<OButton
|
|
283
|
+
style={styles.btnPickUp}
|
|
284
|
+
textStyle={{ color: theme.colors.white }}
|
|
285
|
+
text={t('ORDER_NOT_READY', 'Order not ready')}
|
|
286
|
+
onClick={() =>
|
|
287
|
+
handleViewActionOrder && handleViewActionOrder('notReady')
|
|
322
288
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
327
|
-
secondButton={true}
|
|
328
|
-
firstColorCustom={theme.colors.red}
|
|
329
|
-
secondColorCustom={theme.colors.green}
|
|
330
|
-
widthButton={'45%'}
|
|
289
|
+
imgLeftStyle={{ tintColor: theme.colors.backArrow }}
|
|
290
|
+
bgColor={theme.colors.red}
|
|
331
291
|
/>
|
|
332
|
-
|
|
333
|
-
)}
|
|
334
|
-
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
335
|
-
<FloatingButton
|
|
336
|
-
btnText={t('REJECT', 'Reject')}
|
|
337
|
-
isSecondaryBtn={false}
|
|
338
|
-
secondButtonClick={() => order?.isLogistic && logisticOrderStatus.includes(order?.status) ? handleClickLogisticOrder?.(1, order?.logistic_order_id) : handleViewActionOrder('accept')}
|
|
339
|
-
firstButtonClick={() => order?.isLogistic && logisticOrderStatus.includes(order?.status) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
|
|
340
|
-
secondBtnText={t('ACCEPT', 'Accept')}
|
|
341
|
-
secondButton={true}
|
|
342
|
-
firstColorCustom={theme.colors.red}
|
|
343
|
-
secondColorCustom={theme.colors.green}
|
|
344
|
-
widthButton={'45%'}
|
|
345
|
-
/>
|
|
292
|
+
</View>
|
|
346
293
|
)}
|
|
294
|
+
<View
|
|
295
|
+
style={{
|
|
296
|
+
height:
|
|
297
|
+
order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
|
|
298
|
+
}}
|
|
299
|
+
/>
|
|
300
|
+
|
|
347
301
|
</>
|
|
348
302
|
)
|
|
349
303
|
}
|
|
@@ -390,10 +344,66 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
390
344
|
/>
|
|
391
345
|
{order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
|
|
392
346
|
<>
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
347
|
+
<OrderDetailsContainer
|
|
348
|
+
keyboardShouldPersistTaps="handled"
|
|
349
|
+
showsVerticalScrollIndicator={false}
|
|
350
|
+
>
|
|
351
|
+
{order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
|
|
352
|
+
<OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
|
|
353
|
+
)) : (
|
|
354
|
+
<OrderDetailsInformation order={order} />
|
|
355
|
+
)}
|
|
356
|
+
</OrderDetailsContainer>
|
|
357
|
+
{showFloatButtonsPickUp[order?.status] && (
|
|
358
|
+
<FloatingButton
|
|
359
|
+
disabled={props.order?.loading}
|
|
360
|
+
btnText={t('PICKUP_FAILED', 'Pickup failed')}
|
|
361
|
+
isSecondaryBtn={false}
|
|
362
|
+
secondButtonClick={() =>
|
|
363
|
+
handleChangeOrderStatus && handleChangeOrderStatus(9)
|
|
364
|
+
}
|
|
365
|
+
firstButtonClick={() =>
|
|
366
|
+
handleViewActionOrder && handleViewActionOrder('pickupFailed')
|
|
367
|
+
}
|
|
368
|
+
secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
369
|
+
secondButton={true}
|
|
370
|
+
firstColorCustom={theme.colors.red}
|
|
371
|
+
secondColorCustom={theme.colors.green}
|
|
372
|
+
widthButton={'45%'}
|
|
373
|
+
/>
|
|
374
|
+
)}
|
|
375
|
+
{(order?.status === 9 || order?.status === 19) && (
|
|
376
|
+
<>
|
|
377
|
+
<FloatingButton
|
|
378
|
+
disabled={props.order?.loading}
|
|
379
|
+
btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
380
|
+
isSecondaryBtn={false}
|
|
381
|
+
secondButtonClick={() =>
|
|
382
|
+
handleChangeOrderStatus && handleChangeOrderStatus(11)
|
|
383
|
+
}
|
|
384
|
+
firstButtonClick={() =>
|
|
385
|
+
handleViewActionOrder && handleViewActionOrder('deliveryFailed')
|
|
386
|
+
}
|
|
387
|
+
secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
388
|
+
secondButton={true}
|
|
389
|
+
firstColorCustom={theme.colors.red}
|
|
390
|
+
secondColorCustom={theme.colors.green}
|
|
391
|
+
widthButton={'45%'}
|
|
392
|
+
/>
|
|
393
|
+
</>
|
|
394
|
+
)}
|
|
395
|
+
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
396
|
+
<FloatingButton
|
|
397
|
+
btnText={t('REJECT', 'Reject')}
|
|
398
|
+
isSecondaryBtn={false}
|
|
399
|
+
secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
|
|
400
|
+
firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
|
|
401
|
+
secondBtnText={t('ACCEPT', 'Accept')}
|
|
402
|
+
secondButton={true}
|
|
403
|
+
firstColorCustom={theme.colors.red}
|
|
404
|
+
secondColorCustom={theme.colors.green}
|
|
405
|
+
widthButton={'45%'}
|
|
406
|
+
/>
|
|
397
407
|
)}
|
|
398
408
|
</>
|
|
399
409
|
)}
|
|
@@ -27,18 +27,19 @@ import { ReviewCustomer } from '../ReviewCustomer'
|
|
|
27
27
|
|
|
28
28
|
interface OrderContent {
|
|
29
29
|
order: any,
|
|
30
|
-
logisticOrderStatus?: Array<number
|
|
30
|
+
logisticOrderStatus?: Array<number>,
|
|
31
|
+
isOrderGroup?: boolean,
|
|
32
|
+
lastOrder?: boolean
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
34
36
|
const [, t] = useLanguage();
|
|
35
37
|
const theme = useTheme()
|
|
36
38
|
|
|
37
|
-
const { order, logisticOrderStatus } = props;
|
|
39
|
+
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
38
40
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
39
41
|
const [{ configs }] = useConfig();
|
|
40
42
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
41
|
-
const [isCustomerReviewed, setIsCustomerReviewed] = useState(false)
|
|
42
43
|
|
|
43
44
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
44
45
|
|
|
@@ -63,13 +64,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
63
64
|
}
|
|
64
65
|
})
|
|
65
66
|
|
|
66
|
-
const handleSuccessReviewed = () => {
|
|
67
|
-
setOpenReviewModal(false)
|
|
68
|
-
setIsCustomerReviewed(true)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
67
|
return (
|
|
72
|
-
<OrderContent>
|
|
68
|
+
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
69
|
+
{isOrderGroup && (
|
|
70
|
+
<OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
|
|
71
|
+
)}
|
|
73
72
|
<OrderBusiness>
|
|
74
73
|
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
75
74
|
{t('BUSINESS_DETAILS', 'Business details')}
|
|
@@ -148,42 +147,52 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
148
147
|
<OText style={{ marginBottom: 5 }} size={16} weight="600">
|
|
149
148
|
{t('CUSTOMER_DETAILS', 'Customer details')}
|
|
150
149
|
</OText>
|
|
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
|
-
|
|
150
|
+
{
|
|
151
|
+
(order?.customer?.name || order?.customer?.lastname) && (
|
|
152
|
+
<View style={{ flexDirection: 'row' }}>
|
|
153
|
+
<OText numberOfLines={2} mBottom={4}>
|
|
154
|
+
{order?.customer?.name && (
|
|
155
|
+
<OText
|
|
156
|
+
numberOfLines={1}
|
|
157
|
+
mBottom={4}
|
|
158
|
+
ellipsizeMode="tail"
|
|
159
|
+
space>
|
|
160
|
+
{order?.customer?.name}
|
|
161
|
+
</OText>
|
|
162
|
+
)}
|
|
163
|
+
{order?.customer?.middle_name && (
|
|
164
|
+
<OText
|
|
165
|
+
numberOfLines={1}
|
|
166
|
+
mBottom={4}
|
|
167
|
+
ellipsizeMode="tail"
|
|
168
|
+
space>
|
|
169
|
+
{order?.customer?.middle_name}
|
|
170
|
+
</OText>
|
|
171
|
+
)}
|
|
172
|
+
{order?.customer?.lastname && (
|
|
173
|
+
<OText
|
|
174
|
+
numberOfLines={1}
|
|
175
|
+
mBottom={4}
|
|
176
|
+
ellipsizeMode="tail"
|
|
177
|
+
space>
|
|
178
|
+
{order?.customer?.lastname}
|
|
179
|
+
</OText>
|
|
180
|
+
)}
|
|
181
|
+
{
|
|
182
|
+
order?.customer?.second_lastname && (
|
|
183
|
+
<OText
|
|
184
|
+
numberOfLines={1}
|
|
185
|
+
mBottom={4}
|
|
186
|
+
ellipsizeMode="tail"
|
|
187
|
+
space>
|
|
188
|
+
{order?.customer?.second_lastname}
|
|
189
|
+
</OText>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
</OText>
|
|
193
|
+
</View>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
187
196
|
|
|
188
197
|
{!!order?.customer?.email && (
|
|
189
198
|
<View style={styles.linkWithIcons}>
|
|
@@ -250,7 +259,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
250
259
|
{order?.customer?.zipcode}
|
|
251
260
|
</OText>
|
|
252
261
|
)}
|
|
253
|
-
{
|
|
262
|
+
{!order?.user_review && pastOrderStatuses.includes(order?.status) && (
|
|
254
263
|
<OButton
|
|
255
264
|
style={styles.btnReview}
|
|
256
265
|
textStyle={{ color: theme.colors.white }}
|
|
@@ -258,7 +267,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
258
267
|
imgRightSrc={false}
|
|
259
268
|
onClick={() => setOpenReviewModal(true)}
|
|
260
269
|
/>
|
|
261
|
-
)}
|
|
270
|
+
)}
|
|
262
271
|
</OrderCustomer>
|
|
263
272
|
|
|
264
273
|
<OrderProducts>
|
|
@@ -430,7 +439,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
430
439
|
<ReviewCustomer
|
|
431
440
|
order={order}
|
|
432
441
|
closeModal={() => setOpenReviewModal(false)}
|
|
433
|
-
onClose={() =>
|
|
442
|
+
onClose={() => setOpenReviewModal(false)}
|
|
434
443
|
/>
|
|
435
444
|
</OModal>
|
|
436
445
|
</OrderContent>
|
|
@@ -28,8 +28,8 @@ interface OrderHeader {
|
|
|
28
28
|
handleOpenMessagesForBusiness?: any,
|
|
29
29
|
getOrderStatus?: any,
|
|
30
30
|
logisticOrderStatus?: Array<number>,
|
|
31
|
-
handleViewSummaryOrder
|
|
32
|
-
handleCopyClipboard
|
|
31
|
+
handleViewSummaryOrder?: any;
|
|
32
|
+
handleCopyClipboard?: any
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
@@ -96,7 +96,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
96
96
|
/>
|
|
97
97
|
|
|
98
98
|
{
|
|
99
|
-
(!order?.isLogistic || !logisticOrderStatus?.includes(order?.status)) && (
|
|
99
|
+
(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
|
|
100
100
|
<Actions>
|
|
101
101
|
{getOrderStatus(order?.status, t)?.value !==
|
|
102
102
|
t('PENDING', 'Pending') && (
|
|
@@ -111,7 +111,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
111
111
|
}}
|
|
112
112
|
borderColor={theme.colors.clear}
|
|
113
113
|
style={styles.icons}
|
|
114
|
-
onClick={() => handleCopyClipboard()}
|
|
114
|
+
onClick={() => handleCopyClipboard?.()}
|
|
115
115
|
/>
|
|
116
116
|
<OIconButton
|
|
117
117
|
icon={theme.images.general.print}
|
|
@@ -122,7 +122,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
122
122
|
}}
|
|
123
123
|
borderColor={theme.colors.clear}
|
|
124
124
|
style={styles.icons}
|
|
125
|
-
onClick={() => handleViewSummaryOrder()}
|
|
125
|
+
onClick={() => handleViewSummaryOrder?.()}
|
|
126
126
|
/>
|
|
127
127
|
</>
|
|
128
128
|
)}
|
|
@@ -162,7 +162,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
162
162
|
<OText numberOfLines={2} size={20} weight="600">
|
|
163
163
|
<>
|
|
164
164
|
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id} `}
|
|
165
|
-
{
|
|
165
|
+
{!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
|
|
166
166
|
<>
|
|
167
167
|
{t('IS', 'is')}{' '}
|
|
168
168
|
<OText
|
|
@@ -175,7 +175,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
175
175
|
)}
|
|
176
176
|
</>
|
|
177
177
|
</OText>
|
|
178
|
-
{
|
|
178
|
+
{!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
|
|
179
179
|
<OText size={13}>
|
|
180
180
|
{`${order?.paymethod?.name} - ${order.delivery_type === 1
|
|
181
181
|
? t('DELIVERY', 'Delivery')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const OrderDetailsContainer = styled.ScrollView`
|
|
4
4
|
flex: 1;
|
|
@@ -25,6 +25,15 @@ export const Logo = styled.View`
|
|
|
25
25
|
|
|
26
26
|
export const OrderContent = styled.View`
|
|
27
27
|
flex: 1;
|
|
28
|
+
${(props : any) => props.isOrderGroup && css`
|
|
29
|
+
border-color: rgba(0, 0, 0, 0.2);
|
|
30
|
+
border-width: 1px;
|
|
31
|
+
padding: 10px;
|
|
32
|
+
`
|
|
33
|
+
}
|
|
34
|
+
${(props : any) => props.lastOrder && css`
|
|
35
|
+
margin-bottom: 50px;
|
|
36
|
+
`}
|
|
28
37
|
`;
|
|
29
38
|
|
|
30
39
|
export const OrderHeader = styled.View`
|
|
@@ -45,7 +54,7 @@ export const OrderBusiness = styled.View`
|
|
|
45
54
|
export const OrderCustomer = styled.View`
|
|
46
55
|
border-bottom-width: 10px;
|
|
47
56
|
border-bottom-color: ${(props: any) => props.theme.colors.inputChat};
|
|
48
|
-
padding-vertical:
|
|
57
|
+
padding-vertical: 10px;
|
|
49
58
|
`;
|
|
50
59
|
|
|
51
60
|
export const OrderProducts = styled(OrderCustomer)``;
|