fix: make sure calculations in booking flow are correct

This commit is contained in:
Simon Emanuelsson
2025-04-02 15:49:59 +02:00
committed by Michael Zetterberg
parent 3e0f503314
commit a222ecfc5c
28 changed files with 309 additions and 276 deletions

View File

@@ -42,13 +42,11 @@ export default function Breakfast() {
: undefined
const methods = useForm<BreakfastFormSchema>({
defaultValues: breakfastSelection
? { breakfast: breakfastSelection }
: undefined,
criteriaMode: "all",
mode: "all",
resolver: zodResolver(breakfastFormSchema),
reValidateMode: "onChange",
values: breakfastSelection ? { breakfast: breakfastSelection } : undefined,
})
const onSubmit = useCallback(

View File

@@ -28,6 +28,14 @@ import styles from "./ui.module.css"
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
import type { RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
import type { EnterDetailsSummaryProps } from "@/types/components/hotelReservation/summary"
import { CurrencyEnum } from "@/types/enums/currency"
const notDisplayableCurrencies = [
CurrencyEnum.CC,
CurrencyEnum.POINTS,
CurrencyEnum.Voucher,
CurrencyEnum.Unknown,
]
export default function SummaryUI({
booking,
@@ -81,6 +89,10 @@ export default function SummaryUI({
"redemption" in roomOneRoomRate ||
"voucher" in roomOneRoomRate
const isSameCurrency = totalPrice.requested
? totalPrice.requested.currency === totalPrice.local.currency
: false
return (
<section className={styles.summary}>
<header className={styles.header}>
@@ -160,6 +172,10 @@ export default function SummaryUI({
guestsParts.push(childrenMsg)
}
const hideBedCurrency = notDisplayableCurrencies.includes(
room.roomPrice.perStay.local.currency
)
return (
<Fragment key={idx}>
<div
@@ -262,7 +278,9 @@ export default function SummaryUI({
{formatPrice(
intl,
0,
room.roomPrice.perStay.local.currency
hideBedCurrency
? ""
: room.roomPrice.perStay.local.currency
)}
</Body>
</div>
@@ -418,7 +436,7 @@ export default function SummaryUI({
)}
</Caption>
) : null}
{totalPrice.requested && !isSpecialRate && (
{totalPrice.requested && !isSpecialRate && !isSameCurrency && (
<Caption color="uiTextMediumContrast">
{intl.formatMessage(
{ id: "Approx. {value}" },