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