ordering-ui-react-native 0.15.16 → 0.15.17-release
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 +5 -3
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessTypeFilter/index.tsx +12 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/LanguageSelector/index.tsx +1 -0
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +1 -9
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +54 -49
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- package/themes/business/src/types/index.tsx +2 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +179 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +49 -58
- package/themes/original/src/components/Cart/index.tsx +58 -21
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +57 -33
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/index.tsx +73 -2
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +49 -44
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +119 -127
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +35 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +25 -33
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +40 -35
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/TaxInformation/index.tsx +17 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
- package/themes/original/src/components/UserProfile/index.tsx +70 -20
- package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +75 -8
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +79 -25
- package/themes/original/src/utils/index.tsx +12 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -168
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, BackHandler,
|
|
3
|
-
import Spinner from 'react-native-loading-spinner-overlay';
|
|
2
|
+
import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
|
|
4
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
5
|
-
import { Messages } from '../Messages';
|
|
6
4
|
import {
|
|
7
5
|
useLanguage,
|
|
8
6
|
OrderDetails as OrderDetailsConTableoller,
|
|
9
7
|
useUtils,
|
|
10
|
-
useConfig
|
|
11
|
-
useSession,
|
|
8
|
+
useConfig
|
|
12
9
|
} from 'ordering-components/native';
|
|
13
10
|
import { useTheme } from 'styled-components/native';
|
|
14
11
|
import {
|
|
@@ -16,14 +13,10 @@ import {
|
|
|
16
13
|
Header,
|
|
17
14
|
OrderContent,
|
|
18
15
|
OrderBusiness,
|
|
19
|
-
Logo,
|
|
20
16
|
OrderData,
|
|
21
17
|
OrderInfo,
|
|
22
|
-
OrderStatus,
|
|
23
18
|
StaturBar,
|
|
24
|
-
StatusImage,
|
|
25
19
|
OrderCustomer,
|
|
26
|
-
CustomerPhoto,
|
|
27
20
|
InfoBlock,
|
|
28
21
|
HeaderInfo,
|
|
29
22
|
Customer,
|
|
@@ -31,33 +24,34 @@ import {
|
|
|
31
24
|
Table,
|
|
32
25
|
OrderBill,
|
|
33
26
|
Total,
|
|
34
|
-
NavBack,
|
|
35
27
|
Icons,
|
|
36
28
|
OrderDriver,
|
|
37
29
|
Map,
|
|
38
30
|
Divider,
|
|
31
|
+
OrderAction
|
|
39
32
|
} from './styles';
|
|
40
33
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
41
34
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
42
35
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
43
36
|
import { OrderDetailsParams } from '../../types';
|
|
44
|
-
import { USER_TYPE } from '../../config/constants';
|
|
45
37
|
import { GoogleMap } from '../GoogleMap';
|
|
46
38
|
import { verifyDecimals } from '../../utils';
|
|
47
39
|
import { OSRow } from '../OrderSummary/styles';
|
|
48
40
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
49
41
|
import { TaxInformation } from '../TaxInformation';
|
|
50
42
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
51
|
-
|
|
43
|
+
import NavBar from '../NavBar'
|
|
52
44
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
53
45
|
const {
|
|
54
46
|
navigation,
|
|
55
47
|
messages,
|
|
56
48
|
setMessages,
|
|
57
49
|
readMessages,
|
|
58
|
-
messagesReadList,
|
|
59
50
|
isFromCheckout,
|
|
60
51
|
driverLocation,
|
|
52
|
+
onNavigationRedirect,
|
|
53
|
+
reorderState,
|
|
54
|
+
handleReorder
|
|
61
55
|
} = props;
|
|
62
56
|
|
|
63
57
|
const theme = useTheme();
|
|
@@ -86,25 +80,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
86
80
|
justifyContent: 'flex-start',
|
|
87
81
|
paddingLeft: 0,
|
|
88
82
|
height: 30,
|
|
89
|
-
width:
|
|
83
|
+
width: 30,
|
|
84
|
+
marginTop: Platform.OS === 'ios' ? 0 : 30
|
|
90
85
|
},
|
|
91
86
|
});
|
|
92
87
|
|
|
93
88
|
const [, t] = useLanguage();
|
|
94
89
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
95
|
-
const [{ user }] = useSession();
|
|
96
90
|
const [{ configs }] = useConfig();
|
|
97
|
-
|
|
98
|
-
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
99
|
-
const [openModalForDriver, setOpenModalForDriver] = useState(false);
|
|
100
91
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
101
|
-
const [unreadAlert, setUnreadAlert] = useState({
|
|
102
|
-
business: false,
|
|
103
|
-
driver: false,
|
|
104
|
-
});
|
|
105
92
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
106
93
|
|
|
107
94
|
const { order, businessData } = props.order;
|
|
95
|
+
const mapValidStatuses = [9, 19, 23]
|
|
108
96
|
|
|
109
97
|
const walletName: any = {
|
|
110
98
|
cash: {
|
|
@@ -293,18 +281,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
293
281
|
percentage: 95,
|
|
294
282
|
image: theme.images.order.status7,
|
|
295
283
|
},
|
|
296
|
-
{
|
|
297
|
-
key: 22,
|
|
298
|
-
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
299
|
-
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
300
|
-
percentage: 35,
|
|
301
|
-
image: theme.images.order.status8
|
|
284
|
+
{
|
|
285
|
+
key: 22,
|
|
286
|
+
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
287
|
+
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
288
|
+
percentage: 35,
|
|
289
|
+
image: theme.images.order.status8
|
|
302
290
|
},
|
|
303
|
-
{
|
|
304
|
-
key: 23,
|
|
305
|
-
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
306
|
-
slug: 'ORDER_DRIVER_ON_WAY',
|
|
307
|
-
percentage: 45,
|
|
291
|
+
{
|
|
292
|
+
key: 23,
|
|
293
|
+
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
294
|
+
slug: 'ORDER_DRIVER_ON_WAY',
|
|
295
|
+
percentage: 45,
|
|
308
296
|
image: theme.images.order.status8
|
|
309
297
|
}
|
|
310
298
|
];
|
|
@@ -314,38 +302,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
314
302
|
return objectStatus && objectStatus;
|
|
315
303
|
};
|
|
316
304
|
|
|
317
|
-
const
|
|
318
|
-
setOpenModalForBusiness(true);
|
|
305
|
+
const handleGoToMessages = (type: string) => {
|
|
319
306
|
readMessages && readMessages();
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
const business = unreadedMessages.some((message: any) =>
|
|
337
|
-
message?.can_see?.includes(2),
|
|
338
|
-
);
|
|
339
|
-
const driver = unreadedMessages.some((message: any) =>
|
|
340
|
-
message?.can_see?.includes(4),
|
|
341
|
-
);
|
|
342
|
-
setUnreadAlert({ business, driver });
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
const handleCloseModal = () => {
|
|
346
|
-
setOpenModalForBusiness(false);
|
|
347
|
-
setOpenModalForDriver(false);
|
|
348
|
-
};
|
|
307
|
+
navigation.navigate(
|
|
308
|
+
'MessageDetails',
|
|
309
|
+
{
|
|
310
|
+
type,
|
|
311
|
+
order,
|
|
312
|
+
messages,
|
|
313
|
+
setMessages,
|
|
314
|
+
orderId: order?.id,
|
|
315
|
+
business: type === 'business',
|
|
316
|
+
driver: type === 'driver',
|
|
317
|
+
onClose: () => navigation?.canGoBack()
|
|
318
|
+
? navigation.goBack()
|
|
319
|
+
: navigation.navigate('BottomTab', { screen: 'MyOrders' }),
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
}
|
|
349
323
|
|
|
350
324
|
const handleArrowBack: any = () => {
|
|
351
325
|
if (!isFromCheckout) {
|
|
@@ -387,6 +361,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
387
361
|
)
|
|
388
362
|
}
|
|
389
363
|
|
|
364
|
+
const RenderGoogleMap = () => {
|
|
365
|
+
const driverLocationString = typeof order?.driver?.location?.location === 'string' && order?.driver?.location?.location?.split(',').map((l: string) => l.replace(/[^-.0-9]/g, ''))
|
|
366
|
+
const parsedLocations = locations.map(location => typeof location?.location === 'string' ? {
|
|
367
|
+
...location,
|
|
368
|
+
lat: parseFloat(location?.location?.split(',')[0].replace(/[^-.0-9]/g, '')),
|
|
369
|
+
lng: parseFloat(location?.location?.split(',')[1].replace(/[^-.0-9]/g, ''))
|
|
370
|
+
} : location)
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<GoogleMap
|
|
374
|
+
location={typeof order?.driver?.location?.location === 'string'
|
|
375
|
+
? {
|
|
376
|
+
lat: parseFloat(driverLocationString[0]),
|
|
377
|
+
lng: parseFloat(driverLocationString[1]),
|
|
378
|
+
} : order?.driver?.location
|
|
379
|
+
}
|
|
380
|
+
locations={parsedLocations}
|
|
381
|
+
readOnly
|
|
382
|
+
/>
|
|
383
|
+
)
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
useEffect(() => {
|
|
387
|
+
if (reorderState?.error) {
|
|
388
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
389
|
+
}
|
|
390
|
+
if (!reorderState?.error && reorderState?.result?.uuid) {
|
|
391
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
392
|
+
}
|
|
393
|
+
}, [reorderState])
|
|
394
|
+
|
|
390
395
|
useEffect(() => {
|
|
391
396
|
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
392
397
|
return () => {
|
|
@@ -394,14 +399,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
394
399
|
};
|
|
395
400
|
}, []);
|
|
396
401
|
|
|
397
|
-
useEffect(() => {
|
|
398
|
-
if (messagesReadList?.length) {
|
|
399
|
-
openModalForBusiness
|
|
400
|
-
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
401
|
-
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
402
|
-
}
|
|
403
|
-
}, [messagesReadList]);
|
|
404
|
-
|
|
405
402
|
const locations = [
|
|
406
403
|
{
|
|
407
404
|
...order?.driver?.location,
|
|
@@ -430,10 +427,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
430
427
|
}
|
|
431
428
|
}, [driverLocation]);
|
|
432
429
|
|
|
433
|
-
useEffect(() => {
|
|
434
|
-
console.log('order: ', order)
|
|
435
|
-
}, [order]);
|
|
436
|
-
|
|
437
430
|
return (
|
|
438
431
|
<OrderDetailsContainer keyboardShouldPersistTaps="handled">
|
|
439
432
|
{(!order || Object.keys(order).length === 0) && (
|
|
@@ -481,7 +474,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
481
474
|
<PlaceholderLine width={65} height={10} />
|
|
482
475
|
<PlaceholderLine width={80} height={10} />
|
|
483
476
|
<PlaceholderLine width={70} height={10} />
|
|
484
|
-
<View style={{marginTop: 10}}>
|
|
477
|
+
<View style={{ marginTop: 10 }}>
|
|
485
478
|
<PlaceholderLine width={60} height={20} />
|
|
486
479
|
<PlaceholderLine width={40} height={10} />
|
|
487
480
|
</View>
|
|
@@ -491,27 +484,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
491
484
|
{order && Object.keys(order).length > 0 && (
|
|
492
485
|
<>
|
|
493
486
|
<Header>
|
|
494
|
-
<
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
487
|
+
<NavBar
|
|
488
|
+
title={`${t('ORDER', 'Order')} #${order?.id}`}
|
|
489
|
+
titleAlign={'center'}
|
|
490
|
+
onActionLeft={handleArrowBack}
|
|
491
|
+
showCall={false}
|
|
492
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
493
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start', marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
494
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
495
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
496
|
+
subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
497
|
+
{order?.delivery_datetime_utc
|
|
498
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
499
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
500
|
+
</OText>}
|
|
500
501
|
/>
|
|
501
502
|
<OrderInfo>
|
|
502
503
|
<OrderData>
|
|
503
|
-
<OText
|
|
504
|
-
size={20}
|
|
505
|
-
lineHeight={30}
|
|
506
|
-
weight={'600'}
|
|
507
|
-
color={theme.colors.textNormal}>
|
|
508
|
-
{t('ORDER', 'Order')} #{order?.id}
|
|
509
|
-
</OText>
|
|
510
|
-
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
511
|
-
{order?.delivery_datetime_utc
|
|
512
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
513
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
514
|
-
</OText>
|
|
515
504
|
{
|
|
516
505
|
(
|
|
517
506
|
parseInt(order?.status) === 1 ||
|
|
@@ -610,7 +599,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
610
599
|
)}
|
|
611
600
|
<TouchableOpacity
|
|
612
601
|
style={{ paddingStart: 5 }}
|
|
613
|
-
onPress={() =>
|
|
602
|
+
onPress={() => handleGoToMessages('business')}>
|
|
614
603
|
<OIcon
|
|
615
604
|
src={theme.images.general.chat}
|
|
616
605
|
width={16}
|
|
@@ -702,7 +691,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
702
691
|
)}
|
|
703
692
|
{order?.driver && (
|
|
704
693
|
<>
|
|
705
|
-
{order?.driver?.location && parseInt(order?.status)
|
|
694
|
+
{order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
|
|
706
695
|
<Map>
|
|
707
696
|
<GoogleMap
|
|
708
697
|
location={order?.driver?.location}
|
|
@@ -739,7 +728,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
739
728
|
</OText>
|
|
740
729
|
<Icons>
|
|
741
730
|
<TouchableOpacity
|
|
742
|
-
onPress={() =>
|
|
731
|
+
onPress={() => handleGoToMessages('driver')}>
|
|
743
732
|
<OIcon
|
|
744
733
|
src={theme.images.general.chat}
|
|
745
734
|
width={16}
|
|
@@ -780,16 +769,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
780
769
|
'Once business accepts your order, we will send you an email, thank you!',
|
|
781
770
|
)}
|
|
782
771
|
</OText>
|
|
783
|
-
<
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
772
|
+
<OrderAction>
|
|
773
|
+
<OButton
|
|
774
|
+
text={t('YOUR_ORDERS', 'Your Orders')}
|
|
775
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
776
|
+
imgRightSrc={null}
|
|
777
|
+
borderColor={theme.colors.primary}
|
|
778
|
+
bgColor={theme.colors.clear}
|
|
779
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
|
|
780
|
+
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
781
|
+
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
782
|
+
/>
|
|
783
|
+
{(
|
|
784
|
+
parseInt(order?.status) === 1 ||
|
|
785
|
+
parseInt(order?.status) === 2 ||
|
|
786
|
+
parseInt(order?.status) === 5 ||
|
|
787
|
+
parseInt(order?.status) === 6 ||
|
|
788
|
+
parseInt(order?.status) === 10 ||
|
|
789
|
+
parseInt(order?.status) === 11 ||
|
|
790
|
+
parseInt(order?.status) === 12
|
|
791
|
+
) && (
|
|
792
|
+
<OButton
|
|
793
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
794
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
795
|
+
imgRightSrc={null}
|
|
796
|
+
borderColor='transparent'
|
|
797
|
+
bgColor={theme.colors.primary + 10}
|
|
798
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
799
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
800
|
+
/>
|
|
801
|
+
)}
|
|
802
|
+
</OrderAction>
|
|
793
803
|
</HeaderInfo>
|
|
794
804
|
<OrderProducts>
|
|
795
805
|
{order?.products?.length &&
|
|
@@ -899,7 +909,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
899
909
|
<OSRow>
|
|
900
910
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
901
911
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
902
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}
|
|
912
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
903
913
|
</OText>
|
|
904
914
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
|
|
905
915
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -1022,28 +1032,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1022
1032
|
</OrderContent>
|
|
1023
1033
|
</>
|
|
1024
1034
|
)}
|
|
1025
|
-
<OModal
|
|
1026
|
-
open={openModalForBusiness || openModalForDriver}
|
|
1027
|
-
entireModal
|
|
1028
|
-
customClose
|
|
1029
|
-
onClose={() => handleCloseModal()}>
|
|
1030
|
-
<Messages
|
|
1031
|
-
type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
|
|
1032
|
-
orderId={order?.id}
|
|
1033
|
-
messages={messages}
|
|
1034
|
-
order={order}
|
|
1035
|
-
business={openModalForBusiness}
|
|
1036
|
-
driver={openModalForDriver}
|
|
1037
|
-
setMessages={setMessages}
|
|
1038
|
-
onClose={handleCloseModal}
|
|
1039
|
-
/>
|
|
1040
|
-
</OModal>
|
|
1041
1035
|
<OModal
|
|
1042
1036
|
open={openTaxModal.open}
|
|
1043
1037
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
1044
1038
|
entireModal
|
|
1045
|
-
title={`${openTaxModal.data?.name ||
|
|
1046
|
-
t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
|
|
1047
1039
|
>
|
|
1048
1040
|
<TaxInformation
|
|
1049
1041
|
type={openTaxModal.type}
|
|
@@ -5,7 +5,6 @@ export const OrderDetailsContainer = styled.ScrollView`
|
|
|
5
5
|
`
|
|
6
6
|
|
|
7
7
|
export const NavBack = styled.TouchableOpacity`
|
|
8
|
-
|
|
9
8
|
`
|
|
10
9
|
|
|
11
10
|
|
|
@@ -125,3 +124,6 @@ export const Divider = styled.View`
|
|
|
125
124
|
margin-top: 5px;
|
|
126
125
|
margin-bottom: 5px;
|
|
127
126
|
`
|
|
127
|
+
export const OrderAction = styled.View`
|
|
128
|
+
flex-direction: row;
|
|
129
|
+
`
|
|
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
98
98
|
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
|
|
99
99
|
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
|
|
100
100
|
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
|
|
101
|
-
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY
|
|
101
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
|
|
102
102
|
]
|
|
103
103
|
|
|
104
104
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
131
131
|
|
|
132
132
|
useEffect(() => {
|
|
133
133
|
if (isFocused) {
|
|
134
|
-
loadOrders()
|
|
134
|
+
loadOrders(false, false, false, true)
|
|
135
135
|
}
|
|
136
136
|
}, [isFocused])
|
|
137
137
|
|
|
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
188
188
|
<ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
|
|
189
189
|
</ProgressContentWrapper>
|
|
190
190
|
<ProgressTextWrapper>
|
|
191
|
-
<OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
191
|
+
<OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
192
192
|
<TimeWrapper>
|
|
193
193
|
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
194
194
|
<OText size={11}>
|
|
@@ -218,7 +218,7 @@ export const OrderProgress = (props: any) => {
|
|
|
218
218
|
const orderProgressProps = {
|
|
219
219
|
...props,
|
|
220
220
|
UIComponent: OrderProgressUI,
|
|
221
|
-
orderStatus: [0, 3, 4, 7, 8, 9, 13, 14,
|
|
221
|
+
orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
|
|
222
222
|
useDefualtSessionManager: true,
|
|
223
223
|
paginationSettings: {
|
|
224
224
|
initialPage: 1,
|
|
@@ -26,6 +26,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
26
26
|
import { TaxInformation } from '../TaxInformation';
|
|
27
27
|
import { TouchableOpacity } from 'react-native';
|
|
28
28
|
import { OAlert } from '../../../../../src/components/shared'
|
|
29
|
+
import { PlaceSpot } from '../PlaceSpot'
|
|
29
30
|
|
|
30
31
|
const OrderSummaryUI = (props: any) => {
|
|
31
32
|
const {
|
|
@@ -49,7 +50,9 @@ const OrderSummaryUI = (props: any) => {
|
|
|
49
50
|
const [validationFields] = useValidationFields();
|
|
50
51
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
|
|
51
52
|
const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
|
|
53
|
+
const [openPlaceModal, setOpenPlaceModal] = useState(false)
|
|
52
54
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
|
|
55
|
+
const placeSpotTypes = [3, 4]
|
|
53
56
|
|
|
54
57
|
const handleDeleteClick = (product: any) => {
|
|
55
58
|
removeProduct(product, cart)
|
|
@@ -109,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
109
112
|
{cart?.products?.length > 0 && (
|
|
110
113
|
<>
|
|
111
114
|
<OSProductList>
|
|
112
|
-
{cart?.products
|
|
115
|
+
{cart?.products?.map((product: any) => (
|
|
113
116
|
<ProductItemAccordion
|
|
114
117
|
key={product.code}
|
|
115
118
|
product={product}
|
|
@@ -199,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
199
202
|
<OSRow>
|
|
200
203
|
<OText size={12} numberOfLines={1}>
|
|
201
204
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
202
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
205
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
203
206
|
</OText>
|
|
204
207
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
205
208
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -301,6 +304,24 @@ const OrderSummaryUI = (props: any) => {
|
|
|
301
304
|
</OSTable>
|
|
302
305
|
</View>
|
|
303
306
|
)}
|
|
307
|
+
{placeSpotTypes.includes(orderState?.options?.type) && (
|
|
308
|
+
<OSTable style={{ marginTop: 15 }}>
|
|
309
|
+
<OText size={14} lineHeight={21} weight={'600'}>
|
|
310
|
+
{t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
|
|
311
|
+
</OText>
|
|
312
|
+
<TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
|
|
313
|
+
<OText
|
|
314
|
+
size={14}
|
|
315
|
+
lineHeight={21}
|
|
316
|
+
weight={'600'}
|
|
317
|
+
color={theme.colors.primary}
|
|
318
|
+
style={{ textDecorationLine: 'underline' }}
|
|
319
|
+
>
|
|
320
|
+
{t('EDIT', 'Edit')}
|
|
321
|
+
</OText>
|
|
322
|
+
</TouchableOpacity>
|
|
323
|
+
</OSTable>
|
|
324
|
+
)}
|
|
304
325
|
{cart?.status !== 2 && (
|
|
305
326
|
<OSTable>
|
|
306
327
|
<View style={{ width: '100%', marginTop: 20 }}>
|
|
@@ -349,6 +370,18 @@ const OrderSummaryUI = (props: any) => {
|
|
|
349
370
|
products={cart?.products}
|
|
350
371
|
/>
|
|
351
372
|
</OModal>
|
|
373
|
+
<OModal
|
|
374
|
+
open={openPlaceModal}
|
|
375
|
+
title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
|
|
376
|
+
onClose={() => setOpenPlaceModal(false)}
|
|
377
|
+
entireModal
|
|
378
|
+
>
|
|
379
|
+
<PlaceSpot
|
|
380
|
+
cart={cart}
|
|
381
|
+
isOpenPlaceSpot={openPlaceModal}
|
|
382
|
+
setOpenPlaceModal={setOpenPlaceModal}
|
|
383
|
+
/>
|
|
384
|
+
</OModal>
|
|
352
385
|
<OAlert
|
|
353
386
|
open={confirm.open}
|
|
354
387
|
title={confirm.title}
|
|
@@ -19,7 +19,8 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
19
19
|
typeSelected,
|
|
20
20
|
defaultValue,
|
|
21
21
|
configTypes,
|
|
22
|
-
orderTypes
|
|
22
|
+
orderTypes,
|
|
23
|
+
setOrderTypeValue
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const theme = useTheme();
|
|
@@ -39,6 +40,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
39
40
|
|
|
40
41
|
const handleChangeOrderTypeCallback = (orderType: number) => {
|
|
41
42
|
if (!orderState.loading) {
|
|
43
|
+
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
42
44
|
handleChangeOrderType(orderType)
|
|
43
45
|
goToBack();
|
|
44
46
|
}
|
|
@@ -51,7 +53,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
51
53
|
btnStyle={{ paddingLeft: 0 }}
|
|
52
54
|
paddingTop={0}
|
|
53
55
|
style={{ paddingBottom: 0 }}
|
|
54
|
-
title={t('
|
|
56
|
+
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
55
57
|
titleAlign={'center'}
|
|
56
58
|
titleStyle={{ fontSize: 14 }}
|
|
57
59
|
/>
|