ordering-ui-react-native 0.18.55-test1 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -5
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  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 +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useCallback } from 'react'
2
2
 
3
3
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OButton, OText, OLink, OModal } from '../shared'
6
7
  import {
@@ -53,9 +54,16 @@ export const OrderContentComponent = (props: OrderContent) => {
53
54
  const WIDTH_SCREEN = orientationState?.dimensions?.width
54
55
 
55
56
  const [openReviewModal, setOpenReviewModal] = useState(false)
57
+ const [showCustomFields, setShowCustomFields] = useState<boolean>(false);
56
58
 
57
- const [isReadMore, setIsReadMore] = useState(false)
58
- const [lengthMore, setLengthMore] = useState(false)
59
+ const [isReadMore, setIsReadMore] = useState({
60
+ customerAddress: false,
61
+ businessAddressNotes: false
62
+ })
63
+ const [lengthMore, setLengthMore] = useState({
64
+ customerAddress: false,
65
+ businessAddressNotes: false
66
+ })
59
67
 
60
68
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
61
69
 
@@ -105,11 +113,19 @@ export const OrderContentComponent = (props: OrderContent) => {
105
113
  }
106
114
 
107
115
  const containsOnlyNumbers = (str: string) => {
116
+ str = str?.replace('+', '');
108
117
  return /^\d+$/.test(str);
109
118
  }
110
119
 
111
- const onTextLayout = useCallback((e: any) => {
112
- setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
120
+ const onTextLayout = useCallback((e: any, item: string) => {
121
+ if (item === 'customerAddress') {
122
+ const customerAddressMore = (e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2
123
+ setLengthMore(prev => ({ ...prev, customerAddress: customerAddressMore }))
124
+ }
125
+ if (item === 'businessAddressNotes') {
126
+ const businessAddressNotesMore = (e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3
127
+ setLengthMore(prev => ({ ...prev, businessAddressNotes: businessAddressNotesMore }))
128
+ }
113
129
  }, []);
114
130
 
115
131
  return (
@@ -120,27 +136,36 @@ export const OrderContentComponent = (props: OrderContent) => {
120
136
 
121
137
  {order?.metafields?.length > 0 && (
122
138
  <OrderBusiness>
123
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
124
- {t('CUSTOM_FIELDS', 'Custom fields')}
125
- </OText>
126
-
127
- {order.metafields.map((field: any) => (
128
- <View
129
- key={field.id}
130
- style={{
131
- width: '100%',
132
- flexDirection: 'row',
133
- marginBottom: 5
134
- }}
135
- >
136
- <OText style={{ width: '50%' }}>
137
- {field.key}
138
- </OText>
139
- <OText style={{ width: '45%', textAlign: 'right' }}>
140
- {field.value}
141
- </OText>
142
- </View>
143
- ))}
139
+ <TouchableOpacity onPress={() => setShowCustomFields((prev: boolean) => !prev)} style={{ flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'flex-start' }}>
140
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
141
+ {t('CUSTOM_FIELDS', 'Custom fields')}
142
+ </OText>
143
+ <AntDesignIcon
144
+ name={showCustomFields ? 'up' : 'down'}
145
+ size={14}
146
+ />
147
+ </TouchableOpacity>
148
+ {showCustomFields && (
149
+ <>
150
+ {order.metafields.map((field: any) => (
151
+ <View
152
+ key={field.id}
153
+ style={{
154
+ width: '100%',
155
+ flexDirection: 'row',
156
+ marginBottom: 5
157
+ }}
158
+ >
159
+ <OText style={{ width: '50%' }}>
160
+ {field.key}
161
+ </OText>
162
+ <OText style={{ width: '45%', textAlign: 'right' }}>
163
+ {field.value}
164
+ </OText>
165
+ </View>
166
+ ))}
167
+ </>
168
+ )}
144
169
  </OrderBusiness>
145
170
  )}
146
171
 
@@ -170,7 +195,7 @@ export const OrderContentComponent = (props: OrderContent) => {
170
195
  <OLink
171
196
  PressStyle={styles.linkWithIcons}
172
197
  url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
173
- shorcut={`${order?.business?.cellphone}`}
198
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.cellphone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.cellphone}`}
174
199
  TextStyle={styles.textLink}
175
200
  />
176
201
  </View>
@@ -180,8 +205,8 @@ export const OrderContentComponent = (props: OrderContent) => {
180
205
  <View style={styles.linkWithIcons}>
181
206
  <OLink
182
207
  PressStyle={styles.linkWithIcons}
183
- url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
184
- shorcut={order?.business?.phone}
208
+ url={`tel:${containsOnlyNumbers(order?.business?.phone) ? order?.business?.phone : 'invalid'}`}
209
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.phone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.phone}`}
185
210
  TextStyle={styles.textLink}
186
211
  />
187
212
  </View>
@@ -194,8 +219,8 @@ export const OrderContentComponent = (props: OrderContent) => {
194
219
  <OLink
195
220
  PressStyle={styles.linkWithIcons}
196
221
  url={Platform.select({
197
- ios: `maps:0,0?q=${order?.business?.address}`,
198
- android: `geo:0,0?q=${order?.business?.address}`,
222
+ ios: `maps:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
223
+ android: `geo:0,0?q=${order?.business?.address}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
199
224
  })}
200
225
  numberOfLines={2}
201
226
  shorcut={order?.business?.address}
@@ -209,17 +234,28 @@ export const OrderContentComponent = (props: OrderContent) => {
209
234
  </OText>
210
235
  )}
211
236
  {!!order?.business?.address_notes && (
212
- <View style={styles.linkWithIcons}>
213
- <OLink
214
- PressStyle={styles.linkWithIcons}
215
- url={Platform.select({
216
- ios: `maps:0,0?q=${order?.business?.address_notes}`,
217
- android: `geo:0,0?q=${order?.business?.address_notes}`,
218
- })}
219
- shorcut={order?.business?.address_notes}
220
- TextStyle={styles.textLink}
221
- />
222
- </View>
237
+ <>
238
+ <View style={styles.linkWithIcons}>
239
+ <OLink
240
+ PressStyle={styles.linkWithIcons}
241
+ url={Platform.select({
242
+ ios: `maps:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
243
+ android: `geo:0,0?q=${order?.business?.address_notes}@${order?.business?.location?.lat},${order?.business?.location?.lng}`,
244
+ })}
245
+ shorcut={order?.business?.address_notes}
246
+ TextStyle={styles.textLink}
247
+ onTextLayout={e => onTextLayout(e, 'businessAddressNotes')}
248
+ numberOfLines={isReadMore.businessAddressNotes ? 20 : 3}
249
+ />
250
+ </View>
251
+ {lengthMore.businessAddressNotes && (
252
+ <TouchableOpacity
253
+ onPress={() => setIsReadMore({ ...isReadMore, businessAddressNotes: !isReadMore.businessAddressNotes })}
254
+ >
255
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.businessAddressNotes ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
256
+ </TouchableOpacity>
257
+ )}
258
+ </>
223
259
  )}
224
260
  </OrderBusiness>
225
261
 
@@ -301,7 +337,7 @@ export const OrderContentComponent = (props: OrderContent) => {
301
337
  <OLink
302
338
  PressStyle={styles.linkWithIcons}
303
339
  url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
304
- shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
340
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.cellphone}`}
305
341
  TextStyle={styles.textLink}
306
342
  />
307
343
  </View>
@@ -311,8 +347,8 @@ export const OrderContentComponent = (props: OrderContent) => {
311
347
  <View style={styles.linkWithIcons}>
312
348
  <OLink
313
349
  PressStyle={styles.linkWithIcons}
314
- url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
315
- shorcut={order?.customer?.phone}
350
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
351
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.phone}`}
316
352
  TextStyle={styles.textLink}
317
353
  />
318
354
  </View>
@@ -324,18 +360,20 @@ export const OrderContentComponent = (props: OrderContent) => {
324
360
  <OLink
325
361
  PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
326
362
  url={Platform.select({
327
- ios: `maps:0,0?q=${order?.customer?.address}`,
328
- android: `geo:0,0?q=${order?.customer?.address}`,
363
+ ios: `maps:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
364
+ android: `geo:0,0?q=${order?.customer?.address}@${order?.customer?.location?.lat},${order?.customer?.location?.lng}`,
329
365
  })}
330
- onTextLayout={onTextLayout}
331
- numberOfLines={isReadMore ? 20 : 2}
366
+ onTextLayout={e => onTextLayout(e, 'customerAddress')}
367
+ numberOfLines={isReadMore.customerAddress ? 20 : 2}
332
368
  shorcut={order?.customer?.address}
333
369
  TextStyle={styles.textLink}
334
370
  />
335
371
  </View>
336
- {lengthMore && (
337
- <TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
338
- <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
372
+ {lengthMore.customerAddress && (
373
+ <TouchableOpacity
374
+ onPress={() => setIsReadMore({ ...isReadMore, customerAddress: !isReadMore.customerAddress })}
375
+ >
376
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore.customerAddress ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
339
377
  </TouchableOpacity>
340
378
  )}
341
379
  </>
@@ -370,26 +408,16 @@ export const OrderContentComponent = (props: OrderContent) => {
370
408
  {t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
371
409
  </OText>
372
410
  )}
373
- {((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
411
+ {(order?.delivery_option !== undefined && order?.delivery_type === 1) && (
374
412
  <View style={{ marginTop: 10 }}>
375
413
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
376
414
  <OText>
377
415
  {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
378
416
  </OText>
379
417
  )}
380
- {!!order?.comment && (
381
- <>
382
- <OText weight='500' style={{ marginBottom: 5 }}>
383
- {t('ORDER_COMMENT', 'Order Comment')}
384
- </OText>
385
- <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
386
- {order?.comment}
387
- </OText>
388
- </>
389
- )}
390
418
  </View>
391
419
  )}
392
- {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
420
+ {!order?.user_review && pastOrderStatuses.includes(order?.status) && order?.customer_id && (
393
421
  <OButton
394
422
  style={styles.btnReview}
395
423
  textStyle={{ color: theme.colors.white }}
@@ -401,10 +429,16 @@ export const OrderContentComponent = (props: OrderContent) => {
401
429
  </OrderCustomer>
402
430
 
403
431
  <OrderProducts>
404
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
432
+ <OText style={{ marginBottom: 10 }} size={16} weight="600">
405
433
  {t('ORDER_DETAILS', 'Order Details')}
406
434
  </OText>
407
435
 
436
+ {!!order?.comment && (
437
+ <OText>
438
+ {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
439
+ </OText>
440
+ )}
441
+
408
442
  {order?.products?.length > 0 &&
409
443
  order?.products.map((product: any, i: number) => (
410
444
  <ProductItemAccordion
@@ -523,7 +557,7 @@ export const OrderContentComponent = (props: OrderContent) => {
523
557
  ))
524
558
  }
525
559
  {
526
- order?.summary?.delivery_price > 0 && (
560
+ typeof order?.summary?.delivery_price === 'number' && order.delivery_type !== 2 && (
527
561
  <Table>
528
562
  <OText mBottom={4}>
529
563
  {t('DELIVERY_FEE', 'Delivery Fee')}
@@ -550,15 +584,14 @@ export const OrderContentComponent = (props: OrderContent) => {
550
584
  </Table>
551
585
  ))
552
586
  }
553
- {order?.summary?.driver_tip > 0 && (
587
+ {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
554
588
  <Table>
555
589
  <OText mBottom={4}>
556
590
  {t('DRIVER_TIP', 'Driver tip')}
557
- {order?.summary?.driver_tip > 0 &&
558
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
591
+ {order?.driver_tip > 0 && parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
559
592
  !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
560
593
  (
561
- `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
594
+ `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
562
595
  )}
563
596
  </OText>
564
597
  <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
@@ -609,13 +642,12 @@ export const OrderContentComponent = (props: OrderContent) => {
609
642
  <OText>
610
643
  {event?.wallet_event
611
644
  ? walletName[event?.wallet_event?.wallet?.type]?.name
612
- : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
645
+ : event?.paymethod?.gateway
646
+ ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
647
+ : order?.paymethod?.id === event?.paymethod_id
648
+ ? t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
649
+ : ''}
613
650
  </OText>
614
- {event?.data?.charge_id && (
615
- <OText>
616
- {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
617
- </OText>
618
- )}
619
651
  </View>
620
652
  <OText>
621
653
  {(event?.paymethod?.gateway === 'cash' && order?.cash)
@@ -22,6 +22,7 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
22
22
  import {
23
23
  useLanguage,
24
24
  useUtils,
25
+ useConfig
25
26
  } from 'ordering-components/native';
26
27
 
27
28
  interface OrderHeader {
@@ -49,7 +50,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
49
50
  } = props
50
51
  const theme = useTheme();
51
52
  const [, t] = useLanguage();
52
- const [{ parseDate }] = useUtils();
53
+ const [configState] = useConfig()
54
+ const [{ parseDate, parsePrice }] = useUtils();
55
+ const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
56
+ const showExternalId = configState?.configs?.change_order_id?.value === '1'
53
57
 
54
58
  const styles = StyleSheet.create({
55
59
  icons: {
@@ -120,6 +124,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
120
124
  ? t('CURBSIDE', 'Curbside')
121
125
  : t('DRIVER_THRU', 'Driver thru')
122
126
 
127
+ const handlePaymethodsListString = () => {
128
+ const paymethodsList = order?.payment_events?.filter((item: any) => item.event === 'payment').map((paymethod: any) => {
129
+ return paymethod?.wallet_event
130
+ ? walletName[paymethod?.wallet_event?.wallet?.type]?.name
131
+ : paymethod?.paymethod?.gateway && paymethod?.paymethod?.gateway === 'cash' && order?.cash > 0
132
+ ? `${t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
133
+ : paymethod?.paymethod?.gateway
134
+ ? t(paymethod?.paymethod?.gateway?.toUpperCase(), paymethod?.paymethod?.name)
135
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
136
+ })
137
+ return paymethodsList.join(', ')
138
+ }
139
+
140
+ const deliveryDate = () => {
141
+ const dateString = order?.delivery_datetime_utc ?? order?.delivery_datetime
142
+ const currentDate = new Date();
143
+ const receivedDate: any = new Date(order?.delivery_datetime);
144
+
145
+ const formattedDate = receivedDate <= currentDate
146
+ ? `${t('ASAP_ABBREVIATION', 'ASAP')}(${parseDate(dateString, { utc: !!order?.delivery_datetime_utc })})`
147
+ : parseDate(dateString, { utc: !!order?.delivery_datetime_utc })
148
+ return formattedDate
149
+ }
150
+
123
151
  return (
124
152
  <>
125
153
  {!props.isCustomView && (
@@ -140,14 +168,16 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
140
168
  style={styles.icons}
141
169
  />
142
170
  </TouchableOpacity>
143
- <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
144
- <SimpleLineIcons
145
- name='printer'
146
- color={theme.colors.textGray}
147
- size={20}
148
- style={styles.icons}
149
- />
150
- </TouchableOpacity>
171
+ {!!handleViewSummaryOrder && (
172
+ <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
173
+ <SimpleLineIcons
174
+ name='printer'
175
+ color={theme.colors.textGray}
176
+ size={20}
177
+ style={styles.icons}
178
+ />
179
+ </TouchableOpacity>
180
+ )}
151
181
  </>
152
182
  )}
153
183
  <OIconButton
@@ -180,16 +210,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
180
210
  <OrderHeader>
181
211
  {!props.isCustomView ? (
182
212
  <OText size={13} style={{ marginBottom: 5 }}>
183
- {order?.delivery_datetime_utc
184
- ? parseDate(order?.delivery_datetime_utc)
185
- : parseDate(order?.delivery_datetime, { utc: false })}
213
+ {deliveryDate()}
186
214
  </OText>
187
215
  ) : (
188
216
  <Header style={{ alignItems: 'center' }}>
189
217
  <OText size={13} style={{ marginBottom: 5 }}>
190
- {order?.delivery_datetime_utc
191
- ? parseDate(order?.delivery_datetime_utc)
192
- : parseDate(order?.delivery_datetime, { utc: false })}
218
+ {deliveryDate()}
193
219
  </OText>
194
220
 
195
221
  {(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
@@ -205,14 +231,16 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
205
231
  style={styles.icons}
206
232
  />
207
233
  </TouchableOpacity>
208
- <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
209
- <SimpleLineIcons
210
- name='printer'
211
- color={theme.colors.textGray}
212
- size={20}
213
- style={styles.icons}
214
- />
215
- </TouchableOpacity>
234
+ {!!handleViewSummaryOrder && (
235
+ <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
236
+ <SimpleLineIcons
237
+ name='printer'
238
+ color={theme.colors.textGray}
239
+ size={20}
240
+ style={styles.icons}
241
+ />
242
+ </TouchableOpacity>
243
+ )}
216
244
  </>
217
245
  )}
218
246
  <OIconButton
@@ -245,7 +273,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
245
273
 
246
274
  <OText numberOfLines={2} size={20} weight="600">
247
275
  <>
248
- {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id} `}
276
+ {`${t('INVOICE_ORDER_NO', 'Order No.')} ${showExternalId ? order?.external_id || order?.id : order?.id} `}
249
277
  {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
250
278
  <>
251
279
  {t('IS', 'is')}{' '}
@@ -259,7 +287,13 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
259
287
  )}
260
288
  </>
261
289
  </OText>
262
- {!order?.isLogistic && order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
290
+ {order?.external_id && !showExternalId && (
291
+ <OText size={13}>
292
+ <OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
293
+ {order?.external_id}
294
+ </OText>
295
+ )}
296
+ {!order?.isLogistic && !!order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
263
297
  <>
264
298
  <OText size={13}>
265
299
  <OText size={13} weight='bold'>{`${t('ORDER_TYPE', 'Order Type')}: `}</OText>
@@ -271,23 +305,27 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
271
305
  {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
272
306
  </OText>
273
307
  )}
274
- {order?.payment_events?.length > 0 && (
275
- <View>
276
- <OText size={13}>
277
- <OText size={13} weight='bold'>
278
- {`${t('PAYMENT_METHODS', 'Payment methods')}: `}
279
- </OText>
280
- {order?.payment_events?.map((event: any, idx: number) => {
281
- return event?.wallet_event
282
- ? idx < order?.payment_events?.length - 1
283
- ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
284
- : walletName[event?.wallet_event?.wallet?.type]?.name
285
- : idx < order?.payment_events?.length - 1
286
- ? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
287
- : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
288
- })}
308
+ <OText>
309
+ <OText size={13} weight='bold'>
310
+ {`${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: `}
311
+ </OText>
312
+ {order?.payment_events?.length > 0 ? (
313
+ <OText size={13}>{`${handlePaymethodsListString()}`}</OText>
314
+ ) : (
315
+ <OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
316
+ )}
317
+ </OText>
318
+ {order?.spot_number && (
319
+ <OText size={13}>
320
+ <OText size={13} weight='bold'>
321
+ {`${order?.delivery_type === 3
322
+ ? t('EATIN_SPOT_NUMBER', 'Table number')
323
+ : order?.delivery_type === 5
324
+ ? t('DRIVE_THRU_SPOT_NUMBER', 'Drive thru lane')
325
+ : t('CURBSIDE_SPOT_NUMBER', 'Spot number')}: `}
289
326
  </OText>
290
- </View>
327
+ {order.spot_number}
328
+ </OText>
291
329
  )}
292
330
  </>
293
331
  )}