ordering-ui-react-native 0.18.38 → 0.18.40
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.
- package/package.json +1 -1
- package/themes/business/src/components/DriverMap/index.tsx +1 -1
- package/themes/original/src/components/AddressForm/index.tsx +7 -4
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +18 -3
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +0 -3
- package/themes/original/src/components/BusinessController/index.tsx +3 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +331 -276
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +49 -8
- package/themes/original/src/components/CartContent/index.tsx +56 -14
- package/themes/original/src/components/CartContent/styles.tsx +4 -0
- package/themes/original/src/components/Checkout/index.tsx +6 -5
- package/themes/original/src/components/GoogleMap/index.tsx +11 -2
- package/themes/original/src/components/LoginForm/index.tsx +15 -14
- package/themes/original/src/components/MultiCheckout/index.tsx +6 -5
- package/themes/original/src/components/MyOrders/index.tsx +14 -1
- package/themes/original/src/components/NavBar/index.tsx +9 -4
- package/themes/original/src/components/OrderSummary/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +3 -1
- package/themes/original/src/components/ProductForm/index.tsx +23 -11
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +7 -5
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +2 -2
- package/themes/original/src/components/SignupForm/index.tsx +14 -14
- package/themes/original/src/components/SingleOrderCard/index.tsx +7 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -5
- package/themes/original/src/components/UserProfile/index.tsx +2 -20
- package/themes/original/src/components/UserProfileForm/index.tsx +7 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/Wallets/index.tsx +4 -4
- package/themes/original/src/types/index.tsx +2 -2
- package/themes/original/src/utils/index.tsx +11 -0
|
@@ -3,7 +3,7 @@ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastTy
|
|
|
3
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
8
|
import { NotFoundSource } from '../NotFoundSource'
|
|
9
9
|
import { SingleProductCard } from '../SingleProductCard'
|
|
@@ -30,6 +30,10 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
|
30
30
|
import { BusinessSearchParams } from '../../types'
|
|
31
31
|
import { useIsFocused } from '@react-navigation/native';
|
|
32
32
|
import { MaxSectionItem } from './MaxSectionItem'
|
|
33
|
+
import { IOScrollView } from 'react-native-intersection-observer'
|
|
34
|
+
|
|
35
|
+
const PIXELS_TO_SCROLL = 1000
|
|
36
|
+
|
|
33
37
|
export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
34
38
|
const {
|
|
35
39
|
navigation,
|
|
@@ -67,6 +71,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
67
71
|
]
|
|
68
72
|
|
|
69
73
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
74
|
+
const hideBrowse = theme?.bar_menu?.components?.browse?.hidden
|
|
70
75
|
|
|
71
76
|
const priceList = [
|
|
72
77
|
{ level: '1', content: '$' },
|
|
@@ -90,6 +95,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
90
95
|
},
|
|
91
96
|
searchInput: {
|
|
92
97
|
fontSize: 12,
|
|
98
|
+
height: 44
|
|
93
99
|
},
|
|
94
100
|
productsContainer: {
|
|
95
101
|
marginTop: 20
|
|
@@ -207,6 +213,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
207
213
|
})
|
|
208
214
|
}
|
|
209
215
|
|
|
216
|
+
const handleScroll = ({ nativeEvent }: any) => {
|
|
217
|
+
const y = nativeEvent.contentOffset.y;
|
|
218
|
+
const height = nativeEvent.contentSize.height;
|
|
219
|
+
const hasMore = !(
|
|
220
|
+
paginationProps.totalPages === paginationProps.currentPage
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
|
|
224
|
+
handleSearchbusinessAndProducts();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
210
228
|
useEffect(() => {
|
|
211
229
|
if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
|
|
212
230
|
handleSearchbusinessAndProducts(true)
|
|
@@ -223,297 +241,334 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
223
241
|
}, [isFocused])
|
|
224
242
|
|
|
225
243
|
return (
|
|
226
|
-
<
|
|
227
|
-
|
|
244
|
+
<IOScrollView
|
|
245
|
+
onScroll={(e: any) => handleScroll(e)}
|
|
246
|
+
showsVerticalScrollIndicator={false}
|
|
228
247
|
>
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
{parseDistance(business?.distance)}
|
|
284
|
-
</OText>
|
|
285
|
-
</Metadata>
|
|
286
|
-
</BusinessInfoItem>
|
|
287
|
-
<OButton
|
|
288
|
-
onClick={() => onBusinessClick(business)}
|
|
289
|
-
textStyle={{ color: theme.colors.primary, fontSize: 10 }}
|
|
290
|
-
text={t('GO_TO_STORE', 'Go to store')}
|
|
291
|
-
bgColor='#F5F9FF'
|
|
292
|
-
borderColor='#fff'
|
|
293
|
-
style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
|
|
248
|
+
<View style={{
|
|
249
|
+
width: '100%',
|
|
250
|
+
display: 'flex',
|
|
251
|
+
flexDirection: 'row',
|
|
252
|
+
alignItems: 'center',
|
|
253
|
+
paddingHorizontal: hideBrowse && !isChewLayout ? 40 : 20,
|
|
254
|
+
}}>
|
|
255
|
+
{hideBrowse && !isChewLayout && (
|
|
256
|
+
<OButton
|
|
257
|
+
imgLeftStyle={{ width: 18 }}
|
|
258
|
+
imgRightSrc={null}
|
|
259
|
+
style={{
|
|
260
|
+
borderWidth: 0,
|
|
261
|
+
width: 26,
|
|
262
|
+
height: 26,
|
|
263
|
+
backgroundColor: '#FFF',
|
|
264
|
+
borderColor: '#FFF',
|
|
265
|
+
shadowColor: '#FFF',
|
|
266
|
+
paddingLeft: 0,
|
|
267
|
+
paddingRight: 0,
|
|
268
|
+
marginTop: 50,
|
|
269
|
+
}}
|
|
270
|
+
onClick={() => props.navigation.goBack()}
|
|
271
|
+
icon={AntDesignIcon}
|
|
272
|
+
iconProps={{
|
|
273
|
+
name: 'arrowleft',
|
|
274
|
+
size: 26
|
|
275
|
+
}}
|
|
276
|
+
/>
|
|
277
|
+
)}
|
|
278
|
+
<HeaderTitle ph={20} text={t('SEARCH', 'Search')} />
|
|
279
|
+
<AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
|
|
280
|
+
</View>
|
|
281
|
+
<BContainer
|
|
282
|
+
style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
|
|
283
|
+
>
|
|
284
|
+
<SearchWrapper>
|
|
285
|
+
<SearchBar
|
|
286
|
+
lazyLoad
|
|
287
|
+
{...(isChewLayout && { height: 55 })}
|
|
288
|
+
inputStyle={{ ...styles.searchInput }}
|
|
289
|
+
placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
|
|
290
|
+
onSearch={(val: string) => handleChangeTermValue(val)}
|
|
291
|
+
value={termValue}
|
|
292
|
+
/>
|
|
293
|
+
</SearchWrapper>
|
|
294
|
+
<OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
|
|
295
|
+
{t('TYPE_AT_LEAST_2_CHARACTERS', 'Type at least 2 characters')}
|
|
296
|
+
</OText>
|
|
297
|
+
{
|
|
298
|
+
noResults && (
|
|
299
|
+
<View>
|
|
300
|
+
<NotFoundSource
|
|
301
|
+
content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
|
|
294
302
|
/>
|
|
295
|
-
</
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
303
|
+
</View>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
<ProductsList>
|
|
307
|
+
{businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
|
|
308
|
+
<SingleBusinessSearch key={`card-${business?.id}`}>
|
|
309
|
+
<SingleBusinessContainer>
|
|
310
|
+
<BusinessInfo>
|
|
311
|
+
{(business?.logo || theme.images?.dummies?.businessLogo) && (
|
|
312
|
+
<FastImage
|
|
313
|
+
style={{ height: 48, width: 48 }}
|
|
314
|
+
source={{
|
|
315
|
+
uri: optimizeImage(business?.logo, 'h_120,c_limit'),
|
|
316
|
+
priority: FastImage.priority.normal,
|
|
317
|
+
}}
|
|
318
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
321
|
+
</BusinessInfo>
|
|
322
|
+
<BusinessInfoItem>
|
|
323
|
+
<OText size={12}>{business?.name}</OText>
|
|
324
|
+
<Metadata>
|
|
325
|
+
{orderState?.options?.type === 1 && (
|
|
326
|
+
<>
|
|
327
|
+
<OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
|
|
328
|
+
<OText size={10} mRight={3}>
|
|
329
|
+
{business && parsePrice(business?.delivery_price)}
|
|
330
|
+
</OText>
|
|
331
|
+
</>
|
|
332
|
+
)}
|
|
333
|
+
<OText size={10} mRight={3}>
|
|
334
|
+
{convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
|
|
335
|
+
</OText>
|
|
336
|
+
<OText size={10}>
|
|
337
|
+
{parseDistance(business?.distance)}
|
|
338
|
+
</OText>
|
|
339
|
+
</Metadata>
|
|
340
|
+
</BusinessInfoItem>
|
|
341
|
+
<OButton
|
|
342
|
+
onClick={() => onBusinessClick(business)}
|
|
343
|
+
textStyle={{ color: theme.colors.primary, fontSize: 10 }}
|
|
344
|
+
text={t('GO_TO_STORE', 'Go to store')}
|
|
345
|
+
bgColor='#F5F9FF'
|
|
346
|
+
borderColor='#fff'
|
|
347
|
+
style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
|
|
312
348
|
/>
|
|
313
|
-
|
|
349
|
+
</SingleBusinessContainer>
|
|
350
|
+
<ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
|
|
351
|
+
{business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
|
|
352
|
+
<SingleProductCard
|
|
353
|
+
key={product?.id}
|
|
354
|
+
isSoldOut={(product.inventoried && !product.quantity)}
|
|
355
|
+
product={product}
|
|
356
|
+
enableIntersection={false}
|
|
357
|
+
businessId={business?.id}
|
|
358
|
+
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
|
|
359
|
+
productAddedToCartLength={0}
|
|
360
|
+
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
361
|
+
style={{
|
|
362
|
+
width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
|
|
363
|
+
maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
|
|
364
|
+
marginRight: 20
|
|
365
|
+
}}
|
|
366
|
+
/>
|
|
367
|
+
)))}
|
|
314
368
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<OText
|
|
363
|
-
size={20}
|
|
364
|
-
mBottom={15}
|
|
365
|
-
style={{ marginTop: 10 }}
|
|
366
|
-
>
|
|
367
|
-
{t('FILTER', 'Filter')}
|
|
368
|
-
</OText>
|
|
369
|
-
<SortContainer>
|
|
370
|
-
<OText weight='bold' mBottom={7} size={16}>
|
|
371
|
-
{t('SORT', 'Sort')}
|
|
372
|
-
</OText>
|
|
373
|
-
{sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
|
|
374
|
-
<TouchableOpacity
|
|
375
|
-
key={item?.value}
|
|
376
|
-
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
377
|
-
style={{ marginBottom: 7 }}
|
|
378
|
-
>
|
|
379
|
-
<OText
|
|
380
|
-
weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
|
|
381
|
-
mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
|
|
382
|
-
>
|
|
383
|
-
{item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
|
|
384
|
-
</OText>
|
|
385
|
-
</TouchableOpacity>
|
|
386
|
-
))}
|
|
387
|
-
</SortContainer>
|
|
388
|
-
<BrandContainer>
|
|
369
|
+
</ScrollView>
|
|
370
|
+
</SingleBusinessSearch>
|
|
371
|
+
))}
|
|
372
|
+
{businessesSearchList?.loading && (
|
|
373
|
+
<>
|
|
374
|
+
{[...Array(3).keys()].map(
|
|
375
|
+
(item, i) => (
|
|
376
|
+
<View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
|
|
377
|
+
<Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
|
|
378
|
+
<View style={{ flexDirection: 'row' }}>
|
|
379
|
+
<PlaceholderLine
|
|
380
|
+
width={24}
|
|
381
|
+
height={70}
|
|
382
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
383
|
+
/>
|
|
384
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
385
|
+
<PlaceholderLine width={20} style={{ marginBottom: 25 }} />
|
|
386
|
+
<PlaceholderLine width={60} />
|
|
387
|
+
</Placeholder>
|
|
388
|
+
</View>
|
|
389
|
+
</Placeholder>
|
|
390
|
+
<Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
|
|
391
|
+
<View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
|
|
392
|
+
<PlaceholderLine
|
|
393
|
+
width={24}
|
|
394
|
+
height={70}
|
|
395
|
+
style={{ marginRight: 10, marginBottom: 5 }}
|
|
396
|
+
/>
|
|
397
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
398
|
+
<PlaceholderLine width={60} height={10} />
|
|
399
|
+
<PlaceholderLine width={50} height={10} />
|
|
400
|
+
<PlaceholderLine width={70} height={10} />
|
|
401
|
+
</Placeholder>
|
|
402
|
+
</View>
|
|
403
|
+
</Placeholder>
|
|
404
|
+
</View>
|
|
405
|
+
),
|
|
406
|
+
)}
|
|
407
|
+
</>
|
|
408
|
+
)}
|
|
409
|
+
</ProductsList>
|
|
410
|
+
<OModal
|
|
411
|
+
open={openFilters}
|
|
412
|
+
onCancel={() => handleCloseFilters()}
|
|
413
|
+
onClose={() => handleCloseFilters()}
|
|
414
|
+
>
|
|
415
|
+
<ScrollView style={styles.filterContainer}>
|
|
389
416
|
<OText
|
|
390
|
-
size={
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
style={{ marginBottom: 10 }}
|
|
417
|
+
size={20}
|
|
418
|
+
mBottom={15}
|
|
419
|
+
style={{ marginTop: 10 }}
|
|
394
420
|
>
|
|
395
|
-
{t('
|
|
421
|
+
{t('FILTER', 'Filter')}
|
|
396
422
|
</OText>
|
|
397
|
-
|
|
398
|
-
<
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
423
|
+
<SortContainer>
|
|
424
|
+
<OText weight='bold' mBottom={7} size={16}>
|
|
425
|
+
{t('SORT', 'Sort')}
|
|
426
|
+
</OText>
|
|
427
|
+
{sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
|
|
428
|
+
<TouchableOpacity
|
|
429
|
+
key={item?.value}
|
|
430
|
+
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
431
|
+
style={{ marginBottom: 7 }}
|
|
432
|
+
>
|
|
433
|
+
<OText
|
|
434
|
+
weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
|
|
435
|
+
mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
|
|
407
436
|
>
|
|
408
|
-
<
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
437
|
+
{item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
|
|
438
|
+
</OText>
|
|
439
|
+
</TouchableOpacity>
|
|
440
|
+
))}
|
|
441
|
+
</SortContainer>
|
|
442
|
+
<BrandContainer>
|
|
443
|
+
<OText
|
|
444
|
+
size={16}
|
|
445
|
+
weight='bold'
|
|
446
|
+
lineHeight={24}
|
|
447
|
+
style={{ marginBottom: 10 }}
|
|
448
|
+
>
|
|
449
|
+
{t('BRANDS', 'Brands')}
|
|
450
|
+
</OText>
|
|
451
|
+
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
452
|
+
<ScrollView
|
|
453
|
+
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
454
|
+
showsVerticalScrollIndicator={true}
|
|
455
|
+
nestedScrollEnabled={true}
|
|
456
|
+
>
|
|
457
|
+
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
458
|
+
<BrandItem
|
|
459
|
+
key={i}
|
|
460
|
+
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
412
461
|
>
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
462
|
+
<OText
|
|
463
|
+
size={14}
|
|
464
|
+
weight={'400'}
|
|
465
|
+
lineHeight={24}
|
|
466
|
+
>
|
|
467
|
+
{brand?.name}
|
|
468
|
+
</OText>
|
|
469
|
+
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
470
|
+
<AntDesignIcon
|
|
471
|
+
name='check'
|
|
472
|
+
color={theme.colors.success500}
|
|
473
|
+
size={16}
|
|
474
|
+
/>
|
|
475
|
+
)}
|
|
476
|
+
</BrandItem>
|
|
477
|
+
))}
|
|
478
|
+
</ScrollView>
|
|
479
|
+
)}
|
|
480
|
+
{!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
|
|
481
|
+
<OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
|
|
482
|
+
)}
|
|
483
|
+
</BrandContainer>
|
|
484
|
+
<PriceFilterWrapper>
|
|
485
|
+
<OText
|
|
486
|
+
size={16}
|
|
487
|
+
weight='bold'
|
|
488
|
+
lineHeight={24}
|
|
489
|
+
style={{ marginBottom: 5 }}
|
|
490
|
+
>
|
|
491
|
+
{t('PRICE_RANGE', 'Price range')}
|
|
492
|
+
</OText>
|
|
493
|
+
<View style={styles.priceContainer}>
|
|
494
|
+
{priceList.map((price: any, i: number) => (
|
|
495
|
+
<OButton
|
|
496
|
+
key={i}
|
|
497
|
+
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
498
|
+
onClick={() => handleChangePriceRange(price?.level)}
|
|
499
|
+
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
500
|
+
style={styles.priceItem}
|
|
501
|
+
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
|
|
502
|
+
/>
|
|
423
503
|
))}
|
|
424
|
-
</
|
|
504
|
+
</View>
|
|
505
|
+
</PriceFilterWrapper>
|
|
506
|
+
{orderState?.options?.type === 1 && (
|
|
507
|
+
<MaxSectionItem
|
|
508
|
+
filters={filters}
|
|
509
|
+
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
510
|
+
options={maxDeliveryFeeOptions}
|
|
511
|
+
filter='max_delivery_price'
|
|
512
|
+
handleChangeFilters={handleChangeFilters}
|
|
513
|
+
/>
|
|
425
514
|
)}
|
|
426
|
-
{
|
|
427
|
-
<
|
|
515
|
+
{[1, 2].includes(orderState?.options?.type) && (
|
|
516
|
+
<MaxSectionItem
|
|
517
|
+
filters={filters}
|
|
518
|
+
title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
|
|
519
|
+
options={maxTimeOptions}
|
|
520
|
+
filter='max_eta'
|
|
521
|
+
handleChangeFilters={handleChangeFilters}
|
|
522
|
+
/>
|
|
428
523
|
)}
|
|
429
|
-
</BrandContainer>
|
|
430
|
-
<PriceFilterWrapper>
|
|
431
|
-
<OText
|
|
432
|
-
size={16}
|
|
433
|
-
weight='bold'
|
|
434
|
-
lineHeight={24}
|
|
435
|
-
style={{ marginBottom: 5 }}
|
|
436
|
-
>
|
|
437
|
-
{t('PRICE_RANGE', 'Price range')}
|
|
438
|
-
</OText>
|
|
439
|
-
<View style={styles.priceContainer}>
|
|
440
|
-
{priceList.map((price: any, i: number) => (
|
|
441
|
-
<OButton
|
|
442
|
-
key={i}
|
|
443
|
-
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
444
|
-
onClick={() => handleChangePriceRange(price?.level)}
|
|
445
|
-
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
446
|
-
style={styles.priceItem}
|
|
447
|
-
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
|
|
448
|
-
/>
|
|
449
|
-
))}
|
|
450
|
-
</View>
|
|
451
|
-
</PriceFilterWrapper>
|
|
452
|
-
{orderState?.options?.type === 1 && (
|
|
453
|
-
<MaxSectionItem
|
|
454
|
-
filters={filters}
|
|
455
|
-
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
456
|
-
options={maxDeliveryFeeOptions}
|
|
457
|
-
filter='max_delivery_price'
|
|
458
|
-
handleChangeFilters={handleChangeFilters}
|
|
459
|
-
/>
|
|
460
|
-
)}
|
|
461
|
-
{[1, 2].includes(orderState?.options?.type) && (
|
|
462
524
|
<MaxSectionItem
|
|
463
525
|
filters={filters}
|
|
464
|
-
title={
|
|
465
|
-
options={
|
|
466
|
-
filter='
|
|
526
|
+
title={t('MAX_DISTANCE', 'Max distance')}
|
|
527
|
+
options={maxDistanceOptions}
|
|
528
|
+
filter='max_distance'
|
|
467
529
|
handleChangeFilters={handleChangeFilters}
|
|
468
530
|
/>
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
)
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
textStyle={{ color: theme.colors.primary }}
|
|
511
|
-
onClick={() => clearFilters()}
|
|
512
|
-
/>
|
|
513
|
-
</View>
|
|
514
|
-
</WrapperButtons>
|
|
515
|
-
</OModal>
|
|
516
|
-
</BContainer>
|
|
531
|
+
{businessTypes?.length > 0 && (
|
|
532
|
+
<TagsContainer>
|
|
533
|
+
<OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
|
|
534
|
+
<View style={styles.businessTypesContainer}>
|
|
535
|
+
{businessTypes.map((type: any, i: number) => type.enabled && (
|
|
536
|
+
<OButton
|
|
537
|
+
key={type?.id}
|
|
538
|
+
bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
539
|
+
onClick={() => handleChangeActiveBusinessType(type)}
|
|
540
|
+
text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
|
|
541
|
+
style={styles.categoryStyle}
|
|
542
|
+
textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
|
|
543
|
+
/>
|
|
544
|
+
))}
|
|
545
|
+
</View>
|
|
546
|
+
</TagsContainer>
|
|
547
|
+
)}
|
|
548
|
+
</ScrollView>
|
|
549
|
+
<WrapperButtons>
|
|
550
|
+
<View style={{ width: '50%' }}>
|
|
551
|
+
<OButton
|
|
552
|
+
text={t('APPLY', 'Apply')}
|
|
553
|
+
parentStyle={styles.applyButton}
|
|
554
|
+
textStyle={{ color: '#fff' }}
|
|
555
|
+
onClick={() => handleApplyFilters()}
|
|
556
|
+
/>
|
|
557
|
+
</View>
|
|
558
|
+
<View style={{ width: '50%' }}>
|
|
559
|
+
<OButton
|
|
560
|
+
text={t('CLEAR_FILTERS', 'Clear')}
|
|
561
|
+
bgColor={theme.colors.white}
|
|
562
|
+
borderColor={theme.colors.primary}
|
|
563
|
+
parentStyle={styles.applyButton}
|
|
564
|
+
textStyle={{ color: theme.colors.primary }}
|
|
565
|
+
onClick={() => clearFilters()}
|
|
566
|
+
/>
|
|
567
|
+
</View>
|
|
568
|
+
</WrapperButtons>
|
|
569
|
+
</OModal>
|
|
570
|
+
</BContainer>
|
|
571
|
+
</IOScrollView>
|
|
517
572
|
)
|
|
518
573
|
}
|
|
519
574
|
|