ordering-ui-react-native 0.14.55 → 0.14.58
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/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +1 -1
- package/src/components/StripeElementsForm/index.tsx +28 -13
- package/src/components/TaxInformation/index.tsx +1 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +1 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +5 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
- package/themes/original/src/components/MomentOption/index.tsx +209 -196
- package/themes/original/src/components/MomentOption/styles.tsx +18 -42
- package/themes/original/src/components/ProductForm/index.tsx +6 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +51 -49
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
- package/themes/original/src/components/TaxInformation/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -191,7 +191,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
191
191
|
{isFarAway && (
|
|
192
192
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
193
193
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
194
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
194
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
195
195
|
</FarAwayMessage>
|
|
196
196
|
)}
|
|
197
197
|
</OrderControlContainer>
|
|
@@ -205,7 +205,7 @@ const CheckoutUI = (props: any) => {
|
|
|
205
205
|
const onMessage = (e: any) => {
|
|
206
206
|
if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
|
|
207
207
|
let payment = JSON.parse(e.nativeEvent.data);
|
|
208
|
-
|
|
208
|
+
setOpenOrderCreating(true)
|
|
209
209
|
if (payment === 'api error') {
|
|
210
210
|
setShowGateway({ closedByUser: true, open: false })
|
|
211
211
|
setProg(true);
|
|
@@ -33,19 +33,33 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
33
33
|
const { confirmSetupIntent, loading: confirmSetupLoading } = useConfirmSetupIntent();
|
|
34
34
|
const [createPmLoading, setCreatePmLoading] = useState(false);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
let billingDetails: any = {}
|
|
37
|
+
|
|
38
|
+
if (user?.name || user?.lastname) {
|
|
39
|
+
if (user?.name) {
|
|
40
|
+
billingDetails.name = user?.name
|
|
41
|
+
}
|
|
42
|
+
if (user?.lastname) {
|
|
43
|
+
billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (user?.email) {
|
|
48
|
+
billingDetails.email = user?.email
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (user?.address) {
|
|
52
|
+
billingDetails.addressLine1 = user?.address
|
|
53
|
+
}
|
|
41
54
|
|
|
42
55
|
const createPayMethod = async () => {
|
|
56
|
+
const params: any = { type: 'Card' }
|
|
57
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
58
|
+
params.billingDetails = billingDetails
|
|
59
|
+
}
|
|
43
60
|
try {
|
|
44
61
|
setCreatePmLoading(true)
|
|
45
|
-
const { paymentMethod } = await createPaymentMethod(
|
|
46
|
-
type: 'Card',
|
|
47
|
-
billingDetails,
|
|
48
|
-
});
|
|
62
|
+
const { paymentMethod } = await createPaymentMethod(params);
|
|
49
63
|
|
|
50
64
|
setCreatePmLoading(false)
|
|
51
65
|
handleSource && handleSource({
|
|
@@ -68,11 +82,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
68
82
|
createPayMethod();
|
|
69
83
|
return
|
|
70
84
|
}
|
|
85
|
+
const params: any = { type: 'Card' }
|
|
86
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
87
|
+
params.billingDetails = billingDetails
|
|
88
|
+
}
|
|
71
89
|
try {
|
|
72
|
-
const { setupIntent, error } = await confirmSetupIntent(requirements,
|
|
73
|
-
type: 'Card',
|
|
74
|
-
billingDetails,
|
|
75
|
-
});
|
|
90
|
+
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
76
91
|
|
|
77
92
|
if (setupIntent?.status === 'Succeeded') {
|
|
78
93
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
@@ -36,7 +36,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
36
36
|
? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null)
|
|
37
37
|
: type === 'fee'
|
|
38
38
|
? (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))
|
|
39
|
-
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code))
|
|
39
|
+
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code)) && product?.offers?.find(offer => offer?.name === data?.name)
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
197
197
|
{isFarAway && (
|
|
198
198
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
199
199
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
200
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
200
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
201
201
|
</FarAwayMessage>
|
|
202
202
|
)}
|
|
203
203
|
{!auth && (
|
|
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
155
155
|
{isFarAway && (
|
|
156
156
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
157
157
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
158
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
158
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
159
159
|
</FarAwayMessage>
|
|
160
160
|
)}
|
|
161
161
|
<View style={styles.wrapperOrderOptions}>
|
|
@@ -25,7 +25,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
|
|
|
25
25
|
import FastImage from 'react-native-fast-image'
|
|
26
26
|
|
|
27
27
|
export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
28
|
-
const { business, handleClick, navigation } = props;
|
|
28
|
+
const { business, handleClick, navigation, isBusinessOpen } = props;
|
|
29
29
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
|
|
30
30
|
useUtils();
|
|
31
31
|
const [orderState] = useOrder();
|
|
@@ -122,7 +122,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
122
122
|
</View>
|
|
123
123
|
)}
|
|
124
124
|
<BusinessState>
|
|
125
|
-
{!
|
|
125
|
+
{!isBusinessOpen && (
|
|
126
126
|
<View style={styles.businessStateView}>
|
|
127
127
|
<OText
|
|
128
128
|
color={theme.colors.textThird}
|
|
@@ -168,7 +168,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
168
168
|
<OText>{getBusinessType()}</OText>
|
|
169
169
|
</BusinessCategory> */}
|
|
170
170
|
<Metadata>
|
|
171
|
-
{!
|
|
171
|
+
{!isBusinessOpen ? (
|
|
172
172
|
<View style={styles.closed}>
|
|
173
173
|
<OText size={10} color={theme.colors.red}>
|
|
174
174
|
{t('CLOSED', 'Closed')}
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from './styles';
|
|
24
24
|
|
|
25
25
|
export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
26
|
-
const { business, handleClick } = props;
|
|
26
|
+
const { business, handleClick, isBusinessOpen } = props;
|
|
27
27
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
|
|
28
28
|
useUtils();
|
|
29
29
|
const [orderState] = useOrder();
|
|
@@ -128,7 +128,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
128
128
|
<OText>{getBusinessType()}</OText>
|
|
129
129
|
</BusinessCategory> */}
|
|
130
130
|
<Metadata>
|
|
131
|
-
{!
|
|
131
|
+
{!isBusinessOpen ? (
|
|
132
132
|
<View style={styles.closed}>
|
|
133
133
|
<OText size={10} color={theme.colors.red}>
|
|
134
134
|
{t('CLOSED', 'Closed')}
|
|
@@ -155,6 +155,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
155
155
|
const handleTouchDrag = useCallback(() => {
|
|
156
156
|
setCategoryClicked(false);
|
|
157
157
|
}, []);
|
|
158
|
+
|
|
159
|
+
const handleBackNavigation = () => {
|
|
160
|
+
navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
|
|
161
|
+
}
|
|
158
162
|
|
|
159
163
|
return (
|
|
160
164
|
<SafeAreaView
|
|
@@ -169,7 +173,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
169
173
|
imgLeftSrc={theme.images.general.arrow_left}
|
|
170
174
|
imgRightSrc={null}
|
|
171
175
|
style={styles.btnBackArrow}
|
|
172
|
-
onClick={() =>
|
|
176
|
+
onClick={() => handleBackNavigation()}
|
|
173
177
|
imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
|
|
174
178
|
/>
|
|
175
179
|
</View>
|
|
@@ -231,7 +235,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
231
235
|
selectedCategoryId={selectedCategoryId}
|
|
232
236
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
233
237
|
setSelectedCategoryId={setSelectedCategoryId}
|
|
234
|
-
|
|
238
|
+
setCategoryClicked={setCategoryClicked}
|
|
235
239
|
/>
|
|
236
240
|
)}
|
|
237
241
|
</>
|
|
@@ -309,13 +313,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
309
313
|
business={currentCart?.business}
|
|
310
314
|
cartProducts={currentCart?.products}
|
|
311
315
|
cart={currentCart}
|
|
312
|
-
|
|
316
|
+
setOpenUpselling={setOpenUpselling}
|
|
313
317
|
handleUpsellingPage={handleUpsellingPage}
|
|
314
318
|
handleCloseUpsellingPage={handleCloseUpsellingPage}
|
|
315
319
|
openUpselling={openUpselling}
|
|
316
320
|
canOpenUpselling={canOpenUpselling}
|
|
317
321
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
318
|
-
|
|
322
|
+
onRedirect={onRedirect}
|
|
319
323
|
/>
|
|
320
324
|
)}
|
|
321
325
|
</SafeAreaView>
|
|
@@ -177,11 +177,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
177
177
|
// }, [])
|
|
178
178
|
|
|
179
179
|
const handleOnRefresh = () => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
);
|
|
183
|
-
if (!businessesList.loading && hasMore) {
|
|
184
|
-
getBusinesses();
|
|
180
|
+
if (!businessesList.loading) {
|
|
181
|
+
getBusinesses(true);
|
|
185
182
|
}
|
|
186
183
|
}
|
|
187
184
|
|
|
@@ -315,6 +312,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
315
312
|
<BusinessFeaturedController
|
|
316
313
|
key={bAry[0].id}
|
|
317
314
|
business={bAry[0]}
|
|
315
|
+
isBusinessOpen={bAry[0]?.open}
|
|
318
316
|
handleCustomClick={handleBusinessClick}
|
|
319
317
|
orderType={orderState?.options?.type}
|
|
320
318
|
/>
|
|
@@ -322,6 +320,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
322
320
|
<BusinessFeaturedController
|
|
323
321
|
key={bAry[1].id}
|
|
324
322
|
business={bAry[1]}
|
|
323
|
+
isBusinessOpen={bAry[1]?.open}
|
|
325
324
|
handleCustomClick={handleBusinessClick}
|
|
326
325
|
orderType={orderState?.options?.type}
|
|
327
326
|
/>
|
|
@@ -361,6 +360,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
361
360
|
<BusinessController
|
|
362
361
|
key={business.id}
|
|
363
362
|
business={business}
|
|
363
|
+
isBusinessOpen={business.open}
|
|
364
364
|
handleCustomClick={handleBusinessClick}
|
|
365
365
|
orderType={orderState?.options?.type}
|
|
366
366
|
navigation={navigation}
|
|
@@ -103,6 +103,7 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
103
103
|
>
|
|
104
104
|
<BusinessController
|
|
105
105
|
business={business}
|
|
106
|
+
isBusinessOpen={business?.open}
|
|
106
107
|
handleCustomClick={onBusinessClick}
|
|
107
108
|
orderType={orderState?.options?.type}
|
|
108
109
|
navigation={navigation}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import moment
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import CalendarStrip from 'react-native-calendar-strip'
|
|
3
4
|
import {
|
|
4
5
|
useLanguage,
|
|
5
6
|
useConfig,
|
|
6
|
-
useUtils,
|
|
7
7
|
useOrder,
|
|
8
8
|
MomentOption as MomentOptionController,
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
11
12
|
import {
|
|
12
|
-
ImageStore,
|
|
13
13
|
StyleSheet,
|
|
14
|
-
useWindowDimensions,
|
|
15
14
|
View,
|
|
15
|
+
TouchableOpacity
|
|
16
16
|
} from 'react-native';
|
|
17
17
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
18
18
|
import { MomentOptionParams } from '../../types';
|
|
@@ -20,25 +20,17 @@ import NavBar from '../NavBar';
|
|
|
20
20
|
import { OButton, OIcon, OText } from '../shared';
|
|
21
21
|
import { Container } from '../../layouts/Container';
|
|
22
22
|
import {
|
|
23
|
-
HeaderTitle,
|
|
24
23
|
WrapSelectOption,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Hour,
|
|
30
|
-
WrapDelveryTime,
|
|
24
|
+
OrderTimeWrapper,
|
|
25
|
+
TimeListWrapper,
|
|
26
|
+
TimeContentWrapper,
|
|
27
|
+
TimeItem
|
|
31
28
|
} from './styles';
|
|
32
|
-
import CalendarPicker from 'react-native-calendar-picker';
|
|
33
|
-
import { TouchableRipple } from 'react-native-paper';
|
|
34
29
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
35
|
-
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
|
36
|
-
import SelectDropdown from 'react-native-select-dropdown';
|
|
37
30
|
|
|
38
31
|
const MomentOptionUI = (props: MomentOptionParams) => {
|
|
39
32
|
const {
|
|
40
33
|
navigation,
|
|
41
|
-
nopadding,
|
|
42
34
|
datesList,
|
|
43
35
|
hoursList,
|
|
44
36
|
dateSelected,
|
|
@@ -84,12 +76,62 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
84
76
|
paddingHorizontal: 16,
|
|
85
77
|
flexDirection: 'row',
|
|
86
78
|
alignItems: 'center'
|
|
79
|
+
},
|
|
80
|
+
calendar: {
|
|
81
|
+
paddingBottom: 15,
|
|
82
|
+
borderBottomWidth: 1,
|
|
83
|
+
borderColor: theme.colors.backgroundGray200,
|
|
84
|
+
height: 100
|
|
85
|
+
},
|
|
86
|
+
calendarHeaderContainer: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
justifyContent: 'flex-start',
|
|
89
|
+
textAlign: 'left',
|
|
90
|
+
marginBottom: 17,
|
|
91
|
+
borderBottomWidth: 1,
|
|
92
|
+
borderColor: theme.colors.backgroundGray200
|
|
93
|
+
},
|
|
94
|
+
calendarHeader: {
|
|
95
|
+
color: '#344050',
|
|
96
|
+
alignSelf: 'flex-start',
|
|
97
|
+
fontSize: 14,
|
|
98
|
+
fontWeight: '400'
|
|
99
|
+
},
|
|
100
|
+
dateNumber: {
|
|
101
|
+
color: '#B1BCCC',
|
|
102
|
+
fontSize: 16,
|
|
103
|
+
fontWeight: '500',
|
|
104
|
+
},
|
|
105
|
+
dateName: {
|
|
106
|
+
color: '#B1BCCC',
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
textTransform: 'capitalize',
|
|
109
|
+
},
|
|
110
|
+
highlightDateName: {
|
|
111
|
+
color: '#344050',
|
|
112
|
+
fontSize: 12,
|
|
113
|
+
textTransform: 'capitalize',
|
|
114
|
+
},
|
|
115
|
+
highlightDateNumber: {
|
|
116
|
+
color: '#344050',
|
|
117
|
+
fontSize: 16,
|
|
118
|
+
textTransform: 'capitalize',
|
|
119
|
+
},
|
|
120
|
+
disabledDateName: {
|
|
121
|
+
color: '#B1BCCC',
|
|
122
|
+
fontSize: 10,
|
|
123
|
+
textTransform: 'capitalize',
|
|
124
|
+
opacity: 1,
|
|
125
|
+
},
|
|
126
|
+
disabledDateNumber: {
|
|
127
|
+
color: '#B1BCCC',
|
|
128
|
+
fontSize: 14,
|
|
129
|
+
fontWeight: '500'
|
|
87
130
|
}
|
|
88
131
|
});
|
|
89
132
|
|
|
90
133
|
const [, t] = useLanguage();
|
|
91
134
|
const [{ configs }] = useConfig();
|
|
92
|
-
const [{ parseTime }] = useUtils();
|
|
93
135
|
const [orderState] = useOrder();
|
|
94
136
|
const [optionSelected, setOptionSelected] = useState({
|
|
95
137
|
isAsap: false,
|
|
@@ -99,14 +141,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
99
141
|
isLoading: 0,
|
|
100
142
|
isEditing: false,
|
|
101
143
|
});
|
|
102
|
-
const { width } = useWindowDimensions();
|
|
103
144
|
const { bottom } = useSafeAreaInsets();
|
|
104
145
|
|
|
105
|
-
const [
|
|
106
|
-
const [
|
|
107
|
-
const [
|
|
108
|
-
const [maxDate, setMaxDate] = useState(new Date)
|
|
109
|
-
const [alert, setAlert] = useState<any>({ show: false })
|
|
146
|
+
const [selectedTime, setSelectedTime] = useState(null);
|
|
147
|
+
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
148
|
+
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
110
149
|
|
|
111
150
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
112
151
|
|
|
@@ -134,19 +173,6 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
134
173
|
.utc()
|
|
135
174
|
.format('YYYY-MM-DD HH:mm:ss');
|
|
136
175
|
|
|
137
|
-
const getTwoChar = (ori: string) => {
|
|
138
|
-
return ori.substring(0, 2);
|
|
139
|
-
};
|
|
140
|
-
const weekDays = [
|
|
141
|
-
getTwoChar(t('SUNDAY_ABBREVIATION', 'Su')),
|
|
142
|
-
getTwoChar(t('MONDAY_ABBREVIATION', 'Mo')),
|
|
143
|
-
getTwoChar(t('TUESDAY_ABBREVIATION', 'Tu')),
|
|
144
|
-
getTwoChar(t('WEDNESDAY_ABBREVIATION', 'We')),
|
|
145
|
-
getTwoChar(t('THURSDAY_ABBREVIATION', 'Th')),
|
|
146
|
-
getTwoChar(t('FRIDAY_ABBREVIATION', 'Fr')),
|
|
147
|
-
getTwoChar(t('SATURDAY_ABBREVIATION', 'Sa')),
|
|
148
|
-
];
|
|
149
|
-
|
|
150
176
|
useEffect(() => {
|
|
151
177
|
if (orderState.options?.moment) {
|
|
152
178
|
setOptionSelected({ isAsap: false, isSchedule: true });
|
|
@@ -168,176 +194,163 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
168
194
|
}
|
|
169
195
|
}, [momentState.isLoading]);
|
|
170
196
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
197
|
+
const onSelectDate = (val: any) => {
|
|
198
|
+
setSelectedDate(val)
|
|
199
|
+
if (handleChangeDate) handleChangeDate(moment(val).format('YYYY-MM-DD'))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const LeftSelector = () => {
|
|
203
|
+
return (
|
|
204
|
+
<View style={{ height: '100%', justifyContent: 'flex-end' }}>
|
|
205
|
+
<IconAntDesign
|
|
206
|
+
name='caretleft'
|
|
207
|
+
color={theme.colors.textNormal}
|
|
208
|
+
size={16}
|
|
209
|
+
/>
|
|
210
|
+
</View>
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const RightSelector = () => {
|
|
215
|
+
return (
|
|
216
|
+
<View style={{ height: '100%', justifyContent: 'flex-end' }}>
|
|
217
|
+
<IconAntDesign
|
|
218
|
+
name='caretright'
|
|
219
|
+
color={theme.colors.textNormal}
|
|
220
|
+
size={16}
|
|
221
|
+
/>
|
|
222
|
+
</View>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
179
225
|
|
|
180
226
|
useEffect(() => {
|
|
181
227
|
if (datesList?.length > 0) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
setMaxDate(_maxDate)
|
|
228
|
+
const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
|
|
229
|
+
const minDateParts = _datesList[0].split('-')
|
|
230
|
+
const maxDateParts = _datesList[_datesList.length - 1].split('-')
|
|
231
|
+
const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
|
|
232
|
+
const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
|
|
233
|
+
setDateWhitelist([{ start: _minDate, end: _maxDate }])
|
|
189
234
|
}
|
|
190
235
|
}, [datesList])
|
|
191
236
|
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
if (dateSelected) {
|
|
239
|
+
const dateParts = dateSelected.split('-')
|
|
240
|
+
const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
|
|
241
|
+
setSelectedDate(_dateSelected)
|
|
242
|
+
}
|
|
243
|
+
}, [dateSelected])
|
|
244
|
+
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
setSelectedTime(timeSelected)
|
|
247
|
+
}, [timeSelected])
|
|
248
|
+
|
|
192
249
|
return (
|
|
193
250
|
<>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
251
|
+
<Container style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
252
|
+
<View style={{ paddingBottom: 90 }}>
|
|
253
|
+
<NavBar
|
|
254
|
+
onActionLeft={() => goToBack()}
|
|
255
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
256
|
+
paddingTop={0}
|
|
257
|
+
style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
|
|
258
|
+
title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
|
|
259
|
+
titleAlign={'center'}
|
|
260
|
+
titleStyle={{ fontSize: 14, marginRight: 0, marginLeft: 0 }}
|
|
261
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
262
|
+
/>
|
|
206
263
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
264
|
+
<WrapSelectOption
|
|
265
|
+
onPress={() => _handleAsap()}
|
|
266
|
+
disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
|
|
267
|
+
{optionSelected.isAsap ? (
|
|
268
|
+
<OIcon
|
|
269
|
+
src={theme.images.general.option_checked}
|
|
270
|
+
width={16}
|
|
271
|
+
style={{ marginEnd: 24 }}
|
|
272
|
+
/>
|
|
273
|
+
) : (
|
|
274
|
+
<OIcon
|
|
275
|
+
src={theme.images.general.option_normal}
|
|
276
|
+
width={16}
|
|
277
|
+
style={{ marginEnd: 24 }}
|
|
278
|
+
/>
|
|
279
|
+
)}
|
|
280
|
+
<OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM d, yyyy h:mm A')} + delivery time)`}</OText>
|
|
281
|
+
</WrapSelectOption>
|
|
282
|
+
<WrapSelectOption
|
|
283
|
+
onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
|
|
284
|
+
disabled={orderState.loading}>
|
|
285
|
+
{optionSelected.isSchedule ? (
|
|
286
|
+
<OIcon
|
|
287
|
+
src={theme.images.general.option_checked}
|
|
288
|
+
width={16}
|
|
289
|
+
style={{ marginEnd: 24 }}
|
|
290
|
+
/>
|
|
291
|
+
) : (
|
|
292
|
+
<OIcon
|
|
293
|
+
src={theme.images.general.option_normal}
|
|
294
|
+
width={16}
|
|
295
|
+
style={{ marginEnd: 24 }}
|
|
296
|
+
/>
|
|
297
|
+
)}
|
|
298
|
+
<OText color={optionSelected.isSchedule ? theme.colors.textNormal : theme.colors.disabled}>{t('SCHEDULE_FOR_LATER', 'Schedule for later')}</OText>
|
|
299
|
+
</WrapSelectOption>
|
|
243
300
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
flexDirection: 'column',
|
|
273
|
-
alignItems: 'flex-start',
|
|
274
|
-
marginBottom: 20
|
|
275
|
-
}}
|
|
276
|
-
buttonTextStyle={{
|
|
277
|
-
color: theme.colors.textNormal,
|
|
278
|
-
fontSize: 12,
|
|
279
|
-
paddingTop: 10
|
|
280
|
-
}}
|
|
281
|
-
dropdownStyle={{
|
|
282
|
-
borderRadius: 8,
|
|
283
|
-
borderColor: theme.colors.lightGray,
|
|
284
|
-
}}
|
|
285
|
-
rowStyle={{
|
|
286
|
-
borderBottomColor: theme.colors.white,
|
|
287
|
-
backgroundColor: theme.colors.white,
|
|
288
|
-
height: 40,
|
|
289
|
-
flexDirection: 'column',
|
|
290
|
-
alignItems: 'flex-start',
|
|
291
|
-
paddingTop: 8,
|
|
292
|
-
paddingLeft: 22
|
|
293
|
-
}}
|
|
294
|
-
rowTextStyle={{
|
|
295
|
-
color: theme.colors.textNormal,
|
|
296
|
-
fontSize: 14,
|
|
297
|
-
}}
|
|
298
|
-
/>
|
|
299
|
-
<CalendarPicker
|
|
300
|
-
nextTitle=">"
|
|
301
|
-
width={width - 80}
|
|
302
|
-
previousTitle="<"
|
|
303
|
-
nextComponent={
|
|
304
|
-
<OIcon
|
|
305
|
-
src={theme.images.general.chevron_right}
|
|
306
|
-
color={theme.colors.disabled}
|
|
307
|
-
width={12}
|
|
308
|
-
style={{ marginHorizontal: 4 }}
|
|
309
|
-
/>
|
|
310
|
-
}
|
|
311
|
-
previousComponent={
|
|
312
|
-
<OIcon
|
|
313
|
-
src={theme.images.general.chevron_left}
|
|
314
|
-
color={theme.colors.disabled}
|
|
315
|
-
width={12}
|
|
316
|
-
style={{ marginHorizontal: 4 }}
|
|
317
|
-
/>
|
|
318
|
-
}
|
|
319
|
-
onDateChange={(date: moment.Moment) =>
|
|
320
|
-
handleChangeDate(date.format('YYYY-MM-DD'))
|
|
321
|
-
}
|
|
322
|
-
selectedDayColor={theme.colors.primaryContrast}
|
|
323
|
-
todayBackgroundColor={theme.colors.border}
|
|
324
|
-
dayLabelsWrapper={{ borderColor: theme.colors.clear }}
|
|
325
|
-
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
326
|
-
weekdays={weekDays}
|
|
327
|
-
selectedStartDate={momento}
|
|
328
|
-
minDate={minDate}
|
|
329
|
-
maxDate={maxDate}
|
|
330
|
-
/>
|
|
301
|
+
{optionSelected.isSchedule && (
|
|
302
|
+
<OrderTimeWrapper>
|
|
303
|
+
<View style={{ flex: 1 }}>
|
|
304
|
+
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
305
|
+
<CalendarStrip
|
|
306
|
+
scrollable
|
|
307
|
+
style={styles.calendar}
|
|
308
|
+
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
309
|
+
calendarHeaderStyle={styles.calendarHeader}
|
|
310
|
+
dateNumberStyle={styles.dateNumber}
|
|
311
|
+
dateNameStyle={styles.dateName}
|
|
312
|
+
iconContainer={{ flex: 0.1 }}
|
|
313
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
314
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
315
|
+
dayContainerStyle={{ height: '100%' }}
|
|
316
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
317
|
+
calendarHeaderFormat='MMMM, YYYY'
|
|
318
|
+
iconStyle={{ borderWidth: 1 }}
|
|
319
|
+
selectedDate={selectDate}
|
|
320
|
+
datesWhitelist={datesWhitelist}
|
|
321
|
+
disabledDateNameStyle={styles.disabledDateName}
|
|
322
|
+
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
323
|
+
disabledDateOpacity={0.6}
|
|
324
|
+
onDateSelected={(date) => onSelectDate(date)}
|
|
325
|
+
leftSelector={<LeftSelector />}
|
|
326
|
+
rightSelector={<RightSelector />}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
331
329
|
</View>
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
330
|
+
<TimeListWrapper nestedScrollEnabled={true}>
|
|
331
|
+
<TimeContentWrapper>
|
|
332
|
+
{hoursList.map((time: any, i: number) => (
|
|
333
|
+
<TouchableOpacity key={i} onPress={() => setSelectedTime(time.startTime)}>
|
|
334
|
+
<TimeItem active={selectedTime === time.startTime}>
|
|
335
|
+
<OText
|
|
336
|
+
size={14}
|
|
337
|
+
color={selectedTime === time.startTime ? theme.colors.primary : theme.colors.textNormal}
|
|
338
|
+
style={{
|
|
339
|
+
lineHeight: 24
|
|
340
|
+
}}
|
|
341
|
+
>{time.startTime}</OText>
|
|
342
|
+
</TimeItem>
|
|
343
|
+
</TouchableOpacity>
|
|
344
|
+
))}
|
|
345
|
+
{hoursList.length % 3 === 2 && (
|
|
346
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
347
|
+
)}
|
|
348
|
+
</TimeContentWrapper>
|
|
349
|
+
</TimeListWrapper>
|
|
350
|
+
</OrderTimeWrapper>
|
|
351
|
+
)}
|
|
352
|
+
</View>
|
|
353
|
+
</Container>
|
|
341
354
|
</>
|
|
342
355
|
);
|
|
343
356
|
};
|
|
@@ -6,61 +6,37 @@ export const Container = styled.ScrollView`
|
|
|
6
6
|
padding: 0 20px;
|
|
7
7
|
padding-bottom: 20px;
|
|
8
8
|
`
|
|
9
|
-
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
margin-bottom: 20px;
|
|
12
|
-
`
|
|
9
|
+
|
|
13
10
|
export const WrapSelectOption = styled.TouchableOpacity`
|
|
14
11
|
flex-direction: row;
|
|
15
12
|
align-items: center;
|
|
16
13
|
margin-vertical: 5px;
|
|
17
14
|
`
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
flex-direction: row;
|
|
21
|
-
margin-vertical: 10px;
|
|
15
|
+
export const OrderTimeWrapper = styled.View`
|
|
16
|
+
margin-top: 34px;
|
|
22
17
|
`
|
|
23
|
-
export const Day = styled.TouchableOpacity`
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
border-right-width: 1px;
|
|
29
|
-
width: 25%;
|
|
30
|
-
margin-vertical: 10px;
|
|
31
|
-
border-color: ${(props: any) => props.theme.colors.textSecondary};
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
`
|
|
37
|
-
export const WrapHours = styled.ScrollView`
|
|
38
|
-
border-width: 1px;
|
|
39
|
-
border-color: ${(props: any) => props.theme.colors.border};
|
|
40
|
-
border-radius: 7.6px;
|
|
41
|
-
margin-top: 6px;
|
|
42
|
-
height: 140px;
|
|
43
|
-
max-height: 140px;
|
|
19
|
+
export const TimeListWrapper = styled.ScrollView`
|
|
20
|
+
margin-top: 30px;
|
|
21
|
+
max-height: 160px;
|
|
44
22
|
`
|
|
45
|
-
|
|
23
|
+
|
|
24
|
+
export const TimeContentWrapper = styled.View`
|
|
46
25
|
flex: 1;
|
|
47
26
|
flex-wrap: wrap;
|
|
48
27
|
flex-direction: row;
|
|
49
28
|
justify-content: space-between;
|
|
50
|
-
margin: 0 20px;
|
|
51
29
|
`
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
|
|
31
|
+
export const TimeItem = styled.View`
|
|
32
|
+
width: 86px;
|
|
33
|
+
height: 34px;
|
|
34
|
+
background: #E9ECEF;
|
|
35
|
+
border-radius: 7.6px;
|
|
54
36
|
justify-content: center;
|
|
55
37
|
align-items: center;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
width: 90px;
|
|
61
|
-
margin-vertical: 7px;
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
export const WrapDelveryTime = styled.View`
|
|
65
|
-
flex: 1;
|
|
38
|
+
margin: 10px 0px;
|
|
39
|
+
${({ active }: any) => active && css`
|
|
40
|
+
background: #F5F9FF;
|
|
41
|
+
`}
|
|
66
42
|
`
|
|
@@ -155,7 +155,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
155
155
|
const { product, loading, error } = productObject;
|
|
156
156
|
const [gallery, setGallery] = useState([])
|
|
157
157
|
const [thumbsSwiper, setThumbsSwiper] = useState(0)
|
|
158
|
-
|
|
158
|
+
const [indexGallery, setIndexGallery] = useState(0)
|
|
159
159
|
const [selOpt, setSelectedOpt] = useState(0);
|
|
160
160
|
const [isHaveWeight, setIsHaveWeight] = useState(false)
|
|
161
161
|
const [qtyBy, setQtyBy] = useState({
|
|
@@ -208,7 +208,10 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
const handleClickThumb = (index: number) => {
|
|
211
|
-
|
|
211
|
+
if (index !== indexGallery) {
|
|
212
|
+
swiperRef?.current.scrollBy(index - thumbsSwiper, true);
|
|
213
|
+
setIndexGallery(index)
|
|
214
|
+
}
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
const handleRedirectLogin = () => {
|
|
@@ -455,7 +458,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
455
458
|
textDecorationLine: 'line-through',
|
|
456
459
|
marginLeft: 7,
|
|
457
460
|
marginRight: 7
|
|
458
|
-
}}>{parsePrice(product?.offer_price)}</OText>
|
|
461
|
+
}}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
459
462
|
)}
|
|
460
463
|
</View>
|
|
461
464
|
)}
|
|
@@ -51,7 +51,6 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
51
51
|
|
|
52
52
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
53
53
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
|
-
|
|
55
54
|
return (
|
|
56
55
|
<Container>
|
|
57
56
|
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
@@ -73,54 +72,57 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
73
72
|
</OText>
|
|
74
73
|
</IconControl>
|
|
75
74
|
{showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
75
|
+
<QuantityControl>
|
|
76
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
77
|
+
<>
|
|
78
|
+
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
79
|
+
<OIcon
|
|
80
|
+
src={theme.images.general.minus}
|
|
81
|
+
width={16}
|
|
82
|
+
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
83
|
+
/>
|
|
84
|
+
</Checkbox>
|
|
85
|
+
<OText size={12} mLeft={5} mRight={5}>
|
|
86
|
+
{state.quantity}
|
|
87
|
+
</OText>
|
|
88
|
+
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
89
|
+
<OIcon
|
|
90
|
+
src={theme.images.general.plus}
|
|
91
|
+
width={16}
|
|
92
|
+
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
93
|
+
/>
|
|
94
|
+
</Checkbox>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</QuantityControl>
|
|
98
|
+
<PositionControl>
|
|
99
|
+
{option?.with_half_option && state?.selected && (
|
|
100
|
+
<>
|
|
101
|
+
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
102
|
+
<OIcon
|
|
103
|
+
src={theme.images.general.half_l}
|
|
104
|
+
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
105
|
+
width={16}
|
|
106
|
+
style={styles.inverse}
|
|
107
|
+
/>
|
|
108
|
+
</Circle>
|
|
109
|
+
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
110
|
+
<OIcon
|
|
111
|
+
src={theme.images.general.half_f}
|
|
112
|
+
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
113
|
+
width={16}
|
|
114
|
+
/>
|
|
115
|
+
</Circle>
|
|
116
|
+
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
117
|
+
<OIcon
|
|
118
|
+
src={theme.images.general.half_r}
|
|
119
|
+
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
120
|
+
width={16}
|
|
121
|
+
/>
|
|
122
|
+
</Circle>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
125
|
+
</PositionControl>
|
|
124
126
|
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
125
127
|
+ {parsePrice(price)}
|
|
126
128
|
</OText>
|
|
@@ -5,28 +5,35 @@ export const Container = styled.View`
|
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
padding: 10px;
|
|
8
|
+
width: 100%;
|
|
8
9
|
`
|
|
9
10
|
|
|
10
11
|
export const IconControl = styled.TouchableOpacity`
|
|
11
12
|
flex-direction: row;
|
|
12
|
-
|
|
13
|
+
width: 45%;
|
|
13
14
|
align-items: center;
|
|
14
15
|
`
|
|
15
16
|
|
|
16
17
|
export const QuantityControl = styled.View`
|
|
17
18
|
flex-direction: row;
|
|
18
19
|
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
19
21
|
margin-horizontal: 5px;
|
|
22
|
+
flex: 1;
|
|
23
|
+
width: 60px;
|
|
24
|
+
|
|
20
25
|
`
|
|
21
26
|
|
|
22
27
|
export const PositionControl = styled.View`
|
|
23
28
|
flex-direction: row;
|
|
24
29
|
align-items: center;
|
|
25
30
|
margin-right: 5px;
|
|
31
|
+
flex: 1;
|
|
26
32
|
`
|
|
27
33
|
|
|
28
34
|
export const Checkbox = styled.TouchableOpacity`
|
|
29
35
|
`
|
|
30
36
|
|
|
31
37
|
export const Circle = styled.TouchableOpacity`
|
|
38
|
+
margin: 0 1px;
|
|
32
39
|
`
|
|
@@ -121,9 +121,9 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
121
121
|
{product?.name}
|
|
122
122
|
</OText>
|
|
123
123
|
<PricesContainer>
|
|
124
|
-
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
124
|
+
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
125
125
|
{product?.offer_price !== null && product?.in_offer && (
|
|
126
|
-
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
126
|
+
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
127
127
|
)}
|
|
128
128
|
</PricesContainer>
|
|
129
129
|
<OText
|
|
@@ -37,19 +37,33 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
37
37
|
const { top, bottom } = useSafeAreaInsets();
|
|
38
38
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
let billingDetails: any = {}
|
|
41
|
+
|
|
42
|
+
if (user?.name || user?.lastname) {
|
|
43
|
+
if (user?.name) {
|
|
44
|
+
billingDetails.name = user?.name
|
|
45
|
+
}
|
|
46
|
+
if (user?.lastname) {
|
|
47
|
+
billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (user?.email) {
|
|
52
|
+
billingDetails.email = user?.email
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (user?.address) {
|
|
56
|
+
billingDetails.addressLine1 = user?.address
|
|
57
|
+
}
|
|
45
58
|
|
|
46
59
|
const createPayMethod = async () => {
|
|
60
|
+
const params: any = { type: 'Card' }
|
|
61
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
62
|
+
params.billingDetails = billingDetails
|
|
63
|
+
}
|
|
47
64
|
try {
|
|
48
65
|
setCreatePmLoading(true)
|
|
49
|
-
const { paymentMethod } = await createPaymentMethod(
|
|
50
|
-
type: 'Card',
|
|
51
|
-
billingDetails,
|
|
52
|
-
});
|
|
66
|
+
const { paymentMethod } = await createPaymentMethod(params);
|
|
53
67
|
|
|
54
68
|
setCreatePmLoading(false)
|
|
55
69
|
handleSource && handleSource({
|
|
@@ -79,11 +93,12 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
79
93
|
createPayMethod();
|
|
80
94
|
return
|
|
81
95
|
}
|
|
96
|
+
const params: any = { type: 'Card' }
|
|
97
|
+
if (Object.keys(billingDetails).length > 0) {
|
|
98
|
+
params.billingDetails = billingDetails
|
|
99
|
+
}
|
|
82
100
|
try {
|
|
83
|
-
const { setupIntent, error } = await confirmSetupIntent(requirements,
|
|
84
|
-
type: 'Card',
|
|
85
|
-
billingDetails,
|
|
86
|
-
});
|
|
101
|
+
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|
|
87
102
|
|
|
88
103
|
if (setupIntent?.status === 'Succeeded') {
|
|
89
104
|
stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
|
|
@@ -36,7 +36,7 @@ export const TaxInformation = (props: taxInformationParams) => {
|
|
|
36
36
|
? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null)
|
|
37
37
|
: type === 'fee'
|
|
38
38
|
? (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))
|
|
39
|
-
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code))
|
|
39
|
+
: Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code)) && product?.offers?.find((offer : any) => offer?.name === data?.name)
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -144,7 +144,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
144
144
|
{isFarAway && (
|
|
145
145
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
146
146
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
147
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', '
|
|
147
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
148
148
|
</FarAwayMessage>
|
|
149
149
|
)}
|
|
150
150
|
<View style={styles.wrapperOrderOptions}>
|