ordering-ui-react-native 0.15.27 → 0.15.28-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 +3 -2
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- 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 +5 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- 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/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -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 +58 -51
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -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/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/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- 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/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- 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 +121 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +132 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +118 -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 +53 -60
- package/themes/original/src/components/Cart/index.tsx +21 -17
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +58 -45
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- 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/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +389 -156
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- 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 +56 -33
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- 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 +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +55 -58
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- 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/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
- package/themes/original/src/components/ProductForm/index.tsx +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- 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/SearchBar/index.tsx +4 -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 +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- 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 +76 -9
- 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/OModal.tsx +1 -1
- 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 +68 -6
- package/themes/original/src/utils/index.tsx +28 -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
|
@@ -12,11 +12,9 @@ export const FormSide = styled.View`
|
|
|
12
12
|
margin: auto;
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
export const OTabs = styled.
|
|
15
|
+
export const OTabs = styled.ScrollView`
|
|
16
16
|
flex-direction: row;
|
|
17
17
|
width: 100%;
|
|
18
|
-
flex-wrap: wrap;
|
|
19
|
-
justify-content: flex-start;
|
|
20
18
|
margin-bottom: -1px;
|
|
21
19
|
`;
|
|
22
20
|
|
|
@@ -36,7 +34,7 @@ export const LoginWith = styled.View`
|
|
|
36
34
|
width: 100%;
|
|
37
35
|
align-items: flex-start;
|
|
38
36
|
border-bottom-width: 1px;
|
|
39
|
-
border-bottom-color: ${(props: any) => props.theme.colors.border}
|
|
37
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
40
38
|
`;
|
|
41
39
|
|
|
42
40
|
export const FormInput = styled.View`
|
|
@@ -80,3 +78,8 @@ export const LineSeparator = styled.View`
|
|
|
80
78
|
export const SkeletonWrapper = styled.View`
|
|
81
79
|
width: 90%;
|
|
82
80
|
`
|
|
81
|
+
export const RecaptchaButton = styled.View`
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
align-items: center;
|
|
84
|
+
margin-bottom: 10px;
|
|
85
|
+
`
|
|
@@ -3,14 +3,20 @@ import { TouchableOpacity } from 'react-native';
|
|
|
3
3
|
import { LogoutAction } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText } from '../shared';
|
|
6
|
+
import { _retrieveStoreData } from '../../providers/StoreUtil';
|
|
6
7
|
|
|
7
8
|
const LogoutButtonUI = (props: any) => {
|
|
8
9
|
const { handleLogoutClick, text, color, iconSize } = props
|
|
9
10
|
const theme = useTheme();
|
|
10
11
|
|
|
12
|
+
const handleClick = async () => {
|
|
13
|
+
const data = await _retrieveStoreData('notification_state');
|
|
14
|
+
handleLogoutClick(data)
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
return (
|
|
12
18
|
<TouchableOpacity
|
|
13
|
-
onPress={() =>
|
|
19
|
+
onPress={() => handleClick()}
|
|
14
20
|
style={{ flexDirection: 'row', alignItems: 'center' }}
|
|
15
21
|
>
|
|
16
22
|
<OIcon
|
|
@@ -36,7 +36,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
36
36
|
loadOrders,
|
|
37
37
|
setSelectedOrderId,
|
|
38
38
|
setOrderList,
|
|
39
|
-
setOpenMessges
|
|
39
|
+
setOpenMessges,
|
|
40
|
+
setRefreshOrders,
|
|
41
|
+
refreshOrders
|
|
40
42
|
} = props
|
|
41
43
|
|
|
42
44
|
const theme = useTheme();
|
|
@@ -99,6 +101,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
99
101
|
setOrderList(orderList)
|
|
100
102
|
}, [orderList, loading])
|
|
101
103
|
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if(refreshOrders){
|
|
106
|
+
loadOrders(false, false, false, true)
|
|
107
|
+
setRefreshOrders && setRefreshOrders(false)
|
|
108
|
+
}
|
|
109
|
+
}, [refreshOrders])
|
|
110
|
+
|
|
102
111
|
return (
|
|
103
112
|
<>
|
|
104
113
|
{!loading && orders.length === 0 && (
|
|
@@ -39,7 +39,7 @@ const ORDER_STATUS: any = {
|
|
|
39
39
|
23: 'ORDER_DRIVER_ON_WAY'
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const filterSpecialStatus = ['prepared_in', 'delivered_in']
|
|
42
|
+
const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
const MessagesUI = (props: MessagesParams) => {
|
|
@@ -332,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
332
332
|
)
|
|
333
333
|
)
|
|
334
334
|
|
|
335
|
-
const renderSend = (props: any) =>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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
|
+
}
|
|
359
363
|
|
|
360
364
|
const renderBubble = (props: any) => (
|
|
361
365
|
<Bubble
|
|
@@ -536,6 +540,11 @@ const styles = StyleSheet.create({
|
|
|
536
540
|
|
|
537
541
|
export const Messages = (props: MessagesParams) => {
|
|
538
542
|
const [allMessages, setAllMessages] = useState(props.messages)
|
|
543
|
+
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
setAllMessages(props.messages)
|
|
546
|
+
}, [props.messages])
|
|
547
|
+
|
|
539
548
|
const MessagesProps = {
|
|
540
549
|
...props,
|
|
541
550
|
UIComponent: MessagesUI,
|
|
@@ -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,10 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
4
5
|
import {
|
|
5
6
|
useLanguage,
|
|
6
7
|
OrderDetails as OrderDetailsConTableoller,
|
|
7
8
|
useUtils,
|
|
9
|
+
useOrder,
|
|
8
10
|
useConfig
|
|
9
11
|
} from 'ordering-components/native';
|
|
10
12
|
import { useTheme } from 'styled-components/native';
|
|
@@ -40,7 +42,7 @@ import { OSRow } from '../OrderSummary/styles';
|
|
|
40
42
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
41
43
|
import { TaxInformation } from '../TaxInformation';
|
|
42
44
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
43
|
-
|
|
45
|
+
import NavBar from '../NavBar'
|
|
44
46
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
45
47
|
const {
|
|
46
48
|
navigation,
|
|
@@ -80,17 +82,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
80
82
|
justifyContent: 'flex-start',
|
|
81
83
|
paddingLeft: 0,
|
|
82
84
|
height: 30,
|
|
83
|
-
width:
|
|
85
|
+
width: 30,
|
|
86
|
+
marginTop: Platform.OS === 'ios' ? 0 : 30
|
|
84
87
|
},
|
|
85
88
|
});
|
|
86
89
|
|
|
87
90
|
const [, t] = useLanguage();
|
|
88
91
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
89
92
|
const [{ configs }] = useConfig();
|
|
93
|
+
const [{ carts }] = useOrder()
|
|
94
|
+
|
|
90
95
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
91
96
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
92
|
-
|
|
93
97
|
const { order, businessData } = props.order;
|
|
98
|
+
const mapValidStatuses = [9, 19, 23]
|
|
94
99
|
|
|
95
100
|
const walletName: any = {
|
|
96
101
|
cash: {
|
|
@@ -328,7 +333,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
328
333
|
};
|
|
329
334
|
|
|
330
335
|
const getIncludedTaxes = () => {
|
|
331
|
-
if (order?.taxes?.length === 0) {
|
|
336
|
+
if (order?.taxes?.length === 0 || !order?.taxes) {
|
|
332
337
|
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
333
338
|
} else {
|
|
334
339
|
return order?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
@@ -361,11 +366,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
361
366
|
|
|
362
367
|
|
|
363
368
|
useEffect(() => {
|
|
369
|
+
const _businessId = 'businessId:' + businessData?.id
|
|
364
370
|
if (reorderState?.error) {
|
|
365
|
-
|
|
371
|
+
if (businessData?.id) {
|
|
372
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
373
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
374
|
+
}
|
|
366
375
|
}
|
|
367
|
-
if (!reorderState?.error && reorderState?.
|
|
368
|
-
|
|
376
|
+
if (!reorderState?.error && reorderState.loading === false && businessData?.id) {
|
|
377
|
+
const products = carts?.[_businessId]?.products
|
|
378
|
+
const available = products.every((product: any) => product.valid === true)
|
|
379
|
+
|
|
380
|
+
if (available && reorderState?.result?.uuid && (products?.length === order?.products.length)) {
|
|
381
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
382
|
+
} else {
|
|
383
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
384
|
+
products?.length !== order?.products.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
385
|
+
navigation.navigate('Business', { store: businessData?.slug })
|
|
386
|
+
}
|
|
369
387
|
}
|
|
370
388
|
}, [reorderState])
|
|
371
389
|
|
|
@@ -397,6 +415,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
397
415
|
'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
|
|
398
416
|
},
|
|
399
417
|
];
|
|
418
|
+
const driverLocationString = typeof order?.driver?.location?.location === 'string' && order?.driver?.location?.location?.split(',').map((l: string) => l.replace(/[^-.0-9]/g, ''))
|
|
419
|
+
const parsedLocations = locations.map(location => typeof location?.location === 'string' ? {
|
|
420
|
+
...location,
|
|
421
|
+
lat: parseFloat(location?.location?.split(',')[0].replace(/[^-.0-9]/g, '')),
|
|
422
|
+
lng: parseFloat(location?.location?.split(',')[1].replace(/[^-.0-9]/g, ''))
|
|
423
|
+
} : location)
|
|
400
424
|
|
|
401
425
|
useEffect(() => {
|
|
402
426
|
if (driverLocation) {
|
|
@@ -461,27 +485,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
461
485
|
{order && Object.keys(order).length > 0 && (
|
|
462
486
|
<>
|
|
463
487
|
<Header>
|
|
464
|
-
<
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
488
|
+
<NavBar
|
|
489
|
+
title={`${t('ORDER', 'Order')} #${order?.id}`}
|
|
490
|
+
titleAlign={'center'}
|
|
491
|
+
onActionLeft={handleArrowBack}
|
|
492
|
+
showCall={false}
|
|
493
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
494
|
+
style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
|
|
495
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
496
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
497
|
+
subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
498
|
+
{order?.delivery_datetime_utc
|
|
499
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
500
|
+
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
501
|
+
</OText>}
|
|
470
502
|
/>
|
|
471
503
|
<OrderInfo>
|
|
472
504
|
<OrderData>
|
|
473
|
-
<OText
|
|
474
|
-
size={20}
|
|
475
|
-
lineHeight={30}
|
|
476
|
-
weight={'600'}
|
|
477
|
-
color={theme.colors.textNormal}>
|
|
478
|
-
{t('ORDER', 'Order')} #{order?.id}
|
|
479
|
-
</OText>
|
|
480
|
-
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
481
|
-
{order?.delivery_datetime_utc
|
|
482
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
483
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
484
|
-
</OText>
|
|
485
505
|
{
|
|
486
506
|
(
|
|
487
507
|
parseInt(order?.status) === 1 ||
|
|
@@ -662,7 +682,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
662
682
|
</OText>
|
|
663
683
|
</View>
|
|
664
684
|
)}
|
|
665
|
-
{order?.comment && (
|
|
685
|
+
{!!order?.comment && (
|
|
666
686
|
<View style={{ marginTop: 15 }}>
|
|
667
687
|
<OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
|
|
668
688
|
{t('COMMENT', 'Comment')}
|
|
@@ -672,11 +692,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
672
692
|
)}
|
|
673
693
|
{order?.driver && (
|
|
674
694
|
<>
|
|
675
|
-
{order?.driver?.location && parseInt(order?.status)
|
|
695
|
+
{order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
|
|
676
696
|
<Map>
|
|
677
|
-
|
|
678
|
-
location={order?.driver?.location
|
|
679
|
-
|
|
697
|
+
<GoogleMap
|
|
698
|
+
location={typeof order?.driver?.location?.location === 'string'
|
|
699
|
+
? {
|
|
700
|
+
lat: parseFloat(driverLocationString[0]),
|
|
701
|
+
lng: parseFloat(driverLocationString[1]),
|
|
702
|
+
} : driverLocation ?? order?.driver?.location
|
|
703
|
+
}
|
|
704
|
+
locations={parsedLocations}
|
|
680
705
|
readOnly
|
|
681
706
|
/>
|
|
682
707
|
</Map>
|
|
@@ -890,7 +915,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
890
915
|
<OSRow>
|
|
891
916
|
<OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
|
|
892
917
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
893
|
-
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}
|
|
918
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
894
919
|
</OText>
|
|
895
920
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
|
|
896
921
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -1017,8 +1042,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1017
1042
|
open={openTaxModal.open}
|
|
1018
1043
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
1019
1044
|
entireModal
|
|
1020
|
-
title={`${openTaxModal.data?.name ||
|
|
1021
|
-
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}%`})` : ''} `}
|
|
1022
1045
|
>
|
|
1023
1046
|
<TaxInformation
|
|
1024
1047
|
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
|
|
|
@@ -127,4 +126,4 @@ export const Divider = styled.View`
|
|
|
127
126
|
`
|
|
128
127
|
export const OrderAction = styled.View`
|
|
129
128
|
flex-direction: row;
|
|
130
|
-
`
|
|
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,
|
|
@@ -71,7 +71,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const getIncludedTaxes = () => {
|
|
74
|
-
if (cart?.taxes === null) {
|
|
74
|
+
if (cart?.taxes === null || !cart?.taxes) {
|
|
75
75
|
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
76
76
|
} else {
|
|
77
77
|
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
@@ -112,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
112
112
|
{cart?.products?.length > 0 && (
|
|
113
113
|
<>
|
|
114
114
|
<OSProductList>
|
|
115
|
-
{cart?.products
|
|
115
|
+
{cart?.products?.map((product: any) => (
|
|
116
116
|
<ProductItemAccordion
|
|
117
117
|
key={product.code}
|
|
118
118
|
product={product}
|
|
@@ -202,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
202
202
|
<OSRow>
|
|
203
203
|
<OText size={12} numberOfLines={1}>
|
|
204
204
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
205
|
-
({parsePrice(fee?.fixed)} + {fee
|
|
205
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
206
206
|
</OText>
|
|
207
207
|
<TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
|
|
208
208
|
<AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
|
|
@@ -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
|
/>
|