ordering-ui-react-native 0.16.84 → 0.16.85-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 +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +8 -8
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +1 -21
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  23. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  24. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  25. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  26. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  27. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  28. package/themes/business/src/components/MapView/index.tsx +19 -8
  29. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  30. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  34. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  35. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  36. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  37. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  38. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  41. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  45. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  46. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  48. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  52. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  53. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  54. package/themes/business/src/components/shared/OLink.tsx +33 -13
  55. package/themes/business/src/components/shared/OModal.tsx +16 -9
  56. package/themes/business/src/components/shared/OText.tsx +8 -2
  57. package/themes/business/src/types/index.tsx +35 -3
  58. package/themes/business/src/utils/index.tsx +53 -0
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  63. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  64. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  65. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  66. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  67. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  68. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  71. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  72. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  76. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  77. package/themes/kiosk/src/types/index.d.ts +13 -0
  78. package/themes/kiosk/src/utils/index.tsx +15 -0
  79. package/themes/original/index.tsx +8 -0
  80. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  81. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  82. package/themes/original/src/components/AddressList/index.tsx +18 -18
  83. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  84. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  85. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  86. package/themes/original/src/components/BusinessController/index.tsx +100 -47
  87. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  88. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  89. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +93 -42
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
  92. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +564 -495
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +83 -42
  103. package/themes/original/src/components/CartContent/index.tsx +77 -15
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +74 -86
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +26 -10
  134. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +179 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +6 -11
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
  150. package/themes/original/src/components/OrderProgress/index.tsx +82 -106
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +79 -84
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  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 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  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 +377 -270
  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 +78 -66
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +106 -47
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +243 -218
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +61 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/Wallets/index.tsx +96 -93
  204. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  205. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  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 +1 -1
  209. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  210. package/themes/original/src/components/shared/OInput.tsx +10 -1
  211. package/themes/original/src/layouts/Container.tsx +13 -9
  212. package/themes/original/src/types/index.tsx +36 -5
  213. package/themes/original/src/utils/index.tsx +321 -58
  214. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -46,6 +46,12 @@ export const BusinessItemAccordion = (props: any) => {
46
46
  }
47
47
  }, [orderState?.carts, isClosed])
48
48
 
49
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
50
+ if (item?.type === 1)
51
+ return acc = acc + item?.summary?.tax
52
+ return acc = acc
53
+ }, cart?.subtotal)
54
+
49
55
  return (
50
56
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
51
57
  <BIHeader
@@ -102,7 +108,7 @@ export const BusinessItemAccordion = (props: any) => {
102
108
  <OText
103
109
  size={12}
104
110
  lineHeight={18}
105
- color={theme.colors.textSecondary}
111
+ color={theme.colors.primary}
106
112
  style={{ textDecorationLine: 'underline' }}
107
113
  >
108
114
  {t('CHANGE_STORE', 'Change store')}
@@ -149,9 +155,9 @@ export const BusinessItemAccordion = (props: any) => {
149
155
  <OButton
150
156
  onClick={handleClickCheckout}
151
157
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
158
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
159
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
161
  borderColor={theme.colors.primary}
156
162
  isDisabled={checkoutButtonDisabled}
157
163
  />
@@ -25,7 +25,8 @@ import {
25
25
  BrandItem,
26
26
  PriceFilterWrapper,
27
27
  OptionTitle,
28
- BContainer
28
+ BContainer,
29
+ WrapperButtons
29
30
  } from './styles'
30
31
  import FastImage from 'react-native-fast-image'
31
32
  import { convertHoursToMinutes } from '../../utils'
@@ -51,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
51
52
  brandList,
52
53
  onNavigationRedirect,
53
54
  handleUpdateBusinessList,
54
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
55
57
  } = props
56
58
 
57
59
  const screenHeight = Dimensions.get('window').height;
@@ -74,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
74
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
75
77
  ]
76
78
 
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
+
77
81
  const priceList = [
78
82
  { level: '1', content: '$' },
79
83
  { level: '2', content: '$$' },
@@ -95,7 +99,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
95
99
  width: '100%'
96
100
  },
97
101
  searchInput: {
98
- fontSize: 10,
102
+ fontSize: 12,
99
103
  },
100
104
  productsContainer: {
101
105
  marginTop: 20
@@ -134,7 +138,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
134
138
  borderWidth: 0
135
139
  },
136
140
  applyButton: {
137
- paddingHorizontal: 40,
141
+ paddingHorizontal: 10,
138
142
  width: '100%',
139
143
  marginTop: 20
140
144
  }
@@ -145,10 +149,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
145
149
  }
146
150
 
147
151
  const handleCloseFilters = () => {
148
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
152
+ clearFilters()
149
153
  setOpenFilters(false)
150
154
  }
151
155
 
156
+ const clearFilters = () => {
157
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
158
+ }
159
+
152
160
  const handleChangeActiveBusinessType = (type: any) => {
153
161
  if (type?.id === null) {
154
162
  handleChangeFilters('business_types', [])
@@ -183,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
183
191
 
184
192
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
185
193
 
186
- const onProductClick = (business: any, categoryId: any, productId: any) => {
194
+
195
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
187
196
  if (!isInteger(business?.id) ||
188
197
  !isInteger(categoryId) ||
189
198
  !isInteger(productId) ||
@@ -191,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
191
200
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
192
201
  return
193
202
  }
194
-
203
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
204
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
195
205
  navigation.navigate('ProductDetails', {
196
206
  isRedirect: 'business',
197
207
  businessId: business?.id,
198
208
  categoryId: categoryId,
199
209
  productId: productId,
210
+ product: product,
200
211
  business: {
201
212
  store: business.slug,
202
213
  header: business.header,
203
214
  logo: business.logo,
204
- }
215
+ },
216
+ productAddedToCartLength
205
217
  })
206
218
  }
207
219
 
@@ -221,19 +233,23 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
221
233
  }, [isFocused])
222
234
 
223
235
  return (
224
- <BContainer>
236
+ <BContainer
237
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
+ >
225
239
  <SearchWrapper>
226
- {isFocused && (
227
- <SearchBar
228
- lazyLoad
229
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
230
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
231
- onSearch={(val: string) => handleChangeTermValue(val)}
232
- value={termValue}
233
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
234
- />
235
- )}
240
+ <SearchBar
241
+ lazyLoad
242
+ {...(isChewLayout && { height: 55 })}
243
+ inputStyle={{ ...styles.searchInput }}
244
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
245
+ onSearch={(val: string) => handleChangeTermValue(val)}
246
+ value={termValue}
247
+ iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
248
+ />
236
249
  </SearchWrapper>
250
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
+ {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
+ </OText>
237
253
  {
238
254
  noResults && (
239
255
  <View>
@@ -250,26 +266,41 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
250
266
  onNavigationRedirect={onNavigationRedirect}
251
267
  BusinessControllerSkeletons={BusinessControllerSkeletons}
252
268
  businessPaginationProps={paginationProps}
269
+ franchiseId={brandId}
270
+ hideBackBtn
271
+ titleStyle={{
272
+ paddingHorizontal: 0,
273
+ marginTop: 0,
274
+ marginLeft: 0
275
+ }}
253
276
  />
254
277
  )}
255
278
 
256
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
257
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
258
- {t('BUSINESSES', 'Businesses')}
259
- </OText>
260
- </OptionTitle>
261
- <ScrollView horizontal>
279
+ {businessesSearchList.businesses?.length > 0 && (
280
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
+ {t('BUSINESSES', 'Businesses')}
283
+ </OText>
284
+ </OptionTitle>
285
+ )}
286
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
262
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
263
- <BusinessController
288
+ <View
264
289
  key={business.id}
265
- business={business}
266
- isBusinessOpen={business.open}
267
- enableIntersection={false}
268
- handleCustomClick={() => onBusinessClick(business)}
269
- handleUpdateBusinessList={handleUpdateBusinessList}
270
- orderType={orderState?.options?.type}
271
- style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
272
- />
290
+ style={{
291
+ width: screenWidth - 120,
292
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
293
+ }}
294
+ >
295
+ <BusinessController
296
+ business={business}
297
+ isBusinessOpen={business.open}
298
+ enableIntersection={false}
299
+ handleCustomClick={() => onBusinessClick(business)}
300
+ handleUpdateBusinessList={handleUpdateBusinessList}
301
+ orderType={orderState?.options?.type}
302
+ />
303
+ </View>
273
304
  ))}
274
305
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
275
306
  <LoadMoreBusinessContainer>
@@ -338,7 +369,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
338
369
  product={product}
339
370
  enableIntersection={false}
340
371
  businessId={business?.id}
341
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
372
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
342
373
  productAddedToCartLength={0}
343
374
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
344
375
  style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
@@ -367,7 +398,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
367
398
  </View>
368
399
  </Placeholder>
369
400
  <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
370
- <View style={{ flexDirection: 'row-reverse' }}>
401
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
371
402
  <PlaceholderLine
372
403
  width={24}
373
404
  height={70}
@@ -484,22 +515,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
484
515
  </PriceFilterWrapper>
485
516
  {orderState?.options?.type === 1 && (
486
517
  <MaxSectionItem
518
+ filters={filters}
487
519
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
488
520
  options={maxDeliveryFeeOptions}
489
521
  filter='max_delivery_price'
522
+ handleChangeFilters={handleChangeFilters}
490
523
  />
491
524
  )}
492
525
  {[1, 2].includes(orderState?.options?.type) && (
493
526
  <MaxSectionItem
527
+ filters={filters}
494
528
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
495
529
  options={maxTimeOptions}
496
530
  filter='max_eta'
531
+ handleChangeFilters={handleChangeFilters}
497
532
  />
498
533
  )}
499
534
  <MaxSectionItem
535
+ filters={filters}
500
536
  title={t('MAX_DISTANCE', 'Max distance')}
501
537
  options={maxDistanceOptions}
502
538
  filter='max_distance'
539
+ handleChangeFilters={handleChangeFilters}
503
540
  />
504
541
  {businessTypes?.length > 0 && (
505
542
  <TagsContainer>
@@ -519,12 +556,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
519
556
  </TagsContainer>
520
557
  )}
521
558
  </ScrollView>
522
- <OButton
523
- text={t('APPLY', 'Apply')}
524
- parentStyle={styles.applyButton}
525
- textStyle={{ color: '#fff' }}
526
- onClick={() => handleApplyFilters()}
527
- />
559
+ <WrapperButtons>
560
+ <View style={{ width: '50%' }}>
561
+ <OButton
562
+ text={t('APPLY', 'Apply')}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: '#fff' }}
565
+ onClick={() => handleApplyFilters()}
566
+ />
567
+ </View>
568
+ <View style={{ width: '50%' }}>
569
+ <OButton
570
+ text={t('CLEAR_FILTERS', 'Clear')}
571
+ bgColor={theme.colors.white}
572
+ borderColor={theme.colors.primary}
573
+ parentStyle={styles.applyButton}
574
+ textStyle={{ color: theme.colors.primary }}
575
+ onClick={() => clearFilters()}
576
+ />
577
+ </View>
578
+ </WrapperButtons>
528
579
  </OModal>
529
580
  </BContainer>
530
581
  )
@@ -86,3 +86,9 @@ export const OptionTitle = styled.View`
86
86
  margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
87
87
  `}
88
88
  `
89
+
90
+ export const WrapperButtons = styled.View`
91
+ flex-direction: row;
92
+ width: 100%;
93
+ justify-content: space-between;
94
+ `
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { TouchableOpacity, StyleSheet, View, Dimensions, Platform } from 'react-native'
3
3
  import { useLanguage, useUtils, useConfig, useOrder, MomentOption } from 'ordering-components/native'
4
- import { OButton, OText } from '../shared'
4
+ import { OButton, OIcon, OText } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
7
  import FastImage from 'react-native-fast-image'
@@ -37,7 +37,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
37
37
  handleChangeDate,
38
38
  handleChangeTime,
39
39
  handleAsap,
40
- isAsap
40
+ getActualSchedule,
41
+ isAsap,
42
+ cateringPreorder,
43
+ preorderLeadTime
41
44
  } = props
42
45
 
43
46
  const theme = useTheme()
@@ -52,6 +55,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
52
55
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
53
56
  const [isEnabled, setIsEnabled] = useState(false)
54
57
  const { top } = useSafeAreaInsets()
58
+ const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
59
+
55
60
  const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
61
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
57
62
  const styles = StyleSheet.create({
@@ -252,10 +257,45 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
252
257
 
253
258
  useEffect(() => {
254
259
  if (selectDate === null) return
255
- const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
256
- const _times = getTimes(selectDate, selectedMenu)
257
- setTimeList(_times)
258
- }, [selectDate, menu])
260
+ if (cateringPreorder) {
261
+ let _timeLists = []
262
+ const schedule = business && getActualSchedule()
263
+ if (!schedule && cateringPreorder && Object.keys(business)?.length > 0) {
264
+ return
265
+ }
266
+ _timeLists = hoursList
267
+ .filter(hour => ((Object.keys(business || {})?.length === 0) || schedule?.lapses?.some((lapse: any) =>
268
+ moment(dateSelected + ` ${hour.startTime}`) >= moment(dateSelected + ` ${lapse.open.hour}:${lapse.open.minute}`).add(preorderLeadTime, 'minutes') && moment(dateSelected + ` ${hour.endTime}`) <= moment(dateSelected + ` ${lapse.close.hour}:${lapse.close.minute}`))) &&
269
+ moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`) &&
270
+ (moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder))
271
+ .map(hour => {
272
+ return {
273
+ value: hour.startTime,
274
+ text: is12hours ? (
275
+ hour.startTime.includes('12')
276
+ ? `${hour.startTime}PM`
277
+ : parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
278
+ ) : (
279
+ parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
280
+ ),
281
+ endText: is12hours ? (
282
+ hour.endTime.includes('12')
283
+ ? `${hour.endTime}PM`
284
+ : parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'hh:mma' })
285
+ ) : (
286
+ parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'HH:mm' })
287
+ )
288
+ }
289
+ })
290
+ if (_timeLists?.length > 0) {
291
+ setTimeList(_timeLists)
292
+ }
293
+ } else {
294
+ const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
295
+ const _times = getTimes(selectDate, selectedMenu)
296
+ setTimeList(_times)
297
+ }
298
+ }, [selectDate, menu, business, cateringPreorder, hoursList, dateSelected])
259
299
 
260
300
  useEffect(() => {
261
301
  if (selectedPreorderType === 0 && Object.keys(menu).length > 0) setMenu({})
@@ -263,6 +303,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
263
303
 
264
304
  useEffect(() => {
265
305
  if (dateSelected) {
306
+
266
307
  const dateParts = dateSelected.split('-')
267
308
  const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
268
309
  setSelectedDate(_dateSelected)
@@ -302,7 +343,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
302
343
  />
303
344
  </View>
304
345
  </BusinessInfoWrapper>
305
- {isPreOrderSetting && (
346
+ {isPreOrderSetting && !cateringPreorder && (
306
347
  <PreorderTypeWrapper>
307
348
  <OText
308
349
  size={16}
@@ -415,19 +456,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
415
456
  />
416
457
  )}
417
458
  </View>
418
- <TimeListWrapper nestedScrollEnabled={true}>
419
- {(isEnabled && timeList?.length > 0) ? (
459
+ <TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
460
+ {((isEnabled || cateringPreorder) && timeList?.length > 0) ? (
420
461
  <TimeContentWrapper>
421
462
  {timeList.map((time: any, i: number) => (
422
463
  <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
- <TimeItem active={timeSelected === time.value}>
464
+ <TimeItem active={timeSelected === time.value} cateringPreorder={cateringPreorder}>
465
+ {cateringPreorder && (
466
+ <>
467
+ {timeSelected === time.value ? (
468
+ <OIcon
469
+ src={theme.images.general.option_checked}
470
+ width={18}
471
+ style={{ marginEnd: 24, bottom: 2 }}
472
+ />
473
+ ) : (
474
+ <OIcon
475
+ src={theme.images.general.option_normal}
476
+ width={18}
477
+ style={{ marginEnd: 24, bottom: 2 }}
478
+ />
479
+ )}
480
+ </>
481
+ )}
424
482
  <OText
425
- size={14}
483
+ size={cateringPreorder ? 18 : 16}
426
484
  color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
485
  style={{
428
486
  lineHeight: 24
429
487
  }}
430
- >{time.text}</OText>
488
+ >{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
431
489
  </TimeItem>
432
490
  </TouchableOpacity>
433
491
  ))}
@@ -461,7 +519,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
461
519
  marginBottom: 12,
462
520
  textAlign: 'center'
463
521
  }}
464
- >
522
+ >
465
523
  {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
466
524
  </OText>
467
525
  )}
@@ -480,7 +538,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
480
538
 
481
539
  export const BusinessPreorder = (props: any) => {
482
540
  const [{ configs }] = useConfig()
483
-
541
+ const [orderState] = useOrder()
484
542
  const limitDays = parseInt(configs?.max_days_preorder?.value, 10)
485
543
 
486
544
  const currentDate = new Date()
@@ -492,10 +550,33 @@ export const BusinessPreorder = (props: any) => {
492
550
  currentDate.setHours(23)
493
551
  currentDate.setMinutes(59)
494
552
 
553
+ const cateringTypeString = orderState?.options?.type === 7
554
+ ? 'catering_delivery'
555
+ : orderState?.options?.type === 8
556
+ ? 'catering_pickup'
557
+ : null
558
+
559
+ const splitCateringValue = (configName : string) =>
560
+ Object.values(props?.business?.configs || {})
561
+ ?.find(config => config?.key === configName)
562
+ ?.value?.split('|')
563
+ ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
564
+ const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
565
+ const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
566
+ const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
567
+ const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
568
+ const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
569
+
495
570
  const businessPreorderProps = {
496
571
  ...props,
497
572
  UIComponent: BusinessPreorderUI,
498
- maxDate: currentDate
573
+ maxDate: currentDate,
574
+ preorderLeadTime,
575
+ preorderSlotInterval,
576
+ preorderTimeRange,
577
+ preorderMaximumDays,
578
+ preorderMinimumDays,
579
+ cateringPreorder: !!cateringTypeString
499
580
  }
500
581
  return <MomentOption {...businessPreorderProps} />
501
582
  }
@@ -166,14 +166,16 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
166
166
  style={bpStyles.catWrap}
167
167
  onLayout={(event: any) => handleOnLayout(event, category.id)}
168
168
  >
169
- <View style={bpStyles.catIcon}>
170
- <OIcon
171
- url={optimizeImage(category.image, 'h_250,c_limit')}
172
- width={41}
173
- height={41}
174
- style={{ borderRadius: 7.6 }}
175
- />
176
- </View>
169
+ {!!category.image && (
170
+ <View style={bpStyles.catIcon}>
171
+ <OIcon
172
+ url={optimizeImage(category.image, 'h_250,c_limit')}
173
+ width={41}
174
+ height={41}
175
+ style={{ borderRadius: 7.6 }}
176
+ />
177
+ </View>
178
+ )}
177
179
  <OText size={16} weight="600">
178
180
  {category.name}
179
181
  </OText>
@@ -18,15 +18,12 @@ export const RibbonBox = styled.View`
18
18
  background-color: ${(props: any) => props.theme.colors.primary};
19
19
  padding: 2px 8px;
20
20
  max-width: 180px;
21
-
22
21
  ${(props: any) => props.bgColor && css`
23
22
  background-color: ${props.bgColor};
24
23
  `}
25
-
26
24
  ${(props: any) => props.isRoundRect && css`
27
25
  border-radius: 7.6px;
28
26
  `}
29
-
30
27
  ${(props: any) => props.isCapsule && css`
31
28
  border-radius: 50px;
32
29
  `}