ordering-ui-react-native 0.22.75 → 0.22.76-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 (137) hide show
  1. package/package.json +5 -7
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/Checkout/index.tsx +40 -39
  4. package/src/components/VerifyPhone/styles.tsx +1 -2
  5. package/src/context/OfflineActions/index.tsx +236 -0
  6. package/src/providers/AlertProvider.tsx +3 -1
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
  8. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  9. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  10. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  11. package/themes/business/src/components/Chat/index.tsx +15 -3
  12. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  13. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  14. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  15. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  16. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  17. package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
  18. package/themes/business/src/components/MapView/index.tsx +68 -142
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
  20. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  24. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  27. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  28. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +207 -144
  30. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  31. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
  33. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  34. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  43. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/config/currency.tsx +1010 -0
  46. package/themes/business/src/hooks/useLocation.tsx +16 -12
  47. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  48. package/themes/business/src/types/index.tsx +26 -4
  49. package/themes/business/src/utils/index.tsx +26 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +223 -219
  61. package/themes/original/src/components/AddressForm/index.tsx +56 -17
  62. package/themes/original/src/components/AppleLogin/index.tsx +3 -4
  63. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  64. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -3
  65. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
  67. package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
  68. package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
  69. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
  70. package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
  71. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  72. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
  73. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
  74. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
  75. package/themes/original/src/components/Cart/index.tsx +43 -12
  76. package/themes/original/src/components/Checkout/index.tsx +126 -98
  77. package/themes/original/src/components/FloatingButton/index.tsx +1 -1
  78. package/themes/original/src/components/GPSButton/index.tsx +2 -1
  79. package/themes/original/src/components/GoogleMap/index.tsx +3 -2
  80. package/themes/original/src/components/Help/functions.tsx +76 -0
  81. package/themes/original/src/components/Help/index.tsx +74 -29
  82. package/themes/original/src/components/Help/styles.tsx +4 -1
  83. package/themes/original/src/components/HelpOptions/index.tsx +53 -0
  84. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  85. package/themes/original/src/components/Home/index.tsx +36 -11
  86. package/themes/original/src/components/LastOrder/index.tsx +1 -1
  87. package/themes/original/src/components/LoginForm/index.tsx +11 -5
  88. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  89. package/themes/original/src/components/Messages/index.tsx +562 -555
  90. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  91. package/themes/original/src/components/MomentOption/index.tsx +141 -61
  92. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  93. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  94. package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
  95. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
  96. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  97. package/themes/original/src/components/NavBar/index.tsx +6 -2
  98. package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
  99. package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
  100. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  101. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
  102. package/themes/original/src/components/OrderDetails/index.tsx +44 -20
  103. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  104. package/themes/original/src/components/OrderProgress/index.tsx +5 -4
  105. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  106. package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
  107. package/themes/original/src/components/OrdersOption/index.tsx +325 -325
  108. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
  109. package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
  110. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  111. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  112. package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
  113. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  114. package/themes/original/src/components/SignupForm/index.tsx +40 -24
  115. package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
  116. package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
  117. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  118. package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
  119. package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
  120. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  121. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
  122. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  123. package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
  124. package/themes/original/src/components/UserVerification/index.tsx +18 -5
  125. package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
  126. package/themes/original/src/components/shared/OInput.tsx +97 -97
  127. package/themes/original/src/components/shared/OModal.tsx +7 -2
  128. package/themes/original/src/providers/AlertProvider.tsx +1 -1
  129. package/themes/original/src/types/index.tsx +700 -695
  130. package/themes/original/src/utils/index.tsx +50 -34
  131. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  132. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
  133. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
  134. package/themes/original/src/components/HelpGuide/index.tsx +0 -68
  135. package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
  136. package/themes/original/src/components/HelpOrder/index.tsx +0 -71
  137. package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
- import { OText, OIconButton } from '../shared';
3
- import { StyleSheet, View, Platform, Alert } from 'react-native';
2
+ import { OText, OIcon } from '../shared';
3
+ import { StyleSheet, View, Platform, Alert, TouchableOpacity } from 'react-native';
4
4
  import {
5
5
  Content,
6
6
  OrderCustomer,
@@ -15,7 +15,7 @@ import {
15
15
  ContentInfo,
16
16
  } from './styles';
17
17
  import { useUtils, useLanguage, useConfig } from 'ordering-components/native';
18
- import { verifyDecimals, getProductPrice } from '../../utils';
18
+ import { verifyDecimals, getProductPrice, getCurrenySymbol } from '../../utils';
19
19
  import { FloatingButton } from '../FloatingButton';
20
20
  import RNHTMLtoPDF from 'react-native-html-to-pdf';
21
21
  import RNPrint from 'react-native-print';
@@ -152,14 +152,14 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
152
152
  </br>
153
153
 
154
154
  ${!!order?.delivery_option
155
- ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
156
- } </br>`
157
- : ''
158
- }
155
+ ? `${t('DELIVERY_PREFERENCE', 'Delivery Preference')}: ${t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)
156
+ } </br>`
157
+ : ''
158
+ }
159
159
 
160
160
  ${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}
161
161
  </br>
162
- ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${handlePaymethodsListString()}
162
+ ${t(paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD', paymethodsLength > 1 ? 'Payment methods' : 'Payment method')}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
163
163
  </p>
164
164
 
165
165
  <h1>${t('CUSTOMER_DETAILS', 'Customer details')}</h1>
@@ -168,9 +168,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
168
168
  ${t('EMAIL', 'Email')}: ${order?.customer?.email}
169
169
  </br>
170
170
  ${!!order?.customer?.cellphone
171
- ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
172
- } </br>`
173
- : ''}
171
+ ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.cellphone
172
+ } </br>`
173
+ : ''}
174
174
 
175
175
  ${!!order?.customer?.phone
176
176
  ? `${t('MOBILE_PHONE', 'Mobile Phone')}: ${order?.customer?.phone
@@ -196,10 +196,10 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
196
196
  ${order?.business?.email}
197
197
  </br>
198
198
  ${!!order?.business?.cellphone
199
- ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
200
- } </br>`
201
- : ''
202
- }
199
+ ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.cellphone
200
+ } </br>`
201
+ : ''
202
+ }
203
203
  ${!!order?.business?.phone
204
204
  ? `${t('BUSINESS_PHONE', 'Business Phone')}: ${order?.business?.phone
205
205
  } </br>`
@@ -216,7 +216,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
216
216
  </p>
217
217
  <h1> ${t('ORDER_DETAILS', 'Order Details')}</h1>
218
218
 
219
- ${order?.comment ? ('</br>'+ t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
219
+ ${order?.comment ? ('</br>' + t('ORDER_COMMENT', 'Order Comment') + ':' + order?.comment) : ''}
220
220
 
221
221
  ${order?.products.length &&
222
222
  order?.products.map(
@@ -242,139 +242,174 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
242
242
  </div>`
243
243
  )
244
244
  }
245
- <div style="display: flex;">
246
-
247
- <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
248
- ${t('SUBTOTAL', 'Subtotal')}
249
- </div>
250
-
251
- <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
252
- ${parsePrice(
253
- order.tax_type === 1
254
- ? order?.summary?.subtotal + order?.summary?.tax ?? 0
255
- : order?.summary?.subtotal ?? 0,
256
- )}
257
- </div>
245
+ <div style="display: flex;">
246
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
247
+ ${t('SUBTOTAL', 'Subtotal')}
248
+ </div>
258
249
 
250
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
251
+ ${parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: getCurrenySymbol(order?.currency) })}
259
252
  </div>
253
+ </div>
260
254
 
261
- <div style="display: flex">
255
+ <div style="display: flex">
262
256
  ${order?.summary?.discount > 0
263
257
  ? order?.offer_type === 1
264
258
  ? `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
265
- ${t('DISCOUNT', 'Discount')} (${verifyDecimals(
266
- order?.offer_rate,
267
- parsePrice,
268
- )}%)
269
- </div>`
270
- : `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%"> ${t(
271
- 'DISCOUNT',
272
- 'Discount',
273
- )}
274
- </div>`
275
- : ''
276
- }
277
- ${order?.summary?.discount > 0
278
- ? `<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">- ${parsePrice(
279
- order?.summary?.discount,
280
- )}
259
+ ${t('DISCOUNT', 'Discount')} (${verifyDecimals(order?.offer_rate, parsePrice)}%)
281
260
  </div>`
261
+ : `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%"> ${t('DISCOUNT', 'Discount')}</div>`
282
262
  : ''
283
263
  }
284
- </div>
285
-
286
- ${order?.tax_type !== 1
287
- ? `<div style="font-size: 25px">
288
- ${t('TAX', 'Tax')}
289
- ${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%
290
- ${parsePrice(order?.summary?.tax ?? 0)}
291
- ${t('TAX', 'Tax')}
292
- ${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%
293
- </div>`
264
+ ${order?.summary?.discount > 0
265
+ ? `<div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
266
+ - ${parsePrice(order?.summary?.discount ?? order?.discount, { currency: getCurrenySymbol(order?.currency) })}
267
+ </div>`
294
268
  : ''
295
269
  }
270
+ </div>
296
271
 
297
- ${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ?
298
- ` <div style="display: flex">
299
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
300
- ${t('DELIVERY_FEE', 'Delivery Fee')}
301
- </div>
302
-
303
- <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
304
- ${parsePrice(order?.summary?.delivery_price ?? 0)}
305
- </div>` :
306
- ''}
307
-
308
- </div>
309
- <div style="display: flex">
310
-
311
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
312
- ${t('DRIVER_TIP', 'Driver tip')}
313
- ${percentTip ? `(${percentTip}%)` : ''}
314
- </div>
315
-
316
- <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
317
- ${parsePrice(order?.summary?.driver_tip ?? 0)}
272
+ ${order?.offers?.length > 0 ? order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
273
+ `<div style="display: flex">
274
+ ${order?.rate_type === 1
275
+ ? `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
276
+ ${t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)} (${verifyDecimals(offer?.rate, parsePrice)}%)
277
+ </div>`
278
+ : `<div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">${t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}</div>`}
279
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
280
+ - ${parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}
318
281
  </div>
282
+ </div>`
283
+ )) : ''}
319
284
 
320
- </div>
321
-
322
- ${order?.summary?.service_fee > 0 && `
323
- <div style="display: flex">
324
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
325
- ${t('SERVICE_FEE', 'Service Fee')}
326
- (${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)
285
+ ${order?.taxes?.length === 0 && order?.tax_type === 2
286
+ ? `<div style="display: flex;">
287
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
288
+ ${t('TAX', 'Tax')} (${verifyDecimals(order?.tax, parseNumber)}%)}
327
289
  </div>
290
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
291
+ ${parsePrice(order?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
292
+ </div>
293
+ </div>`
294
+ : ''}
328
295
 
329
- <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
330
- ${parsePrice(order?.summary?.service_fee ?? 0)}
296
+ ${order?.fees?.length === 0 && order?.summary?.service_fee > 0 ? (
297
+ `<div style="display: flex;">
298
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
299
+ ${t('SERVICE_FEE', 'Service fee')} (${verifyDecimals(order?.service_fee, parseNumber)}%)}
331
300
  </div>
301
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
302
+ ${parsePrice(order?.summary?.service_fee ?? 0, { currency: getCurrenySymbol(order?.currency) })}
303
+ </div>
304
+ </div>`
305
+ ) : ''}
332
306
 
333
- </div>
334
- `}
307
+ ${order?.taxes?.length > 0 ? order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
308
+ `<div style="display: flex;">
309
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
310
+ ${t(tax?.name?.toUpperCase?.()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')} (${verifyDecimals(tax?.rate, parseNumber)}%)
311
+ </div>
312
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
313
+ ${parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
314
+ </div>
315
+ </div>`
316
+ )) : ''}
335
317
 
336
- <div style="display: flex">
318
+ ${order?.offers?.length > 0 ? order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
319
+ `<div style="display: flex;">
320
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
321
+ ${t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)} ${offer.rate_type === 1 ? `(${verifyDecimals(offer?.rate, parsePrice)}%)` : ''}
322
+ </div>
323
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
324
+ - ${parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}
325
+ </div>
326
+ </div>`
327
+ )) : ''}
337
328
 
338
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
339
- ${t('TOTAL', 'Total')}
329
+ ${order?.summary?.delivery_price > 0 && order.delivery_type !== 2 ?
330
+ ` <div style="display: flex">
331
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
332
+ ${t('DELIVERY_FEE', 'Delivery Fee')}
340
333
  </div>
341
334
 
342
335
  <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
343
- ${parsePrice(order?.summary?.total ?? 0)}
344
- </div>
345
-
336
+ ${parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
337
+ </div>` :
338
+ ''
339
+ }
340
+ </div>
341
+
342
+ <div style="display: flex">
343
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start">
344
+ ${t('DRIVER_TIP', 'Driver tip')}
345
+ ${percentTip ? `(${percentTip}%)` : ''}
346
+ </div>
347
+ <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
348
+ ${parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: getCurrenySymbol(order?.currency) })}
349
+ </div>
350
+ </div>
351
+
352
+ ${order?.taxes?.length > 0 ? order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
353
+ `<div style="display: flex;">
354
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
355
+ ${tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')} (${verifyDecimals(tax?.rate, parsePrice)}%)
346
356
  </div>
357
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
358
+ ${parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
359
+ </div>
360
+ </div>`
361
+ )) : ''}
347
362
 
348
- ${order?.payment_events.length && `
349
- <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
350
- ${t('PAYMENTS', 'Payments')}
351
- </div>
352
- `}
353
-
354
- ${order?.payment_events.length &&
355
- order?.payment_events.map(
356
- (event: any, i: number) =>
357
- `<div style="display: flex;flexDirection:row;flex-wrap:wrap">
363
+ ${order?.offers?.length > 0 ? order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
364
+ `<div style="display: flex;">
365
+ <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
366
+ ${t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)} ${offer.rate_type === 1 ? `(${verifyDecimals(offer?.rate, parsePrice, { currency: getCurrenySymbol(order?.currency) })}%)` : ''}
367
+ </div>
368
+ <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
369
+ - ${parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}
370
+ </div>
371
+ </div>`
372
+ )) : ''}
373
+
374
+ <div style="display: flex">
375
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
376
+ ${t('TOTAL', 'Total')}
377
+ </div>
378
+ <div style="font-size: 26px; width: 30%; display: flex; justify-content: flex-end">
379
+ ${parsePrice(order?.summary?.total ?? 0)}
380
+ </div>
381
+ </div>
382
+
383
+ ${order?.payment_events.length && `
384
+ <div style="font-size: 26px; width: 70%; display: flex; justify-content: flex-start; font-weight: bold">
385
+ ${t('PAYMENTS', 'Payments')}
386
+ </div>
387
+ `}
388
+
389
+ ${order?.payment_events.length &&
390
+ order?.payment_events.map(
391
+ (event: any, i: number) =>
392
+ `<div style="display: flex;flexDirection:row;flex-wrap:wrap">
358
393
  <div style="display:flex;width:100%">
359
394
  <div style="display:flex; justify-content: flex-start; font-size: 26px; width: 70%">
360
395
  ${event?.wallet_event
361
- ? walletName[event?.wallet_event?.wallet?.type]?.name
362
- : event?.paymethod?.gateway && event?.paymethod?.gateway === 'cash' && order?.cash > 0
363
- ? `${t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
364
- : event?.paymethod?.gateway
365
- ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
366
- : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
396
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
397
+ : event?.paymethod?.gateway && event?.paymethod?.gateway === 'cash' && order?.cash > 0
398
+ ? `${t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)} (${t('CASH_CHANGE_OF', 'Change of :amount:').replace(':amount:', parsePrice(order?.cash))})`
399
+ : event?.paymethod?.gateway
400
+ ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
401
+ : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}
367
402
  </div>
368
403
 
369
404
  <div style="display:flex; justify-content: flex-end; font-size: 26px; width: 30%">
370
405
  ${(event?.paymethod?.gateway === 'cash' && order?.cash)
371
- ? parsePrice(order?.cash, { currency: order?.currency })
372
- : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
406
+ ? parsePrice(order?.cash, { currency: order?.currency })
407
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
373
408
  </div>
374
409
  </div>
375
410
  </div>`
376
- )}
377
- </div>`;
411
+ )}
412
+ </div> `;
378
413
  };
379
414
 
380
415
  const deliveryStatus: any = {
@@ -418,8 +453,16 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
418
453
 
419
454
  const styles = StyleSheet.create({
420
455
  btnBackArrow: {
421
- maxWidth: 40,
422
- height: 25,
456
+ borderWidth: 0,
457
+ width: 32,
458
+ height: 32,
459
+ tintColor: theme.colors.textGray,
460
+ backgroundColor: theme.colors.clear,
461
+ borderColor: theme.colors.clear,
462
+ shadowColor: theme.colors.clear,
463
+ paddingLeft: 0,
464
+ paddingRight: 0,
465
+ marginTop: 10
423
466
  },
424
467
  textBold: {
425
468
  fontWeight: '600',
@@ -445,18 +488,27 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
445
488
  }
446
489
  };
447
490
 
491
+ const getIncludedTaxes = (isDeliveryFee?: boolean) => {
492
+ if (!order?.taxes) return 0
493
+ if (order?.taxes?.length === 0) {
494
+ return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
495
+ } else {
496
+ return order?.taxes.reduce((taxIncluded: number, tax: any) => {
497
+ return taxIncluded +
498
+ (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
499
+ (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
500
+ }, 0)
501
+ }
502
+ }
503
+
448
504
  return (
449
505
  <>
450
506
  <Content>
451
507
  <OrderContent>
452
508
  <OrderHeader>
453
- <OIconButton
454
- icon={theme.images.general.arrow_left}
455
- iconStyle={{ width: 20, height: 20 }}
456
- borderColor={theme.colors.clear}
457
- style={{ maxWidth: 40, justifyContent: 'flex-end' }}
458
- onClick={() => handleArrowBack()}
459
- />
509
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
510
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
511
+ </TouchableOpacity>
460
512
  <OText
461
513
  style={{ marginBottom: 5 }}
462
514
  size={15}
@@ -488,7 +540,9 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
488
540
  {`${t('DELIVERY_DATE', 'Delivery Date')}: ${deliveryDate(order)}`}
489
541
  </OText>
490
542
 
491
- <OText style={{ marginBottom: 5 }}>{`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${handlePaymethodsListString()}`}</OText>
543
+ <OText style={{ marginBottom: 5 }}>
544
+ {`${t(`${paymethodsLength > 1 ? 'PAYMENT_METHODS' : 'PAYMENT_METHOD'}`, `${paymethodsLength > 1 ? 'Payment methods' : 'Payment method'}`)}: ${order?.payment_events?.length > 0 ? handlePaymethodsListString() : t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}`}
545
+ </OText>
492
546
 
493
547
  </OrderHeader>
494
548
 
@@ -564,7 +618,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
564
618
  </OText>
565
619
  )}
566
620
 
567
- {order?.customer?.address_notes && (
621
+ {!!order?.customer?.address_notes && (
568
622
  <OText style={{ marginBottom: 5 }}>
569
623
  {`${t('NOTES', 'Notes')}: ${order?.customer?.address_notes}`}
570
624
  </OText>
@@ -663,7 +717,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
663
717
  {t('ORDER_DETAILS', 'Order Details')}
664
718
  </OText>
665
719
 
666
- {order?.comment && (
720
+ {!!order?.comment && (
667
721
  <OText style={{ marginBottom: 5 }}>
668
722
  {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
669
723
  </OText>
@@ -690,38 +744,17 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
690
744
  </OText>
691
745
 
692
746
  <OText style={{ marginBottom: 5 }}>
693
- {parsePrice(
694
- order.tax_type === 1
695
- ? order?.summary?.subtotal + order?.summary?.tax ?? 0
696
- : order?.summary?.subtotal ?? 0,
697
- )}
747
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: getCurrenySymbol(order?.currency) })}
698
748
  </OText>
699
749
  </Table>
700
750
 
701
- {order?.tax_type !== 1 && (
702
- <Table>
703
- <OText style={{ marginBottom: 5 }}>
704
- {t('TAX', 'Tax')}
705
- {`(${verifyDecimals(
706
- order?.summary?.tax_rate,
707
- parseNumber,
708
- )}%)`}
709
- </OText>
710
-
711
- <OText style={{ marginBottom: 5 }}>
712
- {parsePrice(order?.summary?.tax ?? 0)}
713
- </OText>
714
- </Table>
715
- )}
716
-
717
- {order?.summary?.discount > 0 && (
751
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
718
752
  <Table>
719
753
  {order?.offer_type === 1 ? (
720
754
  <OText style={{ marginBottom: 5 }}>
721
755
  <OText>{t('DISCOUNT', 'Discount')}</OText>
722
-
723
756
  <OText>
724
- {`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}
757
+ {`(${verifyDecimals(order?.offer_rate, parsePrice)} %)`}
725
758
  </OText>
726
759
  </OText>
727
760
  ) : (
@@ -731,55 +764,117 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
731
764
  )}
732
765
 
733
766
  <OText style={{ marginBottom: 5 }}>
734
- - {parsePrice(order?.summary?.discount)}
767
+ - {parsePrice(order?.summary?.discount ?? order?.discount, { currency: getCurrenySymbol(order?.currency) })}
735
768
  </OText>
736
769
  </Table>
737
770
  )}
738
771
 
739
- {order?.summary?.delivery_price > 0 && order.delivery_type !== 2 && (
772
+ {order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
773
+ <Table key={offer.id}>
774
+ <OText mBottom={4}>
775
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
776
+ {offer.rate_type === 1 && (
777
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)} %)`}</OText>
778
+ )}
779
+ </OText>
780
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
781
+ </Table>
782
+ ))}
783
+
784
+ {order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
740
785
  <Table>
741
- <OText style={{ marginBottom: 5 }}>
786
+ <OText mBottom={4}>
787
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)} %)`}
788
+ </OText>
789
+ <OText mBottom={4}>
790
+ {parsePrice(order?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
791
+ </OText>
792
+ </Table>
793
+ )}
794
+
795
+ {order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
796
+ <Table>
797
+ <OText mBottom={4}>
798
+ {t('SERVICE_FEE', 'Service fee')}
799
+ {`(${verifyDecimals(order?.service_fee, parseNumber)} %)`}
800
+ </OText>
801
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
802
+ </Table>
803
+ )}
804
+
805
+ {order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
806
+ <Table key={tax.id}>
807
+ <OText mBottom={4}>
808
+ {t(tax?.name?.toUpperCase?.()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
809
+ {`(${verifyDecimals(tax?.rate, parseNumber)} %)`}{' '}
810
+ </OText>
811
+ <OText mBottom={4}>
812
+ {parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
813
+ </OText>
814
+ </Table>
815
+ ))}
816
+
817
+ {order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
818
+ <Table key={offer.id}>
819
+ <OText mBottom={4}>
820
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
821
+ {offer.rate_type === 1 && (
822
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)} %)`}</OText>
823
+ )}
824
+ </OText>
825
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
826
+ </Table>
827
+ ))}
828
+
829
+ {typeof order?.summary?.delivery_price === 'number' && order.delivery_type !== 2 && (
830
+ <Table>
831
+ <OText mBottom={4}>
742
832
  {t('DELIVERY_FEE', 'Delivery Fee')}
743
833
  </OText>
744
834
 
745
- <OText>{parsePrice(order?.summary?.delivery_price)}</OText>
835
+ <OText mBottom={4}>
836
+ {parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
837
+ </OText>
746
838
  </Table>
747
839
  )}
748
840
 
749
841
  {(order?.summary?.driver_tip > 0 || order?.driver_tip > 0) && order.delivery_type !== 2 && (
750
842
  <Table>
751
- <OText style={{ marginBottom: 5 }}>
843
+ <OText mBottom={4}>
752
844
  {t('DRIVER_TIP', 'Driver tip')}
753
- {order?.summary?.driver_tip > 0 &&
754
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
845
+ {order?.driver_tip > 0 && parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
755
846
  !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
756
- `(${verifyDecimals(
757
- order?.summary?.driver_tip,
758
- parseNumber,
759
- )}%)`}
847
+ (
848
+ `(${verifyDecimals(order?.driver_tip, parseNumber)} %)`
849
+ )}
760
850
  </OText>
761
-
762
- <OText style={{ marginBottom: 5 }}>
763
- {parsePrice(order?.summary?.driver_tip ?? 0)}
851
+ <OText mBottom={4}>
852
+ {parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: getCurrenySymbol(order?.currency) })}
764
853
  </OText>
765
854
  </Table>
766
855
  )}
767
856
 
768
- {order?.summary?.service_fee > 0 && (
769
- <Table>
770
- <OText style={{ marginBottom: 5 }}>
771
- {t('SERVICE_FEE', 'Service Fee')}
772
- {`(${verifyDecimals(
773
- order?.summary?.service_fee,
774
- parseNumber,
775
- )}%)`}
857
+ {order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
858
+ <Table key={`${tax.description}_${i} `}>
859
+ <OText mBottom={4}>
860
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
861
+ {`(${verifyDecimals(tax?.rate, parseNumber)} %)`}
776
862
  </OText>
777
-
778
- <OText style={{ marginBottom: 5 }}>
779
- {parsePrice(order?.summary?.service_fee)}
863
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
864
+ </Table>
865
+ ))}
866
+
867
+ {order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
868
+ <Table key={offer.id}>
869
+ <OText mBottom={4}>
870
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
871
+ {offer.rate_type === 1 && (
872
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice, { currency: getCurrenySymbol(order?.currency) })}%)`}</OText>
873
+ )}
780
874
  </OText>
875
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
781
876
  </Table>
782
- )}
877
+ ))}
783
878
 
784
879
  <Total>
785
880
  <Table>
@@ -846,6 +846,18 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
846
846
  {
847
847
  key: 23,
848
848
  text: t('ORDER_DRIVER_ON_WAY', 'Driver on way')
849
+ },
850
+ {
851
+ key: 24,
852
+ text: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order')
853
+ },
854
+ {
855
+ key: 25,
856
+ text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
857
+ },
858
+ {
859
+ key: 26,
860
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
849
861
  }
850
862
  ],
851
863
  tabs: [
@@ -858,7 +870,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
858
870
  {
859
871
  key: 1,
860
872
  text: t('IN_PROGRESS', 'In Progress'),
861
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23],
873
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
862
874
  title: 'inProgress',
863
875
  },
864
876
  {