ordering-ui-react-native 0.21.55 → 0.21.56-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 (165) hide show
  1. package/package.json +8 -9
  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/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessProductList/ProductList.tsx +2 -1
  11. package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
  12. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  13. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  14. package/themes/business/src/components/Home/index.tsx +5 -1
  15. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  16. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  17. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  18. package/themes/business/src/components/MapView/index.tsx +30 -15
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  20. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +43 -24
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +35 -21
  24. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  25. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  26. package/themes/business/src/components/OrdersOption/index.tsx +229 -112
  27. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  28. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
  29. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  30. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  31. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  32. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  33. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  34. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  35. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  36. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  37. package/themes/business/src/components/Sessions/index.tsx +187 -0
  38. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  39. package/themes/business/src/components/StoresList/index.tsx +4 -3
  40. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  41. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  43. package/themes/business/src/components/shared/OInput.tsx +2 -0
  44. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  45. package/themes/business/src/hooks/useLocation.tsx +5 -4
  46. package/themes/business/src/types/index.tsx +22 -5
  47. package/themes/business/src/utils/index.tsx +5 -0
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  52. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  53. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  54. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  55. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  56. package/themes/original/index.tsx +6 -2
  57. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  58. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  59. package/themes/original/src/components/AddressList/index.tsx +8 -7
  60. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  61. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  62. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  63. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  64. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  65. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
  68. package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
  69. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
  70. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  71. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  72. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  73. package/themes/original/src/components/BusinessProductsListing/index.tsx +29 -14
  74. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  75. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  76. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  77. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  78. package/themes/original/src/components/Cart/index.tsx +26 -9
  79. package/themes/original/src/components/CartContent/index.tsx +60 -45
  80. package/themes/original/src/components/Checkout/index.tsx +106 -64
  81. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  82. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  83. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  84. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  85. package/themes/original/src/components/Favorite/index.tsx +1 -5
  86. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  87. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  88. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  89. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  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 +9 -11
  94. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  95. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  96. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  97. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  98. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  99. package/themes/original/src/components/Help/index.tsx +2 -0
  100. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  101. package/themes/original/src/components/Home/index.tsx +2 -10
  102. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
  103. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  104. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  105. package/themes/original/src/components/Messages/index.tsx +8 -7
  106. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  107. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  108. package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
  109. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  110. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  111. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  112. package/themes/original/src/components/NavBar/index.tsx +4 -2
  113. package/themes/original/src/components/NetworkError/index.tsx +2 -8
  114. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  115. package/themes/original/src/components/Notifications/index.tsx +2 -4
  116. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  117. package/themes/original/src/components/OrderDetails/index.tsx +5 -7
  118. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  119. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  120. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  121. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  122. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  123. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  124. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  125. package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
  126. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  127. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  128. package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
  129. package/themes/original/src/components/ProductForm/index.tsx +123 -112
  130. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  131. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  132. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  133. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  134. package/themes/original/src/components/Promotions/index.tsx +6 -9
  135. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  136. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  137. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  138. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  139. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  140. package/themes/original/src/components/Sessions/index.tsx +3 -3
  141. package/themes/original/src/components/SignupForm/index.tsx +65 -67
  142. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  143. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  144. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  145. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  146. package/themes/original/src/components/StripeCardsList/index.tsx +12 -36
  147. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  148. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  149. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  151. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  152. package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
  153. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  154. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  155. package/themes/original/src/components/Wallets/index.tsx +7 -4
  156. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  158. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  159. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  160. package/themes/original/src/components/shared/OButton.tsx +8 -7
  161. package/themes/original/src/components/shared/OInput.tsx +1 -4
  162. package/themes/original/src/layouts/Container.tsx +4 -2
  163. package/themes/original/src/types/index.tsx +5 -1
  164. package/themes/original/src/utils/index.tsx +12 -1
  165. 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,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)
@@ -125,9 +131,12 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
125
131
  ]
126
132
  const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
127
133
  const [openedSelect, setOpenedSelect] = useState('')
134
+ const [lastDateConnection, setLastDateConnection] = useState(null)
135
+ const [internetLoading, setInternetLoading] = useState(!isNetConnected && isNetConnected !== null)
128
136
 
129
137
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
130
138
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
139
+ const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
131
140
 
132
141
  const preorderTypeList = [
133
142
  { key: null, name: t('SLA', 'SLA\'s') },
@@ -378,24 +387,93 @@ 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
+
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
+
387
460
  return (
388
461
  <>
389
462
  <View style={styles.header}>
390
463
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
391
464
  <IconWrapper>
392
- <FeatherIcon
393
- name='refresh-cw'
394
- color={theme.colors.backgroundDark}
395
- size={24}
396
- onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
397
- style={{ marginRight: 20 }}
398
- />
465
+ <View style={{ marginRight: 10 }}>
466
+ <WebsocketStatus />
467
+ </View>
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
+ )}
399
477
  <FontistoIcon
400
478
  name='search'
401
479
  color={theme.colors.backgroundDark}
@@ -404,58 +482,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
404
482
  />
405
483
  </IconWrapper>
406
484
  </View>
407
- <WebsocketStatus />
408
- {configState?.configs?.order_deadlines_enabled?.value === '1' && (
409
- <View style={styles.SLAwrapper}>
410
- <View style={{ flex: 0.5 }}>
411
- <OButton
412
- text={t('SLA_SETTING', 'SLA’s Settings')}
413
- textStyle={{ color: theme.colors.backArrow }}
414
- imgRightSrc={null}
415
- style={{
416
- backgroundColor: theme.colors.inputChat,
417
- borderRadius: 7.6,
418
- zIndex: 10,
419
- borderWidth: 0,
420
- minHeight: 40
421
- }}
422
- onClick={onClickSetting}
423
- />
424
- </View>
425
- <View style={{ width: 10, height: '100%' }} />
426
- <View style={{ flex: 0.5, justifyContent: 'center' }}>
427
- <SelectDropdown
428
- defaultButtonText={t('SLA', 'SLA\'s')}
429
- data={preorderTypeList}
430
- onSelect={(selectedItem, index) => {
431
- onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
432
- }}
433
- buttonTextAfterSelection={(selectedItem, index) => {
434
- return selectedItem.name
435
- }}
436
- rowTextForSelection={(item, index) => {
437
- return item.key
438
- }}
439
- buttonStyle={styles.selectOption}
440
- buttonTextStyle={styles.buttonTextStyle}
441
- renderDropdownIcon={isOpened => {
442
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
443
- }}
444
- dropdownStyle={styles.dropdownStyle}
445
- dropdownOverlayColor='transparent'
446
- rowStyle={styles.rowStyle}
447
- renderCustomizedRowChild={(item, index) => {
448
- return (
449
- <SlaOption>
450
- {index !== 0 && <OrderStatus timeState={item?.key} />}
451
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
452
- </SlaOption>
453
- );
454
- }}
455
- />
456
- </View>
457
- </View>
458
- )}
459
485
  <FiltersTab>
460
486
  <ScrollView
461
487
  ref={scrollRefTab}
@@ -465,7 +491,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
465
491
  nestedScrollEnabled={true}
466
492
  >
467
493
  <TabsContainer>
468
- {(isLogisticActivated && !isBusinessApp) && (
494
+ {(isLogisticActivated && !isBusinessApp && !combineTabs) && (
469
495
  <Pressable
470
496
  style={styles.pressable}
471
497
  onPress={() => setCurrentTabSelected('logisticOrders')}>
@@ -510,7 +536,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
510
536
  </ScrollView>
511
537
  </FiltersTab>
512
538
  <View style={{ flex: 1, minHeight: HEIGHT_SCREEN - 450 }}>
513
- {currentTabSelected !== 'logisticOrders' && !isAlsea && (
539
+ {showTagsList && (
514
540
  <View
515
541
  style={{
516
542
  display: 'flex',
@@ -577,6 +603,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
577
603
  </ScrollView>
578
604
  </View>
579
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
+ )}
580
622
  <ScrollView
581
623
  ref={scrollListRef}
582
624
  showsVerticalScrollIndicator={false}
@@ -585,7 +627,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
585
627
  refreshControl={
586
628
  <RefreshControl
587
629
  refreshing={refreshing}
588
- onRefresh={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
630
+ onRefresh={() => { isNetConnected && (currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })) }}
589
631
  />
590
632
  }
591
633
  >
@@ -622,42 +664,48 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
622
664
  />
623
665
  )
624
666
  }
625
- {((currentOrdersGroup?.loading ||
626
- currentOrdersGroup?.pagination?.total === null) ||
627
- (logisticOrders?.loading)) &&
667
+ {(
628
668
  (
629
- <>
630
- <View>
631
- {[...Array(5)].map((_, i) => (
632
- <Placeholder key={i} Animation={Fade}>
633
- <View
634
- style={{
635
- width: '100%',
636
- flexDirection: 'row',
637
- marginBottom: 10,
638
- }}>
639
- <PlaceholderLine
640
- width={IS_PORTRAIT ? 22 : 11}
641
- height={74}
642
- style={{
643
- marginRight: 20,
644
- marginBottom: 20,
645
- borderRadius: 7.6,
646
- }}
647
- />
648
- <Placeholder>
649
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
650
- <PlaceholderLine width={50} />
651
- <PlaceholderLine width={20} />
652
- </Placeholder>
653
- </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}
690
+ style={{
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} />
654
700
  </Placeholder>
655
- ))}
656
- </View>
657
- </>
658
- )}
701
+ </View>
702
+ </Placeholder>
703
+ ))}
704
+ </View>
705
+ )}
659
706
 
660
- {!currentOrdersGroup?.error?.length &&
707
+ {isNetConnected &&
708
+ !currentOrdersGroup?.error?.length &&
661
709
  !currentOrdersGroup?.loading &&
662
710
  currentOrdersGroup?.pagination?.totalPages &&
663
711
  currentOrdersGroup?.pagination?.currentPage < currentOrdersGroup?.pagination?.totalPages &&
@@ -674,7 +722,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
674
722
  />
675
723
  )}
676
724
 
677
- {((!currentOrdersGroup?.loading &&
725
+ {!internetLoading &&
726
+ ((!currentOrdersGroup?.loading &&
678
727
  (currentOrdersGroup?.error?.length ||
679
728
  currentOrdersGroup?.orders?.length === 0)) ||
680
729
  (currentTabSelected === 'logisticOrders' &&
@@ -683,6 +732,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
683
732
  (
684
733
  <NotFoundSource
685
734
  content={
735
+ !isNetConnected ? t('NETWORK_ERROR', 'Network Error') :
686
736
  ((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
687
737
  (currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
688
738
  ? t('NO_RESULTS_FOUND', 'Sorry, no results found')
@@ -693,6 +743,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
693
743
  }
694
744
  image={theme.images.general.notFound}
695
745
  conditioned={false}
746
+ btnTitle={!isNetConnected && t('REFRESH', 'Refresh')}
747
+ onClickButton={!isNetConnected && (() => RNRestart.Restart())}
696
748
  />
697
749
  )}
698
750
  </ScrollView>
@@ -713,6 +765,41 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
713
765
  {openSearchModal && (
714
766
  <SearchModalContent>
715
767
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
768
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
769
+ <InputContainer style={{ marginBottom: 24 }}>
770
+ <SelectDropdown
771
+ defaultButtonText={search?.timeStatus
772
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
773
+ : t('SLA', 'SLA\'s')}
774
+ data={preorderTypeList}
775
+ onSelect={(selectedItem, index) => {
776
+ setSearch({ ...search, timeStatus: selectedItem?.key })
777
+ }}
778
+ buttonTextAfterSelection={(selectedItem, index) => {
779
+ return selectedItem.name
780
+ }}
781
+ rowTextForSelection={(item, index) => {
782
+ return item.key
783
+ }}
784
+ buttonStyle={styles.selectOption}
785
+ buttonTextStyle={styles.buttonTextStyle}
786
+ renderDropdownIcon={isOpened => {
787
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
788
+ }}
789
+ dropdownStyle={styles.dropdownStyle}
790
+ dropdownOverlayColor='transparent'
791
+ rowStyle={styles.rowStyle}
792
+ renderCustomizedRowChild={(item, index) => {
793
+ return (
794
+ <SlaOption>
795
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
796
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
797
+ </SlaOption>
798
+ );
799
+ }}
800
+ />
801
+ </InputContainer>
802
+ )}
716
803
  <InputContainer>
717
804
  <OInput
718
805
  value={search.id}
@@ -939,12 +1026,18 @@ export const Timer = () => {
939
1026
 
940
1027
  export const OrdersOption = (props: OrdersOptionParams) => {
941
1028
  const [, t] = useLanguage();
1029
+ const [configState] = useConfig()
942
1030
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
1031
+
1032
+ const getCombineTabsStoraged = async () => await _retrieveStoreData('combine_pending_and_progress_orders')
1033
+ const combineTabs = typeof configState?.configs?.combine_pending_and_progress_orders === 'object' ? configState?.configs?.combine_pending_and_progress_orders?.value === '1' : getCombineTabsStoraged()
1034
+
943
1035
  const ordersProps = {
944
1036
  ...props,
945
1037
  UIComponent: OrdersOptionUI,
946
1038
  useDefualtSessionManager: true,
947
1039
  asDashboard: true,
1040
+ combineTabs,
948
1041
  isIos: Platform.OS === 'ios',
949
1042
  orderStatus: [
950
1043
  { key: 0, text: t('PENDING', 'Pending') },
@@ -1026,32 +1119,52 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1026
1119
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
1027
1120
  }
1028
1121
  ],
1029
- tabs: [
1122
+ tabs: combineTabs ? [
1030
1123
  {
1031
1124
  key: 0,
1032
- text: t('PENDING', 'Pending'),
1033
- tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1034
- title: 'pending'
1125
+ text: t('ACTIVE', 'Active'),
1126
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
1127
+ title: 'active',
1035
1128
  },
1036
1129
  {
1037
1130
  key: 1,
1038
- text: t('IN_PROGRESS', 'In Progress'),
1039
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1040
- title: 'inProgress',
1041
- },
1042
- {
1043
- key: 2,
1044
1131
  text: t('COMPLETED', 'Completed'),
1045
1132
  tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1046
1133
  title: 'completed',
1047
1134
  },
1048
1135
  {
1049
- key: 3,
1136
+ key: 2,
1050
1137
  text: t('CANCELLED', 'Cancelled'),
1051
1138
  tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1052
1139
  title: 'cancelled',
1053
1140
  },
1054
- ]
1141
+ ] :
1142
+ [
1143
+ {
1144
+ key: 0,
1145
+ text: t('PENDING', 'Pending'),
1146
+ tags: props?.orderGroupStatusCustom?.pending ?? [0, 13],
1147
+ title: 'pending'
1148
+ },
1149
+ {
1150
+ key: 1,
1151
+ text: t('IN_PROGRESS', 'In Progress'),
1152
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
1153
+ title: 'inProgress',
1154
+ },
1155
+ {
1156
+ key: 2,
1157
+ text: t('COMPLETED', 'Completed'),
1158
+ tags: props?.orderGroupStatusCustom?.completed ?? [1, 11, 15],
1159
+ title: 'completed',
1160
+ },
1161
+ {
1162
+ key: 3,
1163
+ text: t('CANCELLED', 'Cancelled'),
1164
+ tags: props?.orderGroupStatusCustom?.cancelled ?? [2, 5, 6, 10, 12, 16, 17],
1165
+ title: 'cancelled',
1166
+ },
1167
+ ]
1055
1168
  };
1056
1169
 
1057
1170
  return (<>
@@ -1062,3 +1175,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1062
1175
  )}
1063
1176
  </>);
1064
1177
  };
1178
+
1179
+ OrdersOption.defaultProps = {
1180
+ isNetConnected: true
1181
+ }
@@ -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,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Platform, PlatformIOSStatic, StyleSheet, TouchableOpacity, View } from 'react-native';
2
+ import { Platform, PlatformIOSStatic, Pressable, StyleSheet, View } from 'react-native';
3
3
  import DeviceInfo from 'react-native-device-info';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
@@ -47,6 +47,7 @@ export const OrderItem = React.memo((props: any) => {
47
47
  timer: configState?.configs?.order_deadlines_enabled?.value === '1',
48
48
  slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
49
49
  })
50
+ const showExternalId = configState?.configs?.change_order_id?.value === '1'
50
51
 
51
52
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
52
53
  const platformIOS = Platform as PlatformIOSStatic
@@ -76,7 +77,6 @@ export const OrderItem = React.memo((props: any) => {
76
77
  marginLeft: 3,
77
78
  },
78
79
  title: {
79
- marginBottom: 6,
80
80
  fontFamily: 'Poppins',
81
81
  fontStyle: 'normal',
82
82
  fontWeight: '600',
@@ -84,7 +84,6 @@ export const OrderItem = React.memo((props: any) => {
84
84
  color: theme.colors.textGray,
85
85
  },
86
86
  date: {
87
- marginBottom: 6,
88
87
  fontFamily: 'Poppins',
89
88
  fontStyle: 'normal',
90
89
  fontWeight: 'normal',
@@ -104,7 +103,7 @@ export const OrderItem = React.memo((props: any) => {
104
103
  const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
105
104
  const _delivery = order?.delivery_datetime_utc
106
105
  ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
107
- : parseDate(cdtToutc)
106
+ : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
108
107
  const _eta = order?.eta_time
109
108
  const diffTimeAsSeconds = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'seconds')
110
109
  return Math.ceil(diffTimeAsSeconds / 60)
@@ -120,7 +119,7 @@ export const OrderItem = React.memo((props: any) => {
120
119
  let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
121
120
  let restMins: string | number = restMinOfTargetedMin - 60 * restHours
122
121
  // make standard time format
123
- day = day === 0 ? '' : day + 'day '
122
+ day = day === 0 ? '' : `${day + ' ' + t('DAY', 'day') + ' '}`
124
123
  restHours = restHours < 10 ? '0' + restHours : restHours
125
124
  restMins = restMins < 10 ? '0' + restMins : restMins
126
125
 
@@ -138,8 +137,7 @@ export const OrderItem = React.memo((props: any) => {
138
137
  }, [configState.loading])
139
138
 
140
139
  return (
141
- <TouchableOpacity
142
- activeOpacity={1}
140
+ <Pressable
143
141
  disabled={order?.locked && isLogisticOrder}
144
142
  style={styles.cardButton}
145
143
  onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
@@ -153,10 +151,10 @@ export const OrderItem = React.memo((props: any) => {
153
151
  <Logo style={styles.logo}>
154
152
  <FastImage
155
153
  style={styles.icon}
156
- source={order.business?.logo ? {
157
- uri: optimizeImage(order.business?.logo, 'h_100,c_limit'),
154
+ source={order.business?.logo?.includes('https') ? {
155
+ uri: order.business?.logo,
158
156
  priority: FastImage.priority.normal,
159
- } : theme?.images?.dummies?.businessLogo}
157
+ } : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
160
158
  resizeMode={FastImage.resizeMode.cover}
161
159
  />
162
160
  </Logo>
@@ -180,24 +178,36 @@ export const OrderItem = React.memo((props: any) => {
180
178
  />
181
179
  </NotificationIcon>
182
180
  )}
183
- <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
184
- <OText
181
+ <View>
182
+ {!order?.order_group_id && showExternalId && !order?.order_group && (
183
+ <OText
184
+ style={styles.date}
185
+ color={theme.colors.unselectText}
186
+ numberOfLines={1}
187
+ adjustsFontSizeToFit
188
+ >
189
+ {`${order?.external_id ?? t('NO_EXTERNAL_ID', 'No external Id ') + t('NO', 'Order No.') + order?.id}` + ' · ' + `${order?.delivery_datetime_utc
190
+ ? parseDate(order?.delivery_datetime_utc)
191
+ : parseDate(order?.delivery_datetime, { utc: false })
192
+ }`}
193
+ </OText>
194
+ )}
195
+ {!showExternalId && (<OText
185
196
  style={styles.date}
186
197
  color={theme.colors.unselectText}
187
198
  numberOfLines={1}
188
199
  adjustsFontSizeToFit
189
200
  >
190
- {(!!order?.order_group_id && order?.order_group && isLogisticOrder
201
+ {((!!order?.order_group_id && order?.order_group && isLogisticOrder
191
202
  ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
192
- : (t('NO', 'Order No.') + order.id)
193
- ) + ' · '}
194
- {order?.delivery_datetime_utc
203
+ : (t('NO', 'Order No.') + order?.id)
204
+ ) + ' · ' + `${order?.delivery_datetime_utc
195
205
  ? parseDate(order?.delivery_datetime_utc)
196
- : parseDate(order?.delivery_datetime, { utc: false })}
206
+ : parseDate(order?.delivery_datetime, { utc: false })}`)}
197
207
  </OText>
208
+ )}
198
209
  {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
199
210
  <>
200
- <OText> · </OText>
201
211
  <OText
202
212
  style={styles.date}
203
213
  color={
@@ -237,6 +247,6 @@ export const OrderItem = React.memo((props: any) => {
237
247
  )}
238
248
  </Information>
239
249
  </Card>
240
- </TouchableOpacity>
250
+ </Pressable>
241
251
  )
242
252
  }, OrderItemPropsAreEqual)