import { profile } from "@/constants/routes/myPages" import { dt } from "@/lib/dt" import { getBookingConfirmation, getProfileSafely, } from "@/lib/trpc/memoizedRequests" import { CreditCardAddIcon, EditIcon, PersonIcon } from "@/components/Icons" 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 { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import styles from "./summary.module.css" import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" import { BreakfastPackageEnum } from "@/types/enums/breakfast" export default async function Summary({ confirmationNumber, }: BookingConfirmationProps) { const intl = await getIntl() const lang = getLang() const { booking, hotel } = await getBookingConfirmation(confirmationNumber) const user = await getProfileSafely() const { firstName, lastName } = booking.guest const membershipNumber = user?.membership?.membershipNumber const totalNights = dt(booking.checkOutDate.setHours(0, 0, 0)).diff( dt(booking.checkInDate.setHours(0, 0, 0)), "days" ) const breakfastPackage = booking.packages.find( (pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST ) return (
{intl.formatMessage({ id: "Guest" })} {`${firstName} ${lastName}`} {membershipNumber ? ( {intl.formatMessage( { id: "membership.no" }, { membershipNumber } )} ) : null} {booking.guest.email} {booking.guest.phoneNumber}
{user ? ( {intl.formatMessage({ id: "Go to profile" })} ) : null}
{intl.formatMessage({ id: "Payment" })} {intl.formatMessage( { id: "guest.paid" }, { amount: intl.formatNumber(booking.totalPrice), currency: booking.currencyCode, } )} Date information N/A Card information N/A
{/* # href until more info */} {user ? ( {intl.formatMessage({ id: "Save card to profile" })} ) : null}
{intl.formatMessage({ id: "Booking" })} N/A, {intl.formatMessage({ id: "booking.nights" }, { totalNights })} ,{" "} {intl.formatMessage( { id: "booking.adults" }, { totalAdults: booking.adults } )} {breakfastPackage ? ( {intl.formatMessage({ id: "Breakfast added" })} ) : null} Bedtype N/A
{/* # href until more info */} {intl.formatMessage({ id: "Manage booking" })}
{intl.formatMessage({ id: "Hotel" })} {hotel.name} {`${hotel.address.streetAddress}, ${hotel.address.zipCode} ${hotel.address.city}`} {hotel.contactInformation.phoneNumber} {`${intl.formatMessage({ id: "Longitude" }, { long: hotel.location.longitude })} ∙ ${intl.formatMessage({ id: "Latitude" }, { lat: hotel.location.latitude })}`}
{hotel.contactInformation.websiteUrl} {hotel.contactInformation.email}
) }