Merged in feat/SW-1589-implement-booking-code-enter (pull request #1368)
Feat/SW-1589 implement booking code enter * feat: SW-1589 Booking code rate implementation * feat: SW-1589 Optimized price display * feat: SW-1589 Display standard price * feat: SW-1589 Fixed rate title issue Approved-by: Niclas Edenvin
This commit is contained in:
@@ -90,6 +90,7 @@ export default async function DetailsPage({
|
|||||||
cancellationText: roomAvailability.cancellationText,
|
cancellationText: roomAvailability.cancellationText,
|
||||||
mustBeGuaranteed: roomAvailability.mustBeGuaranteed,
|
mustBeGuaranteed: roomAvailability.mustBeGuaranteed,
|
||||||
packages,
|
packages,
|
||||||
|
rateTitle: roomAvailability.rateTitle,
|
||||||
rateDetails: roomAvailability.rateDetails ?? [],
|
rateDetails: roomAvailability.rateDetails ?? [],
|
||||||
roomType: roomAvailability.selectedRoom.roomType,
|
roomType: roomAvailability.selectedRoom.roomType,
|
||||||
roomTypeCode: roomAvailability.selectedRoom.roomTypeCode,
|
roomTypeCode: roomAvailability.selectedRoom.roomTypeCode,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
ArrowRightIcon,
|
ArrowRightIcon,
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
ChevronDownSmallIcon,
|
ChevronDownSmallIcon,
|
||||||
|
PriceTagIcon,
|
||||||
} from "@/components/Icons"
|
} from "@/components/Icons"
|
||||||
import Modal from "@/components/Modal"
|
import Modal from "@/components/Modal"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
@@ -175,7 +176,10 @@ export default function SummaryUI({
|
|||||||
</Caption>
|
</Caption>
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
title={room.cancellationText}
|
title={
|
||||||
|
room.rateTitle ? room.rateTitle : room.cancellationText
|
||||||
|
}
|
||||||
|
subtitle={room.rateTitle ? room.cancellationText : undefined}
|
||||||
>
|
>
|
||||||
<div className={styles.terms}>
|
<div className={styles.terms}>
|
||||||
{room.rateDetails?.map((info) => (
|
{room.rateDetails?.map((info) => (
|
||||||
@@ -366,6 +370,7 @@ export default function SummaryUI({
|
|||||||
}))}
|
}))}
|
||||||
totalPrice={totalPrice}
|
totalPrice={totalPrice}
|
||||||
vat={vat}
|
vat={vat}
|
||||||
|
bookingCode={booking.bookingCode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -376,6 +381,15 @@ export default function SummaryUI({
|
|||||||
totalPrice.local.currency
|
totalPrice.local.currency
|
||||||
)}
|
)}
|
||||||
</Body>
|
</Body>
|
||||||
|
{totalPrice.local.regularPrice && (
|
||||||
|
<Caption color="uiTextMediumContrast" striked={true}>
|
||||||
|
{formatPrice(
|
||||||
|
intl,
|
||||||
|
totalPrice.local.regularPrice,
|
||||||
|
totalPrice.local.currency
|
||||||
|
)}
|
||||||
|
</Caption>
|
||||||
|
)}
|
||||||
{totalPrice.requested && (
|
{totalPrice.requested && (
|
||||||
<Caption color="uiTextMediumContrast">
|
<Caption color="uiTextMediumContrast">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
@@ -392,6 +406,12 @@ export default function SummaryUI({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{booking.bookingCode && (
|
||||||
|
<div>
|
||||||
|
<PriceTagIcon />
|
||||||
|
{booking.bookingCode}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Divider className={styles.bottomDivider} color="primaryLightSubtle" />
|
<Divider className={styles.bottomDivider} color="primaryLightSubtle" />
|
||||||
</div>
|
</div>
|
||||||
{showSignupPromo && memberPrice && !isMember ? (
|
{showSignupPromo && memberPrice && !isMember ? (
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useIntl } from "react-intl"
|
|||||||
|
|
||||||
import { dt } from "@/lib/dt"
|
import { dt } from "@/lib/dt"
|
||||||
|
|
||||||
|
import { PriceTagIcon } from "@/components/Icons"
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
@@ -75,6 +76,7 @@ interface PriceDetailsTableProps {
|
|||||||
}[]
|
}[]
|
||||||
totalPrice: Price
|
totalPrice: Price
|
||||||
vat: number
|
vat: number
|
||||||
|
bookingCode?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PriceDetailsTable({
|
export default function PriceDetailsTable({
|
||||||
@@ -83,6 +85,7 @@ export default function PriceDetailsTable({
|
|||||||
rooms,
|
rooms,
|
||||||
totalPrice,
|
totalPrice,
|
||||||
vat,
|
vat,
|
||||||
|
bookingCode,
|
||||||
}: PriceDetailsTableProps) {
|
}: PriceDetailsTableProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
@@ -229,6 +232,29 @@ export default function PriceDetailsTable({
|
|||||||
</Body>
|
</Body>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{totalPrice.local.regularPrice && (
|
||||||
|
<tr className={styles.row}>
|
||||||
|
<td></td>
|
||||||
|
<td className={styles.price}>
|
||||||
|
<Caption color="uiTextMediumContrast" striked={true}>
|
||||||
|
{formatPrice(
|
||||||
|
intl,
|
||||||
|
totalPrice.local.regularPrice,
|
||||||
|
totalPrice.local.currency
|
||||||
|
)}
|
||||||
|
</Caption>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
{bookingCode && totalPrice.local.regularPrice && (
|
||||||
|
<tr className={styles.row}>
|
||||||
|
<td>
|
||||||
|
<PriceTagIcon />
|
||||||
|
{bookingCode}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
</TableSection>
|
</TableSection>
|
||||||
</table>
|
</table>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ interface PriceDetailsModalProps {
|
|||||||
}[]
|
}[]
|
||||||
totalPrice: Price
|
totalPrice: Price
|
||||||
vat: number
|
vat: number
|
||||||
|
bookingCode?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PriceDetailsModal({
|
export default function PriceDetailsModal({
|
||||||
@@ -37,6 +38,7 @@ export default function PriceDetailsModal({
|
|||||||
rooms,
|
rooms,
|
||||||
totalPrice,
|
totalPrice,
|
||||||
vat,
|
vat,
|
||||||
|
bookingCode,
|
||||||
}: PriceDetailsModalProps) {
|
}: PriceDetailsModalProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
@@ -58,6 +60,7 @@ export default function PriceDetailsModal({
|
|||||||
rooms={rooms}
|
rooms={rooms}
|
||||||
totalPrice={totalPrice}
|
totalPrice={totalPrice}
|
||||||
vat={vat}
|
vat={vat}
|
||||||
|
bookingCode={bookingCode}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ export default function Summary({
|
|||||||
}))}
|
}))}
|
||||||
totalPrice={totalPrice}
|
totalPrice={totalPrice}
|
||||||
vat={vat}
|
vat={vat}
|
||||||
|
bookingCode={booking.bookingCode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -269,6 +270,15 @@ export default function Summary({
|
|||||||
totalPrice.local.currency
|
totalPrice.local.currency
|
||||||
)}
|
)}
|
||||||
</Body>
|
</Body>
|
||||||
|
{booking.bookingCode && totalPrice.local.regularPrice && (
|
||||||
|
<Caption color="uiTextMediumContrast" striked={true}>
|
||||||
|
{formatPrice(
|
||||||
|
intl,
|
||||||
|
totalPrice.local.regularPrice,
|
||||||
|
totalPrice.local.currency
|
||||||
|
)}
|
||||||
|
</Caption>
|
||||||
|
)}
|
||||||
{totalPrice.requested && (
|
{totalPrice.requested && (
|
||||||
<Caption color="uiTextMediumContrast">
|
<Caption color="uiTextMediumContrast">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export default function RateSummary({ isUserLoggedIn }: RateSummaryProps) {
|
|||||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||||
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
|
const nights = dt(checkOutDate).diff(dt(checkInDate), "days")
|
||||||
|
const bookingCode = params.get("bookingCode")
|
||||||
|
|
||||||
const totalNights = intl.formatMessage(
|
const totalNights = intl.formatMessage(
|
||||||
{ id: "{totalNights, plural, one {# night} other {# nights}}" },
|
{ id: "{totalNights, plural, one {# night} other {# nights}}" },
|
||||||
@@ -224,6 +225,19 @@ export default function RateSummary({ isUserLoggedIn }: RateSummaryProps) {
|
|||||||
totalPriceToShow.local.currency
|
totalPriceToShow.local.currency
|
||||||
)}
|
)}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
|
{bookingCode && totalPriceToShow.local.regularPrice && (
|
||||||
|
<Caption
|
||||||
|
textAlign="right"
|
||||||
|
color="uiTextMediumContrast"
|
||||||
|
striked={true}
|
||||||
|
>
|
||||||
|
{formatPrice(
|
||||||
|
intl,
|
||||||
|
totalPriceToShow.local.regularPrice,
|
||||||
|
totalPriceToShow.local.currency
|
||||||
|
)}
|
||||||
|
</Caption>
|
||||||
|
)}
|
||||||
{totalPriceToShow.requested ? (
|
{totalPriceToShow.requested ? (
|
||||||
<Body color="uiTextMediumContrast">
|
<Body color="uiTextMediumContrast">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
|
|||||||
@@ -34,11 +34,17 @@ export const calculateTotalPrice = (
|
|||||||
petRoomPrice = Number(petRoomPackage.localPrice.totalPrice)
|
petRoomPrice = Number(petRoomPackage.localPrice.totalPrice)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const regularPrice = rate.localPrice.regularPricePerStay
|
||||||
|
? (total.local.regularPrice || 0) +
|
||||||
|
(rate.localPrice.regularPricePerStay || 0)
|
||||||
|
: undefined
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local: {
|
local: {
|
||||||
currency: rate.localPrice.currency,
|
currency: rate.localPrice.currency,
|
||||||
price:
|
price:
|
||||||
total.local.price + rate.localPrice.pricePerStay + petRoomPrice,
|
total.local.price + rate.localPrice.pricePerStay + petRoomPrice,
|
||||||
|
regularPrice,
|
||||||
},
|
},
|
||||||
requested: rate.requestedPrice
|
requested: rate.requestedPrice
|
||||||
? {
|
? {
|
||||||
@@ -56,6 +62,7 @@ export const calculateTotalPrice = (
|
|||||||
currency: (selectedRateSummary[0].public?.localPrice.currency ||
|
currency: (selectedRateSummary[0].public?.localPrice.currency ||
|
||||||
selectedRateSummary[0].member?.localPrice.currency)!,
|
selectedRateSummary[0].member?.localPrice.currency)!,
|
||||||
price: 0,
|
price: 0,
|
||||||
|
regularPrice: undefined,
|
||||||
},
|
},
|
||||||
requested: undefined,
|
requested: undefined,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ p.caption {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.striked {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
.baseTextAccent {
|
.baseTextAccent {
|
||||||
color: var(--Base-Text-Accent);
|
color: var(--Base-Text-Accent);
|
||||||
}
|
}
|
||||||
@@ -111,6 +115,10 @@ p.caption {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.green {
|
.green {
|
||||||
color: var(--UI-Semantic-Success);
|
color: var(--UI-Semantic-Success);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default function Caption({
|
|||||||
textAlign,
|
textAlign,
|
||||||
textTransform,
|
textTransform,
|
||||||
uppercase,
|
uppercase,
|
||||||
|
striked,
|
||||||
type,
|
type,
|
||||||
...props
|
...props
|
||||||
}: CaptionProps) {
|
}: CaptionProps) {
|
||||||
@@ -21,6 +22,7 @@ export default function Caption({
|
|||||||
className,
|
className,
|
||||||
textTransform,
|
textTransform,
|
||||||
uppercase,
|
uppercase,
|
||||||
|
striked,
|
||||||
type,
|
type,
|
||||||
})
|
})
|
||||||
: captionVariants({
|
: captionVariants({
|
||||||
@@ -29,6 +31,7 @@ export default function Caption({
|
|||||||
textTransform,
|
textTransform,
|
||||||
textAlign,
|
textAlign,
|
||||||
uppercase,
|
uppercase,
|
||||||
|
striked,
|
||||||
type,
|
type,
|
||||||
})
|
})
|
||||||
return <Comp className={classNames} {...props} />
|
return <Comp className={classNames} {...props} />
|
||||||
|
|||||||
@@ -34,10 +34,14 @@ const config = {
|
|||||||
textAlign: {
|
textAlign: {
|
||||||
center: styles.center,
|
center: styles.center,
|
||||||
left: styles.left,
|
left: styles.left,
|
||||||
|
right: styles.right,
|
||||||
},
|
},
|
||||||
uppercase: {
|
uppercase: {
|
||||||
true: styles.uppercase,
|
true: styles.uppercase,
|
||||||
},
|
},
|
||||||
|
striked: {
|
||||||
|
true: styles.striked,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
color: "black",
|
color: "black",
|
||||||
@@ -61,6 +65,9 @@ const fontOnlyConfig = {
|
|||||||
uppercase: {
|
uppercase: {
|
||||||
true: styles.uppercase,
|
true: styles.uppercase,
|
||||||
},
|
},
|
||||||
|
striked: {
|
||||||
|
true: styles.striked,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
type: "regular",
|
type: "regular",
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export default function EnterDetailsProvider({
|
|||||||
breakfastIncluded: !!room.breakfastIncluded,
|
breakfastIncluded: !!room.breakfastIncluded,
|
||||||
cancellationText: room.cancellationText,
|
cancellationText: room.cancellationText,
|
||||||
rateDetails: room.rateDetails,
|
rateDetails: room.rateDetails,
|
||||||
|
rateTitle: room.rateTitle,
|
||||||
roomFeatures: room.packages,
|
roomFeatures: room.packages,
|
||||||
roomRate: room.roomRate,
|
roomRate: room.roomRate,
|
||||||
roomType: room.roomType,
|
roomType: room.roomType,
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import type { BedTypeSelection } from "@/types/components/hotelReservation/enter
|
|||||||
import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
||||||
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
||||||
import { HotelTypeEnum } from "@/types/enums/hotelType"
|
import { HotelTypeEnum } from "@/types/enums/hotelType"
|
||||||
|
import { RateTypeEnum } from "@/types/enums/rateType"
|
||||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||||
import type { HotelDataWithUrl } from "@/types/hotel"
|
import type { HotelDataWithUrl } from "@/types/hotel"
|
||||||
import type {
|
import type {
|
||||||
@@ -511,8 +512,8 @@ export const hotelQueryRouter = router({
|
|||||||
adults: adultCount,
|
adults: adultCount,
|
||||||
...(childArray &&
|
...(childArray &&
|
||||||
childArray.length > 0 && {
|
childArray.length > 0 && {
|
||||||
children: generateChildrenString(childArray),
|
children: generateChildrenString(childArray),
|
||||||
}),
|
}),
|
||||||
...(bookingCode && { bookingCode }),
|
...(bookingCode && { bookingCode }),
|
||||||
language: apiLang,
|
language: apiLang,
|
||||||
}
|
}
|
||||||
@@ -754,9 +755,9 @@ export const hotelQueryRouter = router({
|
|||||||
type: matchingRoom.mainBed.type,
|
type: matchingRoom.mainBed.type,
|
||||||
extraBed: matchingRoom.fixedExtraBed
|
extraBed: matchingRoom.fixedExtraBed
|
||||||
? {
|
? {
|
||||||
type: matchingRoom.fixedExtraBed.type,
|
type: matchingRoom.fixedExtraBed.type,
|
||||||
description: matchingRoom.fixedExtraBed.description,
|
description: matchingRoom.fixedExtraBed.description,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,6 +785,11 @@ export const hotelQueryRouter = router({
|
|||||||
cancellationText: rateDefinition?.cancellationText ?? "",
|
cancellationText: rateDefinition?.cancellationText ?? "",
|
||||||
mustBeGuaranteed: !!rateDefinition?.mustBeGuaranteed,
|
mustBeGuaranteed: !!rateDefinition?.mustBeGuaranteed,
|
||||||
breakfastIncluded: !!rateDefinition?.breakfastIncluded,
|
breakfastIncluded: !!rateDefinition?.breakfastIncluded,
|
||||||
|
// Send rate Title when it is a booking code rate
|
||||||
|
rateTitle:
|
||||||
|
rateDefinition?.rateType !== RateTypeEnum.Regular
|
||||||
|
? rateDefinition?.title
|
||||||
|
: undefined,
|
||||||
memberRate: rates?.member,
|
memberRate: rates?.member,
|
||||||
publicRate: rates?.public,
|
publicRate: rates?.public,
|
||||||
bedTypes,
|
bedTypes,
|
||||||
@@ -1114,9 +1120,9 @@ export const hotelQueryRouter = router({
|
|||||||
|
|
||||||
return hotelData
|
return hotelData
|
||||||
? {
|
? {
|
||||||
...hotelData,
|
...hotelData,
|
||||||
url: hotelPage?.url ?? null,
|
url: hotelPage?.url ?? null,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
|
|||||||
local: {
|
local: {
|
||||||
currency: roomRate.publicRate.localPrice.currency,
|
currency: roomRate.publicRate.localPrice.currency,
|
||||||
price: roomRate.publicRate.localPrice.pricePerNight,
|
price: roomRate.publicRate.localPrice.pricePerNight,
|
||||||
|
regularPrice: roomRate.publicRate.localPrice.regularPricePerNight,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
perStay: {
|
perStay: {
|
||||||
@@ -124,6 +125,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
|
|||||||
local: {
|
local: {
|
||||||
currency: roomRate.publicRate.localPrice.currency,
|
currency: roomRate.publicRate.localPrice.currency,
|
||||||
price: roomRate.publicRate.localPrice.pricePerStay,
|
price: roomRate.publicRate.localPrice.pricePerStay,
|
||||||
|
regularPrice: roomRate.publicRate.localPrice.regularPricePerStay,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -136,7 +138,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
|
|||||||
|
|
||||||
type TotalPrice = {
|
type TotalPrice = {
|
||||||
requested: { currency: string; price: number } | undefined
|
requested: { currency: string; price: number } | undefined
|
||||||
local: { currency: string; price: number }
|
local: { currency: string; price: number; regularPrice?: number }
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTotalPrice(roomRates: RoomRate[], isMember: boolean) {
|
export function getTotalPrice(roomRates: RoomRate[], isMember: boolean) {
|
||||||
@@ -165,6 +167,9 @@ export function getTotalPrice(roomRates: RoomRate[], isMember: boolean) {
|
|||||||
local: {
|
local: {
|
||||||
currency: rate.localPrice.currency,
|
currency: rate.localPrice.currency,
|
||||||
price: add(total.local.price ?? 0, rate.localPrice.pricePerStay),
|
price: add(total.local.price ?? 0, rate.localPrice.pricePerStay),
|
||||||
|
regularPrice: rate.localPrice.regularPricePerStay
|
||||||
|
? add(total.local.regularPrice, rate.localPrice.regularPricePerStay)
|
||||||
|
: total.local.regularPrice,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -232,6 +237,12 @@ export function calcTotalPrice(
|
|||||||
breakfastLocalPrice * room.adults * nights,
|
breakfastLocalPrice * room.adults * nights,
|
||||||
roomFeaturesTotal
|
roomFeaturesTotal
|
||||||
),
|
),
|
||||||
|
regularPrice: add(
|
||||||
|
acc.local.regularPrice,
|
||||||
|
roomPrice.perStay.local.regularPrice,
|
||||||
|
breakfastLocalPrice * room.adults * nights,
|
||||||
|
roomFeaturesTotal
|
||||||
|
),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ export function createDetailsStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stateTotalLocalPrice = state.totalPrice.local.price
|
const stateTotalLocalPrice = state.totalPrice.local.price
|
||||||
|
const stateTotalLocalRegularPrice = state.totalPrice.local.regularPrice
|
||||||
|
|
||||||
const addToTotalPrice =
|
const addToTotalPrice =
|
||||||
(currentRoom.room.breakfast === undefined ||
|
(currentRoom.room.breakfast === undefined ||
|
||||||
@@ -290,7 +291,10 @@ export function createDetailsStore(
|
|||||||
local: {
|
local: {
|
||||||
currency: breakfast.localPrice.currency,
|
currency: breakfast.localPrice.currency,
|
||||||
price: stateTotalLocalPrice + breakfastTotalPrice,
|
price: stateTotalLocalPrice + breakfastTotalPrice,
|
||||||
},
|
regularPrice: stateTotalLocalRegularPrice
|
||||||
|
? stateTotalLocalRegularPrice + breakfastTotalPrice
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,6 +326,9 @@ export function createDetailsStore(
|
|||||||
if (localPrice < 0) {
|
if (localPrice < 0) {
|
||||||
localPrice = 0
|
localPrice = 0
|
||||||
}
|
}
|
||||||
|
let regularPrice = stateTotalLocalRegularPrice
|
||||||
|
? stateTotalLocalRegularPrice - currentBreakfastTotalPrice
|
||||||
|
: undefined
|
||||||
|
|
||||||
state.totalPrice = {
|
state.totalPrice = {
|
||||||
requested: state.totalPrice.requested && {
|
requested: state.totalPrice.requested && {
|
||||||
@@ -331,6 +338,7 @@ export function createDetailsStore(
|
|||||||
local: {
|
local: {
|
||||||
currency,
|
currency,
|
||||||
price: localPrice,
|
price: localPrice,
|
||||||
|
regularPrice,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
interface TPrice {
|
interface TPrice {
|
||||||
currency: string
|
currency: string
|
||||||
price: number
|
price: number
|
||||||
|
regularPrice?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Price {
|
export interface Price {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export interface Room {
|
|||||||
mustBeGuaranteed?: boolean
|
mustBeGuaranteed?: boolean
|
||||||
packages: Packages | null
|
packages: Packages | null
|
||||||
rateDetails: string[]
|
rateDetails: string[]
|
||||||
|
rateTitle?: string
|
||||||
roomRate: RoomRate
|
roomRate: RoomRate
|
||||||
roomType: string
|
roomType: string
|
||||||
roomTypeCode: string
|
roomTypeCode: string
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export interface InitialRoomData {
|
|||||||
breakfastIncluded: boolean
|
breakfastIncluded: boolean
|
||||||
cancellationText: string
|
cancellationText: string
|
||||||
rateDetails: string[] | undefined
|
rateDetails: string[] | undefined
|
||||||
|
rateTitle?: string
|
||||||
roomFeatures: Packages | null
|
roomFeatures: Packages | null
|
||||||
roomRate: RoomRate
|
roomRate: RoomRate
|
||||||
roomType: string
|
roomType: string
|
||||||
|
|||||||
Reference in New Issue
Block a user