ordering-ui-react-native 0.17.97 → 0.17.98-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 (224) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  67. package/themes/original/src/components/AddressList/index.tsx +5 -8
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +36 -403
  94. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  95. package/themes/original/src/components/Cart/index.tsx +44 -81
  96. package/themes/original/src/components/CartContent/index.tsx +70 -30
  97. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  98. package/themes/original/src/components/Checkout/index.tsx +262 -35
  99. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  100. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  101. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  102. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  103. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  104. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  105. package/themes/original/src/components/Favorite/index.tsx +1 -5
  106. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  108. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  110. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  113. package/themes/original/src/components/Home/index.tsx +13 -4
  114. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  120. package/themes/original/src/components/Messages/index.tsx +15 -4
  121. package/themes/original/src/components/MomentOption/index.tsx +41 -36
  122. package/themes/original/src/components/MomentOption/styles.tsx +0 -15
  123. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  125. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  128. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  129. package/themes/original/src/components/NavBar/index.tsx +20 -13
  130. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  131. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  132. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  133. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  134. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  135. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  136. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  137. package/themes/original/src/components/OrderSummary/index.tsx +59 -56
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  140. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  143. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  144. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  145. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  147. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  148. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  149. package/themes/original/src/components/ProductForm/index.tsx +65 -34
  150. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  151. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  152. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  153. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  154. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  155. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  156. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  157. package/themes/original/src/components/Promotions/index.tsx +2 -2
  158. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  159. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  160. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  161. package/themes/original/src/components/ServiceForm/index.tsx +40 -20
  162. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +3 -8
  172. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  173. package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
  174. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  175. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  176. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  177. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  178. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  179. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  180. package/themes/original/src/components/Wallets/index.tsx +51 -61
  181. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  182. package/themes/original/src/components/shared/OButton.tsx +3 -3
  183. package/themes/original/src/components/shared/OInput.tsx +4 -5
  184. package/themes/original/src/components/shared/OModal.tsx +3 -3
  185. package/themes/original/src/config/constants.tsx +0 -10
  186. package/themes/original/src/types/index.tsx +31 -15
  187. package/themes/original/src/utils/index.tsx +180 -13
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  189. package/src/navigators/BottomNavigator.tsx +0 -117
  190. package/src/navigators/CheckoutNavigator.tsx +0 -66
  191. package/src/navigators/HomeNavigator.tsx +0 -202
  192. package/src/navigators/NavigationRef.tsx +0 -7
  193. package/src/navigators/RootNavigator.tsx +0 -269
  194. package/src/pages/Account.tsx +0 -34
  195. package/src/pages/AddressForm.tsx +0 -62
  196. package/src/pages/AddressList.tsx +0 -24
  197. package/src/pages/BusinessProductsList.tsx +0 -81
  198. package/src/pages/BusinessesListing.tsx +0 -43
  199. package/src/pages/CartList.tsx +0 -49
  200. package/src/pages/Checkout.tsx +0 -101
  201. package/src/pages/ForgotPassword.tsx +0 -24
  202. package/src/pages/Help.tsx +0 -23
  203. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  204. package/src/pages/HelpGuide.tsx +0 -23
  205. package/src/pages/HelpOrder.tsx +0 -23
  206. package/src/pages/Home.tsx +0 -36
  207. package/src/pages/IntroductoryTutorial.tsx +0 -170
  208. package/src/pages/Login.tsx +0 -47
  209. package/src/pages/MomentOption.tsx +0 -30
  210. package/src/pages/MultiCheckout.tsx +0 -31
  211. package/src/pages/MultiOrdersDetails.tsx +0 -27
  212. package/src/pages/MyOrders.tsx +0 -40
  213. package/src/pages/NetworkError.tsx +0 -24
  214. package/src/pages/NotFound.tsx +0 -22
  215. package/src/pages/OrderDetails.tsx +0 -25
  216. package/src/pages/ProductDetails.tsx +0 -55
  217. package/src/pages/Profile.tsx +0 -36
  218. package/src/pages/ReviewDriver.tsx +0 -30
  219. package/src/pages/ReviewOrder.tsx +0 -32
  220. package/src/pages/ReviewProducts.tsx +0 -30
  221. package/src/pages/Sessions.tsx +0 -22
  222. package/src/pages/Signup.tsx +0 -53
  223. package/src/pages/SpinnerLoader.tsx +0 -10
  224. package/src/pages/Splash.tsx +0 -21
@@ -1,17 +1,19 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform } from 'react-native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
3
3
  import { useLanguage, useUtils, useToast, OrderListGroups, useConfig } from 'ordering-components/native';
4
4
  import SelectDropdown from 'react-native-select-dropdown'
5
5
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
6
6
  import FeatherIcon from 'react-native-vector-icons/Feather';
7
7
  import FontistoIcon from 'react-native-vector-icons/Fontisto'
8
8
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
+
9
10
  import { useTheme } from 'styled-components/native';
10
11
  import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
11
12
  import { NotificationSetting } from '../../../../../src/components/NotificationSetting'
12
13
  import { NewOrderNotification } from '../NewOrderNotification';
14
+ import { WebsocketStatus } from '../WebsocketStatus'
13
15
 
14
- import { OText, OButton, OModal, OIconButton, OInput, OIcon } from '../shared';
16
+ import { OText, OButton, OModal, OInput, OIcon } from '../shared';
15
17
  import { NotFoundSource } from '../NotFoundSource';
16
18
  import {
17
19
  FiltersTab,
@@ -73,6 +75,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
73
75
 
74
76
  const defaultSearchList = {
75
77
  id: '',
78
+ external_id: '',
76
79
  state: '',
77
80
  city: '',
78
81
  business: '',
@@ -92,35 +95,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
92
95
  const [{ parseDate }] = useUtils()
93
96
  const [configState] = useConfig()
94
97
  const [orientationState] = useDeviceOrientation();
95
- const [, { showToast }] = useToast();
96
98
  const [openSearchModal, setOpenSearchModal] = useState(false)
97
99
  const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
98
100
  const [slaSettingTime, setSlaSettingTime] = useState(6000)
99
101
  const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
100
102
  const [search, setSearch] = useState(defaultSearchList)
101
- const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
102
- const [hour, setHour] = useState(0)
103
- const [minute, setMinute] = useState(0)
104
- const [openedSelect, setOpenedSelect] = useState('')
105
- const WIDTH_SCREEN = orientationState?.dimensions?.width
106
- const HEIGHT_SCREEN = orientationState?.dimensions?.height
107
- const IS_PORTRAIT = orientationState.orientation === PORTRAIT
108
-
109
- const preorderTypeList = [
110
- { key: null, name: t('SLA', 'SLA\'s') },
111
- { key: 'in_time', name: t('OK', 'Ok') },
112
- { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
113
- { key: 'delayed', name: t('DELAYED', 'Delayed') }
114
- ]
115
-
116
- const defaultOrderTypes = [
117
- { key: 1, name: t('DELIVERY', 'Delivery') },
118
- { key: 2, name: t('PICKUP', 'Pickup') },
119
- { key: 3, name: t('EAT_IN', 'Eat in') },
120
- { key: 4, name: t('CURBSIDE', 'Curbside') },
121
- { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
122
- ]
123
-
124
103
  const deliveryStatus = [
125
104
  {
126
105
  key: t('OK', 'Ok'),
@@ -144,6 +123,26 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
144
123
  backColor: '#E63757'
145
124
  }
146
125
  ]
126
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
127
+ const [openedSelect, setOpenedSelect] = useState('')
128
+
129
+ const HEIGHT_SCREEN = orientationState?.dimensions?.height
130
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
131
+
132
+ const preorderTypeList = [
133
+ { key: null, name: t('SLA', 'SLA\'s') },
134
+ { key: 'in_time', name: t('OK', 'Ok') },
135
+ { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
136
+ { key: 'delayed', name: t('DELAYED', 'Delayed') }
137
+ ]
138
+
139
+ const defaultOrderTypes = [
140
+ { key: 1, name: t('DELIVERY', 'Delivery') },
141
+ { key: 2, name: t('PICKUP', 'Pickup') },
142
+ { key: 3, name: t('EAT_IN', 'Eat in') },
143
+ { key: 4, name: t('CURBSIDE', 'Curbside') },
144
+ { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
145
+ ]
147
146
 
148
147
  const styles = StyleSheet.create({
149
148
  header: {
@@ -239,6 +238,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
239
238
  overflow: 'hidden',
240
239
  minHeight: 155
241
240
  },
241
+ btnBackArrow: {
242
+ borderWidth: 0,
243
+ width: 32,
244
+ height: 32,
245
+ tintColor: theme.colors.textGray,
246
+ backgroundColor: theme.colors.clear,
247
+ borderColor: theme.colors.clear,
248
+ shadowColor: theme.colors.clear,
249
+ paddingLeft: 0,
250
+ paddingRight: 0,
251
+ marginBottom: 30,
252
+ marginTop: 30
253
+ },
242
254
  rowStyle: {
243
255
  display: 'flex',
244
256
  borderBottomWidth: 0,
@@ -372,10 +384,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
372
384
  setTags({ values: [] })
373
385
  }, [currentTabSelected])
374
386
 
375
- useEffect(() => {
376
- setSelectedTabStatus(deliveryStatus)
377
- }, [])
378
-
379
387
  return (
380
388
  <>
381
389
  <View style={styles.header}>
@@ -396,6 +404,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
396
404
  />
397
405
  </IconWrapper>
398
406
  </View>
407
+ <WebsocketStatus />
399
408
  {configState?.configs?.order_deadlines_enabled?.value === '1' && (
400
409
  <View style={styles.SLAwrapper}>
401
410
  <View style={{ flex: 0.5 }}>
@@ -597,6 +606,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
597
606
  orderTitle={props.orderDetailsProps?.orderTitle}
598
607
  handleChangeOrderStatus={handleChangeOrderStatus}
599
608
  handleSendCustomerReview={handleSendCustomerReview}
609
+ isBusinessApp={isBusinessApp}
600
610
  />
601
611
  )}
602
612
  {!logisticOrders?.error?.length &&
@@ -607,6 +617,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
607
617
  onNavigationRedirect={onNavigationRedirect}
608
618
  getOrderStatus={getOrderStatus}
609
619
  handleClickLogisticOrder={handleClickLogisticOrder}
620
+ isBusinessApp={isBusinessApp}
610
621
  isLogisticOrder
611
622
  />
612
623
  )
@@ -696,20 +707,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
696
707
  <ModalContainer
697
708
  nestedScrollEnabled={true}
698
709
  >
699
- <OIconButton
700
- icon={theme.images.general.arrow_left}
701
- borderColor={theme.colors.clear}
702
- iconColor={theme.colors.backArrow}
703
- iconStyle={{ width: 20, height: 13 }}
704
- style={{
705
- maxWidth: 40,
706
- height: 35,
707
- justifyContent: 'flex-end',
708
- marginBottom: 30,
709
- marginTop: 30
710
- }}
711
- onClick={() => handleClose()}
712
- />
710
+ <TouchableOpacity onPress={() => handleClose()} style={styles.btnBackArrow}>
711
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
712
+ </TouchableOpacity>
713
713
  {openSearchModal && (
714
714
  <SearchModalContent>
715
715
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
@@ -728,6 +728,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
728
728
  onPress={() => setSearch({ ...search, id: '' })}
729
729
  />
730
730
  </InputContainer>
731
+ <InputContainer>
732
+ <OInput
733
+ value={search.external_id}
734
+ onChange={(value: any) => setSearch({ ...search, external_id: value })}
735
+ style={styles.inputStyle}
736
+ placeholder={t('EXTERNAL_ID', 'External id')}
737
+ autoCorrect={false}
738
+ />
739
+ <AntDesignIcon
740
+ name='close'
741
+ size={20}
742
+ style={{ position: 'absolute', right: 12, top: 13 }}
743
+ onPress={() => setSearch({ ...search, external_id: '' })}
744
+ />
745
+ </InputContainer>
731
746
  <OrdersOptionDate
732
747
  {...props}
733
748
  search={search}
@@ -917,15 +932,13 @@ export const Timer = () => {
917
932
  return (
918
933
  <TimerInputWrapper>
919
934
  <OText style={styles.settingTime} color={theme.colors.disabled}>{configs?.order_deadlines_delayed_time?.value}</OText>
920
- <OText>{t('MIN', 'min')}</OText>
935
+ <OText>{t('TIME_MIN', 'min')}</OText>
921
936
  </TimerInputWrapper>
922
937
  )
923
938
  }
924
939
 
925
940
  export const OrdersOption = (props: OrdersOptionParams) => {
926
941
  const [, t] = useLanguage();
927
- const [configState] = useConfig()
928
- const theme = useTheme()
929
942
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
930
943
  const ordersProps = {
931
944
  ...props,
@@ -0,0 +1,103 @@
1
+ import React, { useState } from 'react'
2
+ import { Dimensions, View, StyleSheet } from 'react-native'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+ import { OButton } from '../shared'
5
+ import { useTheme } from 'styled-components/native'
6
+ import { useLanguage } from 'ordering-components/native'
7
+
8
+ export const FooterComponent = (props : any) => {
9
+ const {
10
+ loading,
11
+ reload,
12
+ pagination,
13
+ tabsFilter,
14
+ tabs,
15
+ loadMore
16
+ } = props
17
+
18
+ const theme = useTheme()
19
+ const [, t] = useLanguage()
20
+
21
+ const [orientation, setOrientation] = useState(
22
+ Dimensions.get('window').width < Dimensions.get('window').height
23
+ ? 'Portrait'
24
+ : 'Landscape',
25
+ );
26
+
27
+ Dimensions.addEventListener('change', ({ window: { width, height } }) => {
28
+ if (width < height) {
29
+ setOrientation('Portrait');
30
+ } else {
31
+ setOrientation('Landscape');
32
+ }
33
+ });
34
+
35
+ const styles = StyleSheet.create({
36
+ loadButton: {
37
+ borderRadius: 7.6,
38
+ height: 44,
39
+ marginRight: 10,
40
+ marginBottom: 10,
41
+ marginTop: 5,
42
+ },
43
+ loadButtonText: {
44
+ color: theme.colors.white,
45
+ fontFamily: 'Poppins',
46
+ fontStyle: 'normal',
47
+ fontWeight: 'normal',
48
+ fontSize: 18,
49
+ },
50
+ })
51
+
52
+ return (
53
+ <>
54
+ {(loading || reload) && (
55
+ <>
56
+ <View>
57
+ {[...Array(5)].map((item, i) => (
58
+ <Placeholder key={i} Animation={Fade}>
59
+ <View
60
+ style={{
61
+ width: '100%',
62
+ flexDirection: 'row',
63
+ marginBottom: 10,
64
+ }}>
65
+ <PlaceholderLine
66
+ width={orientation === 'Portrait' ? 22 : 11}
67
+ height={74}
68
+ style={{
69
+ marginRight: 20,
70
+ marginBottom: 20,
71
+ borderRadius: 7.6,
72
+ }}
73
+ />
74
+ <Placeholder>
75
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
76
+ <PlaceholderLine width={50} />
77
+ <PlaceholderLine width={20} />
78
+ </Placeholder>
79
+ </View>
80
+ </Placeholder>
81
+ ))}
82
+ </View>
83
+ </>
84
+ )}
85
+
86
+ {pagination?.totalPages &&
87
+ !loading &&
88
+ !reload &&
89
+ JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) &&
90
+ pagination?.currentPage < pagination?.totalPages && (
91
+ <OButton
92
+ onClick={() => loadMore && loadMore()}
93
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
94
+ imgRightSrc={null}
95
+ textStyle={styles.loadButtonText}
96
+ style={styles.loadButton}
97
+ bgColor={theme.colors.primary}
98
+ borderColor={theme.colors.primary}
99
+ />
100
+ )}
101
+ </>
102
+ )
103
+ }
@@ -1,17 +1,31 @@
1
- import React from 'react';
2
- import { StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
1
+ import React, { useState } from 'react';
2
+ import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useLanguage, useUtils } from 'ordering-components/native';
5
5
  import { Card, Logo, Information, Header, Badge } from './styles';
6
6
  import { OIcon, OText } from '../shared';
7
7
  import { PreviousMessagesParams } from '../../types';
8
+ import { FooterComponent } from './FooterMessageComponent';
8
9
 
9
10
  export const PreviousMessages = (props: PreviousMessagesParams) => {
10
- const { orders, onNavigationRedirect, setOrders } = props;
11
+ const {
12
+ orders,
13
+ onNavigationRedirect,
14
+ setOrders,
15
+ getOrders,
16
+ pagination,
17
+ loading,
18
+ reload,
19
+ tabs,
20
+ loadMore,
21
+ tabsFilter,
22
+ error
23
+ } = props;
11
24
 
12
25
  const [, t] = useLanguage();
13
26
  const theme = useTheme();
14
27
  const [{ parseDate, optimizeImage }] = useUtils();
28
+ const [refreshing] = useState(false);
15
29
 
16
30
  const handlePressOrder = (order: any) => {
17
31
  const uuid = order?.id;
@@ -253,63 +267,91 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
253
267
  fontStyle: 'normal',
254
268
  fontWeight: 'normal',
255
269
  color: theme.colors.orderTypeColor,
256
- },
270
+ }
257
271
  });
258
272
 
259
- return (
260
- <>
261
- {orders?.length > 0 &&
262
- orders?.map((order: any) => (
263
- <TouchableOpacity
264
- key={order?.id}
265
- onPress={() => handlePressOrder(order)}
266
- style={styles.cardButton}
267
- activeOpacity={1}>
268
- <Card key={order?.id}>
269
- <Logo style={styles.logo}>
270
- <OIcon
271
- url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
272
- src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
273
- style={styles.icon}
274
- />
275
- </Logo>
276
- <Information>
277
- <Header>
278
- <OText numberOfLines={1} style={styles.title}>
279
- {order?.business?.name}
280
- </OText>
273
+ const MessageComponent = (props : any) => {
274
+ const order = props.item
275
+ return (
276
+ <>
277
+ {!reload &&
278
+ !error &&
279
+ JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) && (
280
+ <TouchableOpacity
281
+ key={order?.id}
282
+ onPress={() => handlePressOrder(order)}
283
+ style={styles.cardButton}
284
+ activeOpacity={1}>
285
+ <Card key={order?.id}>
286
+ <Logo style={styles.logo}>
287
+ <OIcon
288
+ url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
289
+ src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
290
+ style={styles.icon}
291
+ />
292
+ </Logo>
293
+ <Information>
294
+ <Header>
295
+ <OText numberOfLines={1} style={styles.title}>
296
+ {order?.business?.name}
297
+ </OText>
281
298
 
282
- {order?.unread_count > 0 && (
283
- <Badge>
284
- <OText size={14} style={styles.badge}>
285
- {order?.unread_count}
286
- </OText>
287
- </Badge>
288
- )}
289
- </Header>
299
+ {order?.unread_count > 0 && (
300
+ <Badge>
301
+ <OText size={14} style={styles.badge}>
302
+ {order?.unread_count}
303
+ </OText>
304
+ </Badge>
305
+ )}
306
+ </Header>
290
307
 
291
- <OText
292
- style={styles.date}
293
- numberOfLines={1}
294
- adjustsFontSizeToFit
295
- size={20}>
296
- {t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
297
- {order?.delivery_datetime_utc
298
- ? parseDate(order?.delivery_datetime_utc)
299
- : parseDate(order?.delivery_datetime, { utc: false })}
300
- </OText>
308
+ <OText
309
+ style={styles.date}
310
+ numberOfLines={1}
311
+ adjustsFontSizeToFit
312
+ size={20}>
313
+ {t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
314
+ {order?.delivery_datetime_utc
315
+ ? parseDate(order?.delivery_datetime_utc)
316
+ : parseDate(order?.delivery_datetime, { utc: false })}
317
+ </OText>
301
318
 
302
- <OText
303
- style={styles.orderType}
304
- mRight={5}
305
- numberOfLines={1}
306
- adjustsFontSizeToFit>
307
- {getOrderStatus(order?.status)?.value}
308
- </OText>
309
- </Information>
310
- </Card>
311
- </TouchableOpacity>
312
- ))}
319
+ <OText
320
+ style={styles.orderType}
321
+ mRight={5}
322
+ numberOfLines={1}
323
+ adjustsFontSizeToFit>
324
+ {getOrderStatus(order?.status)?.value}
325
+ </OText>
326
+ </Information>
327
+ </Card>
328
+ </TouchableOpacity>
329
+ )}
330
+ </>
331
+ )
332
+ }
333
+
334
+ return (
335
+ <>
336
+ <FlatList
337
+ data={orders}
338
+ renderItem={MessageComponent}
339
+ keyExtractor={(order) => order?.id}
340
+ showsVerticalScrollIndicator={false}
341
+ style={{ flex: 1 }}
342
+ refreshControl={<RefreshControl
343
+ refreshing={refreshing}
344
+ onRefresh={() => getOrders?.()}
345
+ />}
346
+ ListFooterComponent={<FooterComponent
347
+ loading={loading}
348
+ reload={reload}
349
+ pagination={pagination}
350
+ tabsFilter={tabsFilter}
351
+ tabs={tabs}
352
+ loadMore={loadMore}
353
+ />}
354
+ />
313
355
  </>
314
356
  );
315
357
  };
@@ -21,7 +21,13 @@ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrienta
21
21
 
22
22
  const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
23
23
 
24
- export const OrderItem = (props: any) => {
24
+ function OrderItemPropsAreEqual(prevProps: any, nextProps: any) {
25
+ return JSON.stringify(prevProps.order) === JSON.stringify(nextProps.order) &&
26
+ JSON.stringify(prevProps._order) === JSON.stringify(nextProps._order) &&
27
+ prevProps.currentTabSelected === nextProps.currentTabSelected
28
+ }
29
+
30
+ export const OrderItem = React.memo((props: any) => {
25
31
  const {
26
32
  order,
27
33
  _order,
@@ -97,10 +103,10 @@ export const OrderItem = (props: any) => {
97
103
  const offset = 300
98
104
  const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
99
105
  const _delivery = order?.delivery_datetime_utc
100
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
101
- : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
106
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
107
+ : parseDate(cdtToutc)
102
108
  const _eta = order?.eta_time
103
- const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
109
+ const diffTimeAsSeconds = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'seconds')
104
110
  return Math.ceil(diffTimeAsSeconds / 60)
105
111
  }
106
112
 
@@ -122,12 +128,6 @@ export const OrderItem = (props: any) => {
122
128
  return finalTaget
123
129
  }
124
130
 
125
- const getStatusClassName = (minutes: number) => {
126
- if (isNaN(Number(minutes))) return 'in_time'
127
- const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
128
- return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
129
- }
130
-
131
131
  useEffect(() => {
132
132
  const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
133
133
  setAllowColumns({
@@ -145,17 +145,9 @@ export const OrderItem = (props: any) => {
145
145
  onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
146
146
  >
147
147
  <Card key={order.id}>
148
- {allowColumns?.slaBar && (
148
+ {!!allowColumns?.slaBar && (
149
149
  <Timestatus
150
- style={{
151
- backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time'
152
- ? '#00D27A'
153
- : getStatusClassName(getDelayMinutes(order)) === 'at_risk'
154
- ? '#FFC700'
155
- : getStatusClassName(getDelayMinutes(order)) === 'delayed'
156
- ? '#E63757'
157
- : ''
158
- }}
150
+ timeState={order?.time_status}
159
151
  />
160
152
  )}
161
153
  <Logo style={styles.logo}>
@@ -195,12 +187,12 @@ export const OrderItem = (props: any) => {
195
187
  numberOfLines={1}
196
188
  adjustsFontSizeToFit
197
189
  >
198
- {(order?.order_group_id && order?.order_group && isLogisticOrder
199
- ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
200
- : (t('NO', 'Order No.') + order.id)
201
- ) + ' · '}
190
+ {(!!order?.order_group_id && order?.order_group && isLogisticOrder
191
+ ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
192
+ : (t('NO', 'Order No.') + order.id)
193
+ ) + ' · '}
202
194
  {order?.delivery_datetime_utc
203
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
195
+ ? parseDate(order?.delivery_datetime_utc)
204
196
  : parseDate(order?.delivery_datetime, { utc: false })}
205
197
  </OText>
206
198
  {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
@@ -209,11 +201,11 @@ export const OrderItem = (props: any) => {
209
201
  <OText
210
202
  style={styles.date}
211
203
  color={
212
- getStatusClassName(getDelayMinutes(order)) === 'in_time'
204
+ order?.time_status === 'in_time'
213
205
  ? '#00D27A'
214
- : getStatusClassName(getDelayMinutes(order)) === 'at_risk'
206
+ : order?.time_status === 'at_risk'
215
207
  ? '#FFC700'
216
- : getStatusClassName(getDelayMinutes(order)) === 'delayed'
208
+ : order?.time_status === 'delayed'
217
209
  ? '#E63757'
218
210
  : ''}
219
211
  >
@@ -247,4 +239,4 @@ export const OrderItem = (props: any) => {
247
239
  </Card>
248
240
  </TouchableOpacity>
249
241
  )
250
- }
242
+ }, OrderItemPropsAreEqual)