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