ordering-ui-react-native 0.18.2 → 0.18.3-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 (263) hide show
  1. package/package.json +9 -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 +0 -20
  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 +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
  36. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  37. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  38. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  39. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  40. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  41. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  42. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  44. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  45. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  46. package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
  47. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
  49. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  50. package/themes/business/src/components/StoresList/index.tsx +6 -5
  51. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OModal.tsx +16 -9
  55. package/themes/business/src/types/index.tsx +8 -0
  56. package/themes/business/src/utils/index.tsx +4 -4
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/original/index.tsx +7 -3
  69. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  70. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  71. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  72. package/themes/original/src/components/AddressList/index.tsx +5 -8
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  78. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  79. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  80. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  81. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  82. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  83. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  84. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  87. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  92. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  93. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  96. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  99. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  107. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  108. package/themes/original/src/components/Cart/index.tsx +49 -47
  109. package/themes/original/src/components/CartContent/index.tsx +99 -38
  110. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  111. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  112. package/themes/original/src/components/Checkout/index.tsx +324 -43
  113. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  114. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  115. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  116. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  117. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  118. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  119. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  120. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  121. package/themes/original/src/components/Favorite/index.tsx +4 -9
  122. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  123. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  124. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  125. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  126. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  127. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  128. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  129. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  131. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  132. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  133. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  134. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  135. package/themes/original/src/components/Home/index.tsx +14 -5
  136. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  137. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  139. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  140. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  141. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  142. package/themes/original/src/components/Messages/index.tsx +15 -4
  143. package/themes/original/src/components/Messages/styles.tsx +1 -1
  144. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  145. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  146. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  148. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  149. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  150. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  151. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  152. package/themes/original/src/components/NavBar/index.tsx +20 -13
  153. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  154. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  155. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  156. package/themes/original/src/components/Notifications/index.tsx +4 -8
  157. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  158. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  159. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  160. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  161. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  162. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  163. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  164. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  165. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  166. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  170. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  171. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  172. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  173. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  174. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  175. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  177. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  179. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  180. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  181. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  182. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  183. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  185. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  187. package/themes/original/src/components/Promotions/index.tsx +6 -6
  188. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  189. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  190. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  191. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  192. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  193. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  194. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  195. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  196. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  197. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  198. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  199. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  200. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  201. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  202. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  205. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  206. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  208. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  209. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  210. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  211. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  212. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  213. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  214. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  215. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  216. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  217. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  218. package/themes/original/src/components/Wallets/index.tsx +48 -60
  219. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  220. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  221. package/themes/original/src/components/shared/OButton.tsx +3 -3
  222. package/themes/original/src/components/shared/OInput.tsx +4 -5
  223. package/themes/original/src/components/shared/OModal.tsx +15 -17
  224. package/themes/original/src/layouts/Container.tsx +5 -3
  225. package/themes/original/src/types/index.tsx +28 -6
  226. package/themes/original/src/utils/index.tsx +180 -13
  227. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  228. package/src/navigators/BottomNavigator.tsx +0 -117
  229. package/src/navigators/CheckoutNavigator.tsx +0 -66
  230. package/src/navigators/HomeNavigator.tsx +0 -202
  231. package/src/navigators/NavigationRef.tsx +0 -7
  232. package/src/navigators/RootNavigator.tsx +0 -269
  233. package/src/pages/Account.tsx +0 -34
  234. package/src/pages/AddressForm.tsx +0 -62
  235. package/src/pages/AddressList.tsx +0 -24
  236. package/src/pages/BusinessProductsList.tsx +0 -81
  237. package/src/pages/BusinessesListing.tsx +0 -43
  238. package/src/pages/CartList.tsx +0 -49
  239. package/src/pages/Checkout.tsx +0 -101
  240. package/src/pages/ForgotPassword.tsx +0 -24
  241. package/src/pages/Help.tsx +0 -23
  242. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  243. package/src/pages/HelpGuide.tsx +0 -23
  244. package/src/pages/HelpOrder.tsx +0 -23
  245. package/src/pages/Home.tsx +0 -36
  246. package/src/pages/IntroductoryTutorial.tsx +0 -170
  247. package/src/pages/Login.tsx +0 -47
  248. package/src/pages/MomentOption.tsx +0 -30
  249. package/src/pages/MultiCheckout.tsx +0 -31
  250. package/src/pages/MultiOrdersDetails.tsx +0 -27
  251. package/src/pages/MyOrders.tsx +0 -40
  252. package/src/pages/NetworkError.tsx +0 -24
  253. package/src/pages/NotFound.tsx +0 -22
  254. package/src/pages/OrderDetails.tsx +0 -25
  255. package/src/pages/ProductDetails.tsx +0 -55
  256. package/src/pages/Profile.tsx +0 -36
  257. package/src/pages/ReviewDriver.tsx +0 -30
  258. package/src/pages/ReviewOrder.tsx +0 -32
  259. package/src/pages/ReviewProducts.tsx +0 -30
  260. package/src/pages/Sessions.tsx +0 -22
  261. package/src/pages/Signup.tsx +0 -53
  262. package/src/pages/SpinnerLoader.tsx +0 -10
  263. package/src/pages/Splash.tsx +0 -21
@@ -1,13 +1,16 @@
1
1
  import React, { useState, useEffect, useMemo } from 'react';
2
- import { View, StyleSheet, BackHandler, Platform, Linking, RefreshControl } from 'react-native';
2
+ import { View, StyleSheet, BackHandler, Platform, Linking, RefreshControl, SafeAreaView } from 'react-native';
3
3
  import LinearGradient from 'react-native-linear-gradient';
4
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
4
5
  import { _setStoreData } from '../../providers/StoreUtil';
5
6
  import {
6
7
  useLanguage,
7
8
  OrderDetails as OrderDetailsConTableoller,
8
9
  useUtils,
9
10
  useOrder,
10
- useConfig
11
+ useConfig,
12
+ useToast,
13
+ ToastType
11
14
  } from 'ordering-components/native';
12
15
  import { useTheme } from 'styled-components/native';
13
16
  import { showLocation } from 'react-native-map-link';
@@ -33,14 +36,16 @@ import {
33
36
  Divider,
34
37
  OrderAction,
35
38
  PlaceSpotWrapper,
36
- ProfessionalPhoto
39
+ ProfessionalPhoto,
40
+ TopHeader,
41
+ TopActions
37
42
  } from './styles';
38
43
  import { OButton, OIcon, OModal, OText } from '../shared';
39
44
  import { ProductItemAccordion } from '../ProductItemAccordion';
40
45
  import { TouchableOpacity } from 'react-native-gesture-handler';
41
46
  import { OrderDetailsParams } from '../../types';
42
47
  import { GoogleMap } from '../GoogleMap';
43
- import { verifyDecimals, getOrderStatus } from '../../utils';
48
+ import { verifyDecimals, getOrderStatus, getOrderStatuPickUp } from '../../utils';
44
49
  import { OSRow } from '../OrderSummary/styles';
45
50
  import AntIcon from 'react-native-vector-icons/AntDesign'
46
51
  import { TaxInformation } from '../TaxInformation';
@@ -49,6 +54,7 @@ import NavBar from '../NavBar'
49
54
  import { OrderHistory } from './OrderHistory';
50
55
  import { PlaceSpot } from '../PlaceSpot'
51
56
  import { SendGiftCard } from '../GiftCard/SendGiftCard'
57
+ import { OrderEta } from './OrderEta'
52
58
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
53
59
  const {
54
60
  navigation,
@@ -64,7 +70,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
64
70
  } = props;
65
71
 
66
72
  const theme = useTheme();
67
-
73
+ const [, { showToast }] = useToast()
68
74
  const styles = StyleSheet.create({
69
75
  rowDirection: {
70
76
  flexDirection: 'row',
@@ -103,6 +109,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
103
109
  borderBottomWidth: 1,
104
110
  marginVertical: 10,
105
111
  paddingVertical: 5
112
+ },
113
+ wrapperNavbar: {
114
+ paddingHorizontal: 20,
115
+ paddingTop: 0,
106
116
  }
107
117
  });
108
118
 
@@ -116,11 +126,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
116
126
  const [isOrderHistory, setIsOrderHistory] = useState(false)
117
127
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
118
128
  const [refreshing] = useState(false);
129
+ const [showTitle, setShowTitle] = useState(false)
130
+
119
131
  const { order, businessData } = props.order;
120
132
  const mapValidStatuses = [9, 19, 23]
121
133
  const placeSpotTypes = [3, 4, 5]
122
134
  const directionTypes = [2, 3, 4, 5]
123
- const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
135
+ const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
136
+ const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
137
+ const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
124
138
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
125
139
  const isGiftCardOrder = !order?.business_id
126
140
  const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
@@ -134,6 +148,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
134
148
  const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
135
149
  const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
136
150
  const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
151
+ const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
137
152
  const walletName: any = {
138
153
  cash: {
139
154
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
@@ -191,7 +206,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
191
206
  order: {
192
207
  id: order?.id,
193
208
  business_id: order?.business_id,
194
- logo: order.business?.logo,
209
+ logo: order.business?.logo || theme.images.dummies.businessLogo,
195
210
  driver: order?.driver,
196
211
  products: order?.products,
197
212
  review: order?.review,
@@ -216,6 +231,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
216
231
  getOrder()
217
232
  }
218
233
 
234
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
235
+ setShowTitle(contentOffset.y > 30)
236
+ }
237
+
219
238
  useEffect(() => {
220
239
  const _businessId = 'businessId:' + businessData?.id
221
240
  if (reorderState?.error) {
@@ -335,160 +354,66 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
335
354
  }
336
355
  }, [driverLocation]);
337
356
 
357
+ useEffect(() => {
358
+ if (props?.order?.error && !props?.order?.loading) {
359
+ showToast(ToastType.Error, props?.order?.error)
360
+ navigation.navigate('BusinessList')
361
+ }
362
+ }, [props?.order?.error, props?.order?.loading])
363
+
364
+
365
+ useEffect(() => {
366
+ if (!order?.delivery_type) return
367
+ setIsPickup(order?.delivery_type === 2)
368
+ }, [order?.delivery_type])
369
+
338
370
  return (
339
- <OrderDetailsContainer
340
- keyboardShouldPersistTaps="handled"
341
- refreshControl={
342
- <RefreshControl
343
- refreshing={refreshing}
344
- onRefresh={() => resfreshOrder()}
345
- />
346
- }
347
- >
348
- {(!order || Object.keys(order).length === 0) && (
349
- <Placeholder style={{ marginTop: 30 }}>
350
- <Header>
351
- <OrderInfo>
352
- <OrderData>
353
- <PlaceholderLine width={60} height={15} />
354
- <PlaceholderLine width={60} height={10} />
355
- <StaturBar>
356
- <PlaceholderLine height={15} />
357
- <PlaceholderLine width={40} height={20} />
358
- </StaturBar>
359
- </OrderData>
360
- <View
361
- style={{
362
- height: 8,
363
- backgroundColor: theme.colors.backgroundGray100,
364
- marginTop: 18,
365
- marginHorizontal: -40,
366
- }}
371
+ <SafeAreaView>
372
+ <View style={styles.wrapperNavbar}>
373
+ <TopHeader>
374
+ <>
375
+ <TopActions onPress={() => handleArrowBack()}>
376
+ <IconAntDesign
377
+ name='arrowleft'
378
+ size={26}
367
379
  />
368
- </OrderInfo>
369
- </Header>
370
- <OrderContent>
371
- <OrderBusiness>
372
- <PlaceholderLine width={30} height={20} />
373
- <PlaceholderLine width={60} height={15} />
374
- <PlaceholderLine width={75} height={10} />
375
- <PlaceholderLine width={40} height={10} />
376
- <PlaceholderLine width={95} height={10} />
377
- </OrderBusiness>
378
- </OrderContent>
379
- <View
380
- style={{
381
- height: 8,
382
- backgroundColor: theme.colors.backgroundGray100,
383
- marginTop: 18,
384
- marginHorizontal: -40,
385
- }}
386
- />
387
- <OrderCustomer>
388
- <PlaceholderLine width={20} height={20} />
389
- <PlaceholderLine width={70} height={15} />
390
- <PlaceholderLine width={65} height={10} />
391
- <PlaceholderLine width={80} height={10} />
392
- <PlaceholderLine width={70} height={10} />
393
- <View style={{ marginTop: 10 }}>
394
- <PlaceholderLine width={60} height={20} />
395
- <PlaceholderLine width={40} height={10} />
396
- </View>
397
- </OrderCustomer>
398
- </Placeholder>
399
- )}
400
- {order && Object.keys(order).length > 0 && (
401
- <>
402
- <Header>
403
- <NavBar
404
- title={`${t('ORDER', 'Order')} #${order?.id}`}
405
- titleAlign={'center'}
406
- onActionLeft={handleArrowBack}
407
- showCall={false}
408
- btnStyle={{ paddingLeft: 0 }}
409
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
410
- titleWrapStyle={{ paddingHorizontal: 0 }}
411
- titleStyle={{ marginRight: 0, marginLeft: 0 }}
412
- subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
413
- {
414
- activeStatus.includes(order?.status)
415
- ? order?.eta_time + 'min'
416
- : order?.delivery_datetime_utc
417
- ? parseDate(order?.delivery_datetime_utc)
418
- : parseDate(order?.delivery_datetime, { utc: false })
419
- }
420
- </OText>}
421
- />
422
- {enabledPoweredByOrdering && (
423
- <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
424
- <OText>
425
- Powered By Ordering.co
426
- </OText>
427
- </View>
380
+ </TopActions>
381
+ {showTitle && (
382
+ <OText
383
+ size={16}
384
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
385
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
386
+ numberOfLines={2}
387
+ ellipsizeMode='tail'
388
+ >
389
+ {`${t('ORDER', 'Order')} #${order?.id}`}
390
+ </OText>
428
391
  )}
429
- {!isGiftCardOrder && (
392
+ </>
393
+ </TopHeader>
394
+ </View>
395
+ <OrderDetailsContainer
396
+ keyboardShouldPersistTaps="handled"
397
+ refreshControl={
398
+ <RefreshControl
399
+ refreshing={refreshing}
400
+ onRefresh={() => resfreshOrder()}
401
+ />
402
+ }
403
+ onScroll={handleScroll}
404
+ >
405
+
406
+ {(!order || Object.keys(order).length === 0) && (
407
+ <Placeholder style={{ marginTop: 30 }}>
408
+ <Header>
430
409
  <OrderInfo>
431
410
  <OrderData>
432
- <View style={styles.linkWrapper}>
433
- {
434
- (
435
- parseInt(order?.status) === 1 ||
436
- parseInt(order?.status) === 11 ||
437
- parseInt(order?.status) === 15
438
- ) && !order.review && !isReviewed && (
439
- <TouchableOpacity
440
- activeOpacity={0.7}
441
- style={{ marginTop: 6, marginRight: 10 }}
442
- onPress={() => handleClickOrderReview(order)}
443
- >
444
- <OText
445
- size={12}
446
- lineHeight={15}
447
- color={theme.colors.primary}
448
- style={{ textDecorationLine: 'underline' }}
449
- >
450
- {t('REVIEW_YOUR_ORDER', 'Review your order')}
451
- </OText>
452
- </TouchableOpacity>
453
- )}
454
- <TouchableOpacity
455
- activeOpacity={0.7}
456
- style={{ marginTop: 6 }}
457
- onPress={() => setIsOrderHistory(true)}
458
- >
459
- <OText
460
- size={12}
461
- lineHeight={15}
462
- color={theme.colors.primary}
463
- style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
464
- >
465
- {t('VIEW_DETAILS', 'View Details')}
466
- </OText>
467
- </TouchableOpacity>
468
- </View>
469
- {!hideDeliveryProgress && (
470
- <>
471
- <StaturBar>
472
- <LinearGradient
473
- start={{ x: 0.0, y: 0.0 }}
474
- end={{
475
- x: getOrderStatus(order?.status)?.percentage || 0,
476
- y: 0,
477
- }}
478
- locations={[0.9999, 0.9999]}
479
- colors={[theme.colors.primary, theme.colors.backgroundGray100]}
480
- style={styles.statusBar}
481
- />
482
- </StaturBar>
483
- <OText
484
- size={16}
485
- lineHeight={24}
486
- weight={'600'}
487
- color={theme.colors.textNormal}>
488
- {getOrderStatus(order?.status)?.value}
489
- </OText>
490
- </>
491
- )}
411
+ <PlaceholderLine width={60} height={15} />
412
+ <PlaceholderLine width={60} height={10} />
413
+ <StaturBar>
414
+ <PlaceholderLine height={15} />
415
+ <PlaceholderLine width={40} height={20} />
416
+ </StaturBar>
492
417
  </OrderData>
493
418
  <View
494
419
  style={{
@@ -499,124 +424,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
499
424
  }}
500
425
  />
501
426
  </OrderInfo>
502
- )}
503
- </Header>
504
- <OrderContent>
505
- {!isGiftCardOrder && (
427
+ </Header>
428
+ <OrderContent>
506
429
  <OrderBusiness>
507
- <OText
508
- size={16}
509
- lineHeight={24}
510
- weight={'500'}
511
- color={theme.colors.textNormal}
512
- mBottom={12}>
513
- {t('FROM', 'From')}
514
- </OText>
515
- <View
516
- style={{
517
- display: 'flex',
518
- flexDirection: 'column',
519
- alignItems: 'flex-start',
520
- }}>
521
- <View
522
- style={{
523
- flexDirection: 'row',
524
- alignItems: 'center',
525
- justifyContent: 'space-between',
526
- }}>
527
- <OText
528
- size={13}
529
- lineHeight={20}
530
- color={theme.colors.textNormal}
531
- style={{ flexGrow: 1, flexBasis: '80%' }}>
532
- {order?.business?.name}
533
- </OText>
534
- <Icons>
535
- {!!order?.business?.cellphone && !hideBusinessPhone && (
536
- <TouchableOpacity
537
- onPress={() => order?.business?.cellphone &&
538
- Linking.openURL(`tel:${order?.business?.cellphone}`)
539
- }
540
- style={{ paddingEnd: 5 }}
541
- >
542
- <OIcon
543
- src={theme.images.general.phone}
544
- width={16}
545
- color={theme.colors.disabled}
546
- />
547
- </TouchableOpacity>
548
- )}
549
- {!hideBusinessMessages && (
550
- <TouchableOpacity
551
- style={{ paddingStart: 5 }}
552
- onPress={() => handleGoToMessages('business')}>
553
- <OIcon
554
- src={theme.images.general.chat}
555
- width={16}
556
- color={theme.colors.disabled}
557
- />
558
- </TouchableOpacity>
559
- )}
560
- </Icons>
561
- </View>
562
- {!hideBusinessEmail && (
563
- <OText
564
- size={12}
565
- lineHeight={18}
566
- color={theme.colors.textNormal}
567
- mBottom={2}>
568
- {order?.business?.email}
569
- </OText>
570
- )}
571
- {!!order?.business?.cellphone && !hideBusinessPhone && (
572
- <OText
573
- size={12}
574
- lineHeight={18}
575
- color={theme.colors.textNormal}
576
- mBottom={2}>
577
- {order?.business?.cellphone}
578
- </OText>
579
- )}
580
- {!hideBusinessAddress && (
581
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
582
- {order?.business?.address}
583
- </OText>
584
- )}
585
- </View>
586
- {directionTypes.includes(order?.delivery_type) && (
587
- <OButton
588
- text={t('GET_DIRECTIONS', 'Get Directions')}
589
- imgRightSrc=''
590
- textStyle={{ color: theme.colors.white }}
591
- style={{
592
- alignSelf: 'center',
593
- borderRadius: 10,
594
- marginTop: 30
595
- }}
596
- onClick={() => showLocation({
597
- latitude: order?.business?.location?.lat,
598
- longitude: order?.business?.location?.lng,
599
- naverCallerName: 'com.reactnativeappstemplate5',
600
- dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
601
- dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
602
- cancelText: t('CANCEL', 'Cancel'),
603
- })}
604
- />
605
- )}
430
+ <PlaceholderLine width={30} height={20} />
431
+ <PlaceholderLine width={60} height={15} />
432
+ <PlaceholderLine width={75} height={10} />
433
+ <PlaceholderLine width={40} height={10} />
434
+ <PlaceholderLine width={95} height={10} />
606
435
  </OrderBusiness>
607
- )}
608
-
609
- {!isGiftCardOrder && placeSpotTypes.includes(order?.delivery_type) && (
610
- <PlaceSpotWrapper>
611
- <PlaceSpot
612
- isInputMode
613
- cart={order}
614
- spotNumberDefault={order?.spot_number}
615
- vehicleDefault={order?.vehicle}
616
- />
617
- </PlaceSpotWrapper>
618
- )}
619
-
436
+ </OrderContent>
620
437
  <View
621
438
  style={{
622
439
  height: 8,
@@ -626,172 +443,403 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
626
443
  }}
627
444
  />
628
445
  <OrderCustomer>
629
- <OText
630
- size={16}
631
- lineHeight={24}
632
- weight={'500'}
633
- color={theme.colors.textNormal}
634
- mBottom={12}>
635
- {isGiftCardOrder ? t('CUSTOMER', 'Customer') : t('TO', 'To')}
636
- </OText>
637
- <Customer>
638
- <InfoBlock>
446
+ <PlaceholderLine width={20} height={20} />
447
+ <PlaceholderLine width={70} height={15} />
448
+ <PlaceholderLine width={65} height={10} />
449
+ <PlaceholderLine width={80} height={10} />
450
+ <PlaceholderLine width={70} height={10} />
451
+ <View style={{ marginTop: 10 }}>
452
+ <PlaceholderLine width={60} height={20} />
453
+ <PlaceholderLine width={40} height={10} />
454
+ </View>
455
+ </OrderCustomer>
456
+ </Placeholder>
457
+ )}
458
+ {order && Object.keys(order).length > 0 && (
459
+ <>
460
+ <Header>
461
+ <NavBar
462
+ hideArrowLeft
463
+ title={`${t('ORDER', 'Order')} #${order?.id}`}
464
+ titleAlign={'center'}
465
+ showCall={false}
466
+ btnStyle={{ paddingLeft: 0 }}
467
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
468
+ titleWrapStyle={{ paddingHorizontal: 0 }}
469
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
470
+ subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
471
+ {activeStatus.includes(order?.status) ? (
472
+ <OrderEta order={order} />
473
+ ) : (
474
+ parseDate(order?.reporting_data?.at[`status:${order.status}`])
475
+ )}
476
+ </OText>}
477
+ />
478
+ {enabledPoweredByOrdering && (
479
+ <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
480
+ <OText>
481
+ Powered By Ordering.co
482
+ </OText>
483
+ </View>
484
+ )}
485
+ {!isGiftCardOrder && (
486
+ <OrderInfo>
487
+ <OrderData>
488
+ <View style={styles.linkWrapper}>
489
+ {
490
+ (
491
+ parseInt(order?.status) === 1 ||
492
+ parseInt(order?.status) === 11 ||
493
+ parseInt(order?.status) === 15
494
+ ) && !order.review && !isReviewed && (
495
+ <TouchableOpacity
496
+ activeOpacity={0.7}
497
+ style={{ marginTop: 6, marginRight: 10 }}
498
+ onPress={() => handleClickOrderReview(order)}
499
+ >
500
+ <OText
501
+ size={12}
502
+ lineHeight={15}
503
+ color={theme.colors.primary}
504
+ style={{ textDecorationLine: 'underline' }}
505
+ >
506
+ {t('REVIEW_YOUR_ORDER', 'Review your order')}
507
+ </OText>
508
+ </TouchableOpacity>
509
+ )}
510
+ <TouchableOpacity
511
+ activeOpacity={0.7}
512
+ style={{ marginTop: 6 }}
513
+ onPress={() => setIsOrderHistory(true)}
514
+ >
515
+ <OText
516
+ size={12}
517
+ lineHeight={15}
518
+ color={theme.colors.primary}
519
+ style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
520
+ >
521
+ {t('VIEW_DETAILS', 'View Details')}
522
+ </OText>
523
+ </TouchableOpacity>
524
+ </View>
525
+ {!hideDeliveryProgress && (
526
+ <>
527
+ <StaturBar>
528
+ <LinearGradient
529
+ start={{ x: 0.0, y: 0.0 }}
530
+ end={{
531
+ x: progressBarObjt(order?.status)?.percentage || 0,
532
+ y: 0,
533
+ }}
534
+ locations={[0.9999, 0.9999]}
535
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
536
+ style={styles.statusBar}
537
+ />
538
+ </StaturBar>
539
+ <OText
540
+ size={16}
541
+ lineHeight={24}
542
+ weight={'600'}
543
+ color={theme.colors.textNormal}>
544
+ {progressBarObjt(order?.status)?.value}
545
+ </OText>
546
+ </>
547
+ )}
548
+ </OrderData>
549
+ <View
550
+ style={{
551
+ height: 8,
552
+ backgroundColor: theme.colors.backgroundGray100,
553
+ marginTop: 18,
554
+ marginHorizontal: -40,
555
+ }}
556
+ />
557
+ </OrderInfo>
558
+ )}
559
+ </Header>
560
+ <OrderContent>
561
+ {!isGiftCardOrder && (
562
+ <OrderBusiness>
639
563
  <OText
640
- size={12}
641
- lineHeight={18}
564
+ size={16}
565
+ lineHeight={24}
566
+ weight={'500'}
642
567
  color={theme.colors.textNormal}
643
- mBottom={2}>
644
- {order?.customer?.name} {order?.customer?.lastname}
568
+ mBottom={12}>
569
+ {t('FROM', 'From')}
645
570
  </OText>
646
- {!hideCustomerAddress && (
647
- <OText
648
- size={12}
649
- lineHeight={18}
650
- color={theme.colors.textNormal}
651
- mBottom={2}>
652
- {order?.customer?.address}
653
- </OText>
571
+ <View
572
+ style={{
573
+ display: 'flex',
574
+ flexDirection: 'column',
575
+ alignItems: 'flex-start',
576
+ }}>
577
+ <View
578
+ style={{
579
+ flexDirection: 'row',
580
+ alignItems: 'center',
581
+ justifyContent: 'space-between',
582
+ }}>
583
+ <OText
584
+ size={13}
585
+ lineHeight={20}
586
+ color={theme.colors.textNormal}
587
+ style={{ flexGrow: 1, flexBasis: '80%' }}>
588
+ {order?.business?.name}
589
+ </OText>
590
+ <Icons>
591
+ {!!order?.business?.cellphone && !hideBusinessPhone && (
592
+ <TouchableOpacity
593
+ onPress={() => order?.business?.cellphone &&
594
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
595
+ }
596
+ style={{ paddingEnd: 5 }}
597
+ >
598
+ <OIcon
599
+ src={theme.images.general.phone}
600
+ width={16}
601
+ color={theme.colors.disabled}
602
+ />
603
+ </TouchableOpacity>
604
+ )}
605
+ {!hideBusinessMessages && (
606
+ <TouchableOpacity
607
+ style={{ paddingStart: 5 }}
608
+ onPress={() => handleGoToMessages('business')}>
609
+ <OIcon
610
+ src={theme.images.general.chat}
611
+ width={16}
612
+ color={theme.colors.disabled}
613
+ />
614
+ </TouchableOpacity>
615
+ )}
616
+ </Icons>
617
+ </View>
618
+ {!hideBusinessEmail && (
619
+ <OText
620
+ size={12}
621
+ lineHeight={18}
622
+ color={theme.colors.textNormal}
623
+ mBottom={2}>
624
+ {order?.business?.email}
625
+ </OText>
626
+ )}
627
+ {!!order?.business?.cellphone && !hideBusinessPhone && (
628
+ <OText
629
+ size={12}
630
+ lineHeight={18}
631
+ color={theme.colors.textNormal}
632
+ mBottom={2}>
633
+ {order?.business?.cellphone}
634
+ </OText>
635
+ )}
636
+ {!hideBusinessAddress && (
637
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
638
+ {order?.business?.address}
639
+ </OText>
640
+ )}
641
+ </View>
642
+ {directionTypes.includes(order?.delivery_type) && (
643
+ <OButton
644
+ text={t('GET_DIRECTIONS', 'Get Directions')}
645
+ imgRightSrc=''
646
+ textStyle={{ color: theme.colors.white }}
647
+ style={{
648
+ alignSelf: 'center',
649
+ borderRadius: 10,
650
+ marginTop: 30
651
+ }}
652
+ onClick={() => showLocation({
653
+ latitude: order?.business?.location?.lat,
654
+ longitude: order?.business?.location?.lng,
655
+ naverCallerName: 'com.reactnativeappstemplate5',
656
+ dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
657
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
658
+ cancelText: t('CANCEL', 'Cancel'),
659
+ })}
660
+ />
654
661
  )}
655
- {(!!order?.customer?.cellphone && !hideCustomerPhone) && (
662
+ </OrderBusiness>
663
+ )}
664
+
665
+ {!isGiftCardOrder && placeSpotTypes.includes(order?.delivery_type) && (
666
+ <PlaceSpotWrapper>
667
+ <PlaceSpot
668
+ isInputMode
669
+ cart={order}
670
+ spotNumberDefault={order?.spot_number}
671
+ vehicleDefault={order?.vehicle}
672
+ />
673
+ </PlaceSpotWrapper>
674
+ )}
675
+
676
+ <View
677
+ style={{
678
+ height: 8,
679
+ backgroundColor: theme.colors.backgroundGray100,
680
+ marginTop: 18,
681
+ marginHorizontal: -40,
682
+ }}
683
+ />
684
+ <OrderCustomer>
685
+ <OText
686
+ size={16}
687
+ lineHeight={24}
688
+ weight={'500'}
689
+ color={theme.colors.textNormal}
690
+ mBottom={12}>
691
+ {isGiftCardOrder ? t('CUSTOMER', 'Customer') : t('TO', 'To')}
692
+ </OText>
693
+ <Customer>
694
+ <InfoBlock>
656
695
  <OText
657
696
  size={12}
658
697
  lineHeight={18}
659
698
  color={theme.colors.textNormal}
660
699
  mBottom={2}>
661
- {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
700
+ {order?.customer?.name} {order?.customer?.lastname}
662
701
  </OText>
663
- )}
664
- </InfoBlock>
665
- </Customer>
666
- {!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type === 1 && (
667
- <View style={{ marginTop: 15 }}>
668
- <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
669
- {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
670
- </OText>
671
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
672
- {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
673
- </OText>
674
- </View>
675
- )}
676
- {!!order?.comment && (
677
- <View style={{ marginTop: 15 }}>
678
- <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
679
- {t('COMMENT', 'Comment')}
680
- </OText>
681
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
682
- </View>
683
- )}
702
+ {!hideCustomerAddress && (
703
+ <OText
704
+ size={12}
705
+ lineHeight={18}
706
+ color={theme.colors.textNormal}
707
+ mBottom={2}>
708
+ {order?.customer?.address}
709
+ </OText>
710
+ )}
711
+ {(!!order?.customer?.cellphone && !hideCustomerPhone) && (
712
+ <OText
713
+ size={12}
714
+ lineHeight={18}
715
+ color={theme.colors.textNormal}
716
+ mBottom={2}>
717
+ {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
718
+ </OText>
719
+ )}
720
+ </InfoBlock>
721
+ </Customer>
722
+ {!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type === 1 && (
723
+ <View style={{ marginTop: 15 }}>
724
+ <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
725
+ {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
726
+ </OText>
727
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
728
+ {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
729
+ </OText>
730
+ </View>
731
+ )}
732
+ {!!order?.comment && (
733
+ <View style={{ marginTop: 15 }}>
734
+ <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
735
+ {t('COMMENT', 'Comment')}
736
+ </OText>
737
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
738
+ </View>
739
+ )}
740
+ {order?.driver && (
741
+ <>
742
+ {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
743
+ <Map>
744
+ <GoogleMap
745
+ location={typeof order?.driver?.location?.location === 'string'
746
+ ? {
747
+ lat: parseFloat(driverLocationString[0]),
748
+ lng: parseFloat(driverLocationString[1]),
749
+ } : driverLocation ?? order?.driver?.location
750
+ }
751
+ locations={parsedLocations}
752
+ readOnly
753
+ />
754
+ </Map>
755
+ )}
756
+ </>
757
+ )}
758
+ </OrderCustomer>
684
759
  {order?.driver && (
685
760
  <>
686
- {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
687
- <Map>
688
- <GoogleMap
689
- location={typeof order?.driver?.location?.location === 'string'
690
- ? {
691
- lat: parseFloat(driverLocationString[0]),
692
- lng: parseFloat(driverLocationString[1]),
693
- } : driverLocation ?? order?.driver?.location
694
- }
695
- locations={parsedLocations}
696
- readOnly
697
- />
698
- </Map>
699
- )}
700
- </>
701
- )}
702
- </OrderCustomer>
703
- {order?.driver && (
704
- <>
705
- <View
706
- style={{
707
- height: 8,
708
- backgroundColor: theme.colors.backgroundGray100,
709
- marginTop: 18,
710
- marginHorizontal: -40,
711
- }}
712
- />
713
- <OrderDriver>
714
- <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
715
- <Customer>
716
- <InfoBlock>
717
- <View
718
- style={{
719
- flexDirection: 'row',
720
- alignItems: 'center',
721
- justifyContent: 'space-between',
722
- }}>
723
- {!hideDriverName && (
724
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
725
- {order?.driver?.name} {order?.driver?.lastname}
761
+ <View
762
+ style={{
763
+ height: 8,
764
+ backgroundColor: theme.colors.backgroundGray100,
765
+ marginTop: 18,
766
+ marginHorizontal: -40,
767
+ }}
768
+ />
769
+ <OrderDriver>
770
+ <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
771
+ <Customer>
772
+ <InfoBlock>
773
+ <View
774
+ style={{
775
+ flexDirection: 'row',
776
+ alignItems: 'center',
777
+ justifyContent: 'space-between',
778
+ }}>
779
+ {!hideDriverName && (
780
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
781
+ {order?.driver?.name} {order?.driver?.lastname}
782
+ </OText>
783
+ )}
784
+ {!hideDriverMessages && (
785
+ <Icons>
786
+ <TouchableOpacity
787
+ onPress={() => handleGoToMessages('driver')}>
788
+ <OIcon
789
+ src={theme.images.general.chat}
790
+ width={16}
791
+ color={theme.colors.disabled}
792
+ />
793
+ </TouchableOpacity>
794
+ </Icons>
795
+ )}
796
+ </View>
797
+ {!hideDriverPhone && (
798
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
799
+ {order?.driver?.cellphone}
726
800
  </OText>
727
801
  )}
728
- {!hideDriverMessages && (
729
- <Icons>
730
- <TouchableOpacity
731
- onPress={() => handleGoToMessages('driver')}>
732
- <OIcon
733
- src={theme.images.general.chat}
734
- width={16}
735
- color={theme.colors.disabled}
736
- />
737
- </TouchableOpacity>
738
- </Icons>
739
- )}
740
- </View>
741
- {!hideDriverPhone && (
742
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
743
- {order?.driver?.cellphone}
744
- </OText>
745
- )}
746
- </InfoBlock>
747
- </Customer>
748
- </OrderDriver>
749
- </>
750
- )}
751
- <View
752
- style={{
753
- height: 8,
754
- backgroundColor: theme.colors.backgroundGray100,
755
- marginTop: 18,
756
- marginHorizontal: -40,
757
- }}
758
- />
759
- <HeaderInfo>
760
- <OText
761
- size={24}
762
- color={theme.colors.textNormal}
763
- style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
764
- {t(
765
- 'YOUR_ORDER_HAS_BEEN_RECEIVED',
766
- 'Your Order has been received',
767
- )}
768
- </OText>
769
- <OText color={theme.colors.textNormal} size={14} weight={'500'}>
770
- {t(
771
- 'ORDER_MESSAGE_HEADER_TEXT',
772
- 'Once business accepts your order, we will send you an email, thank you!',
773
- )}
774
- </OText>
775
- <OrderAction>
776
- <OButton
777
- text={t('YOUR_ORDERS', 'Your Orders')}
778
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
779
- imgRightSrc={null}
780
- borderColor={theme.colors.primary}
781
- bgColor={theme.colors.clear}
782
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
783
- parentStyle={{ marginTop: 29, marginEnd: 15 }}
784
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
785
- />
786
- {(
787
- parseInt(order?.status) === 1 ||
788
- parseInt(order?.status) === 2 ||
789
- parseInt(order?.status) === 5 ||
790
- parseInt(order?.status) === 6 ||
791
- parseInt(order?.status) === 10 ||
792
- parseInt(order?.status) === 11 ||
793
- parseInt(order?.status) === 12
794
- ) && (
802
+ </InfoBlock>
803
+ </Customer>
804
+ </OrderDriver>
805
+ </>
806
+ )}
807
+ <View
808
+ style={{
809
+ height: 8,
810
+ backgroundColor: theme.colors.backgroundGray100,
811
+ marginTop: 18,
812
+ marginHorizontal: -40,
813
+ }}
814
+ />
815
+ <HeaderInfo>
816
+ <OText
817
+ size={24}
818
+ color={theme.colors.textNormal}
819
+ style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
820
+ {t(
821
+ 'YOUR_ORDER_HAS_BEEN_RECEIVED',
822
+ 'Your Order has been received',
823
+ )}
824
+ </OText>
825
+ <OText color={theme.colors.textNormal} size={14} weight={'500'}>
826
+ {t(
827
+ 'ORDER_MESSAGE_HEADER_TEXT',
828
+ 'Once business accepts your order, we will send you an email, thank you!',
829
+ )}
830
+ </OText>
831
+ <OrderAction>
832
+ <OButton
833
+ text={t('YOUR_ORDERS', 'Your Orders')}
834
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
835
+ imgRightSrc={null}
836
+ borderColor={theme.colors.primary}
837
+ bgColor={theme.colors.clear}
838
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
839
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
840
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
841
+ />
842
+ {(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && !isGiftCardOrder && (
795
843
  <OButton
796
844
  text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
797
845
  textStyle={{ fontSize: 14, color: theme.colors.primary }}
@@ -802,280 +850,283 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
802
850
  onClick={() => handleReorder && handleReorder(order.id)}
803
851
  />
804
852
  )}
805
- </OrderAction>
806
- </HeaderInfo>
807
- <OrderProducts>
808
- {sortedProductList}
809
- </OrderProducts>
810
- <OrderBill>
811
- <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
812
- <Table>
813
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
814
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
815
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
816
- </OText>
817
- </Table>
818
- {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
853
+ </OrderAction>
854
+ </HeaderInfo>
855
+ <OrderProducts>
856
+ {sortedProductList}
857
+ </OrderProducts>
858
+ <OrderBill>
859
+ <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
819
860
  <Table>
820
- {order?.offer_type === 1 ? (
821
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
822
- {t('DISCOUNT', 'Discount')}
823
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
824
- order?.offer_rate,
825
- parsePrice,
826
- )}%)`}</OText>
827
- </OText>
828
- ) : (
829
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
830
- )}
861
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
831
862
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
832
- - {parsePrice(order?.summary?.discount || order?.discount)}
863
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
833
864
  </OText>
834
865
  </Table>
835
- )}
836
- {
837
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
838
- <Table key={offer.id}>
839
- <OSRow>
840
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
841
- {offer.name}
842
- {offer.rate_type === 1 && (
843
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
844
- )}
845
- </OText>
846
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
847
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
848
- </TouchableOpacity>
849
- </OSRow>
850
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
851
- </Table>
852
- ))
853
- }
854
- {!isGiftCardOrder && (
855
- <Divider />
856
- )}
857
- {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
858
- <Table>
859
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
860
- {order?.tax_type === 1 ? (
861
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
862
- ) : (
863
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
864
- )}
865
- </Table>
866
- )}
867
- {
868
- order?.taxes?.length === 0 && order?.tax_type === 2 && (
866
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
869
867
  <Table>
868
+ {order?.offer_type === 1 ? (
869
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
870
+ {t('DISCOUNT', 'Discount')}
871
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
872
+ order?.offer_rate,
873
+ parsePrice,
874
+ )}%)`}</OText>
875
+ </OText>
876
+ ) : (
877
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
878
+ )}
870
879
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
871
- {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
880
+ - {parsePrice(order?.summary?.discount || order?.discount)}
872
881
  </OText>
873
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.tax || 0)}</OText>
874
882
  </Table>
875
- )
876
- }
877
- {
878
- order?.fees?.length === 0 && (
883
+ )}
884
+ {
885
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
886
+ <Table key={offer.id}>
887
+ <OSRow>
888
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
889
+ {offer.name}
890
+ {offer.rate_type === 1 && (
891
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
892
+ )}
893
+ </OText>
894
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
895
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
896
+ </TouchableOpacity>
897
+ </OSRow>
898
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
899
+ </Table>
900
+ ))
901
+ }
902
+ {!isGiftCardOrder && (
903
+ <Divider />
904
+ )}
905
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
879
906
  <Table>
880
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
881
- {t('SERVICE_FEE', 'Service fee')}
882
- {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
883
- </OText>
884
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
907
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
908
+ {order?.tax_type === 1 ? (
909
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
910
+ ) : (
911
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
912
+ )}
885
913
  </Table>
886
- )
887
- }
888
- {
889
- order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
890
- <Table key={tax.id}>
891
- <OSRow>
892
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
893
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
894
- {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
914
+ )}
915
+ {
916
+ order?.taxes?.length === 0 && order?.tax_type === 2 && (
917
+ <Table>
918
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
919
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
895
920
  </OText>
896
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
897
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
898
- </TouchableOpacity>
899
- </OSRow>
900
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
901
- </Table>
902
- ))
903
- }
904
- {
905
- order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
906
- <Table key={fee.id}>
907
- <OSRow>
908
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
909
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
910
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
921
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.tax || 0)}</OText>
922
+ </Table>
923
+ )
924
+ }
925
+ {
926
+ order?.fees?.length === 0 && (
927
+ <Table>
928
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
929
+ {t('SERVICE_FEE', 'Service fee')}
930
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
911
931
  </OText>
912
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
913
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
914
- </TouchableOpacity>
915
- </OSRow>
916
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
932
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
933
+ </Table>
934
+ )
935
+ }
936
+ {
937
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
938
+ <Table key={tax.id}>
939
+ <OSRow>
940
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
941
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
942
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
943
+ </OText>
944
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
945
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
946
+ </TouchableOpacity>
947
+ </OSRow>
948
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
949
+ </Table>
950
+ ))
951
+ }
952
+ {
953
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
954
+ <Table key={fee.id}>
955
+ <OSRow>
956
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
957
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
958
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
959
+ </OText>
960
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
961
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
962
+ </TouchableOpacity>
963
+ </OSRow>
964
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
965
+ </Table>
966
+ ))
967
+ }
968
+ {
969
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
970
+ <Table key={offer.id}>
971
+ <OSRow>
972
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
973
+ {offer.name}
974
+ {offer.rate_type === 1 && (
975
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
976
+ )}
977
+ </OText>
978
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
979
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
980
+ </TouchableOpacity>
981
+ </OSRow>
982
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
983
+ </Table>
984
+ ))
985
+ }
986
+ {typeof order?.summary?.delivery_price === 'number' && (
987
+ <Table>
988
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
989
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
917
990
  </Table>
918
- ))
919
- }
920
- {
921
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
922
- <Table key={offer.id}>
923
- <OSRow>
924
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
925
- {offer.name}
926
- {offer.rate_type === 1 && (
927
- <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
991
+ )}
992
+ {
993
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
994
+ <Table key={offer.id}>
995
+ <OSRow>
996
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
997
+ {offer.name}
998
+ {offer.rate_type === 1 && (
999
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
1000
+ )}
1001
+ </OText>
1002
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
1003
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
1004
+ </TouchableOpacity>
1005
+ </OSRow>
1006
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1007
+ </Table>
1008
+ ))
1009
+ }
1010
+ {order?.summary?.driver_tip > 0 && (
1011
+ <Table>
1012
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
1013
+ {t('DRIVER_TIP', 'Driver tip')}
1014
+ {order?.summary?.driver_tip > 0 &&
1015
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
1016
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
1017
+ (
1018
+ `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
928
1019
  )}
929
- </OText>
930
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
931
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
932
- </TouchableOpacity>
933
- </OSRow>
934
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1020
+ </OText>
1021
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
935
1022
  </Table>
936
- ))
937
- }
938
- {order?.summary?.delivery_price > 0 && (
939
- <Table>
940
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
941
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
942
- </Table>
943
- )}
944
- {
945
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
946
- <Table key={offer.id}>
947
- <OSRow>
948
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
949
- {offer.name}
950
- {offer.rate_type === 1 && (
951
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
952
- )}
953
- </OText>
954
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
955
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
956
- </TouchableOpacity>
957
- </OSRow>
958
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1023
+ )}
1024
+ <Total>
1025
+ <Table>
1026
+ <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
1027
+ <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>
1028
+ {parsePrice(order?.summary?.total ?? order?.total)}
1029
+ </OText>
959
1030
  </Table>
960
- ))
961
- }
962
- {order?.summary?.driver_tip > 0 && (
963
- <Table>
964
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
965
- {t('DRIVER_TIP', 'Driver tip')}
966
- {order?.summary?.driver_tip > 0 &&
967
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
968
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
969
- (
970
- `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
971
- )}
972
- </OText>
973
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
974
- </Table>
975
- )}
976
- <Total>
977
- <Table>
978
- <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
979
- <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>
980
- {parsePrice(order?.summary?.total ?? order?.total)}
981
- </OText>
982
- </Table>
983
- </Total>
984
- {order?.payment_events?.length > 0 && (
985
- <View style={{ marginTop: 10 }}>
986
- <OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
987
- <View
988
- style={{
989
- width: '100%',
990
- marginTop: 10
991
- }}
992
- >
993
- {order?.payment_events?.map((event: any) => event.amount > 0 && (
994
- <View
995
- key={event.id}
996
- style={{
997
- display: 'flex',
998
- flexDirection: 'row',
999
- justifyContent: 'space-between',
1000
- alignItems: 'center',
1001
- marginBottom: 10
1002
- }}
1003
- >
1031
+ </Total>
1032
+ {order?.payment_events?.length > 0 && (
1033
+ <View style={{ marginTop: 10 }}>
1034
+ <OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
1035
+ <View
1036
+ style={{
1037
+ width: '100%',
1038
+ marginTop: 10
1039
+ }}
1040
+ >
1041
+ {order?.payment_events?.map((event: any) => event.amount > 0 && (
1004
1042
  <View
1043
+ key={event.id}
1005
1044
  style={{
1006
1045
  display: 'flex',
1007
- flexDirection: 'column',
1046
+ flexDirection: 'row',
1047
+ justifyContent: 'space-between',
1048
+ alignItems: 'center',
1049
+ marginBottom: 10
1008
1050
  }}
1009
1051
  >
1010
- <OText>
1011
- {event?.wallet_event
1012
- ? walletName[event?.wallet_event?.wallet?.type]?.name
1013
- : event?.paymethod?.name}
1014
- </OText>
1015
- {event?.data?.charge_id && (
1052
+ <View
1053
+ style={{
1054
+ display: 'flex',
1055
+ flexDirection: 'column',
1056
+ }}
1057
+ >
1058
+ <OText>
1059
+ {event?.wallet_event
1060
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
1061
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
1062
+ </OText>
1063
+ {/* {event?.data?.charge_id && (
1016
1064
  <OText>
1017
1065
  {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
1018
1066
  </OText>
1019
- )}
1067
+ )} */}
1068
+ </View>
1069
+ <OText>
1070
+ -{parsePrice(event.amount, { isTruncable: true })}
1071
+ </OText>
1020
1072
  </View>
1021
- <OText>
1022
- -{parsePrice(event.amount, { isTruncable: true })}
1023
- </OText>
1024
- </View>
1025
- ))}
1073
+ ))}
1074
+ </View>
1026
1075
  </View>
1027
- </View>
1076
+ )}
1077
+ </OrderBill>
1078
+ {isGiftCardOrder && order?.products[0]?.gift_card?.status === 'pending' && !isGiftCardSent && (
1079
+ <>
1080
+ <View
1081
+ style={{
1082
+ height: 8,
1083
+ backgroundColor: theme.colors.backgroundGray100,
1084
+ marginTop: 10,
1085
+ marginHorizontal: -40,
1086
+ marginBottom: 20
1087
+ }}
1088
+ />
1089
+ <SendGiftCard
1090
+ giftCardId={order?.products[0]?.gift_card?.id}
1091
+ setIsGiftCardSent={setIsGiftCardSent}
1092
+ />
1093
+ </>
1028
1094
  )}
1029
- </OrderBill>
1030
- {isGiftCardOrder && order?.products[0]?.gift_card?.status === 'pending' && !isGiftCardSent && (
1031
- <>
1032
- <View
1033
- style={{
1034
- height: 8,
1035
- backgroundColor: theme.colors.backgroundGray100,
1036
- marginTop: 10,
1037
- marginHorizontal: -40,
1038
- marginBottom: 20
1039
- }}
1040
- />
1041
- <SendGiftCard
1042
- giftCardId={order?.products[0]?.gift_card?.id}
1043
- setIsGiftCardSent={setIsGiftCardSent}
1044
- />
1045
- </>
1046
- )}
1047
- </OrderContent>
1048
- </>
1049
- )}
1050
- <OModal
1051
- open={openTaxModal.open}
1052
- onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1053
- entireModal
1054
- >
1055
- <TaxInformation
1056
- type={openTaxModal.type}
1057
- data={openTaxModal.data}
1058
- products={order?.products}
1059
- />
1060
- </OModal>
1061
- <OModal
1062
- open={isOrderHistory}
1063
- onClose={() => setIsOrderHistory(false)}
1064
- entireModal
1065
- >
1066
- <OrderHistory
1067
- order={order}
1068
- messages={messages}
1069
- enableReview={(
1070
- parseInt(order?.status) === 1 ||
1071
- parseInt(order?.status) === 11 ||
1072
- parseInt(order?.status) === 15
1073
- ) && !order.review && !isReviewed}
1095
+ </OrderContent>
1096
+ </>
1097
+ )}
1098
+ <OModal
1099
+ open={openTaxModal.open}
1100
+ onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1101
+ entireModal
1102
+ >
1103
+ <TaxInformation
1104
+ type={openTaxModal.type}
1105
+ data={openTaxModal.data}
1106
+ products={order?.products}
1107
+ />
1108
+ </OModal>
1109
+ <OModal
1110
+ open={isOrderHistory}
1074
1111
  onClose={() => setIsOrderHistory(false)}
1075
- handleTriggerReview={handleTriggerReview}
1076
- />
1077
- </OModal>
1078
- </OrderDetailsContainer>
1112
+ entireModal
1113
+ >
1114
+ <OrderHistory
1115
+ order={order}
1116
+ hideViaText={props.hideViaText}
1117
+ messages={messages}
1118
+ enableReview={(
1119
+ parseInt(order?.status) === 1 ||
1120
+ parseInt(order?.status) === 11 ||
1121
+ parseInt(order?.status) === 15
1122
+ ) && !order.review && !isReviewed}
1123
+ onClose={() => setIsOrderHistory(false)}
1124
+ handleTriggerReview={handleTriggerReview}
1125
+ />
1126
+ </OModal>
1127
+ </OrderDetailsContainer>
1128
+ </SafeAreaView>
1129
+
1079
1130
  );
1080
1131
  };
1081
1132