ordering-ui-react-native 0.17.67 → 0.17.68-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 (202) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +2 -1
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +270 -245
  15. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  16. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  17. package/themes/business/src/components/Chat/index.tsx +123 -111
  18. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  22. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  23. package/themes/business/src/components/MapView/index.tsx +10 -10
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +111 -43
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  35. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  36. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  37. package/themes/business/src/components/PreviousOrders/index.tsx +444 -242
  38. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
  41. package/themes/business/src/components/StoresList/index.tsx +3 -4
  42. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  43. package/themes/business/src/components/shared/OLink.tsx +33 -13
  44. package/themes/business/src/components/shared/OModal.tsx +16 -9
  45. package/themes/business/src/components/shared/OText.tsx +8 -2
  46. package/themes/business/src/types/index.tsx +28 -12
  47. package/themes/business/src/utils/index.tsx +29 -2
  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/Intro/index.tsx +16 -1
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  54. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  55. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  56. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  57. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +2 -0
  60. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  61. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  62. package/themes/original/src/components/AddressList/index.tsx +27 -22
  63. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +80 -66
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +139 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -556
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +77 -79
  90. package/themes/original/src/components/CartContent/index.tsx +117 -20
  91. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  92. package/themes/original/src/components/Checkout/index.tsx +356 -124
  93. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  94. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  95. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  96. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  97. package/themes/original/src/components/Favorite/index.tsx +8 -9
  98. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  99. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  100. package/themes/original/src/components/FloatingButton/index.tsx +11 -14
  101. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  102. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  103. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  104. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  106. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  107. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  108. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  109. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  110. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  113. package/themes/original/src/components/Help/index.tsx +8 -8
  114. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  115. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  116. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  117. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  119. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  120. package/themes/original/src/components/Home/index.tsx +13 -4
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -31
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  124. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  125. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  126. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  127. package/themes/original/src/components/Messages/index.tsx +14 -7
  128. package/themes/original/src/components/MomentOption/index.tsx +195 -90
  129. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  130. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  132. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  133. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  134. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  135. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  136. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  137. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  138. package/themes/original/src/components/NavBar/index.tsx +20 -17
  139. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  140. package/themes/original/src/components/Notifications/index.tsx +46 -50
  141. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  142. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  143. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  144. package/themes/original/src/components/OrderDetails/index.tsx +191 -363
  145. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  146. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  147. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  148. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  149. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  151. package/themes/original/src/components/OrdersOption/index.tsx +68 -87
  152. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  153. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  154. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  155. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  160. package/themes/original/src/components/ProductForm/index.tsx +105 -30
  161. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -11
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  165. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  168. package/themes/original/src/components/Promotions/index.tsx +5 -4
  169. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  170. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  171. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  172. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  173. package/themes/original/src/components/Sessions/index.tsx +11 -8
  174. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  175. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  176. package/themes/original/src/components/SingleOrderCard/index.tsx +101 -62
  177. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  178. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  181. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  183. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  184. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  185. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  186. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  187. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  189. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  190. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  191. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  192. package/themes/original/src/components/UserVerification/index.tsx +52 -49
  193. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  194. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  195. package/themes/original/src/components/Wallets/index.tsx +66 -30
  196. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  197. package/themes/original/src/components/shared/OButton.tsx +6 -2
  198. package/themes/original/src/components/shared/OInput.tsx +6 -1
  199. package/themes/original/src/components/shared/OModal.tsx +3 -3
  200. package/themes/original/src/types/index.tsx +41 -11
  201. package/themes/original/src/utils/index.tsx +273 -1
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Linking, Platform, TextInput } from 'react-native';
3
- import { useLanguage, useUtils, useToast, ToastType, OrderListGroups, useConfig } from 'ordering-components/native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
3
+ import { useLanguage, useUtils, useToast, OrderListGroups, useConfig } from 'ordering-components/native';
4
4
  import SelectDropdown from 'react-native-select-dropdown'
5
5
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
6
6
  import FeatherIcon from 'react-native-vector-icons/Feather';
@@ -20,7 +20,6 @@ import {
20
20
  IconWrapper,
21
21
  ModalContainer,
22
22
  ModalTitle,
23
- FilterBtnWrapper,
24
23
  TabPressable,
25
24
  OrderStatus,
26
25
  SlaOption,
@@ -34,42 +33,17 @@ import {
34
33
  ItemContent,
35
34
  TimerInputWrapper,
36
35
  OverLine,
37
- Actions,
38
36
  InputContainer
39
37
  } from './styles';
40
38
  import { PreviousOrders } from '../PreviousOrders';
41
39
  import { OrdersOptionParams } from '../../types';
42
40
 
43
- import { TouchableOpacity } from 'react-native-gesture-handler';
44
- import GestureRecognizer from 'react-native-swipe-gestures';
45
- import ODropDown from '../shared/ODropDown';
46
- import { OrdersOptionStatus } from '../OrdersOptionStatus'
47
41
  import { OrdersOptionCity } from '../OrdersOptionCity';
48
42
  import { OrdersOptionBusiness } from '../OrdersOptionBusiness';
49
43
  import { OrdersOptionDelivery } from '../OrdersOptionDelivery';
50
44
  import { OrdersOptionPaymethod } from '../OrdersOptionPaymethod';
51
45
  import { OrdersOptionDriver } from '../OrdersOptionDriver';
52
46
  import { OrdersOptionDate } from '../OrdersOptionDate';
53
- import { GestureEvent, GestureDetector } from 'react-native-gesture-handler'
54
- const tabsList: any = {
55
- pending: 1,
56
- inProgress: 2,
57
- completed: 3,
58
- cancelled: 4
59
- };
60
-
61
- const tabsListText: any = {
62
- 1: 'pending',
63
- 2: 'inProgress',
64
- 3: 'completed',
65
- 4: 'cancelled'
66
- };
67
-
68
- const swipeConfig = {
69
- velocityThreshold: 0.3,
70
- directionalOffsetThreshold: 80
71
- };
72
-
73
47
  const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
74
48
 
75
49
  const OrdersOptionUI = (props: OrdersOptionParams) => {
@@ -81,10 +55,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
81
55
  ordersGroup,
82
56
  setOrdersGroup,
83
57
  orderStatus,
58
+ ordersFormatted,
84
59
  loadOrders,
85
60
  loadMoreOrders,
86
61
  onNavigationRedirect,
87
- filtered,
88
62
  onFiltered,
89
63
  handleClickOrder,
90
64
  isBusinessApp,
@@ -92,7 +66,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
92
66
  logisticOrders,
93
67
  loadLogisticOrders,
94
68
  isLogisticActivated,
95
- isAlsea
69
+ isAlsea,
70
+ handleChangeOrderStatus,
71
+ handleSendCustomerReview
96
72
  } = props;
97
73
 
98
74
  const defaultSearchList = {
@@ -122,7 +98,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
122
98
  const [slaSettingTime, setSlaSettingTime] = useState(6000)
123
99
  const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
124
100
  const [search, setSearch] = useState(defaultSearchList)
125
- const [selectedTabStatus, setSelectedTabStatus] = useState([])
101
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
126
102
  const [hour, setHour] = useState(0)
127
103
  const [minute, setMinute] = useState(0)
128
104
  const [openedSelect, setOpenedSelect] = useState('')
@@ -263,6 +239,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
263
239
  overflow: 'hidden',
264
240
  minHeight: 155
265
241
  },
242
+ btnBackArrow: {
243
+ borderWidth: 0,
244
+ width: 32,
245
+ height: 32,
246
+ tintColor: theme.colors.textGray,
247
+ backgroundColor: theme.colors.clear,
248
+ borderColor: theme.colors.clear,
249
+ shadowColor: theme.colors.clear,
250
+ paddingLeft: 0,
251
+ paddingRight: 0,
252
+ marginBottom: 30,
253
+ marginTop: 30
254
+ },
266
255
  rowStyle: {
267
256
  display: 'flex',
268
257
  borderBottomWidth: 0,
@@ -346,26 +335,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
346
335
  })
347
336
  }
348
337
 
349
- const onSwipeLeft = () => {
350
- let currentTab = tabsList[currentTabSelected]
351
- currentTab = currentTab >= 4 ? null : currentTab + 1
352
-
353
- if (!currentTab) return
354
-
355
- const nextTab = tabsListText[currentTab]
356
- nextTab && setCurrentTabSelected(nextTab)
357
- }
358
-
359
- const onSwipeRight = () => {
360
- let currentTab = tabsList[currentTabSelected]
361
- currentTab = currentTab <= 1 ? null : currentTab - 1
362
-
363
- if (!currentTab) return
364
-
365
- const nextTab = tabsListText[currentTab]
366
- nextTab && setCurrentTabSelected(nextTab)
367
- }
368
-
369
338
  const calculateDate = (type: any, from: any, to: any) => {
370
339
  switch (type) {
371
340
  case 'today':
@@ -419,14 +388,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
419
388
  useEffect(() => {
420
389
  setSelectedTabStatus(deliveryStatus)
421
390
  }, [])
422
-
391
+
423
392
  return (
424
- // <GestureRecognizer
425
- // onSwipeLeft={onSwipeLeft}
426
- // onSwipeRight={onSwipeRight}
427
- // config={swipeConfig}
428
- // style={{ flex: 1 }}
429
- // >
430
393
  <>
431
394
  <View style={styles.header}>
432
395
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
@@ -635,12 +598,18 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
635
598
  currentTabSelected !== 'logisticOrders' &&
636
599
  (
637
600
  <PreviousOrders
638
- orders={currentOrdersGroup?.orders}
601
+ orders={ordersFormatted}
602
+ navigation={props.navigation}
639
603
  onNavigationRedirect={onNavigationRedirect}
640
604
  getOrderStatus={getOrderStatus}
641
605
  handleClickOrder={handleClickOrder}
642
606
  slaSettingTime={slaSettingTime}
643
607
  currentTabSelected={currentTabSelected}
608
+ appTitle={props.orderDetailsProps?.appTitle}
609
+ actions={props.orderDetailsProps?.actions}
610
+ orderTitle={props.orderDetailsProps?.orderTitle}
611
+ handleChangeOrderStatus={handleChangeOrderStatus}
612
+ handleSendCustomerReview={handleSendCustomerReview}
644
613
  />
645
614
  )}
646
615
  {!logisticOrders?.error?.length &&
@@ -730,7 +699,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
730
699
  )}
731
700
  </ScrollView>
732
701
  </View>
733
- {/* </GestureRecognizer> */}
734
702
 
735
703
  {isBusinessApp && (
736
704
  <NewOrderNotification isBusinessApp={isBusinessApp} />
@@ -741,20 +709,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
741
709
  <ModalContainer
742
710
  nestedScrollEnabled={true}
743
711
  >
744
- <OIconButton
745
- icon={theme.images.general.arrow_left}
746
- borderColor={theme.colors.clear}
747
- iconColor={theme.colors.backArrow}
748
- iconStyle={{ width: 20, height: 13 }}
749
- style={{
750
- maxWidth: 40,
751
- height: 35,
752
- justifyContent: 'flex-end',
753
- marginBottom: 30,
754
- marginTop: 30
755
- }}
756
- onClick={() => handleClose()}
757
- />
712
+ <TouchableOpacity onPress={() => handleClose()} style={styles.btnBackArrow}>
713
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
714
+ </TouchableOpacity>
758
715
  {openSearchModal && (
759
716
  <SearchModalContent>
760
717
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
@@ -884,7 +841,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
884
841
  </ScrollView>
885
842
  </FiltersTab>
886
843
  <DeliveryStatusWrapper>
887
- {selectedTabStatus && selectedTabStatus.length > 0 && selectedTabStatus.map((item, i) => (
844
+ {selectedTabStatus && selectedTabStatus.length > 0 && selectedTabStatus.map((item: any, i: number) => (
888
845
  <StatusBlock
889
846
  key={i}
890
847
  item={item}
@@ -0,0 +1,249 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Platform, PlatformIOSStatic, StyleSheet, TouchableOpacity, View } from 'react-native';
3
+ import DeviceInfo from 'react-native-device-info';
4
+ import { useTheme } from 'styled-components/native';
5
+ import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
6
+ import EntypoIcon from 'react-native-vector-icons/Entypo'
7
+ import FastImage from 'react-native-fast-image'
8
+ import moment from 'moment'
9
+
10
+ import {
11
+ Card,
12
+ Logo,
13
+ Information,
14
+ MyOrderOptions,
15
+ NotificationIcon,
16
+ Timestatus
17
+ } from './styles'
18
+
19
+ import { OText } from '../shared';
20
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
21
+
22
+ const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
23
+
24
+ export const OrderItem = (props: any) => {
25
+ const {
26
+ order,
27
+ _order,
28
+ isLogisticOrder,
29
+ currentTabSelected,
30
+ getOrderStatus,
31
+ handlePressOrder
32
+ } = props
33
+
34
+ const theme = useTheme()
35
+ const [, t] = useLanguage()
36
+ const [configState] = useConfig()
37
+ const [{ parseDate, optimizeImage }] = useUtils();
38
+ const [orientationState] = useDeviceOrientation();
39
+
40
+ const [allowColumns, setAllowColumns] = useState({
41
+ timer: configState?.configs?.order_deadlines_enabled?.value === '1',
42
+ slaBar: configState?.configs?.order_deadlines_enabled?.value === '1',
43
+ })
44
+
45
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
46
+ const platformIOS = Platform as PlatformIOSStatic
47
+
48
+ const isIpad = platformIOS.isPad
49
+ const isTablet = DeviceInfo.isTablet();
50
+
51
+ const styles = StyleSheet.create({
52
+ cardButton: {
53
+ flex: 1,
54
+ paddingVertical: (isIpad || isTablet) ? 20 : 0,
55
+ marginBottom: IS_PORTRAIT ? 25 : 0,
56
+ marginLeft: 3,
57
+ },
58
+ icon: {
59
+ borderRadius: 7.6,
60
+ width: 60,
61
+ height: 60
62
+ },
63
+ logo: {
64
+ borderRadius: 10,
65
+ shadowColor: "#0000006e",
66
+ shadowRadius: 10,
67
+ elevation: 15,
68
+ justifyContent: 'center',
69
+ alignItems: 'center',
70
+ marginLeft: 3,
71
+ },
72
+ title: {
73
+ marginBottom: 6,
74
+ fontFamily: 'Poppins',
75
+ fontStyle: 'normal',
76
+ fontWeight: '600',
77
+ fontSize: 16,
78
+ color: theme.colors.textGray,
79
+ },
80
+ date: {
81
+ marginBottom: 6,
82
+ fontFamily: 'Poppins',
83
+ fontStyle: 'normal',
84
+ fontWeight: 'normal',
85
+ fontSize: 12,
86
+ },
87
+ orderType: {
88
+ fontSize: 12,
89
+ fontFamily: 'Poppins',
90
+ fontStyle: 'normal',
91
+ fontWeight: 'normal',
92
+ color: theme.colors.orderTypeColor,
93
+ },
94
+ });
95
+
96
+ const getDelayMinutes = (order: any) => {
97
+ const cdtToutc = moment(order?.delivery_datetime).utc().format('YYYY-MM-DD HH:mm:ss')
98
+ const _delivery = order?.delivery_datetime_utc
99
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
100
+ : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
101
+ const _eta = order?.eta_time
102
+ const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
103
+ return Math.ceil(diffTimeAsSeconds / 60)
104
+ }
105
+
106
+ const displayDelayedTime = (order: any) => {
107
+ let tagetedMin = getDelayMinutes(order)
108
+ // get day, hour and minutes
109
+ const sign = tagetedMin >= 0 ? '' : '- '
110
+ tagetedMin = Math.abs(tagetedMin)
111
+ let day: string | number = Math.floor(tagetedMin / 1440)
112
+ const restMinOfTargetedMin = tagetedMin - 1440 * day
113
+ let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
114
+ let restMins: string | number = restMinOfTargetedMin - 60 * restHours
115
+ // make standard time format
116
+ day = day === 0 ? '' : day + 'day '
117
+ restHours = restHours < 10 ? '0' + restHours : restHours
118
+ restMins = restMins < 10 ? '0' + restMins : restMins
119
+
120
+ const finalTaget = sign + day + restHours + ':' + restMins
121
+ return finalTaget
122
+ }
123
+
124
+ const getStatusClassName = (minutes: number) => {
125
+ if (isNaN(Number(minutes))) return 'in_time'
126
+ const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
127
+ return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
128
+ }
129
+
130
+ useEffect(() => {
131
+ const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
132
+ setAllowColumns({
133
+ ...allowColumns,
134
+ timer: slaSettings,
135
+ slaBar: slaSettings
136
+ })
137
+ }, [configState.loading])
138
+
139
+ return (
140
+ <TouchableOpacity
141
+ activeOpacity={1}
142
+ disabled={order?.locked && isLogisticOrder}
143
+ style={styles.cardButton}
144
+ onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
145
+ >
146
+ <Card key={order.id}>
147
+ {!!allowColumns?.slaBar && (
148
+ <Timestatus
149
+ style={{
150
+ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time'
151
+ ? '#00D27A'
152
+ : getStatusClassName(getDelayMinutes(order)) === 'at_risk'
153
+ ? '#FFC700'
154
+ : getStatusClassName(getDelayMinutes(order)) === 'delayed'
155
+ ? '#E63757'
156
+ : ''
157
+ }}
158
+ />
159
+ )}
160
+ <Logo style={styles.logo}>
161
+ <FastImage
162
+ style={styles.icon}
163
+ source={order.business?.logo ? {
164
+ uri: optimizeImage(order.business?.logo, 'h_100,c_limit'),
165
+ priority: FastImage.priority.normal,
166
+ } : theme?.images?.dummies?.businessLogo}
167
+ resizeMode={FastImage.resizeMode.cover}
168
+ />
169
+ </Logo>
170
+ <Information>
171
+ {!!order?.order_group_id && (
172
+ <OText>
173
+ <OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
174
+ </OText>
175
+ )}
176
+ {!!order.business?.name && (
177
+ <OText numberOfLines={1} style={styles.title}>
178
+ {order.business?.name}
179
+ </OText>
180
+ )}
181
+ {!!order?.showNotification && (
182
+ <NotificationIcon>
183
+ <EntypoIcon
184
+ name="dot-single"
185
+ size={32}
186
+ color={theme.colors.primary}
187
+ />
188
+ </NotificationIcon>
189
+ )}
190
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
191
+ <OText
192
+ style={styles.date}
193
+ color={theme.colors.unselectText}
194
+ numberOfLines={1}
195
+ adjustsFontSizeToFit
196
+ >
197
+ {(!!order?.order_group_id && order?.order_group && isLogisticOrder
198
+ ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
199
+ : (t('NO', 'Order No.') + order.id)
200
+ ) + ' · '}
201
+ {order?.delivery_datetime_utc
202
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
203
+ : parseDate(order?.delivery_datetime, { utc: false })}
204
+ </OText>
205
+ {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
206
+ <>
207
+ <OText> · </OText>
208
+ <OText
209
+ style={styles.date}
210
+ color={
211
+ getStatusClassName(getDelayMinutes(order)) === 'in_time'
212
+ ? '#00D27A'
213
+ : getStatusClassName(getDelayMinutes(order)) === 'at_risk'
214
+ ? '#FFC700'
215
+ : getStatusClassName(getDelayMinutes(order)) === 'delayed'
216
+ ? '#E63757'
217
+ : ''}
218
+ >
219
+ {displayDelayedTime(order)}
220
+ </OText>
221
+ </>
222
+ )}
223
+ </View>
224
+ {!isLogisticOrder && (
225
+ <MyOrderOptions>
226
+ <OText
227
+ style={styles.orderType}
228
+ mRight={5}
229
+ numberOfLines={1}
230
+ adjustsFontSizeToFit
231
+ >
232
+ {order.delivery_type === 1
233
+ ? t('DELIVERY', 'Delivery')
234
+ : order.delivery_type === 2
235
+ ? t('PICKUP', 'Pickup')
236
+ : order.delivery_type === 3
237
+ ? t('EAT_IN', 'Eat in')
238
+ : order.delivery_type === 4
239
+ ? t('CURBSIDE', 'Curbside')
240
+ : t('DRIVER_THRU', 'Driver thru')}
241
+ {` · ${getOrderStatus(order.status)}`}
242
+ </OText>
243
+ </MyOrderOptions>
244
+ )}
245
+ </Information>
246
+ </Card>
247
+ </TouchableOpacity>
248
+ )
249
+ }
@@ -0,0 +1,115 @@
1
+ import React, { useState } from 'react'
2
+ import { Animated, StyleSheet, View } from 'react-native'
3
+ import { useTheme } from 'styled-components/native';
4
+ import { useLanguage, useUtils } from 'ordering-components/native'
5
+ import FastImage from 'react-native-fast-image'
6
+ import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
7
+
8
+ import {
9
+ AccordionSection,
10
+ Accordion,
11
+ ContentInfo,
12
+ AccordionContent,
13
+ ProductOptionsList
14
+ } from './styles'
15
+
16
+ import { OText } from '../shared';
17
+
18
+ export const OrdersGroupedItem = (props: any) => {
19
+ const { groupId, orders } = props
20
+
21
+ const theme = useTheme()
22
+ const [, t] = useLanguage()
23
+ const [{ parseDate }] = useUtils();
24
+ const [isActive, setActiveState] = useState(false)
25
+
26
+ const styles = StyleSheet.create({
27
+ productImage: {
28
+ borderRadius: 7.6,
29
+ width: 60,
30
+ height: 60
31
+ },
32
+ logo: {
33
+ borderRadius: 10,
34
+ shadowColor: "#0000006e",
35
+ shadowRadius: 10,
36
+ elevation: 15,
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ marginLeft: 3,
40
+ height: 65,
41
+ width: 65
42
+ },
43
+ title: {
44
+ marginBottom: 2,
45
+ fontWeight: '600',
46
+ fontSize: 16,
47
+ color: theme.colors.textGray,
48
+ },
49
+ orderlength: {
50
+ marginBottom: 2,
51
+ fontSize: 12,
52
+ },
53
+ })
54
+
55
+ return (
56
+ <AccordionSection>
57
+ <Accordion
58
+ activeOpacity={1}
59
+ onPress={() => setActiveState(!isActive)}
60
+ >
61
+ <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
62
+ <ContentInfo>
63
+ <View style={styles.logo}>
64
+ <FastImage
65
+ style={styles.productImage}
66
+ source={theme.images.general.ordersGroup}
67
+ resizeMode={FastImage.resizeMode.cover}
68
+ />
69
+ </View>
70
+ <View style={{ flex: 1, marginLeft: 5, flexDirection: 'column' }}>
71
+ <View>
72
+ <OText numberOfLines={1} style={styles.title}>
73
+ {t('GROUP_NRO', 'Group No.')}{groupId}
74
+ </OText>
75
+ </View>
76
+ <OText
77
+ style={styles.orderlength}
78
+ color={theme.colors.unselectText}
79
+ numberOfLines={1}
80
+ adjustsFontSizeToFit
81
+ >
82
+ {orders.length}{' '}{t('ORDERS', 'Orders')}
83
+ </OText>
84
+ <OText
85
+ style={styles.orderlength}
86
+ color={theme.colors.unselectText}
87
+ numberOfLines={1}
88
+ adjustsFontSizeToFit
89
+ >
90
+ {orders[0]?.delivery_datetime_utc
91
+ ? parseDate(orders[0]?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
92
+ : parseDate(orders[0]?.delivery_datetime, { utc: false })}
93
+ </OText>
94
+ </View>
95
+ <View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
96
+ <View style={{ flexDirection: 'row' }}>
97
+ <MaterialCommunityIcon name={isActive ? 'chevron-up' : 'chevron-down'} size={18} />
98
+ </View>
99
+ </View>
100
+ </ContentInfo>
101
+ </View>
102
+ </Accordion>
103
+
104
+ <View style={{ display: isActive ? 'flex' : 'none' }}>
105
+ <Animated.View>
106
+ <AccordionContent>
107
+ <ProductOptionsList>
108
+ {props.children}
109
+ </ProductOptionsList>
110
+ </AccordionContent>
111
+ </Animated.View>
112
+ </View>
113
+ </AccordionSection>
114
+ )
115
+ }