"use client" import { useIntl } from "react-intl" import { CheckIcon, InfoCircleIcon } from "@/components/Icons" import Label from "@/components/TempDesignSystem/Form/Label" import Popover from "@/components/TempDesignSystem/Popover" import Caption from "@/components/TempDesignSystem/Text/Caption" import PriceTable from "./PriceList" import styles from "./flexibilityOption.module.css" import type { FlexibilityOptionProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption" export default function FlexibilityOption({ product, name, paymentTerm, priceInformation, roomTypeCode, petRoomPackage, handleSelectRate, }: FlexibilityOptionProps) { const intl = useIntl() if (!product) { return (
{name} ({paymentTerm})
) } const { public: publicPrice, member: memberPrice } = product.productType const onClick: React.MouseEventHandler = (e) => { handleSelectRate((prev) => { if ( prev && prev.publicRateCode === publicPrice.rateCode && prev.roomTypeCode === roomTypeCode ) { if (e.currentTarget?.checked) e.currentTarget.checked = false return undefined } else return { publicRateCode: publicPrice.rateCode, roomTypeCode: roomTypeCode, name: name, paymentTerm: paymentTerm, } }) } return ( ) }