feat: add no breakfast message to price details modal and to conf page receipt
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user