feat: SW-1588 Optimized code & comments
This commit is contained in:
@@ -63,6 +63,11 @@ export default function PriceList({
|
|||||||
nights,
|
nights,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// When it is Promotion rate either booking code rate or public
|
||||||
|
// Show striked Regular rate which is overtaken by the Promotional rate when member rate is not available
|
||||||
|
const showOvertakingPrice =
|
||||||
|
!memberLocalPrice && publicLocalPrice.regularPricePerNight
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<dl className={styles.priceList}>
|
<dl className={styles.priceList}>
|
||||||
{isUserLoggedIn && isMainRoom && memberLocalPrice ? null : (
|
{isUserLoggedIn && isMainRoom && memberLocalPrice ? null : (
|
||||||
@@ -129,7 +134,7 @@ export default function PriceList({
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{publicLocalPrice.regularPricePerNight && (
|
{showOvertakingPrice && (
|
||||||
<div className={styles.priceRow}>
|
<div className={styles.priceRow}>
|
||||||
<dt></dt>
|
<dt></dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ export default function RoomSelectionPanel() {
|
|||||||
(state) => state.activeCodeFilter
|
(state) => state.activeCodeFilter
|
||||||
)
|
)
|
||||||
|
|
||||||
// With Booking code rates we will always obtain public rate and never a member rate,
|
// Regular Rates (Save, Change and Flex) always should send both public and member rates
|
||||||
// so we should ignore it from the logic below.
|
// so we can check public rates for availability
|
||||||
const isRegularRatesAvailableWithCode =
|
const isRegularRatesAvailableWithCode =
|
||||||
bookingCode &&
|
bookingCode &&
|
||||||
rooms.some(
|
rooms.some(
|
||||||
@@ -49,6 +49,8 @@ export default function RoomSelectionPanel() {
|
|||||||
|
|
||||||
// Booking codes rate comes with various rate types but Regular is reserved
|
// Booking codes rate comes with various rate types but Regular is reserved
|
||||||
// for non-booking code rates (Save, Change & Flex)
|
// for non-booking code rates (Save, Change & Flex)
|
||||||
|
// With Booking code rates we will always obtain public rate and maybe a member rate
|
||||||
|
// so we check for public rate and ignore member rate
|
||||||
const isBookingCodeRatesAvailable =
|
const isBookingCodeRatesAvailable =
|
||||||
bookingCode &&
|
bookingCode &&
|
||||||
rooms.some(
|
rooms.some(
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ export const roomConfigurationSchema = z
|
|||||||
return product
|
return product
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return rate even if single when booking code rate which can be any one of other rate types
|
// Return rate with only public available when it is a booking code rate
|
||||||
|
// which can be any one of other rate types
|
||||||
if (product.productType.public.rateType !== RateTypeEnum.Regular) {
|
if (product.productType.public.rateType !== RateTypeEnum.Regular) {
|
||||||
return product
|
return product
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user