Feat/SW-1813 * feat(SW-1652): handle linkedReservations fetching * feat: add linkedReservation retry functionality * chore: align naming * feat(SW-1813): Add booking confirmation PriceDetailsModal Approved-by: Simon.Emanuelsson
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import type { BookingConfirmationRoom } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
|
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
|
import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation"
|
|
|
|
export function mapRoomState(
|
|
booking: BookingConfirmationSchema,
|
|
room: BookingConfirmationRoom
|
|
) {
|
|
const breakfast = booking.packages.find(
|
|
(pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST
|
|
)
|
|
const breakfastIncluded = booking.packages.some(
|
|
(pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST
|
|
)
|
|
|
|
return {
|
|
adults: booking.adults,
|
|
bedDescription: room.bedType.description,
|
|
breakfast,
|
|
breakfastIncluded,
|
|
children: booking.childrenAges.length,
|
|
childBedPreferences: booking.childBedPreferences,
|
|
confirmationNumber: booking.confirmationNumber,
|
|
fromDate: booking.checkInDate,
|
|
name: room.name,
|
|
rateDefinition: booking.rateDefinition,
|
|
roomFeatures: booking.packages.filter((p) => p.type === "RoomFeature"),
|
|
roomPrice: booking.roomPrice,
|
|
toDate: booking.checkOutDate,
|
|
totalPrice: booking.totalPrice,
|
|
totalPriceExVat: booking.totalPriceExVat,
|
|
vatAmount: booking.vatAmount,
|
|
}
|
|
}
|