Feat/SW-1652 confirmation page * feat(SW-1652): handle linkedReservations fetching * fix: add missing translations * feat: add linkedReservation retry functionality * chore: align naming Approved-by: Simon.Emanuelsson
30 lines
1.0 KiB
TypeScript
30 lines
1.0 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 selectedBreakfast = 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,
|
|
breakfastIncluded,
|
|
children: booking.childrenAges.length,
|
|
confirmationNumber: booking.confirmationNumber,
|
|
fromDate: booking.checkInDate,
|
|
name: room.name,
|
|
rateDefinition: booking.rateDefinition,
|
|
roomPrice: booking.roomPrice,
|
|
selectedBreakfast,
|
|
toDate: booking.checkOutDate,
|
|
totalPrice: booking.totalPrice,
|
|
}
|
|
}
|