diff --git a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/desktop.module.css b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/desktop.module.css
index 306a09436..7746d8f5d 100644
--- a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/desktop.module.css
+++ b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/desktop.module.css
@@ -106,7 +106,7 @@
text-decoration: none;
}
-@media (min-width: 1366px) {
+@media (min-width: 1367px) {
.desktop {
display: block;
}
diff --git a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/mobile.module.css b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/mobile.module.css
index bbc65f86a..fd743c304 100644
--- a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/mobile.module.css
+++ b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/mobile.module.css
@@ -67,7 +67,7 @@
text-decoration: none;
}
-@media (min-width: 1366px) {
+@media (min-width: 1367px) {
.mobile {
display: none;
}
diff --git a/apps/scandic-web/components/DatePicker/Screen/Desktop.tsx b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx
similarity index 81%
rename from apps/scandic-web/components/DatePicker/Screen/Desktop.tsx
rename to apps/scandic-web/components/DatePicker/Range/Desktop.tsx
index c2c8550f1..c6c71cf1a 100644
--- a/apps/scandic-web/components/DatePicker/Screen/Desktop.tsx
+++ b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx
@@ -17,14 +17,14 @@ import useLang from "@/hooks/useLang"
import styles from "./desktop.module.css"
import classNames from "react-day-picker/style.module.css"
-import type { DatePickerProps } from "@/types/components/datepicker"
+import type { DatePickerRangeProps } from "@/types/components/datepicker"
-export default function DatePickerDesktop({
+export default function DatePickerRangeDesktop({
close,
handleOnSelect,
locales,
selectedDate,
-}: DatePickerProps) {
+}: DatePickerRangeProps) {
const lang = useLang()
const intl = useIntl()
const [month, setMonth] = useState(new Date())
@@ -58,6 +58,9 @@ export default function DatePickerDesktop({
root: `${classNames.root} ${styles.container}`,
week: styles.week,
weekday: `${classNames.weekday} ${styles.weekDay}`,
+ nav: `${classNames.nav} ${styles.nav}`,
+ button_next: `${classNames.button_next} ${styles.button_next}`,
+ button_previous: `${classNames.button_previous} ${styles.button_previous}`,
}}
disabled={[
{ from: startOfMonth, to: yesterday },
@@ -120,29 +123,6 @@ export default function DatePickerDesktop({
)
},
- Nav(props) {
- if (Array.isArray(props.children)) {
- const prevButton = props.children?.[0]
- const nextButton = props.children?.[1]
- return (
- <>
- {prevButton ? (
-
- ) : null}
- {nextButton ? (
-
- ) : null}
- >
- )
- }
- return <>>
- },
}}
/>
)
diff --git a/apps/scandic-web/components/DatePicker/Screen/Mobile.tsx b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx
similarity index 95%
rename from apps/scandic-web/components/DatePicker/Screen/Mobile.tsx
rename to apps/scandic-web/components/DatePicker/Range/Mobile.tsx
index 8494f5c0f..d0150583d 100644
--- a/apps/scandic-web/components/DatePicker/Screen/Mobile.tsx
+++ b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx
@@ -14,14 +14,14 @@ import useLang from "@/hooks/useLang"
import styles from "./mobile.module.css"
import classNames from "react-day-picker/style.module.css"
-import type { DatePickerProps } from "@/types/components/datepicker"
+import type { DatePickerRangeProps } from "@/types/components/datepicker"
-export default function DatePickerMobile({
+export default function DatePickerRangeMobile({
close,
handleOnSelect,
locales,
selectedDate,
-}: DatePickerProps) {
+}: DatePickerRangeProps) {
const lang = useLang()
const intl = useIntl()
diff --git a/apps/scandic-web/components/DatePicker/Screen/desktop.module.css b/apps/scandic-web/components/DatePicker/Range/desktop.module.css
similarity index 93%
rename from apps/scandic-web/components/DatePicker/Screen/desktop.module.css
rename to apps/scandic-web/components/DatePicker/Range/desktop.module.css
index aa02537a5..68db4780f 100644
--- a/apps/scandic-web/components/DatePicker/Screen/desktop.module.css
+++ b/apps/scandic-web/components/DatePicker/Range/desktop.module.css
@@ -111,11 +111,18 @@ td.day[data-outside="true"] ~ td.day[data-disabled="true"] button.dayButton,
margin-top: var(--Spacing-x2);
}
-.nextButton {
- transform: rotate(180deg);
- right: 0;
+.nav {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
}
-.previousButton {
- left: 0;
+.nav .button_next {
+ transform: rotate(180deg);
+ margin-left: auto;
+}
+
+.nav .button_previous:disabled,
+.nav .button_next:disabled {
+ display: none;
}
diff --git a/apps/scandic-web/components/DatePicker/Screen/mobile.module.css b/apps/scandic-web/components/DatePicker/Range/mobile.module.css
similarity index 97%
rename from apps/scandic-web/components/DatePicker/Screen/mobile.module.css
rename to apps/scandic-web/components/DatePicker/Range/mobile.module.css
index d26ed3423..0fc095da0 100644
--- a/apps/scandic-web/components/DatePicker/Screen/mobile.module.css
+++ b/apps/scandic-web/components/DatePicker/Range/mobile.module.css
@@ -10,6 +10,11 @@
position: relative;
}
+.container.noHeader {
+ grid-template-areas: "content";
+ grid-template-rows: auto;
+}
+
.root {
display: grid;
grid-area: content;
@@ -130,10 +135,6 @@ td.day[data-today="true"] {
width: 40px;
}
-td.day button.dayButton:hover {
- background: var(--Base-Surface-Secondary-light-Hover);
-}
-
td.day[data-outside="true"] button.dayButton {
border: none;
}
diff --git a/apps/scandic-web/components/DatePicker/Single/Desktop.tsx b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx
new file mode 100644
index 000000000..09e1aa16d
--- /dev/null
+++ b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx
@@ -0,0 +1,130 @@
+"use client"
+
+import { useState } from "react"
+import { DayPicker } from "react-day-picker"
+import { useIntl } from "react-intl"
+
+import { Lang } from "@/constants/languages"
+import { dt } from "@/lib/dt"
+
+import { ChevronLeftIcon } from "@/components/Icons"
+import Button from "@/components/TempDesignSystem/Button"
+import Divider from "@/components/TempDesignSystem/Divider"
+import Caption from "@/components/TempDesignSystem/Text/Caption"
+import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
+import useLang from "@/hooks/useLang"
+
+import styles from "./desktop.module.css"
+import classNames from "react-day-picker/style.module.css"
+
+import type { DatePickerSingleProps } from "@/types/components/datepicker"
+
+export default function DatePickerSingleDesktop({
+ close,
+ handleOnSelect,
+ locales,
+ selectedDate,
+ startMonth,
+}: DatePickerSingleProps) {
+ const lang = useLang()
+ const intl = useIntl()
+ const [month, setMonth] = useState(() => startMonth ?? new Date())
+
+ /** English is default language and doesn't need to be imported */
+ const locale = lang === Lang.en ? undefined : locales[lang]
+ const currentDate = dt().toDate()
+ const startOfMonth = dt(currentDate).set("date", 1).toDate()
+ const yesterday = dt(currentDate).subtract(1, "day").toDate()
+
+ // Max future date allowed to book kept same as of existing prod.
+ const endDate = dt().add(395, "day").toDate()
+ const endOfLastMonth = dt(endDate).endOf("month").toDate()
+
+ function handleMonthChange(selected: Date) {
+ setMonth(selected)
+ }
+
+ return (
+
+ )
+ },
+ Footer(props) {
+ return (
+ <>
+
+
+ >
+ )
+ },
+ MonthCaption(props) {
+ return (
+
+
+ {props.children}
+
+
+ )
+ },
+ }}
+ />
+ )
+}
diff --git a/apps/scandic-web/components/DatePicker/Single/Mobile.tsx b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx
new file mode 100644
index 000000000..15335e949
--- /dev/null
+++ b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx
@@ -0,0 +1,107 @@
+"use client"
+import { DayPicker } from "react-day-picker"
+import { useIntl } from "react-intl"
+
+import { Lang } from "@/constants/languages"
+import { dt } from "@/lib/dt"
+
+import { CloseLargeIcon } from "@/components/Icons"
+import Button from "@/components/TempDesignSystem/Button"
+import Body from "@/components/TempDesignSystem/Text/Body"
+import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
+import useLang from "@/hooks/useLang"
+
+import styles from "./mobile.module.css"
+import classNames from "react-day-picker/style.module.css"
+
+import type { DatePickerSingleProps } from "@/types/components/datepicker"
+
+export default function DatePickerSingleMobile({
+ close,
+ handleOnSelect,
+ locales,
+ selectedDate,
+ hideHeader,
+}: DatePickerSingleProps) {
+ const lang = useLang()
+ const intl = useIntl()
+
+ /** English is default language and doesn't need to be imported */
+ const locale = lang === Lang.en ? undefined : locales[lang]
+ const currentDate = dt().toDate()
+ const startOfCurrentMonth = dt(currentDate).set("date", 1).toDate()
+ const yesterday = dt(currentDate).subtract(1, "day").toDate()
+
+ // Max future date allowed to book kept same as of existing prod.
+ const endDate = dt().add(395, "day").toDate()
+ const endOfLastMonth = dt(endDate).endOf("month").toDate()
+
+ return (
+
+
+
+
+ {props.children}
+
+
+ )
+ },
+ }}
+ />
+
+
+ )
+}
diff --git a/apps/scandic-web/components/DatePicker/Single/desktop.module.css b/apps/scandic-web/components/DatePicker/Single/desktop.module.css
new file mode 100644
index 000000000..6e3d65f0f
--- /dev/null
+++ b/apps/scandic-web/components/DatePicker/Single/desktop.module.css
@@ -0,0 +1,127 @@
+@media screen and (max-width: 1366px) {
+ .container {
+ display: none;
+ }
+}
+
+div.months {
+ flex-wrap: nowrap;
+}
+
+.monthCaption {
+ justify-content: center;
+}
+
+.captionLabel {
+ text-transform: capitalize;
+}
+
+td.day,
+td.rangeEnd,
+td.rangeStart {
+ font-family: var(--typography-Body-Bold-fontFamily);
+ font-size: var(--typography-Body-Bold-fontSize);
+ font-weight: 500;
+ letter-spacing: var(--typography-Body-Bold-letterSpacing);
+ line-height: var(--typography-Body-Bold-lineHeight);
+ text-decoration: var(--typography-Body-Bold-textDecoration);
+}
+
+td.rangeEnd,
+td.rangeStart {
+ background: var(--Base-Background-Primary-Normal);
+}
+
+td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) {
+ border-radius: 0 50% 50% 0;
+}
+
+td.rangeStart[aria-selected="true"] {
+ border-radius: 50% 0 0 50%;
+}
+
+td.rangeEnd[aria-selected="true"] button.dayButton:hover,
+td.rangeStart[aria-selected="true"] button.dayButton:hover {
+ background: var(--Primary-Light-On-Surface-Accent);
+ border-radius: 50%;
+}
+
+td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
+td.rangeStart[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
+td.day[aria-selected="true"] button.dayButton {
+ background: var(--Primary-Light-On-Surface-Accent);
+ border: none;
+ color: var(--Base-Button-Inverted-Fill-Normal);
+}
+
+td.day,
+td.day[data-today="true"] {
+ color: var(--UI-Text-High-contrast);
+ height: 40px;
+ padding: var(--Spacing-x-half);
+ width: 40px;
+}
+
+td.day button.dayButton:hover {
+ background: var(--Base-Surface-Secondary-light-Hover);
+}
+
+td.day[data-outside="true"] button.dayButton {
+ border: none;
+}
+
+td.rangeMiddle[aria-selected="true"] button.dayButton {
+ background: var(--Base-Background-Primary-Normal);
+ border: none;
+ border-radius: 0;
+ color: var(--UI-Text-High-contrast);
+}
+
+td.day[data-disabled="true"],
+td.day[data-disabled="true"] button.dayButton,
+td.day[data-outside="true"] ~ td.day[data-disabled="true"],
+td.day[data-outside="true"] ~ td.day[data-disabled="true"] button.dayButton,
+.week:has(td.day[data-outside="true"] ~ td.day[data-disabled="true"])
+ td.day[data-outside="true"]
+ button.dayButton {
+ background: none;
+ color: var(--Base-Text-Disabled);
+ cursor: not-allowed;
+}
+
+.weekDay {
+ color: var(--UI-Text-Placeholder);
+ font-family: var(--typography-Footnote-Labels-fontFamily);
+ font-size: var(--typography-Footnote-Labels-fontSize);
+ font-weight: var(--typography-Footnote-Labels-fontWeight);
+ letter-spacing: var(--typography-Footnote-Labels-letterSpacing);
+ line-height: var(--typography-Footnote-Labels-lineHeight);
+ text-decoration: var(--typography-Footnote-Labels-textDecoration);
+ text-transform: uppercase;
+}
+
+.footer {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: var(--Spacing-x2);
+}
+
+.divider {
+ margin-top: var(--Spacing-x2);
+}
+
+.nav {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+}
+
+.nav .button_next {
+ transform: rotate(180deg);
+ margin-left: auto;
+}
+
+.nav .button_previous:disabled,
+.nav .button_next:disabled {
+ display: none;
+}
diff --git a/apps/scandic-web/components/DatePicker/Single/mobile.module.css b/apps/scandic-web/components/DatePicker/Single/mobile.module.css
new file mode 100644
index 000000000..fa4b6cf55
--- /dev/null
+++ b/apps/scandic-web/components/DatePicker/Single/mobile.module.css
@@ -0,0 +1,176 @@
+.container {
+ --header-height: 72px;
+ --sticky-button-height: 120px;
+
+ display: grid;
+ grid-template-areas:
+ "header"
+ "content";
+ grid-template-rows: var(--header-height) calc(100dvh - var(--header-height));
+ position: relative;
+}
+
+.container.noHeader {
+ grid-template-areas: "content";
+ grid-template-rows: auto;
+}
+
+.root {
+ display: grid;
+ grid-area: content;
+}
+
+.header {
+ align-self: flex-end;
+ background-color: var(--Main-Grey-White);
+ grid-area: header;
+ padding: var(--Spacing-x3) var(--Spacing-x2);
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.select {
+ justify-self: center;
+ min-width: 100px;
+ transform: translateX(24px);
+}
+
+.close {
+ align-items: center;
+ background: none;
+ border: none;
+ cursor: pointer;
+ display: flex;
+ justify-self: flex-end;
+}
+
+div.months {
+ display: grid;
+ overflow-y: scroll;
+ scroll-snap-type: y mandatory;
+}
+
+.month {
+ display: grid;
+ justify-items: center;
+ scroll-snap-align: start;
+}
+
+.month:last-of-type {
+ padding-bottom: var(--sticky-button-height);
+}
+
+.monthCaption {
+ justify-content: center;
+}
+
+.captionLabel {
+ text-transform: capitalize;
+}
+
+.footer {
+ align-self: flex-start;
+ background: linear-gradient(
+ 180deg,
+ rgba(255, 255, 255, 0) 7.5%,
+ #ffffff 82.5%
+ );
+ display: flex;
+ grid-area: content;
+ padding: var(--Spacing-x1) var(--Spacing-x2) var(--Spacing-x7);
+ position: sticky;
+ top: calc(100vh - var(--sticky-button-height));
+ width: 100%;
+ z-index: 10;
+}
+
+.footer .button {
+ width: 100%;
+}
+
+td.day,
+td.rangeEnd,
+td.rangeStart {
+ font-family: var(--typography-Body-Bold-fontFamily);
+ font-size: var(--typography-Body-Bold-fontSize);
+ font-weight: 500;
+ letter-spacing: var(--typography-Body-Bold-letterSpacing);
+ line-height: var(--typography-Body-Bold-lineHeight);
+ text-decoration: var(--typography-Body-Bold-textDecoration);
+}
+
+td.rangeEnd,
+td.rangeStart {
+ background: var(--Base-Background-Primary-Normal);
+}
+
+td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) {
+ border-radius: 0 50% 50% 0;
+}
+
+td.rangeStart[aria-selected="true"] {
+ border-radius: 50% 0 0 50%;
+}
+
+td.rangeEnd[aria-selected="true"] button.dayButton:hover,
+td.rangeStart[aria-selected="true"] button.dayButton:hover {
+ background: var(--Primary-Light-On-Surface-Accent);
+ border-radius: 50%;
+}
+
+td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
+td.rangeStart[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
+td.day[aria-selected="true"] button.dayButton {
+ background: var(--Primary-Light-On-Surface-Accent);
+ border: none;
+ color: var(--Base-Button-Inverted-Fill-Normal);
+}
+
+td.day,
+td.day[data-today="true"] {
+ color: var(--UI-Text-High-contrast);
+ height: 40px;
+ padding: var(--Spacing-x-half);
+ width: 40px;
+}
+
+td.day[data-outside="true"] button.dayButton {
+ border: none;
+}
+
+td.rangeMiddle[aria-selected="true"] button.dayButton {
+ background: var(--Base-Background-Primary-Normal);
+ border: none;
+ border-radius: 0;
+ color: var(--UI-Text-High-contrast);
+}
+
+td.day[data-disabled="true"],
+td.day[data-disabled="true"] button.dayButton,
+td.day[data-outside="true"] ~ td.day[data-disabled="true"],
+td.day[data-outside="true"] ~ td.day[data-disabled="true"] button.dayButton,
+.week:has(td.day[data-outside="true"] ~ td.day[data-disabled="true"])
+ td.day[data-outside="true"]
+ button.dayButton {
+ background: none;
+ color: var(--Base-Text-Disabled);
+ cursor: not-allowed;
+}
+
+.weekDay {
+ color: var(--UI-Text-Placeholder);
+ font-family: var(--typography-Caption-Labels-fontFamily);
+ font-size: var(--typography-Caption-Labels-fontSize);
+ font-weight: var(--typography-Caption-Labels-fontWeight);
+ letter-spacing: var(--typography-Caption-Labels-letterSpacing);
+ line-height: var(--typography-Caption-Labels-lineHeight);
+ text-decoration: var(--typography-Caption-Labels-textDecoration);
+ text-transform: uppercase;
+}
+
+@media screen and (min-width: 1367px) {
+ .container {
+ display: none;
+ }
+}
diff --git a/apps/scandic-web/components/DatePicker/index.tsx b/apps/scandic-web/components/DatePicker/index.tsx
index d0d417cb1..e39e55fc9 100644
--- a/apps/scandic-web/components/DatePicker/index.tsx
+++ b/apps/scandic-web/components/DatePicker/index.tsx
@@ -11,8 +11,8 @@ import { dt } from "@/lib/dt"
import Body from "@/components/TempDesignSystem/Text/Body"
import useLang from "@/hooks/useLang"
-import DatePickerDesktop from "./Screen/Desktop"
-import DatePickerMobile from "./Screen/Mobile"
+import DatePickerRangeDesktop from "./Range/Desktop"
+import DatePickerRangeMobile from "./Range/Mobile"
import styles from "./date-picker.module.css"
@@ -148,7 +148,7 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
-
-
{
// Add price information
- addRoomPrice({
- id: booking.confirmationNumber ?? "",
+ setRoomPrice({
+ id: booking.confirmationNumber,
totalPrice: booking.totalPrice,
currencyCode: booking.currencyCode,
isMainBooking: true,
})
// Add room details
- addRoomDetails({
- id: booking.confirmationNumber ?? "",
+ setRoomDetails({
+ id: booking.confirmationNumber,
+ hotelId: booking.hotelId,
+ checkInDate: booking.checkInDate,
+ checkOutDate: booking.checkOutDate,
+ adults: booking.adults,
+ children: childrenAsString,
roomName: room?.name ?? booking.roomTypeCode ?? "",
+ roomTypeCode: booking.roomTypeCode ?? "",
+ rateCode: booking.rateDefinition.rateCode ?? "",
+ bookingCode: booking.bookingCode ?? "",
isCancelable: booking.isCancelable,
+ mainRoom: booking.mainRoom,
})
- }, [booking, room, addRoomPrice, addRoomDetails])
+ }, [booking, room, childrenAsString, setRoomPrice, setRoomDetails])
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}`
const isPaid =
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Pricecontainer/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Pricecontainer/index.tsx
deleted file mode 100644
index c4e554039..000000000
--- a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Pricecontainer/index.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { useFormContext } from "react-hook-form"
-import { useIntl } from "react-intl"
-
-import Caption from "@/components/TempDesignSystem/Text/Caption"
-import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
-
-import { getCheckedRoomsCounts } from "../utils"
-
-import styles from "../cancelStay.module.css"
-
-import type {
- FormValues,
- PriceContainerProps,
-} from "@/types/components/hotelReservation/myStay/cancelStay"
-
-export default function PriceContainer({
- booking,
- stayDetails,
-}: PriceContainerProps) {
- const intl = useIntl()
- const { getValues } = useFormContext()
-
- const checkedRoomsDetails = getCheckedRoomsCounts(booking, getValues, intl)
-
- return (
-
-
-
- {intl.formatMessage({ id: "Cancellation cost" })}
-
-
- {stayDetails.nightsText}, {checkedRoomsDetails.adultsText}
- {checkedRoomsDetails.totalChildren > 0
- ? `, ${checkedRoomsDetails.childrenText}`
- : ""}
-
-
-
-
- 0 {booking.currencyCode}
-
-
-
- )
-}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/LinkedReservation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/LinkedReservation/index.tsx
index 56e3e8d6a..b798f32bc 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/LinkedReservation/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/LinkedReservation/index.tsx
@@ -10,6 +10,7 @@ import useLang from "@/hooks/useLang"
import { useMyStayRoomDetailsStore } from "../stores/myStayRoomDetailsStore"
import { useMyStayTotalPriceStore } from "../stores/myStayTotalPrice"
+import { formatChildBedPreferences } from "../utils"
import styles from "./linkedReservation.module.css"
@@ -27,29 +28,47 @@ export default function LinkedReservation({
const intl = useIntl()
const lang = useLang()
- const { addRoomPrice } = useMyStayTotalPriceStore()
- const { addRoomDetails } = useMyStayRoomDetailsStore()
+ const {
+ actions: { setRoomPrice },
+ } = useMyStayTotalPriceStore()
+ const {
+ actions: { setRoomDetails },
+ } = useMyStayRoomDetailsStore()
const bookingConfirmation = use(bookingPromise)
const { booking, room } = bookingConfirmation ?? {}
useEffect(() => {
if (booking) {
- addRoomPrice({
- id: booking.confirmationNumber ?? "",
+ const childrenAsString = formatChildBedPreferences({
+ childrenAges: booking.childrenAges ?? [],
+ childBedPreferences: booking.childBedPreferences ?? [],
+ })
+
+ setRoomPrice({
+ id: booking.confirmationNumber,
totalPrice: booking.totalPrice,
currencyCode: booking.currencyCode,
isMainBooking: false,
})
- // Add room details to the store
- addRoomDetails({
- id: booking.confirmationNumber ?? "",
+ // Add room details for linked reservation to the store
+ setRoomDetails({
+ id: booking.confirmationNumber,
+ hotelId: booking.hotelId,
+ checkInDate: booking.checkInDate,
+ checkOutDate: booking.checkOutDate,
+ adults: booking.adults,
+ children: childrenAsString,
roomName: room?.name ?? booking.roomTypeCode ?? "",
+ roomTypeCode: booking.roomTypeCode ?? "",
+ rateCode: booking.rateDefinition.rateCode ?? "",
+ bookingCode: booking.bookingCode ?? "",
isCancelable: booking.isCancelable,
+ mainRoom: booking.mainRoom,
})
}
- }, [booking, room, addRoomPrice, addRoomDetails])
+ }, [booking, room, setRoomPrice, setRoomDetails])
if (!booking) return null
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/CancelStayPriceContainer/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/CancelStayPriceContainer/index.tsx
new file mode 100644
index 000000000..7ff1e1be5
--- /dev/null
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/CancelStayPriceContainer/index.tsx
@@ -0,0 +1,27 @@
+import { useIntl } from "react-intl"
+
+import PriceContainer from "../../../PriceContainer"
+import { useCheckedRoomsCounts } from "../utils"
+
+import type { PriceContainerProps } from "@/types/components/hotelReservation/myStay/cancelStay"
+
+export default function CancelStayPriceContainer({
+ booking,
+ stayDetails,
+}: PriceContainerProps) {
+ const intl = useIntl()
+
+ const checkedRoomsDetails = useCheckedRoomsCounts(booking, intl)
+
+ return (
+
+ )
+}
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Confirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/Confirmation/index.tsx
similarity index 89%
rename from apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Confirmation/index.tsx
rename to apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/Confirmation/index.tsx
index a5fe0c871..2df864c20 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/Confirmation/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/Confirmation/index.tsx
@@ -3,18 +3,18 @@
import { useFormContext } from "react-hook-form"
import { useIntl } from "react-intl"
+import { useMyStayRoomDetailsStore } from "@/components/HotelReservation/MyStay/stores/myStayRoomDetailsStore"
import Checkbox from "@/components/TempDesignSystem/Form/Checkbox"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
-import { useMyStayRoomDetailsStore } from "../../stores/myStayRoomDetailsStore"
-import PriceContainer from "../Pricecontainer"
+import CancelStayPriceContainer from "../CancelStayPriceContainer"
import styles from "../cancelStay.module.css"
import type {
CancelStayConfirmationProps,
- FormValues,
+ CancelStayFormValues,
} from "@/types/components/hotelReservation/myStay/cancelStay"
export function CancelStayConfirmation({
@@ -23,7 +23,7 @@ export function CancelStayConfirmation({
stayDetails,
}: CancelStayConfirmationProps) {
const intl = useIntl()
- const { getValues } = useFormContext()
+ const { getValues } = useFormContext()
const { rooms: roomDetails } = useMyStayRoomDetailsStore()
return (
@@ -91,7 +91,7 @@ export function CancelStayConfirmation({
>
)}
{getValues("rooms").some((room) => room.checked) && (
-
+
)}
>
)
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/FinalConfirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/FinalConfirmation/index.tsx
similarity index 81%
rename from apps/scandic-web/components/HotelReservation/MyStay/CancelStay/FinalConfirmation/index.tsx
rename to apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/FinalConfirmation/index.tsx
index 95d7e08ea..a139b405f 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/CancelStay/FinalConfirmation/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/ManageStay/ActionPanel/Actions/CancelStay/FinalConfirmation/index.tsx
@@ -2,7 +2,7 @@ import { useIntl } from "react-intl"
import Body from "@/components/TempDesignSystem/Text/Body"
-import PriceContainer from "../Pricecontainer"
+import CancelStayPriceContainer from "../CancelStayPriceContainer"
import styles from "../cancelStay.module.css"
@@ -23,7 +23,7 @@ export function FinalConfirmation({
})}