fix: filter out available bedtypes
This commit is contained in:
@@ -17,7 +17,7 @@ export default async function SummaryPage({
|
||||
getQueryParamsForEnterDetails(selectRoomParams)
|
||||
|
||||
const availability = await getSelectedRoomAvailability({
|
||||
hotelId: parseInt(hotel),
|
||||
hotelId: hotel,
|
||||
adults,
|
||||
children,
|
||||
roomStayStartDate: fromDate,
|
||||
@@ -35,25 +35,25 @@ export default async function SummaryPage({
|
||||
|
||||
const prices = user
|
||||
? {
|
||||
local: {
|
||||
price: availability.memberRate?.localPrice.pricePerStay,
|
||||
currency: availability.memberRate?.localPrice.currency,
|
||||
},
|
||||
euro: {
|
||||
price: availability.memberRate?.requestedPrice?.pricePerStay,
|
||||
currency: availability.memberRate?.requestedPrice?.currency,
|
||||
},
|
||||
}
|
||||
local: {
|
||||
price: availability.memberRate?.localPrice.pricePerStay,
|
||||
currency: availability.memberRate?.localPrice.currency,
|
||||
},
|
||||
euro: {
|
||||
price: availability.memberRate?.requestedPrice?.pricePerStay,
|
||||
currency: availability.memberRate?.requestedPrice?.currency,
|
||||
},
|
||||
}
|
||||
: {
|
||||
local: {
|
||||
price: availability.publicRate?.localPrice.pricePerStay,
|
||||
currency: availability.publicRate?.localPrice.currency,
|
||||
},
|
||||
euro: {
|
||||
price: availability.publicRate?.requestedPrice?.pricePerStay,
|
||||
currency: availability.publicRate?.requestedPrice?.currency,
|
||||
},
|
||||
}
|
||||
local: {
|
||||
price: availability.publicRate?.localPrice.pricePerStay,
|
||||
currency: availability.publicRate?.localPrice.currency,
|
||||
},
|
||||
euro: {
|
||||
price: availability.publicRate?.requestedPrice?.pricePerStay,
|
||||
currency: availability.publicRate?.requestedPrice?.currency,
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<Summary
|
||||
|
||||
@@ -52,7 +52,7 @@ export default async function StepPage({
|
||||
const breakfastInput = { adults, fromDate, hotelId, toDate }
|
||||
void getBreakfastPackages(breakfastInput)
|
||||
void getSelectedRoomAvailability({
|
||||
hotelId: parseInt(searchParams.hotel),
|
||||
hotelId,
|
||||
adults,
|
||||
children,
|
||||
roomStayStartDate: fromDate,
|
||||
@@ -67,7 +67,7 @@ export default async function StepPage({
|
||||
include: [HotelIncludeEnum.RoomCategories],
|
||||
})
|
||||
const roomAvailability = await getSelectedRoomAvailability({
|
||||
hotelId: parseInt(searchParams.hotel),
|
||||
hotelId,
|
||||
adults,
|
||||
children,
|
||||
roomStayStartDate: fromDate,
|
||||
@@ -98,27 +98,17 @@ export default async function StepPage({
|
||||
id: "Select payment method",
|
||||
})
|
||||
|
||||
const availableRoom = roomAvailability.selectedRoom?.roomType
|
||||
const bedTypes = hotelData.included
|
||||
?.find((room) => room.name === availableRoom)
|
||||
?.roomTypes.map((room) => ({
|
||||
description: room.mainBed.description,
|
||||
size: room.mainBed.widthRange,
|
||||
value: room.code,
|
||||
}))
|
||||
|
||||
return (
|
||||
<section>
|
||||
<HistoryStateManager />
|
||||
|
||||
{/* TODO: How to handle no beds found? */}
|
||||
{bedTypes ? (
|
||||
{roomAvailability.bedTypes ? (
|
||||
<SectionAccordion
|
||||
header="Select bed"
|
||||
step={StepEnum.selectBed}
|
||||
label={intl.formatMessage({ id: "Request bedtype" })}
|
||||
>
|
||||
<BedType bedTypes={bedTypes} />
|
||||
<BedType bedTypes={roomAvailability.bedTypes} />
|
||||
</SectionAccordion>
|
||||
) : null}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user