ordering-ui-react-native 0.15.85 → 0.15.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 (241) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +25 -3
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +145 -61
  25. package/src/components/SingleProductCard/index.tsx +16 -4
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/hooks/useCountdownTimer.tsx +26 -0
  36. package/src/index.tsx +2 -0
  37. package/src/navigators/CheckoutNavigator.tsx +6 -0
  38. package/src/navigators/HomeNavigator.tsx +6 -0
  39. package/src/pages/BusinessesListing.tsx +7 -6
  40. package/src/pages/MultiCheckout.tsx +31 -0
  41. package/src/pages/MultiOrdersDetails.tsx +27 -0
  42. package/src/pages/OrderDetails.tsx +1 -1
  43. package/src/pages/ReviewDriver.tsx +2 -2
  44. package/src/pages/ReviewOrder.tsx +2 -2
  45. package/src/theme.json +0 -1
  46. package/src/types/index.tsx +18 -11
  47. package/src/utils/index.tsx +28 -29
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +100 -60
  50. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  51. package/themes/business/src/components/Chat/index.tsx +52 -92
  52. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  56. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  57. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  58. package/themes/business/src/components/MapView/index.tsx +1 -1
  59. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  60. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  61. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  62. package/themes/business/src/components/OrderDetails/Delivery.tsx +17 -7
  63. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +26 -18
  64. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  65. package/themes/business/src/components/OrdersOption/index.tsx +66 -20
  66. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  67. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  70. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  71. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  72. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  73. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  74. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  75. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  76. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  77. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  78. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  79. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  80. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  81. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  82. package/themes/business/src/components/shared/OModal.tsx +41 -38
  83. package/themes/business/src/types/index.tsx +15 -7
  84. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  86. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  87. package/themes/kiosk/src/components/BusinessMenu/index.tsx +25 -26
  88. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  89. package/themes/kiosk/src/components/Cart/index.tsx +10 -11
  90. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  91. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  92. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  93. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  94. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  95. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  96. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  97. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  98. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  99. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  100. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  101. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  102. package/themes/kiosk/src/components/PaymentOptions/index.tsx +55 -53
  103. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  104. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  105. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  106. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  107. package/themes/kiosk/src/types/index.d.ts +1 -0
  108. package/themes/original/index.tsx +22 -0
  109. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  110. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  111. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  112. package/themes/original/src/components/AddressList/index.tsx +1 -1
  113. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  114. package/themes/original/src/components/BusinessBasicInformation/index.tsx +291 -150
  115. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  116. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  117. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  118. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  119. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  120. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  121. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  122. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  123. package/themes/original/src/components/BusinessListingSearch/index.tsx +185 -120
  124. package/themes/original/src/components/BusinessListingSearch/styles.tsx +23 -11
  125. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  126. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  127. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  128. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  129. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  130. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  131. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  132. package/themes/original/src/components/BusinessProductsListing/index.tsx +311 -176
  133. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  134. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  135. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  136. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  137. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  138. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  139. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +663 -0
  140. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  141. package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
  142. package/themes/original/src/components/Cart/index.tsx +83 -38
  143. package/themes/original/src/components/Cart/styles.tsx +4 -0
  144. package/themes/original/src/components/CartContent/index.tsx +3 -3
  145. package/themes/original/src/components/Checkout/index.tsx +128 -67
  146. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  147. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  148. package/themes/original/src/components/Favorite/index.tsx +92 -0
  149. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  150. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  151. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  152. package/themes/original/src/components/ForgotPasswordForm/index.tsx +13 -4
  153. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  154. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  155. package/themes/original/src/components/Help/index.tsx +21 -4
  156. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  157. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  158. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  159. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  160. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  161. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  162. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  163. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  164. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  165. package/themes/original/src/components/Messages/index.tsx +17 -17
  166. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  167. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  168. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  169. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  170. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  171. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  172. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  173. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  174. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  175. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  176. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  177. package/themes/original/src/components/NavBar/index.tsx +11 -5
  178. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  179. package/themes/original/src/components/OrderDetails/index.tsx +164 -81
  180. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  181. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  182. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  183. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  184. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  185. package/themes/original/src/components/OrderTypeSelector/index.tsx +78 -35
  186. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  187. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  188. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  189. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  190. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  191. package/themes/original/src/components/OrdersOption/index.tsx +138 -46
  192. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  193. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  194. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  195. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  196. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  197. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  198. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  199. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  200. package/themes/original/src/components/ProductForm/index.tsx +714 -673
  201. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  202. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  203. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  204. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  205. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  206. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  207. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  208. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  209. package/themes/original/src/components/Promotions/index.tsx +22 -6
  210. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  211. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  212. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  213. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  214. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  215. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  216. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  217. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  218. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  219. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  220. package/themes/original/src/components/SingleProductCard/index.tsx +197 -95
  221. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  222. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  223. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  224. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  225. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  226. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  227. package/themes/original/src/components/UserProfile/index.tsx +5 -1
  228. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  229. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  230. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  231. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  232. package/themes/original/src/components/Wallets/index.tsx +177 -163
  233. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  234. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  235. package/themes/original/src/components/shared/OButton.tsx +10 -3
  236. package/themes/original/src/components/shared/OInput.tsx +3 -2
  237. package/themes/original/src/components/shared/OModal.tsx +4 -2
  238. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  239. package/themes/original/src/types/index.tsx +212 -44
  240. package/themes/original/src/utils/index.tsx +94 -1
  241. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -151,6 +151,13 @@ export const ProductOptionsUI = (props: any) => {
151
151
  productTagNameStyle: {
152
152
  paddingHorizontal: 6,
153
153
  marginRight: 5
154
+ },
155
+ actionContainer: {
156
+ flexDirection: 'row',
157
+ alignItems: 'center',
158
+ justifyContent: 'space-between',
159
+ width: '100%',
160
+ marginTop: 10
154
161
  }
155
162
  });
156
163
 
@@ -162,7 +169,7 @@ export const ProductOptionsUI = (props: any) => {
162
169
  const [gallery, setGallery] = useState([])
163
170
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
164
171
  const [indexGallery, setIndexGallery] = useState(0)
165
- const [selOpt, setSelectedOpt] = useState(0);
172
+ const [selOpt, setSelectedOpt] = useState(-1);
166
173
  const [isHaveWeight, setIsHaveWeight] = useState(false)
167
174
  const [playing, setPlaying] = useState(false);
168
175
  const [qtyBy, setQtyBy] = useState({
@@ -175,6 +182,7 @@ export const ProductOptionsUI = (props: any) => {
175
182
  const [optionLayout, setOptionLayout] = useState<any>({})
176
183
  const [headerRefHeight, setHeaderRefHeight] = useState(0)
177
184
  const [summaryRefHeight, setSummaryRefHeight] = useState(0)
185
+ const [isScrollAvailable, setIsScrollAvailable] = useState(null)
178
186
 
179
187
  const isError = (id: number) => {
180
188
  let bgColor = theme.colors.white;
@@ -278,6 +286,62 @@ export const ProductOptionsUI = (props: any) => {
278
286
  setOptionLayout(_optionLayout)
279
287
  }
280
288
 
289
+ const saveErrors =
290
+ orderState.loading ||
291
+ maxProductQuantity === 0 ||
292
+ Object.keys(errors).length > 0;
293
+
294
+ const ExtraOptions = ({ eID, options }: any) => (
295
+ <>
296
+ {options.map(({ id, name, respect_to, suboptions }: any) => (
297
+ <React.Fragment key={`cont_key_${id}`}>
298
+ {respect_to == null && suboptions?.length > 0 && (
299
+ <TouchableOpacity
300
+ key={`eopt_key_${id}`}
301
+ onPress={() => setSelectedOpt(id)}
302
+ style={[
303
+ styles.extraItem,
304
+ {
305
+ borderBottomColor:
306
+ selOpt == id ? theme.colors.textNormal : theme.colors.border,
307
+ },
308
+ ]}>
309
+ <OText
310
+ color={
311
+ selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
312
+ }
313
+ size={selOpt == id ? 14 : 12}
314
+ weight={selOpt == id ? '600' : 'normal'}
315
+ style={{ maxWidth: 150 }}
316
+ numberOfLines={1}>
317
+ {name}
318
+ </OText>
319
+ </TouchableOpacity>
320
+ )}
321
+ </React.Fragment>
322
+ ))}
323
+ </>
324
+ );
325
+
326
+ const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
327
+
328
+ const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
329
+ if (_topOption) {
330
+ const _topOptionId = Number(_topOption.replace('id:', ''))
331
+ }
332
+ }
333
+
334
+ const handleGoBack = navigation?.canGoBack()
335
+ ? () => navigation.goBack()
336
+ : () => navigation.navigate('Business', { store: props.businessSlug })
337
+
338
+ useEffect(() => {
339
+ if (isScrollAvailable) {
340
+ setIsScrollAvailable(null)
341
+ scrollDown(isScrollAvailable)
342
+ }
343
+ }, [errors])
344
+
281
345
  useEffect(() => {
282
346
  const imageList: any = []
283
347
  const videoList: any = []
@@ -319,732 +383,708 @@ export const ProductOptionsUI = (props: any) => {
319
383
  }
320
384
  }, [product])
321
385
 
322
- const saveErrors =
323
- orderState.loading ||
324
- maxProductQuantity === 0 ||
325
- Object.keys(errors).length > 0;
326
-
327
- const ExtraOptions = ({ eID, options }: any) => (
328
- <>
329
- {options.map(({ id, name, respect_to, suboptions }: any) => (
330
- <React.Fragment key={`cont_key_${id}`}>
331
- {respect_to == null && suboptions?.length > 0 && (
332
- <TouchableOpacity
333
- key={`eopt_key_${id}`}
334
- onPress={() => setSelectedOpt(id)}
335
- style={[
336
- styles.extraItem,
337
- {
338
- borderBottomColor:
339
- selOpt == id ? theme.colors.textNormal : theme.colors.border,
340
- },
341
- ]}>
342
- <OText
343
- color={
344
- selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
345
- }
346
- size={selOpt == id ? 14 : 12}
347
- weight={selOpt == id ? '600' : 'normal'}>
348
- {name}
349
- </OText>
350
- </TouchableOpacity>
386
+ const ActionButton = () => {
387
+ return (
388
+ <View
389
+ style={{
390
+ width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
391
+ }}>
392
+ {((productCart &&
393
+ auth &&
394
+ orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
395
+ <OButton
396
+ onClick={() => handleSaveProduct()}
397
+ imgRightSrc=""
398
+ text={`${orderState.loading
399
+ ? t('LOADING', 'Loading')
400
+ : (isSoldOut || maxProductQuantity <= 0)
401
+ ? t('SOLD_OUT', 'Sold out')
402
+ : editMode
403
+ ? t('UPDATE', 'Update')
404
+ : t('ADD', 'Add')
405
+ }`}
406
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
407
+ textStyle={{
408
+ color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
409
+ fontSize: orderState.loading || editMode ? 10 : 14
410
+ }}
411
+ style={{
412
+ 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,
413
+ 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,
414
+ opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
415
+ borderRadius: 7.6,
416
+ height: 44,
417
+ shadowOpacity: 0,
418
+ borderWidth: 1,
419
+ marginTop: isHaveWeight ? 10 : 0
420
+ }}
421
+ />
351
422
  )}
352
- </React.Fragment>
353
- ))}
354
- </>
355
- );
356
-
357
- const handleGoBack = navigation?.canGoBack()
358
- ? () => navigation.goBack()
359
- : () => navigation.navigate('Business', { store: props.businessSlug })
423
+ {auth &&
424
+ !orderState.options?.address_id &&
425
+ (orderState.loading ? (
426
+ <OButton
427
+ isDisabled
428
+ text={t('LOADING', 'Loading')}
429
+ imgRightSrc=""
430
+ textStyle={{ fontSize: 10 }}
431
+ />
432
+ ) : (
433
+ <OButton onClick={navigation.navigate('AddressList')} />
434
+ ))}
435
+ {!auth && (
436
+ <OButton
437
+ isDisabled={isSoldOut || maxProductQuantity <= 0}
438
+ onClick={() => handleRedirectLogin()}
439
+ text={
440
+ isSoldOut || maxProductQuantity <= 0
441
+ ? t('SOLD_OUT', 'Sold out')
442
+ : t('LOGIN_SIGNUP', 'Login / Sign Up')
443
+ }
444
+ imgRightSrc=""
445
+ textStyle={{ color: theme.colors.primary, fontSize: 14 }}
446
+ style={{
447
+ height: 44,
448
+ borderColor: theme.colors.primary,
449
+ backgroundColor: theme.colors.white,
450
+ }}
451
+ />
452
+ )}
453
+ </View>
454
+ )
455
+ }
360
456
 
361
457
  return (
362
458
  <SafeAreaView style={{ flex: 1 }}>
363
459
  <TopHeader>
364
460
  <TopActions onPress={() => handleGoBack()}>
365
- <OIcon src={theme.images.general.arrow_left} width={15} />
461
+ <IconAntDesign name='arrowleft' size={26} />
366
462
  </TopActions>
367
463
  </TopHeader>
368
- <ScrollView ref={scrollViewRef}>
369
- {!error && (
370
- <View style={{ paddingBottom: 80 }}>
371
- <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
372
- {loading && !product ? (
373
- <View style={styles.productHeaderSkeleton}>
374
- <Placeholder Animation={Fade}>
375
- <PlaceholderLine
376
- height={258}
377
- style={{ borderRadius: 0 }}
378
- width={windowWidth}
379
- />
380
- </Placeholder>
381
- </View>
382
- ) : (
383
- <>
384
- <Swiper
385
- loop={false}
386
- ref={swiperRef}
387
- showsButtons={true}
388
- style={styles.mainSwiper}
389
- showsPagination={false}
390
- onIndexChanged={(index) => handleChangeMainIndex(index)}
391
- prevButton={
392
- <View style={styles.swiperButton}>
393
- <IconAntDesign
394
- name="caretleft"
395
- color={theme.colors.white}
396
- size={13}
397
- // style={styles.starIcon}
398
- />
399
- </View>
400
- }
401
- nextButton={
402
- <View style={styles.swiperButton}>
403
- <IconAntDesign
404
- name="caretright"
405
- color={theme.colors.white}
406
- size={13}
407
- // style={styles.starIcon}
464
+ {!error && (
465
+ <ScrollView
466
+ ref={scrollViewRef}
467
+ contentContainerStyle={{ paddingBottom: 80 }}
468
+ stickyHeaderIndices={[2]}
469
+ onScroll={handleScroll}>
470
+ <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
471
+ {loading && !product ? (
472
+ <View style={styles.productHeaderSkeleton}>
473
+ <Placeholder Animation={Fade}>
474
+ <PlaceholderLine
475
+ height={258}
476
+ style={{ borderRadius: 0 }}
477
+ width={windowWidth}
478
+ />
479
+ </Placeholder>
480
+ </View>
481
+ ) : (
482
+ <>
483
+ <Swiper
484
+ loop={false}
485
+ ref={swiperRef}
486
+ showsButtons={true}
487
+ style={styles.mainSwiper}
488
+ showsPagination={false}
489
+ onIndexChanged={(index) => handleChangeMainIndex(index)}
490
+ prevButton={
491
+ <View style={styles.swiperButton}>
492
+ <IconAntDesign
493
+ name="caretleft"
494
+ color={theme.colors.white}
495
+ size={13}
496
+ // style={styles.starIcon}
497
+ />
498
+ </View>
499
+ }
500
+ nextButton={
501
+ <View style={styles.swiperButton}>
502
+ <IconAntDesign
503
+ name="caretright"
504
+ color={theme.colors.white}
505
+ size={13}
506
+ // style={styles.starIcon}
507
+ />
508
+ </View>
509
+ }
510
+ >
511
+ {gallery && gallery.length > 0 && gallery.map((img, i) => (
512
+ <View
513
+ style={styles.slide1}
514
+ key={i}
515
+ >
516
+ {img.includes('image') ? (
517
+ <FastImage
518
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
519
+ source={{
520
+ uri: optimizeImage(img, 'h_1024,c_limit'),
521
+ priority: FastImage.priority.normal,
522
+ }}
408
523
  />
409
- </View>
410
- }
411
- >
412
- {gallery && gallery.length > 0 && gallery.map((img, i) => (
524
+ ) : (
525
+ <>
526
+ <YoutubePlayer
527
+ height={300}
528
+ play={playing}
529
+ videoId={img}
530
+ onChangeState={onStateChange}
531
+ />
532
+ <Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
533
+ </>
534
+ )}
535
+ </View>
536
+ ))}
537
+ </Swiper>
538
+ <ScrollView
539
+ horizontal
540
+ contentContainerStyle={{
541
+ paddingHorizontal: 30,
542
+ paddingVertical: 15
543
+ }}
544
+ >
545
+ {gallery.length > 0 && gallery.map((img, index) => (
546
+ <TouchableOpacity
547
+ key={index}
548
+ onPress={() => handleClickThumb(index)}
549
+ >
413
550
  <View
414
- style={styles.slide1}
415
- key={i}
551
+ style={{
552
+ height: 56,
553
+ borderRadius: 8,
554
+ margin: 8,
555
+ opacity: index === thumbsSwiper ? 1 : 0.8
556
+ }}
416
557
  >
417
558
  {img.includes('image') ? (
418
- <FastImage
419
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
420
- source={{
421
- uri: optimizeImage(img, 'h_1024,c_limit'),
422
- priority: FastImage.priority.normal,
559
+ <OIcon
560
+ url={img}
561
+ style={{
562
+ borderColor: theme.colors.lightGray,
563
+ borderRadius: 8,
564
+ minHeight: '100%',
565
+ opacity: isSoldOut ? 0.5 : 1
423
566
  }}
567
+ width={56}
568
+ height={56}
569
+ cover
424
570
  />
425
571
  ) : (
426
- <>
427
- <YoutubePlayer
428
- height={300}
429
- play={playing}
430
- videoId={img}
431
- onChangeState={onStateChange}
432
- />
433
- <Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
434
- </>
572
+ <OIcon
573
+ url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
574
+ style={{
575
+ borderColor: theme.colors.lightGray,
576
+ borderRadius: 8,
577
+ minHeight: '100%',
578
+ opacity: isSoldOut ? 0.5 : 1
579
+ }}
580
+ width={56}
581
+ height={56}
582
+ cover
583
+ />
435
584
  )}
436
585
  </View>
437
- ))}
438
- </Swiper>
439
- <ScrollView
440
- horizontal
441
- contentContainerStyle={{
442
- paddingHorizontal: 30,
443
- paddingVertical: 15
444
- }}
445
- >
446
- {gallery.length > 0 && gallery.map((img, index) => (
447
- <TouchableOpacity
448
- key={index}
449
- onPress={() => handleClickThumb(index)}
450
- >
451
- <View
452
- style={{
453
- height: 56,
454
- borderRadius: 8,
455
- margin: 8,
456
- opacity: index === thumbsSwiper ? 1 : 0.8
457
- }}
458
- >
459
- {img.includes('image') ? (
460
- <OIcon
461
- url={img}
462
- style={{
463
- borderColor: theme.colors.lightGray,
464
- borderRadius: 8,
465
- minHeight: '100%',
466
- opacity: isSoldOut ? 0.5 : 1
467
- }}
468
- width={56}
469
- height={56}
470
- cover
471
- />
472
- ) : (
473
- <OIcon
474
- url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
475
- style={{
476
- borderColor: theme.colors.lightGray,
477
- borderRadius: 8,
478
- minHeight: '100%',
479
- opacity: isSoldOut ? 0.5 : 1
480
- }}
481
- width={56}
482
- height={56}
483
- cover
484
- />
485
- )}
486
- </View>
487
- </TouchableOpacity>
586
+ </TouchableOpacity>
488
587
 
489
- ))}
490
- </ScrollView>
588
+ ))}
589
+ </ScrollView>
590
+ </>
591
+ )}
592
+ </WrapHeader>
593
+ <ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
594
+ <ProductTitle>
595
+ {loading && !product ? (
596
+ <Placeholder Animation={Fade}>
597
+ <View
598
+ style={{
599
+ flexDirection: 'row',
600
+ justifyContent: 'space-between',
601
+ }}>
602
+ <PlaceholderLine width={40} height={20} />
603
+ <PlaceholderLine width={30} height={20} />
604
+ </View>
605
+ </Placeholder>
606
+ ) : (
607
+ <>
608
+ <View style={{ flexDirection: 'row' }}>
609
+ <OText
610
+ size={20}
611
+ lineHeight={30}
612
+ weight={'600'}
613
+ style={{ flex: 1, marginBottom: 10 }}>
614
+ {product?.name || productCart.name}
615
+ </OText>
616
+ {!!product?.calories && (
617
+ <OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
618
+ </OText>
619
+ )}
620
+ </View>
621
+ {((!!product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (!!product?.estimated_person)) && (
622
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
623
+ {
624
+ ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
625
+ && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
626
+ }
627
+ {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
628
+ <>&nbsp;&#183;&nbsp;</>
629
+ )}
630
+ {product?.estimated_person
631
+ && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
632
+ }
633
+ </OText>
634
+ )}
635
+ {isHaveWeight ? (
636
+ <OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
637
+ ) : (
638
+ <View style={{ flexDirection: 'row', marginBottom: 10 }}>
639
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
640
+ {product?.offer_price !== null && product?.in_offer && (
641
+ <OText style={{
642
+ fontSize: 14,
643
+ color: '#808080',
644
+ textDecorationLine: 'line-through',
645
+ marginLeft: 7,
646
+ marginRight: 7
647
+ }}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
648
+ )}
649
+ </View>
650
+ )}
491
651
  </>
492
652
  )}
493
- </WrapHeader>
494
- <WrapContent>
495
- <ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
496
- <ProductTitle>
497
- {loading && !product ? (
498
- <Placeholder Animation={Fade}>
499
- <View
500
- style={{
501
- flexDirection: 'row',
502
- justifyContent: 'space-between',
503
- }}>
504
- <PlaceholderLine width={40} height={20} />
505
- <PlaceholderLine width={30} height={20} />
506
- </View>
507
- </Placeholder>
653
+ </ProductTitle>
654
+ <ProductDescription>
655
+ <OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
656
+ {product?.description || productCart?.description}
657
+ </OText>
658
+ </ProductDescription>
659
+ <ScrollView
660
+ horizontal
661
+ showsHorizontalScrollIndicator={false}
662
+ contentContainerStyle={{ paddingBottom: 30 }}
663
+ >
664
+ {product?.tags?.map((tag: any) => (
665
+ <View
666
+ key={tag.id}
667
+ style={styles.productTagWrapper}
668
+ >
669
+ {!!tag?.image ? (
670
+ <OIcon
671
+ url={optimizeImage(tag?.image, 'h_40,c_limit')}
672
+ style={styles.productTagImageStyle}
673
+ />
508
674
  ) : (
509
- <>
510
- <View style={{ flexDirection: 'row' }}>
511
- <OText
512
- size={20}
513
- lineHeight={30}
514
- weight={'600'}
515
- style={{ flex: 1, marginBottom: 10 }}>
516
- {product?.name || productCart.name}
517
- </OText>
518
- {!!product?.calories && (
519
- <OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
520
- </OText>
521
- )}
522
- </View>
523
- {((!!product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (!!product?.estimated_person)) && (
524
- <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
525
- {
526
- ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
527
- && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
528
- }
529
- {product?.sku && product?.sku !== '-1' && product?.sku !== '1' && product?.estimated_person && (
530
- <>&nbsp;&#183;&nbsp;</>
531
- )}
532
- {product?.estimated_person
533
- && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
534
- }
535
- </OText>
536
- )}
537
- {isHaveWeight ? (
538
- <OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
539
- ) : (
540
- <View style={{ flexDirection: 'row', marginBottom: 10 }}>
541
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
542
- {product?.offer_price !== null && product?.in_offer && (
543
- <OText style={{
544
- fontSize: 14,
545
- color: '#808080',
546
- textDecorationLine: 'line-through',
547
- marginLeft: 7,
548
- marginRight: 7
549
- }}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
550
- )}
551
- </View>
552
- )}
553
- </>
675
+ <OIcon
676
+ src={theme.images?.dummies?.product}
677
+ style={styles.productTagImageStyle}
678
+ />
554
679
  )}
555
- </ProductTitle>
556
- <ProductDescription>
557
- <OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
558
- {product?.description || productCart?.description}
680
+ <OText color={theme.colors.textSecondary} size={12} style={styles.productTagNameStyle}>{tag.name}</OText>
681
+ </View>
682
+ ))}
683
+ </ScrollView>
684
+ </ProductSummary>
685
+ {(!loading && product) && (
686
+ <ExtraOptionWrap
687
+ horizontal
688
+ showsHorizontalScrollIndicator={false}
689
+ style={{ marginBottom: 20 }}
690
+ contentContainerStyle={{ paddingHorizontal: 33, backgroundColor: theme.colors.white }}
691
+ >
692
+ <TouchableOpacity
693
+ key={`eopt_key_00`}
694
+ onPress={() => setSelectedOpt(-1)}
695
+ style={[
696
+ styles.extraItem,
697
+ {
698
+ borderBottomColor: selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
699
+ },
700
+ ]}>
701
+ <OText
702
+ color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
703
+ size={selOpt == -1 ? 14 : 12}
704
+ weight={selOpt == -1 ? '600' : 'normal'}>
705
+ {t('ALL', 'All')}
706
+ </OText>
707
+ </TouchableOpacity>
708
+ {product?.ingredients.length > 0 && (
709
+ <TouchableOpacity
710
+ key={`eopt_key_01`}
711
+ onPress={() => setSelectedOpt(0)}
712
+ style={[
713
+ styles.extraItem,
714
+ {
715
+ borderBottomColor:
716
+ selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
717
+ },
718
+ ]}>
719
+ <OText
720
+ color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
721
+ size={selOpt == 0 ? 14 : 12}
722
+ weight={selOpt == 0 ? '600' : 'normal'}>
723
+ {t('INGREDIENTS', 'Ingredients')}
559
724
  </OText>
560
- </ProductDescription>
561
- <ScrollView
562
- horizontal
563
- showsHorizontalScrollIndicator={false}
564
- contentContainerStyle={{ paddingBottom: 30 }}
565
- >
566
- {product?.tags?.map((tag: any) => (
725
+ </TouchableOpacity>
726
+ )}
727
+ {product?.extras.map((extra: any) =>
728
+ <ExtraOptions key={extra.id} options={extra.options} />
729
+ )}
730
+ </ExtraOptionWrap>
731
+ )}
732
+ {loading && !product ? (
733
+ <>
734
+ {[...Array(2)].map((item, i) => (
735
+ <Placeholder
736
+ key={i}
737
+ style={{ marginBottom: 20 }}
738
+ Animation={Fade}>
739
+ <PlaceholderLine
740
+ height={40}
741
+ style={{ flex: 1, marginTop: 10 }}
742
+ />
743
+ {[...Array(3)].map((item, i) => (
567
744
  <View
568
- key={tag.id}
569
- style={styles.productTagWrapper}
570
- >
571
- {!!tag?.image ? (
572
- <OIcon
573
- url={optimizeImage(tag?.image, 'h_40,c_limit')}
574
- style={styles.productTagImageStyle}
575
- />
576
- ) : (
577
- <OIcon
578
- src={theme.images?.dummies?.product}
579
- style={styles.productTagImageStyle}
580
- />
581
- )}
582
- <OText color={theme.colors.textSecondary} size={12} style={styles.productTagNameStyle}>{tag.name}</OText>
745
+ key={'place_key_' + i}
746
+ style={{
747
+ flexDirection: 'row',
748
+ justifyContent: 'space-between',
749
+ }}>
750
+ <PlaceholderLine
751
+ height={30}
752
+ width={10}
753
+ style={{ marginBottom: 20 }}
754
+ />
755
+ <PlaceholderLine
756
+ height={30}
757
+ width={50}
758
+ style={{ marginBottom: 20 }}
759
+ />
760
+ <PlaceholderLine
761
+ height={30}
762
+ width={30}
763
+ style={{ marginBottom: 20 }}
764
+ />
583
765
  </View>
584
766
  ))}
585
- </ScrollView>
586
- </ProductSummary>
587
- {loading && !product ? (
767
+ </Placeholder>
768
+ ))}
769
+ </>
770
+ ) : (
771
+ <ProductEditions>
772
+ {selOpt === -1 ? (
588
773
  <>
589
- {[...Array(2)].map((item, i) => (
590
- <Placeholder
591
- key={i}
592
- style={{ marginBottom: 20 }}
593
- Animation={Fade}>
594
- <PlaceholderLine
595
- height={40}
596
- style={{ flex: 1, marginTop: 10 }}
597
- />
598
- {[...Array(3)].map((item, i) => (
599
- <View
600
- key={'place_key_' + i}
601
- style={{
602
- flexDirection: 'row',
603
- justifyContent: 'space-between',
604
- }}>
605
- <PlaceholderLine
606
- height={30}
607
- width={10}
608
- style={{ marginBottom: 20 }}
609
- />
610
- <PlaceholderLine
611
- height={30}
612
- width={50}
613
- style={{ marginBottom: 20 }}
614
- />
615
- <PlaceholderLine
616
- height={30}
617
- width={30}
618
- style={{ marginBottom: 20 }}
774
+ {product?.ingredients.length > 0 && (
775
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
776
+ <SectionTitle>
777
+ <OText size={16}>
778
+ {t('INGREDIENTS', 'Ingredients')}
779
+ </OText>
780
+ </SectionTitle>
781
+ <WrapperIngredients>
782
+ {product?.ingredients.map((ingredient: any) => (
783
+ <ProductIngredient
784
+ key={ingredient.id}
785
+ ingredient={ingredient}
786
+ state={
787
+ productCart.ingredients[`id:${ingredient.id}`]
788
+ }
789
+ onChange={handleChangeIngredientState}
790
+ isSoldOut={isSoldOut}
619
791
  />
620
- </View>
621
- ))}
622
- </Placeholder>
623
- ))}
792
+ ))}
793
+ </WrapperIngredients>
794
+ </View>
795
+ )}
796
+ {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
797
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
798
+ const currentState =
799
+ productCart.options[`id:${option.id}`] || {};
800
+ return (
801
+ <React.Fragment key={`popt_${option.id}`}>
802
+ {showOption(option) && (
803
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
804
+ <ProductOption
805
+ option={option}
806
+ currentState={currentState}
807
+ error={errors[`id:${option.id}`]}>
808
+ <WrapperSubOption
809
+ style={{
810
+ backgroundColor: isError(option.id),
811
+ borderRadius: 7.6
812
+ }}>
813
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
814
+ (suboption: any) => {
815
+ const currentState =
816
+ productCart.options[
817
+ `id:${option.id}`
818
+ ]?.suboptions[
819
+ `id:${suboption.id}`
820
+ ] || {};
821
+ const balance =
822
+ productCart.options[
823
+ `id:${option.id}`
824
+ ]?.balance || 0;
825
+ return (
826
+ <ProductOptionSubOption
827
+ key={suboption.id}
828
+ isSoldOut={isSoldOut}
829
+ onChange={
830
+ handleChangeSuboptionState
831
+ }
832
+ balance={balance}
833
+ option={option}
834
+ suboption={suboption}
835
+ state={currentState}
836
+ disabled={
837
+ isSoldOut ||
838
+ maxProductQuantity <= 0
839
+ }
840
+ setIsScrollAvailable={setIsScrollAvailable}
841
+ error={errors[`id:${option.id}`]}
842
+ />
843
+ );
844
+ },
845
+ )}
846
+ </WrapperSubOption>
847
+ </ProductOption>
848
+ </View>
849
+ )}
850
+ </React.Fragment>
851
+ );
852
+ }),
853
+ )}
624
854
  </>
625
855
  ) : (
626
- <ProductEditions>
627
- <ExtraOptionWrap
628
- horizontal
629
- showsHorizontalScrollIndicator={false}
630
- style={{ marginBottom: 20 }}
631
- contentContainerStyle={{ paddingHorizontal: 33 }}
632
- >
633
- <TouchableOpacity
634
- key={`eopt_all_0`}
635
- onPress={() => setSelectedOpt(0)}
636
- style={[
637
- styles.extraItem,
638
- {
639
- borderBottomColor: selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
640
- },
641
- ]}>
642
- <OText
643
- color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
644
- size={selOpt == 0 ? 14 : 12}
645
- weight={selOpt == 0 ? '600' : 'normal'}>
646
- {t('ALL', 'All')}
647
- </OText>
648
- </TouchableOpacity>
649
- {product?.ingredients.length > 0 && (
650
- <TouchableOpacity
651
- key={`eopt_all_00`}
652
- onPress={() => setSelectedOpt(-1)}
653
- style={[
654
- styles.extraItem,
655
- {
656
- borderBottomColor:
657
- selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
658
- },
659
- ]}>
660
- <OText
661
- color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
662
- size={selOpt == -1 ? 14 : 12}
663
- weight={selOpt == -1 ? '600' : 'normal'}>
856
+ <>
857
+ {selOpt === 0 ? (
858
+ <View style={styles.optionContainer}>
859
+ <SectionTitle>
860
+ <OText size={16}>
664
861
  {t('INGREDIENTS', 'Ingredients')}
665
862
  </OText>
666
- </TouchableOpacity>
667
- )}
668
- {product?.extras.map((extra: any) =>
669
- <ExtraOptions key={extra.id} options={extra.options} />
670
- )}
671
- </ExtraOptionWrap>
672
-
673
- {selOpt == 0 ? (
863
+ </SectionTitle>
864
+ <WrapperIngredients>
865
+ {product?.ingredients.map((ingredient: any) => (
866
+ <ProductIngredient
867
+ key={ingredient.id}
868
+ ingredient={ingredient}
869
+ state={
870
+ productCart.ingredients[`id:${ingredient.id}`]
871
+ }
872
+ onChange={handleChangeIngredientState}
873
+ isSoldOut={isSoldOut}
874
+ />
875
+ ))}
876
+ </WrapperIngredients>
877
+ </View>
878
+ ) : (
674
879
  <>
675
- {product?.ingredients.length > 0 && (
676
- <View style={styles.optionContainer}>
677
- <SectionTitle>
678
- <OText size={16}>
679
- {t('INGREDIENTS', 'Ingredients')}
680
- </OText>
681
- </SectionTitle>
682
- <WrapperIngredients>
683
- {product?.ingredients.map((ingredient: any) => (
684
- <ProductIngredient
685
- key={ingredient.id}
686
- ingredient={ingredient}
687
- state={
688
- productCart.ingredients[`id:${ingredient.id}`]
689
- }
690
- onChange={handleChangeIngredientState}
691
- isSoldOut={isSoldOut}
692
- />
693
- ))}
694
- </WrapperIngredients>
695
- </View>
696
- )}
697
- {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
880
+ {product?.extras.map((extra: any) =>
698
881
  extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
699
- const currentState =
700
- productCart.options[`id:${option.id}`] || {};
701
- return (
702
- <React.Fragment key={`popt_${option.id}`}>
703
- {showOption(option) && (
704
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
705
- <ProductOption
706
- option={option}
707
- currentState={currentState}
708
- error={errors[`id:${option.id}`]}>
709
- <WrapperSubOption
710
- style={{
711
- backgroundColor: isError(option.id),
712
- borderRadius: 7.6
713
- }}>
714
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
715
- (suboption: any) => {
716
- const currentState =
717
- productCart.options[
718
- `id:${option.id}`
719
- ]?.suboptions[
720
- `id:${suboption.id}`
721
- ] || {};
722
- const balance =
723
- productCart.options[
724
- `id:${option.id}`
725
- ]?.balance || 0;
726
- return (
727
- <ProductOptionSubOption
728
- key={suboption.id}
729
- isSoldOut={isSoldOut}
730
- onChange={
731
- handleChangeSuboptionState
732
- }
733
- balance={balance}
734
- option={option}
735
- suboption={suboption}
736
- state={currentState}
737
- disabled={
738
- isSoldOut ||
739
- maxProductQuantity <= 0
740
- }
741
- scrollDown={scrollDown}
742
- error={errors[`id:${option.id}`]}
743
- />
744
- );
745
- },
746
- )}
747
- </WrapperSubOption>
748
- </ProductOption>
749
- </View>
750
- )}
751
- </React.Fragment>
752
- );
882
+ if (
883
+ option.id == selOpt ||
884
+ (hasRespected(
885
+ extra.options,
886
+ option.respect_to,
887
+ ) &&
888
+ showOption(option))
889
+ ) {
890
+ const currentState =
891
+ productCart.options[`id:${option.id}`] || {};
892
+ return (
893
+ <React.Fragment key={option.id}>
894
+ {showOption(option) && (
895
+ <View style={styles.optionContainer}>
896
+ <ProductOption
897
+ option={option}
898
+ currentState={currentState}
899
+ error={errors[`id:${option.id}`]}>
900
+ <WrapperSubOption
901
+ style={{
902
+ backgroundColor: isError(
903
+ option.id,
904
+ ),
905
+ }}>
906
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
907
+ (suboption: any) => {
908
+ const currentState =
909
+ productCart.options[
910
+ `id:${option.id}`
911
+ ]?.suboptions[
912
+ `id:${suboption.id}`
913
+ ] || {};
914
+ const balance =
915
+ productCart.options[
916
+ `id:${option.id}`
917
+ ]?.balance || 0;
918
+ return (
919
+ <ProductOptionSubOption
920
+ key={suboption.id}
921
+ onChange={
922
+ handleChangeSuboptionState
923
+ }
924
+ balance={balance}
925
+ option={option}
926
+ suboption={suboption}
927
+ state={currentState}
928
+ disabled={
929
+ isSoldOut ||
930
+ maxProductQuantity <= 0
931
+ }
932
+ />
933
+ );
934
+ },
935
+ )}
936
+ </WrapperSubOption>
937
+ </ProductOption>
938
+ </View>
939
+ )}
940
+ </React.Fragment>
941
+ );
942
+ }
753
943
  }),
754
944
  )}
755
945
  </>
756
- ) : (
757
- <>
758
- {selOpt == -1 ? (
759
- <View style={styles.optionContainer}>
760
- <SectionTitle>
761
- <OText size={16}>
762
- {t('INGREDIENTS', 'Ingredients')}
763
- </OText>
764
- </SectionTitle>
765
- <WrapperIngredients>
766
- {product?.ingredients.map((ingredient: any) => (
767
- <ProductIngredient
768
- key={ingredient.id}
769
- ingredient={ingredient}
770
- state={
771
- productCart.ingredients[`id:${ingredient.id}`]
772
- }
773
- onChange={handleChangeIngredientState}
774
- isSoldOut={isSoldOut}
775
- />
776
- ))}
777
- </WrapperIngredients>
778
- </View>
779
- ) : (
780
- <>
781
- {product?.extras.map((extra: any) =>
782
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
783
- if (
784
- option.id == selOpt ||
785
- (hasRespected(
786
- extra.options,
787
- option.respect_to,
788
- ) &&
789
- showOption(option))
790
- ) {
791
- const currentState =
792
- productCart.options[`id:${option.id}`] || {};
793
- return (
794
- <React.Fragment key={option.id}>
795
- {showOption(option) && (
796
- <View style={styles.optionContainer}>
797
- <ProductOption
798
- option={option}
799
- currentState={currentState}
800
- error={errors[`id:${option.id}`]}>
801
- <WrapperSubOption
802
- style={{
803
- backgroundColor: isError(
804
- option.id,
805
- ),
806
- }}>
807
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
808
- (suboption: any) => {
809
- const currentState =
810
- productCart.options[
811
- `id:${option.id}`
812
- ]?.suboptions[
813
- `id:${suboption.id}`
814
- ] || {};
815
- const balance =
816
- productCart.options[
817
- `id:${option.id}`
818
- ]?.balance || 0;
819
- return (
820
- <ProductOptionSubOption
821
- key={suboption.id}
822
- onChange={
823
- handleChangeSuboptionState
824
- }
825
- balance={balance}
826
- option={option}
827
- suboption={suboption}
828
- state={currentState}
829
- disabled={
830
- isSoldOut ||
831
- maxProductQuantity <= 0
832
- }
833
- />
834
- );
835
- },
836
- )}
837
- </WrapperSubOption>
838
- </ProductOption>
839
- </View>
840
- )}
841
- </React.Fragment>
842
- );
843
- }
844
- }),
845
- )}
846
- </>
847
- )}
848
- </>
849
946
  )}
850
- {!product?.hide_special_instructions && (
851
- <ProductComment>
852
- <SectionTitle>
853
- <OText size={16} weight={'600'} lineHeight={24}>
854
- {t('SPECIAL_COMMENT', 'Special comment')}
855
- </OText>
856
- </SectionTitle>
857
- <OInput
858
- multiline
859
- placeholder={t('SPECIAL_COMMENT', 'Special comment')}
860
- value={productCart.comment}
861
- onChange={(val: string) =>
862
- handleChangeCommentState({ target: { value: val } })
863
- }
864
- isDisabled={
865
- !(productCart && !isSoldOut && maxProductQuantity)
866
- }
867
- style={styles.comment}
868
- />
869
- </ProductComment>
870
- )}
871
- </ProductEditions>
872
- )}
873
- </WrapContent>
874
- </View>
875
- )}
876
- {!!error && error.length > 0 && (
877
- <NotFoundSource content={error[0]?.message || error[0]} />
878
- )}
879
- </ScrollView>
880
- {!loading && !error && product && (
881
- <ProductActions ios={Platform?.OS === 'ios'}>
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>
889
- {productCart && !isSoldOut && maxProductQuantity > 0 && (
890
- <View style={styles.quantityControl}>
891
- <TouchableOpacity
892
- onPress={decrement}
893
- disabled={productCart.quantity === 1 || isSoldOut}>
894
- <OIcon
895
- src={theme.images.general.minus}
896
- width={16}
897
- color={
898
- productCart.quantity === 1 || isSoldOut
899
- ? theme.colors.backgroundGray
900
- : theme.colors.backgroundDark
901
- }
902
- />
903
- </TouchableOpacity>
904
- {qtyBy?.pieces && (
905
- <TextInput
906
- keyboardType='numeric'
907
- value={`${productCart?.quantity > 0 ? productCart?.quantity : ''}`}
908
- onChangeText={(val: any) => onChangeProductCartQuantity(parseInt(val))}
909
- editable={!orderState.loading}
910
- style={{
911
- borderWidth: 1,
912
- textAlign: 'center',
913
- minWidth: 60,
914
- borderRadius: 8,
915
- borderColor: theme.colors.inputBorderColor,
916
- height: 44,
917
- marginHorizontal: 10
918
- }}
919
- />
947
+ </>
920
948
  )}
921
- {qtyBy?.weight_unit && (
922
- <OText
923
- size={12}
924
- lineHeight={18}
925
- style={{ minWidth: 40, textAlign: 'center' }}
926
- >
927
- {productCart.quantity * product?.weight}
928
- </OText>
949
+ {!product?.hide_special_instructions && (
950
+ <ProductComment>
951
+ <SectionTitle>
952
+ <OText size={16} weight={'600'} lineHeight={24}>
953
+ {t('SPECIAL_COMMENT', 'Special comment')}
954
+ </OText>
955
+ </SectionTitle>
956
+ <OInput
957
+ multiline
958
+ placeholder={t('SPECIAL_COMMENT', 'Special comment')}
959
+ value={productCart.comment}
960
+ onChange={(val: string) =>
961
+ handleChangeCommentState({ target: { value: val } })
962
+ }
963
+ isDisabled={
964
+ !(productCart && !isSoldOut && maxProductQuantity)
965
+ }
966
+ style={styles.comment}
967
+ />
968
+ </ProductComment>
929
969
  )}
930
- <TouchableOpacity
931
- onPress={increment}
932
- disabled={
933
- maxProductQuantity <= 0 ||
934
- productCart.quantity >= maxProductQuantity ||
935
- isSoldOut
936
- }>
937
- <OIcon
938
- src={theme.images.general.plus}
939
- width={16}
940
- color={
941
- maxProductQuantity <= 0 ||
970
+ </ProductEditions>
971
+ )}
972
+ {!!error && error.length > 0 && (
973
+ <NotFoundSource content={error[0]?.message || error[0]} />
974
+ )}
975
+ </ScrollView>
976
+ )}
977
+ {!loading && !error && product && (
978
+ <ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
979
+ <View style={styles.actionContainer}>
980
+ <View>
981
+ <OText size={16} lineHeight={24} weight={'600'}>
982
+ {productCart.total ? parsePrice(productCart?.total) : ''}
983
+ </OText>
984
+ {product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && productCart?.quantity !== 1 && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
985
+ {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>}
986
+ </View>
987
+ {productCart && !isSoldOut && maxProductQuantity > 0 && (
988
+ <>
989
+ <View style={styles.quantityControl}>
990
+ <TouchableOpacity
991
+ onPress={decrement}
992
+ disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order)}>
993
+ <OIcon
994
+ src={theme.images.general.minus}
995
+ width={16}
996
+ color={
997
+ productCart.quantity === 1 || isSoldOut
998
+ ? theme.colors.backgroundGray
999
+ : theme.colors.backgroundDark
1000
+ }
1001
+ />
1002
+ </TouchableOpacity>
1003
+ {qtyBy?.pieces && (
1004
+ <TextInput
1005
+ keyboardType='numeric'
1006
+ value={`${productCart?.quantity > 0 ? productCart?.quantity : ''}`}
1007
+ onChangeText={(val: any) => onChangeProductCartQuantity(parseInt(val))}
1008
+ editable={!orderState.loading}
1009
+ style={{
1010
+ borderWidth: 1,
1011
+ textAlign: 'center',
1012
+ minWidth: 60,
1013
+ borderRadius: 8,
1014
+ borderColor: theme.colors.inputBorderColor,
1015
+ height: 44,
1016
+ marginHorizontal: 10
1017
+ }}
1018
+ />
1019
+ )}
1020
+ {qtyBy?.weight_unit && (
1021
+ <OText
1022
+ size={12}
1023
+ lineHeight={18}
1024
+ style={{ minWidth: 40, textAlign: 'center' }}
1025
+ >
1026
+ {productCart.quantity * product?.weight}
1027
+ </OText>
1028
+ )}
1029
+ <TouchableOpacity
1030
+ onPress={increment}
1031
+ disabled={
1032
+ maxProductQuantity <= 0 ||
942
1033
  productCart.quantity >= maxProductQuantity ||
1034
+ (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
943
1035
  isSoldOut
944
- ? theme.colors.backgroundGray
945
- : theme.colors.backgroundDark
946
- }
947
- />
948
- </TouchableOpacity>
949
- {isHaveWeight && (
950
- <WeightUnitSwitch>
951
- <TouchableOpacity
952
- onPress={() => handleSwitchQtyUnit('pieces')}
953
- >
954
- <WeightUnitItem active={qtyBy?.pieces}>
955
- <OText
956
- size={12}
957
- lineHeight={18}
958
- color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
959
- >
960
- {t('PIECES', 'pcs')}
961
- </OText>
962
- </WeightUnitItem>
1036
+ }>
1037
+ <OIcon
1038
+ src={theme.images.general.plus}
1039
+ width={16}
1040
+ color={
1041
+ maxProductQuantity <= 0 ||
1042
+ productCart.quantity >= maxProductQuantity ||
1043
+ (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
1044
+ isSoldOut
1045
+ ? theme.colors.backgroundGray
1046
+ : theme.colors.backgroundDark
1047
+ }
1048
+ />
963
1049
  </TouchableOpacity>
964
- <View style={{ alignItems: 'flex-start' }}>
1050
+ </View>
1051
+ {isHaveWeight && (
1052
+ <WeightUnitSwitch>
965
1053
  <TouchableOpacity
966
- onPress={() => handleSwitchQtyUnit('weight_unit')}
1054
+ onPress={() => handleSwitchQtyUnit('pieces')}
967
1055
  >
968
- <WeightUnitItem active={qtyBy?.weight_unit}>
1056
+ <WeightUnitItem active={qtyBy?.pieces}>
969
1057
  <OText
970
1058
  size={12}
971
1059
  lineHeight={18}
972
- color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
1060
+ color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
973
1061
  >
974
- {product?.weight_unit}
1062
+ {t('PIECES', 'pcs')}
975
1063
  </OText>
976
1064
  </WeightUnitItem>
977
1065
  </TouchableOpacity>
978
- </View>
979
- </WeightUnitSwitch>
980
- )}
981
- </View>
982
- )}
983
- <View
984
- style={{
985
- width: isSoldOut || maxProductQuantity <= 0 ? '60%' : '40%',
986
- }}>
987
- {((productCart &&
988
- auth &&
989
- orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
990
- <OButton
991
- onClick={() => handleSaveProduct()}
992
- imgRightSrc=""
993
- text={`${orderState.loading
994
- ? t('LOADING', 'Loading')
995
- : (isSoldOut || maxProductQuantity <= 0)
996
- ? t('SOLD_OUT', 'Sold out')
997
- : editMode
998
- ? t('UPDATE', 'Update')
999
- : t('ADD', 'Add')
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))}
1002
- textStyle={{
1003
- color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
1004
- fontSize: orderState.loading || editMode ? 10 : 14
1005
- }}
1006
- style={{
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,
1010
- borderRadius: 7.6,
1011
- height: 44,
1012
- shadowOpacity: 0,
1013
- borderWidth: 1,
1014
- }}
1015
- />
1016
- )}
1017
- {auth &&
1018
- !orderState.options?.address_id &&
1019
- (orderState.loading ? (
1020
- <OButton
1021
- isDisabled
1022
- text={t('LOADING', 'Loading')}
1023
- imgRightSrc=""
1024
- textStyle={{ fontSize: 10 }}
1025
- />
1026
- ) : (
1027
- <OButton onClick={navigation.navigate('AddressList')} />
1028
- ))}
1029
- {!auth && (
1030
- <OButton
1031
- isDisabled={isSoldOut || maxProductQuantity <= 0}
1032
- onClick={() => handleRedirectLogin()}
1033
- text={
1034
- isSoldOut || maxProductQuantity <= 0
1035
- ? t('SOLD_OUT', 'Sold out')
1036
- : t('LOGIN_SIGNUP', 'Login / Sign Up')
1037
- }
1038
- imgRightSrc=""
1039
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
1040
- style={{
1041
- height: 44,
1042
- borderColor: theme.colors.primary,
1043
- backgroundColor: theme.colors.white,
1044
- }}
1045
- />
1066
+ <View style={{ alignItems: 'flex-start' }}>
1067
+ <TouchableOpacity
1068
+ onPress={() => handleSwitchQtyUnit('weight_unit')}
1069
+ >
1070
+ <WeightUnitItem active={qtyBy?.weight_unit}>
1071
+ <OText
1072
+ size={12}
1073
+ lineHeight={18}
1074
+ color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
1075
+ >
1076
+ {product?.weight_unit}
1077
+ </OText>
1078
+ </WeightUnitItem>
1079
+ </TouchableOpacity>
1080
+ </View>
1081
+ </WeightUnitSwitch>
1082
+ )}
1083
+ </>
1046
1084
  )}
1085
+ {!isHaveWeight && <ActionButton />}
1047
1086
  </View>
1087
+ {isHaveWeight && <ActionButton />}
1048
1088
  </ProductActions>
1049
1089
  )}
1050
1090
  </SafeAreaView>
@@ -1055,6 +1095,7 @@ export const ProductOptionsUI = (props: any) => {
1055
1095
  export const ProductForm = (props: any) => {
1056
1096
  const productOptionsProps = {
1057
1097
  ...props,
1098
+ productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
1058
1099
  UIComponent: ProductOptionsUI,
1059
1100
  };
1060
1101