ordering-ui-react-native 0.15.33 → 0.15.34-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 (169) hide show
  1. package/package.json +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/LoginForm/index.tsx +3 -1
  10. package/src/components/OrderDetails/index.tsx +2 -2
  11. package/src/components/PaymentOptions/index.tsx +9 -16
  12. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  13. package/src/components/SignupForm/index.tsx +3 -1
  14. package/src/components/SingleProductCard/index.tsx +16 -4
  15. package/src/components/StripeElementsForm/index.tsx +27 -48
  16. package/src/components/UpsellingProducts/index.tsx +1 -1
  17. package/src/components/UserProfileForm/index.tsx +63 -6
  18. package/src/components/UserProfileForm/styles.tsx +8 -0
  19. package/src/components/VerifyPhone/styles.tsx +1 -2
  20. package/src/components/shared/OModal.tsx +1 -1
  21. package/src/config.json +0 -2
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/HomeNavigator.tsx +6 -0
  24. package/src/pages/BusinessProductsList.tsx +1 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/Checkout.tsx +1 -1
  27. package/src/pages/Sessions.tsx +22 -0
  28. package/src/types/index.tsx +5 -11
  29. package/src/utils/index.tsx +68 -1
  30. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  31. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  32. package/themes/business/src/components/Chat/index.tsx +38 -86
  33. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  34. package/themes/business/src/components/Home/index.tsx +128 -55
  35. package/themes/business/src/components/Home/styles.tsx +8 -1
  36. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  37. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  38. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  39. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  40. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  41. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  42. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  43. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  44. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  45. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  46. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  47. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  48. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  49. package/themes/business/src/components/shared/OModal.tsx +1 -1
  50. package/themes/business/src/types/index.tsx +5 -1
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  55. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  56. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  57. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  58. package/themes/kiosk/src/components/Intro/index.tsx +12 -12
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  62. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  63. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  64. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  66. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/kiosk/src/types/index.d.ts +2 -0
  69. package/themes/original/index.tsx +184 -1
  70. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  71. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +56 -16
  78. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +125 -7
  82. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  83. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  85. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  86. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +111 -14
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  91. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  92. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  93. package/themes/original/src/components/BusinessesListing/index.tsx +85 -45
  94. package/themes/original/src/components/Cart/index.tsx +21 -17
  95. package/themes/original/src/components/CartContent/index.tsx +2 -2
  96. package/themes/original/src/components/Checkout/index.tsx +59 -48
  97. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  98. package/themes/original/src/components/Favorite/index.tsx +91 -0
  99. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  100. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  101. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  102. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  103. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  104. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  105. package/themes/original/src/components/Help/index.tsx +21 -4
  106. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  107. package/themes/original/src/components/Home/index.tsx +1 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  110. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  111. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  112. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  113. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  114. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  115. package/themes/original/src/components/Messages/index.tsx +6 -1
  116. package/themes/original/src/components/Messages/styles.tsx +1 -3
  117. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  118. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  119. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  120. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  121. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  122. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  123. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  124. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  125. package/themes/original/src/components/OrdersOption/index.tsx +57 -56
  126. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  127. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  128. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  129. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  130. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  131. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  132. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  133. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  134. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  135. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  136. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  137. package/themes/original/src/components/Promotions/index.tsx +250 -0
  138. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  139. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  140. package/themes/original/src/components/Sessions/index.tsx +160 -0
  141. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  142. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  143. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  144. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  145. package/themes/original/src/components/SingleProductCard/index.tsx +82 -30
  146. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  147. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
  148. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  149. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  150. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  151. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  152. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  153. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  154. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  155. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  156. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  157. package/themes/original/src/components/Wallets/index.tsx +76 -9
  158. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  159. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  160. package/themes/original/src/components/shared/OModal.tsx +4 -2
  161. package/themes/original/src/components/shared/index.tsx +2 -0
  162. package/themes/original/src/config/constants.tsx +6 -6
  163. package/themes/original/src/types/index.tsx +107 -9
  164. package/themes/original/src/utils/index.tsx +28 -2
  165. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  166. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  167. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  168. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  169. package/src/components/StripeMethodForm/index.tsx +0 -174
@@ -9,7 +9,7 @@ import { useTheme } from 'styled-components/native';
9
9
  import { OIcon, OText } from '../shared';
10
10
  import { StyleSheet, useWindowDimensions, View } from 'react-native';
11
11
  import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes } from '../../utils';
12
+ import { convertHoursToMinutes, shape } from '../../utils';
13
13
  import {
14
14
  Card,
15
15
  BusinessHero,
@@ -20,6 +20,7 @@ import {
20
20
  BusinessState,
21
21
  BusinessLogo,
22
22
  Reviews,
23
+ RibbonBox
23
24
  } from './styles';
24
25
 
25
26
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
@@ -97,6 +98,24 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
97
98
 
98
99
  return (
99
100
  <Card activeOpacity={1} onPress={() => handleClick(business)}>
101
+ {business?.ribbon?.enabled && (
102
+ <RibbonBox
103
+ bgColor={business?.ribbon?.color}
104
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
105
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
106
+ >
107
+ <OText
108
+ size={10}
109
+ weight={'400'}
110
+ color={theme.colors.white}
111
+ numberOfLines={2}
112
+ ellipsizeMode='tail'
113
+ lineHeight={13}
114
+ >
115
+ {business?.ribbon?.text}
116
+ </OText>
117
+ </RibbonBox>
118
+ )}
100
119
  <BusinessHero>
101
120
  <BusinessLogo>
102
121
  <OIcon
@@ -4,6 +4,7 @@ export const Card = styled.TouchableOpacity`
4
4
  margin-vertical: 4px;
5
5
  height: 60px;
6
6
  overflow: hidden;
7
+ position: relative;
7
8
  `;
8
9
 
9
10
  export const BusinessHero = styled.View`
@@ -48,3 +49,25 @@ export const BusinessLogo = styled.View`
48
49
  export const Reviews = styled.View`
49
50
  flex-direction: row;
50
51
  `
52
+
53
+ export const RibbonBox = styled.View`
54
+ position: absolute;
55
+ z-index: 1;
56
+ top: 0px;
57
+ right: 5px;
58
+ background-color: ${(props: any) => props.theme.colors.primary};
59
+ padding: 1px 8px;
60
+ max-width: 160px;
61
+
62
+ ${(props: any) => props.bgColor && css`
63
+ background-color: ${props.bgColor};
64
+ `}
65
+
66
+ ${(props: any) => props.isRoundRect && css`
67
+ border-radius: 7.6px;
68
+ `}
69
+
70
+ ${(props: any) => props.isCapsule && css`
71
+ border-radius: 50px;
72
+ `}
73
+ `
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import { OButton, OIcon, OModal, OText } from '../shared'
@@ -22,15 +22,18 @@ import {
22
22
  ProgressContentWrapper,
23
23
  ProgressBar,
24
24
  TagsContainer,
25
- SortContainer
25
+ SortContainer,
26
+ BrandContainer,
27
+ BrandItem,
28
+ PriceFilterWrapper
26
29
  } from './styles'
27
30
  import FastImage from 'react-native-fast-image'
28
31
  import { convertHoursToMinutes } from '../../utils'
29
32
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
30
33
  import { BusinessSearchParams } from '../../types'
31
34
 
32
- export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
33
35
 
36
+ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
34
37
  const {
35
38
  navigation,
36
39
  businessesSearchList,
@@ -42,9 +45,13 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
42
45
  handleChangeFilters,
43
46
  filters,
44
47
  businessTypes,
45
- setFilters
48
+ setFilters,
49
+ brandList,
50
+ handleUpdateBusinessList,
51
+ handleUpdateProducts
46
52
  } = props
47
-
53
+
54
+ const screenHeight = Dimensions.get('window').height;
48
55
  const theme = useTheme()
49
56
  const [orderState] = useOrder()
50
57
  const { top } = useSafeAreaInsets();
@@ -63,11 +70,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
63
70
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
64
71
  ]
65
72
 
73
+ const priceList = [
74
+ { level: '1', content: '$' },
75
+ { level: '2', content: '$$' },
76
+ { level: '3', content: '$$$' },
77
+ { level: '4', content: '$$$$' },
78
+ { level: '5', content: '$$$$$' }
79
+ ]
80
+
66
81
  const styles = StyleSheet.create({
67
82
  container: {
68
83
  paddingHorizontal: 40,
69
84
  width: '100%'
70
85
  },
86
+ filterContainer: {
87
+ maxHeight: screenHeight - 150,
88
+ paddingHorizontal: 40,
89
+ width: '100%'
90
+ },
71
91
  searchInput: {
72
92
  fontSize: 10,
73
93
  },
@@ -84,6 +104,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
84
104
  flexWrap: 'wrap',
85
105
  justifyContent: 'center'
86
106
  },
107
+ priceContainer: {
108
+ width: '100%',
109
+ flexDirection: 'row',
110
+ flexWrap: 'wrap',
111
+ justifyContent: 'space-between'
112
+ },
87
113
  categoryStyle: {
88
114
  marginRight: 10,
89
115
  marginTop: 10,
@@ -95,6 +121,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
95
121
  height: 28,
96
122
  borderWidth: 0
97
123
  },
124
+ priceItem: {
125
+ marginRight: 10,
126
+ marginTop: 10,
127
+ borderRadius: 50,
128
+ paddingVertical: 4,
129
+ paddingLeft: 5,
130
+ paddingRight: 5,
131
+ height: 27,
132
+ borderWidth: 0
133
+ },
98
134
  applyButton: {
99
135
  paddingHorizontal: 40,
100
136
  width: '100%',
@@ -107,7 +143,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
107
143
  }
108
144
 
109
145
  const handleCloseFilters = () => {
110
- setFilters({ business_types: [], orderBy: 'default' })
146
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
111
147
  setOpenFilters(false)
112
148
  }
113
149
 
@@ -126,6 +162,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
126
162
  }
127
163
  }
128
164
 
165
+ const handleChangeBrandFilter = (brandId: number) => {
166
+ let franchiseIds = [...filters?.franchise_ids]
167
+ if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
168
+ else franchiseIds.push(brandId)
169
+ handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
170
+ }
171
+
172
+ const handleChangePriceRange = (value: string) => {
173
+ if (value === filters?.price_level) handleChangeFilters('price_level', null)
174
+ else handleChangeFilters('price_level', value)
175
+ }
176
+
129
177
  const handleApplyFilters = () => {
130
178
  handleSearchbusinessAndProducts(true)
131
179
  setOpenFilters(false)
@@ -137,6 +185,10 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
137
185
  }
138
186
  }, [filters, openFilters])
139
187
 
188
+ useEffect(() => {
189
+ handleSearchbusinessAndProducts(true)
190
+ }, [])
191
+
140
192
  const MaxSectionItem = ({ title, options, filter }: any) => {
141
193
  const parseValue = (option: number) => {
142
194
  return filter === 'max_distance'
@@ -214,6 +266,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
214
266
  business={business}
215
267
  isBusinessOpen={business.open}
216
268
  handleCustomClick={() => onBusinessClick(business)}
269
+ handleUpdateBusinessList={handleUpdateBusinessList}
217
270
  orderType={orderState?.options?.type}
218
271
  style={{ width: 320, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
219
272
  />
@@ -334,6 +387,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
334
387
  businessId={business?.id}
335
388
  onProductClick={() => { }}
336
389
  productAddedToCartLength={0}
390
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
337
391
  style={{ width: 320, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
338
392
  />
339
393
  )))}
@@ -384,7 +438,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
384
438
  onCancel={() => handleCloseFilters()}
385
439
  onClose={() => handleCloseFilters()}
386
440
  >
387
- <ScrollView style={styles.container}>
441
+ <ScrollView style={styles.filterContainer}>
388
442
  <OText
389
443
  size={20}
390
444
  mBottom={15}
@@ -411,6 +465,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
411
465
  </TouchableOpacity>
412
466
  ))}
413
467
  </SortContainer>
468
+ <BrandContainer>
469
+ <OText
470
+ size={16}
471
+ weight='bold'
472
+ lineHeight={24}
473
+ style={{ marginBottom: 10 }}
474
+ >
475
+ {t('BRANDS', 'Brands')}
476
+ </OText>
477
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
478
+ <ScrollView
479
+ style={{ maxHeight: 300, marginBottom: 10 }}
480
+ showsVerticalScrollIndicator={true}
481
+ nestedScrollEnabled={true}
482
+ >
483
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
484
+ <BrandItem
485
+ key={i}
486
+ onPress={() => handleChangeBrandFilter(brand?.id)}
487
+ >
488
+ <OText
489
+ size={14}
490
+ weight={'400'}
491
+ lineHeight={24}
492
+ >
493
+ {brand?.name}
494
+ </OText>
495
+ {filters?.franchise_ids?.includes(brand?.id) && (
496
+ <AntDesignIcon
497
+ name='check'
498
+ color={theme.colors.success500}
499
+ size={16}
500
+ />
501
+ )}
502
+ </BrandItem>
503
+ ))}
504
+ </ScrollView>
505
+ )}
506
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
507
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
508
+ )}
509
+ </BrandContainer>
510
+ <PriceFilterWrapper>
511
+ <OText
512
+ size={16}
513
+ weight='bold'
514
+ lineHeight={24}
515
+ style={{ marginBottom: 5 }}
516
+ >
517
+ {t('PRICE_RANGE', 'Price range')}
518
+ </OText>
519
+ <View style={styles.priceContainer}>
520
+ {priceList.map((price: any, i: number) => (
521
+ <OButton
522
+ key={i}
523
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
524
+ onClick={() => handleChangePriceRange(price?.level)}
525
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
526
+ style={styles.priceItem}
527
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
528
+ />
529
+ ))}
530
+ </View>
531
+ </PriceFilterWrapper>
414
532
  {orderState?.options?.type === 1 && (
415
533
  <MaxSectionItem
416
534
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
@@ -68,9 +68,22 @@ export const ProgressContentWrapper = styled.View`
68
68
  `
69
69
 
70
70
  export const TagsContainer = styled.View`
71
-
71
+ padding-bottom: 10px;
72
72
  `
73
73
 
74
74
  export const SortContainer = styled.View`
75
75
  margin-bottom: 10px;
76
76
  `
77
+
78
+ export const BrandContainer = styled.View``
79
+
80
+ export const BrandItem = styled.TouchableOpacity`
81
+ flex-direction: row;
82
+ justify-content: space-between;
83
+ margin-bottom: 4px;
84
+ align-items: center;
85
+ `
86
+
87
+ export const PriceFilterWrapper = styled.View`
88
+ margin-bottom: 20px;
89
+ `
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
3
3
  import { OText } from '../shared'
4
4
  import { BusinessMenuListParams } from '../../types'
@@ -19,7 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
19
19
 
20
20
  const [, t] = useLanguage()
21
21
  const theme = useTheme()
22
- const {top} = useSafeAreaInsets()
22
+ const { top } = useSafeAreaInsets()
23
23
 
24
24
  const styles = StyleSheet.create({
25
25
  container: {
@@ -36,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
36
36
  height: 44,
37
37
  width: '100%'
38
38
  }
39
- })
39
+ })
40
40
 
41
41
  const dropDownIcon = () => {
42
42
  return (
@@ -48,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
48
48
  )
49
49
  }
50
50
 
51
+ useEffect(() => {
52
+ if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
53
+ setMenu(businessMenuList?.menus[0])
54
+ }
55
+ }, [businessMenuList?.menus])
56
+
51
57
  return (
52
58
  <>
53
59
  {businessMenuList.loading ? (
54
60
  <Placeholder Animation={Fade}>
55
61
  <View>
56
- <PlaceholderLine height={44}/>
62
+ <PlaceholderLine height={44} />
57
63
  </View>
58
64
  </Placeholder>
59
65
  ) : (
@@ -67,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
67
73
  onSelect={(selectedItem, index) => {
68
74
  setMenu(selectedItem)
69
75
  }}
76
+ defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
70
77
  buttonTextAfterSelection={(selectedItem, index) => {
71
78
  return selectedItem.name
72
79
  }}
@@ -51,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
51
51
  const [selectDate, setSelectedDate] = useState<any>(null)
52
52
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
53
53
  const [isEnabled, setIsEnabled] = useState(false)
54
- const {top} = useSafeAreaInsets()
54
+ const { top } = useSafeAreaInsets()
55
+ const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
55
57
  const styles = StyleSheet.create({
56
58
  container: {
57
59
  height: windowHeight,
@@ -142,7 +144,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
142
144
 
143
145
  const validateSelectedDate = (curdate: any, menu: any) => {
144
146
  const day = moment(curdate).format('d')
145
- setIsEnabled(menu?.schedule[day]?.enabled || false)
147
+ setIsEnabled(menu?.schedule?.[day]?.enabled || false)
146
148
  }
147
149
 
148
150
  const getTimes = (curdate: any, menu: any) => {
@@ -300,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
300
302
  />
301
303
  </View>
302
304
  </BusinessInfoWrapper>
303
- <PreorderTypeWrapper>
304
- <OText
305
- size={16}
306
- style={{
307
- fontWeight: '600',
308
- lineHeight: 24,
309
- marginBottom: 12
310
- }}
311
- >
312
- {t('PREORDER_TYPE', 'Preorder type')}
313
- </OText>
314
- <SelectDropdown
315
- defaultValueByIndex={selectedPreorderType}
316
- data={preorderTypeList}
317
- // disabled={orderState.loading}
318
- onSelect={(selectedItem, index) => {
319
- setSelectedPreorderType(index)
320
- }}
321
- buttonTextAfterSelection={(selectedItem, index) => {
322
- return selectedItem.name
323
- }}
324
- rowTextForSelection={(item, index) => {
325
- return item.name
326
- }}
327
- buttonStyle={styles.selectOption}
328
- buttonTextStyle={{
329
- color: theme.colors.disabled,
330
- fontSize: 14,
331
- textAlign: 'left',
332
- marginHorizontal: 0
333
- }}
334
- dropdownStyle={{
335
- borderRadius: 8,
336
- borderColor: theme.colors.lightGray,
337
- marginTop: Platform.OS === 'ios' ? 12 : -top
338
- }}
339
- rowStyle={{
340
- borderBottomColor: theme.colors.backgroundGray100,
341
- backgroundColor: theme.colors.backgroundGray100,
342
- height: 40,
343
- flexDirection: 'column',
344
- alignItems: 'flex-start',
345
- paddingTop: 8,
346
- paddingHorizontal: 14
347
- }}
348
- rowTextStyle={{
349
- color: theme.colors.disabled,
350
- fontSize: 14,
351
- marginHorizontal: 0
352
- }}
353
- renderDropdownIcon={() => dropDownIcon()}
354
- dropdownOverlayColor='transparent'
355
- />
356
- </PreorderTypeWrapper>
305
+ {isPreOrderSetting && (
306
+ <PreorderTypeWrapper>
307
+ <OText
308
+ size={16}
309
+ style={{
310
+ fontWeight: '600',
311
+ lineHeight: 24,
312
+ marginBottom: 12
313
+ }}
314
+ >
315
+ {t('PREORDER_TYPE', 'Preorder type')}
316
+ </OText>
317
+ <SelectDropdown
318
+ defaultValueByIndex={selectedPreorderType}
319
+ data={preorderTypeList}
320
+ // disabled={orderState.loading}
321
+ onSelect={(selectedItem, index) => {
322
+ setSelectedPreorderType(index)
323
+ }}
324
+ buttonTextAfterSelection={(selectedItem, index) => {
325
+ return selectedItem.name
326
+ }}
327
+ rowTextForSelection={(item, index) => {
328
+ return item.name
329
+ }}
330
+ buttonStyle={styles.selectOption}
331
+ buttonTextStyle={{
332
+ color: theme.colors.disabled,
333
+ fontSize: 14,
334
+ textAlign: 'left',
335
+ marginHorizontal: 0
336
+ }}
337
+ dropdownStyle={{
338
+ borderRadius: 8,
339
+ borderColor: theme.colors.lightGray,
340
+ marginTop: Platform.OS === 'ios' ? 12 : -top
341
+ }}
342
+ rowStyle={{
343
+ borderBottomColor: theme.colors.backgroundGray100,
344
+ backgroundColor: theme.colors.backgroundGray100,
345
+ height: 40,
346
+ flexDirection: 'column',
347
+ alignItems: 'flex-start',
348
+ paddingTop: 8,
349
+ paddingHorizontal: 14
350
+ }}
351
+ rowTextStyle={{
352
+ color: theme.colors.disabled,
353
+ fontSize: 14,
354
+ marginHorizontal: 0
355
+ }}
356
+ renderDropdownIcon={() => dropDownIcon()}
357
+ dropdownOverlayColor='transparent'
358
+ />
359
+ </PreorderTypeWrapper>
360
+ )}
357
361
  {selectedPreorderType === 1 && (
358
362
  <MenuWrapper>
359
363
  <OText
@@ -373,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
373
377
  />
374
378
  </MenuWrapper>
375
379
  )}
376
- <OrderTimeWrapper>
380
+ {isPreOrderSetting && showOrderTime && (
381
+ <OrderTimeWrapper>
382
+ <OText
383
+ size={16}
384
+ style={{
385
+ fontWeight: '600',
386
+ lineHeight: 24
387
+ }}
388
+ >
389
+ {t('ORDER_TIME', 'Order time')}
390
+ </OText>
391
+ <View style={{ flex: 1 }}>
392
+ {selectDate && datesWhitelist[0]?.start !== null && (
393
+ <CalendarStrip
394
+ scrollable
395
+ style={styles.calendar}
396
+ calendarHeaderContainerStyle={styles.calendarHeaderContainer}
397
+ calendarHeaderStyle={styles.calendarHeader}
398
+ dateNumberStyle={styles.dateNumber}
399
+ dateNameStyle={styles.dateName}
400
+ iconContainer={{ flex: 0.1 }}
401
+ highlightDateNameStyle={styles.highlightDateName}
402
+ highlightDateNumberStyle={styles.highlightDateNumber}
403
+ dayContainerStyle={{ height: '100%' }}
404
+ highlightDateContainerStyle={{ height: '100%' }}
405
+ calendarHeaderFormat='MMMM, YYYY'
406
+ iconStyle={{ borderWidth: 1 }}
407
+ selectedDate={selectDate}
408
+ datesWhitelist={datesWhitelist}
409
+ disabledDateNameStyle={styles.disabledDateName}
410
+ disabledDateNumberStyle={styles.disabledDateNumber}
411
+ disabledDateOpacity={0.6}
412
+ onDateSelected={(date) => onSelectDate(date)}
413
+ leftSelector={<LeftSelector />}
414
+ rightSelector={<RightSelector />}
415
+ />
416
+ )}
417
+ </View>
418
+ <TimeListWrapper nestedScrollEnabled={true}>
419
+ {(isEnabled && timeList?.length > 0) ? (
420
+ <TimeContentWrapper>
421
+ {timeList.map((time: any, i: number) => (
422
+ <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
+ <TimeItem active={timeSelected === time.value}>
424
+ <OText
425
+ size={14}
426
+ color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
+ style={{
428
+ lineHeight: 24
429
+ }}
430
+ >{time.text}</OText>
431
+ </TimeItem>
432
+ </TouchableOpacity>
433
+ ))}
434
+ {timeList.length % 3 === 2 && (
435
+ <TimeItem style={{ backgroundColor: 'transparent' }} />
436
+ )}
437
+ </TimeContentWrapper>
438
+ ) : (
439
+ <OText
440
+ size={16}
441
+ style={{
442
+ fontWeight: '600',
443
+ lineHeight: 24,
444
+ marginBottom: 12,
445
+ textAlign: 'center'
446
+ }}
447
+ >
448
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
449
+ </OText>
450
+ )}
451
+ </TimeListWrapper>
452
+ </OrderTimeWrapper>
453
+ )}
454
+ {!isPreOrderSetting && (
377
455
  <OText
378
456
  size={16}
379
457
  style={{
380
458
  fontWeight: '600',
381
- lineHeight: 24
459
+ lineHeight: 24,
460
+ marginTop: 30,
461
+ marginBottom: 12,
462
+ textAlign: 'center'
382
463
  }}
383
- >
384
- {t('ORDER_TIME', 'Order time')}
464
+ >
465
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
385
466
  </OText>
386
- <View style={{ flex: 1 }}>
387
- {selectDate && datesWhitelist[0]?.start !== null && (
388
- <CalendarStrip
389
- scrollable
390
- style={styles.calendar}
391
- calendarHeaderContainerStyle={styles.calendarHeaderContainer}
392
- calendarHeaderStyle={styles.calendarHeader}
393
- dateNumberStyle={styles.dateNumber}
394
- dateNameStyle={styles.dateName}
395
- iconContainer={{ flex: 0.1 }}
396
- highlightDateNameStyle={styles.highlightDateName}
397
- highlightDateNumberStyle={styles.highlightDateNumber}
398
- dayContainerStyle={{ height: '100%' }}
399
- highlightDateContainerStyle={{ height: '100%' }}
400
- calendarHeaderFormat='MMMM, YYYY'
401
- iconStyle={{ borderWidth: 1 }}
402
- selectedDate={selectDate}
403
- datesWhitelist={datesWhitelist}
404
- disabledDateNameStyle={styles.disabledDateName}
405
- disabledDateNumberStyle={styles.disabledDateNumber}
406
- disabledDateOpacity={0.6}
407
- onDateSelected={(date) => onSelectDate(date)}
408
- leftSelector={<LeftSelector />}
409
- rightSelector={<RightSelector />}
410
- />
411
- )}
412
- </View>
413
- <TimeListWrapper nestedScrollEnabled={true}>
414
- {(isEnabled && timeList?.length > 0) ? (
415
- <TimeContentWrapper>
416
- {timeList.map((time: any, i: number) => (
417
- <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
418
- <TimeItem active={timeSelected === time.value}>
419
- <OText
420
- size={14}
421
- color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
422
- style={{
423
- lineHeight: 24
424
- }}
425
- >{time.text}</OText>
426
- </TimeItem>
427
- </TouchableOpacity>
428
- ))}
429
- {timeList.length % 3 === 2 && (
430
- <TimeItem style={{ backgroundColor: 'transparent' }} />
431
- )}
432
- </TimeContentWrapper>
433
- ) : (
434
- <OText
435
- size={16}
436
- style={{
437
- fontWeight: '600',
438
- lineHeight: 24,
439
- marginBottom: 12,
440
- textAlign: 'center'
441
- }}
442
- >
443
- {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
444
- </OText>
445
- )}
446
- </TimeListWrapper>
447
- </OrderTimeWrapper>
467
+ )}
448
468
  <OButton
449
469
  text={t('GO_TO_MENU', 'Go to menu')}
450
470
  textStyle={{ color: 'white' }}