ordering-ui-react-native 0.14.85 → 0.14.87-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -3
- package/src/DeliveryApp.tsx +34 -2
- package/src/assets/images/no-network.png +0 -0
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +7 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/providers/AlertProvider.tsx +4 -1
- package/src/theme.json +2 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +196 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/NetworkError/index.tsx +61 -0
- package/themes/business/src/components/NetworkError/styles.tsx +11 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +351 -59
- package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
- package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
- package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
- package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
- package/themes/business/src/types/index.tsx +4 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/index.tsx +2 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
- package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/kiosk/src/types/index.d.ts +4 -0
- package/themes/original/index.tsx +28 -6
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +27 -1
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
- package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
- package/themes/original/src/components/BusinessesListing/index.tsx +23 -22
- package/themes/original/src/components/Cart/index.tsx +43 -10
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +54 -17
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/Messages/index.tsx +24 -21
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/NetworkError/index.tsx +61 -0
- package/themes/original/src/components/NetworkError/styles.tsx +11 -0
- package/themes/original/src/components/OrderDetails/index.tsx +103 -124
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +2 -3
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +16 -40
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +164 -114
- package/themes/original/src/components/ProductForm/styles.tsx +5 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
- package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
- package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
- package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
- package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -9
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +20 -0
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/themes/original/src/types/index.tsx +47 -10
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -163
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
ExtraOptionWrap,
|
|
38
38
|
WeightUnitSwitch,
|
|
39
39
|
WeightUnitItem,
|
|
40
|
-
TopActions
|
|
40
|
+
TopActions,
|
|
41
|
+
ProductSummary
|
|
41
42
|
} from './styles';
|
|
42
43
|
import { OButton, OIcon, OInput, OText } from '../shared';
|
|
43
44
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
@@ -45,7 +46,6 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
|
45
46
|
import { NotFoundSource } from '../NotFoundSource';
|
|
46
47
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
47
48
|
import { useState } from 'react';
|
|
48
|
-
|
|
49
49
|
const windowHeight = Dimensions.get('window').height;
|
|
50
50
|
const windowWidth = Dimensions.get('window').width;
|
|
51
51
|
|
|
@@ -170,8 +170,11 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
170
170
|
pieces: true
|
|
171
171
|
})
|
|
172
172
|
const [pricePerWeightUnit, setPricePerWeightUnit] = useState<any>(null)
|
|
173
|
-
|
|
173
|
+
const scrollViewRef = useRef<any>(null);
|
|
174
174
|
const swiperRef: any = useRef(null)
|
|
175
|
+
const [optionLayout, setOptionLayout] = useState<any>({})
|
|
176
|
+
const [headerRefHeight, setHeaderRefHeight] = useState(0)
|
|
177
|
+
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
175
178
|
|
|
176
179
|
const isError = (id: number) => {
|
|
177
180
|
let bgColor = theme.colors.white;
|
|
@@ -253,6 +256,28 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
253
256
|
handleChangeProductCartQuantity(quantity)
|
|
254
257
|
}
|
|
255
258
|
|
|
259
|
+
const scrollDown = (id: any) => {
|
|
260
|
+
const isErrors = Object.values(errors).length > 0
|
|
261
|
+
if (!isErrors) {
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
const targetOptionId = Object.getOwnPropertyNames(errors).filter(item => !item.includes(id))[0]
|
|
265
|
+
const targetY = optionLayout[targetOptionId]?.y
|
|
266
|
+
if (targetY) {
|
|
267
|
+
scrollViewRef.current.scrollTo({
|
|
268
|
+
y: targetY + headerRefHeight + summaryRefHeight,
|
|
269
|
+
animated: true
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const handleOnLayout = (event: any, optionId: any) => {
|
|
275
|
+
const _optionLayout = { ...optionLayout }
|
|
276
|
+
const optionKey = 'id:' + optionId
|
|
277
|
+
_optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
|
|
278
|
+
setOptionLayout(_optionLayout)
|
|
279
|
+
}
|
|
280
|
+
|
|
256
281
|
useEffect(() => {
|
|
257
282
|
const imageList: any = []
|
|
258
283
|
const videoList: any = []
|
|
@@ -264,8 +289,24 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
264
289
|
}
|
|
265
290
|
if (img?.video) {
|
|
266
291
|
const keys = img?.video.split('/')
|
|
267
|
-
|
|
268
|
-
|
|
292
|
+
let _videoId = keys[keys.length - 1]
|
|
293
|
+
|
|
294
|
+
if (_videoId.includes('watch')) {
|
|
295
|
+
const __url = _videoId.split('=')[1]
|
|
296
|
+
_videoId = __url
|
|
297
|
+
} else if (_videoId.includes('?')) {
|
|
298
|
+
const __url = _videoId.split('?')[0]
|
|
299
|
+
_videoId = __url
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (_videoId.search(/&/i) >= 0) {
|
|
303
|
+
_videoId = _videoId.split('&')[0]
|
|
304
|
+
} else if (_videoId.search(/\?/i) >= 0) {
|
|
305
|
+
_videoId = _videoId.split('?')[0]
|
|
306
|
+
}
|
|
307
|
+
if ((_videoId.length === 11)) {
|
|
308
|
+
videoList.push(_videoId)
|
|
309
|
+
}
|
|
269
310
|
}
|
|
270
311
|
}
|
|
271
312
|
}
|
|
@@ -304,9 +345,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
304
345
|
</OText>
|
|
305
346
|
</TouchableOpacity>
|
|
306
347
|
)}
|
|
307
|
-
{options.map(({ id, name, respect_to }: any) => (
|
|
348
|
+
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
308
349
|
<React.Fragment key={`cont_key_${id}`}>
|
|
309
|
-
{respect_to == null && (
|
|
350
|
+
{respect_to == null && suboptions?.length > 0 && (
|
|
310
351
|
<TouchableOpacity
|
|
311
352
|
key={`eopt_key_${id}`}
|
|
312
353
|
onPress={() => setSelectedOpt(id)}
|
|
@@ -343,10 +384,10 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
343
384
|
<OIcon src={theme.images.general.arrow_left} width={15} />
|
|
344
385
|
</TopActions>
|
|
345
386
|
</TopHeader>
|
|
346
|
-
<ScrollView>
|
|
387
|
+
<ScrollView ref={scrollViewRef}>
|
|
347
388
|
{!error && (
|
|
348
389
|
<View style={{ paddingBottom: 80 }}>
|
|
349
|
-
<WrapHeader>
|
|
390
|
+
<WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
|
|
350
391
|
{loading && !product ? (
|
|
351
392
|
<View style={styles.productHeaderSkeleton}>
|
|
352
393
|
<Placeholder Animation={Fade}>
|
|
@@ -396,7 +437,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
396
437
|
<FastImage
|
|
397
438
|
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
|
|
398
439
|
source={{
|
|
399
|
-
uri: optimizeImage(img, '
|
|
440
|
+
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
400
441
|
priority: FastImage.priority.normal,
|
|
401
442
|
}}
|
|
402
443
|
/>
|
|
@@ -470,96 +511,98 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
470
511
|
)}
|
|
471
512
|
</WrapHeader>
|
|
472
513
|
<WrapContent>
|
|
473
|
-
<
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
<
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
<
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
{!!product?.calories && (
|
|
496
|
-
<OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
|
|
514
|
+
<ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
|
|
515
|
+
<ProductTitle>
|
|
516
|
+
{loading && !product ? (
|
|
517
|
+
<Placeholder Animation={Fade}>
|
|
518
|
+
<View
|
|
519
|
+
style={{
|
|
520
|
+
flexDirection: 'row',
|
|
521
|
+
justifyContent: 'space-between',
|
|
522
|
+
}}>
|
|
523
|
+
<PlaceholderLine width={40} height={20} />
|
|
524
|
+
<PlaceholderLine width={30} height={20} />
|
|
525
|
+
</View>
|
|
526
|
+
</Placeholder>
|
|
527
|
+
) : (
|
|
528
|
+
<>
|
|
529
|
+
<View style={{ flexDirection: 'row' }}>
|
|
530
|
+
<OText
|
|
531
|
+
size={20}
|
|
532
|
+
lineHeight={30}
|
|
533
|
+
weight={'600'}
|
|
534
|
+
style={{ flex: 1, marginBottom: 10 }}>
|
|
535
|
+
{product?.name || productCart.name}
|
|
497
536
|
</OText>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
<OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
|
|
502
|
-
{
|
|
503
|
-
((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
|
|
504
|
-
&& <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
|
|
505
|
-
}
|
|
506
|
-
{product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
|
|
507
|
-
<> · </>
|
|
508
|
-
)}
|
|
509
|
-
{product?.estimated_person
|
|
510
|
-
&& <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
|
|
511
|
-
}
|
|
512
|
-
</OText>
|
|
513
|
-
)}
|
|
514
|
-
{isHaveWeight ? (
|
|
515
|
-
<OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
|
|
516
|
-
) : (
|
|
517
|
-
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
518
|
-
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
519
|
-
{product?.offer_price !== null && product?.in_offer && (
|
|
520
|
-
<OText style={{
|
|
521
|
-
fontSize: 14,
|
|
522
|
-
color: '#808080',
|
|
523
|
-
textDecorationLine: 'line-through',
|
|
524
|
-
marginLeft: 7,
|
|
525
|
-
marginRight: 7
|
|
526
|
-
}}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
537
|
+
{!!product?.calories && (
|
|
538
|
+
<OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
|
|
539
|
+
</OText>
|
|
527
540
|
)}
|
|
528
541
|
</View>
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
542
|
+
{((!!product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (!!product?.estimated_person)) && (
|
|
543
|
+
<OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
|
|
544
|
+
{
|
|
545
|
+
((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
|
|
546
|
+
&& <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
|
|
547
|
+
}
|
|
548
|
+
{product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
|
|
549
|
+
<> · </>
|
|
550
|
+
)}
|
|
551
|
+
{product?.estimated_person
|
|
552
|
+
&& <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
|
|
553
|
+
}
|
|
554
|
+
</OText>
|
|
555
|
+
)}
|
|
556
|
+
{isHaveWeight ? (
|
|
557
|
+
<OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
|
|
558
|
+
) : (
|
|
559
|
+
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
560
|
+
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
561
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
562
|
+
<OText style={{
|
|
563
|
+
fontSize: 14,
|
|
564
|
+
color: '#808080',
|
|
565
|
+
textDecorationLine: 'line-through',
|
|
566
|
+
marginLeft: 7,
|
|
567
|
+
marginRight: 7
|
|
568
|
+
}}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
569
|
+
)}
|
|
570
|
+
</View>
|
|
571
|
+
)}
|
|
572
|
+
</>
|
|
573
|
+
)}
|
|
574
|
+
</ProductTitle>
|
|
575
|
+
<ProductDescription>
|
|
576
|
+
<OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
|
|
577
|
+
{product?.description || productCart?.description}
|
|
578
|
+
</OText>
|
|
579
|
+
</ProductDescription>
|
|
580
|
+
<ScrollView
|
|
581
|
+
horizontal
|
|
582
|
+
showsHorizontalScrollIndicator={false}
|
|
583
|
+
contentContainerStyle={{ paddingBottom: 30 }}
|
|
584
|
+
>
|
|
585
|
+
{product?.tags?.map((tag: any) => (
|
|
586
|
+
<View
|
|
587
|
+
key={tag.id}
|
|
588
|
+
style={styles.productTagWrapper}
|
|
589
|
+
>
|
|
590
|
+
{!!tag?.image ? (
|
|
591
|
+
<OIcon
|
|
592
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
593
|
+
style={styles.productTagImageStyle}
|
|
594
|
+
/>
|
|
595
|
+
) : (
|
|
596
|
+
<OIcon
|
|
597
|
+
src={theme.images?.dummies?.product}
|
|
598
|
+
style={styles.productTagImageStyle}
|
|
599
|
+
/>
|
|
600
|
+
)}
|
|
601
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.productTagNameStyle}>{tag.name}</OText>
|
|
602
|
+
</View>
|
|
603
|
+
))}
|
|
604
|
+
</ScrollView>
|
|
605
|
+
</ProductSummary>
|
|
563
606
|
{loading && !product ? (
|
|
564
607
|
<>
|
|
565
608
|
{[...Array(2)].map((item, i) => (
|
|
@@ -658,7 +701,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
658
701
|
return (
|
|
659
702
|
<React.Fragment key={`popt_${option.id}`}>
|
|
660
703
|
{showOption(option) && (
|
|
661
|
-
<View style={styles.optionContainer}>
|
|
704
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
662
705
|
<ProductOption
|
|
663
706
|
option={option}
|
|
664
707
|
currentState={currentState}
|
|
@@ -695,6 +738,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
695
738
|
isSoldOut ||
|
|
696
739
|
maxProductQuantity <= 0
|
|
697
740
|
}
|
|
741
|
+
scrollDown={scrollDown}
|
|
742
|
+
error={errors[`id:${option.id}`]}
|
|
698
743
|
/>
|
|
699
744
|
);
|
|
700
745
|
},
|
|
@@ -834,9 +879,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
834
879
|
</ScrollView>
|
|
835
880
|
{!loading && !error && product && (
|
|
836
881
|
<ProductActions ios={Platform?.OS === 'ios'}>
|
|
837
|
-
<
|
|
838
|
-
{
|
|
839
|
-
|
|
882
|
+
<View>
|
|
883
|
+
<OText size={16} lineHeight={24} weight={'600'}>
|
|
884
|
+
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
885
|
+
</OText>
|
|
886
|
+
{product?.minimum_per_order && productCart?.quantity < product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
|
|
887
|
+
{product?.maximum_per_order && productCart?.quantity > product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
|
|
888
|
+
</View>
|
|
840
889
|
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
841
890
|
<View style={styles.quantityControl}>
|
|
842
891
|
<TouchableOpacity
|
|
@@ -855,7 +904,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
855
904
|
{qtyBy?.pieces && (
|
|
856
905
|
<TextInput
|
|
857
906
|
keyboardType='numeric'
|
|
858
|
-
value={`${productCart?.quantity > 0 ? productCart?.quantity: ''}`}
|
|
907
|
+
value={`${productCart?.quantity > 0 ? productCart?.quantity : ''}`}
|
|
859
908
|
onChangeText={(val: any) => onChangeProductCartQuantity(parseInt(val))}
|
|
860
909
|
editable={!orderState.loading}
|
|
861
910
|
style={{
|
|
@@ -935,28 +984,29 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
935
984
|
style={{
|
|
936
985
|
width: isSoldOut || maxProductQuantity <= 0 ? '60%' : '40%',
|
|
937
986
|
}}>
|
|
938
|
-
{productCart &&
|
|
939
|
-
!isSoldOut &&
|
|
940
|
-
maxProductQuantity > 0 &&
|
|
987
|
+
{((productCart &&
|
|
941
988
|
auth &&
|
|
942
|
-
orderState.options?.address_id && (
|
|
989
|
+
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
943
990
|
<OButton
|
|
944
991
|
onClick={() => handleSaveProduct()}
|
|
945
992
|
imgRightSrc=""
|
|
946
993
|
text={`${orderState.loading
|
|
947
994
|
? t('LOADING', 'Loading')
|
|
948
|
-
:
|
|
949
|
-
? t('
|
|
950
|
-
:
|
|
995
|
+
: (isSoldOut || maxProductQuantity <= 0)
|
|
996
|
+
? t('SOLD_OUT', 'Sold out')
|
|
997
|
+
: editMode
|
|
998
|
+
? t('UPDATE', 'Update')
|
|
999
|
+
: t('ADD', 'Add')
|
|
951
1000
|
}`}
|
|
1001
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
952
1002
|
textStyle={{
|
|
953
|
-
color:
|
|
1003
|
+
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
954
1004
|
fontSize: orderState.loading || editMode ? 10 : 14
|
|
955
1005
|
}}
|
|
956
1006
|
style={{
|
|
957
|
-
backgroundColor:
|
|
958
|
-
borderColor:
|
|
959
|
-
opacity:
|
|
1007
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
1008
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
1009
|
+
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
960
1010
|
borderRadius: 7.6,
|
|
961
1011
|
height: 44,
|
|
962
1012
|
shadowOpacity: 0,
|
|
@@ -976,7 +1026,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
976
1026
|
) : (
|
|
977
1027
|
<OButton onClick={navigation.navigate('AddressList')} />
|
|
978
1028
|
))}
|
|
979
|
-
{
|
|
1029
|
+
{!auth && (
|
|
980
1030
|
<OButton
|
|
981
1031
|
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
982
1032
|
onClick={() => handleRedirectLogin()}
|
|
@@ -6,9 +6,10 @@ export const WrapHeader = styled.View`
|
|
|
6
6
|
`
|
|
7
7
|
|
|
8
8
|
export const TopActions = styled.TouchableOpacity`
|
|
9
|
-
height:
|
|
9
|
+
height: 60px;
|
|
10
10
|
justify-content: center;
|
|
11
11
|
padding-horizontal: 30px;
|
|
12
|
+
width: 80px;
|
|
12
13
|
`;
|
|
13
14
|
|
|
14
15
|
export const TopHeader = styled.View`
|
|
@@ -48,7 +49,6 @@ export const ProductDescription = styled.View`
|
|
|
48
49
|
`
|
|
49
50
|
|
|
50
51
|
export const ProductEditions = styled.View`
|
|
51
|
-
|
|
52
52
|
`
|
|
53
53
|
|
|
54
54
|
export const SectionTitle = styled.View`
|
|
@@ -71,7 +71,7 @@ export const ProductActions = styled.View`
|
|
|
71
71
|
position: absolute;
|
|
72
72
|
bottom: 0px;
|
|
73
73
|
min-height: 70px;
|
|
74
|
-
padding-top: ${(props
|
|
74
|
+
padding-top: ${(props: any) => props.ios ? '20px' : '0'};
|
|
75
75
|
padding-horizontal: 40px;
|
|
76
76
|
width: 100%;
|
|
77
77
|
flex-direction: row;
|
|
@@ -97,3 +97,5 @@ export const WeightUnitItem = styled.View`
|
|
|
97
97
|
background-color: ${(props: any) => props.theme.colors.primary}20;
|
|
98
98
|
`}
|
|
99
99
|
`
|
|
100
|
+
export const ProductSummary = styled.View`
|
|
101
|
+
`
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ProductOptionSuboption as ProductSubOptionController
|
|
6
6
|
} from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native';
|
|
8
|
-
import { StyleSheet } from 'react-native'
|
|
8
|
+
import { StyleSheet, View } from 'react-native'
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
Container,
|
|
@@ -27,7 +27,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
27
27
|
suboption,
|
|
28
28
|
toggleSelect,
|
|
29
29
|
changePosition,
|
|
30
|
-
disabled
|
|
30
|
+
disabled,
|
|
31
|
+
error,
|
|
32
|
+
scrollDown
|
|
31
33
|
} = props
|
|
32
34
|
|
|
33
35
|
const theme = useTheme();
|
|
@@ -38,6 +40,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
38
40
|
|
|
39
41
|
const handleSuboptionClick = () => {
|
|
40
42
|
toggleSelect()
|
|
43
|
+
if (error) {
|
|
44
|
+
scrollDown(option?.id)
|
|
45
|
+
}
|
|
41
46
|
if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
|
|
42
47
|
setShowMessage(true)
|
|
43
48
|
}
|
|
@@ -52,81 +57,83 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
52
57
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
53
58
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
59
|
return (
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
{(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
state?.selected ? (
|
|
65
|
-
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
60
|
+
<View>
|
|
61
|
+
<Container onPress={() => handleSuboptionClick()}>
|
|
62
|
+
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
63
|
+
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
64
|
+
state?.selected ? (
|
|
65
|
+
<OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
|
|
66
|
+
) : (
|
|
67
|
+
<OIcon src={theme.images.general.check_nor} color={theme.colors.disabled} width={16} />
|
|
68
|
+
)
|
|
66
69
|
) : (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
state?.selected ? (
|
|
71
|
+
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
72
|
+
) : (
|
|
73
|
+
<OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
|
|
74
|
+
)
|
|
75
|
+
)}
|
|
76
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={10} style={{ flex: 1 }}>
|
|
77
|
+
{suboption?.name}
|
|
78
|
+
</OText>
|
|
79
|
+
</IconControl>
|
|
80
|
+
<QuantityControl>
|
|
81
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
82
|
+
<>
|
|
83
|
+
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
84
|
+
<OIcon
|
|
85
|
+
src={theme.images.general.minus}
|
|
86
|
+
width={16}
|
|
87
|
+
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
88
|
+
/>
|
|
89
|
+
</Checkbox>
|
|
90
|
+
<OText size={12} mLeft={5} mRight={5}>
|
|
91
|
+
{state.quantity}
|
|
92
|
+
</OText>
|
|
93
|
+
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
94
|
+
<OIcon
|
|
95
|
+
src={theme.images.general.plus}
|
|
96
|
+
width={16}
|
|
97
|
+
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
98
|
+
/>
|
|
99
|
+
</Checkbox>
|
|
100
|
+
</>
|
|
101
|
+
)}
|
|
102
|
+
</QuantityControl>
|
|
103
|
+
<PositionControl>
|
|
104
|
+
{option?.with_half_option && state?.selected && (
|
|
105
|
+
<>
|
|
106
|
+
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
107
|
+
<OIcon
|
|
108
|
+
src={theme.images.general.half_l}
|
|
109
|
+
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
110
|
+
width={16}
|
|
111
|
+
style={styles.inverse}
|
|
112
|
+
/>
|
|
113
|
+
</Circle>
|
|
114
|
+
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
115
|
+
<OIcon
|
|
116
|
+
src={theme.images.general.half_f}
|
|
117
|
+
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
118
|
+
width={16}
|
|
119
|
+
/>
|
|
120
|
+
</Circle>
|
|
121
|
+
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
122
|
+
<OIcon
|
|
123
|
+
src={theme.images.general.half_r}
|
|
124
|
+
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
125
|
+
width={16}
|
|
126
|
+
/>
|
|
127
|
+
</Circle>
|
|
128
|
+
</>
|
|
129
|
+
)}
|
|
130
|
+
</PositionControl>
|
|
131
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
132
|
+
+ {parsePrice(price)}
|
|
72
133
|
</OText>
|
|
73
|
-
</
|
|
134
|
+
</Container>
|
|
74
135
|
{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>}
|
|
75
|
-
|
|
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>
|
|
126
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
127
|
-
+ {parsePrice(price)}
|
|
128
|
-
</OText>
|
|
129
|
-
</Container>
|
|
136
|
+
</View>
|
|
130
137
|
)
|
|
131
138
|
}
|
|
132
139
|
|