ordering-ui-react-native 0.16.77 → 0.16.78-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 (216) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  23. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  24. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  25. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  26. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  27. package/themes/business/src/components/MapView/index.tsx +14 -3
  28. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  30. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +82 -47
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  33. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  34. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  35. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  36. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  37. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  40. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  44. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  47. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +24 -5
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  51. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  52. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  53. package/themes/business/src/components/shared/OLink.tsx +33 -13
  54. package/themes/business/src/components/shared/OText.tsx +8 -2
  55. package/themes/business/src/types/index.tsx +36 -3
  56. package/themes/business/src/utils/index.tsx +53 -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/BusinessesListing/index.tsx +2 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  63. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  64. package/themes/kiosk/src/components/LoginForm/index.tsx +476 -153
  65. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  69. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  70. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  71. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  72. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  73. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  74. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  75. package/themes/kiosk/src/types/index.d.ts +14 -0
  76. package/themes/kiosk/src/utils/index.tsx +15 -0
  77. package/themes/original/index.tsx +8 -0
  78. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  79. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  80. package/themes/original/src/components/AddressList/index.tsx +18 -18
  81. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -79
  84. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  85. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  86. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +102 -155
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +563 -494
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +75 -40
  103. package/themes/original/src/components/CartContent/index.tsx +80 -18
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +101 -106
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +42 -26
  134. package/themes/original/src/components/MomentOption/index.tsx +23 -14
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +7 -6
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  150. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +86 -92
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -254
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +20 -9
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +360 -265
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +112 -77
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +177 -164
  206. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  207. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  209. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  210. package/themes/original/src/components/shared/OButton.tsx +9 -4
  211. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  212. package/themes/original/src/components/shared/OInput.tsx +10 -1
  213. package/themes/original/src/layouts/Container.tsx +13 -9
  214. package/themes/original/src/types/index.tsx +42 -7
  215. package/themes/original/src/utils/index.tsx +322 -58
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -52,7 +52,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
52
52
  handleClickLogisticOrder,
53
53
  forceUpdate,
54
54
  getPermissions,
55
- isGrantedPermissions
55
+ orderAssingId,
56
+ isGrantedPermissions,
56
57
  } = props;
57
58
  const [, { showToast }] = useToast();
58
59
  const { order } = props.order
@@ -154,12 +155,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
154
155
  };
155
156
 
156
157
  const handleRejectLogisticOrder = () => {
157
- handleClickLogisticOrder?.(2, order?.logistic_order_id)
158
+ handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
158
159
  handleArrowBack()
159
160
  }
160
161
 
161
162
  const handleAcceptLogisticOrder = (order: any) => {
162
- handleClickLogisticOrder?.(1, order?.logistic_order_id)
163
+ handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
163
164
  if (order?.order_group) {
164
165
  handleArrowBack()
165
166
  }
@@ -1,6 +1,6 @@
1
- import React, { useState } from 'react'
1
+ import React, { useState, useCallback } from 'react'
2
2
 
3
- import { Platform, StyleSheet, View } from 'react-native';
3
+ import { Platform, StyleSheet, View, TouchableOpacity } from 'react-native';
4
4
 
5
5
  import { OButton, OText, OLink, OModal } from '../shared'
6
6
  import {
@@ -16,12 +16,13 @@ import {
16
16
 
17
17
  import { ProductItemAccordion } from '../ProductItemAccordion';
18
18
 
19
- import { verifyDecimals } from '../../utils';
19
+ import { verifyDecimals, calculateDistance, transformDistance } from '../../utils';
20
20
 
21
21
  import {
22
22
  useLanguage,
23
23
  useUtils,
24
24
  useConfig,
25
+ useSession
25
26
  } from 'ordering-components/native';
26
27
  import { useTheme } from 'styled-components/native';
27
28
  import { ReviewCustomer } from '../ReviewCustomer'
@@ -38,12 +39,18 @@ interface OrderContent {
38
39
  export const OrderContentComponent = (props: OrderContent) => {
39
40
  const [, t] = useLanguage();
40
41
  const theme = useTheme()
41
-
42
+ const [{user}] = useSession()
43
+ console.log(user)
42
44
  const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
43
45
  const [{ parsePrice, parseNumber }] = useUtils();
44
46
  const [{ configs }] = useConfig();
47
+ const distanceUnit = configs?.distance_unit?.value
48
+
45
49
  const [openReviewModal, setOpenReviewModal] = useState(false)
46
50
 
51
+ const [isReadMore, setIsReadMore] = useState(false)
52
+ const [lengthMore, setLengthMore] = useState(false)
53
+
47
54
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
48
55
 
49
56
  const walletName: any = {
@@ -91,10 +98,18 @@ export const OrderContentComponent = (props: OrderContent) => {
91
98
  return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
92
99
  }
93
100
 
101
+ const containsOnlyNumbers = (str: string) => {
102
+ return /^\d+$/.test(str);
103
+ }
104
+
105
+ const onTextLayout = useCallback((e: any) => {
106
+ setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
107
+ },[]);
108
+
94
109
  return (
95
110
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
96
111
  {isOrderGroup && (
97
- <OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
112
+ <OText size={18}>{t('ORDER', 'Order')} #{order?.id}</OText>
98
113
  )}
99
114
 
100
115
  {order?.metafields?.length > 0 && (
@@ -148,7 +163,7 @@ export const OrderContentComponent = (props: OrderContent) => {
148
163
  <View style={styles.linkWithIcons}>
149
164
  <OLink
150
165
  PressStyle={styles.linkWithIcons}
151
- url={`tel:${order?.business?.cellphone}`}
166
+ url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
152
167
  shorcut={`${order?.business?.cellphone}`}
153
168
  TextStyle={styles.textLink}
154
169
  />
@@ -159,7 +174,7 @@ export const OrderContentComponent = (props: OrderContent) => {
159
174
  <View style={styles.linkWithIcons}>
160
175
  <OLink
161
176
  PressStyle={styles.linkWithIcons}
162
- url={`tel:${order?.business?.phone}`}
177
+ url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
163
178
  shorcut={order?.business?.phone}
164
179
  TextStyle={styles.textLink}
165
180
  />
@@ -176,12 +191,17 @@ export const OrderContentComponent = (props: OrderContent) => {
176
191
  ios: `maps:0,0?q=${order?.business?.address}`,
177
192
  android: `geo:0,0?q=${order?.business?.address}`,
178
193
  })}
194
+ numberOfLines={2}
179
195
  shorcut={order?.business?.address}
180
196
  TextStyle={styles.textLink}
181
197
  />
182
198
  </View>
183
199
  )}
184
-
200
+ {!!order?.business?.location && (
201
+ <OText>
202
+ {t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, user?.location), distanceUnit)} {t(distanceUnit.toUpperCase(), distanceUnit)}
203
+ </OText>
204
+ )}
185
205
  {!!order?.business?.address_notes && (
186
206
  <View style={styles.linkWithIcons}>
187
207
  <OLink
@@ -274,7 +294,7 @@ export const OrderContentComponent = (props: OrderContent) => {
274
294
  <View style={styles.linkWithIcons}>
275
295
  <OLink
276
296
  PressStyle={styles.linkWithIcons}
277
- url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
297
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
278
298
  shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
279
299
  TextStyle={styles.textLink}
280
300
  />
@@ -285,7 +305,7 @@ export const OrderContentComponent = (props: OrderContent) => {
285
305
  <View style={styles.linkWithIcons}>
286
306
  <OLink
287
307
  PressStyle={styles.linkWithIcons}
288
- url={`tel:${order?.customer?.phone}`}
308
+ url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
289
309
  shorcut={order?.customer?.phone}
290
310
  TextStyle={styles.textLink}
291
311
  />
@@ -293,17 +313,26 @@ export const OrderContentComponent = (props: OrderContent) => {
293
313
  )}
294
314
 
295
315
  {!!order?.customer?.address && (
296
- <View style={styles.linkWithIcons}>
297
- <OLink
298
- PressStyle={styles.linkWithIcons}
299
- url={Platform.select({
300
- ios: `maps:0,0?q=${order?.customer?.address}`,
301
- android: `geo:0,0?q=${order?.customer?.address}`,
302
- })}
303
- shorcut={order?.customer?.address}
304
- TextStyle={styles.textLink}
305
- />
306
- </View>
316
+ <>
317
+ <View style={styles.linkWithIcons}>
318
+ <OLink
319
+ PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
320
+ url={Platform.select({
321
+ ios: `maps:0,0?q=${order?.customer?.address}`,
322
+ android: `geo:0,0?q=${order?.customer?.address}`,
323
+ })}
324
+ onTextLayout={onTextLayout}
325
+ numberOfLines={isReadMore ? 20 : 2}
326
+ shorcut={order?.customer?.address}
327
+ TextStyle={styles.textLink}
328
+ />
329
+ </View>
330
+ {lengthMore && (
331
+ <TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
332
+ <OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
333
+ </TouchableOpacity>
334
+ )}
335
+ </>
307
336
  )}
308
337
 
309
338
  {!!order?.customer?.internal_number && (
@@ -333,13 +362,18 @@ export const OrderContentComponent = (props: OrderContent) => {
333
362
  <View style={{ marginTop: 10 }}>
334
363
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
335
364
  <OText>
336
- {order?.delivery_option?.name}
365
+ {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
337
366
  </OText>
338
367
  )}
339
368
  {!!order?.comment && (
340
- <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
341
- {order?.comment}
342
- </OText>
369
+ <>
370
+ <OText weight='500' style={{ marginBottom: 5 }}>
371
+ {t('ORDER_COMMENT', 'Order Comment')}
372
+ </OText>
373
+ <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
374
+ {order?.comment}
375
+ </OText>
376
+ </>
343
377
  )}
344
378
  </View>
345
379
  )}
@@ -364,6 +398,7 @@ export const OrderContentComponent = (props: OrderContent) => {
364
398
  <ProductItemAccordion
365
399
  key={product?.id || i}
366
400
  product={product}
401
+ currency={order?.currency}
367
402
  />
368
403
  ))}
369
404
  </OrderProducts>
@@ -372,7 +407,7 @@ export const OrderContentComponent = (props: OrderContent) => {
372
407
  <Table>
373
408
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
374
409
  <OText mBottom={4}>
375
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency})}
410
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency })}
376
411
  </OText>
377
412
  </Table>
378
413
  {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
@@ -385,7 +420,7 @@ export const OrderContentComponent = (props: OrderContent) => {
385
420
  ) : (
386
421
  <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
387
422
  )}
388
- <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency})}</OText>
423
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency })}</OText>
389
424
  </Table>
390
425
  )}
391
426
  {
@@ -393,13 +428,13 @@ export const OrderContentComponent = (props: OrderContent) => {
393
428
  <Table key={offer.id}>
394
429
  <OSRow>
395
430
  <OText mBottom={4}>
396
- {offer.name}
431
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
397
432
  {offer.rate_type === 1 && (
398
433
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
399
434
  )}
400
435
  </OText>
401
436
  </OSRow>
402
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
437
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
403
438
  </Table>
404
439
  ))
405
440
  }
@@ -407,9 +442,9 @@ export const OrderContentComponent = (props: OrderContent) => {
407
442
  <Table>
408
443
  <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
409
444
  {order?.tax_type === 1 ? (
410
- <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency})}</OText>
445
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency })}</OText>
411
446
  ) : (
412
- <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency})}</OText>
447
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency })}</OText>
413
448
  )}
414
449
  </Table>
415
450
  )}
@@ -419,7 +454,7 @@ export const OrderContentComponent = (props: OrderContent) => {
419
454
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
420
455
  </OText>
421
456
  <OText mBottom={4}>
422
- {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency})}
457
+ {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency })}
423
458
  </OText>
424
459
  </Table>
425
460
  )}
@@ -430,7 +465,7 @@ export const OrderContentComponent = (props: OrderContent) => {
430
465
  {t('SERVICE_FEE', 'Service fee')}
431
466
  {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
432
467
  </OText>
433
- <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency})}</OText>
468
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency })}</OText>
434
469
  </Table>
435
470
  )
436
471
  }
@@ -439,11 +474,11 @@ export const OrderContentComponent = (props: OrderContent) => {
439
474
  <Table key={tax.id}>
440
475
  <OSRow>
441
476
  <OText mBottom={4}>
442
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
477
+ {t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
443
478
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
444
479
  </OText>
445
480
  </OSRow>
446
- <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency})}</OText>
481
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency })}</OText>
447
482
  </Table>
448
483
  ))
449
484
  }
@@ -452,11 +487,11 @@ export const OrderContentComponent = (props: OrderContent) => {
452
487
  <Table key={fee.id}>
453
488
  <OSRow>
454
489
  <OText mBottom={4}>
455
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
456
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency})} + `}{fee.percentage}%){' '}
490
+ {t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
491
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
457
492
  </OText>
458
493
  </OSRow>
459
- <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency})}</OText>
494
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency })}</OText>
460
495
  </Table>
461
496
  ))
462
497
  }
@@ -465,13 +500,13 @@ export const OrderContentComponent = (props: OrderContent) => {
465
500
  <Table key={offer.id}>
466
501
  <OSRow>
467
502
  <OText mBottom={4}>
468
- {offer.name}
503
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
469
504
  {offer.rate_type === 1 && (
470
505
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
471
506
  )}
472
507
  </OText>
473
508
  </OSRow>
474
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
509
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
475
510
  </Table>
476
511
  ))
477
512
  }
@@ -483,7 +518,7 @@ export const OrderContentComponent = (props: OrderContent) => {
483
518
  </OText>
484
519
 
485
520
  <OText mBottom={4}>
486
- {parsePrice(order?.summary?.delivery_price, { currency: order?.currency})}
521
+ {parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
487
522
  </OText>
488
523
  </Table>
489
524
  )
@@ -493,13 +528,13 @@ export const OrderContentComponent = (props: OrderContent) => {
493
528
  <Table key={offer.id}>
494
529
  <OSRow>
495
530
  <OText mBottom={4}>
496
- {offer.name}
531
+ {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
497
532
  {offer.rate_type === 1 && (
498
533
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
499
534
  )}
500
535
  </OText>
501
536
  </OSRow>
502
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency})}</OText>
537
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
503
538
  </Table>
504
539
  ))
505
540
  }
@@ -514,7 +549,7 @@ export const OrderContentComponent = (props: OrderContent) => {
514
549
  `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
515
550
  )}
516
551
  </OText>
517
- <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency})}</OText>
552
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
518
553
  </Table>
519
554
  )}
520
555
 
@@ -528,7 +563,7 @@ export const OrderContentComponent = (props: OrderContent) => {
528
563
  mBottom={4}
529
564
  style={styles.textBold}
530
565
  color={theme.colors.primary}>
531
- {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency})}
566
+ {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency })}
532
567
  </OText>
533
568
  </Table>
534
569
  </Total>
@@ -562,7 +597,7 @@ export const OrderContentComponent = (props: OrderContent) => {
562
597
  <OText>
563
598
  {event?.wallet_event
564
599
  ? walletName[event?.wallet_event?.wallet?.type]?.name
565
- : event?.paymethod?.name}
600
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
566
601
  </OText>
567
602
  {event?.data?.charge_id && (
568
603
  <OText>
@@ -571,7 +606,7 @@ export const OrderContentComponent = (props: OrderContent) => {
571
606
  )}
572
607
  </View>
573
608
  <OText>
574
- -{parsePrice(event.amount, { currency: order?.currency})}
609
+ -{parsePrice(event.amount, { currency: order?.currency })}
575
610
  </OText>
576
611
  </View>
577
612
  ))}
@@ -271,7 +271,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
271
271
  {order?.delivery_option && (
272
272
  <OText size={13}>
273
273
  <OText size={13} weight='bold'>{`${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: `}</OText>
274
- {order?.delivery_option?.name}
274
+ {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
275
275
  </OText>
276
276
  )}
277
277
  {order?.payment_events?.length > 0 && (
@@ -286,8 +286,8 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
286
286
  ? `${walletName[event?.wallet_event?.wallet?.type]?.name} - `
287
287
  : walletName[event?.wallet_event?.wallet?.type]?.name
288
288
  : idx < order?.payment_events?.length - 1
289
- ? `${event?.paymethod?.name} - `
290
- : event?.paymethod?.name
289
+ ? `${t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)} - `
290
+ : t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
291
291
  })}
292
292
  </OText>
293
293
  </View>
@@ -0,0 +1,195 @@
1
+ //React & React Native
2
+ import React, { useState, useEffect } from 'react';
3
+ import { View } from 'react-native';
4
+
5
+ // Thirds
6
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
+
8
+ //OrderingComponent
9
+ import {
10
+ useLanguage,
11
+ OrderDetails as OrderDetailsConTableoller,
12
+ useSession,
13
+ } from 'ordering-components/native';
14
+
15
+ //Components
16
+ import Alert from '../../providers/AlertProvider';
17
+ import { FloatingButton } from '../FloatingButton';
18
+ import { OrderDetailsLogisticParams } from '../../types';
19
+ import { useTheme } from 'styled-components/native';
20
+ import { NotFoundSource } from '../NotFoundSource';
21
+ import { getOrderStatus } from '../../utils';
22
+ import { OrderHeaderComponent } from '../OrderDetails/OrderHeaderComponent';
23
+ import { OrderContentComponent } from '../OrderDetails/OrderContentComponent';
24
+ //Styles
25
+ import { OrderDetailsContainer } from './styles';
26
+
27
+ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
28
+ const {
29
+ navigation,
30
+ handleClickLogisticOrder,
31
+ orderAssingId,
32
+ } = props;
33
+ const { order } = props.order
34
+ const theme = useTheme();
35
+ const [, t] = useLanguage();
36
+ const [session] = useSession();
37
+ const [alertState, setAlertState] = useState<{
38
+ open: boolean;
39
+ content: Array<string>;
40
+ key?: string | null;
41
+ }>({ open: false, content: [], key: null });
42
+
43
+ const logisticOrderStatus = [4, 6, 7]
44
+
45
+ const showFloatButtonsAcceptOrReject: any = {
46
+ 0: true,
47
+ 4: true,
48
+ 7: true,
49
+ 14: true
50
+ };
51
+
52
+ const handleArrowBack: any = () => {
53
+ navigation?.canGoBack() && navigation.goBack();
54
+ };
55
+
56
+ const handleRejectLogisticOrder = (order: any) => {
57
+ handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
58
+ handleArrowBack()
59
+ }
60
+
61
+ const handleAcceptLogisticOrder = (order: any) => {
62
+ handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
63
+ handleArrowBack()
64
+ }
65
+
66
+ useEffect(() => {
67
+ if (order?.driver === null && session?.user?.level === 4) {
68
+ setAlertState({
69
+ open: true,
70
+ content: [
71
+ t(
72
+ 'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
73
+ 'You have been removed from the order',
74
+ ),
75
+ ],
76
+ key: null,
77
+ });
78
+ }
79
+ }, [order?.driver]);
80
+
81
+ const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
82
+ const {
83
+ order,
84
+ isOrderGroup,
85
+ lastOrder,
86
+ } = props
87
+ return (
88
+ <>
89
+ <OrderContentComponent
90
+ order={order}
91
+ logisticOrderStatus={logisticOrderStatus}
92
+ isOrderGroup={isOrderGroup}
93
+ lastOrder={lastOrder}
94
+ />
95
+ <View
96
+ style={{
97
+ height:
98
+ order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
99
+ }}
100
+ />
101
+
102
+ </>
103
+ )
104
+ }
105
+
106
+ return (
107
+ <>
108
+ {(!order || Object.keys(order).length === 0) &&
109
+ (props.order?.error?.length < 1 || !props.order?.error) && (
110
+ <View style={{ flex: 1 }}>
111
+ {[...Array(6)].map((item, i) => (
112
+ <Placeholder key={i} Animation={Fade}>
113
+ <View style={{ flexDirection: 'row', paddingVertical: 20 }}>
114
+ <Placeholder>
115
+ <PlaceholderLine width={100} />
116
+ <PlaceholderLine width={70} />
117
+ <PlaceholderLine width={30} />
118
+ <PlaceholderLine width={20} />
119
+ </Placeholder>
120
+ </View>
121
+ </Placeholder>
122
+ ))}
123
+ </View>
124
+ )}
125
+
126
+ {(!!props.order?.error || props.order?.error) && (
127
+ <NotFoundSource
128
+ btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
129
+ content={
130
+ props.order.error[0] ||
131
+ props.order.error ||
132
+ t('NETWORK_ERROR', 'Network Error')
133
+ }
134
+ onClickButton={() => navigation.navigate('Orders')}
135
+ />
136
+ )}
137
+ {!((!order || Object.keys(order).length === 0) &&
138
+ (props.order?.error?.length < 1 || !props.order?.error)) && (
139
+ <View style={{ flex: 1 }}>
140
+ <OrderHeaderComponent
141
+ order={order}
142
+ getOrderStatus={getOrderStatus}
143
+ handleArrowBack={handleArrowBack}
144
+ logisticOrderStatus={logisticOrderStatus}
145
+ />
146
+ {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
147
+ <>
148
+ <OrderDetailsContainer
149
+ keyboardShouldPersistTaps="handled"
150
+ showsVerticalScrollIndicator={false}
151
+ >
152
+ {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
153
+ <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
154
+ )) : (
155
+ <OrderDetailsInformation order={order} />
156
+ )}
157
+ </OrderDetailsContainer>
158
+
159
+ {showFloatButtonsAcceptOrReject[order?.status] && (
160
+ <FloatingButton
161
+ btnText={t('REJECT', 'Reject')}
162
+ isSecondaryBtn={false}
163
+ secondButtonClick={() => handleAcceptLogisticOrder(order)}
164
+ firstButtonClick={() => handleRejectLogisticOrder(order)}
165
+ secondBtnText={t('ACCEPT', 'Accept')}
166
+ secondButton={true}
167
+ firstColorCustom={theme.colors.red}
168
+ secondColorCustom={theme.colors.green}
169
+ widthButton={'45%'}
170
+ />
171
+ )}
172
+ </>
173
+ )}
174
+ </View>
175
+ )}
176
+ {alertState?.open && (
177
+ <Alert
178
+ open={alertState.open}
179
+ onAccept={handleArrowBack}
180
+ onClose={handleArrowBack}
181
+ content={alertState.content}
182
+ title={t('WARNING', 'Warning')}
183
+ />
184
+ )}
185
+ </>
186
+ );
187
+ };
188
+
189
+ export const OrderDetailsLogistic = (props: OrderDetailsLogisticParams) => {
190
+ const orderDetailsProps = {
191
+ ...props,
192
+ UIComponent: OrderDetailsLogisticUI,
193
+ };
194
+ return <OrderDetailsConTableoller {...orderDetailsProps} />;
195
+ };
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const OrderDetailsContainer = styled.ScrollView`
4
+ flex: 1;
5
+ `;