feat: add no breakfast message to price details modal and to conf page receipt

This commit is contained in:
Simon Emanuelsson
2025-05-09 11:56:50 +02:00
parent 3cd8c59dd3
commit ca29237f2e
14 changed files with 389 additions and 279 deletions

View File

@@ -5,19 +5,30 @@ import type { IntlShape } from "react-intl"
import type { BookingConfirmationRoom } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
import { CurrencyEnum } from "@/types/enums/currency"
import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation"
import type {
BookingConfirmationSchema,
PackageSchema,
} from "@/types/trpc/routers/booking/confirmation"
export function mapRoomState(
booking: BookingConfirmationSchema,
room: BookingConfirmationRoom,
intl: IntlShape
) {
const breakfast = booking.packages.find(
const breakfastPackage = booking.packages.find(
(pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST
)
const breakfastIncluded = booking.packages.some(
(pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST
)
const breakfastIncluded =
booking.packages.some(
(pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST
) || booking.rateDefinition.breakfastIncluded
let breakfast: false | undefined | PackageSchema
if (breakfastPackage) {
breakfast = breakfastPackage
} else if (!breakfastIncluded) {
breakfast = false
}
let formattedRoomCost = formatPrice(
intl,