ordering-ui-react-native 0.14.85 → 0.14.86-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.
Files changed (134) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +34 -2
  3. package/src/assets/images/no-network.png +0 -0
  4. package/src/components/BusinessTypeFilter/index.tsx +9 -2
  5. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Cart/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +0 -1
  9. package/src/components/Home/index.tsx +3 -5
  10. package/src/components/LanguageSelector/index.tsx +65 -97
  11. package/src/components/LanguageSelector/styles.tsx +4 -17
  12. package/src/components/Messages/index.tsx +38 -30
  13. package/src/components/MomentOption/index.tsx +3 -1
  14. package/src/components/OrderDetails/index.tsx +26 -5
  15. package/src/components/PaymentOptions/index.tsx +7 -16
  16. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  17. package/src/components/ProductForm/index.tsx +1 -1
  18. package/src/components/ProductForm/styles.tsx +1 -0
  19. package/src/components/StripeElementsForm/index.tsx +27 -48
  20. package/src/components/UserProfileForm/index.tsx +35 -1
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/config.json +0 -2
  23. package/src/pages/Checkout.tsx +1 -1
  24. package/src/providers/AlertProvider.tsx +4 -1
  25. package/src/theme.json +2 -1
  26. package/src/types/index.tsx +2 -9
  27. package/src/utils/index.tsx +196 -1
  28. package/themes/business/index.tsx +4 -0
  29. package/themes/business/src/components/Chat/index.tsx +32 -31
  30. package/themes/business/src/components/NetworkError/index.tsx +61 -0
  31. package/themes/business/src/components/NetworkError/styles.tsx +11 -0
  32. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  34. package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
  35. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  36. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  37. package/themes/business/src/components/OrdersOption/index.tsx +351 -59
  38. package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
  39. package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
  42. package/themes/business/src/types/index.tsx +4 -0
  43. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  45. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/kiosk/index.tsx +2 -0
  47. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  48. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  49. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  50. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  51. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  52. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  53. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  54. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  55. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  56. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  57. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  58. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
  61. package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
  62. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  63. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  64. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  66. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  67. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  68. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  69. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  70. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  73. package/themes/kiosk/src/types/index.d.ts +4 -0
  74. package/themes/original/index.tsx +26 -6
  75. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
  77. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  78. package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
  79. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
  80. package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
  82. package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
  83. package/themes/original/src/components/BusinessesListing/index.tsx +23 -22
  84. package/themes/original/src/components/Cart/index.tsx +43 -10
  85. package/themes/original/src/components/Checkout/index.tsx +54 -17
  86. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  87. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  88. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  90. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
  91. package/themes/original/src/components/LoginForm/index.tsx +83 -68
  92. package/themes/original/src/components/Messages/index.tsx +19 -21
  93. package/themes/original/src/components/MomentOption/index.tsx +127 -152
  94. package/themes/original/src/components/MomentOption/styles.tsx +42 -18
  95. package/themes/original/src/components/NetworkError/index.tsx +61 -0
  96. package/themes/original/src/components/NetworkError/styles.tsx +11 -0
  97. package/themes/original/src/components/OrderDetails/index.tsx +103 -124
  98. package/themes/original/src/components/OrderProgress/index.tsx +2 -3
  99. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  100. package/themes/original/src/components/OrdersOption/index.tsx +16 -40
  101. package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
  102. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
  103. package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
  104. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  105. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  106. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  107. package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
  108. package/themes/original/src/components/ProductForm/index.tsx +35 -20
  109. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  110. package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
  111. package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
  112. package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
  113. package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
  114. package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
  115. package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
  116. package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
  117. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  118. package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
  119. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
  120. package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
  121. package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
  122. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  123. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  124. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  125. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  126. package/themes/original/src/components/UserProfile/index.tsx +13 -6
  127. package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
  128. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  129. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  130. package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
  131. package/themes/original/src/types/index.tsx +47 -10
  132. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  133. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  134. package/src/components/StripeMethodForm/index.tsx +0 -163
@@ -22,18 +22,23 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
22
22
  textStyle,
23
23
  flagStyle,
24
24
  noDropIcon,
25
- isDisabled
25
+ isDisabled,
26
+ isStartValidation
26
27
  } = props
27
28
 
28
29
  const theme = useTheme();
29
30
 
31
+ const [, t] = useLanguage()
32
+ const [{ configs }] = useConfig()
33
+ const phoneInput = useRef<PhoneInput>(null);
34
+ const [userphoneNumber, setUserphoneNumber] = useState('');
30
35
 
31
36
  const style = StyleSheet.create({
32
37
  input: {
33
38
  backgroundColor: theme.colors.white,
34
39
  borderRadius: 7.6,
35
40
  borderWidth: 1,
36
- borderColor: theme.colors.border,
41
+ borderColor: (isStartValidation && userphoneNumber === '') ? theme.colors.danger5 : theme.colors.border,
37
42
  paddingBottom: 0,
38
43
  paddingTop: 0,
39
44
  flexGrow: 1,
@@ -48,12 +53,6 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
48
53
  }
49
54
  })
50
55
 
51
-
52
- const [, t] = useLanguage()
53
- const [{ configs }] = useConfig()
54
- const phoneInput = useRef<PhoneInput>(null);
55
- const [userphoneNumber, setUserphoneNumber] = useState('');
56
-
57
56
  const handleChangeNumber = (number: any) => {
58
57
  setUserphoneNumber(number)
59
58
  }
@@ -97,6 +96,14 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
97
96
 
98
97
  return (
99
98
  <Wrapper onPress={() => forwardRef?.current?.focus?.()}>
99
+ {(isStartValidation && userphoneNumber === '') && (
100
+ <OText
101
+ size={14}
102
+ color={theme.colors.danger5}
103
+ >
104
+ {t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))}*
105
+ </OText>
106
+ )}
100
107
  <PhoneInput
101
108
  ref={phoneInput}
102
109
  disabled={isDisabled}
@@ -0,0 +1,114 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { View } from 'react-native'
3
+ import { PlaceSpot as PlaceSpotController, useLanguage } from 'ordering-components/native'
4
+ import { PlaceGroupContainer, PlaceSpotContainer } from './styles'
5
+ import { NotFoundSource } from '../NotFoundSource'
6
+ import { OText, ODropDown } from '../shared'
7
+ import { Placeholder, PlaceholderLine } from 'rn-placeholder'
8
+ import { PlaceSpotParams } from '../../types'
9
+
10
+ const PlaceSpotUI = (props: PlaceSpotParams) => {
11
+ const {
12
+ isOpenPlaceSpot,
13
+ cart,
14
+ placesState,
15
+ handleChangePlace,
16
+ getPlacesList,
17
+ setOpenPlaceModal
18
+ } = props
19
+
20
+ const [, t] = useLanguage()
21
+ const [placeGroupSelected, setPlaceGroupSelected] = useState<any>(null)
22
+
23
+ const getPlacesGroups = () => {
24
+ const groups = placesState.placeGroups?.filter((group: any) => group?.enabled && placesState?.places?.find((place: any) => place?.enabled && place?.place_group_id === group?.id))
25
+ return groups.map((group: any) => ({
26
+ value: group,
27
+ content: group?.name,
28
+ showOnSelected: group?.name
29
+ }))
30
+ }
31
+
32
+ const getPlaces = () => {
33
+ const places = placeGroupSelected && placesState?.places?.filter((place: any) => place?.enabled && place?.place_group_id === placeGroupSelected?.id)
34
+ return places.map((place: any) => ({
35
+ value: place,
36
+ content: place.name,
37
+ showOnSelected: place.name
38
+ }))
39
+ }
40
+
41
+ const handlerChangePlace = (place: any) => {
42
+ setOpenPlaceModal(false)
43
+ handleChangePlace(place)
44
+ }
45
+
46
+
47
+ useEffect(() => {
48
+ if (!placesState?.loading) {
49
+ const placeGroupOnCart = placesState?.placeGroups.find((group: any) => group?.id === cart?.place?.place_group_id)
50
+ setPlaceGroupSelected(placeGroupOnCart)
51
+ }
52
+ }, [placesState])
53
+
54
+ useEffect(() => {
55
+ getPlacesList()
56
+ }, [isOpenPlaceSpot])
57
+
58
+ return (
59
+ <PlaceSpotContainer>
60
+ {(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
61
+ <NotFoundSource
62
+ content={t('NO_PLACES_THIS_BUSINESS', 'There are not places for this business')}
63
+ />
64
+ )}
65
+ {placesState?.loading && (
66
+ <Placeholder>
67
+ <PlaceGroupContainer>
68
+ <PlaceholderLine width={100} height={25} />
69
+ <PlaceholderLine height={30} />
70
+ </PlaceGroupContainer>
71
+ <View>
72
+ <PlaceholderLine width={120} height={25} />
73
+ <PlaceholderLine height={30} />
74
+ </View>
75
+ </Placeholder>
76
+ )}
77
+ {!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
78
+ <>
79
+ <PlaceGroupContainer>
80
+ <OText size={16} mBottom={10}>{t('PLACE_GROUP', 'Place group')}</OText>
81
+ <ODropDown
82
+ placeholder={t('PLACE_GROUP', 'Place group')}
83
+ options={getPlacesGroups()}
84
+ onSelect={(group: any) => setPlaceGroupSelected(group)}
85
+ defaultValue={placeGroupSelected ?? cart?.place}
86
+ isModal
87
+ />
88
+ </PlaceGroupContainer>
89
+ {placeGroupSelected && (
90
+ <View>
91
+ <OText size={16} mBottom={10}>{t('SELECT_YOUR_SPOT', 'Select your spot')}</OText>
92
+ <ODropDown
93
+ onSelect={(place: any) => handlerChangePlace(place)}
94
+ placeholder={t('SELECT_YOUR_SPOT', 'Select your spot')}
95
+ options={getPlaces()}
96
+ defaultValue={placesState?.places?.find((place : any) => place?.id === cart?.place_id)}
97
+ isModal
98
+ />
99
+ </View>
100
+ )}
101
+ </>
102
+ )}
103
+ </PlaceSpotContainer>
104
+ )
105
+ }
106
+
107
+ export const PlaceSpot = (props: PlaceSpotParams) => {
108
+ const placeSpotProps = {
109
+ ...props,
110
+ UIComponent: PlaceSpotUI
111
+ }
112
+
113
+ return <PlaceSpotController {...placeSpotProps} />
114
+ }
@@ -0,0 +1,11 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const PlaceSpotContainer = styled.View`
4
+ min-height: 300px;
5
+ padding: 20px;
6
+ `
7
+
8
+ export const PlaceGroupContainer = styled.View`
9
+ margin-bottom: 40px;
10
+ margin-top: 20px;
11
+ `
@@ -86,6 +86,10 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
86
86
  id: order?.id,
87
87
  business_id: order?.business_id,
88
88
  logo: order.business?.logo,
89
+ driver: order?.driver,
90
+ products: order?.products,
91
+ review: order?.review,
92
+ user_review: order?.user_review
89
93
  },
90
94
  });
91
95
  };
@@ -264,7 +264,15 @@ export const ProductOptionsUI = (props: any) => {
264
264
  }
265
265
  if (img?.video) {
266
266
  const keys = img?.video.split('/')
267
- const _videoId = keys[keys.length - 1]
267
+ let _videoId = keys[keys.length - 1]
268
+ if (_videoId.includes('watch')) {
269
+ const __url = _videoId.split('=')[1]
270
+ _videoId = __url
271
+ }
272
+ if (_videoId.includes('?')) {
273
+ const __url = _videoId.split('?')[0]
274
+ _videoId = __url
275
+ }
268
276
  videoList.push(_videoId)
269
277
  }
270
278
  }
@@ -304,9 +312,9 @@ export const ProductOptionsUI = (props: any) => {
304
312
  </OText>
305
313
  </TouchableOpacity>
306
314
  )}
307
- {options.map(({ id, name, respect_to }: any) => (
315
+ {options.map(({ id, name, respect_to, suboptions }: any) => (
308
316
  <React.Fragment key={`cont_key_${id}`}>
309
- {respect_to == null && (
317
+ {respect_to == null && suboptions?.length > 0 && (
310
318
  <TouchableOpacity
311
319
  key={`eopt_key_${id}`}
312
320
  onPress={() => setSelectedOpt(id)}
@@ -396,7 +404,7 @@ export const ProductOptionsUI = (props: any) => {
396
404
  <FastImage
397
405
  style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
398
406
  source={{
399
- uri: optimizeImage(img, 'h_258,c_limit'),
407
+ uri: optimizeImage(img, 'h_1024,c_limit'),
400
408
  priority: FastImage.priority.normal,
401
409
  }}
402
410
  />
@@ -436,7 +444,7 @@ export const ProductOptionsUI = (props: any) => {
436
444
  >
437
445
  {img.includes('image') ? (
438
446
  <OIcon
439
- url={img}
447
+ url={optimizeImage(img, 'h_250,c_limit')}
440
448
  style={{
441
449
  borderColor: theme.colors.lightGray,
442
450
  borderRadius: 8,
@@ -834,9 +842,13 @@ export const ProductOptionsUI = (props: any) => {
834
842
  </ScrollView>
835
843
  {!loading && !error && product && (
836
844
  <ProductActions ios={Platform?.OS === 'ios'}>
837
- <OText size={16} lineHeight={24} weight={'600'}>
838
- {productCart.total ? parsePrice(productCart?.total) : ''}
839
- </OText>
845
+ <View>
846
+ <OText size={16} lineHeight={24} weight={'600'}>
847
+ {productCart.total ? parsePrice(productCart?.total) : ''}
848
+ </OText>
849
+ {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>}
850
+ {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>}
851
+ </View>
840
852
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
841
853
  <View style={styles.quantityControl}>
842
854
  <TouchableOpacity
@@ -845,6 +857,7 @@ export const ProductOptionsUI = (props: any) => {
845
857
  <OIcon
846
858
  src={theme.images.general.minus}
847
859
  width={16}
860
+ style={{ borderWidth: 1, borderColor: 'red' }}
848
861
  color={
849
862
  productCart.quantity === 1 || isSoldOut
850
863
  ? theme.colors.backgroundGray
@@ -888,6 +901,7 @@ export const ProductOptionsUI = (props: any) => {
888
901
  <OIcon
889
902
  src={theme.images.general.plus}
890
903
  width={16}
904
+ style={{ borderWidth: 1, borderColor: 'red' }}
891
905
  color={
892
906
  maxProductQuantity <= 0 ||
893
907
  productCart.quantity >= maxProductQuantity ||
@@ -935,28 +949,29 @@ export const ProductOptionsUI = (props: any) => {
935
949
  style={{
936
950
  width: isSoldOut || maxProductQuantity <= 0 ? '60%' : '40%',
937
951
  }}>
938
- {productCart &&
939
- !isSoldOut &&
940
- maxProductQuantity > 0 &&
952
+ {((productCart &&
941
953
  auth &&
942
- orderState.options?.address_id && (
954
+ orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
943
955
  <OButton
944
956
  onClick={() => handleSaveProduct()}
945
957
  imgRightSrc=""
946
958
  text={`${orderState.loading
947
959
  ? t('LOADING', 'Loading')
948
- : editMode
949
- ? t('UPDATE', 'Update')
950
- : t('ADD', 'Add')
960
+ : (isSoldOut || maxProductQuantity <= 0)
961
+ ? t('SOLD_OUT', 'Sold out')
962
+ : editMode
963
+ ? t('UPDATE', 'Update')
964
+ : t('ADD', 'Add')
951
965
  }`}
966
+ 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
967
  textStyle={{
953
- color: (saveErrors || !productCart.quantity) ? theme.colors.primary : theme.colors.white,
968
+ color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
954
969
  fontSize: orderState.loading || editMode ? 10 : 14
955
970
  }}
956
971
  style={{
957
- backgroundColor: (saveErrors || !productCart.quantity) ? theme.colors.lightGray : theme.colors.primary,
958
- borderColor: (saveErrors || !productCart.quantity) ? theme.colors.white : theme.colors.primary,
959
- opacity: (saveErrors || !productCart.quantity) ? 0.3 : 1,
972
+ 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,
973
+ 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,
974
+ opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
960
975
  borderRadius: 7.6,
961
976
  height: 44,
962
977
  shadowOpacity: 0,
@@ -976,7 +991,7 @@ export const ProductOptionsUI = (props: any) => {
976
991
  ) : (
977
992
  <OButton onClick={navigation.navigate('AddressList')} />
978
993
  ))}
979
- {(!auth || isSoldOut || maxProductQuantity <= 0) && (
994
+ {!auth && (
980
995
  <OButton
981
996
  isDisabled={isSoldOut || maxProductQuantity <= 0}
982
997
  onClick={() => handleRedirectLogin()}
@@ -48,7 +48,6 @@ export const ProductDescription = styled.View`
48
48
  `
49
49
 
50
50
  export const ProductEditions = styled.View`
51
-
52
51
  `
53
52
 
54
53
  export const SectionTitle = styled.View`
@@ -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
- <Container onPress={() => handleSuboptionClick()}>
56
- <IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
57
- {((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
58
- state?.selected ? (
59
- <OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
60
- ) : (
61
- <OIcon src={theme.images.general.check_nor} color={theme.colors.disabled} width={16} />
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
- <OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
68
- )
69
- )}
70
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={10} style={{ flex: 1 }}>
71
- {suboption?.name}
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
- </IconControl>
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
- <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>
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