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

@@ -15,8 +15,8 @@ import { useRoomContext } from "@/contexts/SelectRate/Room"
import styles from "./selectedRoomPanel.module.css"
import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate"
import { CurrencyEnum } from "@/types/enums/currency"
import { RateEnum } from "@/types/enums/rate"
export default function SelectedRoomPanel() {
const intl = useIntl()
@@ -43,13 +43,13 @@ export default function SelectedRoomPanel() {
const payLater = intl.formatMessage({ id: "Pay later" })
const payNow = intl.formatMessage({ id: "Pay now" })
function getRateTitle(rate: Rate["rate"]) {
function getRateTitle(rate: RateEnum) {
switch (rate) {
case "change":
case RateEnum.change:
return `${freeBooking}, ${payNow}`
case "flex":
case RateEnum.flex:
return `${freeCancelation}, ${payLater}`
case "save":
case RateEnum.save:
default:
return `${nonRefundable}, ${payNow}`
}