ordering-ui-react-native 0.19.7-testing → 0.19.8-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 (219) hide show
  1. package/package.json +6 -5
  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/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +138 -106
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +27 -13
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +83 -37
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/StoresList/index.tsx +5 -3
  41. package/themes/business/src/components/UserProfileForm/index.tsx +26 -10
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  43. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  44. package/themes/business/src/types/index.tsx +10 -0
  45. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  47. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  50. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  51. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  52. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  53. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  54. package/themes/original/index.tsx +7 -3
  55. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  56. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  57. package/themes/original/src/components/AddressList/index.tsx +4 -7
  58. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  59. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  60. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  61. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  62. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  63. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  64. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  65. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  69. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  71. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  73. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
  77. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  78. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  87. package/themes/original/src/components/Cart/index.tsx +27 -8
  88. package/themes/original/src/components/CartContent/index.tsx +61 -39
  89. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  90. package/themes/original/src/components/Checkout/index.tsx +199 -55
  91. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  92. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  93. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  94. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  95. package/themes/original/src/components/Favorite/index.tsx +4 -9
  96. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  97. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  98. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  99. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  105. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  108. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  109. package/themes/original/src/components/Home/index.tsx +1 -1
  110. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  111. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  112. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  113. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  114. package/themes/original/src/components/Messages/index.tsx +9 -4
  115. package/themes/original/src/components/Messages/styles.tsx +1 -1
  116. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  120. package/themes/original/src/components/MultiCheckout/index.tsx +226 -52
  121. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  122. package/themes/original/src/components/MultiOrdersDetails/index.tsx +19 -14
  123. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  124. package/themes/original/src/components/NavBar/index.tsx +3 -1
  125. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  126. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  127. package/themes/original/src/components/Notifications/index.tsx +4 -8
  128. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  129. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  130. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  131. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  132. package/themes/original/src/components/OrderProgress/index.tsx +7 -7
  133. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  134. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  135. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  136. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  137. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  138. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  139. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  140. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  141. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  142. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  143. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  144. package/themes/original/src/components/PaymentOptions/index.tsx +75 -33
  145. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  146. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  147. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  148. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  149. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  150. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  151. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  152. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  153. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  154. package/themes/original/src/components/Promotions/index.tsx +4 -4
  155. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  156. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  157. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  158. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  159. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  160. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  161. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  162. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  163. package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
  164. package/themes/original/src/components/StripeElementsForm/index.tsx +5 -3
  165. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  166. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  167. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  168. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  169. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  170. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  171. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  172. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  173. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  174. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  175. package/themes/original/src/components/Wallets/index.tsx +8 -9
  176. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  177. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  178. package/themes/original/src/components/shared/OInput.tsx +1 -4
  179. package/themes/original/src/components/shared/OModal.tsx +12 -14
  180. package/themes/original/src/layouts/Container.tsx +5 -3
  181. package/themes/original/src/types/index.tsx +10 -2
  182. package/themes/original/src/utils/index.tsx +124 -0
  183. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  184. package/src/navigators/BottomNavigator.tsx +0 -117
  185. package/src/navigators/CheckoutNavigator.tsx +0 -66
  186. package/src/navigators/HomeNavigator.tsx +0 -202
  187. package/src/navigators/NavigationRef.tsx +0 -7
  188. package/src/navigators/RootNavigator.tsx +0 -269
  189. package/src/pages/Account.tsx +0 -34
  190. package/src/pages/AddressForm.tsx +0 -62
  191. package/src/pages/AddressList.tsx +0 -24
  192. package/src/pages/BusinessProductsList.tsx +0 -81
  193. package/src/pages/BusinessesListing.tsx +0 -43
  194. package/src/pages/CartList.tsx +0 -49
  195. package/src/pages/Checkout.tsx +0 -101
  196. package/src/pages/ForgotPassword.tsx +0 -24
  197. package/src/pages/Help.tsx +0 -23
  198. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  199. package/src/pages/HelpGuide.tsx +0 -23
  200. package/src/pages/HelpOrder.tsx +0 -23
  201. package/src/pages/Home.tsx +0 -36
  202. package/src/pages/IntroductoryTutorial.tsx +0 -170
  203. package/src/pages/Login.tsx +0 -47
  204. package/src/pages/MomentOption.tsx +0 -30
  205. package/src/pages/MultiCheckout.tsx +0 -31
  206. package/src/pages/MultiOrdersDetails.tsx +0 -27
  207. package/src/pages/MyOrders.tsx +0 -40
  208. package/src/pages/NetworkError.tsx +0 -24
  209. package/src/pages/NotFound.tsx +0 -22
  210. package/src/pages/OrderDetails.tsx +0 -25
  211. package/src/pages/ProductDetails.tsx +0 -55
  212. package/src/pages/Profile.tsx +0 -36
  213. package/src/pages/ReviewDriver.tsx +0 -30
  214. package/src/pages/ReviewOrder.tsx +0 -32
  215. package/src/pages/ReviewProducts.tsx +0 -30
  216. package/src/pages/Sessions.tsx +0 -22
  217. package/src/pages/Signup.tsx +0 -53
  218. package/src/pages/SpinnerLoader.tsx +0 -10
  219. package/src/pages/Splash.tsx +0 -21
@@ -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
+
9
10
  import { useTheme } from 'styled-components/native';
10
11
  import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
11
12
  import { NotificationSetting } from '../../../../../src/components/NotificationSetting'
12
13
  import { NewOrderNotification } from '../NewOrderNotification';
14
+ import { WebsocketStatus } from '../WebsocketStatus'
13
15
 
14
- import { OText, OButton, OModal, OIconButton, OInput, OIcon } from '../shared';
16
+ import { OText, OButton, OModal, OInput, OIcon } from '../shared';
15
17
  import { NotFoundSource } from '../NotFoundSource';
16
18
  import {
17
19
  FiltersTab,
@@ -73,6 +75,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
73
75
 
74
76
  const defaultSearchList = {
75
77
  id: '',
78
+ external_id: '',
76
79
  state: '',
77
80
  city: '',
78
81
  business: '',
@@ -92,35 +95,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
92
95
  const [{ parseDate }] = useUtils()
93
96
  const [configState] = useConfig()
94
97
  const [orientationState] = useDeviceOrientation();
95
- const [, { showToast }] = useToast();
96
98
  const [openSearchModal, setOpenSearchModal] = useState(false)
97
99
  const [openSLASettingModal, setOpenSLASettingModal] = useState(false)
98
100
  const [slaSettingTime, setSlaSettingTime] = useState(6000)
99
101
  const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
100
102
  const [search, setSearch] = useState(defaultSearchList)
101
- const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
102
- const [hour, setHour] = useState(0)
103
- const [minute, setMinute] = useState(0)
104
- const [openedSelect, setOpenedSelect] = useState('')
105
- const WIDTH_SCREEN = orientationState?.dimensions?.width
106
- const HEIGHT_SCREEN = orientationState?.dimensions?.height
107
- const IS_PORTRAIT = orientationState.orientation === PORTRAIT
108
-
109
- const preorderTypeList = [
110
- { key: null, name: t('SLA', 'SLA\'s') },
111
- { key: 'in_time', name: t('OK', 'Ok') },
112
- { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
113
- { key: 'delayed', name: t('DELAYED', 'Delayed') }
114
- ]
115
-
116
- const defaultOrderTypes = [
117
- { key: 1, name: t('DELIVERY', 'Delivery') },
118
- { key: 2, name: t('PICKUP', 'Pickup') },
119
- { key: 3, name: t('EAT_IN', 'Eat in') },
120
- { key: 4, name: t('CURBSIDE', 'Curbside') },
121
- { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
122
- ]
123
-
124
103
  const deliveryStatus = [
125
104
  {
126
105
  key: t('OK', 'Ok'),
@@ -144,6 +123,26 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
144
123
  backColor: '#E63757'
145
124
  }
146
125
  ]
126
+ const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
127
+ const [openedSelect, setOpenedSelect] = useState('')
128
+
129
+ const HEIGHT_SCREEN = orientationState?.dimensions?.height
130
+ const IS_PORTRAIT = orientationState.orientation === PORTRAIT
131
+
132
+ const preorderTypeList = [
133
+ { key: null, name: t('SLA', 'SLA\'s') },
134
+ { key: 'in_time', name: t('OK', 'Ok') },
135
+ { key: 'at_risk', name: t('AT_RISK', 'At Risk') },
136
+ { key: 'delayed', name: t('DELAYED', 'Delayed') }
137
+ ]
138
+
139
+ const defaultOrderTypes = [
140
+ { key: 1, name: t('DELIVERY', 'Delivery') },
141
+ { key: 2, name: t('PICKUP', 'Pickup') },
142
+ { key: 3, name: t('EAT_IN', 'Eat in') },
143
+ { key: 4, name: t('CURBSIDE', 'Curbside') },
144
+ { key: 5, name: t('DRIVE_THRU', 'Drive thru') }
145
+ ]
147
146
 
148
147
  const styles = StyleSheet.create({
149
148
  header: {
@@ -385,15 +384,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
385
384
  setTags({ values: [] })
386
385
  }, [currentTabSelected])
387
386
 
388
- useEffect(() => {
389
- setSelectedTabStatus(deliveryStatus)
390
- }, [])
391
-
392
387
  return (
393
388
  <>
394
389
  <View style={styles.header}>
395
390
  <OText style={styles.title}>{t('MY_ORDERS', 'My orders')}</OText>
396
391
  <IconWrapper>
392
+ <View style={{ marginRight: 10 }}>
393
+ <WebsocketStatus />
394
+ </View>
397
395
  <FeatherIcon
398
396
  name='refresh-cw'
399
397
  color={theme.colors.backgroundDark}
@@ -411,7 +409,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
411
409
  </View>
412
410
  {configState?.configs?.order_deadlines_enabled?.value === '1' && (
413
411
  <View style={styles.SLAwrapper}>
414
- <View style={{ flex: 0.5 }}>
412
+ {/* <View style={{ flex: 0.5 }}>
415
413
  <OButton
416
414
  text={t('SLA_SETTING', 'SLA’s Settings')}
417
415
  textStyle={{ color: theme.colors.backArrow }}
@@ -425,9 +423,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
425
423
  }}
426
424
  onClick={onClickSetting}
427
425
  />
428
- </View>
429
- <View style={{ width: 10, height: '100%' }} />
430
- <View style={{ flex: 0.5, justifyContent: 'center' }}>
426
+ </View> */}
427
+ {/* <View style={{ width: 10, height: '100%' }} /> */}
428
+ {/* <View style={{ flex: 0.5, justifyContent: 'center' }}>
431
429
  <SelectDropdown
432
430
  defaultButtonText={t('SLA', 'SLA\'s')}
433
431
  data={preorderTypeList}
@@ -457,7 +455,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
457
455
  );
458
456
  }}
459
457
  />
460
- </View>
458
+ </View> */}
461
459
  </View>
462
460
  )}
463
461
  <FiltersTab>
@@ -610,6 +608,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
610
608
  orderTitle={props.orderDetailsProps?.orderTitle}
611
609
  handleChangeOrderStatus={handleChangeOrderStatus}
612
610
  handleSendCustomerReview={handleSendCustomerReview}
611
+ isBusinessApp={isBusinessApp}
613
612
  />
614
613
  )}
615
614
  {!logisticOrders?.error?.length &&
@@ -620,6 +619,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
620
619
  onNavigationRedirect={onNavigationRedirect}
621
620
  getOrderStatus={getOrderStatus}
622
621
  handleClickLogisticOrder={handleClickLogisticOrder}
622
+ isBusinessApp={isBusinessApp}
623
623
  isLogisticOrder
624
624
  />
625
625
  )
@@ -715,6 +715,39 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
715
715
  {openSearchModal && (
716
716
  <SearchModalContent>
717
717
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
718
+ <InputContainer style={{ marginBottom: 24 }}>
719
+ <SelectDropdown
720
+ defaultButtonText={search?.timeStatus
721
+ ? preorderTypeList.find(type => type.key === search?.timeStatus)?.name
722
+ : t('SLA', 'SLA\'s')}
723
+ data={preorderTypeList}
724
+ onSelect={(selectedItem, index) => {
725
+ setSearch({ ...search, timeStatus: selectedItem?.key })
726
+ }}
727
+ buttonTextAfterSelection={(selectedItem, index) => {
728
+ return selectedItem.name
729
+ }}
730
+ rowTextForSelection={(item, index) => {
731
+ return item.key
732
+ }}
733
+ buttonStyle={styles.selectOption}
734
+ buttonTextStyle={styles.buttonTextStyle}
735
+ renderDropdownIcon={isOpened => {
736
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
737
+ }}
738
+ dropdownStyle={styles.dropdownStyle}
739
+ dropdownOverlayColor='transparent'
740
+ rowStyle={styles.rowStyle}
741
+ renderCustomizedRowChild={(item, index) => {
742
+ return (
743
+ <SlaOption>
744
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
745
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
746
+ </SlaOption>
747
+ );
748
+ }}
749
+ />
750
+ </InputContainer>
718
751
  <InputContainer>
719
752
  <OInput
720
753
  value={search.id}
@@ -730,6 +763,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
730
763
  onPress={() => setSearch({ ...search, id: '' })}
731
764
  />
732
765
  </InputContainer>
766
+ <InputContainer>
767
+ <OInput
768
+ value={search.external_id}
769
+ onChange={(value: any) => setSearch({ ...search, external_id: value })}
770
+ style={styles.inputStyle}
771
+ placeholder={t('EXTERNAL_ID', 'External id')}
772
+ autoCorrect={false}
773
+ />
774
+ <AntDesignIcon
775
+ name='close'
776
+ size={20}
777
+ style={{ position: 'absolute', right: 12, top: 13 }}
778
+ onPress={() => setSearch({ ...search, external_id: '' })}
779
+ />
780
+ </InputContainer>
733
781
  <OrdersOptionDate
734
782
  {...props}
735
783
  search={search}
@@ -919,15 +967,13 @@ export const Timer = () => {
919
967
  return (
920
968
  <TimerInputWrapper>
921
969
  <OText style={styles.settingTime} color={theme.colors.disabled}>{configs?.order_deadlines_delayed_time?.value}</OText>
922
- <OText>{t('MIN', 'min')}</OText>
970
+ <OText>{t('TIME_MIN', 'min')}</OText>
923
971
  </TimerInputWrapper>
924
972
  )
925
973
  }
926
974
 
927
975
  export const OrdersOption = (props: OrdersOptionParams) => {
928
976
  const [, t] = useLanguage();
929
- const [configState] = useConfig()
930
- const theme = useTheme()
931
977
  const [checkNotificationStatus, setCheckNotificationStatus] = useState({ open: false, checked: false })
932
978
  const ordersProps = {
933
979
  ...props,
@@ -0,0 +1,103 @@
1
+ import React, { useState } from 'react'
2
+ import { Dimensions, View, StyleSheet } from 'react-native'
3
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
+ import { OButton } from '../shared'
5
+ import { useTheme } from 'styled-components/native'
6
+ import { useLanguage } from 'ordering-components/native'
7
+
8
+ export const FooterComponent = (props : any) => {
9
+ const {
10
+ loading,
11
+ reload,
12
+ pagination,
13
+ tabsFilter,
14
+ tabs,
15
+ loadMore
16
+ } = props
17
+
18
+ const theme = useTheme()
19
+ const [, t] = useLanguage()
20
+
21
+ const [orientation, setOrientation] = useState(
22
+ Dimensions.get('window').width < Dimensions.get('window').height
23
+ ? 'Portrait'
24
+ : 'Landscape',
25
+ );
26
+
27
+ Dimensions.addEventListener('change', ({ window: { width, height } }) => {
28
+ if (width < height) {
29
+ setOrientation('Portrait');
30
+ } else {
31
+ setOrientation('Landscape');
32
+ }
33
+ });
34
+
35
+ const styles = StyleSheet.create({
36
+ loadButton: {
37
+ borderRadius: 7.6,
38
+ height: 44,
39
+ marginRight: 10,
40
+ marginBottom: 10,
41
+ marginTop: 5,
42
+ },
43
+ loadButtonText: {
44
+ color: theme.colors.white,
45
+ fontFamily: 'Poppins',
46
+ fontStyle: 'normal',
47
+ fontWeight: 'normal',
48
+ fontSize: 18,
49
+ },
50
+ })
51
+
52
+ return (
53
+ <>
54
+ {(loading || reload) && (
55
+ <>
56
+ <View>
57
+ {[...Array(5)].map((item, i) => (
58
+ <Placeholder key={i} Animation={Fade}>
59
+ <View
60
+ style={{
61
+ width: '100%',
62
+ flexDirection: 'row',
63
+ marginBottom: 10,
64
+ }}>
65
+ <PlaceholderLine
66
+ width={orientation === 'Portrait' ? 22 : 11}
67
+ height={74}
68
+ style={{
69
+ marginRight: 20,
70
+ marginBottom: 20,
71
+ borderRadius: 7.6,
72
+ }}
73
+ />
74
+ <Placeholder>
75
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
76
+ <PlaceholderLine width={50} />
77
+ <PlaceholderLine width={20} />
78
+ </Placeholder>
79
+ </View>
80
+ </Placeholder>
81
+ ))}
82
+ </View>
83
+ </>
84
+ )}
85
+
86
+ {pagination?.totalPages &&
87
+ !loading &&
88
+ !reload &&
89
+ JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) &&
90
+ pagination?.currentPage < pagination?.totalPages && (
91
+ <OButton
92
+ onClick={() => loadMore && loadMore()}
93
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
94
+ imgRightSrc={null}
95
+ textStyle={styles.loadButtonText}
96
+ style={styles.loadButton}
97
+ bgColor={theme.colors.primary}
98
+ borderColor={theme.colors.primary}
99
+ />
100
+ )}
101
+ </>
102
+ )
103
+ }
@@ -1,17 +1,31 @@
1
- import React from 'react';
2
- import { StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
1
+ import React, { useState } from 'react';
2
+ import { StyleSheet, TouchableOpacity, FlatList, RefreshControl } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useLanguage, useUtils } from 'ordering-components/native';
5
5
  import { Card, Logo, Information, Header, Badge } from './styles';
6
6
  import { OIcon, OText } from '../shared';
7
7
  import { PreviousMessagesParams } from '../../types';
8
+ import { FooterComponent } from './FooterMessageComponent';
8
9
 
9
10
  export const PreviousMessages = (props: PreviousMessagesParams) => {
10
- const { orders, onNavigationRedirect, setOrders } = props;
11
+ const {
12
+ orders,
13
+ onNavigationRedirect,
14
+ setOrders,
15
+ getOrders,
16
+ pagination,
17
+ loading,
18
+ reload,
19
+ tabs,
20
+ loadMore,
21
+ tabsFilter,
22
+ error
23
+ } = props;
11
24
 
12
25
  const [, t] = useLanguage();
13
26
  const theme = useTheme();
14
27
  const [{ parseDate, optimizeImage }] = useUtils();
28
+ const [refreshing] = useState(false);
15
29
 
16
30
  const handlePressOrder = (order: any) => {
17
31
  const uuid = order?.id;
@@ -253,63 +267,91 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
253
267
  fontStyle: 'normal',
254
268
  fontWeight: 'normal',
255
269
  color: theme.colors.orderTypeColor,
256
- },
270
+ }
257
271
  });
258
272
 
259
- return (
260
- <>
261
- {orders?.length > 0 &&
262
- orders?.map((order: any) => (
263
- <TouchableOpacity
264
- key={order?.id}
265
- onPress={() => handlePressOrder(order)}
266
- style={styles.cardButton}
267
- activeOpacity={1}>
268
- <Card key={order?.id}>
269
- <Logo style={styles.logo}>
270
- <OIcon
271
- url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
272
- src={!order?.business?.logo && theme?.images?.dummies?.businessLogo}
273
- style={styles.icon}
274
- />
275
- </Logo>
276
- <Information>
277
- <Header>
278
- <OText numberOfLines={1} style={styles.title}>
279
- {order?.business?.name}
280
- </OText>
273
+ const MessageComponent = (props : any) => {
274
+ const order = props.item
275
+ return (
276
+ <>
277
+ {!reload &&
278
+ !error &&
279
+ JSON.stringify(tabsFilter) === JSON.stringify(tabs[0].tags) && (
280
+ <TouchableOpacity
281
+ key={order?.id}
282
+ onPress={() => handlePressOrder(order)}
283
+ style={styles.cardButton}
284
+ activeOpacity={1}>
285
+ <Card key={order?.id}>
286
+ <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}
290
+ style={styles.icon}
291
+ />
292
+ </Logo>
293
+ <Information>
294
+ <Header>
295
+ <OText numberOfLines={1} style={styles.title}>
296
+ {order?.business?.name}
297
+ </OText>
281
298
 
282
- {order?.unread_count > 0 && (
283
- <Badge>
284
- <OText size={14} style={styles.badge}>
285
- {order?.unread_count}
286
- </OText>
287
- </Badge>
288
- )}
289
- </Header>
299
+ {order?.unread_count > 0 && (
300
+ <Badge>
301
+ <OText size={14} style={styles.badge}>
302
+ {order?.unread_count}
303
+ </OText>
304
+ </Badge>
305
+ )}
306
+ </Header>
290
307
 
291
- <OText
292
- style={styles.date}
293
- numberOfLines={1}
294
- adjustsFontSizeToFit
295
- size={20}>
296
- {t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
297
- {order?.delivery_datetime_utc
298
- ? parseDate(order?.delivery_datetime_utc)
299
- : parseDate(order?.delivery_datetime, { utc: false })}
300
- </OText>
308
+ <OText
309
+ style={styles.date}
310
+ numberOfLines={1}
311
+ adjustsFontSizeToFit
312
+ size={20}>
313
+ {t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
314
+ {order?.delivery_datetime_utc
315
+ ? parseDate(order?.delivery_datetime_utc)
316
+ : parseDate(order?.delivery_datetime, { utc: false })}
317
+ </OText>
301
318
 
302
- <OText
303
- style={styles.orderType}
304
- mRight={5}
305
- numberOfLines={1}
306
- adjustsFontSizeToFit>
307
- {getOrderStatus(order?.status)?.value}
308
- </OText>
309
- </Information>
310
- </Card>
311
- </TouchableOpacity>
312
- ))}
319
+ <OText
320
+ style={styles.orderType}
321
+ mRight={5}
322
+ numberOfLines={1}
323
+ adjustsFontSizeToFit>
324
+ {getOrderStatus(order?.status)?.value}
325
+ </OText>
326
+ </Information>
327
+ </Card>
328
+ </TouchableOpacity>
329
+ )}
330
+ </>
331
+ )
332
+ }
333
+
334
+ return (
335
+ <>
336
+ <FlatList
337
+ data={orders}
338
+ renderItem={MessageComponent}
339
+ keyExtractor={(order) => order?.id}
340
+ showsVerticalScrollIndicator={false}
341
+ style={{ flex: 1 }}
342
+ refreshControl={<RefreshControl
343
+ refreshing={refreshing}
344
+ onRefresh={() => getOrders?.()}
345
+ />}
346
+ ListFooterComponent={<FooterComponent
347
+ loading={loading}
348
+ reload={reload}
349
+ pagination={pagination}
350
+ tabsFilter={tabsFilter}
351
+ tabs={tabs}
352
+ loadMore={loadMore}
353
+ />}
354
+ />
313
355
  </>
314
356
  );
315
357
  };
@@ -21,7 +21,13 @@ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrienta
21
21
 
22
22
  const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
23
23
 
24
- export const OrderItem = (props: any) => {
24
+ function OrderItemPropsAreEqual(prevProps: any, nextProps: any) {
25
+ return JSON.stringify(prevProps.order) === JSON.stringify(nextProps.order) &&
26
+ JSON.stringify(prevProps._order) === JSON.stringify(nextProps._order) &&
27
+ prevProps.currentTabSelected === nextProps.currentTabSelected
28
+ }
29
+
30
+ export const OrderItem = React.memo((props: any) => {
25
31
  const {
26
32
  order,
27
33
  _order,
@@ -94,12 +100,13 @@ export const OrderItem = (props: any) => {
94
100
  });
95
101
 
96
102
  const getDelayMinutes = (order: any) => {
97
- const cdtToutc = moment(order?.delivery_datetime).utc().format('YYYY-MM-DD HH:mm:ss')
103
+ const offset = 300
104
+ const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
98
105
  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' })
106
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
107
+ : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
101
108
  const _eta = order?.eta_time
102
- const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
109
+ const diffTimeAsSeconds = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'seconds')
103
110
  return Math.ceil(diffTimeAsSeconds / 60)
104
111
  }
105
112
 
@@ -121,12 +128,6 @@ export const OrderItem = (props: any) => {
121
128
  return finalTaget
122
129
  }
123
130
 
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
131
  useEffect(() => {
131
132
  const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
132
133
  setAllowColumns({
@@ -146,24 +147,16 @@ export const OrderItem = (props: any) => {
146
147
  <Card key={order.id}>
147
148
  {!!allowColumns?.slaBar && (
148
149
  <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
- }}
150
+ timeState={order?.time_status}
158
151
  />
159
152
  )}
160
153
  <Logo style={styles.logo}>
161
154
  <FastImage
162
155
  style={styles.icon}
163
- source={order.business?.logo ? {
164
- uri: optimizeImage(order.business?.logo, 'h_100,c_limit'),
156
+ source={order.business?.logo?.includes('https') ? {
157
+ uri: order.business?.logo,
165
158
  priority: FastImage.priority.normal,
166
- } : theme?.images?.dummies?.businessLogo}
159
+ } : order.business?.logo ?? theme?.images?.dummies?.businessLogo}
167
160
  resizeMode={FastImage.resizeMode.cover}
168
161
  />
169
162
  </Logo>
@@ -195,11 +188,11 @@ export const OrderItem = (props: any) => {
195
188
  adjustsFontSizeToFit
196
189
  >
197
190
  {(!!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
- ) + ' · '}
191
+ ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}`
192
+ : (t('NO', 'Order No.') + order.id)
193
+ ) + ' · '}
201
194
  {order?.delivery_datetime_utc
202
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
195
+ ? parseDate(order?.delivery_datetime_utc)
203
196
  : parseDate(order?.delivery_datetime, { utc: false })}
204
197
  </OText>
205
198
  {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
@@ -208,11 +201,11 @@ export const OrderItem = (props: any) => {
208
201
  <OText
209
202
  style={styles.date}
210
203
  color={
211
- getStatusClassName(getDelayMinutes(order)) === 'in_time'
204
+ order?.time_status === 'in_time'
212
205
  ? '#00D27A'
213
- : getStatusClassName(getDelayMinutes(order)) === 'at_risk'
206
+ : order?.time_status === 'at_risk'
214
207
  ? '#FFC700'
215
- : getStatusClassName(getDelayMinutes(order)) === 'delayed'
208
+ : order?.time_status === 'delayed'
216
209
  ? '#E63757'
217
210
  : ''}
218
211
  >
@@ -246,4 +239,4 @@ export const OrderItem = (props: any) => {
246
239
  </Card>
247
240
  </TouchableOpacity>
248
241
  )
249
- }
242
+ }, OrderItemPropsAreEqual)