ordering-ui-react-native 0.15.54 → 0.15.56-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/AddressForm/index.tsx +18 -2
- package/src/components/BusinessController/index.tsx +16 -8
- package/src/components/BusinessTypeFilter/index.tsx +3 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +120 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/OrderDetails/index.tsx +9 -23
- package/src/components/PaymentOptions/index.tsx +67 -50
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +145 -61
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeMethodForm/index.tsx +1 -2
- 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/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/CheckoutNavigator.tsx +6 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/MultiCheckout.tsx +31 -0
- package/src/pages/MultiOrdersDetails.tsx +27 -0
- package/src/pages/Sessions.tsx +22 -0
- package/src/theme.json +0 -1
- package/src/types/index.tsx +18 -11
- package/src/utils/index.tsx +68 -1
- 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 +42 -90
- 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 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- 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/BusinessMenu/index.tsx +39 -28
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +99 -26
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
- package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
- package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
- package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
- package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
- package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +3 -0
- package/themes/original/index.tsx +169 -4
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/AddressForm/index.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +30 -18
- package/themes/original/src/components/AppleLogin/index.tsx +54 -21
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/BusinessController/index.tsx +48 -11
- package/themes/original/src/components/BusinessController/styles.tsx +27 -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/BusinessItemAccordion/index.tsx +8 -5
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +10 -26
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
- package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
- package/themes/original/src/components/Cart/index.tsx +60 -41
- package/themes/original/src/components/Checkout/index.tsx +48 -32
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/Favorite/index.tsx +92 -0
- package/themes/original/src/components/Favorite/styles.tsx +22 -0
- package/themes/original/src/components/FavoriteList/index.tsx +298 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +11 -11
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- 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 +91 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +332 -164
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +1 -1
- 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/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
- package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
- package/themes/original/src/components/MyOrders/index.tsx +120 -32
- package/themes/original/src/components/MyOrders/styles.tsx +8 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +135 -49
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderSummary/index.tsx +2 -2
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
- package/themes/original/src/components/OrdersOption/index.tsx +130 -38
- package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/ProductForm/index.tsx +70 -62
- package/themes/original/src/components/ProductForm/styles.tsx +0 -1
- 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 +151 -133
- package/themes/original/src/components/Promotions/styles.tsx +3 -23
- package/themes/original/src/components/SearchBar/index.tsx +10 -4
- 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/SignupForm/index.tsx +269 -130
- package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
- package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
- package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +5 -96
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +53 -6
- 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/OModal.tsx +4 -2
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +192 -33
- package/themes/original/src/utils/index.tsx +85 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { PanResponder, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { PanResponder, Platform, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
5
5
|
useOrder,
|
|
@@ -40,7 +40,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
40
40
|
const clearCartWhenTimeOut = () => {
|
|
41
41
|
if (cart?.uuid) clearCart(cart?.uuid)
|
|
42
42
|
}
|
|
43
|
-
const timerId = useRef(false);
|
|
43
|
+
const timerId: any = useRef(false);
|
|
44
44
|
|
|
45
45
|
const clearInactivityTimeout = () =>{
|
|
46
46
|
clearTimeout(timerId.current);
|
|
@@ -93,6 +93,17 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
93
93
|
else showCartBottomSheet();
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
const handleRedirect = () => {
|
|
97
|
+
navigation.navigate('DeliveryType', {
|
|
98
|
+
callback: () => {
|
|
99
|
+
navigation.navigate('Business');
|
|
100
|
+
},
|
|
101
|
+
goBack: () => {
|
|
102
|
+
navigation.goBack();
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
96
107
|
return (
|
|
97
108
|
<View style={{
|
|
98
109
|
flex: 1,
|
|
@@ -109,31 +120,31 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
109
120
|
}}
|
|
110
121
|
>
|
|
111
122
|
<Container nopadding nestedScrollEnabled>
|
|
112
|
-
<View style={{ paddingTop: 20 }}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
{Platform.OS === 'android' && (<View style={{ paddingTop: 20 }} />)}
|
|
124
|
+
<NavBar
|
|
125
|
+
title={t('MENU_V21', 'Menu')}
|
|
126
|
+
onActionLeft={goToBack}
|
|
127
|
+
includeOrderTypeSelector
|
|
128
|
+
onClickTypes={handleRedirect}
|
|
129
|
+
rightComponent={cart && (
|
|
130
|
+
<TouchableOpacity
|
|
131
|
+
style={{ flexDirection: 'row', alignItems: 'center' }}
|
|
132
|
+
onPress={onToggleCart}
|
|
133
|
+
>
|
|
134
|
+
<OText
|
|
135
|
+
color={theme.colors.mediumGray}
|
|
121
136
|
>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</TouchableOpacity>
|
|
134
|
-
)}
|
|
135
|
-
/>
|
|
136
|
-
</View>
|
|
137
|
+
{`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
|
|
138
|
+
</OText>
|
|
139
|
+
|
|
140
|
+
<MaterialIcon
|
|
141
|
+
name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
|
|
142
|
+
color={theme.colors.primary}
|
|
143
|
+
size={30}
|
|
144
|
+
/>
|
|
145
|
+
</TouchableOpacity>
|
|
146
|
+
)}
|
|
147
|
+
/>
|
|
137
148
|
|
|
138
149
|
<BusinessProductsListing
|
|
139
150
|
{ ...businessProductsListingProps }
|
|
@@ -144,7 +155,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
144
155
|
</Container>
|
|
145
156
|
</View>
|
|
146
157
|
|
|
147
|
-
<View
|
|
158
|
+
{/* <View
|
|
148
159
|
style={{
|
|
149
160
|
flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
|
|
150
161
|
display: bottomSheetVisibility ? 'flex' : 'none'
|
|
@@ -155,7 +166,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
155
166
|
resetInactivityTimeout={resetInactivityTimeout}
|
|
156
167
|
clearInactivityTimeout={clearInactivityTimeout}
|
|
157
168
|
/>
|
|
158
|
-
</View>
|
|
169
|
+
</View> */}
|
|
159
170
|
</View>
|
|
160
171
|
);
|
|
161
172
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PlaceholderLine } from 'rn-placeholder';
|
|
3
3
|
import { View, ScrollView, Platform } from 'react-native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
@@ -21,7 +21,6 @@ const BusinessesListingUI = (props: any) => {
|
|
|
21
21
|
navigation,
|
|
22
22
|
businessesList,
|
|
23
23
|
handleBusinessClick,
|
|
24
|
-
paginationProps,
|
|
25
24
|
} = props;
|
|
26
25
|
|
|
27
26
|
const theme = useTheme();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useValidationFields,
|
|
11
11
|
} from 'ordering-components/native';
|
|
12
12
|
|
|
13
|
-
import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
|
|
13
|
+
import { CheckoutAction, OrderTypeWrapper, FloatingLayout, OSRow } from './styles';
|
|
14
14
|
|
|
15
15
|
import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
|
|
16
16
|
|
|
@@ -90,13 +90,26 @@ const CartUI = (props: any) => {
|
|
|
90
90
|
|
|
91
91
|
const goToBack = () => navigation.goBack();
|
|
92
92
|
|
|
93
|
+
const getIncludedTaxes = () => {
|
|
94
|
+
if (cart?.taxes === null) {
|
|
95
|
+
return cart.business.tax_type === 1 ? cart?.tax : 0
|
|
96
|
+
} else {
|
|
97
|
+
return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
|
|
98
|
+
return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
|
|
99
|
+
}, 0)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const getIncludedTaxesDiscounts = () => {
|
|
104
|
+
return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
return (
|
|
94
108
|
<>
|
|
95
109
|
<Container>
|
|
96
110
|
<NavBar
|
|
97
111
|
title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
|
|
98
112
|
onActionLeft={goToBack}
|
|
99
|
-
style={{ height: orientationState?.dimensions?.height * 0.08 }}
|
|
100
113
|
btnStyle={{ paddingLeft: 0 }}
|
|
101
114
|
rightComponent={(
|
|
102
115
|
<OButton
|
|
@@ -177,13 +190,10 @@ const CartUI = (props: any) => {
|
|
|
177
190
|
<OSTable>
|
|
178
191
|
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
179
192
|
<OText>
|
|
180
|
-
{cart
|
|
181
|
-
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
182
|
-
: parsePrice(cart?.subtotal || 0)}
|
|
193
|
+
{parsePrice(cart?.subtotal + getIncludedTaxes())}
|
|
183
194
|
</OText>
|
|
184
195
|
</OSTable>
|
|
185
|
-
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
|
|
186
|
-
|
|
196
|
+
{cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && orientationState?.orientation == PORTRAIT && (
|
|
187
197
|
<OSTable
|
|
188
198
|
style={{
|
|
189
199
|
backgroundColor: theme.colors.success,
|
|
@@ -226,44 +236,107 @@ const CartUI = (props: any) => {
|
|
|
226
236
|
</OText>
|
|
227
237
|
</OSTable>
|
|
228
238
|
)}
|
|
229
|
-
{
|
|
239
|
+
{
|
|
240
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
241
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
242
|
+
<OSRow>
|
|
243
|
+
<OText>{offer.name}</OText>
|
|
244
|
+
{offer.rate_type === 1 && (
|
|
245
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
246
|
+
)}
|
|
247
|
+
</OSRow>
|
|
248
|
+
<OText>
|
|
249
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
250
|
+
</OText>
|
|
251
|
+
</OSTable>
|
|
252
|
+
))
|
|
253
|
+
}
|
|
254
|
+
{cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
|
|
230
255
|
<OSTable>
|
|
231
|
-
<OText>
|
|
232
|
-
|
|
233
|
-
{
|
|
234
|
-
|
|
235
|
-
|
|
256
|
+
<OText numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
|
|
257
|
+
{cart?.business?.tax_type === 1 ? (
|
|
258
|
+
<OText>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</OText>
|
|
259
|
+
) : (
|
|
260
|
+
<OText>{parsePrice(cart?.subtotal_with_discount ?? 0)}</OText>
|
|
261
|
+
)}
|
|
236
262
|
</OSTable>
|
|
237
263
|
)}
|
|
264
|
+
{
|
|
265
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
266
|
+
<OSTable key={`${tax?.id}_${i}`}>
|
|
267
|
+
<OSRow>
|
|
268
|
+
<OText>
|
|
269
|
+
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
270
|
+
{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
|
|
271
|
+
</OText>
|
|
272
|
+
</OSRow>
|
|
273
|
+
<OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
|
|
274
|
+
</OSTable>
|
|
275
|
+
))
|
|
276
|
+
}
|
|
277
|
+
{
|
|
278
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
|
|
279
|
+
<OSTable key={`${fee?.id}_${i}`}>
|
|
280
|
+
<OSRow>
|
|
281
|
+
<OText>
|
|
282
|
+
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
283
|
+
({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
|
|
284
|
+
</OText>
|
|
285
|
+
</OSRow>
|
|
286
|
+
<OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
|
|
287
|
+
</OSTable>
|
|
288
|
+
))
|
|
289
|
+
}
|
|
290
|
+
{
|
|
291
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any, i: number) => (
|
|
292
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
293
|
+
<OSRow>
|
|
294
|
+
<OText>{offer.name}</OText>
|
|
295
|
+
{offer.rate_type === 1 && (
|
|
296
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
297
|
+
)}
|
|
298
|
+
</OSRow>
|
|
299
|
+
<OText>
|
|
300
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
301
|
+
</OText>
|
|
302
|
+
</OSTable>
|
|
303
|
+
))
|
|
304
|
+
}
|
|
238
305
|
{selectedOrderType === 1 && cart?.delivery_price > 0 && (
|
|
239
306
|
<OSTable>
|
|
240
307
|
<OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
|
|
241
308
|
<OText>{parsePrice(cart?.delivery_price)}</OText>
|
|
242
309
|
</OSTable>
|
|
243
310
|
)}
|
|
311
|
+
{
|
|
312
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
313
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
314
|
+
<OSRow>
|
|
315
|
+
<OText>{offer.name}</OText>
|
|
316
|
+
{offer.rate_type === 1 && (
|
|
317
|
+
<OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
|
|
318
|
+
)}
|
|
319
|
+
</OSRow>
|
|
320
|
+
<OText>
|
|
321
|
+
- {parsePrice(offer?.summary?.discount)}
|
|
322
|
+
</OText>
|
|
323
|
+
</OSTable>
|
|
324
|
+
))
|
|
325
|
+
}
|
|
244
326
|
{cart?.driver_tip > 0 && (
|
|
245
327
|
<OSTable>
|
|
246
328
|
<OText>
|
|
247
329
|
{t('DRIVER_TIP', 'Driver tip')}
|
|
248
330
|
{cart?.driver_tip_rate > 0 &&
|
|
249
331
|
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
250
|
-
|
|
332
|
+
!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
251
333
|
(
|
|
252
|
-
`(${
|
|
334
|
+
`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
|
|
253
335
|
)}
|
|
254
336
|
</OText>
|
|
255
337
|
<OText>{parsePrice(cart?.driver_tip)}</OText>
|
|
256
338
|
</OSTable>
|
|
257
339
|
)}
|
|
258
|
-
{cart?.service_fee > 0 && (
|
|
259
|
-
<OSTable>
|
|
260
|
-
<OText>
|
|
261
|
-
{t('SERVICE_FEE', 'Service Fee')}
|
|
262
|
-
{`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
|
|
263
|
-
</OText>
|
|
264
|
-
<OText>{parsePrice(cart?.service_fee)}</OText>
|
|
265
|
-
</OSTable>
|
|
266
|
-
)}
|
|
267
340
|
{!cart?.discount_type && isCouponEnabled && !isCartPending && orientationState?.orientation == PORTRAIT && (
|
|
268
341
|
<OSTable>
|
|
269
342
|
<OSCoupon>
|
|
@@ -279,7 +352,7 @@ const CartUI = (props: any) => {
|
|
|
279
352
|
{t('TOTAL', 'Total')}
|
|
280
353
|
</OText>
|
|
281
354
|
<OText weight='bold' color={theme.colors.primary}>
|
|
282
|
-
{cart?.total >=
|
|
355
|
+
{parsePrice(cart?.total >= 0 ? cart?.total : 0)}
|
|
283
356
|
</OText>
|
|
284
357
|
</OSTable>
|
|
285
358
|
</OSBill>
|
|
@@ -379,7 +452,7 @@ const CartUI = (props: any) => {
|
|
|
379
452
|
<ProductForm
|
|
380
453
|
productCart={curProduct}
|
|
381
454
|
businessSlug={cart?.business?.slug}
|
|
382
|
-
businessId={
|
|
455
|
+
businessId={curProduct?.business_id}
|
|
383
456
|
categoryId={curProduct?.category_id}
|
|
384
457
|
productId={curProduct?.id}
|
|
385
458
|
onSave={handlerProductAction}
|
|
@@ -62,6 +62,10 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const handleEditProduct = (product: any) => {
|
|
65
|
+
if (props.onEditProduct) {
|
|
66
|
+
props.onEditProduct(product)
|
|
67
|
+
return
|
|
68
|
+
}
|
|
65
69
|
setCurProduct(product)
|
|
66
70
|
setModalIsOpen(true)
|
|
67
71
|
}
|
|
@@ -148,7 +152,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
148
152
|
<StyledBottomContent
|
|
149
153
|
style={{bottom:10}}
|
|
150
154
|
minHeight={props.height * 0.01}
|
|
151
|
-
>
|
|
155
|
+
>
|
|
152
156
|
<OButton
|
|
153
157
|
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
154
158
|
!openUpselling !== canOpenUpselling ? `${t('CHECKOUT', 'Checkout')} ${parsePrice(cart?.total)}`: t('LOADING', 'Loading')
|
|
@@ -198,6 +202,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
198
202
|
canOpenUpselling={canOpenUpselling}
|
|
199
203
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
200
204
|
onClose={onCloseUpselling}
|
|
205
|
+
onAddProduct={props.onAddProduct}
|
|
201
206
|
resetInactivityTimeout={resetInactivityTimeout}
|
|
202
207
|
/>
|
|
203
208
|
)}
|
|
@@ -231,7 +236,7 @@ const TopBar = (props:any) => {
|
|
|
231
236
|
<OIconButton
|
|
232
237
|
bgColor="transparent"
|
|
233
238
|
borderColor="transparent"
|
|
234
|
-
RenderIcon={() =>
|
|
239
|
+
RenderIcon={() =>
|
|
235
240
|
<EvilIcons
|
|
236
241
|
name={'close'}
|
|
237
242
|
size={40}
|
|
@@ -260,6 +265,8 @@ interface CartBottomSheetUIProps {
|
|
|
260
265
|
onNavigationRedirect: any,
|
|
261
266
|
clearInactivityTimeout: any,
|
|
262
267
|
resetInactivityTimeout: any,
|
|
268
|
+
onEditProduct: any,
|
|
269
|
+
onAddProduct: any,
|
|
263
270
|
}
|
|
264
271
|
|
|
265
272
|
export const CartBottomSheet = (props: any) => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { useLanguage } from 'ordering-components/native';
|
|
3
2
|
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
4
|
-
import { CCNotCarts } from './styles';
|
|
5
3
|
|
|
6
4
|
import { Cart } from '../Cart';
|
|
7
|
-
import { OText } from '../shared';
|
|
8
5
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
9
6
|
import { Cart as TypeCart } from '../../types';
|
|
10
7
|
|
|
@@ -20,7 +17,6 @@ export const CartContent = (props: any) => {
|
|
|
20
17
|
resetInactivityTimeout,
|
|
21
18
|
}: Props = props
|
|
22
19
|
|
|
23
|
-
const [, t] = useLanguage()
|
|
24
20
|
const [isCartsLoading, setIsCartsLoading] = useState(false)
|
|
25
21
|
const [, { hideCartBottomSheet }] = useCartBottomSheet();
|
|
26
22
|
|
|
@@ -56,13 +52,6 @@ export const CartContent = (props: any) => {
|
|
|
56
52
|
}
|
|
57
53
|
</>
|
|
58
54
|
)}
|
|
59
|
-
{/* {(!cart && showNotFound) && (
|
|
60
|
-
<CCNotCarts>
|
|
61
|
-
<OText size={24} style={{ textAlign: 'center' }}>
|
|
62
|
-
{t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
|
|
63
|
-
</OText>
|
|
64
|
-
</CCNotCarts>
|
|
65
|
-
)} */}
|
|
66
55
|
<Spinner visible={isCartsLoading} />
|
|
67
56
|
</>
|
|
68
57
|
)
|
|
@@ -56,9 +56,10 @@ const CartItem = (props: CartItemProps) => {
|
|
|
56
56
|
return product
|
|
57
57
|
}
|
|
58
58
|
const isProductIngredients = productInfo()?.ingredients.length > 0 || productInfo()?.options.length > 0 || product?.comment
|
|
59
|
-
const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price:
|
|
59
|
+
const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: any }) => {
|
|
60
60
|
const pos = position ? `(${position})` : ''
|
|
61
|
-
|
|
61
|
+
const str = `${quantity} x ${name} ${pos}`
|
|
62
|
+
return price ? `${str} ${price}` : str
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
return (
|
|
@@ -184,7 +185,7 @@ const CartItem = (props: CartItemProps) => {
|
|
|
184
185
|
quantity: suboption.quantity,
|
|
185
186
|
name: suboption.name,
|
|
186
187
|
position: (suboption.position !== 'whole') ? t(suboption.position.toUpperCase(), suboption.position) : '',
|
|
187
|
-
price: parsePrice(suboption.price)
|
|
188
|
+
price: suboption.price > 0 && `+${parsePrice(suboption.price)}`
|
|
188
189
|
})}
|
|
189
190
|
</OText>
|
|
190
191
|
</ProductSubOption>
|