ordering-ui-react-native 0.15.2 → 0.15.4-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 +7 -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/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +66 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +25 -4
- 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/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- 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 +1 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- 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 +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
- 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 +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- 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 +7 -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 +2 -2
- 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 +172 -124
- 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/original/index.tsx +179 -0
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +28 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +100 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +32 -21
- package/themes/original/src/components/BusinessListingSearch/index.tsx +7 -3
- 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 +6 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +23 -30
- package/themes/original/src/components/BusinessReviews/index.tsx +8 -28
- package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
- package/themes/original/src/components/Cart/index.tsx +40 -9
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +58 -33
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- 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/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +105 -90
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +156 -70
- package/themes/original/src/components/LoginForm/styles.tsx +6 -1
- package/themes/original/src/components/Messages/index.tsx +52 -45
- 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 +102 -125
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +6 -7
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- 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 +157 -108
- package/themes/original/src/components/ProductForm/styles.tsx +5 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
- 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/SignupForm/index.tsx +173 -154
- 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 +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -16
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- 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/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 +64 -22
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- 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
|
@@ -35,6 +35,8 @@ const ORDER_STATUS: any = {
|
|
|
35
35
|
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
36
36
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
37
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
const filterSpecialStatus = ['prepared_in', 'delivered_in']
|
|
@@ -95,28 +97,18 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
const handleImagePicker = () => {
|
|
98
|
-
launchImageLibrary({ mediaType: 'photo', maxHeight:
|
|
99
|
-
if (response
|
|
100
|
-
|
|
101
|
-
} else if (response
|
|
102
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
100
|
+
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
|
+
if (response?.didCancel) {
|
|
102
|
+
showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
|
|
103
|
+
} else if (response?.errorMessage) {
|
|
103
104
|
showToast(ToastType.Error, response.errorMessage);
|
|
104
105
|
} else {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
111
|
-
}
|
|
106
|
+
if (response?.assets?.length > 0) {
|
|
107
|
+
const image = response?.assets[0]
|
|
108
|
+
const url = `data:${image.type};base64,${image.base64}`
|
|
109
|
+
setImage && setImage(url);
|
|
112
110
|
} else {
|
|
113
|
-
|
|
114
|
-
const image = response?.assets[0]
|
|
115
|
-
const url = `data:${image.type};base64,${image.base64}`
|
|
116
|
-
setImage && setImage(url);
|
|
117
|
-
} else {
|
|
118
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
119
|
-
}
|
|
111
|
+
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
});
|
|
@@ -235,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
235
227
|
{image && (
|
|
236
228
|
<TouchableOpacity
|
|
237
229
|
style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
|
|
238
|
-
onPress={
|
|
230
|
+
onPress={removeImage}
|
|
239
231
|
>
|
|
240
232
|
<MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
|
|
241
233
|
</TouchableOpacity>
|
|
@@ -340,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
340
332
|
)
|
|
341
333
|
)
|
|
342
334
|
|
|
343
|
-
const renderSend = (props: any) =>
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
335
|
+
const renderSend = (props: any) => {
|
|
336
|
+
const isDisabled = (sendMessage?.loading || (message === '' && !image) || messages?.loading)
|
|
337
|
+
return (
|
|
338
|
+
<Send
|
|
339
|
+
{...props}
|
|
340
|
+
disabled={isDisabled}
|
|
341
|
+
alwaysShowSend
|
|
342
|
+
containerStyle={styles.containerSend}
|
|
343
|
+
>
|
|
344
|
+
<OIconButton
|
|
345
|
+
onClick={onSubmit}
|
|
346
|
+
style={{
|
|
347
|
+
height: 44,
|
|
348
|
+
width: 44,
|
|
349
|
+
borderRadius: 7.6,
|
|
350
|
+
opacity: isDisabled ? 0.2 : 1,
|
|
351
|
+
borderColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
352
|
+
backgroundColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
353
|
+
}}
|
|
354
|
+
iconStyle={{ marginTop: 3, marginRight: 2 }}
|
|
355
|
+
icon={theme.images.general.enter}
|
|
356
|
+
iconColor={isDisabled ? '#000' : '#fff'}
|
|
357
|
+
disabled={isDisabled}
|
|
358
|
+
disabledColor={theme.colors.secondary}
|
|
359
|
+
/>
|
|
360
|
+
</Send>
|
|
361
|
+
)
|
|
362
|
+
}
|
|
367
363
|
|
|
368
364
|
const renderBubble = (props: any) => (
|
|
369
365
|
<Bubble
|
|
@@ -543,9 +539,20 @@ const styles = StyleSheet.create({
|
|
|
543
539
|
})
|
|
544
540
|
|
|
545
541
|
export const Messages = (props: MessagesParams) => {
|
|
542
|
+
const [allMessages, setAllMessages] = useState(props.messages)
|
|
543
|
+
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
setAllMessages(props.messages)
|
|
546
|
+
}, [props.messages])
|
|
547
|
+
|
|
546
548
|
const MessagesProps = {
|
|
547
549
|
...props,
|
|
548
|
-
UIComponent: MessagesUI
|
|
550
|
+
UIComponent: MessagesUI,
|
|
551
|
+
messages: allMessages,
|
|
552
|
+
setMessages: (values: any) => {
|
|
553
|
+
props.setMessages && props.setMessages(values)
|
|
554
|
+
setAllMessages(values)
|
|
555
|
+
}
|
|
549
556
|
}
|
|
550
557
|
return <MessagesController {...MessagesProps} />
|
|
551
558
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import styled, { css } from 'styled-components/native'
|
|
3
2
|
|
|
4
|
-
|
|
5
3
|
export const Wrapper = styled.View`
|
|
6
4
|
flex: 1;
|
|
7
5
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
|
|
|
39
37
|
${({ active }: any) => active && css`
|
|
40
38
|
background-color: ${(props: any) => props.theme.colors.whiteGray};
|
|
41
39
|
`}
|
|
42
|
-
`
|
|
40
|
+
`
|
|
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
|
|
|
4
4
|
import {
|
|
5
5
|
useLanguage,
|
|
6
6
|
useConfig,
|
|
7
|
+
useUtils,
|
|
7
8
|
useOrder,
|
|
8
9
|
MomentOption as MomentOptionController,
|
|
9
10
|
} from 'ordering-components/native';
|
|
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
132
133
|
|
|
133
134
|
const [, t] = useLanguage();
|
|
134
135
|
const [{ configs }] = useConfig();
|
|
136
|
+
const [{ parseTime }] = useUtils()
|
|
135
137
|
const [orderState] = useOrder();
|
|
136
138
|
const [optionSelected, setOptionSelected] = useState({
|
|
137
139
|
isAsap: false,
|
|
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
143
145
|
});
|
|
144
146
|
const { bottom } = useSafeAreaInsets();
|
|
145
147
|
|
|
148
|
+
const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
|
|
149
|
+
|
|
146
150
|
const [selectedTime, setSelectedTime] = useState(null);
|
|
147
151
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
148
152
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
338
342
|
style={{
|
|
339
343
|
lineHeight: 24
|
|
340
344
|
}}
|
|
341
|
-
>{
|
|
345
|
+
>{is12hours ? (
|
|
346
|
+
time.startTime.includes('12')
|
|
347
|
+
? `${time.startTime}PM`
|
|
348
|
+
: parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
349
|
+
) : time.startTime
|
|
350
|
+
}</OText>
|
|
342
351
|
</TimeItem>
|
|
343
352
|
</TouchableOpacity>
|
|
344
353
|
))}
|
|
@@ -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,17 +24,16 @@ 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';
|
|
@@ -55,9 +47,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
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();
|
|
@@ -92,16 +86,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
92
86
|
|
|
93
87
|
const [, t] = useLanguage();
|
|
94
88
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
95
|
-
const [{ user }] = useSession();
|
|
96
89
|
const [{ configs }] = useConfig();
|
|
97
|
-
|
|
98
|
-
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
99
|
-
const [openModalForDriver, setOpenModalForDriver] = useState(false);
|
|
100
90
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
101
|
-
const [unreadAlert, setUnreadAlert] = useState({
|
|
102
|
-
business: false,
|
|
103
|
-
driver: false,
|
|
104
|
-
});
|
|
105
91
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
106
92
|
|
|
107
93
|
const { order, businessData } = props.order;
|
|
@@ -293,18 +279,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
293
279
|
percentage: 95,
|
|
294
280
|
image: theme.images.order.status7,
|
|
295
281
|
},
|
|
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
|
|
282
|
+
{
|
|
283
|
+
key: 22,
|
|
284
|
+
value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
|
|
285
|
+
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
286
|
+
percentage: 35,
|
|
287
|
+
image: theme.images.order.status8
|
|
302
288
|
},
|
|
303
|
-
{
|
|
304
|
-
key: 23,
|
|
305
|
-
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
306
|
-
slug: 'ORDER_DRIVER_ON_WAY',
|
|
307
|
-
percentage: 45,
|
|
289
|
+
{
|
|
290
|
+
key: 23,
|
|
291
|
+
value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
|
|
292
|
+
slug: 'ORDER_DRIVER_ON_WAY',
|
|
293
|
+
percentage: 45,
|
|
308
294
|
image: theme.images.order.status8
|
|
309
295
|
}
|
|
310
296
|
];
|
|
@@ -314,38 +300,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
314
300
|
return objectStatus && objectStatus;
|
|
315
301
|
};
|
|
316
302
|
|
|
317
|
-
const
|
|
318
|
-
setOpenModalForBusiness(true);
|
|
319
|
-
readMessages && readMessages();
|
|
320
|
-
setUnreadAlert({ ...unreadAlert, business: false });
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
const handleOpenMessagesForDriver = () => {
|
|
324
|
-
setOpenModalForDriver(true);
|
|
303
|
+
const handleGoToMessages = (type: string) => {
|
|
325
304
|
readMessages && readMessages();
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
setUnreadAlert({ business, driver });
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
const handleCloseModal = () => {
|
|
346
|
-
setOpenModalForBusiness(false);
|
|
347
|
-
setOpenModalForDriver(false);
|
|
348
|
-
};
|
|
305
|
+
navigation.navigate(
|
|
306
|
+
'MessageDetails',
|
|
307
|
+
{
|
|
308
|
+
type,
|
|
309
|
+
order,
|
|
310
|
+
messages,
|
|
311
|
+
setMessages,
|
|
312
|
+
orderId: order?.id,
|
|
313
|
+
business: type === 'business',
|
|
314
|
+
driver: type === 'driver',
|
|
315
|
+
onClose: () => navigation?.canGoBack()
|
|
316
|
+
? navigation.goBack()
|
|
317
|
+
: navigation.navigate('BottomTab', { screen: 'MyOrders' }),
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
}
|
|
349
321
|
|
|
350
322
|
const handleArrowBack: any = () => {
|
|
351
323
|
if (!isFromCheckout) {
|
|
@@ -387,6 +359,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
387
359
|
)
|
|
388
360
|
}
|
|
389
361
|
|
|
362
|
+
|
|
363
|
+
useEffect(() => {
|
|
364
|
+
if (reorderState?.error) {
|
|
365
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
366
|
+
}
|
|
367
|
+
if (!reorderState?.error && reorderState?.result?.uuid) {
|
|
368
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
369
|
+
}
|
|
370
|
+
}, [reorderState])
|
|
371
|
+
|
|
390
372
|
useEffect(() => {
|
|
391
373
|
BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
|
|
392
374
|
return () => {
|
|
@@ -394,14 +376,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
394
376
|
};
|
|
395
377
|
}, []);
|
|
396
378
|
|
|
397
|
-
useEffect(() => {
|
|
398
|
-
if (messagesReadList?.length) {
|
|
399
|
-
openModalForBusiness
|
|
400
|
-
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
401
|
-
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
402
|
-
}
|
|
403
|
-
}, [messagesReadList]);
|
|
404
|
-
|
|
405
379
|
const locations = [
|
|
406
380
|
{
|
|
407
381
|
...order?.driver?.location,
|
|
@@ -430,10 +404,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
430
404
|
}
|
|
431
405
|
}, [driverLocation]);
|
|
432
406
|
|
|
433
|
-
useEffect(() => {
|
|
434
|
-
console.log('order: ', order)
|
|
435
|
-
}, [order]);
|
|
436
|
-
|
|
437
407
|
return (
|
|
438
408
|
<OrderDetailsContainer keyboardShouldPersistTaps="handled">
|
|
439
409
|
{(!order || Object.keys(order).length === 0) && (
|
|
@@ -481,7 +451,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
481
451
|
<PlaceholderLine width={65} height={10} />
|
|
482
452
|
<PlaceholderLine width={80} height={10} />
|
|
483
453
|
<PlaceholderLine width={70} height={10} />
|
|
484
|
-
<View style={{marginTop: 10}}>
|
|
454
|
+
<View style={{ marginTop: 10 }}>
|
|
485
455
|
<PlaceholderLine width={60} height={20} />
|
|
486
456
|
<PlaceholderLine width={40} height={10} />
|
|
487
457
|
</View>
|
|
@@ -594,21 +564,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
594
564
|
{order?.business?.name}
|
|
595
565
|
</OText>
|
|
596
566
|
<Icons>
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
567
|
+
{!!order?.business?.cellphone && (
|
|
568
|
+
<TouchableOpacity
|
|
569
|
+
onPress={() => order?.business?.cellphone &&
|
|
570
|
+
Linking.openURL(`tel:${order?.business?.cellphone}`)
|
|
571
|
+
}
|
|
572
|
+
style={{ paddingEnd: 5 }}
|
|
573
|
+
>
|
|
574
|
+
<OIcon
|
|
575
|
+
src={theme.images.general.phone}
|
|
576
|
+
width={16}
|
|
577
|
+
color={theme.colors.disabled}
|
|
578
|
+
/>
|
|
579
|
+
</TouchableOpacity>
|
|
580
|
+
)}
|
|
609
581
|
<TouchableOpacity
|
|
610
582
|
style={{ paddingStart: 5 }}
|
|
611
|
-
onPress={() =>
|
|
583
|
+
onPress={() => handleGoToMessages('business')}>
|
|
612
584
|
<OIcon
|
|
613
585
|
src={theme.images.general.chat}
|
|
614
586
|
width={16}
|
|
@@ -624,13 +596,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
624
596
|
mBottom={2}>
|
|
625
597
|
{order?.business?.email}
|
|
626
598
|
</OText>
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
599
|
+
{!!order?.business?.cellphone && (
|
|
600
|
+
<OText
|
|
601
|
+
size={12}
|
|
602
|
+
lineHeight={18}
|
|
603
|
+
color={theme.colors.textNormal}
|
|
604
|
+
mBottom={2}>
|
|
605
|
+
{order?.business?.cellphone}
|
|
606
|
+
</OText>
|
|
607
|
+
)}
|
|
634
608
|
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
635
609
|
{order?.business?.address}
|
|
636
610
|
</OText>
|
|
@@ -735,7 +709,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
735
709
|
</OText>
|
|
736
710
|
<Icons>
|
|
737
711
|
<TouchableOpacity
|
|
738
|
-
onPress={() =>
|
|
712
|
+
onPress={() => handleGoToMessages('driver')}>
|
|
739
713
|
<OIcon
|
|
740
714
|
src={theme.images.general.chat}
|
|
741
715
|
width={16}
|
|
@@ -776,16 +750,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
776
750
|
'Once business accepts your order, we will send you an email, thank you!',
|
|
777
751
|
)}
|
|
778
752
|
</OText>
|
|
779
|
-
<
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
753
|
+
<OrderAction>
|
|
754
|
+
<OButton
|
|
755
|
+
text={t('YOUR_ORDERS', 'Your Orders')}
|
|
756
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
757
|
+
imgRightSrc={null}
|
|
758
|
+
borderColor={theme.colors.primary}
|
|
759
|
+
bgColor={theme.colors.clear}
|
|
760
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
|
|
761
|
+
parentStyle={{ marginTop: 29, marginEnd: 15 }}
|
|
762
|
+
onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
|
|
763
|
+
/>
|
|
764
|
+
{(
|
|
765
|
+
parseInt(order?.status) === 1 ||
|
|
766
|
+
parseInt(order?.status) === 2 ||
|
|
767
|
+
parseInt(order?.status) === 5 ||
|
|
768
|
+
parseInt(order?.status) === 6 ||
|
|
769
|
+
parseInt(order?.status) === 10 ||
|
|
770
|
+
parseInt(order?.status) === 11 ||
|
|
771
|
+
parseInt(order?.status) === 12
|
|
772
|
+
) && (
|
|
773
|
+
<OButton
|
|
774
|
+
text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
|
|
775
|
+
textStyle={{ fontSize: 14, color: theme.colors.primary }}
|
|
776
|
+
imgRightSrc={null}
|
|
777
|
+
borderColor='transparent'
|
|
778
|
+
bgColor={theme.colors.primary + 10}
|
|
779
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
|
|
780
|
+
onClick={() => handleReorder && handleReorder(order.id)}
|
|
781
|
+
/>
|
|
782
|
+
)}
|
|
783
|
+
</OrderAction>
|
|
789
784
|
</HeaderInfo>
|
|
790
785
|
<OrderProducts>
|
|
791
786
|
{order?.products?.length &&
|
|
@@ -978,7 +973,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
978
973
|
marginTop: 10
|
|
979
974
|
}}
|
|
980
975
|
>
|
|
981
|
-
{order?.payment_events?.map((event: any) => (
|
|
976
|
+
{order?.payment_events?.map((event: any) => event.amount > 0 && (
|
|
982
977
|
<View
|
|
983
978
|
key={event.id}
|
|
984
979
|
style={{
|
|
@@ -1018,28 +1013,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1018
1013
|
</OrderContent>
|
|
1019
1014
|
</>
|
|
1020
1015
|
)}
|
|
1021
|
-
<OModal
|
|
1022
|
-
open={openModalForBusiness || openModalForDriver}
|
|
1023
|
-
entireModal
|
|
1024
|
-
customClose
|
|
1025
|
-
onClose={() => handleCloseModal()}>
|
|
1026
|
-
<Messages
|
|
1027
|
-
type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
|
|
1028
|
-
orderId={order?.id}
|
|
1029
|
-
messages={messages}
|
|
1030
|
-
order={order}
|
|
1031
|
-
business={openModalForBusiness}
|
|
1032
|
-
driver={openModalForDriver}
|
|
1033
|
-
setMessages={setMessages}
|
|
1034
|
-
onClose={handleCloseModal}
|
|
1035
|
-
/>
|
|
1036
|
-
</OModal>
|
|
1037
1016
|
<OModal
|
|
1038
1017
|
open={openTaxModal.open}
|
|
1039
1018
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
1040
1019
|
entireModal
|
|
1041
|
-
title={`${openTaxModal.data?.name ||
|
|
1042
|
-
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}%`})` : ''} `}
|
|
1043
1020
|
>
|
|
1044
1021
|
<TaxInformation
|
|
1045
1022
|
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
|
+
`
|
|
@@ -9,7 +9,7 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
|
9
9
|
import moment from 'moment';
|
|
10
10
|
import { OText } from '../shared'
|
|
11
11
|
import { NotFoundSource } from '../NotFoundSource'
|
|
12
|
-
import { View, StyleSheet, TouchableOpacity } from 'react-native'
|
|
12
|
+
import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native'
|
|
13
13
|
import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
|
|
14
14
|
import FastImage from 'react-native-fast-image'
|
|
15
15
|
import {
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
ProgressTextWrapper,
|
|
20
20
|
OrderInfoWrapper
|
|
21
21
|
} from './styles'
|
|
22
|
-
|
|
23
22
|
const OrderProgressUI = (props: any) => {
|
|
24
23
|
const {
|
|
25
24
|
orderList,
|
|
@@ -99,7 +98,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
99
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 },
|
|
100
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 },
|
|
101
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 },
|
|
102
|
-
{ 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 }
|
|
103
102
|
]
|
|
104
103
|
|
|
105
104
|
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
@@ -132,14 +131,14 @@ const OrderProgressUI = (props: any) => {
|
|
|
132
131
|
|
|
133
132
|
useEffect(() => {
|
|
134
133
|
if (isFocused) {
|
|
135
|
-
loadOrders()
|
|
134
|
+
loadOrders(false, false, false, true)
|
|
136
135
|
}
|
|
137
136
|
}, [isFocused])
|
|
138
137
|
|
|
139
138
|
return (
|
|
140
139
|
<>
|
|
141
140
|
{orderList?.loading && (
|
|
142
|
-
<Placeholder Animation={Fade} height={158}>
|
|
141
|
+
<Placeholder Animation={Fade} height={Platform.OS === 'ios' ? 147.5 : 158}>
|
|
143
142
|
<PlaceholderLine height={60} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
144
143
|
<PlaceholderLine height={20} style={{ marginBottom: 10 }} />
|
|
145
144
|
<PlaceholderLine height={40} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
@@ -189,7 +188,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
189
188
|
<ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
|
|
190
189
|
</ProgressContentWrapper>
|
|
191
190
|
<ProgressTextWrapper>
|
|
192
|
-
<OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
191
|
+
<OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
193
192
|
<TimeWrapper>
|
|
194
193
|
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
195
194
|
<OText size={11}>
|
|
@@ -219,7 +218,7 @@ export const OrderProgress = (props: any) => {
|
|
|
219
218
|
const orderProgressProps = {
|
|
220
219
|
...props,
|
|
221
220
|
UIComponent: OrderProgressUI,
|
|
222
|
-
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],
|
|
223
222
|
useDefualtSessionManager: true,
|
|
224
223
|
paginationSettings: {
|
|
225
224
|
initialPage: 1,
|