ordering-ui-react-native 0.17.34 → 0.17.35-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 (211) hide show
  1. package/package.json +8 -7
  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 +119 -120
  6. package/src/components/StripeMethodForm/index.tsx +108 -79
  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 +118 -107
  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 +43 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +90 -47
  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 +85 -49
  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 +154 -68
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  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 +350 -323
  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 +105 -78
  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 +15 -1
  94. package/themes/original/src/components/Checkout/index.tsx +331 -177
  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 +78 -0
  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 +197 -116
  134. package/themes/original/src/components/MultiCheckout/index.tsx +298 -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/Notifications/index.tsx +46 -50
  142. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  143. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  144. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  145. package/themes/original/src/components/OrderDetails/index.tsx +199 -359
  146. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  147. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  148. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  149. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  150. package/themes/original/src/components/OrderSummary/index.tsx +87 -59
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  153. package/themes/original/src/components/OrdersOption/index.tsx +63 -56
  154. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  155. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +34 -6
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  160. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  161. package/themes/original/src/components/ProductForm/index.tsx +223 -232
  162. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  163. package/themes/original/src/components/ProductItemAccordion/index.tsx +59 -29
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
  165. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  166. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  167. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  168. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  169. package/themes/original/src/components/Promotions/index.tsx +234 -220
  170. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  171. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  172. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  173. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  174. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  175. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  176. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  177. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  178. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  179. package/themes/original/src/components/ServiceForm/index.tsx +74 -19
  180. package/themes/original/src/components/Sessions/index.tsx +11 -8
  181. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  182. package/themes/original/src/components/SignupForm/index.tsx +42 -19
  183. package/themes/original/src/components/SingleOrderCard/index.tsx +156 -65
  184. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
  185. package/themes/original/src/components/SingleProductCard/index.tsx +100 -56
  186. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -13
  187. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  188. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  189. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  190. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  191. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  192. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  193. package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
  194. package/themes/original/src/components/UserProfile/index.tsx +5 -7
  195. package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
  196. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  197. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  198. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  199. package/themes/original/src/components/Wallets/index.tsx +79 -36
  200. package/themes/original/src/components/Wallets/styles.tsx +5 -4
  201. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  202. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  203. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  204. package/themes/original/src/components/shared/OButton.tsx +6 -2
  205. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  206. package/themes/original/src/components/shared/OInput.tsx +16 -2
  207. package/themes/original/src/components/shared/OModal.tsx +3 -3
  208. package/themes/original/src/layouts/Container.tsx +13 -9
  209. package/themes/original/src/types/index.tsx +37 -9
  210. package/themes/original/src/utils/index.tsx +364 -58
  211. 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,15 +41,12 @@ 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
50
  handleUpdateProducts
56
51
  } = props
57
52
 
@@ -59,6 +54,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
59
54
  const screenWidth = Dimensions.get('window').width;
60
55
  const theme = useTheme()
61
56
  const [orderState] = useOrder()
57
+ const [events] = useEvent()
62
58
  const { top } = useSafeAreaInsets();
63
59
  const [, t] = useLanguage()
64
60
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
@@ -75,6 +71,9 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
75
71
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
76
72
  ]
77
73
 
74
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
75
+ const hideBrowse = theme?.bar_menu?.components?.browse?.hidden
76
+
78
77
  const priceList = [
79
78
  { level: '1', content: '$' },
80
79
  { level: '2', content: '$$' },
@@ -96,7 +95,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
96
95
  width: '100%'
97
96
  },
98
97
  searchInput: {
99
- fontSize: 10,
98
+ fontSize: 12,
99
+ height: 44
100
100
  },
101
101
  productsContainer: {
102
102
  marginTop: 20
@@ -188,7 +188,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
188
188
 
189
189
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
190
190
 
191
- const onProductClick = (business: any, categoryId: any, productId: any) => {
191
+
192
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
192
193
  if (!isInteger(business?.id) ||
193
194
  !isInteger(categoryId) ||
194
195
  !isInteger(productId) ||
@@ -196,20 +197,42 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
196
197
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
197
198
  return
198
199
  }
199
-
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
200
202
  navigation.navigate('ProductDetails', {
201
203
  isRedirect: 'business',
202
204
  businessId: business?.id,
203
205
  categoryId: categoryId,
204
206
  productId: productId,
207
+ product: product,
205
208
  business: {
206
209
  store: business.slug,
207
210
  header: business.header,
208
211
  logo: business.logo,
209
- }
212
+ },
213
+ productAddedToCartLength
210
214
  })
211
215
  }
212
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
+
213
236
  useEffect(() => {
214
237
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
215
238
  handleSearchbusinessAndProducts(true)
@@ -226,330 +249,334 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
226
249
  }, [isFocused])
227
250
 
228
251
  return (
229
- <BContainer>
230
- <SearchWrapper>
231
- <SearchBar
232
- lazyLoad
233
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
234
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
235
- onSearch={(val: string) => handleChangeTermValue(val)}
236
- value={termValue}
237
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
238
- />
239
- </SearchWrapper>
240
- {
241
- noResults && (
242
- <View>
243
- <NotFoundSource
244
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
245
- />
246
- </View>
247
- )
248
- }
249
- {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
250
- <MyOrders
251
- hideOrders
252
- businessesSearchList={businessesSearchList}
253
- onNavigationRedirect={onNavigationRedirect}
254
- BusinessControllerSkeletons={BusinessControllerSkeletons}
255
- businessPaginationProps={paginationProps}
256
- />
257
- )}
258
-
259
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
260
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
261
- {t('BUSINESSES', 'Businesses')}
262
- </OText>
263
- </OptionTitle>
264
- <ScrollView horizontal>
265
- {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
266
- <BusinessController
267
- key={business.id}
268
- business={business}
269
- isBusinessOpen={business.open}
270
- enableIntersection={false}
271
- handleCustomClick={() => onBusinessClick(business)}
272
- handleUpdateBusinessList={handleUpdateBusinessList}
273
- orderType={orderState?.options?.type}
274
- 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
+ }}
275
284
  />
276
- ))}
277
- {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
278
- <LoadMoreBusinessContainer>
279
- <OButton
280
- bgColor='transparent'
281
- borderColor={theme.colors.primary}
282
- onClick={() => handleSearchbusinessAndProducts()}
283
- text={t('LOAD_MORE_BUSINESS', 'Load more business')}
284
- textStyle={{ color: theme.colors.primary }}
285
- />
286
- </LoadMoreBusinessContainer>
287
285
  )}
288
- {businessesSearchList.loading && (
289
- <BusinessControllerSkeletons paginationProps={paginationProps} />
290
- )}
291
- </ScrollView>
292
- <ProductsList>
293
- {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
294
- <SingleBusinessSearch key={`card-${business?.id}`}>
295
- <SingleBusinessContainer>
296
- <BusinessInfo>
297
- {(business?.logo || theme.images?.dummies?.businessLogo) && (
298
- <FastImage
299
- style={{ height: 48, width: 48 }}
300
- source={{
301
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
302
- priority: FastImage.priority.normal,
303
- }}
304
- resizeMode={FastImage.resizeMode.cover}
305
- />
306
- )}
307
- </BusinessInfo>
308
- <BusinessInfoItem>
309
- <OText size={12}>{business?.name}</OText>
310
- <Metadata>
311
- {orderState?.options?.type === 1 && (
312
- <>
313
- <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
314
- <OText size={10} mRight={3}>
315
- {business && parsePrice(business?.delivery_price)}
316
- </OText>
317
- </>
318
- )}
319
- <OText size={10} mRight={3}>
320
- {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
321
- </OText>
322
- <OText size={10}>
323
- {parseDistance(business?.distance)}
324
- </OText>
325
- </Metadata>
326
- </BusinessInfoItem>
327
- <OButton
328
- onClick={() => onBusinessClick(business)}
329
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
330
- text={t('GO_TO_STORE', 'Go to store')}
331
- bgColor='#F5F9FF'
332
- borderColor='#fff'
333
- 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.')}
334
310
  />
335
- </SingleBusinessContainer>
336
- <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
337
- {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
338
- <SingleProductCard
339
- key={product?.id}
340
- isSoldOut={(product.inventoried && !product.quantity)}
341
- product={product}
342
- enableIntersection={false}
343
- businessId={business?.id}
344
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
345
- productAddedToCartLength={0}
346
- handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
347
- 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 }}
348
356
  />
349
- )))}
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
+ )))}
350
376
 
351
- </ScrollView>
352
- </SingleBusinessSearch>
353
- ))}
354
- {businessesSearchList?.loading && (
355
- <>
356
- {[...Array(3).keys()].map(
357
- (item, i) => (
358
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
359
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
360
- <View style={{ flexDirection: 'row' }}>
361
- <PlaceholderLine
362
- width={24}
363
- height={70}
364
- style={{ marginRight: 10, marginBottom: 10 }}
365
- />
366
- <Placeholder style={{ paddingVertical: 10 }}>
367
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
368
- <PlaceholderLine width={60} />
369
- </Placeholder>
370
- </View>
371
- </Placeholder>
372
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
373
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
374
- <PlaceholderLine
375
- width={24}
376
- height={70}
377
- style={{ marginRight: 10, marginBottom: 5 }}
378
- />
379
- <Placeholder style={{ paddingVertical: 10 }}>
380
- <PlaceholderLine width={60} height={10} />
381
- <PlaceholderLine width={50} height={10} />
382
- <PlaceholderLine width={70} height={10} />
383
- </Placeholder>
384
- </View>
385
- </Placeholder>
386
- </View>
387
- ),
388
- )}
389
- </>
390
- )}
391
- </ProductsList>
392
- <OModal
393
- open={openFilters}
394
- onCancel={() => handleCloseFilters()}
395
- onClose={() => handleCloseFilters()}
396
- >
397
- <ScrollView style={styles.filterContainer}>
398
- <OText
399
- size={20}
400
- mBottom={15}
401
- style={{ marginTop: 10 }}
402
- >
403
- {t('FILTER', 'Filter')}
404
- </OText>
405
- <SortContainer>
406
- <OText weight='bold' mBottom={7} size={16}>
407
- {t('SORT', 'Sort')}
408
- </OText>
409
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
410
- <TouchableOpacity
411
- key={item?.value}
412
- onPress={() => handleChangeFilters('orderBy', item?.value)}
413
- style={{ marginBottom: 7 }}
414
- >
415
- <OText
416
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
417
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
418
- >
419
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
420
- </OText>
421
- </TouchableOpacity>
422
- ))}
423
- </SortContainer>
424
- <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}>
425
424
  <OText
426
- size={16}
427
- weight='bold'
428
- lineHeight={24}
429
- style={{ marginBottom: 10 }}
425
+ size={20}
426
+ mBottom={15}
427
+ style={{ marginTop: 10 }}
430
428
  >
431
- {t('BRANDS', 'Brands')}
429
+ {t('FILTER', 'Filter')}
432
430
  </OText>
433
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
434
- <ScrollView
435
- style={{ maxHeight: 300, marginBottom: 10 }}
436
- showsVerticalScrollIndicator={true}
437
- nestedScrollEnabled={true}
438
- >
439
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
440
- <BrandItem
441
- key={i}
442
- 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}
443
444
  >
444
- <OText
445
- size={14}
446
- weight={'400'}
447
- 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)}
448
469
  >
449
- {brand?.name}
450
- </OText>
451
- {filters?.franchise_ids?.includes(brand?.id) && (
452
- <AntDesignIcon
453
- name='check'
454
- color={theme.colors.success500}
455
- size={16}
456
- />
457
- )}
458
- </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
+ />
459
511
  ))}
460
- </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
+ />
461
522
  )}
462
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
463
- <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
+ />
464
531
  )}
465
- </BrandContainer>
466
- <PriceFilterWrapper>
467
- <OText
468
- size={16}
469
- weight='bold'
470
- lineHeight={24}
471
- style={{ marginBottom: 5 }}
472
- >
473
- {t('PRICE_RANGE', 'Price range')}
474
- </OText>
475
- <View style={styles.priceContainer}>
476
- {priceList.map((price: any, i: number) => (
477
- <OButton
478
- key={i}
479
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
480
- onClick={() => handleChangePriceRange(price?.level)}
481
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
482
- style={styles.priceItem}
483
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
484
- />
485
- ))}
486
- </View>
487
- </PriceFilterWrapper>
488
- {orderState?.options?.type === 1 && (
489
532
  <MaxSectionItem
490
533
  filters={filters}
491
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
492
- options={maxDeliveryFeeOptions}
493
- filter='max_delivery_price'
534
+ title={t('MAX_DISTANCE', 'Max distance')}
535
+ options={maxDistanceOptions}
536
+ filter='max_distance'
494
537
  handleChangeFilters={handleChangeFilters}
495
538
  />
496
- )}
497
- {[1, 2].includes(orderState?.options?.type) && (
498
- <MaxSectionItem
499
- filters={filters}
500
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
501
- options={maxTimeOptions}
502
- filter='max_eta'
503
- handleChangeFilters={handleChangeFilters}
504
- />
505
- )}
506
- <MaxSectionItem
507
- filters={filters}
508
- title={t('MAX_DISTANCE', 'Max distance')}
509
- options={maxDistanceOptions}
510
- filter='max_distance'
511
- handleChangeFilters={handleChangeFilters}
512
- />
513
- {businessTypes?.length > 0 && (
514
- <TagsContainer>
515
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
516
- <View style={styles.businessTypesContainer}>
517
- {businessTypes.map((type: any, i: number) => type.enabled && (
518
- <OButton
519
- key={type?.id}
520
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
521
- onClick={() => handleChangeActiveBusinessType(type)}
522
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
523
- style={styles.categoryStyle}
524
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
525
- />
526
- ))}
527
- </View>
528
- </TagsContainer>
529
- )}
530
- </ScrollView>
531
- <WrapperButtons>
532
- <View style={{ width: '50%' }}>
533
- <OButton
534
- text={t('APPLY', 'Apply')}
535
- parentStyle={styles.applyButton}
536
- textStyle={{ color: '#fff' }}
537
- onClick={() => handleApplyFilters()}
538
- />
539
- </View>
540
- <View style={{ width: '50%' }}>
541
- <OButton
542
- text={t('CLEAR_FILTERS', 'Clear')}
543
- bgColor={theme.colors.white}
544
- borderColor={theme.colors.primary}
545
- parentStyle={styles.applyButton}
546
- textStyle={{ color: theme.colors.primary }}
547
- onClick={() => clearFilters()}
548
- />
549
- </View>
550
- </WrapperButtons>
551
- </OModal>
552
- </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>
553
580
  )
554
581
  }
555
582