Merged in fix/sw-1120-pet-costs (pull request #1125)
fix(sw-1120): include pet cost in total * fix(sw-1120): include pet cost in total Approved-by: Bianca Widstam
This commit is contained in:
@@ -39,7 +39,6 @@ export default function RateSummary({
|
|||||||
priceName,
|
priceName,
|
||||||
priceTerm,
|
priceTerm,
|
||||||
} = rateSummary
|
} = rateSummary
|
||||||
const priceToShow = isUserLoggedIn && member ? member : publicRate
|
|
||||||
|
|
||||||
const isPetRoomSelected = features.some(
|
const isPetRoomSelected = features.some(
|
||||||
(feature) => feature.code === RoomPackageCodeEnum.PET_ROOM
|
(feature) => feature.code === RoomPackageCodeEnum.PET_ROOM
|
||||||
@@ -49,13 +48,38 @@ export default function RateSummary({
|
|||||||
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const petRoomLocalPrice =
|
||||||
|
isPetRoomSelected && petRoomPackage?.localPrice.totalPrice
|
||||||
|
? Number(petRoomPackage?.localPrice.totalPrice)
|
||||||
|
: 0
|
||||||
|
const petRoomRequestedPrice =
|
||||||
|
isPetRoomSelected && petRoomPackage?.requestedPrice.totalPrice
|
||||||
|
? Number(petRoomPackage?.requestedPrice.totalPrice)
|
||||||
|
: 0
|
||||||
|
|
||||||
|
const priceToShow = isUserLoggedIn && member ? member : publicRate
|
||||||
|
|
||||||
|
const totalPriceToShow = {
|
||||||
|
localPrice: {
|
||||||
|
currency: priceToShow.localPrice.currency,
|
||||||
|
price: priceToShow.localPrice.pricePerStay + petRoomLocalPrice,
|
||||||
|
},
|
||||||
|
requestedPrice: !priceToShow.requestedPrice
|
||||||
|
? undefined
|
||||||
|
: {
|
||||||
|
currency: priceToShow.requestedPrice.currency,
|
||||||
|
price:
|
||||||
|
priceToShow.requestedPrice.pricePerStay + petRoomRequestedPrice,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||||
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
|
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
|
||||||
|
|
||||||
const showMemberDiscountBanner = member && !isUserLoggedIn
|
const showMemberDiscountBanner = member && !isUserLoggedIn
|
||||||
|
|
||||||
const summaryPriceTex = `${intl.formatMessage(
|
const summaryPriceText = `${intl.formatMessage(
|
||||||
{ id: "booking.nights" },
|
{ id: "booking.nights" },
|
||||||
{ totalNights: nights }
|
{ totalNights: nights }
|
||||||
)}, ${intl.formatMessage(
|
)}, ${intl.formatMessage(
|
||||||
@@ -83,7 +107,7 @@ export default function RateSummary({
|
|||||||
<div className={styles.promoContainer}>
|
<div className={styles.promoContainer}>
|
||||||
<SignupPromoDesktop
|
<SignupPromoDesktop
|
||||||
memberPrice={{
|
memberPrice={{
|
||||||
amount: member.localPrice.pricePerStay,
|
amount: member.localPrice.pricePerStay + petRoomLocalPrice,
|
||||||
currency: member.localPrice.currency,
|
currency: member.localPrice.currency,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -96,7 +120,7 @@ export default function RateSummary({
|
|||||||
{ b: (str) => <b>{str}</b> }
|
{ b: (str) => <b>{str}</b> }
|
||||||
)}
|
)}
|
||||||
</Body>
|
</Body>
|
||||||
<Caption color="uiTextMediumContrast">{summaryPriceTex}</Caption>
|
<Caption color="uiTextMediumContrast">{summaryPriceText}</Caption>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.summaryPrice}>
|
<div className={styles.summaryPrice}>
|
||||||
<div className={styles.summaryPriceTextDesktop}>
|
<div className={styles.summaryPriceTextDesktop}>
|
||||||
@@ -106,17 +130,17 @@ export default function RateSummary({
|
|||||||
>
|
>
|
||||||
{formatPrice(
|
{formatPrice(
|
||||||
intl,
|
intl,
|
||||||
priceToShow.localPrice.pricePerStay,
|
totalPriceToShow.localPrice.price,
|
||||||
priceToShow.localPrice.currency
|
totalPriceToShow.localPrice.currency
|
||||||
)}
|
)}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
{priceToShow?.requestedPrice ? (
|
{totalPriceToShow?.requestedPrice ? (
|
||||||
<Body color="uiTextMediumContrast">
|
<Body color="uiTextMediumContrast">
|
||||||
{intl.formatMessage({ id: "Approx." })}{" "}
|
{intl.formatMessage({ id: "Approx." })}{" "}
|
||||||
{formatPrice(
|
{formatPrice(
|
||||||
intl,
|
intl,
|
||||||
priceToShow.requestedPrice.pricePerStay,
|
totalPriceToShow.requestedPrice.price,
|
||||||
priceToShow.requestedPrice.currency
|
totalPriceToShow.requestedPrice.currency
|
||||||
)}
|
)}
|
||||||
</Body>
|
</Body>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -128,36 +152,17 @@ export default function RateSummary({
|
|||||||
<Subtitle color={isUserLoggedIn ? "red" : "uiTextHighContrast"}>
|
<Subtitle color={isUserLoggedIn ? "red" : "uiTextHighContrast"}>
|
||||||
{formatPrice(
|
{formatPrice(
|
||||||
intl,
|
intl,
|
||||||
priceToShow.localPrice.pricePerStay,
|
totalPriceToShow.localPrice.price,
|
||||||
priceToShow.localPrice.currency
|
totalPriceToShow.localPrice.currency
|
||||||
)}
|
)}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Footnote
|
<Footnote
|
||||||
color="uiTextMediumContrast"
|
color="uiTextMediumContrast"
|
||||||
className={styles.summaryPriceTextMobile}
|
className={styles.summaryPriceTextMobile}
|
||||||
>
|
>
|
||||||
{summaryPriceTex}
|
{summaryPriceText}
|
||||||
</Footnote>
|
</Footnote>
|
||||||
</div>
|
</div>
|
||||||
{isPetRoomSelected && petRoomPackage?.localPrice && (
|
|
||||||
<div className={styles.petInfo}>
|
|
||||||
<Body
|
|
||||||
color="uiTextHighContrast"
|
|
||||||
textTransform="bold"
|
|
||||||
textAlign="right"
|
|
||||||
>
|
|
||||||
+{" "}
|
|
||||||
{formatPrice(
|
|
||||||
intl,
|
|
||||||
parseInt(petRoomPackage.localPrice.totalPrice),
|
|
||||||
petRoomPackage.localPrice.currency
|
|
||||||
)}
|
|
||||||
</Body>
|
|
||||||
<Body color="uiTextMediumContrast" textAlign="right">
|
|
||||||
{intl.formatMessage({ id: "Pet charge" })}
|
|
||||||
</Body>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
theme="base"
|
theme="base"
|
||||||
|
|||||||
Reference in New Issue
Block a user