import { notFound } from "next/navigation" import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests" import { ChevronRightSmallIcon, InfoCircleIcon } from "@/components/Icons" import Button from "@/components/TempDesignSystem/Button" import Divider from "@/components/TempDesignSystem/Divider" import Link from "@/components/TempDesignSystem/Link" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { getIntl } from "@/i18n" import { getBookedHotelRoom } from "@/utils/getBookedHotelRoom" import styles from "./receipt.module.css" import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" import { BreakfastPackageEnum } from "@/types/enums/breakfast" export default async function Receipt({ confirmationNumber, }: BookingConfirmationProps) { const intl = await getIntl() const { booking, hotel } = await getBookingConfirmation(confirmationNumber) const roomAndBed = getBookedHotelRoom(hotel, booking.roomTypeCode ?? "") if (!roomAndBed) { return notFound() } const breakfastPkgSelected = booking.packages.find( (pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST ) const breakfastPkgIncluded = booking.packages.find( (pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST ) return (
{intl.formatMessage({ id: "Summary" })}
{roomAndBed.name} {booking.rateDefinition.isMemberRate ? (
N/A {intl.formatNumber(booking.roomPrice, { currency: booking.currencyCode, style: "currency", })}
) : ( {intl.formatNumber(booking.roomPrice, { currency: booking.currencyCode, style: "currency", })} )} {intl.formatMessage( { id: "booking.adults" }, { totalAdults: booking.adults, } )} {booking.rateDefinition.cancellationText} {intl.formatMessage({ id: "Reservation policy" })}
{roomAndBed.bedType.description} {intl.formatNumber(0, { currency: booking.currencyCode, style: "currency", })}
{intl.formatMessage({ id: "Breakfast buffet" })} {booking.rateDefinition.breakfastIncluded ?? breakfastPkgIncluded ? ( {intl.formatMessage({ id: "Included" })} ) : null} {breakfastPkgSelected ? ( {intl.formatNumber(breakfastPkgSelected.totalPrice, { currency: breakfastPkgSelected.currency, style: "currency", })} ) : null}
{intl.formatMessage({ id: "Total price" })} {intl.formatNumber(booking.totalPrice, { currency: booking.currencyCode, style: "currency", })}
{intl.formatMessage({ id: "Approx." })} N/A EUR
) }