feat: prevent users from selecting the same room when there is no vacancy for it
This commit is contained in:
committed by
Michael Zetterberg
parent
4f0c61f68f
commit
1f1bcd480b
@@ -128,6 +128,11 @@ export function createRatesStore({
|
||||
pathname,
|
||||
rateSummary,
|
||||
roomConfigurations,
|
||||
roomCategories,
|
||||
roomsPackages,
|
||||
roomsAvailability,
|
||||
searchParams,
|
||||
vat,
|
||||
rooms: booking.rooms.map((room, idx) => {
|
||||
const roomConfiguration = roomConfigurations[idx]
|
||||
const roomPackages = roomsPackages[idx]
|
||||
@@ -304,6 +309,26 @@ export function createRatesStore({
|
||||
})
|
||||
)
|
||||
},
|
||||
removeSelectedRoom() {
|
||||
return set(
|
||||
produce((state: RatesState) => {
|
||||
state.rateSummary[idx] = null
|
||||
|
||||
const searchParams = state.searchParams
|
||||
searchParams.delete(`room[${idx}].counterratecode`)
|
||||
searchParams.delete(`room[${idx}].ratecode`)
|
||||
searchParams.delete(`room[${idx}].roomtype`)
|
||||
|
||||
state.searchParams = searchParams
|
||||
|
||||
window.history.replaceState(
|
||||
{},
|
||||
"",
|
||||
`${state.pathname}?${searchParams}`
|
||||
)
|
||||
})
|
||||
)
|
||||
},
|
||||
selectFilter(filter) {
|
||||
return set(
|
||||
produce((state: RatesState) => {
|
||||
@@ -545,11 +570,6 @@ export function createRatesStore({
|
||||
: null,
|
||||
}
|
||||
}),
|
||||
roomCategories,
|
||||
roomsPackages,
|
||||
roomsAvailability,
|
||||
searchParams,
|
||||
vat,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user