ordering-ui-react-native 0.15.98 → 0.16.0-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 (236) hide show
  1. package/package.json +8 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +145 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  46. package/src/types/index.tsx +15 -9
  47. package/src/utils/index.tsx +0 -1
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  50. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  51. package/themes/business/src/components/Chat/index.tsx +42 -34
  52. package/themes/business/src/components/DriverMap/index.tsx +12 -8
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  56. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  57. package/themes/business/src/components/MapView/index.tsx +1 -1
  58. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  59. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  60. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  61. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  62. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  63. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  64. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  65. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  67. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  68. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  71. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  72. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  73. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  74. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  75. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  76. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  77. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  78. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  79. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  80. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  81. package/themes/business/src/components/shared/OModal.tsx +41 -38
  82. package/themes/business/src/types/index.tsx +14 -9
  83. package/themes/business/src/utils/index.tsx +10 -0
  84. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  86. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  87. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  88. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  89. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  90. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  91. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +70 -31
  92. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  93. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  94. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  95. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  96. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  97. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  98. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  99. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  100. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  101. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  102. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  103. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  104. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  105. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  106. package/themes/kiosk/src/types/index.d.ts +3 -0
  107. package/themes/original/index.tsx +22 -0
  108. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  109. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  110. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  111. package/themes/original/src/components/AddressList/index.tsx +2 -2
  112. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  113. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  114. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  115. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  116. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  117. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  118. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  119. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  120. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  121. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  122. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  123. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  124. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  125. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  126. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  127. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  128. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  129. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  130. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  131. package/themes/original/src/components/BusinessProductsListing/index.tsx +298 -178
  132. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  133. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  134. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  135. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  136. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  137. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  138. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  139. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  140. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  141. package/themes/original/src/components/Cart/index.tsx +82 -37
  142. package/themes/original/src/components/Cart/styles.tsx +4 -0
  143. package/themes/original/src/components/CartContent/index.tsx +22 -16
  144. package/themes/original/src/components/Checkout/index.tsx +107 -67
  145. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  146. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  147. package/themes/original/src/components/Favorite/index.tsx +92 -0
  148. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  149. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  150. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  151. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  152. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  153. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  154. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  155. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  156. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  157. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  158. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  159. package/themes/original/src/components/Messages/index.tsx +17 -17
  160. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  161. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  162. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  163. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  164. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  165. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  166. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  167. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  168. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  169. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  170. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  171. package/themes/original/src/components/NavBar/index.tsx +11 -5
  172. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  173. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  174. package/themes/original/src/components/OrderDetails/index.tsx +138 -58
  175. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  176. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  177. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  178. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  179. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  180. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  181. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  182. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  183. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  184. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  185. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  186. package/themes/original/src/components/OrdersOption/index.tsx +143 -47
  187. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  188. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  189. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  190. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  191. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  192. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  193. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  194. package/themes/original/src/components/ProductForm/index.tsx +697 -649
  195. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  196. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  197. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  198. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  199. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  200. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  201. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  202. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  203. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  204. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  205. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  206. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  207. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  208. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  209. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  210. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  211. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  212. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  213. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  214. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  215. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  216. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  217. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  218. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  219. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  220. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  221. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  222. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  223. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  224. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  225. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  226. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  227. package/themes/original/src/components/Wallets/index.tsx +176 -162
  228. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  229. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  230. package/themes/original/src/components/shared/OButton.tsx +10 -3
  231. package/themes/original/src/components/shared/OInput.tsx +3 -2
  232. package/themes/original/src/components/shared/OModal.tsx +4 -2
  233. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  234. package/themes/original/src/types/index.tsx +200 -47
  235. package/themes/original/src/utils/index.tsx +77 -0
  236. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,56 +1,161 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage } from 'ordering-components/native';
3
- import { View, StyleSheet, Platform, I18nManager } from 'react-native';
3
+ import { View, StyleSheet, RefreshControl } from 'react-native';
4
4
 
5
5
  import { OrdersOption } from '../OrdersOption'
6
- import { OText } from '../shared'
6
+ import { HeaderTitle, OText } from '../shared'
7
7
  import { ScrollView } from 'react-native-gesture-handler';
8
-
9
- const PIXELS_TO_SCROLL = 1000;
8
+ import { Tab } from './styles'
9
+ import { useTheme } from 'styled-components/native';
10
+ import { Container } from '../../layouts/Container';
10
11
 
11
12
  export const MyOrders = (props: any) => {
12
- const [, t] = useLanguage();
13
- const [loadMore, setLoadMore] = useState(false)
14
-
13
+ const {
14
+ hideOrders,
15
+ businessesSearchList
16
+ } = props
17
+ const [, t] = useLanguage()
18
+ const theme = useTheme()
19
+ const [refreshing] = useState(false);
20
+ const [refreshOrders, setRefreshOrders] = useState(false)
21
+ const [isEmptyBusinesses, setIsEmptyBusinesses] = useState(false)
22
+ const [businessOrderIds, setBusinessOrderIds] = useState([])
15
23
  const [ordersLength, setOrdersLength] = useState({
16
24
  activeOrdersLength: 0,
17
25
  previousOrdersLength: 0,
18
26
  });
27
+ const [selectedOption, setSelectedOption] = useState(!hideOrders ? 'orders' : 'business')
28
+
29
+ const notOrderOptions = ['business', 'products']
30
+ const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
31
+ const MyOrdersMenu = [
32
+ { key: 'orders', value: t('ORDERS', 'Orders') },
33
+ { key: 'business', value: t('BUSINESS', 'Business') },
34
+ { key: 'products', value: t('PRODUCTS', 'Products') }
35
+ ]
19
36
 
20
- const handleScroll = ({ nativeEvent }: any) => {
21
- const y = nativeEvent.contentOffset.y
22
- const height = nativeEvent.contentSize.height
37
+ const handleOnRefresh = () => {
38
+ setRefreshOrders(true);
39
+ }
23
40
 
24
- if (y + PIXELS_TO_SCROLL > height ) {
25
- setLoadMore(true)
41
+ const styles = StyleSheet.create({
42
+ container: {
43
+ paddingVertical: 5,
44
+ borderColor: theme.colors.clear,
45
+ backgroundColor: '#FFF'
46
+ },
47
+ featuredStyle: {
48
+ display: 'none',
49
+ },
50
+ tabStyle: {
51
+ marginTop: 10,
52
+ height: 4,
53
+ borderTopStartRadius: 4,
54
+ borderTopEndRadius: 4,
55
+ backgroundColor: theme.colors.textPrimary,
56
+ },
57
+ tabDeactived: {
58
+ marginTop: 10,
59
+ height: 4
26
60
  }
27
- }
61
+ });
28
62
 
29
63
  return (
30
- <ScrollView onScroll={(e: any) => handleScroll(e)}>
31
- <OText
32
- size={20}
33
- mBottom={15}
34
- style={{ marginTop: 25, paddingHorizontal: 40 }}>
35
- {t('MY_ORDERS', 'My Orders')}
36
- </OText>
37
- <View style={{ paddingLeft: 40, paddingRight: 40 }}>
64
+ <Container noPadding refreshControl={
65
+ <RefreshControl
66
+ refreshing={refreshing}
67
+ onRefresh={() => handleOnRefresh()}
68
+ />
69
+ }>
70
+ {!hideOrders && (
71
+ <HeaderTitle text={t('MY_ORDERS', 'My Orders')} />
72
+ )}
73
+ {!allEmpty && (
74
+ <ScrollView
75
+ horizontal
76
+ style={{ ...styles.container, borderBottomWidth: 1 }}
77
+ contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 40 }}
78
+ showsHorizontalScrollIndicator={false}
79
+ scrollEventThrottle={16}
80
+ >
81
+ {MyOrdersMenu.filter(option => !hideOrders || option.key !== 'orders').map(option => (
82
+ <Tab
83
+ key={option.key}
84
+ onPress={() => setSelectedOption(option.key)}
85
+ style={
86
+ {
87
+ borderBottomColor:
88
+ selectedOption === option.key
89
+ ? theme.colors.textNormal
90
+ : theme.colors.border,
91
+ }
92
+ }
93
+ >
94
+ <OText>{option?.value}</OText>
95
+ </Tab>
96
+ ))}
97
+ </ScrollView>
98
+ )}
99
+ {selectedOption === 'orders' && (
100
+ <>
101
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
102
+ <OrdersOption
103
+ {...props}
104
+ activeOrders
105
+ ordersLength={ordersLength}
106
+ setOrdersLength={setOrdersLength}
107
+ setRefreshOrders={setRefreshOrders}
108
+ refreshOrders={refreshOrders}
109
+ />
110
+ </View>
111
+ <View style={{ paddingLeft: 40, paddingRight: 40 }}>
112
+ <OrdersOption
113
+ {...props}
114
+ ordersLength={ordersLength}
115
+ setOrdersLength={setOrdersLength}
116
+ setRefreshOrders={setRefreshOrders}
117
+ refreshOrders={refreshOrders}
118
+ />
119
+ </View>
120
+ </>
121
+ )}
122
+ {selectedOption === 'business' && (
38
123
  <OrdersOption
39
124
  {...props}
125
+ isBusiness
126
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
127
+ hideOrders
128
+ horizontal
40
129
  activeOrders
130
+ pastOrders
131
+ preOrders
132
+ businessesSearchList={businessesSearchList}
133
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
134
+ businessOrderIds={businessOrderIds}
135
+ setBusinessOrderIds={setBusinessOrderIds}
41
136
  ordersLength={ordersLength}
42
137
  setOrdersLength={setOrdersLength}
43
- loadMoreStatus={loadMore}
44
- setLoadMoreStatus={setLoadMore}
45
138
  />
46
- </View>
47
- <View style={{ paddingLeft: 40, paddingRight: 40 }}>
139
+ )}
140
+ {selectedOption === 'products' && (
48
141
  <OrdersOption
49
142
  {...props}
143
+ isProducts
144
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
145
+ hideOrders
146
+ horizontal
147
+ activeOrders
148
+ pastOrders
149
+ preOrders
150
+ businessesSearchList={businessesSearchList}
151
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
152
+ businessOrderIds={businessOrderIds}
153
+ setBusinessOrderIds={setBusinessOrderIds}
50
154
  ordersLength={ordersLength}
51
155
  setOrdersLength={setOrdersLength}
52
156
  />
53
- </View>
54
- </ScrollView>
157
+ )}
158
+ </Container>
159
+
55
160
  )
56
161
  }
@@ -3,4 +3,11 @@ import styled, { css } from 'styled-components/native'
3
3
  export const Wrapper = styled.View`
4
4
  flex: 1;
5
5
  background-color: ${(props: any) => props.theme.colors.white};
6
- `
6
+ `
7
+
8
+ export const Tab = styled.TouchableOpacity`
9
+ padding-horizontal: 10px;
10
+ padding-vertical: 10px;
11
+ justify-content: center;
12
+ border-bottom-width: 1px;
13
+ `
@@ -2,6 +2,7 @@ import * as React from 'react'
2
2
  import styled, { useTheme } from 'styled-components/native'
3
3
  import { OButton, OIcon, OText } from '../shared'
4
4
  import { Platform, TextStyle, ViewStyle, I18nManager, TouchableOpacity } from 'react-native'
5
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
6
 
6
7
  const TitleWrapper = styled.View`
7
8
  flex-direction: column;
@@ -61,11 +62,16 @@ const NavBar = (props: Props) => {
61
62
  return (
62
63
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
63
64
  <OButton
64
- imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
65
- imgLeftStyle={{width: 18}}
65
+ imgLeftSrc={props.leftImg}
66
+ imgLeftStyle={{ width: 18 }}
66
67
  imgRightSrc={null}
67
68
  style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
68
69
  onClick={props?.onActionLeft}
70
+ icon={AntDesignIcon}
71
+ iconProps={{
72
+ name: 'arrowleft',
73
+ size: 26
74
+ }}
69
75
  />
70
76
  <TitleTopWrapper>
71
77
  {props.withIcon
@@ -126,9 +132,9 @@ NavBar.defaultProps = {
126
132
  textAlign: 'center'
127
133
  };
128
134
 
129
- const areEqual=(prevProps: { route?: any; }, nextProps: { route?: any; })=>{
130
- return prevProps.route === nextProps.route
131
- return true
135
+ const areEqual = (prevProps: { route?: any; }, nextProps: { route?: any; }) => {
136
+ return prevProps.route === nextProps.route
137
+ return true
132
138
  }
133
139
 
134
140
  export default React.memo(NavBar, areEqual);
@@ -20,12 +20,13 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
20
20
  const theme = useTheme();
21
21
 
22
22
  const errorImage = image || theme.images.general.notFound
23
+ const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
23
24
 
24
25
  return (
25
26
  <NotFound>
26
27
  {errorImage && (
27
28
  <NotFoundImage>
28
- <OIcon src={errorImage} width={260} height={220} />
29
+ <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
29
30
  </NotFoundImage>
30
31
  )}
31
32
  {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
@@ -0,0 +1,167 @@
1
+ import React from 'react'
2
+ import { useTheme } from 'styled-components/native'
3
+ import { ScrollView, StyleSheet, View } from 'react-native'
4
+ import { useLanguage, useUtils } from 'ordering-components/native'
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import { OText, OButton } from '../shared'
7
+
8
+ export const OrderHistory = (props: any) => {
9
+ const {
10
+ order,
11
+ messages,
12
+ enableReview,
13
+ onClose,
14
+ handleTriggerReview
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parseDate }] = useUtils()
19
+ const theme = useTheme()
20
+
21
+ const styles = StyleSheet.create({
22
+ historyItem: {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ flexDirection: 'row',
26
+ borderBottomWidth: 1,
27
+ borderColor: theme.colors.border
28
+ },
29
+ detailWrapper: {
30
+ marginLeft: 20,
31
+ paddingHorizontal: 13,
32
+ paddingVertical: 16
33
+ },
34
+ container: {
35
+ paddingHorizontal: 40,
36
+ paddingVertical: 15
37
+ }
38
+ });
39
+
40
+ const ORDER_STATUS: any = {
41
+ 0: 'ORDER_STATUS_PENDING',
42
+ 1: 'ORDERS_COMPLETED',
43
+ 2: 'ORDER_REJECTED',
44
+ 3: 'ORDER_STATUS_IN_BUSINESS',
45
+ 4: 'ORDER_READY',
46
+ 5: 'ORDER_REJECTED_RESTAURANT',
47
+ 6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
48
+ 7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
49
+ 8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
50
+ 9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
51
+ 10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
52
+ 11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
53
+ 12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
54
+ 13: 'PREORDER',
55
+ 14: 'ORDER_NOT_READY',
56
+ 15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
57
+ 16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
58
+ 17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
59
+ 18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
60
+ 19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
61
+ 20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
62
+ 21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
63
+ 22: 'ORDER_LOOKING_FOR_DRIVER',
64
+ 23: 'ORDER_DRIVER_ON_WAY'
65
+ }
66
+
67
+ const getLogisticTagStatus = (status: any) => {
68
+ switch (status) {
69
+ case 0:
70
+ return t('PENDING', 'Pending')
71
+ case 1:
72
+ return t('IN_PROGRESS', 'In Progress')
73
+ case 2:
74
+ return t('IN_QUEUE', 'In Queue')
75
+ case 3:
76
+ return t('EXPIRED', 'Logistic expired')
77
+ case 4:
78
+ return t('RESOLVED', 'Resolved')
79
+ default:
80
+ return status
81
+ }
82
+ }
83
+
84
+ const handleReview = () => {
85
+ if (enableReview) handleTriggerReview()
86
+ else onClose()
87
+ }
88
+
89
+ return (
90
+ <ScrollView contentContainerStyle={styles.container}>
91
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
92
+ {t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
93
+ </OText>
94
+ {!messages?.loading && order && (
95
+ <View style={styles.historyItem}>
96
+ <MaterialCommunityIcons
97
+ name="checkbox-marked-circle"
98
+ size={20}
99
+ color={theme.colors.primary}
100
+ />
101
+ <View style={styles.detailWrapper}>
102
+ <OText
103
+ size={14}
104
+ weight='bold'
105
+ numberOfLines={1}
106
+ ellipsizeMode='tail'
107
+ >
108
+ {t('ORDER_PLACED', 'Order placed')} {' '}
109
+ {t('VIA', 'Via')}{' '}
110
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
111
+ </OText>
112
+ <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
113
+ </View>
114
+ </View>
115
+ )}
116
+ {messages && messages?.messages.map((message: any, i: number) => message.type === 1 && (
117
+ <View
118
+ style={styles.historyItem}
119
+ key={i}
120
+ >
121
+ <MaterialCommunityIcons
122
+ name="checkbox-marked-circle"
123
+ size={20}
124
+ color={theme.colors.primary}
125
+ />
126
+ <View style={styles.detailWrapper}>
127
+ {message.change?.attribute !== 'driver_id' ? (
128
+ <OText
129
+ size={14}
130
+ weight='bold'
131
+ numberOfLines={1}
132
+ ellipsizeMode='tail'
133
+ >
134
+ {message.change?.attribute === 'logistic_status'
135
+ ? getLogisticTagStatus(parseInt(message.change.new, 10))
136
+ : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
+ }
138
+ </OText>
139
+ ) : (
140
+ <OText
141
+ size={14}
142
+ weight='bold'
143
+ numberOfLines={1}
144
+ ellipsizeMode='tail'
145
+ >
146
+ {message.change.new
147
+ ? (`${message.driver?.name} ${!!message.driver?.lastname ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}`)
148
+ : t('DRIVER_UNASSIGNED', 'Driver unassigned')}
149
+ </OText>
150
+ )}
151
+ <OText size={12}>{parseDate(message?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
152
+ </View>
153
+ </View>
154
+ ))}
155
+ <OButton
156
+ text={enableReview ? t('REVIEW_ORDER', 'Review order') : t('CONTINUE', 'Continue')}
157
+ textStyle={{ fontSize: 14, color: theme.colors.white }}
158
+ imgRightSrc={theme.images.general.arrow_right}
159
+ imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
160
+ borderColor='transparent'
161
+ bgColor={theme.colors.primary}
162
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginBottom: 30, marginTop: 20 }}
163
+ onClick={() => handleReview()}
164
+ />
165
+ </ScrollView>
166
+ )
167
+ }