diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/@summary/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/@summary/page.tsx index 26b166b78..c145d20b3 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/@summary/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/@summary/page.tsx @@ -37,7 +37,7 @@ export default async function SummaryPage({ return null } - const prices = user + const prices = user && availability.memberRate ? { local: { price: availability.memberRate?.localPrice.pricePerStay, @@ -61,7 +61,7 @@ export default async function SummaryPage({ return ( () const [chosenBreakfast, setChosenBreakfast] = useState< BreakfastPackage | BreakfastPackageEnum.NO_BREAKFAST >() + const [totalPrice, setTotalPrice] = useState({ + local: parseInt(room.localPrice.price ?? "0"), + euro: parseInt(room.euroPrice.price ?? "0"), + }) const intl = useIntl() const lang = useLang() const { fromDate, toDate, bedType, breakfast } = useEnterDetailsStore( @@ -51,7 +55,7 @@ export default function Summary({ ) let color: "uiTextHighContrast" | "red" = "uiTextHighContrast" - if (isMember) { + if (showMemberPrice) { color = "red" } @@ -60,8 +64,18 @@ export default function Summary({ if (breakfast) { setChosenBreakfast(breakfast) + if (breakfast !== BreakfastPackageEnum.NO_BREAKFAST) { + setTotalPrice({ + local: + parseInt(room.localPrice.price ?? "0") + + parseInt(breakfast.localPrice.price ?? "0"), + euro: + parseInt(room.euroPrice.price ?? "0") + + parseInt(breakfast.requestedPrice.price ?? "0"), + }) + } } - }, [bedType, breakfast]) + }, [bedType, breakfast, room.localPrice, room.euroPrice]) return (
@@ -178,7 +192,7 @@ export default function Summary({ {intl.formatMessage( { id: "{amount} {currency}" }, { - amount: formatNumber(parseInt(room.localPrice.price ?? "0")), + amount: formatNumber(totalPrice.local), currency: room.localPrice.currency, } )} @@ -188,7 +202,7 @@ export default function Summary({ {intl.formatMessage( { id: "{amount} {currency}" }, { - amount: formatNumber(parseInt(room.euroPrice.price ?? "0")), + amount: formatNumber(totalPrice.euro), currency: room.euroPrice.currency, } )}