ordering-ui-react-native 0.14.50 → 0.14.53
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/OrderDetails/index.tsx +1 -1
- package/themes/kiosk/src/components/CustomerName/index.tsx +87 -83
- package/themes/kiosk/src/components/Intro/index.tsx +1 -1
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/ProductForm/index.tsx +39 -42
- package/themes/original/src/components/BusinessPreorder/index.tsx +53 -40
- package/themes/original/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +3 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +2 -2
- package/themes/original/src/components/UserProfile/index.tsx +10 -4
- package/themes/original/src/components/Wallets/index.tsx +9 -1
package/package.json
CHANGED
|
@@ -453,7 +453,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
453
453
|
{order?.offer_type === 1 ? (
|
|
454
454
|
<OText>
|
|
455
455
|
{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
|
|
456
|
-
<
|
|
456
|
+
<OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
|
|
457
457
|
</OText>
|
|
458
458
|
) : (
|
|
459
459
|
<OText>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
|
|
@@ -24,7 +24,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
24
24
|
const [orientationState] = useDeviceOrientation();
|
|
25
25
|
|
|
26
26
|
const onSubmit = (values: any) => {
|
|
27
|
-
_setStoreData('customer_name', {customerName: values.name});
|
|
27
|
+
_setStoreData('customer_name', { customerName: values.name });
|
|
28
28
|
onProceedToPay()
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -52,27 +52,31 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
52
52
|
|
|
53
53
|
const goToBack = () => navigation?.goBack();
|
|
54
54
|
|
|
55
|
-
const submitButton
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
const submitButton = (
|
|
56
|
+
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
57
|
+
<OButton
|
|
58
|
+
text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
|
|
59
|
+
onClick={handleSubmit(onSubmit)}
|
|
60
|
+
textStyle={{ color: theme.colors.primaryContrast, fontSize: 20 }}
|
|
61
|
+
parentStyle={{
|
|
62
|
+
height: orientationState?.orientation === PORTRAIT
|
|
63
|
+
? 50 : 100
|
|
64
|
+
}}
|
|
65
|
+
style={{
|
|
66
|
+
width: orientationState?.orientation === PORTRAIT
|
|
67
|
+
? orientationState?.dimensions.width * 0.5
|
|
68
|
+
: orientationState?.dimensions.width * 0.5
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
);
|
|
69
73
|
|
|
70
|
-
const skipButton
|
|
71
|
-
<View style={{flex:1,
|
|
74
|
+
const skipButton = (
|
|
75
|
+
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
72
76
|
<OButton
|
|
73
77
|
text={t('SKIP', 'Skip')}
|
|
74
78
|
onClick={onProceedToPay}
|
|
75
|
-
textStyle={{color: theme.colors.primary, fontSize: 20}}
|
|
79
|
+
textStyle={{ color: theme.colors.primary, fontSize: 20 }}
|
|
76
80
|
parentStyle={{
|
|
77
81
|
height: orientationState?.orientation === PORTRAIT
|
|
78
82
|
? 50 : 100
|
|
@@ -80,7 +84,7 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
80
84
|
style={{
|
|
81
85
|
backgroundColor: theme.colors.white,
|
|
82
86
|
width: orientationState?.orientation === PORTRAIT
|
|
83
|
-
? orientationState?.dimensions.width
|
|
87
|
+
? orientationState?.dimensions.width * 0.2
|
|
84
88
|
: orientationState?.dimensions.width * 0.1,
|
|
85
89
|
}}
|
|
86
90
|
/>
|
|
@@ -89,78 +93,78 @@ const CustomerName = (props: Props): React.ReactElement => {
|
|
|
89
93
|
|
|
90
94
|
return (
|
|
91
95
|
<>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
<Container>
|
|
97
|
+
<NavBar
|
|
98
|
+
title={t('YOUR_NAME', 'Your name')}
|
|
99
|
+
onActionLeft={goToBack}
|
|
100
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
101
|
+
/>
|
|
102
|
+
<View style={{
|
|
103
|
+
marginVertical: orientationState?.dimensions?.height * 0.08,
|
|
104
|
+
alignItems: 'center'
|
|
105
|
+
}}>
|
|
106
|
+
<OText
|
|
107
|
+
size={orientationState?.dimensions?.width * 0.05}
|
|
108
|
+
style={{ bottom: 20 }}
|
|
109
|
+
>
|
|
110
|
+
{t('WHATS_YOUR_NAME', "What's your name?")}
|
|
111
|
+
{/* <OText
|
|
108
112
|
size={orientationState?.dimensions?.width * 0.05}
|
|
109
113
|
weight={'700'}
|
|
110
114
|
>
|
|
111
115
|
{`${t('ORDER_BE_FOR', 'order be for?')}`}
|
|
112
116
|
</OText> */}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}}
|
|
125
|
-
value={value}
|
|
126
|
-
autoCapitalize="words"
|
|
127
|
-
autoCorrect={false}
|
|
128
|
-
onChange={(val: any) => onChange(val)}
|
|
129
|
-
onSubmitEditing={handleSubmit(onSubmit)}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
name="name"
|
|
133
|
-
rules={{
|
|
134
|
-
required: t(
|
|
135
|
-
'VALIDATION_ERROR_REQUIRED',
|
|
136
|
-
'The field Customer Name is required',
|
|
137
|
-
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
138
|
-
pattern: {
|
|
139
|
-
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
140
|
-
message: t(
|
|
141
|
-
'INVALID_ERROR',
|
|
142
|
-
'Invalid name',
|
|
143
|
-
).replace('_attribute_', t('NAME', 'Name')),
|
|
144
|
-
}
|
|
117
|
+
</OText>
|
|
118
|
+
<Controller
|
|
119
|
+
control={control}
|
|
120
|
+
render={({ onChange, value }: any) => (
|
|
121
|
+
<OInput
|
|
122
|
+
placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
|
|
123
|
+
style={{
|
|
124
|
+
...styles.inputStyle,
|
|
125
|
+
width: orientationState?.orientation === PORTRAIT
|
|
126
|
+
? orientationState?.dimensions.width * 0.5
|
|
127
|
+
: orientationState?.dimensions.width * 0.5,
|
|
145
128
|
}}
|
|
146
|
-
|
|
129
|
+
value={value}
|
|
130
|
+
autoCapitalize="words"
|
|
131
|
+
autoCorrect={false}
|
|
132
|
+
onChange={(val: any) => onChange(val)}
|
|
133
|
+
onSubmitEditing={handleSubmit(onSubmit)}
|
|
147
134
|
/>
|
|
135
|
+
)}
|
|
136
|
+
name="name"
|
|
137
|
+
rules={{
|
|
138
|
+
required: t(
|
|
139
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
140
|
+
'The field Customer Name is required',
|
|
141
|
+
).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
|
|
142
|
+
pattern: {
|
|
143
|
+
value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
|
|
144
|
+
message: t(
|
|
145
|
+
'INVALID_ERROR',
|
|
146
|
+
'Invalid name',
|
|
147
|
+
).replace('_attribute_', t('NAME', 'Name')),
|
|
148
|
+
}
|
|
149
|
+
}}
|
|
150
|
+
defaultValue=""
|
|
151
|
+
/>
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
{orientationState?.orientation === LANDSCAPE && submitButton}
|
|
154
|
+
{orientationState?.orientation === LANDSCAPE && skipButton}
|
|
155
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
156
|
+
<OSActions>
|
|
157
|
+
{submitButton}
|
|
158
|
+
</OSActions>
|
|
159
|
+
)}
|
|
160
|
+
{(orientationState?.orientation === PORTRAIT) && (
|
|
161
|
+
<OSActions>
|
|
162
|
+
{skipButton}
|
|
163
|
+
</OSActions>
|
|
164
|
+
)}
|
|
165
|
+
</View>
|
|
166
|
+
</Container>
|
|
167
|
+
</>
|
|
164
168
|
);
|
|
165
169
|
};
|
|
166
170
|
|
|
@@ -65,7 +65,7 @@ const Intro = (props: any): React.ReactElement => {
|
|
|
65
65
|
/>
|
|
66
66
|
|
|
67
67
|
<OButton
|
|
68
|
-
text={t('
|
|
68
|
+
text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
|
|
69
69
|
parentStyle={{
|
|
70
70
|
alignItems: 'center',
|
|
71
71
|
width: orientationState?.dimensions?.width - _offset
|
|
@@ -5,7 +5,6 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
|
|
|
5
5
|
import { OrderTypeSelector } from '../OrderTypeSelector'
|
|
6
6
|
import { useConfig, useLanguage } from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native'
|
|
8
|
-
|
|
9
8
|
const Wrapper = styled.View`
|
|
10
9
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
11
10
|
padding: 10px 0px 20px 0px;
|
|
@@ -65,27 +64,28 @@ const NavBar = (props: Props) => {
|
|
|
65
64
|
|
|
66
65
|
return (
|
|
67
66
|
<Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
|
|
68
|
-
{(props?.onActionLeft
|
|
67
|
+
{(props?.onActionLeft) && (
|
|
69
68
|
<OButton
|
|
70
|
-
imgLeftSrc={props.leftImg
|
|
69
|
+
imgLeftSrc={props.leftImg}
|
|
71
70
|
imgRightSrc={null}
|
|
72
71
|
style={{ ...btnBackArrow, ...props.btnStyle }}
|
|
73
72
|
onClick={props.onActionLeft}
|
|
74
|
-
imgLeftStyle=
|
|
73
|
+
imgLeftStyle={props.imgLeftStyle}
|
|
74
|
+
{...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
|
|
75
75
|
/>)
|
|
76
76
|
}
|
|
77
77
|
<TitleTopWrapper>
|
|
78
78
|
{props.withIcon
|
|
79
79
|
? (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
<OIcon
|
|
81
|
+
url={props.icon}
|
|
82
|
+
style={{
|
|
83
|
+
borderColor: theme.colors.lightGray,
|
|
84
|
+
borderRadius: 20,
|
|
85
|
+
}}
|
|
86
|
+
width={60}
|
|
87
|
+
height={60}
|
|
88
|
+
/>
|
|
89
89
|
)
|
|
90
90
|
: null
|
|
91
91
|
}
|
|
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
|
|
|
125
125
|
</View>
|
|
126
126
|
)}
|
|
127
127
|
|
|
128
|
-
{
|
|
128
|
+
{props.rightComponent}
|
|
129
129
|
</Wrapper>
|
|
130
130
|
)
|
|
131
131
|
}
|
|
@@ -69,7 +69,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
69
69
|
|
|
70
70
|
const { product, loading, error } = productObject;
|
|
71
71
|
|
|
72
|
-
const HEADER_EXPANDED_HEIGHT =
|
|
72
|
+
const HEADER_EXPANDED_HEIGHT = Platform.OS === 'ios' ? orientationState?.dimensions?.height * 0.65 : orientationState?.dimensions?.height * 0.4;
|
|
73
73
|
const HEADER_COLLAPSED_HEIGHT = orientationState?.dimensions?.height * 0.2;
|
|
74
74
|
|
|
75
75
|
const isError = (id: number) => {
|
|
@@ -100,35 +100,35 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
100
100
|
const saveErrors = orderState.loading || maxProductQuantity === 0 || Object.keys(errors)?.length > 0
|
|
101
101
|
|
|
102
102
|
const [scrollY] = useState(new Animated.Value(0));
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
const headerHeight = scrollY.interpolate({
|
|
105
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
105
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
106
106
|
outputRange: [HEADER_EXPANDED_HEIGHT, HEADER_COLLAPSED_HEIGHT],
|
|
107
107
|
extrapolate: 'clamp'
|
|
108
108
|
});
|
|
109
109
|
const heroContainerOpacity = scrollY.interpolate({
|
|
110
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
110
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
111
111
|
outputRange: [1, 0],
|
|
112
112
|
extrapolate: 'clamp'
|
|
113
113
|
});
|
|
114
114
|
const heroTranslateY = scrollY.interpolate({
|
|
115
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
116
|
-
outputRange: [0, -(HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT)],
|
|
115
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
116
|
+
outputRange: [0, -(HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT)],
|
|
117
117
|
extrapolate: 'clamp'
|
|
118
118
|
});
|
|
119
119
|
const navBar1ContainerOpacity = scrollY.interpolate({
|
|
120
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
120
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
121
121
|
outputRange: [1, 0],
|
|
122
122
|
extrapolate: 'clamp'
|
|
123
123
|
});
|
|
124
124
|
const navBar2ContainerOpacity = scrollY.interpolate({
|
|
125
|
-
inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
125
|
+
inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
126
126
|
outputRange: [0, 1],
|
|
127
127
|
extrapolate: 'clamp'
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
const collapsedBarContainerOpacity = scrollY.interpolate({
|
|
131
|
-
inputRange: [HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
|
|
131
|
+
inputRange: [HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
|
|
132
132
|
outputRange: [0, 1],
|
|
133
133
|
extrapolate: 'clamp'
|
|
134
134
|
});
|
|
@@ -223,7 +223,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
223
223
|
shadow: {
|
|
224
224
|
shadowColor: '#000',
|
|
225
225
|
shadowOffset: { width: 1, height: 1 },
|
|
226
|
-
shadowOpacity:
|
|
226
|
+
shadowOpacity: 0.4,
|
|
227
227
|
shadowRadius: 3,
|
|
228
228
|
elevation: 5,
|
|
229
229
|
}
|
|
@@ -235,33 +235,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
235
235
|
style={styles.mainContainer}
|
|
236
236
|
contentContainerStyle={styles.scrollContainer}
|
|
237
237
|
onScroll={Animated.event(
|
|
238
|
-
[{ nativeEvent: { contentOffset: { y: scrollY }} }],
|
|
239
|
-
{useNativeDriver: false})
|
|
238
|
+
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
|
|
239
|
+
{ useNativeDriver: false })
|
|
240
240
|
}
|
|
241
241
|
scrollEventThrottle={16}
|
|
242
242
|
>
|
|
243
243
|
<Animated.View style={[styles.header, { height: headerHeight }]}>
|
|
244
244
|
{!isDrawer && (<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</Animated.View>
|
|
245
|
+
<NavBar
|
|
246
|
+
{...navBarProps}
|
|
247
|
+
titleColor={theme.colors.white}
|
|
248
|
+
btnStyle={{
|
|
249
|
+
width: 66,
|
|
250
|
+
height: 66,
|
|
251
|
+
backgroundColor: 'black',
|
|
252
|
+
borderRadius: 100,
|
|
253
|
+
color: 'white',
|
|
254
|
+
opacity: 0.8,
|
|
255
|
+
left: 20,
|
|
256
|
+
}}
|
|
257
|
+
/>
|
|
258
|
+
</Animated.View>
|
|
260
259
|
)}
|
|
261
260
|
<Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
|
|
262
261
|
<NavBar
|
|
263
262
|
{...navBarProps}
|
|
264
|
-
{...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
|
|
265
263
|
btnStyle={{
|
|
266
264
|
width: 55,
|
|
267
265
|
height: 55,
|
|
@@ -269,7 +267,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
269
267
|
borderRadius: 100,
|
|
270
268
|
left: 20,
|
|
271
269
|
}}
|
|
272
|
-
imgLeftStyle={{ width: 27, height: 27 }}
|
|
273
270
|
/>
|
|
274
271
|
</Animated.View>
|
|
275
272
|
|
|
@@ -288,7 +285,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
288
285
|
}}
|
|
289
286
|
>
|
|
290
287
|
<OImage
|
|
291
|
-
source={{uri: product?.images}}
|
|
288
|
+
source={{ uri: product?.images }}
|
|
292
289
|
width={70}
|
|
293
290
|
height={70}
|
|
294
291
|
resizeMode="cover"
|
|
@@ -319,7 +316,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
319
316
|
opacity: heroContainerOpacity,
|
|
320
317
|
position: 'absolute',
|
|
321
318
|
zIndex: -100,
|
|
322
|
-
transform: [{translateY: heroTranslateY }],
|
|
319
|
+
transform: [{ translateY: heroTranslateY }],
|
|
323
320
|
}}>
|
|
324
321
|
<View
|
|
325
322
|
style={{
|
|
@@ -330,13 +327,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
330
327
|
backgroundColor: 'rgba(24, 28, 50, 0.4)',
|
|
331
328
|
}}
|
|
332
329
|
>
|
|
333
|
-
<ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
|
|
330
|
+
<ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex: 1, justifyContent: 'center' }} />
|
|
334
331
|
|
|
335
332
|
</View>
|
|
336
333
|
|
|
337
334
|
<Animated.View
|
|
338
335
|
style={{
|
|
339
|
-
transform: [{translateY: heroTranslateY }],
|
|
336
|
+
transform: [{ translateY: heroTranslateY }],
|
|
340
337
|
width: orientationState?.dimensions?.width * 0.75,
|
|
341
338
|
height: HEADER_EXPANDED_HEIGHT / 2,
|
|
342
339
|
position: 'relative',
|
|
@@ -347,7 +344,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
347
344
|
>
|
|
348
345
|
<OText
|
|
349
346
|
color={theme.colors.white}
|
|
350
|
-
size={orientationState?.dimensions?.width * 0.
|
|
347
|
+
size={orientationState?.dimensions?.width * 0.038}
|
|
351
348
|
weight="bold"
|
|
352
349
|
mBottom={10}
|
|
353
350
|
numberOfLines={2}
|
|
@@ -369,18 +366,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
369
366
|
<Spinner visible={loading} />
|
|
370
367
|
)} */}
|
|
371
368
|
{!loading && !error && product && (
|
|
372
|
-
<View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
|
|
369
|
+
<View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
|
|
373
370
|
<WrapContent isDrawer={isDrawer}>
|
|
374
371
|
<ProductDescription>
|
|
375
372
|
{(
|
|
376
373
|
(product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
|
|
377
374
|
(productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
|
|
378
|
-
) &&(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
375
|
+
) && (
|
|
376
|
+
<>
|
|
377
|
+
<OText size={20}>{t('SKU', 'Sku')}</OText>
|
|
378
|
+
<OText>{product?.sku || productCart?.sku}</OText>
|
|
379
|
+
</>
|
|
380
|
+
)}
|
|
384
381
|
</ProductDescription>
|
|
385
382
|
<ProductEditions>
|
|
386
383
|
{product?.ingredients.length > 0 && (
|
|
@@ -504,7 +501,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
504
501
|
</TouchableOpacity>
|
|
505
502
|
</View>
|
|
506
503
|
)}
|
|
507
|
-
<View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%':'80%' }}>
|
|
504
|
+
<View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%' : '80%' }}>
|
|
508
505
|
{productCart && !isSoldOut && maxProductQuantity > 0 && auth && orderState.options?.address_id && (
|
|
509
506
|
<OButton
|
|
510
507
|
onClick={() => handleSaveProduct()}
|
|
@@ -34,7 +34,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
34
34
|
timeSelected,
|
|
35
35
|
handleBusinessClick,
|
|
36
36
|
handleChangeDate,
|
|
37
|
-
handleChangeTime
|
|
37
|
+
handleChangeTime,
|
|
38
|
+
handleAsap,
|
|
39
|
+
isAsap
|
|
38
40
|
} = props
|
|
39
41
|
|
|
40
42
|
const theme = useTheme()
|
|
@@ -43,10 +45,11 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
43
45
|
const [{ configs }] = useConfig()
|
|
44
46
|
const [orderState] = useOrder()
|
|
45
47
|
const [selectedPreorderType, setSelectedPreorderType] = useState(0)
|
|
46
|
-
const [menu, setMenu] = useState({})
|
|
48
|
+
const [menu, setMenu] = useState<any>({})
|
|
47
49
|
const [timeList, setTimeList] = useState<any>([])
|
|
48
50
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
49
51
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
52
|
+
const [isEnabled, setIsEnabled] = useState(false)
|
|
50
53
|
|
|
51
54
|
const styles = StyleSheet.create({
|
|
52
55
|
container: {
|
|
@@ -137,7 +140,13 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
137
140
|
{ key: 'business_menu', name: t('BUSINESS_MENU', 'Business menu') }
|
|
138
141
|
]
|
|
139
142
|
|
|
143
|
+
const validateSelectedDate = (curdate: any, menu: any) => {
|
|
144
|
+
const day = moment(curdate).format('d')
|
|
145
|
+
setIsEnabled(menu?.schedule[day]?.enabled || false)
|
|
146
|
+
}
|
|
147
|
+
|
|
140
148
|
const getTimes = (curdate: any, menu: any) => {
|
|
149
|
+
validateSelectedDate(curdate, menu)
|
|
141
150
|
const date = new Date()
|
|
142
151
|
var dateSeleted = new Date(curdate)
|
|
143
152
|
var times = []
|
|
@@ -240,26 +249,11 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
240
249
|
}
|
|
241
250
|
|
|
242
251
|
useEffect(() => {
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const _timeLists = hoursList.map((hour: any) => {
|
|
249
|
-
return {
|
|
250
|
-
value: hour.startTime,
|
|
251
|
-
text: configs?.format_time?.value === '12' ? (
|
|
252
|
-
hour.startTime.includes('12')
|
|
253
|
-
? `${hour.startTime}PM`
|
|
254
|
-
: parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
|
|
255
|
-
) : (
|
|
256
|
-
parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
})
|
|
260
|
-
setTimeList(_timeLists)
|
|
261
|
-
}
|
|
262
|
-
}, [selectDate, hoursList, menu])
|
|
252
|
+
if (selectDate === null) return
|
|
253
|
+
const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
|
|
254
|
+
const _times = getTimes(selectDate, selectedMenu)
|
|
255
|
+
setTimeList(_times)
|
|
256
|
+
}, [selectDate, menu])
|
|
263
257
|
|
|
264
258
|
useEffect(() => {
|
|
265
259
|
if (selectedPreorderType === 0 && Object.keys(menu).length > 0) setMenu({})
|
|
@@ -273,6 +267,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
273
267
|
}
|
|
274
268
|
}, [dateSelected])
|
|
275
269
|
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
handleAsap && handleAsap()
|
|
272
|
+
}, [])
|
|
273
|
+
|
|
276
274
|
return (
|
|
277
275
|
<>
|
|
278
276
|
<PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 40 }}>
|
|
@@ -413,24 +411,38 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
413
411
|
)}
|
|
414
412
|
</View>
|
|
415
413
|
<TimeListWrapper nestedScrollEnabled={true}>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
<
|
|
420
|
-
<
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
414
|
+
{(isEnabled && timeList?.length > 0) ? (
|
|
415
|
+
<TimeContentWrapper>
|
|
416
|
+
{timeList.map((time: any, i: number) => (
|
|
417
|
+
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
418
|
+
<TimeItem active={timeSelected === time.value}>
|
|
419
|
+
<OText
|
|
420
|
+
size={14}
|
|
421
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
422
|
+
style={{
|
|
423
|
+
lineHeight: 24
|
|
424
|
+
}}
|
|
425
|
+
>{time.text}</OText>
|
|
426
|
+
</TimeItem>
|
|
427
|
+
</TouchableOpacity>
|
|
428
|
+
))}
|
|
429
|
+
{timeList.length % 3 === 2 && (
|
|
430
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
431
|
+
)}
|
|
432
|
+
</TimeContentWrapper>
|
|
433
|
+
) : (
|
|
434
|
+
<OText
|
|
435
|
+
size={16}
|
|
436
|
+
style={{
|
|
437
|
+
fontWeight: '600',
|
|
438
|
+
lineHeight: 24,
|
|
439
|
+
marginBottom: 12,
|
|
440
|
+
textAlign: 'center'
|
|
441
|
+
}}
|
|
442
|
+
>
|
|
443
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
444
|
+
</OText>
|
|
445
|
+
)}
|
|
434
446
|
</TimeListWrapper>
|
|
435
447
|
</OrderTimeWrapper>
|
|
436
448
|
<OButton
|
|
@@ -438,6 +450,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
438
450
|
textStyle={{ color: 'white' }}
|
|
439
451
|
style={{ borderRadius: 7.6, marginBottom: 20, marginTop: 30 }}
|
|
440
452
|
onClick={() => handleClickBusiness()}
|
|
453
|
+
isDisabled={isAsap || !(dateSelected && timeSelected)}
|
|
441
454
|
/>
|
|
442
455
|
</PreOrderContainer>
|
|
443
456
|
<Spinner visible={orderState.loading} />
|
|
@@ -240,7 +240,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
240
240
|
{isFarAway && (
|
|
241
241
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
242
242
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
243
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
243
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
244
244
|
</FarAwayMessage>
|
|
245
245
|
)}
|
|
246
246
|
<OrderControlContainer>
|
|
@@ -127,6 +127,8 @@ const CheckoutUI = (props: any) => {
|
|
|
127
127
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
128
128
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
129
129
|
|
|
130
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1'
|
|
131
|
+
|
|
130
132
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
131
133
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
132
134
|
: configs?.driver_tip_options?.value || []
|
|
@@ -506,7 +508,7 @@ const CheckoutUI = (props: any) => {
|
|
|
506
508
|
</ChSection>
|
|
507
509
|
)}
|
|
508
510
|
|
|
509
|
-
{!cartState.loading && cart && (
|
|
511
|
+
{!cartState.loading && cart && isWalletEnabled && (
|
|
510
512
|
<WalletPaymentOptionContainer>
|
|
511
513
|
<PaymentOptionWallet
|
|
512
514
|
cart={cart}
|
|
@@ -55,7 +55,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const handleOnChange = (position: any, wallet: any) => {
|
|
58
|
-
const updatedCheckedState = checkedState.map((item, index) =>
|
|
58
|
+
const updatedCheckedState = checkedState.map((item: any, index: any) =>
|
|
59
59
|
index === position ? !item : item
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -85,7 +85,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
85
85
|
walletsState.result?.length > 0 &&
|
|
86
86
|
(
|
|
87
87
|
<>
|
|
88
|
-
{walletsState.result?.map((wallet: any, idx: any) => wallet.valid && (
|
|
88
|
+
{walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && (
|
|
89
89
|
<Container
|
|
90
90
|
key={wallet.id}
|
|
91
91
|
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
useLanguage,
|
|
6
6
|
ToastType,
|
|
7
7
|
useToast,
|
|
8
|
+
useConfig
|
|
8
9
|
} from 'ordering-components/native';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
10
11
|
import { useForm } from 'react-hook-form';
|
|
@@ -91,12 +92,15 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
91
92
|
|
|
92
93
|
const [{ user }] = useSession();
|
|
93
94
|
const [, t] = useLanguage();
|
|
95
|
+
const [{ configs }] = useConfig();
|
|
94
96
|
const [, { showToast }] = useToast();
|
|
95
97
|
const { errors } = useForm();
|
|
96
98
|
|
|
97
99
|
const { height } = useWindowDimensions();
|
|
98
100
|
const { top, bottom } = useSafeAreaInsets();
|
|
99
101
|
|
|
102
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1'
|
|
103
|
+
|
|
100
104
|
const onRedirect = (route: string, params?: any) => {
|
|
101
105
|
navigation.navigate(route, params)
|
|
102
106
|
}
|
|
@@ -161,10 +165,12 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
161
165
|
<MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
162
166
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
|
|
163
167
|
</ListItem>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
{!isWalletEnabled && (
|
|
169
|
+
<ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
|
|
170
|
+
<Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
|
|
171
|
+
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('WALLETS', 'Wallets')}</OText>
|
|
172
|
+
</ListItem>
|
|
173
|
+
)}
|
|
168
174
|
<ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
|
|
169
175
|
<OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
|
|
170
176
|
<OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { Pressable, View } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
@@ -60,6 +60,14 @@ const WalletsUI = (props: any) => {
|
|
|
60
60
|
navigation?.canGoBack() && navigation.goBack()
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (configs?.wallet_enabled?.value === '0') {
|
|
65
|
+
navigation.navigate('BottomTab', {
|
|
66
|
+
screen: 'Profile'
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}, [configs])
|
|
70
|
+
|
|
63
71
|
return (
|
|
64
72
|
<Container>
|
|
65
73
|
<NavBar
|