feat: add no breakfast message to price details modal and to conf page receipt
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
} from "@/server/routers/hotels/schemas/packages"
|
||||
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
||||
import { PackageTypeEnum } from "@/types/enums/packages"
|
||||
import type { Package } from "@/types/requests/packages"
|
||||
@@ -47,24 +48,37 @@ export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
}
|
||||
}
|
||||
|
||||
const breakfastPackage = breakfastPackageSchema.safeParse({
|
||||
code: room.breakfast?.code,
|
||||
description: room.breakfast?.description,
|
||||
localPrice: {
|
||||
currency: room.breakfast?.currency,
|
||||
price: room.breakfast?.unitPrice,
|
||||
totalPrice: room.breakfast?.totalPrice,
|
||||
},
|
||||
packageType:
|
||||
room.breakfast?.code === BreakfastPackageEnum.REGULAR_BREAKFAST
|
||||
? PackageTypeEnum.BreakfastAdult
|
||||
: "",
|
||||
requestedPrice: {
|
||||
currency: room.breakfast?.currency,
|
||||
price: room.breakfast?.unitPrice,
|
||||
totalPrice: room.breakfast?.totalPrice,
|
||||
},
|
||||
})
|
||||
let breakfast:
|
||||
| false
|
||||
| undefined
|
||||
| Omit<BreakfastPackage, "requestedPrice">
|
||||
if (room.breakfast) {
|
||||
const breakfastPackage = breakfastPackageSchema.safeParse({
|
||||
code: room.breakfast?.code,
|
||||
description: room.breakfast?.description,
|
||||
localPrice: {
|
||||
currency: room.breakfast?.currency,
|
||||
price: room.breakfast?.unitPrice,
|
||||
totalPrice: room.breakfast?.totalPrice,
|
||||
},
|
||||
packageType:
|
||||
room.breakfast?.code === BreakfastPackageEnum.REGULAR_BREAKFAST
|
||||
? PackageTypeEnum.BreakfastAdult
|
||||
: "",
|
||||
requestedPrice: {
|
||||
currency: room.breakfast?.currency,
|
||||
price: room.breakfast?.unitPrice,
|
||||
totalPrice: room.breakfast?.totalPrice,
|
||||
},
|
||||
})
|
||||
if (breakfastPackage.success) {
|
||||
breakfast = breakfastPackage.data
|
||||
}
|
||||
}
|
||||
|
||||
if (!room.breakfastIncluded && !breakfast) {
|
||||
breakfast = false
|
||||
}
|
||||
|
||||
const packages = room.roomFeatures
|
||||
?.map((featPkg) => {
|
||||
@@ -97,7 +111,7 @@ export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
description: room.bedDescription,
|
||||
roomTypeCode: room.roomTypeCode || "",
|
||||
},
|
||||
breakfast: breakfastPackage.success ? breakfastPackage.data : undefined,
|
||||
breakfast,
|
||||
breakfastIncluded: room.rateDefinition.breakfastIncluded,
|
||||
childrenInRoom: room.childrenAges?.map((age) => ({
|
||||
age,
|
||||
|
||||
Reference in New Issue
Block a user