"use client" import { useIntl } from "react-intl" import { dt } from "@/lib/dt" import { ArrowRightIcon, ChevronDownSmallIcon } from "@/components/Icons" import Button from "@/components/TempDesignSystem/Button" import Divider from "@/components/TempDesignSystem/Divider" import Link from "@/components/TempDesignSystem/Link" import Popover from "@/components/TempDesignSystem/Popover" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import useLang from "@/hooks/useLang" import styles from "./summary.module.css" import type { SummaryProps } from "@/types/components/hotelReservation/summary" import { CurrencyEnum } from "@/types/enums/currency" export default function Summary({ bedType, breakfast, fromDate, showMemberPrice, room, toDate, toggleSummaryOpen, totalPrice, }: SummaryProps) { const intl = useIntl() const lang = useLang() const diff = dt(toDate).diff(fromDate, "days") const nights = intl.formatMessage( { id: "booking.nights" }, { totalNights: diff } ) function handleToggleSummary() { if (toggleSummaryOpen) { toggleSummaryOpen() } } return (
{intl.formatMessage({ id: "Summary" })} {dt(fromDate).locale(lang).format("ddd, D MMM")} {dt(toDate).locale(lang).format("ddd, D MMM")} ({nights})
{room.roomType} {intl.formatMessage( { id: "{amount} {currency}" }, { amount: intl.formatNumber(room.roomPrice.local.price), currency: room.roomPrice.local.currency, } )}
{intl.formatMessage( { id: "booking.adults" }, { totalAdults: room.adults } )} {room.children?.length ? ( {intl.formatMessage( { id: "booking.children" }, { totalChildren: room.children.length } )} ) : null} {room.cancellationText} {intl.formatMessage({ id: "Rate details" })} } >
{room.packages ? room.packages.map((roomPackage) => (
{roomPackage.description}
{intl.formatMessage( { id: "{amount} {currency}" }, { amount: roomPackage.localPrice.price, currency: roomPackage.localPrice.currency, } )}
)) : null} {bedType ? (
{bedType.description} {intl.formatMessage({ id: "Based on availability" })}
{intl.formatMessage( { id: "{amount} {currency}" }, { amount: "0", currency: room.roomPrice.local.currency } )}
) : null} {breakfast === false ? (
{intl.formatMessage({ id: "No breakfast" })} {intl.formatMessage( { id: "{amount} {currency}" }, { amount: "0", currency: room.roomPrice.local.currency } )}
) : null} {breakfast ? (
{intl.formatMessage({ id: "Breakfast buffet" })} {intl.formatMessage( { id: "{amount} {currency}" }, { amount: breakfast.localPrice.totalPrice, currency: breakfast.localPrice.currency, } )}
) : null}
{intl.formatMessage( { id: "Total price (incl VAT)" }, { b: (str) => {str} } )} {intl.formatMessage({ id: "Price details" })}
{intl.formatMessage( { id: "{amount} {currency}" }, { amount: intl.formatNumber(totalPrice.local.price, { currency: totalPrice.local.currency, style: "currency", }), currency: totalPrice.local.currency, } )} {totalPrice.euro && ( {intl.formatMessage({ id: "Approx." })}{" "} {intl.formatMessage( { id: "{amount} {currency}" }, { amount: intl.formatNumber(totalPrice.euro.price, { currency: CurrencyEnum.EUR, style: "currency", }), currency: totalPrice.euro.currency, } )} )}
) }