ordering-ui-react-native 0.21.21 → 0.21.22-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 (239) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +4 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +2 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/Home/index.tsx +5 -1
  21. package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
  22. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
  26. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  32. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  33. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  35. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  36. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  39. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  46. package/themes/business/src/components/Sessions/index.tsx +187 -0
  47. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  48. package/themes/business/src/components/StoresList/index.tsx +5 -3
  49. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  50. package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
  51. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  52. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  53. package/themes/business/src/components/shared/OInput.tsx +2 -0
  54. package/themes/business/src/hooks/useLocation.tsx +5 -4
  55. package/themes/business/src/types/index.tsx +15 -2
  56. package/themes/business/src/utils/index.tsx +5 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/original/index.tsx +9 -4
  67. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  68. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  69. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  70. package/themes/original/src/components/AddressList/index.tsx +4 -7
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  72. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +20 -12
  77. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  78. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  79. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  80. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  82. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  84. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  86. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  91. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +190 -66
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  107. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  108. package/themes/original/src/components/Favorite/index.tsx +4 -9
  109. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  114. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  120. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  121. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  122. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  123. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  124. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  125. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  126. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  127. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  128. package/themes/original/src/components/Home/index.tsx +2 -1
  129. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  130. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  132. package/themes/original/src/components/Messages/index.tsx +9 -4
  133. package/themes/original/src/components/Messages/styles.tsx +1 -1
  134. package/themes/original/src/components/MomentOption/index.tsx +4 -3
  135. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  136. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -668
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  161. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  162. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  163. package/themes/original/src/components/ProductForm/index.tsx +74 -165
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  165. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
  168. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  169. package/themes/original/src/components/Promotions/index.tsx +4 -4
  170. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  171. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  174. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  175. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  176. package/themes/original/src/components/SignupForm/index.tsx +60 -58
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  189. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  190. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +1 -0
  202. package/themes/original/src/utils/index.tsx +125 -1
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. package/src/pages/Splash.tsx +0 -21
@@ -0,0 +1,196 @@
1
+ import React, { useCallback } from 'react'
2
+ import { StyleSheet, View, TouchableOpacity } from 'react-native'
3
+ import { useTheme } from 'styled-components/native';
4
+ import { OIcon, OText } from '../shared';
5
+ import { NotFoundSource } from '../NotFoundSource';
6
+ import ToggleSwitch from 'toggle-switch-react-native';
7
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
8
+ import { SearchBar } from '../SearchBar';
9
+ import { IOScrollView } from 'react-native-intersection-observer';
10
+ import {
11
+ useLanguage,
12
+ useUtils,
13
+ ToastType,
14
+ useToast,
15
+ } from 'ordering-components/native'
16
+
17
+ const PIXELS_TO_SCROLL = 2000
18
+
19
+ export const ProductList = (props: any) => {
20
+ const { productsList, onClose, updateProduct, searchValue, handleChangeSearch, getCategoryProducts } = props
21
+
22
+ const { loading, products, error } = productsList
23
+
24
+ const theme = useTheme()
25
+ const [{ optimizeImage }] = useUtils();
26
+ const [, { showToast }] = useToast()
27
+ const [, t] = useLanguage()
28
+
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ marginBottom: 0
33
+ },
34
+ header: {
35
+ flexDirection: 'row',
36
+ justifyContent: 'space-between',
37
+ marginBottom: 10,
38
+ },
39
+ btnBackArrow: {
40
+ borderWidth: 0,
41
+ width: 32,
42
+ height: 32,
43
+ tintColor: theme.colors.textGray,
44
+ backgroundColor: theme.colors.clear,
45
+ borderColor: theme.colors.clear,
46
+ shadowColor: theme.colors.clear,
47
+ paddingLeft: 0,
48
+ paddingRight: 0
49
+ },
50
+ sectionTitle: {
51
+ fontStyle: 'normal',
52
+ fontWeight: '600',
53
+ fontSize: 20,
54
+ color: theme.colors.textGray,
55
+ },
56
+ logo: {
57
+ padding: 2,
58
+ borderRadius: 18,
59
+ shadowColor: '#000',
60
+ shadowOffset: {
61
+ width: 0,
62
+ height: 1.5,
63
+ },
64
+ shadowOpacity: 0.21,
65
+ shadowRadius: 3,
66
+ elevation: 7,
67
+ },
68
+ icon: {
69
+ borderRadius: 7.6,
70
+ width: 35,
71
+ height: 35,
72
+ marginRight: 5
73
+ },
74
+ borderStyle: {
75
+ borderColor: theme.colors.red,
76
+ borderWidth: 0,
77
+ borderRadius: 10,
78
+ },
79
+ });
80
+
81
+ const handleSwitch = (enabled: boolean, categoryId: any, productId: any) => {
82
+ updateProduct && updateProduct(categoryId, productId, { enabled })
83
+ };
84
+
85
+ const handleScroll = ({ nativeEvent }: any) => {
86
+ const y = nativeEvent.contentOffset.y;
87
+ const height = nativeEvent.contentSize.height;
88
+ const hasMore = !(
89
+ productsList.pagination.totalPages === productsList.pagination.currentPage
90
+ );
91
+
92
+ if (y + PIXELS_TO_SCROLL > height && !productsList.loading && hasMore && productsList?.products?.length > 0) {
93
+ getCategoryProducts(false)
94
+ showToast(ToastType.Info, t('LOADING_MORE_PRODUCTS', 'Loading more products'))
95
+ }
96
+ };
97
+
98
+ return (
99
+ <View style={{ flex: 1, paddingHorizontal: 20, paddingVertical: 20 }}>
100
+ <View style={styles.header}>
101
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
102
+ <TouchableOpacity
103
+ onPress={onClose}
104
+ style={styles.btnBackArrow}
105
+ >
106
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
107
+ </TouchableOpacity>
108
+ <OText style={styles.sectionTitle}>{t('PRODUCTS', 'Products')}</OText>
109
+ </View>
110
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
111
+ <SearchBar
112
+ borderStyle={styles.borderStyle}
113
+ onSearch={handleChangeSearch}
114
+ searchValue={searchValue}
115
+ lazyLoad
116
+ isCancelXButtonShow={!!searchValue}
117
+ onCancel={() => handleChangeSearch('')}
118
+ placeholder={t('SEARCH', 'Search')}
119
+ containerStyle={{ width: 180 }}
120
+ />
121
+ </View>
122
+ </View>
123
+ <IOScrollView
124
+ style={styles.container}
125
+ onScroll={handleScroll}
126
+ scrollEventThrottle={16}
127
+ bounces={false}
128
+ >
129
+ {!loading && products?.length === 0 && (
130
+ <NotFoundSource
131
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
132
+ image={theme.images.general.notFound}
133
+ conditioned={false}
134
+ />
135
+ )}
136
+ {!loading && products?.length > 0 && (
137
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
138
+ {products.map((product: any, i: number) => (
139
+ <View
140
+ key={i}
141
+ style={{
142
+ flexDirection: 'row',
143
+ justifyContent: 'space-between',
144
+ borderBottomColor: theme.colors.borderTops,
145
+ borderBottomWidth: 1,
146
+ paddingVertical: 15
147
+ }}
148
+ >
149
+ <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', marginRight: 36 }}>
150
+ <OIcon
151
+ url={optimizeImage(product?.images, 'h_300,c_limit')}
152
+ src={!product?.images && theme?.images?.dummies?.businessLogo}
153
+ style={styles.icon}
154
+ />
155
+ <OText numberOfLines={2} size={12} ellipsizeMode='tail'>{product?.name}</OText>
156
+ </View>
157
+ <ToggleSwitch
158
+ isOn={product?.enabled}
159
+ onColor={theme.colors.primary}
160
+ offColor={theme.colors.offColor}
161
+ size="small"
162
+ onToggle={(value: boolean) => handleSwitch(value, product?.category_id, product.id)}
163
+ disabled={loading}
164
+ animationSpeed={200}
165
+ />
166
+ </View>
167
+ ))}
168
+ </View>
169
+ )}
170
+ {loading && (
171
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
172
+ {[...Array(6)].map((item, i) => (
173
+ <Placeholder key={i} Animation={Fade}>
174
+ <View
175
+ style={{
176
+ flex: 1,
177
+ flexDirection: 'row',
178
+ justifyContent: 'space-between',
179
+ alignItems: 'center',
180
+ marginBottom: 10,
181
+ borderBottomColor: theme.colors.borderTops,
182
+ borderBottomWidth: 1,
183
+ paddingVertical: 10
184
+ }}
185
+ >
186
+ <PlaceholderLine width={50} />
187
+ <PlaceholderLine width={20} />
188
+ </View>
189
+ </Placeholder>
190
+ ))}
191
+ </View>
192
+ )}
193
+ </IOScrollView>
194
+ </View>
195
+ )
196
+ }
@@ -0,0 +1,196 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, StyleSheet, ScrollView, Dimensions, TouchableOpacity } from 'react-native';
3
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
4
+ import { useTheme } from 'styled-components/native';
5
+ import { SearchBar } from '../SearchBar';
6
+ import {
7
+ ToastType,
8
+ useToast,
9
+ useLanguage,
10
+ StoreProductList
11
+ } from 'ordering-components/native';
12
+ import { NotFoundSource } from '../NotFoundSource';
13
+ import { OText, OIcon } from '../shared';
14
+ import { IterateCategories } from './IterateCategories';
15
+ import { ProductList } from './ProductList'
16
+
17
+ const BusinessProductListUI = (props: any) => {
18
+ const {
19
+ navigation,
20
+ businessState,
21
+ productsList,
22
+ updateStoreCategory,
23
+ updateStoreProduct,
24
+ productSearch,
25
+ categorySearch,
26
+ handleChangeCategory,
27
+ handleChangeProductSearch,
28
+ handleChangeCategorySearch,
29
+ getCategoryProducts,
30
+ categories
31
+ } = props;
32
+
33
+ const { loading, error, business } = businessState;
34
+
35
+ const [, t] = useLanguage();
36
+ const [, { showToast }] = useToast();
37
+ const theme = useTheme();
38
+
39
+ const [showModal, setShowModal] = useState(false)
40
+
41
+ const handleOpenProducts = (category: any) => {
42
+ handleChangeCategory(category)
43
+ setShowModal(true)
44
+ }
45
+
46
+ useEffect(() => {
47
+ if (error) {
48
+ showToast(
49
+ ToastType.Error,
50
+ error || error[0] || t('NETWORK_ERROR', 'Network Error'),
51
+ );
52
+ }
53
+ }, [loading]);
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ paddingBottom: 20,
58
+ marginBottom: 0,
59
+ flex: 1,
60
+ },
61
+ header: {
62
+ flexDirection: 'row',
63
+ justifyContent: 'space-between',
64
+ marginBottom: 10,
65
+ },
66
+ sectionTitle: {
67
+ fontStyle: 'normal',
68
+ fontWeight: '600',
69
+ fontSize: 20,
70
+ color: theme.colors.textGray,
71
+ },
72
+ borderStyle: {
73
+ borderColor: theme.colors.red,
74
+ borderWidth: 0,
75
+ borderRadius: 10,
76
+ },
77
+ btnBackArrow: {
78
+ borderWidth: 0,
79
+ width: 32,
80
+ height: 32,
81
+ tintColor: theme.colors.textGray,
82
+ backgroundColor: theme.colors.clear,
83
+ borderColor: theme.colors.clear,
84
+ shadowColor: theme.colors.clear,
85
+ paddingLeft: 0,
86
+ paddingRight: 0
87
+ },
88
+ });
89
+
90
+ return (
91
+ <>
92
+ <View style={styles.header}>
93
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
94
+ <TouchableOpacity
95
+ onPress={() => navigation?.canGoBack() && navigation.goBack()}
96
+ style={styles.btnBackArrow}
97
+ >
98
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
99
+ </TouchableOpacity>
100
+ <OText style={styles.sectionTitle}>{t('CATEGORIES', 'Categories')}</OText>
101
+ </View>
102
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
103
+ <SearchBar
104
+ borderStyle={styles.borderStyle}
105
+ onSearch={handleChangeCategorySearch}
106
+ searchValue={categorySearch}
107
+ lazyLoad
108
+ isCancelXButtonShow={!!categorySearch}
109
+ onCancel={() => handleChangeCategorySearch('')}
110
+ placeholder={t('SEARCH', 'Search')}
111
+ containerStyle={{ width: 180 }}
112
+ />
113
+ </View>
114
+ </View>
115
+ <ScrollView
116
+ showsVerticalScrollIndicator={false}
117
+ style={styles.container}>
118
+ {!loading && business?.categories?.length === 0 && (
119
+ <NotFoundSource
120
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
121
+ image={theme.images.general.notFound}
122
+ conditioned={false}
123
+ />
124
+ )}
125
+ {!error && !loading && categories?.length > 0 && (
126
+ <View
127
+ style={{
128
+ borderTopColor: theme.colors.borderTops,
129
+ borderTopWidth: 1
130
+ }}
131
+ >
132
+ <IterateCategories
133
+ list={categories}
134
+ handlerClickCategory={handleOpenProducts}
135
+ updateCategory={updateStoreCategory}
136
+ />
137
+ </View>
138
+ )}
139
+ {loading && (
140
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
141
+ {[...Array(6)].map((item, i) => (
142
+ <Placeholder key={i} Animation={Fade}>
143
+ <View
144
+ style={{
145
+ flex: 1,
146
+ flexDirection: 'row',
147
+ justifyContent: 'space-between',
148
+ alignItems: 'center',
149
+ marginBottom: 10,
150
+ borderBottomColor: theme.colors.borderTops,
151
+ borderBottomWidth: 1,
152
+ paddingVertical: 10
153
+ }}
154
+ >
155
+ <PlaceholderLine width={50} />
156
+ <PlaceholderLine width={20} />
157
+ </View>
158
+ </Placeholder>
159
+ ))}
160
+ </View>
161
+ )}
162
+ </ScrollView>
163
+ {showModal && (
164
+ <View
165
+ style={{
166
+ flex: 1,
167
+ position: 'absolute',
168
+ top: 0,
169
+ width: Dimensions.get('window').width,
170
+ height: Dimensions.get('window').height,
171
+ backgroundColor: theme.colors.backgroundLight,
172
+ left: 0
173
+ }}
174
+ >
175
+ <ProductList
176
+ productsList={productsList}
177
+ updateProduct={updateStoreProduct}
178
+ searchValue={productSearch}
179
+ handleChangeSearch={handleChangeProductSearch}
180
+ getCategoryProducts={getCategoryProducts}
181
+ onClose={() => setShowModal(false)}
182
+ />
183
+ </View>
184
+ )}
185
+ </>
186
+ );
187
+ };
188
+
189
+ export const BusinessProductList = (props: any) => {
190
+ const businessProductListProps = {
191
+ ...props,
192
+ UIComponent: BusinessProductListUI,
193
+ };
194
+
195
+ return <StoreProductList {...businessProductListProps} />;
196
+ };
@@ -0,0 +1,10 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const CategoryTab = styled.View`
4
+ flex-direction: row;
5
+ justify-content: space-between;
6
+ padding-vertical: 10px;
7
+ border-bottom-color: ${(props: any) => props.theme.colors.borderTops};
8
+ border-bottom-width: 1px;
9
+ margin-left: ${(props: any) => props.isSpace ? '10px' : '0px'};
10
+ `
@@ -386,21 +386,30 @@ const ChatUI = (props: MessagesParams) => {
386
386
  style={{ ...styles.firstMessageText, textAlign: 'center' }}
387
387
  >
388
388
  {
389
- message.change?.attribute !== 'driver_id'
390
- ?
391
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
392
- ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
393
- : `${message.change?.attribute !== 'logistic_status'
394
- ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
395
- : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
396
- ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
397
- : getLogisticTag(message.change.new)}`
398
- }`
399
- : message.change.new
389
+ message.change?.attribute === 'driver_group_id'
390
+ ? message.change.old
391
+ ? t('ORDER_ATTRIBUTE_CHANGED_FROM_TO')
392
+ .replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
393
+ .replace('_from_', message.change.old)
394
+ .replace('_to_', message.change.new)
395
+ : t('ORDER_ATTRIBUTE_CHANGED_TO')
396
+ .replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
397
+ .replace('_to_', message.change.new)
398
+ : message.change?.attribute !== 'driver_id'
400
399
  ?
401
- `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
402
- :
403
- `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
400
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
401
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
402
+ : `${message.change?.attribute !== 'logistic_status'
403
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
404
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
405
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
406
+ : getLogisticTag(message.change.new)}`
407
+ }`
408
+ : message.change.new
409
+ ?
410
+ `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
411
+ :
412
+ `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
404
413
  }
405
414
  </OText>
406
415
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
@@ -30,7 +30,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
30
30
  isBusinessMarker,
31
31
  isToFollow,
32
32
  handleViewActionOrder,
33
- updateDriverPosition,
34
33
  driverUpdateLocation,
35
34
  setDriverUpdateLocation,
36
35
  } = props;
@@ -59,6 +58,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
59
58
  key?: string | null;
60
59
  }>({ open: false, content: [], key: null });
61
60
  const distanceUnit = configState?.configs?.distance_unit?.value
61
+ const isHideRejectButtons = configState?.configs?.reject_orders_enabled && configState?.configs?.reject_orders_enabled?.value !== '1'
62
62
 
63
63
  const {
64
64
  hasLocation,
@@ -381,7 +381,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
381
381
  <View style={styles.view}>
382
382
  <OIcon
383
383
  style={styles.image}
384
- url={location.icon}
384
+ src={typeof location.icon === 'number' ? location.icon : { uri: location.icon }}
385
385
  width={25}
386
386
  height={25}
387
387
  />
@@ -539,8 +539,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
539
539
  secondButton={true}
540
540
  firstColorCustom={theme.colors.red}
541
541
  secondColorCustom={theme.colors.green}
542
- widthButton={'45%'}
542
+ widthButton={isHideRejectButtons ? '100%': '45%'}
543
543
  isPadding
544
+ isHideRejectButtons={isHideRejectButtons}
544
545
  />
545
546
  )}
546
547
 
@@ -25,6 +25,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
25
25
  secondButton,
26
26
  widthButton,
27
27
  isPadding,
28
+ isHideRejectButtons
28
29
  } = props;
29
30
 
30
31
  const theme = useTheme();
@@ -61,39 +62,41 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
61
62
  width: '100%',
62
63
  justifyContent: 'space-between',
63
64
  }}>
64
- <Button
65
- secondButton={secondButton}
66
- style={[
67
- {
68
- borderWidth: colorTxt1 ? 1 : 0,
69
- borderColor: colorTxt1 ? colorTxt1 : null,
70
- },
71
- secondButton
72
- ? { backgroundColor: firstColorCustom || styles.primaryBtn }
73
- : color
74
- ? { backgroundColor: color }
75
- : styles.primaryBtn,
76
- ,
77
- { width: widthButton },
78
- ]}
79
- onPress={firstButtonClick}
80
- disabled={disabled}>
81
- <OText color={theme.colors.white} size={16} mLeft={20}>
82
- {btnLeftValueShow ? btnLeftValue : ''}
83
- </OText>
65
+ {!isHideRejectButtons && (
66
+ <Button
67
+ secondButton={secondButton}
68
+ style={[
69
+ {
70
+ borderWidth: colorTxt1 ? 1 : 0,
71
+ borderColor: colorTxt1 ? colorTxt1 : null,
72
+ },
73
+ secondButton
74
+ ? { backgroundColor: firstColorCustom || styles.primaryBtn }
75
+ : color
76
+ ? { backgroundColor: color }
77
+ : styles.primaryBtn,
78
+ ,
79
+ { width: widthButton },
80
+ ]}
81
+ onPress={firstButtonClick}
82
+ disabled={disabled}>
83
+ <OText color={theme.colors.white} size={16} mLeft={20}>
84
+ {btnLeftValueShow ? btnLeftValue : ''}
85
+ </OText>
84
86
 
85
- <OText
86
- style={styles.btnTextStyle}
87
- color={colorTxt1 ? colorTxt1 : theme.colors.white}
88
- numberOfLines={2}
89
- adjustsFontSizeToFit>
90
- {btnText}
91
- </OText>
87
+ <OText
88
+ style={styles.btnTextStyle}
89
+ color={colorTxt1 ? colorTxt1 : theme.colors.white}
90
+ numberOfLines={2}
91
+ adjustsFontSizeToFit>
92
+ {btnText}
93
+ </OText>
92
94
 
93
- <OText color={theme.colors.white} size={16} mRight={20}>
94
- {btnRightValueShow ? btnRightValue : ''}
95
- </OText>
96
- </Button>
95
+ <OText color={theme.colors.white} size={16} mRight={20}>
96
+ {btnRightValueShow ? btnRightValue : ''}
97
+ </OText>
98
+ </Button>
99
+ )}
97
100
 
98
101
  {secondButton && (
99
102
  <Button
@@ -138,7 +138,10 @@ export const Home = (props: any) => {
138
138
  placeholder={t('PROJECT_NAME', 'Project Name')}
139
139
  icon={theme.images.general.project}
140
140
  iconColor={theme.colors.arrowColor}
141
- onChange={(e: any) => onChange(e?.target?.value)}
141
+ onChange={(e: any) => {
142
+ const project = e?.target?.value?.replace(/\s/g, '')
143
+ onChange(project)
144
+ }}
142
145
  selectionColor={theme.colors.primary}
143
146
  color={theme.colors.white}
144
147
  value={value}
@@ -148,6 +151,7 @@ export const Home = (props: any) => {
148
151
  autoCapitalize='none'
149
152
  blurOnSubmit={false}
150
153
  onSubmitEditing={() => handleSubmit(onSubmit)()}
154
+ isValueSync
151
155
  />
152
156
  )}
153
157
  />
@@ -25,8 +25,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
25
25
  value: language?.code,
26
26
  label: language?.name,
27
27
  inputLabel: language?.code.toUpperCase(),
28
- countryCode: langCountries.find(item => item.value == language?.code)
29
- ?.countryCode,
28
+ countryCode: langCountries.find(item => item.value == language?.code)?.countryCode,
30
29
  };
31
30
  });
32
31
 
@@ -50,6 +49,9 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
50
49
  },
51
50
  });
52
51
 
52
+ console.log('_languages', _languages);
53
+
54
+
53
55
  return (
54
56
  <Container style={{ backgroundColor: theme.colors.inputChat }}>
55
57
  {languagesState?.languages && (