ordering-ui-react-native 0.18.3 → 0.18.4-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 (261) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +1 -1
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +64 -36
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
  36. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  37. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  38. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  39. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  40. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  41. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  42. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  44. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  45. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  46. package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
  47. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
  49. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  50. package/themes/business/src/components/StoresList/index.tsx +6 -5
  51. package/themes/business/src/components/UserProfileForm/index.tsx +15 -17
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/types/index.tsx +8 -0
  55. package/themes/business/src/utils/index.tsx +4 -4
  56. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  58. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  60. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  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/PhoneInputNumber/index.tsx +2 -2
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +7 -3
  68. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  69. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +5 -8
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  77. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  78. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  79. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  80. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  81. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  82. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  83. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  84. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  85. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  90. package/themes/original/src/components/BusinessPreorder/index.tsx +11 -9
  91. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  94. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  97. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  105. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  106. package/themes/original/src/components/Cart/index.tsx +49 -47
  107. package/themes/original/src/components/CartContent/index.tsx +99 -38
  108. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  109. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  110. package/themes/original/src/components/Checkout/index.tsx +324 -43
  111. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  112. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  113. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  114. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  115. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  116. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  117. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  118. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  119. package/themes/original/src/components/Favorite/index.tsx +4 -9
  120. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  121. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  122. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  129. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  130. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  131. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  132. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  133. package/themes/original/src/components/Home/index.tsx +14 -5
  134. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  135. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  136. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  137. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  138. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  139. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  140. package/themes/original/src/components/Messages/index.tsx +15 -4
  141. package/themes/original/src/components/Messages/styles.tsx +1 -1
  142. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  143. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  144. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  145. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  146. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  147. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  148. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  149. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  150. package/themes/original/src/components/NavBar/index.tsx +20 -13
  151. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  152. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  153. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  154. package/themes/original/src/components/Notifications/index.tsx +4 -8
  155. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  156. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  157. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  158. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  159. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  160. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  161. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  162. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  163. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  164. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  165. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  167. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  169. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  170. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  171. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  172. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  173. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  174. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  175. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  176. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  177. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  178. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  179. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  180. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  181. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  182. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  183. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  184. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  185. package/themes/original/src/components/Promotions/index.tsx +6 -6
  186. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  187. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  188. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  189. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  190. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  191. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  192. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  193. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  194. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  197. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  199. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  200. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  203. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  204. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  205. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  206. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  207. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  208. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  209. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  210. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  211. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  212. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  213. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  214. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  215. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  216. package/themes/original/src/components/Wallets/index.tsx +48 -60
  217. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  218. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  219. package/themes/original/src/components/shared/OButton.tsx +3 -3
  220. package/themes/original/src/components/shared/OInput.tsx +4 -5
  221. package/themes/original/src/components/shared/OModal.tsx +15 -17
  222. package/themes/original/src/layouts/Container.tsx +5 -3
  223. package/themes/original/src/types/index.tsx +26 -7
  224. package/themes/original/src/utils/index.tsx +180 -13
  225. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  226. package/src/navigators/BottomNavigator.tsx +0 -117
  227. package/src/navigators/CheckoutNavigator.tsx +0 -66
  228. package/src/navigators/HomeNavigator.tsx +0 -202
  229. package/src/navigators/NavigationRef.tsx +0 -7
  230. package/src/navigators/RootNavigator.tsx +0 -269
  231. package/src/pages/Account.tsx +0 -34
  232. package/src/pages/AddressForm.tsx +0 -62
  233. package/src/pages/AddressList.tsx +0 -24
  234. package/src/pages/BusinessProductsList.tsx +0 -81
  235. package/src/pages/BusinessesListing.tsx +0 -43
  236. package/src/pages/CartList.tsx +0 -49
  237. package/src/pages/Checkout.tsx +0 -101
  238. package/src/pages/ForgotPassword.tsx +0 -24
  239. package/src/pages/Help.tsx +0 -23
  240. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  241. package/src/pages/HelpGuide.tsx +0 -23
  242. package/src/pages/HelpOrder.tsx +0 -23
  243. package/src/pages/Home.tsx +0 -36
  244. package/src/pages/IntroductoryTutorial.tsx +0 -170
  245. package/src/pages/Login.tsx +0 -47
  246. package/src/pages/MomentOption.tsx +0 -30
  247. package/src/pages/MultiCheckout.tsx +0 -31
  248. package/src/pages/MultiOrdersDetails.tsx +0 -27
  249. package/src/pages/MyOrders.tsx +0 -40
  250. package/src/pages/NetworkError.tsx +0 -24
  251. package/src/pages/NotFound.tsx +0 -22
  252. package/src/pages/OrderDetails.tsx +0 -25
  253. package/src/pages/ProductDetails.tsx +0 -55
  254. package/src/pages/Profile.tsx +0 -36
  255. package/src/pages/ReviewDriver.tsx +0 -30
  256. package/src/pages/ReviewOrder.tsx +0 -32
  257. package/src/pages/ReviewProducts.tsx +0 -30
  258. package/src/pages/Sessions.tsx +0 -22
  259. package/src/pages/Signup.tsx +0 -53
  260. package/src/pages/SpinnerLoader.tsx +0 -10
  261. package/src/pages/Splash.tsx +0 -21
@@ -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
+ `
@@ -69,6 +69,8 @@ const ChatUI = (props: MessagesParams) => {
69
69
  const [, { showToast }] = useToast();
70
70
  const theme = useTheme();
71
71
  const [messageList, setMessageList] = useState<any>([])
72
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
73
+ const chatDisabled = previousStatus.includes(order?.status)
72
74
 
73
75
  const ORDER_STATUS: any = {
74
76
  0: t('ORDER_STATUS_PENDING', 'Order status pending'),
@@ -97,6 +99,17 @@ const ChatUI = (props: MessagesParams) => {
97
99
  23: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
98
100
  }
99
101
 
102
+ const getLogisticTag = (status: any) => {
103
+ const keyList: any = {
104
+ 0: t('PENDING', 'Pending'),
105
+ 1: t('IN_PROGRESS', 'In progress'),
106
+ 2: t('IN_QUEUE', 'In queue'),
107
+ 3: t('EXPIRED', 'Expired'),
108
+ 4: t('RESOLVED', 'Resolved'),
109
+ }
110
+ return keyList[status] ? keyList[status] : t('UNKNOWN', 'Unknown')
111
+ }
112
+
100
113
  const storeMessageList: any = [
101
114
  { key: 'store_message_1', text: t('STORE_MESSAGE_1', 'store_message_1') },
102
115
  { key: 'store_message_2', text: t('STORE_MESSAGE_2', 'store_message_2') },
@@ -176,12 +189,8 @@ const ChatUI = (props: MessagesParams) => {
176
189
  fontSize: 12,
177
190
  },
178
191
  toolbarStyle: {
179
- flexDirection: 'column-reverse',
180
- paddingVertical: 15,
181
- paddingHorizontal: 30,
182
- backgroundColor: theme.colors.white,
183
- borderTopWidth: 1,
184
- borderTopColor: theme.colors.tabBar,
192
+ padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
193
+ flexDirection: 'column-reverse'
185
194
  },
186
195
  accessoryIcon: {
187
196
  height: 32,
@@ -314,14 +323,16 @@ const ChatUI = (props: MessagesParams) => {
314
323
  quality: 1
315
324
  },
316
325
  (response: any) => {
317
- if (response.didCancel) {
326
+ const image = response.assets?.[0];
327
+ if (!image) return
328
+ if (image.didCancel) {
318
329
  console.log('User cancelled image picker');
319
- } else if (response.errorMessage) {
320
- console.log('ImagePicker Error: ', response.errorMessage);
321
- showToast(ToastType.Error, response.errorMessage);
330
+ } else if (image.errorMessage) {
331
+ console.log('ImagePicker Error: ', image.errorMessage);
332
+ showToast(ToastType.Error, image.errorMessage);
322
333
  } else {
323
- if (response.uri) {
324
- const url = `data:${response.type};base64,${response.base64}`;
334
+ if (image.uri) {
335
+ const url = `data:${image.type};base64,${image.base64}`;
325
336
  setImage && setImage(url);
326
337
  } else {
327
338
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -372,18 +383,34 @@ const ChatUI = (props: MessagesParams) => {
372
383
  }}>
373
384
  <OText
374
385
  numberOfLines={3}
375
- style={{ ...styles.firstMessageText, textAlign: 'center' }}>
376
- {message.change?.attribute !== 'driver_id'
377
- ?
378
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
379
- `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
380
- `${message.change.old !== null && ORDER_STATUS[parseInt(message.change.old, 10)]} ${t('TO', 'to')} ${ORDER_STATUS[parseInt(message.change.new, 10)]}`
381
- }`
382
- : message.change.new
386
+ style={{ ...styles.firstMessageText, textAlign: 'center' }}
387
+ >
388
+ {
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'
383
399
  ?
384
- `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
385
- :
386
- `${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')}`
413
+ }
387
414
  </OText>
388
415
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
389
416
  {parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
@@ -586,16 +613,12 @@ const ChatUI = (props: MessagesParams) => {
586
613
  };
587
614
 
588
615
  const renderAccessory = () => (
616
+ !chatDisabled &&
589
617
  <View>
590
618
  <Header
591
619
  showsVerticalScrollIndicator={false}
592
620
  showsHorizontalScrollIndicator={false}
593
621
  horizontal
594
- // contentContainerStyle={{
595
- // justifyContent:
596
- // orientation === 'Landscape' ? 'center' : 'space-between',
597
- // width: '100%',
598
- // }}
599
622
  nestedScrollEnabled={true}
600
623
  >
601
624
  {user?.level !== 2 && (
@@ -766,113 +789,130 @@ const ChatUI = (props: MessagesParams) => {
766
789
  containerStyle={styles.toolbarStyle}
767
790
  primaryStyle={{ alignItems: 'center', justifyContent: 'space-between' }}
768
791
  accessoryStyle={{ position: 'relative', marginBottom: 45 }}
769
- renderAccessory={order ? () => renderAccessory && renderAccessory() : undefined}
792
+ renderAccessory={() => renderAccessory()}
770
793
  />
771
794
  );
772
795
 
773
796
  const renderComposer = (props: any) => (
774
- <View
775
- style={{
776
- flexDirection: 'row',
777
- height: 44,
778
- width: '85%',
779
- backgroundColor: theme.colors.composerView,
780
- borderRadius: 7.6,
781
- alignItems: 'center',
782
- justifyContent: 'center',
783
- paddingRight: 10,
784
- }}>
785
- <Composer
786
- {...props}
787
- textInputStyle={{
788
- borderRadius: 7.6,
789
- borderColor: theme.colors.transparent,
790
- borderWidth: 0,
791
- color: '#010300',
792
- }}
793
- textInputProps={{
794
- value: message,
795
- onSubmitEditing: onSubmit,
796
- returnKeyType: message ? 'send' : 'done',
797
- blurOnSubmit: true,
798
- multiline: false,
799
- numberOfLines: 1,
800
- autoCorrect: false,
801
- autoCompleteType: 'off',
802
- enablesReturnKeyAutomatically: false,
803
- selectionColor: theme.colors.primary,
797
+ chatDisabled ? (
798
+ <View
799
+ style={{
800
+ width: '100%',
801
+ flexDirection: 'column',
802
+ alignItems: 'center'
804
803
  }}
805
- placeholder={t('WRITE_MESSAGE', 'Write message')}
806
- placeholderTextColor={theme.colors.composerPlaceHolder}
807
- />
808
-
809
- <TouchableOpacity
810
- onPress={() => {
811
- setImage && setImage(null);
812
- setIsShowSignaturePad(!isShowSignaturePad);
813
- }}>
804
+ >
814
805
  <MaterialCommunityIcon
815
- name="pen"
816
- color={
817
- isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
818
- }
806
+ name='close-octagon-outline'
819
807
  size={24}
820
808
  />
821
- </TouchableOpacity>
822
-
823
- {!file.type && (
824
- <Actions
809
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
810
+ </View>
811
+ ) : (
812
+ <View
813
+ style={{
814
+ flexDirection: 'row',
815
+ height: 44,
816
+ width: '85%',
817
+ backgroundColor: theme.colors.composerView,
818
+ borderRadius: 7.6,
819
+ alignItems: 'center',
820
+ justifyContent: 'center',
821
+ paddingRight: 10,
822
+ }}>
823
+ <Composer
825
824
  {...props}
826
- containerStyle={styles.containerActions}
827
- optionTintColor="#222845"
828
- icon={() => (
829
- <>
830
- {!file?.type && (
831
- <>
832
- <OIconButton
833
- borderColor={theme.colors.transparent}
834
- icon={
835
- !isShowSignaturePad && image
836
- ? { uri: image }
837
- : theme.images.general.imageChat
838
- }
839
- iconStyle={{
840
- borderRadius: image ? 10 : 0,
841
- width: image ? 32 : 28,
842
- height: image ? 32 : 28,
843
- }}
844
- onClick={handleImagePicker}
845
- iconCover
846
- />
847
-
848
- {image && !isShowSignaturePad && (
849
- <TouchableOpacity
850
- style={{
851
- position: 'absolute',
852
- top: -5,
853
- right: -5,
854
- borderColor: theme.colors.backgroundDark,
855
- backgroundColor: theme.colors.white,
856
- borderRadius: 25,
857
- }}
858
- onPress={() => removeImage()}>
859
- <MaterialCommunityIcon
860
- name="close-circle-outline"
861
- color={theme.colors.backgroundDark}
862
- size={24}
863
- />
864
- </TouchableOpacity>
865
- )}
866
- </>
867
- )}
868
- </>
869
- )}
825
+ textInputStyle={{
826
+ borderRadius: 7.6,
827
+ borderColor: theme.colors.transparent,
828
+ borderWidth: 0,
829
+ color: '#010300',
830
+ }}
831
+ textInputProps={{
832
+ value: message,
833
+ onSubmitEditing: onSubmit,
834
+ returnKeyType: message ? 'send' : 'done',
835
+ blurOnSubmit: true,
836
+ multiline: false,
837
+ numberOfLines: 1,
838
+ autoCorrect: false,
839
+ autoCompleteType: 'off',
840
+ enablesReturnKeyAutomatically: false,
841
+ selectionColor: theme.colors.primary,
842
+ }}
843
+ placeholder={t('WRITE_MESSAGE', 'Write message')}
844
+ placeholderTextColor={theme.colors.composerPlaceHolder}
870
845
  />
871
- )}
872
- </View>
846
+
847
+ <TouchableOpacity
848
+ onPress={() => {
849
+ setImage && setImage(null);
850
+ setIsShowSignaturePad(!isShowSignaturePad);
851
+ }}>
852
+ <MaterialCommunityIcon
853
+ name="pen"
854
+ color={
855
+ isShowSignaturePad ? theme.colors.primary : theme.colors.arrowColor
856
+ }
857
+ size={24}
858
+ />
859
+ </TouchableOpacity>
860
+
861
+ {!file.type && (
862
+ <Actions
863
+ {...props}
864
+ containerStyle={styles.containerActions}
865
+ optionTintColor="#222845"
866
+ icon={() => (
867
+ <>
868
+ {!file?.type && (
869
+ <>
870
+ <OIconButton
871
+ borderColor={theme.colors.transparent}
872
+ icon={
873
+ !isShowSignaturePad && image
874
+ ? { uri: image }
875
+ : theme.images.general.imageChat
876
+ }
877
+ iconStyle={{
878
+ borderRadius: image ? 10 : 0,
879
+ width: image ? 32 : 28,
880
+ height: image ? 32 : 28,
881
+ }}
882
+ onClick={handleImagePicker}
883
+ iconCover
884
+ />
885
+
886
+ {!!image && !isShowSignaturePad && (
887
+ <TouchableOpacity
888
+ style={{
889
+ position: 'absolute',
890
+ top: -5,
891
+ right: -5,
892
+ borderColor: theme.colors.backgroundDark,
893
+ backgroundColor: theme.colors.white,
894
+ borderRadius: 25,
895
+ }}
896
+ onPress={() => removeImage()}>
897
+ <MaterialCommunityIcon
898
+ name="close-circle-outline"
899
+ color={theme.colors.backgroundDark}
900
+ size={24}
901
+ />
902
+ </TouchableOpacity>
903
+ )}
904
+ </>
905
+ )}
906
+ </>
907
+ )}
908
+ />
909
+ )}
910
+ </View>
911
+ )
873
912
  );
874
913
 
875
914
  const renderSend = (props: any) => (
915
+ !chatDisabled &&
876
916
  <Send
877
917
  {...props}
878
918
  disabled={
@@ -1050,7 +1090,7 @@ const ChatUI = (props: MessagesParams) => {
1050
1090
  .m-signature-pad {
1051
1091
  box-shadow: none;
1052
1092
  border: none;
1053
- }
1093
+ }
1054
1094
  .m-signature-pad--body {
1055
1095
  border: none;
1056
1096
  }
@@ -453,7 +453,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
453
453
  {order?.delivery_datetime_utc
454
454
  ? parseDate(order?.delivery_datetime_utc)
455
455
  : parseDate(order?.delivery_datetime, { utc: false })}
456
- {` - ${order?.paymethod?.name}`}
456
+ {` - ${t(order?.paymethod?.name?.replace(/\s+/g, '_')?.toUpperCase(), order?.paymethod?.name)}`}
457
457
  </OText>
458
458
  <OText weight="bold">
459
459
  {t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}
@@ -1,7 +1,7 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { RefreshControl, ScrollView, View } from 'react-native'
3
3
  import { OText } from '../shared'
4
- import { useLanguage, useSession } from 'ordering-components/native'
4
+ import { useLanguage, useSession, useUtils } from 'ordering-components/native'
5
5
  import { DayContainer } from './styles'
6
6
  import { useTheme } from 'styled-components/native'
7
7
  export const DriverSchedule = (props: any) => {
@@ -9,7 +9,9 @@ export const DriverSchedule = (props: any) => {
9
9
  const [, t] = useLanguage()
10
10
  const theme = useTheme()
11
11
  const [, { refreshUserInfo }] = useSession()
12
+ const [{ parseDate }] = useUtils()
12
13
  const [refreshing] = useState(false);
14
+ const [driverSchedule, setDriverSchedule] = useState([]);
13
15
 
14
16
  const daysOfWeek = [
15
17
  t('SUNDAY_ABBREVIATION', 'Sun'),
@@ -21,11 +23,43 @@ export const DriverSchedule = (props: any) => {
21
23
  t('SATURDAY_ABBREVIATION', 'Sat')
22
24
  ]
23
25
 
26
+ const getNextDate = (day) => {
27
+ const now = new Date()
28
+ now.setDate(now.getDate() + (day + (7 - now.getDay())) % 7)
29
+ return now
30
+ }
31
+
24
32
  const scheduleFormatted = ({ hour, minute }: any) => {
25
33
  const checkTime = (val: number) => val < 10 ? `0${val}` : val
26
34
  return `${checkTime(hour)}:${checkTime(minute)}`
27
35
  }
28
36
 
37
+ useEffect(() => {
38
+ if (schedule) {
39
+ setDriverSchedule(schedule)
40
+ } else {
41
+ const _schedule: any = []
42
+ for (let i = 0; i < 7; i++) {
43
+ _schedule.push({
44
+ enabled: true,
45
+ lapses: [
46
+ {
47
+ open: {
48
+ hour: 0,
49
+ minute: 0
50
+ },
51
+ close: {
52
+ hour: 23,
53
+ minute: 59
54
+ }
55
+ }
56
+ ]
57
+ })
58
+ }
59
+ setDriverSchedule(_schedule)
60
+ }
61
+ }, [schedule])
62
+
29
63
  return (
30
64
  <ScrollView
31
65
  refreshControl={<RefreshControl
@@ -37,22 +71,25 @@ export const DriverSchedule = (props: any) => {
37
71
  {t('SCHEDULE', 'Schedule')}
38
72
  </OText>
39
73
  <View style={{ padding: 30 }}>
40
- {schedule.map((item: any, i: number) => (
74
+ {driverSchedule.map((item: any, i: number) => (
41
75
  <DayContainer key={daysOfWeek[i]}>
42
- <OText style={{ width: '20%' }} size={22} weight={700}>{daysOfWeek[i]}</OText>
43
- <View style={{ width: '80%', alignItems: 'center' }}>
76
+ <View style={{ flex: 1 }}>
77
+ <OText size={22} weight={700}>{daysOfWeek[i]}</OText>
78
+ <OText size={14}>{parseDate(getNextDate(i), { outputFormat: 'YYYY-MM-DD' })}</OText>
79
+ </View>
80
+ <View style={{ flex: 1 }}>
44
81
  <>
45
82
  {item?.enabled ? (
46
- <View>
83
+ <View style={{ width: '100%' }}>
47
84
  {item?.lapses.map((lapse: any, i: number) => (
48
85
  <View key={`${daysOfWeek[i]}_${i}`} style={{ marginTop: 3, marginBottom: 20, flexDirection: 'row', justifyContent: 'space-between' }}>
49
- <OText size={18} style={{ width: '30%' }}>
86
+ <OText size={18} style={{ flex: 1 }}>
50
87
  {scheduleFormatted(lapse.open)}
51
88
  </OText>
52
89
  <OText size={18} style={{ width: 15 }}>
53
90
  -
54
91
  </OText>
55
- <OText size={18} style={{ width: '30%' }}>
92
+ <OText size={18} style={{ flex: 1, textAlign: 'right' }}>
56
93
  {scheduleFormatted(lapse.close)}
57
94
  </OText>
58
95
  </View>