feat(SW-1259): Enter details multiroom * refactor: remove per-step URLs * WIP: map multiroom data * fix: lint errors in details page * fix: made useEnterDetailsStore tests pass * fix: WIP refactor enter details store * fix: WIP enter details store update * fix: added room index to select correct room * fix: added logic for navigating between steps and rooms * fix: update summary to work with store changes * fix: added room and total price calculation * fix: removed unused code and added test for breakfast included * refactor: move store selectors into helpers * refactor: session storage state for multiroom booking * feat: update enter details accordion navigation * fix: added room index to each form component so they select correct room * fix: added unique id to input to handle case when multiple inputs have same name * fix: update payment step with store changes * fix: rebase issues * fix: now you should only be able to go to a step if previous room is completed * refactor: cleanup * fix: if no availability just skip that room for now * fix: add select-rate Summary and adjust typings Approved-by: Arvid Norlin
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { useEnterDetailsStore } from "@/stores/enter-details"
|
|
import { selectRoom } from "@/stores/enter-details/helpers"
|
|
|
|
import { MagicWandIcon } from "@/components/Icons"
|
|
import Modal from "@/components/Modal"
|
|
import Button from "@/components/TempDesignSystem/Button"
|
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
|
import { formatPrice } from "@/utils/numberFormatting"
|
|
|
|
import styles from "./modal.module.css"
|
|
|
|
import type { Dispatch, SetStateAction } from "react"
|
|
|
|
export default function MemberPriceModal({
|
|
isOpen,
|
|
setIsOpen,
|
|
}: {
|
|
isOpen: boolean
|
|
setIsOpen: Dispatch<SetStateAction<boolean>>
|
|
}) {
|
|
const room = useEnterDetailsStore(selectRoom)
|
|
const memberRate = room.roomRate.memberRate
|
|
const intl = useIntl()
|
|
|
|
const memberPrice = memberRate?.localPrice ?? memberRate?.requestedPrice
|
|
|
|
return (
|
|
<Modal isOpen={isOpen} onToggle={setIsOpen}>
|
|
<div className={styles.modalContent}>
|
|
<div className={styles.innerModalContent}>
|
|
<MagicWandIcon width="265px" />
|
|
<Title as="h3" level="h1" textTransform="regular">
|
|
{intl.formatMessage({
|
|
id: "Member price activated",
|
|
})}
|
|
</Title>
|
|
|
|
{memberPrice && (
|
|
<span className={styles.newPrice}>
|
|
<Body>
|
|
{intl.formatMessage({
|
|
id: "The new price is",
|
|
})}
|
|
</Body>
|
|
<Subtitle type="two" color="red">
|
|
{formatPrice(
|
|
intl,
|
|
memberPrice.pricePerStay,
|
|
memberPrice.currency
|
|
)}
|
|
</Subtitle>
|
|
</span>
|
|
)}
|
|
</div>
|
|
<Button intent="primary" theme="base" onClick={() => setIsOpen(false)}>
|
|
{intl.formatMessage({ id: "OK" })}
|
|
</Button>
|
|
</div>
|
|
</Modal>
|
|
)
|
|
}
|