ordering-ui-react-native 0.19.2-testing → 0.19.3-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 (217) hide show
  1. package/package.json +6 -5
  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/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +121 -103
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +27 -13
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +83 -37
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/StoresList/index.tsx +5 -3
  41. package/themes/business/src/components/UserProfileForm/index.tsx +27 -10
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  43. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  44. package/themes/business/src/types/index.tsx +10 -0
  45. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  47. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  50. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  51. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  52. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  53. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  54. package/themes/original/index.tsx +7 -3
  55. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  56. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  57. package/themes/original/src/components/AddressList/index.tsx +4 -7
  58. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  59. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  60. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  61. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  62. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  63. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  64. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  65. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  69. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  71. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  73. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
  77. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  78. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  87. package/themes/original/src/components/Cart/index.tsx +27 -8
  88. package/themes/original/src/components/CartContent/index.tsx +61 -39
  89. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  90. package/themes/original/src/components/Checkout/index.tsx +199 -55
  91. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  92. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  93. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  94. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  95. package/themes/original/src/components/Favorite/index.tsx +4 -9
  96. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  97. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  98. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  99. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  105. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  108. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  109. package/themes/original/src/components/Home/index.tsx +1 -1
  110. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  111. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  112. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  113. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  114. package/themes/original/src/components/Messages/index.tsx +9 -4
  115. package/themes/original/src/components/Messages/styles.tsx +1 -1
  116. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  120. package/themes/original/src/components/MultiCheckout/index.tsx +184 -51
  121. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  122. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  123. package/themes/original/src/components/NavBar/index.tsx +3 -1
  124. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  125. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  126. package/themes/original/src/components/Notifications/index.tsx +4 -8
  127. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  128. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  129. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  130. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  131. package/themes/original/src/components/OrderProgress/index.tsx +7 -7
  132. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  133. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  134. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  135. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  136. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  137. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  138. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  139. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  140. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  141. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  142. package/themes/original/src/components/PaymentOptions/index.tsx +41 -32
  143. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  144. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  145. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  146. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  147. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  148. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  149. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  150. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  151. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  152. package/themes/original/src/components/Promotions/index.tsx +4 -4
  153. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  154. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  155. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  156. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  157. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  158. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  159. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  160. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  161. package/themes/original/src/components/StripeCardsList/index.tsx +53 -7
  162. package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
  163. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  164. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  165. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  166. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  167. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  168. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  169. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  170. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  171. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  172. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  173. package/themes/original/src/components/Wallets/index.tsx +8 -9
  174. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  175. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  176. package/themes/original/src/components/shared/OInput.tsx +1 -4
  177. package/themes/original/src/components/shared/OModal.tsx +12 -14
  178. package/themes/original/src/layouts/Container.tsx +5 -3
  179. package/themes/original/src/types/index.tsx +10 -2
  180. package/themes/original/src/utils/index.tsx +124 -0
  181. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  182. package/src/navigators/BottomNavigator.tsx +0 -117
  183. package/src/navigators/CheckoutNavigator.tsx +0 -66
  184. package/src/navigators/HomeNavigator.tsx +0 -202
  185. package/src/navigators/NavigationRef.tsx +0 -7
  186. package/src/navigators/RootNavigator.tsx +0 -269
  187. package/src/pages/Account.tsx +0 -34
  188. package/src/pages/AddressForm.tsx +0 -62
  189. package/src/pages/AddressList.tsx +0 -24
  190. package/src/pages/BusinessProductsList.tsx +0 -81
  191. package/src/pages/BusinessesListing.tsx +0 -43
  192. package/src/pages/CartList.tsx +0 -49
  193. package/src/pages/Checkout.tsx +0 -101
  194. package/src/pages/ForgotPassword.tsx +0 -24
  195. package/src/pages/Help.tsx +0 -23
  196. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  197. package/src/pages/HelpGuide.tsx +0 -23
  198. package/src/pages/HelpOrder.tsx +0 -23
  199. package/src/pages/Home.tsx +0 -36
  200. package/src/pages/IntroductoryTutorial.tsx +0 -170
  201. package/src/pages/Login.tsx +0 -47
  202. package/src/pages/MomentOption.tsx +0 -30
  203. package/src/pages/MultiCheckout.tsx +0 -31
  204. package/src/pages/MultiOrdersDetails.tsx +0 -27
  205. package/src/pages/MyOrders.tsx +0 -40
  206. package/src/pages/NetworkError.tsx +0 -24
  207. package/src/pages/NotFound.tsx +0 -22
  208. package/src/pages/OrderDetails.tsx +0 -25
  209. package/src/pages/ProductDetails.tsx +0 -55
  210. package/src/pages/Profile.tsx +0 -36
  211. package/src/pages/ReviewDriver.tsx +0 -30
  212. package/src/pages/ReviewOrder.tsx +0 -32
  213. package/src/pages/ReviewProducts.tsx +0 -30
  214. package/src/pages/Sessions.tsx +0 -22
  215. package/src/pages/Signup.tsx +0 -53
  216. package/src/pages/SpinnerLoader.tsx +0 -10
  217. package/src/pages/Splash.tsx +0 -21
@@ -0,0 +1,93 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import { useTheme } from 'styled-components/native'
4
+ import { OButton } from '../shared';
5
+ import { useLanguage, useConfig } from 'ordering-components/native'
6
+ import { OrderItem } from './OrderItem';
7
+ import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
8
+
9
+ function OrderListPropsAreEqual(prevProps: any, nextProps: any) {
10
+ return JSON.stringify(prevProps.order) === JSON.stringify(nextProps.order) &&
11
+ JSON.stringify(prevProps._order) === JSON.stringify(nextProps._order) &&
12
+ JSON.stringify(prevProps.currentOrdenSelected) === JSON.stringify(nextProps.currentOrdenSelected) &&
13
+ prevProps.currentTabSelected === nextProps.currentTabSelected
14
+ }
15
+
16
+ export const OrdersList = React.memo((props: any) => {
17
+ const {
18
+ order,
19
+ _order,
20
+ hideBtns,
21
+ currentOrdenSelected,
22
+ isLogisticOrder,
23
+ handlePressOrder,
24
+ currentTabSelected,
25
+ getOrderStatus,
26
+ handleClickLogisticOrder
27
+ } = props
28
+
29
+ const theme = useTheme()
30
+ const [, t] = useLanguage()
31
+ const [{ configs }] = useConfig();
32
+
33
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
34
+
35
+ return (
36
+ <View
37
+ style={{
38
+ backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
39
+ marginBottom: isLogisticOrder ? 10 : 0
40
+ }}
41
+ >
42
+ <OrderItem
43
+ order={order}
44
+ _order={_order}
45
+ isLogisticOrder={isLogisticOrder}
46
+ handlePressOrder={handlePressOrder}
47
+ currentTabSelected={currentTabSelected}
48
+ getOrderStatus={getOrderStatus}
49
+ />
50
+ {isLogisticOrder && !hideBtns && (
51
+ <AcceptOrRejectOrderStyle>
52
+ {!!order?.order_group_id && !!order?.order_group ? (
53
+ <OButton
54
+ text={t('VIEW_ORDER', 'View order')}
55
+ onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
56
+ bgColor={theme.colors.blueLight}
57
+ borderColor={theme.colors.blueLight}
58
+ imgRightSrc={null}
59
+ style={{ borderRadius: 7, height: 40 }}
60
+ parentStyle={{ width: '100%' }}
61
+ textStyle={{ color: theme?.colors?.white }}
62
+ />
63
+ ) : (
64
+ <>
65
+ {!isHideRejectButtons && (
66
+ <OButton
67
+ text={t('REJECT', 'Reject')}
68
+ onClick={() => handleClickLogisticOrder(2, _order?.id)}
69
+ bgColor={theme.colors.red}
70
+ borderColor={theme.colors.red}
71
+ imgRightSrc={null}
72
+ style={{ borderRadius: 7, height: 40 }}
73
+ parentStyle={{ width: '45%' }}
74
+ textStyle={{ color: theme.colors.white }}
75
+ />
76
+ )}
77
+ <OButton
78
+ text={t('ACCEPT', 'Accept')}
79
+ onClick={() => handleClickLogisticOrder(1, _order?.id)}
80
+ bgColor={theme.colors.green}
81
+ borderColor={theme.colors.green}
82
+ imgRightSrc={null}
83
+ style={{ borderRadius: 7, height: 40 }}
84
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
85
+ textStyle={{ color: theme.colors.white }}
86
+ />
87
+ </>
88
+ )}
89
+ </AcceptOrRejectOrderStyle>
90
+ )}
91
+ </View>
92
+ )
93
+ }, OrderListPropsAreEqual)
@@ -88,7 +88,7 @@ export const OrdersGroupedItem = (props: any) => {
88
88
  adjustsFontSizeToFit
89
89
  >
90
90
  {orders[0]?.delivery_datetime_utc
91
- ? parseDate(orders[0]?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
91
+ ? parseDate(orders[0]?.delivery_datetime_utc)
92
92
  : parseDate(orders[0]?.delivery_datetime, { utc: false })}
93
93
  </OText>
94
94
  </View>
@@ -1,13 +1,13 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
- import { useLanguage } from 'ordering-components/native';
4
+ import { useLanguage, useConfig } from 'ordering-components/native';
5
5
 
6
- import {AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
6
+ import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
7
 
8
8
  import { OButton, OModal } from '../shared';
9
- import { OrderItem } from './OrderItem'
10
9
  import { OrdersGroupedItem } from './OrdersGroupedItem'
10
+ import { OrdersList } from './OrderList';
11
11
  import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
12
12
  import { ReviewCustomer } from '../ReviewCustomer';
13
13
  import { GoogleMap } from '../GoogleMap';
@@ -24,14 +24,17 @@ export const PreviousOrders = (props: any) => {
24
24
  currentTabSelected,
25
25
  currentOrdenSelected,
26
26
  handleChangeOrderStatus,
27
- handleSendCustomerReview
27
+ handleSendCustomerReview,
28
+ isBusinessApp
28
29
  } = props;
29
30
 
30
31
  let hash: any = {};
31
32
  const [, t] = useLanguage();
32
33
  const theme = useTheme();
34
+ const [{ configs }] = useConfig();
33
35
 
34
- const [, setCurrentTime] = useState()
36
+
37
+ // const [, setCurrentTime] = useState()
35
38
  const [openModal, setOpenModal] = useState(false)
36
39
  const [openReviewModal, setOpenReviewModal] = useState({ order: null, ids: [], customerId: null })
37
40
  const [openMapViewModal, setOpenMapViewModal] = useState<any>({ open: false, customerLocation: null, locations: [] })
@@ -41,6 +44,7 @@ export const PreviousOrders = (props: any) => {
41
44
  const viewMapStatus = [9, 18, 19, 23]
42
45
  const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
43
46
  const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
47
+ const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
44
48
 
45
49
  const handlePressOrder = (order: any) => {
46
50
  if (order?.locked && isLogisticOrder) return
@@ -48,9 +52,9 @@ export const PreviousOrders = (props: any) => {
48
52
  if (props.handleClickEvent) {
49
53
  props.handleClickEvent({ ...order, isLogistic: isLogisticOrder })
50
54
  } else {
51
- if (isLogisticOrder){
55
+ if (isLogisticOrder) {
52
56
  onNavigationRedirect &&
53
- onNavigationRedirect('OrderDetailsLogistic', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
57
+ onNavigationRedirect('OrderDetailsLogistic', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
54
58
  } else {
55
59
  onNavigationRedirect &&
56
60
  onNavigationRedirect('OrderDetails', { order });
@@ -58,73 +62,13 @@ export const PreviousOrders = (props: any) => {
58
62
  }
59
63
  };
60
64
 
61
- const OrdersList = (props: any) => {
62
- const { order, _order, hideBtns } = props
63
- return (
64
- <View
65
- style={{
66
- backgroundColor: currentOrdenSelected === order?.id ? theme.colors.gray100 : order?.locked && isLogisticOrder ? '#ccc' : '#fff',
67
- marginBottom: isLogisticOrder ? 10 : 0
68
- }}
69
- >
70
- <OrderItem
71
- order={order}
72
- _order={_order}
73
- isLogisticOrder={isLogisticOrder}
74
- handlePressOrder={handlePressOrder}
75
- currentTabSelected={currentTabSelected}
76
- getOrderStatus={getOrderStatus}
77
- />
78
- {isLogisticOrder && !hideBtns && (
79
- <AcceptOrRejectOrderStyle>
80
- {!!order?.order_group_id && !!order?.order_group ? (
81
- <OButton
82
- text={t('VIEW_ORDER', 'View order')}
83
- onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
84
- bgColor={theme.colors.blueLight}
85
- borderColor={theme.colors.blueLight}
86
- imgRightSrc={null}
87
- style={{ borderRadius: 7, height: 40 }}
88
- parentStyle={{ width: '100%' }}
89
- textStyle={{ color: theme?.colors?.white }}
90
- />
91
- ) : (
92
- <>
93
- <OButton
94
- text={t('REJECT', 'Reject')}
95
- onClick={() => handleClickLogisticOrder(2, _order?.id)}
96
- bgColor={theme.colors.red}
97
- borderColor={theme.colors.red}
98
- imgRightSrc={null}
99
- style={{ borderRadius: 7, height: 40 }}
100
- parentStyle={{ width: '45%' }}
101
- textStyle={{ color: theme.colors.white }}
102
- />
103
- <OButton
104
- text={t('ACCEPT', 'Accept')}
105
- onClick={() => handleClickLogisticOrder(1, _order?.id)}
106
- bgColor={theme.colors.green}
107
- borderColor={theme.colors.green}
108
- imgRightSrc={null}
109
- style={{ borderRadius: 7, height: 40 }}
110
- parentStyle={{ width: '45%' }}
111
- textStyle={{ color: theme.colors.white }}
112
- />
113
- </>
114
- )}
115
- </AcceptOrRejectOrderStyle>
116
- )}
117
- </View>
118
- )
119
- }
120
-
121
65
  const ordersGroupAction = (param1 = '', param2 = '', { order, action, body, ids }: any = {}) => {
122
66
  setOrderUpdateStatus({ ...orderUpdateStatus, action, ids, body, order })
123
67
  if (!param1) setOpenModal(true)
124
68
  if (param1) {
125
69
  setOpenModal(false)
126
70
  handleChangeOrderStatus &&
127
- handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
71
+ handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
128
72
  }
129
73
  }
130
74
 
@@ -159,7 +103,7 @@ export const PreviousOrders = (props: any) => {
159
103
  if (_order?.customer?.location) {
160
104
  locations.push({
161
105
  ..._order?.customer?.location,
162
- title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
106
+ title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
163
107
  address: {
164
108
  addressName: _order?.customer?.address,
165
109
  zipcode: _order?.customer?.zipcode
@@ -180,14 +124,14 @@ export const PreviousOrders = (props: any) => {
180
124
  })
181
125
  }
182
126
 
183
- useEffect(() => {
184
- const interval = setInterval(() => {
185
- const date: any = Date.now()
186
- setCurrentTime(date)
187
- }, slaSettingTime ?? 6000)
127
+ // useEffect(() => {
128
+ // const interval = setInterval(() => {
129
+ // const date: any = Date.now()
130
+ // setCurrentTime(date)
131
+ // }, slaSettingTime ?? 6000)
188
132
 
189
- return () => clearInterval(interval)
190
- }, [])
133
+ // return () => clearInterval(interval)
134
+ // }, [])
191
135
 
192
136
 
193
137
  return (
@@ -210,35 +154,48 @@ export const PreviousOrders = (props: any) => {
210
154
  ?.map((_order: any) => {
211
155
  const order_ = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
212
156
  return (
213
- <OrdersList key={order_.id} order={order_} _order={_order} hideBtns />
157
+ <OrdersList
158
+ key={order_.id}
159
+ order={order_}
160
+ _order={_order}
161
+ hideBtns
162
+ currentOrdenSelected={currentOrdenSelected}
163
+ isLogisticOrder={isLogisticOrder}
164
+ handlePressOrder={handlePressOrder}
165
+ currentTabSelected={currentTabSelected}
166
+ getOrderStatus={getOrderStatus}
167
+ handleClickLogisticOrder={handleClickLogisticOrder}
168
+ />
214
169
  )
215
170
  }
216
- )
171
+ )
217
172
  }
218
173
  {_ordersGrouped[k][0]?.status === 0 && (
219
174
  <AcceptOrRejectOrderStyle>
220
- <OButton
221
- text={t('REJECT_ALL', 'Reject all')}
222
- bgColor={theme.colors.danger100}
223
- borderColor={theme.colors.danger100}
224
- imgRightSrc={null}
225
- style={{ borderRadius: 7, height: 40 }}
226
- parentStyle={{ width: '45%' }}
227
- textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
228
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
229
- action: 'reject',
230
- order: _ordersGrouped[k][0],
231
- ids: _ordersGrouped[k].map((o: any) => o.id),
232
- handleChangeOrderStatus
233
- })}
234
- />
175
+ {!isHideRejectButtons && (
176
+ <OButton
177
+ text={t('REJECT_ALL', 'Reject all')}
178
+ bgColor={theme.colors.danger100}
179
+ borderColor={theme.colors.danger100}
180
+ imgRightSrc={null}
181
+ style={{ borderRadius: 7, height: 40 }}
182
+ parentStyle={{ width: '45%' }}
183
+ textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
184
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
185
+ action: 'reject',
186
+ order: _ordersGrouped[k][0],
187
+ ids: _ordersGrouped[k].map((o: any) => o.id),
188
+ handleChangeOrderStatus
189
+ })}
190
+ />
191
+ )}
235
192
  <OButton
236
193
  text={t('ACCEPT_ALL', 'Accept all')}
237
194
  bgColor={theme.colors.success100}
238
195
  borderColor={theme.colors.success100}
239
196
  imgRightSrc={null}
240
197
  style={{ borderRadius: 7, height: 40 }}
241
- parentStyle={{ width: '45%' }}
198
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
242
199
  textStyle={{ color: theme.colors.success500, fontSize: 12 }}
243
200
  onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
244
201
  action: 'accept',
@@ -268,133 +225,137 @@ export const PreviousOrders = (props: any) => {
268
225
  )}
269
226
  {(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
270
227
  _ordersGrouped[k][0]?.delivery_type === 1 &&
271
- (
272
- <AcceptOrRejectOrderStyle>
273
- <OButton
274
- text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
275
- bgColor={theme.colors.btnBGWhite}
276
- borderColor={theme.colors.btnBGWhite}
277
- imgRightSrc={null}
278
- style={{ borderRadius: 7, height: 40 }}
279
- parentStyle={{ width: '100%' }}
280
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
281
- onClick={() => handleChangeOrderStatus(
282
- 3,
283
- _ordersGrouped[k].map((o: any) => o.id),
284
- )}
285
- />
286
- </AcceptOrRejectOrderStyle>
287
- )}
288
- {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 &&
289
- (
290
- <AcceptOrRejectOrderStyle>
291
- <OButton
292
- text={t('ORDER_NOT_READY', 'Order not ready')}
293
- bgColor={theme.colors.red}
294
- borderColor={theme.colors.red}
295
- imgRightSrc={null}
296
- style={{ borderRadius: 7, height: 40 }}
297
- parentStyle={{ width: '100%' }}
298
- textStyle={{ color: theme.colors.white, fontSize: 12 }}
299
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
300
- action: 'notReady',
301
- order: _ordersGrouped[k][0],
302
- ids: _ordersGrouped[k].map((o: any) => o.id),
303
- handleChangeOrderStatus
304
- })}
305
- />
306
- </AcceptOrRejectOrderStyle>
307
- )}
228
+ (
229
+ <AcceptOrRejectOrderStyle>
230
+ <OButton
231
+ text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
232
+ bgColor={theme.colors.btnBGWhite}
233
+ borderColor={theme.colors.btnBGWhite}
234
+ imgRightSrc={null}
235
+ style={{ borderRadius: 7, height: 40 }}
236
+ parentStyle={{ width: '100%' }}
237
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
238
+ onClick={() => handleChangeOrderStatus(
239
+ 3,
240
+ _ordersGrouped[k].map((o: any) => o.id),
241
+ )}
242
+ />
243
+ </AcceptOrRejectOrderStyle>
244
+ )}
245
+ {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons &&
246
+ (
247
+ <AcceptOrRejectOrderStyle>
248
+ <OButton
249
+ text={t('ORDER_NOT_READY', 'Order not ready')}
250
+ bgColor={theme.colors.red}
251
+ borderColor={theme.colors.red}
252
+ imgRightSrc={null}
253
+ style={{ borderRadius: 7, height: 40 }}
254
+ parentStyle={{ width: '100%' }}
255
+ textStyle={{ color: theme.colors.white, fontSize: 12 }}
256
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
257
+ action: 'notReady',
258
+ order: _ordersGrouped[k][0],
259
+ ids: _ordersGrouped[k].map((o: any) => o.id),
260
+ handleChangeOrderStatus
261
+ })}
262
+ />
263
+ </AcceptOrRejectOrderStyle>
264
+ )}
308
265
  {viewMapStatus.includes(_ordersGrouped[k][0]?.status) &&
309
266
  props.appTitle?.text?.includes('Business') &&
310
- (
311
- <View>
312
- <OButton
313
- text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
314
- bgColor={theme.colors.primaryLight}
315
- borderColor={theme.colors.primaryLight}
316
- imgRightSrc={null}
317
- style={{ borderRadius: 7, height: 40 }}
318
- parentStyle={{ width: '100%' }}
319
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
320
- onClick={() => handleOpenMapView({ orders: _ordersGrouped[k] })}
321
- />
322
- </View>
323
- )}
267
+ (
268
+ <View>
269
+ <OButton
270
+ text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
271
+ bgColor={theme.colors.primaryLight}
272
+ borderColor={theme.colors.primaryLight}
273
+ imgRightSrc={null}
274
+ style={{ borderRadius: 7, height: 40 }}
275
+ parentStyle={{ width: '100%' }}
276
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
277
+ onClick={() => handleOpenMapView({ orders: _ordersGrouped[k] })}
278
+ />
279
+ </View>
280
+ )}
324
281
  {_ordersGrouped[k][0]?.status === 4 &&
325
282
  ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
326
- (
327
- <AcceptOrRejectOrderStyle>
328
- <OButton
329
- text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
330
- bgColor={theme.colors.danger100}
331
- borderColor={theme.colors.danger100}
332
- imgRightSrc={null}
333
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
334
- parentStyle={{ width: '45%' }}
335
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
336
- onClick={() => handleChangeOrderStatus(
337
- 17,
338
- _ordersGrouped[k].map((o: any) => o.id),
283
+ (
284
+ <AcceptOrRejectOrderStyle>
285
+ {!isHideRejectButtons && (
286
+ <OButton
287
+ text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
288
+ bgColor={theme.colors.danger100}
289
+ borderColor={theme.colors.danger100}
290
+ imgRightSrc={null}
291
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
292
+ parentStyle={{ width: '45%' }}
293
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
294
+ onClick={() => handleChangeOrderStatus(
295
+ 17,
296
+ _ordersGrouped[k].map((o: any) => o.id),
297
+ )}
298
+ />
339
299
  )}
340
- />
341
- <OButton
342
- text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
343
- bgColor={theme.colors.success100}
344
- borderColor={theme.colors.success100}
345
- imgRightSrc={null}
346
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
347
- parentStyle={{ width: '45%' }}
348
- textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
349
- onClick={() => handleChangeOrderStatus(
350
- 15,
351
- _ordersGrouped[k].map((o: any) => o.id),
352
- )}
353
- />
354
- </AcceptOrRejectOrderStyle>
355
- )}
300
+ <OButton
301
+ text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
302
+ bgColor={theme.colors.success100}
303
+ borderColor={theme.colors.success100}
304
+ imgRightSrc={null}
305
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
306
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
307
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
308
+ onClick={() => handleChangeOrderStatus(
309
+ 15,
310
+ _ordersGrouped[k].map((o: any) => o.id),
311
+ )}
312
+ />
313
+ </AcceptOrRejectOrderStyle>
314
+ )}
356
315
  {!_ordersGrouped[k][0]?.user_review &&
357
316
  pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
358
- (
359
- <OButton
360
- text={t('REVIEW_CUSTOMER', 'Review customer')}
361
- bgColor={theme.colors.primary}
362
- borderColor={theme.colors.primary}
363
- imgRightSrc={null}
364
- style={{ borderRadius: 8, height: 40 }}
365
- parentStyle={{ width: '100%' }}
366
- textStyle={{ color: theme.colors.white }}
367
- onClick={() => setOpenReviewModal({
368
- order: _ordersGrouped[k][0],
369
- customerId: _ordersGrouped[k][0]?.customer_id,
370
- ids: _ordersGrouped[k].map((o: any) => o.id)
371
- })}
372
- />
373
- )}
374
- {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
375
- <AcceptOrRejectOrderStyle>
317
+ (
376
318
  <OButton
377
- text={t('PICKUP_FAILED', 'Pickup failed')}
378
- bgColor={theme.colors.danger100}
379
- borderColor={theme.colors.danger100}
319
+ text={t('REVIEW_CUSTOMER', 'Review customer')}
320
+ bgColor={theme.colors.primary}
321
+ borderColor={theme.colors.primary}
380
322
  imgRightSrc={null}
381
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
382
- parentStyle={{ width: '45%' }}
383
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
384
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
385
- action: 'pickupFailed',
323
+ style={{ borderRadius: 8, height: 40 }}
324
+ parentStyle={{ width: '100%' }}
325
+ textStyle={{ color: theme.colors.white }}
326
+ onClick={() => setOpenReviewModal({
386
327
  order: _ordersGrouped[k][0],
387
- ids: _ordersGrouped[k].map((o: any) => o.id),
388
- handleChangeOrderStatus
328
+ customerId: _ordersGrouped[k][0]?.customer_id,
329
+ ids: _ordersGrouped[k].map((o: any) => o.id)
389
330
  })}
390
331
  />
332
+ )}
333
+ {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
334
+ <AcceptOrRejectOrderStyle>
335
+ {!isHideRejectButtons && (
336
+ <OButton
337
+ text={t('PICKUP_FAILED', 'Pickup failed')}
338
+ bgColor={theme.colors.danger100}
339
+ borderColor={theme.colors.danger100}
340
+ imgRightSrc={null}
341
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
342
+ parentStyle={{ width: '45%' }}
343
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
344
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
345
+ action: 'pickupFailed',
346
+ order: _ordersGrouped[k][0],
347
+ ids: _ordersGrouped[k].map((o: any) => o.id),
348
+ handleChangeOrderStatus
349
+ })}
350
+ />
351
+ )}
391
352
  <OButton
392
353
  text={t('PICKUP_COMPLETE', 'Pickup complete')}
393
354
  bgColor={theme.colors.success100}
394
355
  borderColor={theme.colors.success100}
395
356
  imgRightSrc={null}
396
357
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
397
- parentStyle={{ width: '45%' }}
358
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
398
359
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
399
360
  onClick={() => handleChangeOrderStatus(
400
361
  9,
@@ -405,28 +366,30 @@ export const PreviousOrders = (props: any) => {
405
366
  )}
406
367
  {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
407
368
  <AcceptOrRejectOrderStyle>
408
- <OButton
409
- text={t('DELIVERY_FAILED', 'Delivery Failed')}
410
- bgColor={theme.colors.danger100}
411
- borderColor={theme.colors.danger100}
412
- imgRightSrc={null}
413
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
414
- parentStyle={{ width: '45%' }}
415
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
416
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
417
- action: 'deliveryFailed',
418
- order: _ordersGrouped[k][0],
419
- ids: _ordersGrouped[k].map((o: any) => o.id),
420
- handleChangeOrderStatus
421
- })}
422
- />
369
+ {!isHideRejectButtons && (
370
+ <OButton
371
+ text={t('DELIVERY_FAILED', 'Delivery Failed')}
372
+ bgColor={theme.colors.danger100}
373
+ borderColor={theme.colors.danger100}
374
+ imgRightSrc={null}
375
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
376
+ parentStyle={{ width: '45%' }}
377
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
378
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
379
+ action: 'deliveryFailed',
380
+ order: _ordersGrouped[k][0],
381
+ ids: _ordersGrouped[k].map((o: any) => o.id),
382
+ handleChangeOrderStatus
383
+ })}
384
+ />
385
+ )}
423
386
  <OButton
424
387
  text={t('DELIVERY_COMPLETE', 'Delivery complete')}
425
388
  bgColor={theme.colors.success100}
426
389
  borderColor={theme.colors.success100}
427
390
  imgRightSrc={null}
428
391
  style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
429
- parentStyle={{ width: '45%' }}
392
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
430
393
  textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
431
394
  onClick={() => handleChangeOrderStatus(
432
395
  11,
@@ -440,7 +403,16 @@ export const PreviousOrders = (props: any) => {
440
403
  </View>
441
404
  ) : (
442
405
  <View key={order.id}>
443
- <OrdersList order={order} _order={_order} />
406
+ <OrdersList
407
+ order={order}
408
+ _order={_order}
409
+ currentOrdenSelected={currentOrdenSelected}
410
+ isLogisticOrder={isLogisticOrder}
411
+ handlePressOrder={handlePressOrder}
412
+ currentTabSelected={currentTabSelected}
413
+ getOrderStatus={getOrderStatus}
414
+ handleClickLogisticOrder={handleClickLogisticOrder}
415
+ />
444
416
  </View>
445
417
  )
446
418
  )