feat: SW-2028 Updated Guarantee notification

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-26 17:18:34 +01:00
parent 13213efb29
commit 03deea1102
10 changed files with 72 additions and 20 deletions

View File

@@ -108,6 +108,11 @@ export default function PriceDetailsTable({
const duration = ` ${dt(fromDate).locale(lang).format("ddd, D MMM")}
-
${dt(toDate).locale(lang).format("ddd, D MMM")} (${nights})`
const noVatCurrencies = [
CurrencyEnum.CC,
CurrencyEnum.POINTS,
CurrencyEnum.Voucher,
]
return (
<table className={styles.priceDetailsTable}>
{rooms.map((room, idx) => {
@@ -133,7 +138,8 @@ export default function PriceDetailsTable({
"corporateCheque" in room.roomRate
? room.roomRate.corporateCheque
: undefined
if (!price) {
const redemptionPrice = "redemption" in room.roomRate ? room.roomRate.redemption : undefined
if (!price && !voucherPrice && !chequePrice && !redemptionPrice) {
return null
}
return (
@@ -211,6 +217,19 @@ export default function PriceDetailsTable({
)}
/>
)}
{redemptionPrice && (
<Row
bold
label={intl.formatMessage({ id: "Room charge" })}
value={formatPrice(
intl,
redemptionPrice.localPrice.pointsPerStay,
CurrencyEnum.POINTS,
redemptionPrice.localPrice.additionalPricePerStay,
redemptionPrice.localPrice.currency ?? undefined
)}
/>
)}
</TableSection>
{room.breakfast ? (
@@ -264,19 +283,25 @@ export default function PriceDetailsTable({
})}
<TableSection>
<TableSectionHeader title={intl.formatMessage({ id: "Total" })} />
{totalPrice.local.currency !== CurrencyEnum.Voucher &&
totalPrice.local.currency !== CurrencyEnum.CC ? (
<>
<Row
label={intl.formatMessage({ id: "Price excluding VAT" })}
value={formatPrice(intl, priceExclVat, totalPrice.local.currency)}
/>
<Row
label={intl.formatMessage({ id: "VAT {vat}%" }, { vat })}
value={formatPrice(intl, vatAmount, totalPrice.local.currency)}
/>
</>
) : null}
{
// @ts-expect-error Currency type is string instead of CurrencyEnum. Change also impacts packages
!noVatCurrencies.includes(totalPrice.local.currency) ? (
<>
<Row
label={intl.formatMessage({ id: "Price excluding VAT" })}
value={formatPrice(
intl,
priceExclVat,
totalPrice.local.currency
)}
/>
<Row
label={intl.formatMessage({ id: "VAT {vat}%" }, { vat })}
value={formatPrice(intl, vatAmount, totalPrice.local.currency)}
/>
</>
) : null
}
<tr className={styles.row}>
<td>
<Body textTransform="bold">
@@ -295,7 +320,7 @@ export default function PriceDetailsTable({
</Body>
</td>
</tr>
{totalPrice.local.regularPrice && (
{totalPrice.local.regularPrice ? (
<tr className={styles.row}>
<td></td>
<td className={styles.price}>
@@ -308,7 +333,7 @@ export default function PriceDetailsTable({
</Caption>
</td>
</tr>
)}
) : null}
{bookingCode && totalPrice.local.regularPrice && (
<tr className={styles.row}>
<td>