Merged in feat/SW-1308-booking-codes-track-b (pull request #1607)
Feat/SW-1308 booking codes track b * feat: SW-1308 Booking codes track b * feat: SW-1308 Booking codes Track B implementation * feat: SW-1308 Optimized after rebase Approved-by: Arvid Norlin
This commit is contained in:
@@ -34,6 +34,7 @@ import styles from "./selectHotel.module.css"
|
||||
|
||||
import type { SelectHotelProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
||||
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
|
||||
import { RateTypeEnum } from "@/types/enums/rateType"
|
||||
|
||||
export default async function SelectHotel({
|
||||
params,
|
||||
@@ -71,7 +72,7 @@ export default async function SelectHotel({
|
||||
isAlternativeFor,
|
||||
bookingCode,
|
||||
city,
|
||||
!!redemption,
|
||||
!!redemption
|
||||
)
|
||||
|
||||
const arrivalDate = new Date(selectHotelParams.fromDate)
|
||||
@@ -95,24 +96,24 @@ export default async function SelectHotel({
|
||||
},
|
||||
isAlternativeFor
|
||||
? {
|
||||
title: intl.formatMessage({ id: "Alternative hotels" }),
|
||||
href: `${alternativeHotels(params.lang)}/?${convertedSearchParams}`,
|
||||
uid: "alternative-hotels",
|
||||
}
|
||||
title: intl.formatMessage({ id: "Alternative hotels" }),
|
||||
href: `${alternativeHotels(params.lang)}/?${convertedSearchParams}`,
|
||||
uid: "alternative-hotels",
|
||||
}
|
||||
: {
|
||||
title: intl.formatMessage({ id: "Select hotel" }),
|
||||
href: `${selectHotel(params.lang)}/?${convertedSearchParams}`,
|
||||
uid: "select-hotel",
|
||||
},
|
||||
title: intl.formatMessage({ id: "Select hotel" }),
|
||||
href: `${selectHotel(params.lang)}/?${convertedSearchParams}`,
|
||||
uid: "select-hotel",
|
||||
},
|
||||
isAlternativeFor
|
||||
? {
|
||||
title: isAlternativeFor.name,
|
||||
uid: isAlternativeFor.id,
|
||||
}
|
||||
title: isAlternativeFor.name,
|
||||
uid: isAlternativeFor.id,
|
||||
}
|
||||
: {
|
||||
title: city.name,
|
||||
uid: city.id,
|
||||
},
|
||||
title: city.name,
|
||||
uid: city.id,
|
||||
},
|
||||
]
|
||||
|
||||
const isAllUnavailable = !hotels.length
|
||||
@@ -133,6 +134,33 @@ export default async function SelectHotel({
|
||||
)
|
||||
|
||||
const suspenseKey = stringify(searchParams)
|
||||
|
||||
let isFullPriceHotelAvailable
|
||||
let isBookingCodeRateAvaliable
|
||||
if (bookingCode) {
|
||||
isFullPriceHotelAvailable = hotels?.find(
|
||||
(hotel) =>
|
||||
hotel.availability.productType?.public?.rateType ===
|
||||
RateTypeEnum.Regular ||
|
||||
hotel.availability.productType?.member?.rateType ===
|
||||
RateTypeEnum.Regular
|
||||
)
|
||||
isBookingCodeRateAvaliable = hotels?.find(
|
||||
(hotel) =>
|
||||
hotel.availability.productType?.public?.rateType !==
|
||||
RateTypeEnum.Regular ||
|
||||
hotel.availability.productType?.member?.rateType !==
|
||||
RateTypeEnum.Regular
|
||||
)
|
||||
}
|
||||
|
||||
// Special rates (corporate cheque, voucher and reward nights) will not have regular rate hotels availability
|
||||
const isSpecialRate = hotels?.some(
|
||||
(hotel) =>
|
||||
hotel.availability.productType?.bonusCheque ||
|
||||
hotel.availability.productType?.voucher ||
|
||||
hotel.availability.productType?.redemptions
|
||||
)
|
||||
return (
|
||||
<>
|
||||
<header className={styles.header}>
|
||||
@@ -160,7 +188,11 @@ export default async function SelectHotel({
|
||||
</div>
|
||||
</header>
|
||||
<main className={styles.main}>
|
||||
{bookingCode ? <BookingCodeFilter /> : null}
|
||||
{isBookingCodeRateAvaliable &&
|
||||
isFullPriceHotelAvailable &&
|
||||
!isSpecialRate ? (
|
||||
<BookingCodeFilter />
|
||||
) : null}
|
||||
<div className={styles.sideBar}>
|
||||
{hotels.length ? (
|
||||
<Link
|
||||
|
||||
Reference in New Issue
Block a user