ordering-ui-react-native 0.17.39 → 0.17.40-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 (214) hide show
  1. package/package.json +9 -9
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/StripeMethodForm/index.tsx +135 -102
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +4 -4
  9. package/src/types/index.tsx +5 -0
  10. package/src/utils/index.tsx +7 -1
  11. package/themes/business/index.tsx +2 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  13. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  14. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  15. package/themes/business/src/components/Chat/index.tsx +125 -113
  16. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  17. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  18. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  19. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  20. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  21. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +49 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +92 -49
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  29. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  30. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  31. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  33. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  34. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  36. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  37. package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
  38. package/themes/business/src/components/StoresList/index.tsx +2 -2
  39. package/themes/business/src/components/shared/OLink.tsx +33 -13
  40. package/themes/business/src/components/shared/OModal.tsx +16 -9
  41. package/themes/business/src/components/shared/OText.tsx +8 -2
  42. package/themes/business/src/types/index.tsx +32 -2
  43. package/themes/business/src/utils/index.tsx +44 -1
  44. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  45. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  46. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  50. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  51. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  52. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  57. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  61. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  62. package/themes/kiosk/src/types/index.d.ts +13 -0
  63. package/themes/kiosk/src/utils/index.tsx +15 -0
  64. package/themes/original/index.tsx +6 -0
  65. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  66. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  67. package/themes/original/src/components/AddressList/index.tsx +26 -21
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  69. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  70. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +159 -90
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  73. package/themes/original/src/components/BusinessController/index.tsx +141 -67
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -2
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +351 -326
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -524
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -6
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +106 -79
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +102 -69
  92. package/themes/original/src/components/CartContent/index.tsx +115 -19
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +375 -179
  95. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  96. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  97. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  100. package/themes/original/src/components/Favorite/index.tsx +7 -4
  101. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  102. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  103. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  104. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  105. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  106. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  116. package/themes/original/src/components/Help/index.tsx +8 -8
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  120. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  121. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  122. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  123. package/themes/original/src/components/Home/index.tsx +13 -4
  124. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +139 -75
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +71 -28
  128. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +32 -10
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +219 -117
  134. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  139. package/themes/original/src/components/MyOrders/index.tsx +53 -51
  140. package/themes/original/src/components/NavBar/index.tsx +18 -18
  141. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  142. package/themes/original/src/components/Notifications/index.tsx +46 -50
  143. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +199 -359
  147. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  149. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  150. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  151. package/themes/original/src/components/OrderSummary/index.tsx +87 -59
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  155. package/themes/original/src/components/OrdersOption/index.tsx +70 -65
  156. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  157. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  160. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  164. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  165. package/themes/original/src/components/ProductForm/index.tsx +223 -232
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +29 -28
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +74 -19
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +42 -19
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  189. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  191. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  192. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  194. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  195. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  196. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  197. package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
  198. package/themes/original/src/components/UserProfile/index.tsx +5 -7
  199. package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
  200. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  201. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  202. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  203. package/themes/original/src/components/Wallets/index.tsx +79 -36
  204. package/themes/original/src/components/Wallets/styles.tsx +5 -4
  205. package/themes/original/src/components/shared/CardAnimation.tsx +3 -3
  206. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  208. package/themes/original/src/components/shared/OButton.tsx +6 -2
  209. package/themes/original/src/components/shared/OInput.tsx +16 -2
  210. package/themes/original/src/components/shared/OModal.tsx +3 -3
  211. package/themes/original/src/layouts/Container.tsx +13 -9
  212. package/themes/original/src/types/index.tsx +38 -9
  213. package/themes/original/src/utils/index.tsx +364 -58
  214. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,30 +1,26 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { OButton, OModal, OText } from '../shared'
6
+ import { HeaderTitle, OButton, OModal, OText } from '../shared'
7
7
  import { SearchBar } from '../SearchBar';
8
- import { BusinessController } from '../BusinessController'
9
8
  import { NotFoundSource } from '../NotFoundSource'
10
9
  import { SingleProductCard } from '../SingleProductCard'
11
10
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
12
11
  import {
13
12
  SearchWrapper,
14
- WrapHeader,
15
13
  ProductsList,
16
14
  SingleBusinessSearch,
17
15
  BusinessInfo,
18
16
  BusinessInfoItem,
19
17
  Metadata,
20
18
  SingleBusinessContainer,
21
- LoadMoreBusinessContainer,
22
19
  TagsContainer,
23
20
  SortContainer,
24
21
  BrandContainer,
25
22
  BrandItem,
26
23
  PriceFilterWrapper,
27
- OptionTitle,
28
24
  BContainer,
29
25
  WrapperButtons
30
26
  } from './styles'
@@ -32,10 +28,12 @@ import FastImage from 'react-native-fast-image'
32
28
  import { convertHoursToMinutes } from '../../utils'
33
29
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
30
  import { BusinessSearchParams } from '../../types'
35
- import { MyOrders } from '../MyOrders'
36
31
  import { useIsFocused } from '@react-navigation/native';
37
32
  import { MaxSectionItem } from './MaxSectionItem'
38
- import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
33
+ import { IOScrollView } from 'react-native-intersection-observer'
34
+
35
+ const PIXELS_TO_SCROLL = 1000
36
+
39
37
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
40
38
  const {
41
39
  navigation,
@@ -43,23 +41,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
43
41
  onBusinessClick,
44
42
  handleChangeTermValue,
45
43
  termValue,
46
- paginationProps,
47
44
  handleSearchbusinessAndProducts,
48
45
  handleChangeFilters,
49
46
  filters,
50
47
  businessTypes,
51
48
  setFilters,
52
49
  brandList,
53
- onNavigationRedirect,
54
- handleUpdateBusinessList,
55
- handleUpdateProducts,
56
- brandId
50
+ handleUpdateProducts
57
51
  } = props
58
52
 
59
53
  const screenHeight = Dimensions.get('window').height;
60
54
  const screenWidth = Dimensions.get('window').width;
61
55
  const theme = useTheme()
62
56
  const [orderState] = useOrder()
57
+ const [events] = useEvent()
63
58
  const { top } = useSafeAreaInsets();
64
59
  const [, t] = useLanguage()
65
60
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
@@ -76,6 +71,9 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
76
71
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
77
72
  ]
78
73
 
74
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
75
+ const hideBrowse = theme?.bar_menu?.components?.browse?.hidden
76
+
79
77
  const priceList = [
80
78
  { level: '1', content: '$' },
81
79
  { level: '2', content: '$$' },
@@ -97,7 +95,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
97
95
  width: '100%'
98
96
  },
99
97
  searchInput: {
100
- fontSize: 10,
98
+ fontSize: 12,
99
+ height: 44
101
100
  },
102
101
  productsContainer: {
103
102
  marginTop: 20
@@ -189,7 +188,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
189
188
 
190
189
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
191
190
 
192
- const onProductClick = (business: any, categoryId: any, productId: any) => {
191
+
192
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
193
193
  if (!isInteger(business?.id) ||
194
194
  !isInteger(categoryId) ||
195
195
  !isInteger(productId) ||
@@ -197,20 +197,42 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
197
197
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
198
198
  return
199
199
  }
200
-
200
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
201
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
201
202
  navigation.navigate('ProductDetails', {
202
203
  isRedirect: 'business',
203
204
  businessId: business?.id,
204
205
  categoryId: categoryId,
205
206
  productId: productId,
207
+ product: product,
206
208
  business: {
207
209
  store: business.slug,
208
210
  header: business.header,
209
211
  logo: business.logo,
210
- }
212
+ },
213
+ productAddedToCartLength
211
214
  })
212
215
  }
213
216
 
217
+ const handleScroll = ({ nativeEvent }: any) => {
218
+ const y = nativeEvent.contentOffset.y;
219
+ const height = nativeEvent.contentSize.height;
220
+ const hasMore = !(
221
+ paginationProps.totalPages === paginationProps.currentPage
222
+ );
223
+
224
+ if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
225
+ handleSearchbusinessAndProducts();
226
+ }
227
+ };
228
+
229
+ const onChangeTermValue = (query: any) => {
230
+ handleChangeTermValue(query)
231
+ if (query) {
232
+ events.emit('products_searched', query)
233
+ }
234
+ }
235
+
214
236
  useEffect(() => {
215
237
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
216
238
  handleSearchbusinessAndProducts(true)
@@ -227,331 +249,334 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
227
249
  }, [isFocused])
228
250
 
229
251
  return (
230
- <BContainer>
231
- <SearchWrapper>
232
- <SearchBar
233
- lazyLoad
234
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
235
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
236
- onSearch={(val: string) => handleChangeTermValue(val)}
237
- value={termValue}
238
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
239
- />
240
- </SearchWrapper>
241
- {
242
- noResults && (
243
- <View>
244
- <NotFoundSource
245
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
246
- />
247
- </View>
248
- )
249
- }
250
- {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
251
- <MyOrders
252
- hideOrders
253
- businessesSearchList={businessesSearchList}
254
- onNavigationRedirect={onNavigationRedirect}
255
- BusinessControllerSkeletons={BusinessControllerSkeletons}
256
- businessPaginationProps={paginationProps}
257
- franchiseId={brandId}
258
- />
259
- )}
260
-
261
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
262
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
263
- {t('BUSINESSES', 'Businesses')}
264
- </OText>
265
- </OptionTitle>
266
- <ScrollView horizontal>
267
- {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
268
- <BusinessController
269
- key={business.id}
270
- business={business}
271
- isBusinessOpen={business.open}
272
- enableIntersection={false}
273
- handleCustomClick={() => onBusinessClick(business)}
274
- handleUpdateBusinessList={handleUpdateBusinessList}
275
- orderType={orderState?.options?.type}
276
- style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
252
+ <IOScrollView
253
+ onScroll={(e: any) => handleScroll(e)}
254
+ showsVerticalScrollIndicator={false}
255
+ >
256
+ <View style={{
257
+ width: '100%',
258
+ display: 'flex',
259
+ flexDirection: 'row',
260
+ alignItems: 'center',
261
+ paddingHorizontal: hideBrowse && !isChewLayout ? 40 : 20,
262
+ }}>
263
+ {hideBrowse && !isChewLayout && (
264
+ <OButton
265
+ imgLeftStyle={{ width: 18 }}
266
+ imgRightSrc={null}
267
+ style={{
268
+ borderWidth: 0,
269
+ width: 26,
270
+ height: 26,
271
+ backgroundColor: '#FFF',
272
+ borderColor: '#FFF',
273
+ shadowColor: '#FFF',
274
+ paddingLeft: 0,
275
+ paddingRight: 0,
276
+ marginTop: 50,
277
+ }}
278
+ onClick={() => props.navigation.goBack()}
279
+ icon={AntDesignIcon}
280
+ iconProps={{
281
+ name: 'arrowleft',
282
+ size: 26
283
+ }}
277
284
  />
278
- ))}
279
- {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
280
- <LoadMoreBusinessContainer>
281
- <OButton
282
- bgColor='transparent'
283
- borderColor={theme.colors.primary}
284
- onClick={() => handleSearchbusinessAndProducts()}
285
- text={t('LOAD_MORE_BUSINESS', 'Load more business')}
286
- textStyle={{ color: theme.colors.primary }}
287
- />
288
- </LoadMoreBusinessContainer>
289
285
  )}
290
- {businessesSearchList.loading && (
291
- <BusinessControllerSkeletons paginationProps={paginationProps} />
292
- )}
293
- </ScrollView>
294
- <ProductsList>
295
- {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
296
- <SingleBusinessSearch key={`card-${business?.id}`}>
297
- <SingleBusinessContainer>
298
- <BusinessInfo>
299
- {(business?.logo || theme.images?.dummies?.businessLogo) && (
300
- <FastImage
301
- style={{ height: 48, width: 48 }}
302
- source={{
303
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
304
- priority: FastImage.priority.normal,
305
- }}
306
- resizeMode={FastImage.resizeMode.cover}
307
- />
308
- )}
309
- </BusinessInfo>
310
- <BusinessInfoItem>
311
- <OText size={12}>{business?.name}</OText>
312
- <Metadata>
313
- {orderState?.options?.type === 1 && (
314
- <>
315
- <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
316
- <OText size={10} mRight={3}>
317
- {business && parsePrice(business?.delivery_price)}
318
- </OText>
319
- </>
320
- )}
321
- <OText size={10} mRight={3}>
322
- {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
323
- </OText>
324
- <OText size={10}>
325
- {parseDistance(business?.distance)}
326
- </OText>
327
- </Metadata>
328
- </BusinessInfoItem>
329
- <OButton
330
- onClick={() => onBusinessClick(business)}
331
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
332
- text={t('GO_TO_STORE', 'Go to store')}
333
- bgColor='#F5F9FF'
334
- borderColor='#fff'
335
- style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
286
+ <HeaderTitle ph={20} text={t('SEARCH', 'Search')} />
287
+ <AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
288
+ </View>
289
+ <BContainer
290
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
291
+ >
292
+ <SearchWrapper>
293
+ <SearchBar
294
+ lazyLoad
295
+ {...(isChewLayout && { height: 55 })}
296
+ inputStyle={{ ...styles.searchInput }}
297
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
298
+ onSearch={(val: string) => onChangeTermValue(val)}
299
+ value={termValue}
300
+ />
301
+ </SearchWrapper>
302
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
303
+ {t('TYPE_AT_LEAST_2_CHARACTERS', 'Type at least 2 characters')}
304
+ </OText>
305
+ {
306
+ noResults && (
307
+ <View>
308
+ <NotFoundSource
309
+ content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
336
310
  />
337
- </SingleBusinessContainer>
338
- <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
339
- {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
340
- <SingleProductCard
341
- key={product?.id}
342
- isSoldOut={(product.inventoried && !product.quantity)}
343
- product={product}
344
- enableIntersection={false}
345
- businessId={business?.id}
346
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
347
- productAddedToCartLength={0}
348
- handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
349
- style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
311
+ </View>
312
+ )
313
+ }
314
+ <ProductsList>
315
+ {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
316
+ <SingleBusinessSearch key={`card-${business?.id}`}>
317
+ <SingleBusinessContainer>
318
+ <BusinessInfo>
319
+ {(business?.logo || theme.images?.dummies?.businessLogo) && (
320
+ <FastImage
321
+ style={{ height: 48, width: 48 }}
322
+ source={{
323
+ uri: optimizeImage(business?.logo, 'h_120,c_limit'),
324
+ priority: FastImage.priority.normal,
325
+ }}
326
+ resizeMode={FastImage.resizeMode.cover}
327
+ />
328
+ )}
329
+ </BusinessInfo>
330
+ <BusinessInfoItem>
331
+ <OText size={12}>{business?.name}</OText>
332
+ <Metadata>
333
+ {orderState?.options?.type === 1 && (
334
+ <>
335
+ <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
336
+ <OText size={10} mRight={3}>
337
+ {business && parsePrice(business?.delivery_price)}
338
+ </OText>
339
+ </>
340
+ )}
341
+ <OText size={10} mRight={3}>
342
+ {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
343
+ </OText>
344
+ <OText size={10}>
345
+ {parseDistance(business?.distance)}
346
+ </OText>
347
+ </Metadata>
348
+ </BusinessInfoItem>
349
+ <OButton
350
+ onClick={() => onBusinessClick(business)}
351
+ textStyle={{ color: theme.colors.primary, fontSize: 10 }}
352
+ text={t('GO_TO_STORE', 'Go to store')}
353
+ bgColor='#F5F9FF'
354
+ borderColor='#fff'
355
+ style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
350
356
  />
351
- )))}
357
+ </SingleBusinessContainer>
358
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
359
+ {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
360
+ <SingleProductCard
361
+ key={product?.id}
362
+ isSoldOut={(product.inventoried && !product.quantity)}
363
+ product={product}
364
+ enableIntersection={false}
365
+ businessId={business?.id}
366
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
367
+ productAddedToCartLength={0}
368
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
369
+ style={{
370
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
371
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
372
+ marginRight: 20
373
+ }}
374
+ />
375
+ )))}
352
376
 
353
- </ScrollView>
354
- </SingleBusinessSearch>
355
- ))}
356
- {businessesSearchList?.loading && (
357
- <>
358
- {[...Array(3).keys()].map(
359
- (item, i) => (
360
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
361
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
362
- <View style={{ flexDirection: 'row' }}>
363
- <PlaceholderLine
364
- width={24}
365
- height={70}
366
- style={{ marginRight: 10, marginBottom: 10 }}
367
- />
368
- <Placeholder style={{ paddingVertical: 10 }}>
369
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
370
- <PlaceholderLine width={60} />
371
- </Placeholder>
372
- </View>
373
- </Placeholder>
374
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
375
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
376
- <PlaceholderLine
377
- width={24}
378
- height={70}
379
- style={{ marginRight: 10, marginBottom: 5 }}
380
- />
381
- <Placeholder style={{ paddingVertical: 10 }}>
382
- <PlaceholderLine width={60} height={10} />
383
- <PlaceholderLine width={50} height={10} />
384
- <PlaceholderLine width={70} height={10} />
385
- </Placeholder>
386
- </View>
387
- </Placeholder>
388
- </View>
389
- ),
390
- )}
391
- </>
392
- )}
393
- </ProductsList>
394
- <OModal
395
- open={openFilters}
396
- onCancel={() => handleCloseFilters()}
397
- onClose={() => handleCloseFilters()}
398
- >
399
- <ScrollView style={styles.filterContainer}>
400
- <OText
401
- size={20}
402
- mBottom={15}
403
- style={{ marginTop: 10 }}
404
- >
405
- {t('FILTER', 'Filter')}
406
- </OText>
407
- <SortContainer>
408
- <OText weight='bold' mBottom={7} size={16}>
409
- {t('SORT', 'Sort')}
410
- </OText>
411
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
412
- <TouchableOpacity
413
- key={item?.value}
414
- onPress={() => handleChangeFilters('orderBy', item?.value)}
415
- style={{ marginBottom: 7 }}
416
- >
417
- <OText
418
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
419
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
420
- >
421
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
422
- </OText>
423
- </TouchableOpacity>
424
- ))}
425
- </SortContainer>
426
- <BrandContainer>
377
+ </ScrollView>
378
+ </SingleBusinessSearch>
379
+ ))}
380
+ {businessesSearchList?.loading && (
381
+ <>
382
+ {[...Array(3).keys()].map(
383
+ (item, i) => (
384
+ <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
385
+ <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
386
+ <View style={{ flexDirection: 'row' }}>
387
+ <PlaceholderLine
388
+ width={24}
389
+ height={70}
390
+ style={{ marginRight: 10, marginBottom: 10 }}
391
+ />
392
+ <Placeholder style={{ paddingVertical: 10 }}>
393
+ <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
394
+ <PlaceholderLine width={60} />
395
+ </Placeholder>
396
+ </View>
397
+ </Placeholder>
398
+ <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
399
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
400
+ <PlaceholderLine
401
+ width={24}
402
+ height={70}
403
+ style={{ marginRight: 10, marginBottom: 5 }}
404
+ />
405
+ <Placeholder style={{ paddingVertical: 10 }}>
406
+ <PlaceholderLine width={60} height={10} />
407
+ <PlaceholderLine width={50} height={10} />
408
+ <PlaceholderLine width={70} height={10} />
409
+ </Placeholder>
410
+ </View>
411
+ </Placeholder>
412
+ </View>
413
+ ),
414
+ )}
415
+ </>
416
+ )}
417
+ </ProductsList>
418
+ <OModal
419
+ open={openFilters}
420
+ onCancel={() => handleCloseFilters()}
421
+ onClose={() => handleCloseFilters()}
422
+ >
423
+ <ScrollView style={styles.filterContainer}>
427
424
  <OText
428
- size={16}
429
- weight='bold'
430
- lineHeight={24}
431
- style={{ marginBottom: 10 }}
425
+ size={20}
426
+ mBottom={15}
427
+ style={{ marginTop: 10 }}
432
428
  >
433
- {t('BRANDS', 'Brands')}
429
+ {t('FILTER', 'Filter')}
434
430
  </OText>
435
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
436
- <ScrollView
437
- style={{ maxHeight: 300, marginBottom: 10 }}
438
- showsVerticalScrollIndicator={true}
439
- nestedScrollEnabled={true}
440
- >
441
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
442
- <BrandItem
443
- key={i}
444
- onPress={() => handleChangeBrandFilter(brand?.id)}
431
+ <SortContainer>
432
+ <OText weight='bold' mBottom={7} size={16}>
433
+ {t('SORT', 'Sort')}
434
+ </OText>
435
+ {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
436
+ <TouchableOpacity
437
+ key={item?.value}
438
+ onPress={() => handleChangeFilters('orderBy', item?.value)}
439
+ style={{ marginBottom: 7 }}
440
+ >
441
+ <OText
442
+ weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
443
+ mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
445
444
  >
446
- <OText
447
- size={14}
448
- weight={'400'}
449
- lineHeight={24}
445
+ {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
446
+ </OText>
447
+ </TouchableOpacity>
448
+ ))}
449
+ </SortContainer>
450
+ <BrandContainer>
451
+ <OText
452
+ size={16}
453
+ weight='bold'
454
+ lineHeight={24}
455
+ style={{ marginBottom: 10 }}
456
+ >
457
+ {t('BRANDS', 'Brands')}
458
+ </OText>
459
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
460
+ <ScrollView
461
+ style={{ maxHeight: 300, marginBottom: 10 }}
462
+ showsVerticalScrollIndicator={true}
463
+ nestedScrollEnabled={true}
464
+ >
465
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
466
+ <BrandItem
467
+ key={i}
468
+ onPress={() => handleChangeBrandFilter(brand?.id)}
450
469
  >
451
- {brand?.name}
452
- </OText>
453
- {filters?.franchise_ids?.includes(brand?.id) && (
454
- <AntDesignIcon
455
- name='check'
456
- color={theme.colors.success500}
457
- size={16}
458
- />
459
- )}
460
- </BrandItem>
470
+ <OText
471
+ size={14}
472
+ weight={'400'}
473
+ lineHeight={24}
474
+ >
475
+ {brand?.name}
476
+ </OText>
477
+ {filters?.franchise_ids?.includes(brand?.id) && (
478
+ <AntDesignIcon
479
+ name='check'
480
+ color={theme.colors.success500}
481
+ size={16}
482
+ />
483
+ )}
484
+ </BrandItem>
485
+ ))}
486
+ </ScrollView>
487
+ )}
488
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
489
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
490
+ )}
491
+ </BrandContainer>
492
+ <PriceFilterWrapper>
493
+ <OText
494
+ size={16}
495
+ weight='bold'
496
+ lineHeight={24}
497
+ style={{ marginBottom: 5 }}
498
+ >
499
+ {t('PRICE_RANGE', 'Price range')}
500
+ </OText>
501
+ <View style={styles.priceContainer}>
502
+ {priceList.map((price: any, i: number) => (
503
+ <OButton
504
+ key={i}
505
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
506
+ onClick={() => handleChangePriceRange(price?.level)}
507
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
508
+ style={styles.priceItem}
509
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
510
+ />
461
511
  ))}
462
- </ScrollView>
512
+ </View>
513
+ </PriceFilterWrapper>
514
+ {orderState?.options?.type === 1 && (
515
+ <MaxSectionItem
516
+ filters={filters}
517
+ title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
518
+ options={maxDeliveryFeeOptions}
519
+ filter='max_delivery_price'
520
+ handleChangeFilters={handleChangeFilters}
521
+ />
463
522
  )}
464
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
465
- <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
523
+ {[1, 2].includes(orderState?.options?.type) && (
524
+ <MaxSectionItem
525
+ filters={filters}
526
+ title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
527
+ options={maxTimeOptions}
528
+ filter='max_eta'
529
+ handleChangeFilters={handleChangeFilters}
530
+ />
466
531
  )}
467
- </BrandContainer>
468
- <PriceFilterWrapper>
469
- <OText
470
- size={16}
471
- weight='bold'
472
- lineHeight={24}
473
- style={{ marginBottom: 5 }}
474
- >
475
- {t('PRICE_RANGE', 'Price range')}
476
- </OText>
477
- <View style={styles.priceContainer}>
478
- {priceList.map((price: any, i: number) => (
479
- <OButton
480
- key={i}
481
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
482
- onClick={() => handleChangePriceRange(price?.level)}
483
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
484
- style={styles.priceItem}
485
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
486
- />
487
- ))}
488
- </View>
489
- </PriceFilterWrapper>
490
- {orderState?.options?.type === 1 && (
491
532
  <MaxSectionItem
492
533
  filters={filters}
493
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
494
- options={maxDeliveryFeeOptions}
495
- filter='max_delivery_price'
534
+ title={t('MAX_DISTANCE', 'Max distance')}
535
+ options={maxDistanceOptions}
536
+ filter='max_distance'
496
537
  handleChangeFilters={handleChangeFilters}
497
538
  />
498
- )}
499
- {[1, 2].includes(orderState?.options?.type) && (
500
- <MaxSectionItem
501
- filters={filters}
502
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
503
- options={maxTimeOptions}
504
- filter='max_eta'
505
- handleChangeFilters={handleChangeFilters}
506
- />
507
- )}
508
- <MaxSectionItem
509
- filters={filters}
510
- title={t('MAX_DISTANCE', 'Max distance')}
511
- options={maxDistanceOptions}
512
- filter='max_distance'
513
- handleChangeFilters={handleChangeFilters}
514
- />
515
- {businessTypes?.length > 0 && (
516
- <TagsContainer>
517
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
518
- <View style={styles.businessTypesContainer}>
519
- {businessTypes.map((type: any, i: number) => type.enabled && (
520
- <OButton
521
- key={type?.id}
522
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
523
- onClick={() => handleChangeActiveBusinessType(type)}
524
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
525
- style={styles.categoryStyle}
526
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
527
- />
528
- ))}
529
- </View>
530
- </TagsContainer>
531
- )}
532
- </ScrollView>
533
- <WrapperButtons>
534
- <View style={{ width: '50%' }}>
535
- <OButton
536
- text={t('APPLY', 'Apply')}
537
- parentStyle={styles.applyButton}
538
- textStyle={{ color: '#fff' }}
539
- onClick={() => handleApplyFilters()}
540
- />
541
- </View>
542
- <View style={{ width: '50%' }}>
543
- <OButton
544
- text={t('CLEAR_FILTERS', 'Clear')}
545
- bgColor={theme.colors.white}
546
- borderColor={theme.colors.primary}
547
- parentStyle={styles.applyButton}
548
- textStyle={{ color: theme.colors.primary }}
549
- onClick={() => clearFilters()}
550
- />
551
- </View>
552
- </WrapperButtons>
553
- </OModal>
554
- </BContainer>
539
+ {businessTypes?.length > 0 && (
540
+ <TagsContainer>
541
+ <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
542
+ <View style={styles.businessTypesContainer}>
543
+ {businessTypes.map((type: any, i: number) => type.enabled && (
544
+ <OButton
545
+ key={type?.id}
546
+ bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
547
+ onClick={() => handleChangeActiveBusinessType(type)}
548
+ text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
549
+ style={styles.categoryStyle}
550
+ textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
551
+ />
552
+ ))}
553
+ </View>
554
+ </TagsContainer>
555
+ )}
556
+ </ScrollView>
557
+ <WrapperButtons>
558
+ <View style={{ width: '50%' }}>
559
+ <OButton
560
+ text={t('APPLY', 'Apply')}
561
+ parentStyle={styles.applyButton}
562
+ textStyle={{ color: '#fff' }}
563
+ onClick={() => handleApplyFilters()}
564
+ />
565
+ </View>
566
+ <View style={{ width: '50%' }}>
567
+ <OButton
568
+ text={t('CLEAR_FILTERS', 'Clear')}
569
+ bgColor={theme.colors.white}
570
+ borderColor={theme.colors.primary}
571
+ parentStyle={styles.applyButton}
572
+ textStyle={{ color: theme.colors.primary }}
573
+ onClick={() => clearFilters()}
574
+ />
575
+ </View>
576
+ </WrapperButtons>
577
+ </OModal>
578
+ </BContainer>
579
+ </IOScrollView>
555
580
  )
556
581
  }
557
582