ordering-ui-react-native 0.21.94 → 0.21.95-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 (160) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/StripeMethodForm/index.tsx +6 -4
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/context/OfflineActions/index.tsx +236 -0
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  10. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  11. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  12. package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
  13. package/themes/business/src/components/Chat/index.tsx +15 -3
  14. package/themes/business/src/components/DriverMap/index.tsx +49 -27
  15. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  16. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  17. package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
  18. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  19. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  20. package/themes/business/src/components/MapView/index.tsx +36 -17
  21. package/themes/business/src/components/NewOrderNotification/index.tsx +49 -29
  22. package/themes/business/src/components/OrderDetails/Business.tsx +74 -9
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +138 -55
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -43
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +62 -24
  26. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  27. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  29. package/themes/business/src/components/OrderSummary/index.tsx +210 -65
  30. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  31. package/themes/business/src/components/OrdersOption/index.tsx +219 -150
  32. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  33. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +42 -20
  35. package/themes/business/src/components/PreviousOrders/index.tsx +76 -66
  36. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  37. package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
  38. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -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/ReviewCustomer/index.tsx +2 -0
  43. package/themes/business/src/components/StoresList/index.tsx +2 -2
  44. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  45. package/themes/business/src/components/UserProfileForm/index.tsx +43 -25
  46. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  50. package/themes/business/src/types/index.tsx +15 -5
  51. package/themes/business/src/utils/index.tsx +25 -1
  52. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  54. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +11 -0
  61. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  62. package/themes/original/src/components/AddressList/index.tsx +8 -7
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
  66. package/themes/original/src/components/BusinessController/index.tsx +12 -7
  67. package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  71. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
  72. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  73. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  74. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  75. package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
  76. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  77. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  78. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +43 -15
  82. package/themes/original/src/components/CartContent/index.tsx +2 -4
  83. package/themes/original/src/components/Checkout/index.tsx +104 -58
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  87. package/themes/original/src/components/Favorite/index.tsx +1 -5
  88. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  90. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  91. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  92. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  93. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  94. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  95. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  96. package/themes/original/src/components/Help/index.tsx +2 -0
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  98. package/themes/original/src/components/Home/index.tsx +2 -10
  99. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  100. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  101. package/themes/original/src/components/MessageListing/index.tsx +2 -1
  102. package/themes/original/src/components/Messages/index.tsx +29 -17
  103. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  104. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  105. package/themes/original/src/components/MultiCheckout/index.tsx +129 -85
  106. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  107. package/themes/original/src/components/MyOrders/index.tsx +10 -23
  108. package/themes/original/src/components/NavBar/index.tsx +7 -4
  109. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  110. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  111. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  112. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +13 -10
  113. package/themes/original/src/components/OrderDetails/index.tsx +42 -19
  114. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  115. package/themes/original/src/components/OrderProgress/index.tsx +16 -6
  116. package/themes/original/src/components/OrderSummary/index.tsx +29 -10
  117. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  118. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  119. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  120. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  121. package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
  122. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  123. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  124. package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
  125. package/themes/original/src/components/ProductForm/index.tsx +107 -102
  126. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  127. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  128. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  129. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  130. package/themes/original/src/components/Promotions/index.tsx +6 -9
  131. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  132. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  133. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  134. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  135. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  136. package/themes/original/src/components/Sessions/index.tsx +3 -3
  137. package/themes/original/src/components/SignupForm/index.tsx +86 -78
  138. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
  139. package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
  140. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  141. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  142. package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
  143. package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
  144. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  145. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  146. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  147. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  148. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  149. package/themes/original/src/components/UserDetails/index.tsx +3 -2
  150. package/themes/original/src/components/UserFormDetails/index.tsx +154 -130
  151. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  152. package/themes/original/src/components/Wallets/index.tsx +6 -3
  153. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  154. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  155. package/themes/original/src/components/shared/OButton.tsx +5 -4
  156. package/themes/original/src/components/shared/OInput.tsx +4 -8
  157. package/themes/original/src/components/shared/OModal.tsx +7 -2
  158. package/themes/original/src/types/index.tsx +5 -1
  159. package/themes/original/src/utils/index.tsx +30 -1
  160. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -846,6 +846,18 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
846
846
  {
847
847
  key: 23,
848
848
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
849
+ },
850
+ {
851
+ key: 24,
852
+ text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
853
+ },
854
+ {
855
+ key: 25,
856
+ text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
857
+ },
858
+ {
859
+ key: 26,
860
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
849
861
  }
850
862
  ],
851
863
  tabs: [
@@ -858,7 +870,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
858
870
  {
859
871
  key: 1,
860
872
  text: t('IN_PROGRESS', 'In Progress'),
861
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
873
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
862
874
  title: 'inProgress',
863
875
  },
864
876
  {
@@ -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,7 +74,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
68
74
  logisticOrders,
69
75
  loadLogisticOrders,
70
76
  isLogisticActivated,
71
- isAlsea,
72
77
  handleChangeOrderStatus,
73
78
  handleSendCustomerReview
74
79
  } = props;
@@ -94,6 +99,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
94
99
  const [, t] = useLanguage();
95
100
  const [{ parseDate }] = useUtils()
96
101
  const [configState] = useConfig()
102
+
97
103
  const [orientationState] = useDeviceOrientation();
98
104
  const [openSearchModal, setOpenSearchModal] = useState(false)
99
105
  const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
@@ -123,12 +129,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
123
129
  backColor: '#E63757'
124
130
  }
125
131
  ]
126
- const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
127
132
  const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
128
133
  const [openedSelect, setOpenedSelect] = useState('')
134
+ const [lastDateConnection, setLastDateConnection] = useState(null)
135
+ const [internetLoading, setInternetLoading] = useState(!isNetConnected && isNetConnected !== null)
129
136
 
130
137
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
131
138
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
139
+ const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
132
140
 
133
141
  const preorderTypeList = [
134
142
  { key: null, name: t('SLA', 'SLA\'s') },
@@ -250,7 +258,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
250
258
  paddingLeft: 0,
251
259
  paddingRight: 0,
252
260
  marginBottom: 30,
253
- marginTop: 30
261
+ marginTop: Platform.OS === 'ios' ? 60 : 30
254
262
  },
255
263
  rowStyle: {
256
264
  display: 'flex',
@@ -379,12 +387,76 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
379
387
  }
380
388
 
381
389
  useEffect(() => {
382
- scrollRefTab.current?.scrollTo({ animated: true });
383
- scrollListRef.current?.scrollTo({ animated: true });
384
- scrollRef.current?.scrollTo({ y: 0, animated: true });
390
+ scrollRefTab.current?.scrollTo();
391
+ scrollListRef.current?.scrollTo();
392
+ scrollRef.current?.scrollTo();
385
393
  setTags({ values: [] })
386
394
  }, [currentTabSelected])
387
395
 
396
+ useEffect(() => {
397
+ const unsubcribe = navigation.addListener('focus', () => {
398
+ currentTabSelected === 'logisticOrders' && loadLogisticOrders && loadLogisticOrders()
399
+ })
400
+ return unsubcribe
401
+ }, [navigation, loadLogisticOrders])
402
+
403
+ useEffect(() => {
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 && combineTabs) {
416
+ _combineTabs && setCombineTabsState(_combineTabs)
417
+ _setStoreData('combine_pending_and_progress_orders', _combineTabs || 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
+
388
460
  return (
389
461
  <>
390
462
  <View style={styles.header}>
@@ -393,13 +465,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
393
465
  <View style={{ marginRight: 10 }}>
394
466
  <WebsocketStatus />
395
467
  </View>
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
- />
468
+ {isNetConnected && (
469
+ <FeatherIcon
470
+ name='refresh-cw'
471
+ color={theme.colors.backgroundDark}
472
+ size={24}
473
+ onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
474
+ style={{ marginRight: 20 }}
475
+ />
476
+ )}
403
477
  <FontistoIcon
404
478
  name='search'
405
479
  color={theme.colors.backgroundDark}
@@ -408,57 +482,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
408
482
  />
409
483
  </IconWrapper>
410
484
  </View>
411
- {configState?.configs?.order_deadlines_enabled?.value === '1' && (
412
- <View style={styles.SLAwrapper}>
413
- {/* <View style={{ flex: 0.5 }}>
414
- <OButton
415
- text={t('SLA_SETTING', 'SLA’s Settings')}
416
- textStyle={{ color: theme.colors.backArrow }}
417
- imgRightSrc={null}
418
- style={{
419
- backgroundColor: theme.colors.inputChat,
420
- borderRadius: 7.6,
421
- zIndex: 10,
422
- borderWidth: 0,
423
- minHeight: 40
424
- }}
425
- onClick={onClickSetting}
426
- />
427
- </View> */}
428
- {/* <View style={{ width: 10, height: '100%' }} /> */}
429
- {/* <View style={{ flex: 0.5, justifyContent: 'center' }}>
430
- <SelectDropdown
431
- defaultButtonText={t('SLA', 'SLA\'s')}
432
- data={preorderTypeList}
433
- onSelect={(selectedItem, index) => {
434
- onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
435
- }}
436
- buttonTextAfterSelection={(selectedItem, index) => {
437
- return selectedItem.name
438
- }}
439
- rowTextForSelection={(item, index) => {
440
- return item.key
441
- }}
442
- buttonStyle={styles.selectOption}
443
- buttonTextStyle={styles.buttonTextStyle}
444
- renderDropdownIcon={isOpened => {
445
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
446
- }}
447
- dropdownStyle={styles.dropdownStyle}
448
- dropdownOverlayColor='transparent'
449
- rowStyle={styles.rowStyle}
450
- renderCustomizedRowChild={(item, index) => {
451
- return (
452
- <SlaOption>
453
- {index !== 0 && <OrderStatus timeState={item?.key} />}
454
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
455
- </SlaOption>
456
- );
457
- }}
458
- />
459
- </View> */}
460
- </View>
461
- )}
462
485
  <FiltersTab>
463
486
  <ScrollView
464
487
  ref={scrollRefTab}
@@ -513,7 +536,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
513
536
  </ScrollView>
514
537
  </FiltersTab>
515
538
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
516
- {currentTabSelected !== 'logisticOrders' && !isAlsea && (
539
+ {showTagsList && (
517
540
  <View
518
541
  style={{
519
542
  display: 'flex',
@@ -580,6 +603,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
580
603
  </ScrollView>
581
604
  </View>
582
605
  )}
606
+ {isNetConnected === false && lastDateConnection && (
607
+ <View
608
+ style={{
609
+ borderRadius: 8,
610
+ paddingVertical: 3,
611
+ backgroundColor: theme.colors.danger500,
612
+ marginBottom: 10
613
+ }}
614
+ >
615
+ <OText
616
+ style={{ color: 'white', textAlign: 'center' }}
617
+ >
618
+ {`${t('LAST_UPDATE', 'Last Update')}: ${lastDateConnection}`}
619
+ </OText>
620
+ </View>
621
+ )}
583
622
  <ScrollView
584
623
  ref={scrollListRef}
585
624
  showsVerticalScrollIndicator={false}
@@ -588,7 +627,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
588
627
  refreshControl={
589
628
  <RefreshControl
590
629
  refreshing={refreshing}
591
- onRefresh={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
630
+ onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
592
631
  />
593
632
  }
594
633
  >
@@ -625,42 +664,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
625
664
  />
626
665
  )
627
666
  }
628
- {((currentOrdersGroup?.loading ||
629
- currentOrdersGroup?.pagination?.total === null) ||
630
- (logisticOrders?.loading)) &&
667
+ {(
631
668
  (
632
- <>
633
- <View>
634
- {[...Array(5)].map((_, i) => (
635
- <Placeholder key={i} Animation={Fade}>
636
- <View
669
+ (
670
+ currentOrdersGroup?.loading ||
671
+ (currentOrdersGroup?.pagination?.total === null && isNetConnected) ||
672
+ logisticOrders?.loading
673
+ ) &&
674
+ !currentOrdersGroup?.error?.length &&
675
+ !currentOrdersGroup?.orders?.length
676
+ ) || internetLoading
677
+ ) && (
678
+ <View>
679
+ {[...Array(5)].map((_, i) => (
680
+ <Placeholder key={i} Animation={Fade}>
681
+ <View
682
+ style={{
683
+ width: '100%',
684
+ flexDirection: 'row',
685
+ marginBottom: 10,
686
+ }}>
687
+ <PlaceholderLine
688
+ width={IS_PORTRAIT ? 22 : 11}
689
+ height={74}
637
690
  style={{
638
- width: '100%',
639
- flexDirection: 'row',
640
- marginBottom: 10,
641
- }}>
642
- <PlaceholderLine
643
- width={IS_PORTRAIT ? 22 : 11}
644
- height={74}
645
- style={{
646
- marginRight: 20,
647
- marginBottom: 20,
648
- borderRadius: 7.6,
649
- }}
650
- />
651
- <Placeholder>
652
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
653
- <PlaceholderLine width={50} />
654
- <PlaceholderLine width={20} />
655
- </Placeholder>
656
- </View>
657
- </Placeholder>
658
- ))}
659
- </View>
660
- </>
691
+ marginRight: 20,
692
+ marginBottom: 20,
693
+ borderRadius: 7.6,
694
+ }}
695
+ />
696
+ <Placeholder>
697
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
698
+ <PlaceholderLine width={50} />
699
+ <PlaceholderLine width={20} />
700
+ </Placeholder>
701
+ </View>
702
+ </Placeholder>
703
+ ))}
704
+ </View>
661
705
  )}
662
706
 
663
- {!currentOrdersGroup?.error?.length &&
707
+ {isNetConnected &&
708
+ !currentOrdersGroup?.error?.length &&
664
709
  !currentOrdersGroup?.loading &&
665
710
  currentOrdersGroup?.pagination?.totalPages &&
666
711
  currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
@@ -677,33 +722,35 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
677
722
  />
678
723
  )}
679
724
 
680
- {((!currentOrdersGroup?.loading &&
681
- (currentOrdersGroup?.error?.length ||
682
- currentOrdersGroup?.orders?.length === 0)) ||
683
- (currentTabSelected === 'logisticOrders' &&
684
- (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
685
- ) &&
725
+ {!internetLoading &&
726
+ ((!currentOrdersGroup?.loading &&
727
+ (currentOrdersGroup?.error?.length ||
728
+ currentOrdersGroup?.orders?.length === 0)) ||
729
+ (currentTabSelected === 'logisticOrders' &&
730
+ (logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
731
+ ) &&
686
732
  (
687
733
  <NotFoundSource
688
734
  content={
689
- ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
690
- (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
691
- ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
692
- : currentOrdersGroup?.error?.[0]?.message ||
693
- currentOrdersGroup?.error?.[0] ||
694
- (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
695
- t('NETWORK_ERROR', 'Network Error')
735
+ !isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
736
+ ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
737
+ (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
738
+ ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
739
+ : currentOrdersGroup?.error?.[0]?.message ||
740
+ currentOrdersGroup?.error?.[0] ||
741
+ (currentTabSelected === 'logisticOrders' && logisticOrders?.error) ||
742
+ t('NETWORK_ERROR', 'Network Error')
696
743
  }
697
744
  image={theme.images.general.notFound}
698
745
  conditioned={false}
746
+ btnTitle={!isNetConnected && t('REFRESH', 'Refresh')}
747
+ onClickButton={!isNetConnected && (() => RNRestart.Restart())}
699
748
  />
700
749
  )}
701
750
  </ScrollView>
702
751
  </View>
703
752
 
704
- {isBusinessApp && (
705
- <NewOrderNotification isBusinessApp={isBusinessApp} />
706
- )}
753
+ <NewOrderNotification isBusinessApp={isBusinessApp} />
707
754
 
708
755
  {(openSearchModal || openSLASettingModal) && (
709
756
  <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
@@ -716,39 +763,41 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
716
763
  {openSearchModal && (
717
764
  <SearchModalContent>
718
765
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
719
- <InputContainer style={{ marginBottom: 24 }}>
720
- <SelectDropdown
721
- defaultButtonText={search?.timeStatus
722
- ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
723
- : t('SLA', 'SLA\'s')}
724
- data={preorderTypeList}
725
- onSelect={(selectedItem, index) => {
726
- setSearch({ ...search, timeStatus: selectedItem?.key })
727
- }}
728
- buttonTextAfterSelection={(selectedItem, index) => {
729
- return selectedItem.name
730
- }}
731
- rowTextForSelection={(item, index) => {
732
- return item.key
733
- }}
734
- buttonStyle={styles.selectOption}
735
- buttonTextStyle={styles.buttonTextStyle}
736
- renderDropdownIcon={isOpened => {
737
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
738
- }}
739
- dropdownStyle={styles.dropdownStyle}
740
- dropdownOverlayColor='transparent'
741
- rowStyle={styles.rowStyle}
742
- renderCustomizedRowChild={(item, index) => {
743
- return (
744
- <SlaOption>
745
- {index !== 0 && <OrderStatus timeState={item?.key} />}
746
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
747
- </SlaOption>
748
- );
749
- }}
750
- />
751
- </InputContainer>
766
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
767
+ <InputContainer style={{ marginBottom: 24 }}>
768
+ <SelectDropdown
769
+ defaultButtonText={search?.timeStatus
770
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
771
+ : t('SLA', 'SLA\'s')}
772
+ data={preorderTypeList}
773
+ onSelect={(selectedItem, index) => {
774
+ setSearch({ ...search, timeStatus: selectedItem?.key })
775
+ }}
776
+ buttonTextAfterSelection={(selectedItem, index) => {
777
+ return selectedItem.name
778
+ }}
779
+ rowTextForSelection={(item, index) => {
780
+ return item.key
781
+ }}
782
+ buttonStyle={styles.selectOption}
783
+ buttonTextStyle={styles.buttonTextStyle}
784
+ renderDropdownIcon={isOpened => {
785
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
786
+ }}
787
+ dropdownStyle={styles.dropdownStyle}
788
+ dropdownOverlayColor='transparent'
789
+ rowStyle={styles.rowStyle}
790
+ renderCustomizedRowChild={(item, index) => {
791
+ return (
792
+ <SlaOption>
793
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
794
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
795
+ </SlaOption>
796
+ );
797
+ }}
798
+ />
799
+ </InputContainer>
800
+ )}
752
801
  <InputContainer>
753
802
  <OInput
754
803
  value={search.id}
@@ -977,12 +1026,16 @@ export const OrdersOption = (props: OrdersOptionParams) => {
977
1026
  const [, t] = useLanguage();
978
1027
  const [configState] = useConfig()
979
1028
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
980
- const combineTabs = configState?.configs?.combine_pending_and_progress_orders?.value === '1'
1029
+
1030
+ const getCombineTabsStoraged = async () => await _retrieveStoreData('combine_pending_and_progress_orders')
1031
+ const combineTabs = typeof configState?.configs?.combine_pending_and_progress_orders === 'object' ? configState?.configs?.combine_pending_and_progress_orders?.value === '1' : getCombineTabsStoraged()
1032
+
981
1033
  const ordersProps = {
982
1034
  ...props,
983
1035
  UIComponent: OrdersOptionUI,
984
1036
  useDefualtSessionManager: true,
985
1037
  asDashboard: true,
1038
+ combineTabs,
986
1039
  isIos: Platform.OS === 'ios',
987
1040
  orderStatus: [
988
1041
  { key: 0, text: t('PENDING', 'Pending') },
@@ -1062,13 +1115,25 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1062
1115
  {
1063
1116
  key: 23,
1064
1117
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
1118
+ },
1119
+ {
1120
+ key: 24,
1121
+ text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
1122
+ },
1123
+ {
1124
+ key: 25,
1125
+ text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
1126
+ },
1127
+ {
1128
+ key: 26,
1129
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
1065
1130
  }
1066
1131
  ],
1067
1132
  tabs: combineTabs ? [
1068
1133
  {
1069
1134
  key: 0,
1070
1135
  text: t('ACTIVE', 'Active'),
1071
- tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
1136
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1072
1137
  title: 'active',
1073
1138
  },
1074
1139
  {
@@ -1094,7 +1159,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1094
1159
  {
1095
1160
  key: 1,
1096
1161
  text: t('IN_PROGRESS', 'In Progress'),
1097
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1162
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1098
1163
  title: 'inProgress',
1099
1164
  },
1100
1165
  {
@@ -1120,3 +1185,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1120
1185
  )}
1121
1186
  </>);
1122
1187
  };
1188
+
1189
+ OrdersOption.defaultProps = {
1190
+ isNetConnected: true
1191
+ }
@@ -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={{
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
3
+ import FastImage from 'react-native-fast-image';
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import { useLanguage, useUtils } from 'ordering-components/native';
5
6
  import { Card, Logo, Information, Header, Badge } from './styles';
@@ -201,6 +202,24 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
201
202
  value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
202
203
  slug: 'ORDER_DRIVER_ON_WAY',
203
204
  percentage: 45
205
+ },
206
+ {
207
+ key: 24,
208
+ value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
209
+ slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
210
+ percentage: 25
211
+ },
212
+ {
213
+ key: 25,
214
+ value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
215
+ slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
216
+ percentage: 25
217
+ },
218
+ {
219
+ key: 26,
220
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
221
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
222
+ percentage: 80
204
223
  }
205
224
  ];
206
225
 
@@ -284,10 +303,14 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
284
303
  activeOpacity={1}>
285
304
  <Card key={order?.id}>
286
305
  <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}
306
+ <FastImage
290
307
  style={styles.icon}
308
+ source={order.business?.logo?.includes('https') ? {
309
+ uri: order.business?.logo,
310
+ priority: FastImage.priority.high,
311
+ cache: FastImage.cacheControl.immutable
312
+ } : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
313
+ resizeMode={FastImage.resizeMode.cover}
291
314
  />
292
315
  </Logo>
293
316
  <Information>