Merged in feat/SW-1813 (pull request #1516)
Feat/SW-1813 * feat(SW-1652): handle linkedReservations fetching * feat: add linkedReservation retry functionality * chore: align naming * feat(SW-1813): Add booking confirmation PriceDetailsModal Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { CancellationRuleEnum } from "@/constants/booking"
|
||||
import { CancellationRuleEnum, ChildBedTypeEnum } from "@/constants/booking"
|
||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||
|
||||
import { CheckIcon, InfoCircleIcon } from "@/components/Icons"
|
||||
@@ -23,14 +23,23 @@ export default function ReceiptRoom({
|
||||
roomIndex,
|
||||
}: BookingConfirmationReceiptRoomProps) {
|
||||
const intl = useIntl()
|
||||
const room = useBookingConfirmationStore((state) => state.rooms[roomIndex])
|
||||
const currencyCode = useBookingConfirmationStore(
|
||||
(state) => state.currencyCode
|
||||
)
|
||||
const { room, currencyCode } = useBookingConfirmationStore((state) => ({
|
||||
room: state.rooms[roomIndex],
|
||||
currencyCode: state.currencyCode,
|
||||
}))
|
||||
|
||||
if (!room) {
|
||||
return <RoomSkeletonLoader />
|
||||
}
|
||||
|
||||
const childBedCrib = room.childBedPreferences.find(
|
||||
(c) => c.bedType === ChildBedTypeEnum.Crib
|
||||
)
|
||||
|
||||
const childBedExtraBed = room.childBedPreferences.find(
|
||||
(c) => c.bedType === ChildBedTypeEnum.ExtraBed
|
||||
)
|
||||
|
||||
return (
|
||||
<article className={styles.room}>
|
||||
<header className={styles.roomHeader}>
|
||||
@@ -99,23 +108,71 @@ export default function ReceiptRoom({
|
||||
</div>
|
||||
</Modal>
|
||||
</header>
|
||||
{room.roomFeatures
|
||||
? room.roomFeatures.map((feature) => (
|
||||
<div className={styles.entry} key={feature.code}>
|
||||
<div>
|
||||
<Body color="uiTextHighContrast">{feature.description}</Body>
|
||||
</div>
|
||||
|
||||
<Body color="uiTextHighContrast">
|
||||
{formatPrice(intl, feature.totalPrice, feature.currency)}
|
||||
</Body>
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
<div className={styles.entry}>
|
||||
<Body color="uiTextHighContrast">{room.bedDescription}</Body>
|
||||
<Body color="uiTextHighContrast">
|
||||
{formatPrice(intl, 0, currencyCode)}
|
||||
</Body>
|
||||
</div>
|
||||
{childBedCrib ? (
|
||||
<div className={styles.entry}>
|
||||
<div>
|
||||
<Body color="uiTextHighContrast">
|
||||
{intl.formatMessage(
|
||||
{ id: "Crib (child) × {count}" },
|
||||
{ count: childBedCrib.quantity }
|
||||
)}
|
||||
</Body>
|
||||
<Caption color="uiTextMediumContrast">
|
||||
{intl.formatMessage({ id: "Based on availability" })}
|
||||
</Caption>
|
||||
</div>
|
||||
<Body color="uiTextHighContrast">
|
||||
{formatPrice(intl, 0, currencyCode)}
|
||||
</Body>
|
||||
</div>
|
||||
) : null}
|
||||
{childBedExtraBed ? (
|
||||
<div className={styles.entry}>
|
||||
<div>
|
||||
<Body color="uiTextHighContrast">
|
||||
{intl.formatMessage(
|
||||
{ id: "Extra bed (child) × {count}" },
|
||||
{
|
||||
count: childBedExtraBed.quantity,
|
||||
}
|
||||
)}
|
||||
</Body>
|
||||
</div>
|
||||
<Body color="uiTextHighContrast">
|
||||
{formatPrice(intl, 0, currencyCode)}
|
||||
</Body>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.entry}>
|
||||
<Body>{intl.formatMessage({ id: "Breakfast buffet" })}</Body>
|
||||
{(room.rateDefinition.breakfastIncluded ?? room.breakfastIncluded) ? (
|
||||
<Body color="red">{intl.formatMessage({ id: "Included" })}</Body>
|
||||
) : null}
|
||||
{room.selectedBreakfast ? (
|
||||
{room.breakfast ? (
|
||||
<Body color="uiTextHighContrast">
|
||||
{formatPrice(
|
||||
intl,
|
||||
room.selectedBreakfast.totalPrice,
|
||||
room.selectedBreakfast.currency
|
||||
room.breakfast.totalPrice * room.adults,
|
||||
room.breakfast.currency
|
||||
)}
|
||||
</Body>
|
||||
) : null}
|
||||
|
||||
@@ -4,21 +4,22 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||
|
||||
import { ChevronRightSmallIcon } from "@/components/Icons"
|
||||
import SkeletonShimmer from "@/components/SkeletonShimmer"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Divider from "@/components/TempDesignSystem/Divider"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import { formatPrice } from "@/utils/numberFormatting"
|
||||
|
||||
import PriceDetailsModal from "../../PriceDetailsModal"
|
||||
|
||||
import styles from "./totalPrice.module.css"
|
||||
|
||||
export default function TotalPrice() {
|
||||
const intl = useIntl()
|
||||
const rooms = useBookingConfirmationStore((state) => state.rooms)
|
||||
const currencyCode = useBookingConfirmationStore(
|
||||
(state) => state.currencyCode
|
||||
)
|
||||
const { rooms, currencyCode } = useBookingConfirmationStore((state) => ({
|
||||
rooms: state.rooms,
|
||||
currencyCode: state.currencyCode,
|
||||
}))
|
||||
|
||||
const hasAllRoomsLoaded = rooms.every((room) => room)
|
||||
const grandTotal = rooms.reduce((acc, room) => {
|
||||
const reservationTotalPrice = room?.totalPrice || 0
|
||||
@@ -42,19 +43,7 @@ export default function TotalPrice() {
|
||||
)}
|
||||
</div>
|
||||
{hasAllRoomsLoaded ? (
|
||||
<div className={styles.entry}>
|
||||
<Button
|
||||
className={styles.btn}
|
||||
intent="text"
|
||||
size="small"
|
||||
theme="base"
|
||||
variant="icon"
|
||||
wrapping
|
||||
>
|
||||
{intl.formatMessage({ id: "Price details" })}
|
||||
<ChevronRightSmallIcon />
|
||||
</Button>
|
||||
</div>
|
||||
<PriceDetailsModal />
|
||||
) : (
|
||||
<div className={styles.priceDetailsLoader}>
|
||||
<SkeletonShimmer width={"100%"} />
|
||||
|
||||
Reference in New Issue
Block a user