ordering-ui-react-native 0.21.47 → 0.21.48-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 (207) hide show
  1. package/package.json +8 -8
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  18. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  19. package/themes/business/src/components/Home/index.tsx +5 -1
  20. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  21. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  22. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  23. package/themes/business/src/components/MapView/index.tsx +30 -15
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  26. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +30 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +40 -20
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  32. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  33. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  34. package/themes/business/src/components/OrdersOption/index.tsx +253 -135
  35. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  36. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  37. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  38. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  39. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  40. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  41. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  42. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  43. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  46. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  47. package/themes/business/src/components/Sessions/index.tsx +187 -0
  48. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  49. package/themes/business/src/components/StoresList/index.tsx +5 -3
  50. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  51. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OInput.tsx +2 -0
  55. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  56. package/themes/business/src/hooks/useLocation.tsx +5 -4
  57. package/themes/business/src/types/index.tsx +21 -5
  58. package/themes/business/src/utils/index.tsx +5 -0
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +6 -2
  68. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  69. package/themes/original/src/components/AddressForm/index.tsx +41 -12
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +18 -4
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  78. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  79. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  82. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  85. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
  87. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  90. package/themes/original/src/components/BusinessProductsListing/index.tsx +31 -18
  91. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  92. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +144 -62
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  107. package/themes/original/src/components/Favorite/index.tsx +9 -9
  108. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  109. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  110. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  111. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  116. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  117. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  118. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  119. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  120. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  121. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  122. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  123. package/themes/original/src/components/Help/index.tsx +7 -0
  124. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  125. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  126. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  128. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  129. package/themes/original/src/components/Home/index.tsx +3 -8
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  131. package/themes/original/src/components/LoginForm/index.tsx +9 -3
  132. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  133. package/themes/original/src/components/Messages/index.tsx +8 -7
  134. package/themes/original/src/components/Messages/styles.tsx +1 -1
  135. package/themes/original/src/components/MomentOption/index.tsx +19 -4
  136. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  137. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  138. package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
  139. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  140. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  141. package/themes/original/src/components/MyOrders/index.tsx +28 -28
  142. package/themes/original/src/components/NavBar/index.tsx +5 -0
  143. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  144. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  145. package/themes/original/src/components/Notifications/index.tsx +9 -8
  146. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  147. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  148. package/themes/original/src/components/OrderDetails/index.tsx +701 -662
  149. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  150. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  151. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  152. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  156. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  157. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  158. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
  161. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  162. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  163. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  164. package/themes/original/src/components/ProductForm/index.tsx +170 -252
  165. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
  166. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  167. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  168. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  169. package/themes/original/src/components/Promotions/index.tsx +13 -11
  170. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  171. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  172. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  174. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  175. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  176. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  177. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  178. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  179. package/themes/original/src/components/Sessions/index.tsx +5 -0
  180. package/themes/original/src/components/SignupForm/index.tsx +67 -59
  181. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  182. package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
  183. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  184. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
  186. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  187. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  188. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  190. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  191. package/themes/original/src/components/UserFormDetails/index.tsx +100 -86
  192. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  193. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  194. package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
  195. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  196. package/themes/original/src/components/Wallets/index.tsx +7 -4
  197. package/themes/original/src/components/Wallets/styles.tsx +2 -1
  198. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  199. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  200. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  201. package/themes/original/src/components/shared/OButton.tsx +5 -5
  202. package/themes/original/src/components/shared/OInput.tsx +1 -4
  203. package/themes/original/src/components/shared/OModal.tsx +12 -14
  204. package/themes/original/src/layouts/Container.tsx +5 -3
  205. package/themes/original/src/types/index.tsx +4 -1
  206. package/themes/original/src/utils/index.tsx +12 -1
  207. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -6,11 +6,14 @@ 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
+ import RNRestart from 'react-native-restart'
9
10
 
10
11
  import { useTheme } from 'styled-components/native';
11
12
  import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
12
13
  import { NotificationSetting } from '../../../../../src/components/NotificationSetting'
13
14
  import { NewOrderNotification } from '../NewOrderNotification';
15
+ import { WebsocketStatus } from '../WebsocketStatus'
16
+ import { _retrieveStoreData, _setStoreData } from '../../providers/StoreUtil'
14
17
 
15
18
  import { OText, OButton, OModal, OInput, OIcon } from '../shared';
16
19
  import { NotFoundSource } from '../NotFoundSource';
@@ -49,8 +52,10 @@ const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
49
52
 
50
53
  const OrdersOptionUI = (props: OrdersOptionParams) => {
51
54
  const {
55
+ navigation,
52
56
  setCurrentFilters,
53
57
  tabs,
58
+ isNetConnected,
54
59
  currentTabSelected,
55
60
  setCurrentTabSelected,
56
61
  ordersGroup,
@@ -67,13 +72,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
67
72
  logisticOrders,
68
73
  loadLogisticOrders,
69
74
  isLogisticActivated,
70
- isAlsea,
71
75
  handleChangeOrderStatus,
72
76
  handleSendCustomerReview
73
77
  } = props;
74
78
 
75
79
  const defaultSearchList = {
76
80
  id: '',
81
+ external_id: '',
77
82
  state: '',
78
83
  city: '',
79
84
  business: '',
@@ -92,33 +97,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
92
97
  const [, t] = useLanguage();
93
98
  const [{ parseDate }] = useUtils()
94
99
  const [configState] = useConfig()
100
+
95
101
  const [orientationState] = useDeviceOrientation();
96
102
  const [openSearchModal, setOpenSearchModal] = useState(false)
97
103
  const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
98
104
  const [slaSettingTime, setSlaSettingTime] = useState(6000)
99
105
  const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
100
106
  const [search, setSearch] = useState(defaultSearchList)
101
- const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
102
- const [openedSelect, setOpenedSelect] = useState('')
103
-
104
- const HEIGHT_SCREEN = orientationState?.dimensions?.height
105
- const IS_PORTRAIT = orientationState.orientation === PORTRAIT
106
-
107
- const preorderTypeList = [
108
- { key: null, name: t('SLA', 'SLA\'s') },
109
- { key: 'in_time', name: t('OK', 'Ok') },
110
- { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
111
- { key: 'delayed', name: t('DELAYED', 'Delayed') }
112
- ]
113
-
114
- const defaultOrderTypes = [
115
- { key: 1, name: t('DELIVERY', 'Delivery') },
116
- { key: 2, name: t('PICKUP', 'Pickup') },
117
- { key: 3, name: t('EAT_IN', 'Eat in') },
118
- { key: 4, name: t('CURBSIDE', 'Curbside') },
119
- { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
120
- ]
121
-
122
107
  const deliveryStatus = [
123
108
  {
124
109
  key: t('OK', 'Ok'),
@@ -142,6 +127,30 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
142
127
  backColor: '#E63757'
143
128
  }
144
129
  ]
130
+ const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
131
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
132
+ const [openedSelect, setOpenedSelect] = useState('')
133
+ const [lastDateConnection, setLastDateConnection] = useState(null)
134
+ const [internetLoading, setInternetLoading] = useState(!isNetConnected && isNetConnected !== null)
135
+
136
+ const HEIGHT_SCREEN = orientationState?.dimensions?.height
137
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
138
+ const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
139
+
140
+ const preorderTypeList = [
141
+ { key: null, name: t('SLA', 'SLA\'s') },
142
+ { key: 'in_time', name: t('OK', 'Ok') },
143
+ { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
144
+ { key: 'delayed', name: t('DELAYED', 'Delayed') }
145
+ ]
146
+
147
+ const defaultOrderTypes = [
148
+ { key: 1, name: t('DELIVERY', 'Delivery') },
149
+ { key: 2, name: t('PICKUP', 'Pickup') },
150
+ { key: 3, name: t('EAT_IN', 'Eat in') },
151
+ { key: 4, name: t('CURBSIDE', 'Curbside') },
152
+ { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
153
+ ]
145
154
 
146
155
  const styles = StyleSheet.create({
147
156
  header: {
@@ -377,28 +386,86 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
377
386
  }
378
387
 
379
388
  useEffect(() => {
380
- scrollRefTab.current?.scrollTo({ animated: true });
381
- scrollListRef.current?.scrollTo({ animated: true });
382
- scrollRef.current?.scrollTo({ y: 0, animated: true });
389
+ scrollRefTab.current?.scrollTo();
390
+ scrollListRef.current?.scrollTo();
391
+ scrollRef.current?.scrollTo();
383
392
  setTags({ values: [] })
384
393
  }, [currentTabSelected])
385
394
 
395
+ useEffect(() => {
396
+ const unsubcribe = navigation.addListener('focus', () => {
397
+ currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
398
+ })
399
+ return unsubcribe
400
+ }, [navigation, loadLogisticOrders])
401
+
386
402
  useEffect(() => {
387
- setSelectedTabStatus(deliveryStatus)
388
- }, [])
403
+ const orderStatuses = ['active', 'pending', 'inProgress', 'completed', 'cancelled']
404
+
405
+ const manageStoragedOrders = async () => {
406
+ setInternetLoading(true)
407
+ let lastConnection = await _retrieveStoreData('last_date_connection');
408
+ let ordersStoraged: any = {}
409
+ for (const status of orderStatuses) {
410
+ ordersStoraged[status] = await _retrieveStoreData(`${status}_orders`) ?? []
411
+ }
412
+
413
+ if (!lastConnection) {
414
+ const formattedDate = parseDate(new Date())
415
+ lastConnection = formattedDate
416
+ _setStoreData('last_date_connection', formattedDate);
417
+ }
418
+
419
+ lastConnection && setLastDateConnection(lastConnection)
420
+
421
+ if (Object.values(ordersStoraged).every((key: any) => Array.isArray(key) && !key?.length)) {
422
+ for (const status of orderStatuses) {
423
+ ordersStoraged[status] = ordersGroup[status]?.orders
424
+ _setStoreData(`${status}_orders`, ordersGroup[status]?.orders);
425
+ }
426
+ }
427
+
428
+ if (Object.values(ordersStoraged).some((key: any) => Array.isArray(key) && key?.length)) {
429
+ let newOrderGroup = {
430
+ ...ordersGroup
431
+ }
432
+ for (const status of orderStatuses) {
433
+ newOrderGroup[status] = {
434
+ ...ordersGroup[status],
435
+ error: null,
436
+ orders: ordersStoraged[status]
437
+ }
438
+ }
439
+ setOrdersGroup(newOrderGroup)
440
+ }
441
+ setInternetLoading(false)
442
+ };
443
+
444
+ if (isNetConnected) {
445
+ _setStoreData('last_date_connection', null);
446
+ orderStatuses.forEach((key: any) => _setStoreData(`${key}_orders`, null))
447
+ } else if (isNetConnected === false) {
448
+ manageStoragedOrders()
449
+ }
450
+ }, [isNetConnected]);
389
451
 
390
452
  return (
391
453
  <>
392
454
  <View style={styles.header}>
393
455
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
394
456
  <IconWrapper>
395
- <FeatherIcon
396
- name='refresh-cw'
397
- color={theme.colors.backgroundDark}
398
- size={24}
399
- onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
400
- style={{ marginRight: 20 }}
401
- />
457
+ <View style={{ marginRight: 10 }}>
458
+ <WebsocketStatus />
459
+ </View>
460
+ {isNetConnected && (
461
+ <FeatherIcon
462
+ name='refresh-cw'
463
+ color={theme.colors.backgroundDark}
464
+ size={24}
465
+ onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
466
+ style={{ marginRight: 20 }}
467
+ />
468
+ )}
402
469
  <FontistoIcon
403
470
  name='search'
404
471
  color={theme.colors.backgroundDark}
@@ -407,57 +474,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
407
474
  />
408
475
  </IconWrapper>
409
476
  </View>
410
- {configState?.configs?.order_deadlines_enabled?.value === '1' && (
411
- <View style={styles.SLAwrapper}>
412
- <View style={{ flex: 0.5 }}>
413
- <OButton
414
- text={t('SLA_SETTING', 'SLA’s Settings')}
415
- textStyle={{ color: theme.colors.backArrow }}
416
- imgRightSrc={null}
417
- style={{
418
- backgroundColor: theme.colors.inputChat,
419
- borderRadius: 7.6,
420
- zIndex: 10,
421
- borderWidth: 0,
422
- minHeight: 40
423
- }}
424
- onClick={onClickSetting}
425
- />
426
- </View>
427
- <View style={{ width: 10, height: '100%' }} />
428
- <View style={{ flex: 0.5, justifyContent: 'center' }}>
429
- <SelectDropdown
430
- defaultButtonText={t('SLA', 'SLA\'s')}
431
- data={preorderTypeList}
432
- onSelect={(selectedItem, index) => {
433
- onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
434
- }}
435
- buttonTextAfterSelection={(selectedItem, index) => {
436
- return selectedItem.name
437
- }}
438
- rowTextForSelection={(item, index) => {
439
- return item.key
440
- }}
441
- buttonStyle={styles.selectOption}
442
- buttonTextStyle={styles.buttonTextStyle}
443
- renderDropdownIcon={isOpened => {
444
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
445
- }}
446
- dropdownStyle={styles.dropdownStyle}
447
- dropdownOverlayColor='transparent'
448
- rowStyle={styles.rowStyle}
449
- renderCustomizedRowChild={(item, index) => {
450
- return (
451
- <SlaOption>
452
- {index !== 0 && <OrderStatus timeState={item?.key} />}
453
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
454
- </SlaOption>
455
- );
456
- }}
457
- />
458
- </View>
459
- </View>
460
- )}
461
477
  <FiltersTab>
462
478
  <ScrollView
463
479
  ref={scrollRefTab}
@@ -467,7 +483,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
467
483
  nestedScrollEnabled={true}
468
484
  >
469
485
  <TabsContainer>
470
- {(isLogisticActivated && !isBusinessApp) && (
486
+ {(isLogisticActivated && !isBusinessApp && !combineTabs) && (
471
487
  <Pressable
472
488
  style={styles.pressable}
473
489
  onPress={() => setCurrentTabSelected('logisticOrders')}>
@@ -512,7 +528,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
512
528
  </ScrollView>
513
529
  </FiltersTab>
514
530
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
515
- {currentTabSelected !== 'logisticOrders' && !isAlsea && (
531
+ {showTagsList && (
516
532
  <View
517
533
  style={{
518
534
  display: 'flex',
@@ -579,6 +595,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
579
595
  </ScrollView>
580
596
  </View>
581
597
  )}
598
+ {isNetConnected === false && lastDateConnection && (
599
+ <View
600
+ style={{
601
+ borderRadius: 8,
602
+ paddingVertical: 3,
603
+ backgroundColor: theme.colors.danger500,
604
+ marginBottom: 10
605
+ }}
606
+ >
607
+ <OText
608
+ style={{ color: 'white', textAlign: 'center' }}
609
+ >
610
+ {`${t('LAST_UPDATE', 'Last Update')}: ${lastDateConnection}`}
611
+ </OText>
612
+ </View>
613
+ )}
582
614
  <ScrollView
583
615
  ref={scrollListRef}
584
616
  showsVerticalScrollIndicator={false}
@@ -587,7 +619,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
587
619
  refreshControl={
588
620
  <RefreshControl
589
621
  refreshing={refreshing}
590
- onRefresh={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
622
+ onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
591
623
  />
592
624
  }
593
625
  >
@@ -624,42 +656,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
624
656
  />
625
657
  )
626
658
  }
627
- {((currentOrdersGroup?.loading ||
628
- currentOrdersGroup?.pagination?.total === null) ||
629
- (logisticOrders?.loading)) &&
659
+ {(
630
660
  (
631
- <>
632
- <View>
633
- {[...Array(5)].map((_, i) => (
634
- <Placeholder key={i} Animation={Fade}>
635
- <View
636
- style={{
637
- width: '100%',
638
- flexDirection: 'row',
639
- marginBottom: 10,
640
- }}>
641
- <PlaceholderLine
642
- width={IS_PORTRAIT ? 22 : 11}
643
- height={74}
644
- style={{
645
- marginRight: 20,
646
- marginBottom: 20,
647
- borderRadius: 7.6,
648
- }}
649
- />
650
- <Placeholder>
651
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
652
- <PlaceholderLine width={50} />
653
- <PlaceholderLine width={20} />
654
- </Placeholder>
655
- </View>
661
+ (
662
+ currentOrdersGroup?.loading ||
663
+ (currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
664
+ logisticOrders?.loading
665
+ ) &&
666
+ !currentOrdersGroup?.error?.length &&
667
+ !currentOrdersGroup?.orders?.length
668
+ ) || internetLoading
669
+ ) && (
670
+ <View>
671
+ {[...Array(5)].map((_, i) => (
672
+ <Placeholder key={i} Animation={Fade}>
673
+ <View
674
+ style={{
675
+ width: '100%',
676
+ flexDirection: 'row',
677
+ marginBottom: 10,
678
+ }}>
679
+ <PlaceholderLine
680
+ width={IS_PORTRAIT ? 22 : 11}
681
+ height={74}
682
+ style={{
683
+ marginRight: 20,
684
+ marginBottom: 20,
685
+ borderRadius: 7.6,
686
+ }}
687
+ />
688
+ <Placeholder>
689
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
690
+ <PlaceholderLine width={50} />
691
+ <PlaceholderLine width={20} />
656
692
  </Placeholder>
657
- ))}
658
- </View>
659
- </>
660
- )}
693
+ </View>
694
+ </Placeholder>
695
+ ))}
696
+ </View>
697
+ )}
661
698
 
662
- {!currentOrdersGroup?.error?.length &&
699
+ {isNetConnected &&
700
+ !currentOrdersGroup?.error?.length &&
663
701
  !currentOrdersGroup?.loading &&
664
702
  currentOrdersGroup?.pagination?.totalPages &&
665
703
  currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
@@ -676,7 +714,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
676
714
  />
677
715
  )}
678
716
 
679
- {((!currentOrdersGroup?.loading &&
717
+ {!internetLoading &&
718
+ ((!currentOrdersGroup?.loading &&
680
719
  (currentOrdersGroup?.error?.length ||
681
720
  currentOrdersGroup?.orders?.length === 0)) ||
682
721
  (currentTabSelected === 'logisticOrders' &&
@@ -685,6 +724,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
685
724
  (
686
725
  <NotFoundSource
687
726
  content={
727
+ !isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
688
728
  ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
689
729
  (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
690
730
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
@@ -695,6 +735,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
695
735
  }
696
736
  image={theme.images.general.notFound}
697
737
  conditioned={false}
738
+ btnTitle={!isNetConnected && t('REFRESH', 'Refresh')}
739
+ onClickButton={!isNetConnected && (() => RNRestart.Restart())}
698
740
  />
699
741
  )}
700
742
  </ScrollView>
@@ -715,6 +757,41 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
715
757
  {openSearchModal && (
716
758
  <SearchModalContent>
717
759
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
760
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
761
+ <InputContainer style={{ marginBottom: 24 }}>
762
+ <SelectDropdown
763
+ defaultButtonText={search?.timeStatus
764
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
765
+ : t('SLA', 'SLA\'s')}
766
+ data={preorderTypeList}
767
+ onSelect={(selectedItem, index) => {
768
+ setSearch({ ...search, timeStatus: selectedItem?.key })
769
+ }}
770
+ buttonTextAfterSelection={(selectedItem, index) => {
771
+ return selectedItem.name
772
+ }}
773
+ rowTextForSelection={(item, index) => {
774
+ return item.key
775
+ }}
776
+ buttonStyle={styles.selectOption}
777
+ buttonTextStyle={styles.buttonTextStyle}
778
+ renderDropdownIcon={isOpened => {
779
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
780
+ }}
781
+ dropdownStyle={styles.dropdownStyle}
782
+ dropdownOverlayColor='transparent'
783
+ rowStyle={styles.rowStyle}
784
+ renderCustomizedRowChild={(item, index) => {
785
+ return (
786
+ <SlaOption>
787
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
788
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
789
+ </SlaOption>
790
+ );
791
+ }}
792
+ />
793
+ </InputContainer>
794
+ )}
718
795
  <InputContainer>
719
796
  <OInput
720
797
  value={search.id}
@@ -730,6 +807,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
730
807
  onPress={() => setSearch({ ...search, id: '' })}
731
808
  />
732
809
  </InputContainer>
810
+ <InputContainer>
811
+ <OInput
812
+ value={search.external_id}
813
+ onChange={(value: any) => setSearch({ ...search, external_id: value })}
814
+ style={styles.inputStyle}
815
+ placeholder={t('EXTERNAL_ID', 'External id')}
816
+ autoCorrect={false}
817
+ />
818
+ <AntDesignIcon
819
+ name='close'
820
+ size={20}
821
+ style={{ position: 'absolute', right: 12, top: 13 }}
822
+ onPress={() => setSearch({ ...search, external_id: '' })}
823
+ />
824
+ </InputContainer>
733
825
  <OrdersOptionDate
734
826
  {...props}
735
827
  search={search}
@@ -919,14 +1011,16 @@ export const Timer = () => {
919
1011
  return (
920
1012
  <TimerInputWrapper>
921
1013
  <OText style={styles.settingTime} color={theme.colors.disabled}>{configs?.order_deadlines_delayed_time?.value}</OText>
922
- <OText>{t('MIN', 'min')}</OText>
1014
+ <OText>{t('TIME_MIN', 'min')}</OText>
923
1015
  </TimerInputWrapper>
924
1016
  )
925
1017
  }
926
1018
 
927
1019
  export const OrdersOption = (props: OrdersOptionParams) => {
928
1020
  const [, t] = useLanguage();
1021
+ const [configState] = useConfig()
929
1022
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
1023
+ const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
930
1024
  const ordersProps = {
931
1025
  ...props,
932
1026
  UIComponent: OrdersOptionUI,
@@ -1013,32 +1107,52 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1013
1107
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
1014
1108
  }
1015
1109
  ],
1016
- tabs: [
1110
+ tabs: combineTabs ? [
1017
1111
  {
1018
1112
  key: 0,
1019
- text: t('PENDING', 'Pending'),
1020
- tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1021
- title: 'pending'
1113
+ text: t('ACTIVE', 'Active'),
1114
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
1115
+ title: 'active',
1022
1116
  },
1023
1117
  {
1024
1118
  key: 1,
1025
- text: t('IN_PROGRESS', 'In Progress'),
1026
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1027
- title: 'inProgress',
1028
- },
1029
- {
1030
- key: 2,
1031
1119
  text: t('COMPLETED', 'Completed'),
1032
1120
  tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1033
1121
  title: 'completed',
1034
1122
  },
1035
1123
  {
1036
- key: 3,
1124
+ key: 2,
1037
1125
  text: t('CANCELLED', 'Cancelled'),
1038
1126
  tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1039
1127
  title: 'cancelled',
1040
1128
  },
1041
- ]
1129
+ ] :
1130
+ [
1131
+ {
1132
+ key: 0,
1133
+ text: t('PENDING', 'Pending'),
1134
+ tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1135
+ title: 'pending'
1136
+ },
1137
+ {
1138
+ key: 1,
1139
+ text: t('IN_PROGRESS', 'In Progress'),
1140
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1141
+ title: 'inProgress',
1142
+ },
1143
+ {
1144
+ key: 2,
1145
+ text: t('COMPLETED', 'Completed'),
1146
+ tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1147
+ title: 'completed',
1148
+ },
1149
+ {
1150
+ key: 3,
1151
+ text: t('CANCELLED', 'Cancelled'),
1152
+ tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1153
+ title: 'cancelled',
1154
+ },
1155
+ ]
1042
1156
  };
1043
1157
 
1044
1158
  return (<>
@@ -1049,3 +1163,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1049
1163
  )}
1050
1164
  </>);
1051
1165
  };
1166
+
1167
+ OrdersOption.defaultProps = {
1168
+ isNetConnected: true
1169
+ }
@@ -6,7 +6,7 @@ import { useTheme } from 'styled-components/native';
6
6
  import { Wrapper } from './styles';
7
7
  import { OText, OIcon } from '../shared';
8
8
  import { PhoneInputParams } from '../../types';
9
- import { transformCountryCode } from '../../utils';
9
+ import { transformCountryCode, findExitingCode } from '../../utils';
10
10
 
11
11
  export const PhoneInputNumber = (props: PhoneInputParams) => {
12
12
  const {
@@ -97,10 +97,13 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
97
97
  containerStyle={{ width: '100%' }}
98
98
  ref={phoneInput}
99
99
  defaultValue={userphoneNumber || defaultValue}
100
- defaultCode={
101
- defaultCode
102
- ? transformCountryCode(defaultCode)
103
- : configs?.default_country_code?.value
100
+ defaultCode={defaultCode ?
101
+ !isNaN(defaultCode)
102
+ ? transformCountryCode(defaultCode)
103
+ : findExitingCode(defaultCode)
104
+ : !isNaN((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
105
+ ? transformCountryCode((configs?.default_country_code?.value || '')?.replace(/\+/g, ''))
106
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())
104
107
  }
105
108
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
106
109
  countryPickerProps={{