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,5 +1,4 @@
1
1
  import React, { useState, useCallback } from 'react'
2
-
3
2
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
3
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
4
 
@@ -13,17 +12,20 @@ import {
13
12
  OrderBill,
14
13
  Total,
15
14
  OSRow,
15
+ OrderVehicle,
16
+ OrderSpot,
16
17
  } from './styles';
17
18
 
18
19
  import { ProductItemAccordion } from '../ProductItemAccordion';
19
20
 
20
- import { verifyDecimals, calculateDistance, transformDistance } from '../../utils';
21
+ import { verifyDecimals, calculateDistance, transformDistance, getCurrenySymbol } from '../../utils';
21
22
 
22
23
  import {
23
24
  useLanguage,
24
25
  useUtils,
25
26
  useConfig,
26
- useSession
27
+ useSession,
28
+ useApi
27
29
  } from 'ordering-components/native';
28
30
  import { useTheme } from 'styled-components/native';
29
31
  import { ReviewCustomer } from '../ReviewCustomer'
@@ -44,6 +46,7 @@ interface OrderContent {
44
46
  export const OrderContentComponent = (props: OrderContent) => {
45
47
  const [, t] = useLanguage();
46
48
  const theme = useTheme()
49
+ const [ordering] = useApi()
47
50
  const [{ user }] = useSession()
48
51
  const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
49
52
  const [{ parsePrice, parseNumber }] = useUtils();
@@ -66,6 +69,11 @@ export const OrderContentComponent = (props: OrderContent) => {
66
69
  })
67
70
 
68
71
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
72
+ const deliveryTypes = [1, 7]
73
+
74
+ const commentDivide = ordering?.project?.includes('delosi')
75
+ ? order?.comment?.split('Total')
76
+ : [order?.comment]
69
77
 
70
78
  const walletName: any = {
71
79
  cash: {
@@ -97,19 +105,21 @@ export const OrderContentComponent = (props: OrderContent) => {
97
105
  }
98
106
  })
99
107
 
100
- const getIncludedTaxes = () => {
108
+ const getIncludedTaxes = (isDeliveryFee?: boolean) => {
101
109
  if (!order?.taxes) return 0
102
110
  if (order?.taxes?.length === 0) {
103
111
  return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
104
112
  } else {
105
113
  return order?.taxes.reduce((taxIncluded: number, tax: any) => {
106
- return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
114
+ return taxIncluded +
115
+ (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') ||
116
+ (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
107
117
  }, 0)
108
118
  }
109
119
  }
110
120
 
111
121
  const getIncludedTaxesDiscounts = () => {
112
- return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
122
+ return order?.taxes?.filter((tax: any) => tax?.type === 1 && tax?.target === 'product')?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
113
123
  }
114
124
 
115
125
  const containsOnlyNumbers = (str: string) => {
@@ -408,9 +418,9 @@ export const OrderContentComponent = (props: OrderContent) => {
408
418
  {t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
409
419
  </OText>
410
420
  )}
411
- {(order?.delivery_option !== undefined && order?.delivery_type === 1) && (
421
+ {(order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type)) && (
412
422
  <View style={{ marginTop: 10 }}>
413
- {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
423
+ {order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type) && (
414
424
  <OText>
415
425
  {t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
416
426
  </OText>
@@ -434,9 +444,29 @@ export const OrderContentComponent = (props: OrderContent) => {
434
444
  </OText>
435
445
 
436
446
  {!!order?.comment && (
437
- <OText>
438
- {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
439
- </OText>
447
+ <View>
448
+ <OText>
449
+ {`${t('ORDER_COMMENT', 'Order Comment')}: `}
450
+ </OText>
451
+ {commentDivide?.map((fragment: string, i: number) => (
452
+ <View
453
+ {...(ordering?.project?.includes('delosi') && i === 1 && {
454
+ backgroundColor: theme.colors.primary,
455
+ weight: 'bold',
456
+ padding: 10
457
+ })}
458
+ >
459
+ <OText
460
+ {...(ordering?.project?.includes('delosi') && i === 1 && {
461
+ color: theme.colors.white,
462
+ weight: 'bold'
463
+ })}
464
+ >
465
+ {ordering?.project?.includes('delosi') && i === 1 ? t('TOTAL', 'Total') : ''}{fragment}
466
+ </OText>
467
+ </View>
468
+ ))}
469
+ </View>
440
470
  )}
441
471
 
442
472
  {order?.products?.length > 0 &&
@@ -449,11 +479,11 @@ export const OrderContentComponent = (props: OrderContent) => {
449
479
  ))}
450
480
  </OrderProducts>
451
481
 
452
- <OrderBill>
482
+ <OrderBill vehicleExists={!!order?.vehicle}>
453
483
  <Table>
454
484
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
455
485
  <OText mBottom={4}>
456
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: order?.currency })}
486
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()), { currency: getCurrenySymbol(order?.currency) })}
457
487
  </OText>
458
488
  </Table>
459
489
  {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
@@ -466,7 +496,7 @@ export const OrderContentComponent = (props: OrderContent) => {
466
496
  ) : (
467
497
  <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
468
498
  )}
469
- <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: order?.currency })}</OText>
499
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
470
500
  </Table>
471
501
  )}
472
502
  {
@@ -480,7 +510,7 @@ export const OrderContentComponent = (props: OrderContent) => {
480
510
  )}
481
511
  </OText>
482
512
  </OSRow>
483
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
513
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
484
514
  </Table>
485
515
  ))
486
516
  }
@@ -488,9 +518,9 @@ export const OrderContentComponent = (props: OrderContent) => {
488
518
  <Table>
489
519
  <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
490
520
  {order?.tax_type === 1 ? (
491
- <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: order?.currency })}</OText>
521
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0), { currency: getCurrenySymbol(order?.currency) })}</OText>
492
522
  ) : (
493
- <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: order?.currency })}</OText>
523
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
494
524
  )}
495
525
  </Table>
496
526
  )}
@@ -500,7 +530,7 @@ export const OrderContentComponent = (props: OrderContent) => {
500
530
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
501
531
  </OText>
502
532
  <OText mBottom={4}>
503
- {parsePrice(order?.summary?.tax ?? 0, { currency: order?.currency })}
533
+ {parsePrice(order?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}
504
534
  </OText>
505
535
  </Table>
506
536
  )}
@@ -511,12 +541,12 @@ export const OrderContentComponent = (props: OrderContent) => {
511
541
  {t('SERVICE_FEE', 'Service fee')}
512
542
  {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
513
543
  </OText>
514
- <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: order?.currency })}</OText>
544
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
515
545
  </Table>
516
546
  )
517
547
  }
518
548
  {
519
- order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
549
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map((tax: any) => (
520
550
  <Table key={tax.id}>
521
551
  <OSRow>
522
552
  <OText mBottom={4}>
@@ -524,7 +554,7 @@ export const OrderContentComponent = (props: OrderContent) => {
524
554
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
525
555
  </OText>
526
556
  </OSRow>
527
- <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: order?.currency })}</OText>
557
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
528
558
  </Table>
529
559
  ))
530
560
  }
@@ -534,10 +564,10 @@ export const OrderContentComponent = (props: OrderContent) => {
534
564
  <OSRow>
535
565
  <OText mBottom={4}>
536
566
  {t(fee?.name?.toUpperCase?.()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
537
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
567
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: getCurrenySymbol(order?.currency) })} + `}{fee.percentage}%){' '}
538
568
  </OText>
539
569
  </OSRow>
540
- <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: order?.currency })}</OText>
570
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
541
571
  </Table>
542
572
  ))
543
573
  }
@@ -552,7 +582,7 @@ export const OrderContentComponent = (props: OrderContent) => {
552
582
  )}
553
583
  </OText>
554
584
  </OSRow>
555
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
585
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
556
586
  </Table>
557
587
  ))
558
588
  }
@@ -564,11 +594,24 @@ export const OrderContentComponent = (props: OrderContent) => {
564
594
  </OText>
565
595
 
566
596
  <OText mBottom={4}>
567
- {parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}
597
+ {parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
568
598
  </OText>
569
599
  </Table>
570
600
  )
571
601
  }
602
+ {
603
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map((tax: any, i: number) => (
604
+ <Table key={`${tax.description}_${i}`}>
605
+ <OSRow>
606
+ <OText mBottom={4}>
607
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
608
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}
609
+ </OText>
610
+ </OSRow>
611
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0, { currency: getCurrenySymbol(order?.currency) })}</OText>
612
+ </Table>
613
+ ))
614
+ }
572
615
  {
573
616
  order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
574
617
  <Table key={offer.id}>
@@ -576,11 +619,11 @@ export const OrderContentComponent = (props: OrderContent) => {
576
619
  <OText mBottom={4}>
577
620
  {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
578
621
  {offer.rate_type === 1 && (
579
- <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
622
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice, { currency: getCurrenySymbol(order?.currency) })}%)`}</OText>
580
623
  )}
581
624
  </OText>
582
625
  </OSRow>
583
- <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: order?.currency })}</OText>
626
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount, { currency: getCurrenySymbol(order?.currency) })}</OText>
584
627
  </Table>
585
628
  ))
586
629
  }
@@ -594,7 +637,7 @@ export const OrderContentComponent = (props: OrderContent) => {
594
637
  `(${verifyDecimals(order?.driver_tip, parseNumber)}%)`
595
638
  )}
596
639
  </OText>
597
- <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: order?.currency })}</OText>
640
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip, { currency: getCurrenySymbol(order?.currency) })}</OText>
598
641
  </Table>
599
642
  )}
600
643
 
@@ -608,14 +651,19 @@ export const OrderContentComponent = (props: OrderContent) => {
608
651
  mBottom={4}
609
652
  style={styles.textBold}
610
653
  color={theme.colors.primary}>
611
- {parsePrice(order?.summary?.total ?? order?.total, { currency: order?.currency })}
654
+ {parsePrice(order?.summary?.total ?? order?.total, { currency: getCurrenySymbol(order?.currency) })}
612
655
  </OText>
613
656
  </Table>
614
657
  </Total>
615
658
 
616
659
  {order?.payment_events?.length > 0 && (
617
- <View>
618
- <OText size={14} color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
660
+ <View
661
+ style={{
662
+ backgroundColor: theme?.colors?.primary,
663
+ padding: 10
664
+ }}
665
+ >
666
+ <OText size={14} color={theme?.colors?.white}>{t('PAYMENTS', 'Payments')}</OText>
619
667
  <View
620
668
  style={{
621
669
  width: '100%',
@@ -639,7 +687,9 @@ export const OrderContentComponent = (props: OrderContent) => {
639
687
  flexDirection: 'column',
640
688
  }}
641
689
  >
642
- <OText>
690
+ <OText
691
+ color={theme?.colors?.white}
692
+ >
643
693
  {event?.wallet_event
644
694
  ? walletName[event?.wallet_event?.wallet?.type]?.name
645
695
  : event?.paymethod?.gateway
@@ -649,17 +699,77 @@ export const OrderContentComponent = (props: OrderContent) => {
649
699
  : ''}
650
700
  </OText>
651
701
  </View>
652
- <OText>
702
+ <OText
703
+ color={theme?.colors?.white}
704
+ >
653
705
  {(event?.paymethod?.gateway === 'cash' && order?.cash)
654
- ? parsePrice(order?.cash, { currency: order?.currency })
655
- : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
706
+ ? parsePrice(order?.cash, { currency: getCurrenySymbol(order?.currency) })
707
+ : `-${parsePrice(event?.amount, { currency: getCurrenySymbol(order?.currency) })}`}
656
708
  </OText>
657
709
  </View>
658
710
  ))}
659
711
  </View>
660
712
  </View>
661
713
  )}
662
- </OrderBill >
714
+
715
+ </OrderBill>
716
+
717
+ {!!order?.spot_number && (
718
+ <OrderSpot vehicleExists={!!order?.vehicle}>
719
+ <Table>
720
+ <OText style={{ marginBottom: 5 }}>
721
+ {t('SPOT_NUMBER', 'Spot number')}
722
+ </OText>
723
+ <OText style={{ marginBottom: 5 }}>
724
+ {order?.spot_number}
725
+ </OText>
726
+ </Table>
727
+ </OrderSpot>
728
+ )}
729
+
730
+ {!!order?.vehicle && (
731
+ <OrderVehicle>
732
+ <OText
733
+ style={{ marginBottom: 5 }}
734
+ size={16}
735
+ weight="600"
736
+ color={theme.colors.textGray}>
737
+ {t('VEHICLE', 'Vehicle')}
738
+ </OText>
739
+ <Table>
740
+ <OText style={{ marginBottom: 5 }}>
741
+ {t('CAR_REGISTRATION', 'Car registration')}
742
+ </OText>
743
+ <OText style={{ marginBottom: 5 }}>
744
+ {order?.vehicle?.car_registration}
745
+ </OText>
746
+ </Table>
747
+ <Table>
748
+ <OText style={{ marginBottom: 5 }}>
749
+ {t('COLOR', 'Color')}
750
+ </OText>
751
+ <OText style={{ marginBottom: 5 }}>
752
+ {order?.vehicle?.color}
753
+ </OText>
754
+ </Table>
755
+ <Table>
756
+ <OText style={{ marginBottom: 5 }}>
757
+ {t('MODEL', 'Model')}
758
+ </OText>
759
+ <OText style={{ marginBottom: 5 }}>
760
+ {order?.vehicle?.model}
761
+ </OText>
762
+ </Table>
763
+ <Table>
764
+ <OText style={{ marginBottom: 5 }}>
765
+ {t('TYPE', 'Type')}
766
+ </OText>
767
+ <OText style={{ marginBottom: 5 }}>
768
+ {order?.vehicle?.type}
769
+ </OText>
770
+ </Table>
771
+ </OrderVehicle>
772
+ )}
663
773
  <OModal
664
774
  open={openReviewModal}
665
775
  onClose={() => setOpenReviewModal(false)}
@@ -3,7 +3,9 @@ import React from 'react';
3
3
  //Styles
4
4
  import {
5
5
  Actions,
6
+ Dot,
6
7
  Header,
8
+ Messages,
7
9
  OrderHeader,
8
10
  } from './styles';
9
11
 
@@ -22,7 +24,8 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
22
24
  import {
23
25
  useLanguage,
24
26
  useUtils,
25
- useConfig
27
+ useConfig,
28
+ useSession
26
29
  } from 'ordering-components/native';
27
30
 
28
31
  interface OrderHeader {
@@ -35,6 +38,8 @@ interface OrderHeader {
35
38
  handleViewSummaryOrder?: any;
36
39
  handleCopyClipboard?: any
37
40
  isCustomView?: any
41
+ messages?: any
42
+ messagesReadList?: any
38
43
  }
39
44
 
40
45
  export const OrderHeaderComponent = (props: OrderHeader) => {
@@ -46,14 +51,21 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
46
51
  getOrderStatus,
47
52
  logisticOrderStatus,
48
53
  handleViewSummaryOrder,
49
- handleCopyClipboard
54
+ handleCopyClipboard,
55
+ messages,
56
+ messagesReadList
50
57
  } = props
51
58
  const theme = useTheme();
52
59
  const [, t] = useLanguage();
53
60
  const [configState] = useConfig()
61
+ const [{ user }] = useSession()
54
62
  const [{ parseDate, parsePrice }] = useUtils();
55
63
  const paymethodsLength = order?.payment_events?.filter((item: any) => item.event === 'payment')?.length
56
64
  const showExternalId = configState?.configs?.change_order_id?.value === '1'
65
+ const messagesReadIds = messagesReadList?.map((message: any) => message?.order_message_id)
66
+
67
+ const filteredMessages = messagesReadList?.length > 0 ? messages?.messages?.filter((message: any) => !messagesReadIds?.includes(message?.id)) : messages?.messages
68
+ const cateringTypes : any = [7, 8]
57
69
 
58
70
  const styles = StyleSheet.create({
59
71
  icons: {
@@ -91,6 +103,11 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
91
103
  19: theme.colors.statusOrderBlue,
92
104
  20: theme.colors.statusOrderBlue,
93
105
  21: theme.colors.statusOrderBlue,
106
+ 22: theme.colors.statusOrderBlue,
107
+ 23: theme.colors.statusOrderBlue,
108
+ 24: theme.colors.statusOrderBlue,
109
+ 25: theme.colors.statusOrderBlue,
110
+ 26: theme.colors.statusOrderBlue,
94
111
  //GREEN
95
112
  1: theme.colors.statusOrderGreen,
96
113
  11: theme.colors.statusOrderGreen,
@@ -137,17 +154,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
137
154
  return paymethodsList.join(', ')
138
155
  }
139
156
 
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
-
151
157
  return (
152
158
  <>
153
159
  {!props.isCustomView && (
@@ -191,18 +197,20 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
191
197
  style={styles.icons}
192
198
  onClick={() => handleOpenMapView()}
193
199
  />
194
-
195
- <OIconButton
196
- icon={theme.images.general.messages}
197
- iconStyle={{
198
- width: 20,
199
- height: 20,
200
- tintColor: theme.colors.textGray,
201
- }}
202
- borderColor={theme.colors.clear}
203
- style={styles.icons}
204
- onClick={() => handleOpenMessagesForBusiness()}
205
- />
200
+ <Messages>
201
+ {filteredMessages?.filter((message: any) => message?.author_id !== user?.id && !message?.read)?.length > 0 && <Dot />}
202
+ <OIconButton
203
+ icon={theme.images.general.messages}
204
+ iconStyle={{
205
+ width: 20,
206
+ height: 20,
207
+ tintColor: theme.colors.textGray,
208
+ }}
209
+ borderColor={theme.colors.clear}
210
+ style={styles.icons}
211
+ onClick={() => handleOpenMessagesForBusiness()}
212
+ />
213
+ </Messages>
206
214
  </Actions>
207
215
  )}
208
216
  </Header>
@@ -210,12 +218,28 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
210
218
  <OrderHeader>
211
219
  {!props.isCustomView ? (
212
220
  <OText size={13} style={{ marginBottom: 5 }}>
213
- {deliveryDate()}
221
+ <>
222
+ {cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
223
+ {order?.delivery_datetime_utc && (
224
+ <>{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime_utc)}</>
225
+ )}
226
+ {order?.delivery_datetime && (
227
+ <>{'\n'}{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime, { utc: false })} {`(${t('BUSINESS_TIME', 'Business time')})`}</>
228
+ )}
229
+ </>
214
230
  </OText>
215
231
  ) : (
216
232
  <Header style={{ alignItems: 'center' }}>
217
233
  <OText size={13} style={{ marginBottom: 5 }}>
218
- {deliveryDate()}
234
+ <>
235
+ {cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
236
+ {order?.delivery_datetime_utc && (
237
+ <>{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime_utc)}</>
238
+ )}
239
+ {order?.delivery_datetime && (
240
+ <>{'\n'}{cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} {parseDate(order?.delivery_datetime, { utc: false })} {`(${t('BUSINESS_TIME', 'Business time')})`}</>
241
+ )}
242
+ </>
219
243
  </OText>
220
244
 
221
245
  {(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
@@ -254,7 +278,6 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
254
278
  style={styles.icons}
255
279
  onClick={() => handleOpenMapView()}
256
280
  />
257
-
258
281
  <OIconButton
259
282
  icon={theme.images.general.messages}
260
283
  iconStyle={{
@@ -25,13 +25,13 @@ export const Logo = styled.View`
25
25
 
26
26
  export const OrderContent = styled.View`
27
27
  flex: 1;
28
- ${(props : any) => props.isOrderGroup && css`
28
+ ${(props: any) => props.isOrderGroup && css`
29
29
  border-color: rgba(0, 0, 0, 0.2);
30
30
  border-width: 1px;
31
31
  padding: 10px;
32
32
  `
33
33
  }
34
- ${(props : any) => props.lastOrder && css`
34
+ ${(props: any) => props.lastOrder && css`
35
35
  margin-bottom: 50px;
36
36
  `}
37
37
  `;
@@ -68,7 +68,28 @@ export const Table = styled.View`
68
68
 
69
69
  export const OrderBill = styled.View`
70
70
  padding-vertical: 20px;
71
- padding-bottom: 30px;
71
+ ${(props: any) => !props.vehicleExists && css`
72
+ padding-bottom: 50px;
73
+ `
74
+ }
75
+ flex: 1;
76
+ `;
77
+
78
+ export const OrderVehicle = styled.View`
79
+ border-top-width: 1px;
80
+ border-top-color: ${(props: any) => props.theme.colors.borderTops};
81
+ padding-vertical: 20px;
82
+ padding-bottom: 50px;
83
+ flex: 1;
84
+ `;
85
+
86
+ export const OrderSpot = styled.View`
87
+ border-top-width: 1px;
88
+ border-top-color: ${(props: any) => props.theme.colors.borderTops};
89
+ padding-vertical: 20px;
90
+ ${(props: any) => !props.vehicleExists && css`
91
+ padding-bottom: 50px;
92
+ `}
72
93
  flex: 1;
73
94
  `;
74
95
 
@@ -98,3 +119,18 @@ export const OSRow = styled.View`
98
119
  width: 70%;
99
120
  flex-wrap: wrap;
100
121
  `
122
+
123
+ export const Messages = styled.View`
124
+ position: relative;
125
+ `;
126
+
127
+ export const Dot = styled.View`
128
+ position: absolute;
129
+ width: 8px;
130
+ height: 8px;
131
+ border-radius: 4px;
132
+ background-color: ${(props: any) => props.theme.colors.red};
133
+ top: 10px;
134
+ right: 10px;
135
+ z-index: 99;
136
+ `;