ordering-ui-react-native 0.18.55-test1 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -5
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  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 +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -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/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -0,0 +1,108 @@
1
+ import React from "react"
2
+ import { View, TouchableOpacity } from "react-native"
3
+ import { OText } from "../shared"
4
+ import ToggleSwitch from 'toggle-switch-react-native';
5
+ import { AccordionDropdown } from './AccordionDropdown'
6
+ import { useTheme } from 'styled-components/native';
7
+ import { CategoryTab } from './styles'
8
+
9
+ export const IterateCategories = (props: any) => {
10
+ const { list, currentCat, isSub, handlerClickCategory, updateCategory } = props
11
+
12
+ const theme = useTheme();
13
+
14
+ const handleSwitch = (enabled: boolean, categoryId: any) => {
15
+ updateCategory && updateCategory(categoryId, { enabled })
16
+ };
17
+
18
+ return (
19
+ <>
20
+ {list?.length > 0 && list.map((category: any, i: number) => (
21
+ <View key={`${category?.id}_${i}`}>
22
+ {(category?.subcategories?.length > 0 || isSub) ? (
23
+ <>
24
+ {category?.subcategories?.length > 0 && (
25
+ <>
26
+ <View>
27
+ <AccordionDropdown
28
+ category={category}
29
+ IterateCategories={IterateCategories}
30
+ handlerClickCategory={handlerClickCategory}
31
+ updateCategory={updateCategory}
32
+ />
33
+ </View>
34
+ </>
35
+ )}
36
+ {isSub && !category?.subcategories?.length && (
37
+ <CategoryTab isSpace={!!category?.parent_category_id}>
38
+ <TouchableOpacity
39
+ style={{ flex: 1, marginRight: 5 }}
40
+ onPress={() => handlerClickCategory(category)}
41
+ >
42
+ <OText numberOfLines={1}>
43
+ {category.name}
44
+ </OText>
45
+ </TouchableOpacity>
46
+ <View>
47
+ <ToggleSwitch
48
+ isOn={category?.enabled}
49
+ onColor={theme.colors.primary}
50
+ offColor={theme.colors.offColor}
51
+ size="small"
52
+ onToggle={(value: boolean) => handleSwitch(value, category.id)}
53
+ // disabled={loading}
54
+ animationSpeed={200}
55
+ />
56
+ </View>
57
+ </CategoryTab>
58
+ )}
59
+ </>
60
+ ) : (
61
+ <CategoryTab
62
+ isSpace={!!category?.parent_category_id}
63
+ >
64
+ <TouchableOpacity onPress={() => handlerClickCategory(category)} style={{ flex: 1, marginRight: 5 }}>
65
+ <OText numberOfLines={1}>
66
+ {category.name}
67
+ </OText>
68
+ </TouchableOpacity>
69
+ <View>
70
+ <ToggleSwitch
71
+ isOn={category?.enabled}
72
+ onColor={theme.colors.primary}
73
+ offColor={theme.colors.offColor}
74
+ size="small"
75
+ onToggle={(value: boolean) => handleSwitch(value, category.id)}
76
+ // disabled={loading}
77
+ animationSpeed={200}
78
+ />
79
+ </View>
80
+ </CategoryTab>
81
+ )}
82
+ </View>
83
+ ))}
84
+ {list && list?.length === 0 && isSub && (
85
+ <CategoryTab
86
+ isSpace={!!currentCat?.parent_category_id}
87
+ >
88
+ <TouchableOpacity onPress={() => handlerClickCategory(currentCat)} style={{ flex: 1, marginRight: 5 }}>
89
+ <OText numberOfLines={1}>
90
+ {currentCat.name}
91
+ </OText>
92
+ </TouchableOpacity>
93
+ <View>
94
+ <ToggleSwitch
95
+ isOn={currentCat?.enabled}
96
+ onColor={theme.colors.primary}
97
+ offColor={theme.colors.offColor}
98
+ size="small"
99
+ onToggle={(value: boolean) => handleSwitch(value, currentCat.id)}
100
+ // disabled={loading}
101
+ animationSpeed={200}
102
+ />
103
+ </View>
104
+ </CategoryTab>
105
+ )}
106
+ </>
107
+ )
108
+ }
@@ -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
+ `
@@ -99,6 +99,17 @@ const ChatUI = (props: MessagesParams) => {
99
99
  23: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
100
100
  }
101
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
+
102
113
  const storeMessageList: any = [
103
114
  { key: 'store_message_1', text: t('STORE_MESSAGE_1', 'store_message_1') },
104
115
  { key: 'store_message_2', text: t('STORE_MESSAGE_2', 'store_message_2') },
@@ -312,14 +323,16 @@ const ChatUI = (props: MessagesParams) => {
312
323
  quality: 1
313
324
  },
314
325
  (response: any) => {
315
- if (response.didCancel) {
326
+ const image = response.assets?.[0];
327
+ if (!image) return
328
+ if (image.didCancel) {
316
329
  console.log('User cancelled image picker');
317
- } else if (response.errorMessage) {
318
- console.log('ImagePicker Error: ', response.errorMessage);
319
- showToast(ToastType.Error, response.errorMessage);
330
+ } else if (image.errorMessage) {
331
+ console.log('ImagePicker Error: ', image.errorMessage);
332
+ showToast(ToastType.Error, image.errorMessage);
320
333
  } else {
321
- if (response.uri) {
322
- const url = `data:${response.type};base64,${response.base64}`;
334
+ if (image.uri) {
335
+ const url = `data:${image.type};base64,${image.base64}`;
323
336
  setImage && setImage(url);
324
337
  } else {
325
338
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -370,18 +383,34 @@ const ChatUI = (props: MessagesParams) => {
370
383
  }}>
371
384
  <OText
372
385
  numberOfLines={3}
373
- style={{ ...styles.firstMessageText, textAlign: 'center' }}>
374
- {message.change?.attribute !== 'driver_id'
375
- ?
376
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute) ?
377
- `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
378
- `${message.change.old !== null && ORDER_STATUS[parseInt(message.change.old, 10)]} ${t('TO', 'to')} ${ORDER_STATUS[parseInt(message.change.new, 10)]}`
379
- }`
380
- : 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'
381
399
  ?
382
- `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
383
- :
384
- `${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
+ }
385
414
  </OText>
386
415
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
387
416
  {parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
@@ -854,7 +883,7 @@ const ChatUI = (props: MessagesParams) => {
854
883
  iconCover
855
884
  />
856
885
 
857
- {image && !isShowSignaturePad && (
886
+ {!!image && !isShowSignaturePad && (
858
887
  <TouchableOpacity
859
888
  style={{
860
889
  position: 'absolute',
@@ -1061,7 +1090,7 @@ const ChatUI = (props: MessagesParams) => {
1061
1090
  .m-signature-pad {
1062
1091
  box-shadow: none;
1063
1092
  border: none;
1064
- }
1093
+ }
1065
1094
  .m-signature-pad--body {
1066
1095
  border: none;
1067
1096
  }