ordering-ui-react-native 0.14.44 → 0.14.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +14 -21
- package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
- package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
- package/themes/kiosk/src/components/Intro/index.tsx +4 -4
- package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +100 -75
- package/themes/original/src/components/ProductForm/index.tsx +54 -52
- package/themes/original/src/components/SingleProductCard/index.tsx +21 -11
- package/themes/original/src/components/SingleProductCard/styles.tsx +4 -0
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
138
138
|
</View>
|
|
139
139
|
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
140
140
|
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
141
|
-
{
|
|
141
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
142
142
|
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
143
143
|
)}
|
|
144
144
|
</View>
|
|
@@ -86,7 +86,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
86
86
|
<OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
|
|
87
87
|
<PricesContainer>
|
|
88
88
|
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
89
|
-
{
|
|
89
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
90
90
|
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
91
91
|
)}
|
|
92
92
|
</PricesContainer>
|
|
@@ -21,10 +21,10 @@ import { Cart as TypeCart } from '../../types';
|
|
|
21
21
|
import CartItem from '../CartItem';
|
|
22
22
|
import NavBar from '../NavBar';
|
|
23
23
|
import { CouponControl } from '../CouponControl';
|
|
24
|
-
import { LANDSCAPE, PORTRAIT, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
|
|
24
|
+
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
|
|
25
25
|
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
26
26
|
import { Container } from '../../../../../src/layouts/Container';
|
|
27
|
-
|
|
27
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
28
28
|
const CartUI = (props: any) => {
|
|
29
29
|
const {
|
|
30
30
|
cart,
|
|
@@ -35,7 +35,7 @@ const CartUI = (props: any) => {
|
|
|
35
35
|
removeProduct,
|
|
36
36
|
setIsCartsLoading,
|
|
37
37
|
navigation,
|
|
38
|
-
}
|
|
38
|
+
}: CartUIProps = props
|
|
39
39
|
|
|
40
40
|
const theme = useTheme()
|
|
41
41
|
const [, t] = useLanguage()
|
|
@@ -83,8 +83,8 @@ const CartUI = (props: any) => {
|
|
|
83
83
|
|
|
84
84
|
const handleChangeOrderType = () => {
|
|
85
85
|
navigation.push('DeliveryType', {
|
|
86
|
-
callback
|
|
87
|
-
goBack: () => {navigation.pop(1)},
|
|
86
|
+
callback: () => { navigation.pop(1) },
|
|
87
|
+
goBack: () => { navigation.pop(1) },
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -97,7 +97,7 @@ const CartUI = (props: any) => {
|
|
|
97
97
|
title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
|
|
98
98
|
onActionLeft={goToBack}
|
|
99
99
|
style={{ height: orientationState?.dimensions?.height * 0.08 }}
|
|
100
|
-
btnStyle={{paddingLeft: 0}}
|
|
100
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
101
101
|
rightComponent={(
|
|
102
102
|
<OButton
|
|
103
103
|
text={t('CANCEL_ORDER', 'Cancel order')}
|
|
@@ -183,6 +183,7 @@ const CartUI = (props: any) => {
|
|
|
183
183
|
</OText>
|
|
184
184
|
</OSTable>
|
|
185
185
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
|
|
186
|
+
|
|
186
187
|
<OSTable
|
|
187
188
|
style={{
|
|
188
189
|
backgroundColor: theme.colors.success,
|
|
@@ -197,10 +198,7 @@ const CartUI = (props: any) => {
|
|
|
197
198
|
flexDirection: 'row',
|
|
198
199
|
}}
|
|
199
200
|
>
|
|
200
|
-
<
|
|
201
|
-
src={theme.images.general.check_decagram}
|
|
202
|
-
/>
|
|
203
|
-
|
|
201
|
+
<AntDesignIcon name='checkcircle' size={24} color='#00D27A' />
|
|
204
202
|
{cart?.discount_type === 1 ? (
|
|
205
203
|
<OText
|
|
206
204
|
mLeft={15}
|
|
@@ -219,8 +217,6 @@ const CartUI = (props: any) => {
|
|
|
219
217
|
</OText>
|
|
220
218
|
)}
|
|
221
219
|
</View>
|
|
222
|
-
|
|
223
|
-
|
|
224
220
|
<OText
|
|
225
221
|
size={16}
|
|
226
222
|
color={theme.colors.green}
|
|
@@ -252,9 +248,9 @@ const CartUI = (props: any) => {
|
|
|
252
248
|
{cart?.driver_tip_rate > 0 &&
|
|
253
249
|
parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
|
|
254
250
|
!!!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
(
|
|
252
|
+
`(${parseNumber(cart?.driver_tip_rate)}%)`
|
|
253
|
+
)}
|
|
258
254
|
</OText>
|
|
259
255
|
<OText>{parsePrice(cart?.driver_tip)}</OText>
|
|
260
256
|
</OSTable>
|
|
@@ -294,7 +290,7 @@ const CartUI = (props: any) => {
|
|
|
294
290
|
<>
|
|
295
291
|
<FloatingLayout isIos={Platform.OS === 'ios'}>
|
|
296
292
|
<CheckoutAction>
|
|
297
|
-
<View style={{display: 'flex', flexDirection: 'row'}}>
|
|
293
|
+
<View style={{ display: 'flex', flexDirection: 'row' }}>
|
|
298
294
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == LANDSCAPE && (
|
|
299
295
|
<OSTable
|
|
300
296
|
style={{
|
|
@@ -311,10 +307,7 @@ const CartUI = (props: any) => {
|
|
|
311
307
|
flexDirection: 'row',
|
|
312
308
|
}}
|
|
313
309
|
>
|
|
314
|
-
<
|
|
315
|
-
src={theme.images.general.check_decagram}
|
|
316
|
-
/>
|
|
317
|
-
|
|
310
|
+
<AntDesignIcon name='checkcircle' size={24} color='#00D27A' />
|
|
318
311
|
{cart?.discount_type === 1 ? (
|
|
319
312
|
<OText
|
|
320
313
|
mLeft={15}
|
|
@@ -369,7 +362,7 @@ const CartUI = (props: any) => {
|
|
|
369
362
|
imgRightSrc={null}
|
|
370
363
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
371
364
|
onClick={() => { navigation?.navigate('CustomerName', { cartUuid: cart?.uuid }) }}
|
|
372
|
-
style={{width: '100%', marginTop: 4}}
|
|
365
|
+
style={{ width: '100%', marginTop: 4 }}
|
|
373
366
|
/>
|
|
374
367
|
</View>
|
|
375
368
|
</View>
|
|
@@ -16,6 +16,7 @@ import { Product } from '../../types';
|
|
|
16
16
|
import QuantityControl from '../QuantityControl';
|
|
17
17
|
import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
18
18
|
import { useTheme } from 'styled-components/native';
|
|
19
|
+
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'
|
|
19
20
|
|
|
20
21
|
const CartItem = (props: CartItemProps) => {
|
|
21
22
|
const theme = useTheme()
|
|
@@ -97,7 +98,6 @@ const CartItem = (props: CartItemProps) => {
|
|
|
97
98
|
<OButton
|
|
98
99
|
bgColor="transparent"
|
|
99
100
|
borderColor="transparent"
|
|
100
|
-
imgLeftSrc={theme.images.general.edit}
|
|
101
101
|
text={t('EDIT', 'Edit')}
|
|
102
102
|
style={{ justifyContent: 'flex-start', paddingLeft: 0, maxWidth: 80 }}
|
|
103
103
|
textStyle={{
|
|
@@ -105,16 +105,18 @@ const CartItem = (props: CartItemProps) => {
|
|
|
105
105
|
marginLeft: 6,
|
|
106
106
|
}}
|
|
107
107
|
onClick={() => { onEditProduct ? onEditProduct(product) : null }}
|
|
108
|
+
iconProps={{ name: 'edit' }}
|
|
109
|
+
IconCustom={() => <FontAwesomeIcon name='edit' size={24} color={theme.colors.primary} />}
|
|
108
110
|
/>
|
|
109
111
|
<OIconButton
|
|
110
112
|
bgColor="transparent"
|
|
111
113
|
borderColor="transparent"
|
|
112
|
-
RenderIcon={isProductIngredients && (() =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
RenderIcon={isProductIngredients && (() =>
|
|
115
|
+
<EvilIcons
|
|
116
|
+
name={isActive ? 'chevron-up' : 'chevron-down'}
|
|
117
|
+
size={40}
|
|
118
|
+
color={theme.colors.primary}
|
|
119
|
+
/>
|
|
118
120
|
)}
|
|
119
121
|
style={{ justifyContent: 'flex-start', right: 40 }}
|
|
120
122
|
onClick={() => (!product?.valid_menu && isCartProduct)
|
|
@@ -72,12 +72,13 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
72
72
|
<OButton
|
|
73
73
|
text={t('SKIP', 'Skip')}
|
|
74
74
|
onClick={onProceedToPay}
|
|
75
|
-
textStyle={{color: theme.colors.
|
|
75
|
+
textStyle={{color: theme.colors.primary, fontSize: 20}}
|
|
76
76
|
parentStyle={{
|
|
77
77
|
height: orientationState?.orientation === PORTRAIT
|
|
78
78
|
? 50 : 100
|
|
79
79
|
}}
|
|
80
80
|
style={{
|
|
81
|
+
backgroundColor: theme.colors.white,
|
|
81
82
|
width: orientationState?.orientation === PORTRAIT
|
|
82
83
|
? orientationState?.dimensions.width - 40
|
|
83
84
|
: orientationState?.dimensions.width * 0.1,
|
|
@@ -8,7 +8,7 @@ import OImage from '../../components/shared/OImage';
|
|
|
8
8
|
import OButton from '../../components/shared/OButton';
|
|
9
9
|
import { LanguageSelector } from '../../components/LanguageSelector';
|
|
10
10
|
import { LogoutPopup } from '../../components/LogoutPopup';
|
|
11
|
-
import {PORTRAIT, LANDSCAPE, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
|
|
11
|
+
import { PORTRAIT, LANDSCAPE, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
|
|
12
12
|
|
|
13
13
|
const Intro = (props: any): React.ReactElement => {
|
|
14
14
|
const { navigation } = props;
|
|
@@ -87,7 +87,7 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
87
87
|
source={theme.images.general.homeHeroLandscape}
|
|
88
88
|
width={orientationState?.dimensions?.width * 0.40}
|
|
89
89
|
height={orientationState?.dimensions?.height * 1.1}
|
|
90
|
-
style={{bottom: 100, right: 100}}
|
|
90
|
+
style={{ bottom: 100, right: 100 }}
|
|
91
91
|
resizeMode='cover'
|
|
92
92
|
/>
|
|
93
93
|
|
|
@@ -114,7 +114,7 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
114
114
|
|
|
115
115
|
<OButton
|
|
116
116
|
style={styles.buttonLandStyle}
|
|
117
|
-
text={t('
|
|
117
|
+
text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
|
|
118
118
|
parentStyle={{
|
|
119
119
|
alignItems: 'center',
|
|
120
120
|
width: orientationState?.dimensions?.width - _offset
|
|
@@ -138,7 +138,7 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
138
138
|
|
|
139
139
|
const styles = StyleSheet.create({
|
|
140
140
|
buttonLandStyle: {
|
|
141
|
-
width:
|
|
141
|
+
width: 290,
|
|
142
142
|
marginBottom: 16
|
|
143
143
|
}
|
|
144
144
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { ImageSourcePropType, ImageStyle, TextStyle, ViewStyle, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
@@ -28,11 +28,15 @@ const OptionCard = (props: Props) => {
|
|
|
28
28
|
<ActivityIndicator size='large' color='#ffffff' />
|
|
29
29
|
</ActivityIndicatorContainer>
|
|
30
30
|
)}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
{props.icon && (
|
|
32
|
+
<OIcon
|
|
33
|
+
src={props.icon}
|
|
34
|
+
style={{ marginBottom: 10, ...props?.iconStyle }}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
{props.VectorIcon && (
|
|
38
|
+
<props.VectorIcon />
|
|
39
|
+
)}
|
|
36
40
|
<OText
|
|
37
41
|
weight="700"
|
|
38
42
|
color="white"
|
|
@@ -97,6 +101,7 @@ interface Props {
|
|
|
97
101
|
callToActionTextStyle?: TextStyle;
|
|
98
102
|
callToActionIcon?: ImageSourcePropType;
|
|
99
103
|
callToActionIconStyle?: ImageStyle;
|
|
104
|
+
VectorIcon?: FunctionComponent;
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
export default OptionCard;
|
|
@@ -19,6 +19,8 @@ import Spinner from 'react-native-loading-spinner-overlay';
|
|
|
19
19
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
20
20
|
import GridContainer from '../../layouts/GridContainer';
|
|
21
21
|
import { OModal, PaymentOptionStripe } from '../../../../../src';
|
|
22
|
+
import AntIconDesign from 'react-native-vector-icons/AntDesign'
|
|
23
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
22
24
|
|
|
23
25
|
const PaymentOptionsUI = (props: any) => {
|
|
24
26
|
const {
|
|
@@ -41,7 +43,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
41
43
|
} = props;
|
|
42
44
|
|
|
43
45
|
const theme = useTheme();
|
|
44
|
-
const [, {showToast}] = useToast();
|
|
46
|
+
const [, { showToast }] = useToast();
|
|
45
47
|
const [, t] = useLanguage();
|
|
46
48
|
const [orientationState] = useDeviceOrientation();
|
|
47
49
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -134,52 +136,52 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
134
136
|
CASH_ID:
|
|
135
137
|
cashIndex !== -1
|
|
136
138
|
? {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
style: cardStyle,
|
|
140
|
+
title: t('CASH', 'Cash'),
|
|
141
|
+
description: t(
|
|
142
|
+
'GO_FOR_YOR_RECEIPT_AND_GO_TO_THE_FRONT_COUNTER',
|
|
143
|
+
'Pay with cash in the front counter',
|
|
144
|
+
),
|
|
145
|
+
bgImage: theme.images.general.cash,
|
|
146
|
+
callToActionText: t('LETS_GO', 'LETS_GO'),
|
|
147
|
+
VectorIcon: () => <AntIconDesign name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
148
|
+
onClick: () =>
|
|
149
|
+
onSelectPaymethod(supportedMethods[cashIndex], false),
|
|
150
|
+
...supportedMethods[cashIndex],
|
|
151
|
+
}
|
|
150
152
|
: null,
|
|
151
153
|
|
|
152
154
|
CARD_ON_DELIVERY_ID:
|
|
153
155
|
cardOnDeliveryIndex !== -1
|
|
154
156
|
? {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
style: cardStyle,
|
|
158
|
+
title: t('CARD', supportedMethods[cardOnDeliveryIndex]?.name),
|
|
159
|
+
description: t(
|
|
160
|
+
'WE_ACCEPT_EVERY_DEBIT_OR_CREDIT_CARD',
|
|
161
|
+
'We accept every debit or credit card',
|
|
162
|
+
),
|
|
163
|
+
bgImage: theme.images.general.carddelivery,
|
|
164
|
+
callToActionText: t("LETS_GO", "Let's go"),
|
|
165
|
+
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
166
|
+
onClick: () => onSelectPaymethod(supportedMethods[cardOnDeliveryIndex], false),
|
|
167
|
+
...supportedMethods[cardOnDeliveryIndex],
|
|
168
|
+
}
|
|
167
169
|
: null,
|
|
168
170
|
STRIPE:
|
|
169
171
|
stripeIndex !== -1
|
|
170
172
|
? {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
173
|
+
style: cardStyle,
|
|
174
|
+
title: t('STRIPE', supportedMethods[stripeIndex]?.name),
|
|
175
|
+
description: t('STRIPE', 'Stripe'),
|
|
176
|
+
bgImage: theme.images.general.carddelivery,
|
|
177
|
+
callToActionText: t('INSERT_INFO', 'Test info'),
|
|
178
|
+
VectorIcon: () => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
onSelectPaymethod(supportedMethods[stripeIndex], false);
|
|
181
|
+
setIsOpenModal(true)
|
|
182
|
+
},
|
|
183
|
+
...supportedMethods[stripeIndex],
|
|
184
|
+
}
|
|
183
185
|
: null,
|
|
184
186
|
};
|
|
185
187
|
|
|
@@ -193,11 +195,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
193
195
|
<NavBar
|
|
194
196
|
title={t('PAYMENT_METHODS', 'Payment methods')}
|
|
195
197
|
onActionLeft={goToBack}
|
|
196
|
-
btnStyle={{paddingLeft: 0}}
|
|
198
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
197
199
|
/>
|
|
198
200
|
|
|
199
201
|
<View
|
|
200
|
-
style={{marginVertical: orientationState?.dimensions?.height * 0.03}}>
|
|
202
|
+
style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
201
203
|
<OText size={orientationState?.dimensions?.width * 0.048}>
|
|
202
204
|
{t('HOW_WOULD_YOU', 'How would you')} {'\n'}
|
|
203
205
|
<OText
|
|
@@ -209,10 +211,10 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
209
211
|
</View>
|
|
210
212
|
|
|
211
213
|
{supportedMethods?.length > 0 && (
|
|
212
|
-
<GridContainer style={{justifyContent: 'space-between'}}>
|
|
214
|
+
<GridContainer style={{ justifyContent: 'space-between' }}>
|
|
213
215
|
{propsOfItems.CARD_ON_DELIVERY_ID && (
|
|
214
|
-
<View style={{marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0}}>
|
|
215
|
-
<OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke/>
|
|
216
|
+
<View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
|
|
217
|
+
<OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
|
|
216
218
|
</View>
|
|
217
219
|
)}
|
|
218
220
|
|
|
@@ -249,7 +251,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
249
251
|
)}
|
|
250
252
|
</GridContainer>
|
|
251
253
|
)}
|
|
252
|
-
<View style={{height: orientationState?.dimensions?.height * 0.05}} />
|
|
254
|
+
<View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
|
|
253
255
|
<OModal
|
|
254
256
|
open={isOpenModal}
|
|
255
257
|
onClose={() => setIsOpenModal(false)}
|
|
@@ -139,17 +139,20 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
139
139
|
)}
|
|
140
140
|
</BIActions>
|
|
141
141
|
</BIHeader>
|
|
142
|
-
{!isActive && !isClosed && !!isProducts &&
|
|
142
|
+
{!isActive && !isClosed && !!isProducts && (
|
|
143
143
|
<PriceContainer>
|
|
144
144
|
<OText>{parsePrice(cart?.total)}</OText>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
{cart?.valid_products && (
|
|
146
|
+
<OButton
|
|
147
|
+
onClick={handleClickCheckout}
|
|
148
|
+
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
149
|
+
style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
150
|
+
text={t('CHECKOUT', 'Checkout')}
|
|
151
|
+
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
152
|
+
borderColor={theme.colors.primary}
|
|
153
|
+
isDisabled={checkoutButtonDisabled}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
153
156
|
</PriceContainer>
|
|
154
157
|
)}
|
|
155
158
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ScrollView,
|
|
8
8
|
Platform,
|
|
9
9
|
TouchableOpacity,
|
|
10
|
+
RefreshControl
|
|
10
11
|
} from 'react-native';
|
|
11
12
|
import {
|
|
12
13
|
BusinessList as BusinessesListingController,
|
|
@@ -57,11 +58,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
57
58
|
handleBusinessClick,
|
|
58
59
|
paginationProps,
|
|
59
60
|
handleChangeSearch,
|
|
60
|
-
|
|
61
|
+
businessId
|
|
61
62
|
} = props;
|
|
62
63
|
|
|
63
64
|
const theme = useTheme();
|
|
64
65
|
const isFocused = useIsFocused();
|
|
66
|
+
const [refreshing] = useState(false);
|
|
65
67
|
|
|
66
68
|
const styles = StyleSheet.create({
|
|
67
69
|
container: {
|
|
@@ -142,15 +144,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
142
144
|
};
|
|
143
145
|
|
|
144
146
|
const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
const R = 6371 // km
|
|
148
|
+
const dLat = convertToRadian(lat2 - lat1)
|
|
149
|
+
const dLon = convertToRadian(lon2 - lon1)
|
|
150
|
+
const curLat1 = convertToRadian(lat1)
|
|
151
|
+
const curLat2 = convertToRadian(lat2)
|
|
152
|
+
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(curLat1) * Math.cos(curLat2)
|
|
153
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
|
154
|
+
return R * c
|
|
155
|
+
}
|
|
154
156
|
|
|
155
157
|
useEffect(() => {
|
|
156
158
|
if (businessesList.businesses.length > 0) {
|
|
@@ -162,6 +164,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
162
164
|
setFeaturedBusinesses(ary);
|
|
163
165
|
}
|
|
164
166
|
}, [businessesList.businesses]);
|
|
167
|
+
|
|
165
168
|
// const resetInactivityTimeout = () => {
|
|
166
169
|
// clearTimeout(timerId.current)
|
|
167
170
|
// timerId.current = setInterval(() => {
|
|
@@ -173,21 +176,37 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
173
176
|
// resetInactivityTimeout()
|
|
174
177
|
// }, [])
|
|
175
178
|
|
|
179
|
+
const handleOnRefresh = () => {
|
|
180
|
+
const hasMore = !(
|
|
181
|
+
paginationProps.totalPages === paginationProps.currentPage
|
|
182
|
+
);
|
|
183
|
+
if (!businessesList.loading && hasMore) {
|
|
184
|
+
getBusinesses();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
176
188
|
useEffect(() => {
|
|
177
189
|
Geolocation.getCurrentPosition((pos) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
const crd = pos.coords
|
|
191
|
+
const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
|
|
192
|
+
if (distance > 20) setIsFarAway(true)
|
|
181
193
|
else setIsFarAway(false)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
}, (err) => {
|
|
195
|
+
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
196
|
+
}, {
|
|
197
|
+
enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
198
|
+
})
|
|
199
|
+
}, [orderState?.options?.address?.location])
|
|
188
200
|
|
|
189
201
|
return (
|
|
190
|
-
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
202
|
+
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
203
|
+
refreshControl={
|
|
204
|
+
<RefreshControl
|
|
205
|
+
refreshing={refreshing}
|
|
206
|
+
onRefresh={() => handleOnRefresh()}
|
|
207
|
+
/>
|
|
208
|
+
}
|
|
209
|
+
>
|
|
191
210
|
<HeaderWrapper
|
|
192
211
|
source={theme.images.backgrounds.business_list_header}
|
|
193
212
|
style={{ paddingTop: top + 20 }}>
|
|
@@ -257,72 +276,78 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
257
276
|
/>
|
|
258
277
|
</WrapMomentOption>
|
|
259
278
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
279
|
+
{!businessId && (
|
|
280
|
+
<SearchBar
|
|
281
|
+
onSearch={handleChangeSearch}
|
|
282
|
+
searchValue={searchValue}
|
|
283
|
+
lazyLoad
|
|
284
|
+
isCancelXButtonShow={!!searchValue}
|
|
285
|
+
borderStyle={styles.borderStyle}
|
|
286
|
+
onCancel={() => handleChangeSearch('')}
|
|
287
|
+
placeholder={t('SEARCH', 'Search')}
|
|
288
|
+
height={26}
|
|
289
|
+
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
290
|
+
/>
|
|
291
|
+
)}
|
|
273
292
|
|
|
274
293
|
</View>
|
|
275
294
|
</OrderControlContainer>
|
|
276
295
|
</HeaderWrapper>
|
|
277
|
-
{
|
|
278
|
-
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
handleCustomClick={handleBusinessClick}
|
|
297
|
-
orderType={orderState?.options?.type}
|
|
298
|
-
/>
|
|
299
|
-
{bAry.length > 1 && (
|
|
296
|
+
{
|
|
297
|
+
isFocused && (
|
|
298
|
+
<OrderProgressWrapper>
|
|
299
|
+
<OrderProgress
|
|
300
|
+
{...props}
|
|
301
|
+
/>
|
|
302
|
+
</OrderProgressWrapper>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
{
|
|
306
|
+
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
307
|
+
<FeaturedWrapper>
|
|
308
|
+
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
|
|
309
|
+
<ScrollView
|
|
310
|
+
showsHorizontalScrollIndicator={false}
|
|
311
|
+
nestedScrollEnabled
|
|
312
|
+
horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
|
|
313
|
+
{featuredBusiness.map((bAry: any, idx) => (
|
|
314
|
+
<View key={'f-listing_' + idx}>
|
|
300
315
|
<BusinessFeaturedController
|
|
301
|
-
key={bAry[
|
|
302
|
-
business={bAry[
|
|
316
|
+
key={bAry[0].id}
|
|
317
|
+
business={bAry[0]}
|
|
303
318
|
handleCustomClick={handleBusinessClick}
|
|
304
319
|
orderType={orderState?.options?.type}
|
|
305
320
|
/>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
321
|
+
{bAry.length > 1 && (
|
|
322
|
+
<BusinessFeaturedController
|
|
323
|
+
key={bAry[1].id}
|
|
324
|
+
business={bAry[1]}
|
|
325
|
+
handleCustomClick={handleBusinessClick}
|
|
326
|
+
orderType={orderState?.options?.type}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
329
|
+
</View>
|
|
330
|
+
))}
|
|
331
|
+
</ScrollView>
|
|
332
|
+
</FeaturedWrapper>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
312
335
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
336
|
+
{
|
|
337
|
+
!businessId && !props.franchiseId && (
|
|
338
|
+
<HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
|
|
339
|
+
)
|
|
340
|
+
}
|
|
316
341
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
317
342
|
<ListWrapper>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
343
|
+
{!businessId && (
|
|
344
|
+
<BusinessTypeFilter
|
|
345
|
+
images={props.images}
|
|
346
|
+
businessTypes={props.businessTypes}
|
|
347
|
+
defaultBusinessType={props.defaultBusinessType}
|
|
348
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
349
|
+
/>
|
|
350
|
+
)}
|
|
326
351
|
{!businessesList.loading && businessesList.businesses.length === 0 && (
|
|
327
352
|
<NotFoundSource
|
|
328
353
|
content={t(
|
|
@@ -289,16 +289,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
289
289
|
</>
|
|
290
290
|
);
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
const handleGoBack = navigation?.canGoBack()
|
|
293
|
+
? () => navigation.goBack()
|
|
294
|
+
: () => navigation.navigate('Business', { store: props.businessSlug })
|
|
295
295
|
|
|
296
296
|
return (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
298
|
+
<TopHeader>
|
|
299
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
300
|
+
<OIcon src={theme.images.general.arrow_left} width={15} />
|
|
301
|
+
</TopActions>
|
|
302
302
|
</TopHeader>
|
|
303
303
|
<ScrollView>
|
|
304
304
|
{!error && (
|
|
@@ -349,13 +349,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
349
349
|
style={styles.slide1}
|
|
350
350
|
key={i}
|
|
351
351
|
>
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
352
|
+
<FastImage
|
|
353
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
|
|
354
|
+
source={{
|
|
355
|
+
uri: optimizeImage(img, 'h_258,c_limit'),
|
|
356
|
+
priority: FastImage.priority.normal,
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
359
|
</View>
|
|
360
360
|
))}
|
|
361
361
|
</Swiper>
|
|
@@ -379,18 +379,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
379
379
|
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
380
380
|
}}
|
|
381
381
|
>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
382
|
+
<OIcon
|
|
383
|
+
url={img}
|
|
384
|
+
style={{
|
|
385
|
+
borderColor: theme.colors.lightGray,
|
|
386
|
+
borderRadius: 8,
|
|
387
|
+
minHeight: '100%',
|
|
388
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
389
|
+
}}
|
|
390
|
+
width={56}
|
|
391
|
+
height={56}
|
|
392
|
+
cover
|
|
393
|
+
/>
|
|
394
394
|
</View>
|
|
395
395
|
</TouchableOpacity>
|
|
396
396
|
|
|
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
446
446
|
) : (
|
|
447
447
|
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
448
448
|
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
449
|
-
{
|
|
449
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
450
450
|
<OText style={{
|
|
451
451
|
fontSize: 14,
|
|
452
452
|
color: '#808080',
|
|
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
460
460
|
</>
|
|
461
461
|
)}
|
|
462
462
|
</ProductTitle>
|
|
463
|
-
|
|
463
|
+
<ProductDescription>
|
|
464
464
|
<OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
|
|
465
465
|
{product?.description || productCart?.description}
|
|
466
466
|
</OText>
|
|
@@ -785,7 +785,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
785
785
|
<OText
|
|
786
786
|
size={12}
|
|
787
787
|
lineHeight={18}
|
|
788
|
-
style={{ minWidth:
|
|
788
|
+
style={{ minWidth: 40, textAlign: 'center' }}
|
|
789
789
|
>
|
|
790
790
|
{qtyBy?.pieces && productCart.quantity}
|
|
791
791
|
{qtyBy?.weight_unit && productCart.quantity * product?.weight}
|
|
@@ -809,36 +809,38 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
809
809
|
}
|
|
810
810
|
/>
|
|
811
811
|
</TouchableOpacity>
|
|
812
|
-
|
|
813
|
-
<
|
|
814
|
-
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
815
|
-
>
|
|
816
|
-
<WeightUnitItem active={qtyBy?.pieces}>
|
|
817
|
-
<OText
|
|
818
|
-
size={12}
|
|
819
|
-
lineHeight={18}
|
|
820
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
821
|
-
>
|
|
822
|
-
{t('PIECES', 'pieces')}
|
|
823
|
-
</OText>
|
|
824
|
-
</WeightUnitItem>
|
|
825
|
-
</TouchableOpacity>
|
|
826
|
-
<View style={{ alignItems: 'flex-start' }}>
|
|
812
|
+
{isHaveWeight && (
|
|
813
|
+
<WeightUnitSwitch>
|
|
827
814
|
<TouchableOpacity
|
|
828
|
-
onPress={() => handleSwitchQtyUnit('
|
|
815
|
+
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
829
816
|
>
|
|
830
|
-
<WeightUnitItem active={qtyBy?.
|
|
817
|
+
<WeightUnitItem active={qtyBy?.pieces}>
|
|
831
818
|
<OText
|
|
832
819
|
size={12}
|
|
833
820
|
lineHeight={18}
|
|
834
|
-
color={qtyBy?.
|
|
821
|
+
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
835
822
|
>
|
|
836
|
-
{
|
|
823
|
+
{t('PIECES', 'pcs')}
|
|
837
824
|
</OText>
|
|
838
825
|
</WeightUnitItem>
|
|
839
826
|
</TouchableOpacity>
|
|
840
|
-
|
|
841
|
-
|
|
827
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
828
|
+
<TouchableOpacity
|
|
829
|
+
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
830
|
+
>
|
|
831
|
+
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
832
|
+
<OText
|
|
833
|
+
size={12}
|
|
834
|
+
lineHeight={18}
|
|
835
|
+
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
836
|
+
>
|
|
837
|
+
{product?.weight_unit}
|
|
838
|
+
</OText>
|
|
839
|
+
</WeightUnitItem>
|
|
840
|
+
</TouchableOpacity>
|
|
841
|
+
</View>
|
|
842
|
+
</WeightUnitSwitch>
|
|
843
|
+
)}
|
|
842
844
|
</View>
|
|
843
845
|
)}
|
|
844
846
|
<View
|
|
@@ -907,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
907
909
|
</View>
|
|
908
910
|
</ProductActions>
|
|
909
911
|
)}
|
|
910
|
-
|
|
912
|
+
</SafeAreaView>
|
|
911
913
|
);
|
|
912
914
|
};
|
|
913
915
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
@@ -51,6 +51,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
51
51
|
textAlign: 'center',
|
|
52
52
|
borderRadius: 25,
|
|
53
53
|
alignItems: 'center'
|
|
54
|
+
},
|
|
55
|
+
regularPriceStyle: {
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
color: '#808080',
|
|
58
|
+
textDecorationLine: 'line-through',
|
|
59
|
+
marginLeft: 7,
|
|
60
|
+
marginRight: 7
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
|
|
@@ -97,13 +104,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
97
104
|
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
98
105
|
]}
|
|
99
106
|
onPress={() => onProductClick?.(product)}>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
{productAddedToCartLength > 0 && (
|
|
108
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
109
|
+
transform: [{ translateX: 10 }, { translateY: -10 }],
|
|
110
|
+
}]}>
|
|
111
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
112
|
+
</QuantityContainer>
|
|
113
|
+
)}
|
|
107
114
|
<CardInfo>
|
|
108
115
|
<OText
|
|
109
116
|
size={12}
|
|
@@ -113,9 +120,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
113
120
|
style={styles.line18}>
|
|
114
121
|
{product?.name}
|
|
115
122
|
</OText>
|
|
116
|
-
<
|
|
117
|
-
{parsePrice(product?.price)}
|
|
118
|
-
|
|
123
|
+
<PricesContainer>
|
|
124
|
+
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
125
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
126
|
+
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
127
|
+
)}
|
|
128
|
+
</PricesContainer>
|
|
119
129
|
<OText
|
|
120
130
|
size={10}
|
|
121
131
|
numberOfLines={2}
|