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

@@ -64,7 +64,8 @@ export default function Steps({ closeModal }: ChangeDatesStepsProps) {
setDates({ fromDate, toDate })
const pkgsSum = sumPackages(packages)
const extraPrice = pkgsSum.price + (breakfast?.localPrice.totalPrice || 0)
const extraPrice =
pkgsSum.price + ((breakfast && breakfast.localPrice.totalPrice) || 0)
if (isLoggedIn && "member" in data.product && data.product.member) {
const { currency, pricePerStay } = data.product.member.localPrice
setNewPrice(formatPrice(intl, pricePerStay + extraPrice, currency))

View File

@@ -40,19 +40,21 @@ export function mapRoomDetails({
)
// We don't get `requestedPrice` in packages
const breakfast: Omit<BreakfastPackage, "requestedPrice"> | null =
breakfastPackageAdults
? {
code: breakfastPackageAdults.code,
description: breakfastPackageAdults.description,
localPrice: {
currency: breakfastPackageAdults.currency,
price: breakfastPackageAdults.unitPrice,
totalPrice: breakfastPackageAdults.totalPrice,
},
packageType: PackageTypeEnum.BreakfastAdult,
}
: null
let breakfast: Omit<BreakfastPackage, "requestedPrice"> | undefined | false
if (breakfastPackageAdults) {
breakfast = {
code: breakfastPackageAdults.code,
description: breakfastPackageAdults.description,
localPrice: {
currency: breakfastPackageAdults.currency,
price: breakfastPackageAdults.unitPrice,
totalPrice: breakfastPackageAdults.totalPrice,
},
packageType: PackageTypeEnum.BreakfastAdult,
}
} else if (!booking.rateDefinition.breakfastIncluded) {
breakfast = false
}
const validBreakfastPackagesChildren: string[] = [
BreakfastPackageEnum.ANCILLARY_CHILD_PAYING_BREAKFAST,
@@ -62,17 +64,17 @@ export function mapRoomDetails({
)
// We don't get `requestedPrice` in packages
const breakfastChildren: Omit<BreakfastPackage, "requestedPrice"> | null =
breakfastPackageChildren
(breakfastPackageChildren && !booking.rateDefinition.breakfastIncluded)
? {
code: breakfastPackageChildren.code,
description: breakfastPackageChildren.description,
localPrice: {
currency: breakfastPackageChildren.currency,
price: breakfastPackageChildren.unitPrice,
totalPrice: breakfastPackageChildren.totalPrice,
},
packageType: PackageTypeEnum.BreakfastChildren,
}
code: breakfastPackageChildren.code,
description: breakfastPackageChildren.description,
localPrice: {
currency: breakfastPackageChildren.currency,
price: breakfastPackageChildren.unitPrice,
totalPrice: breakfastPackageChildren.totalPrice,
},
packageType: PackageTypeEnum.BreakfastChildren,
}
: null
const isCancelled = booking.reservationStatus === BookingStatusEnum.Cancelled