Merged in feat/SW-1076-no-room-availability (pull request #1467)
Feat/SW-1076 no room availability * fix: update booking error codes * feat(SW-1076): handle no room availabilty on enter-details * fix: parse to json in api mutation instead of expecting json * fix: remove 'isComplete' state from sectionAccordion because it was not needed Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -37,6 +37,7 @@ export default function EnterDetailsProvider({
|
||||
rooms: rooms
|
||||
.filter((r) => r.bedTypes?.length) // TODO: how to handle room without bedtypes?
|
||||
.map((room) => ({
|
||||
isAvailable: room.isAvailable,
|
||||
breakfastIncluded: !!room.breakfastIncluded,
|
||||
cancellationText: room.cancellationText,
|
||||
rateDetails: room.rateDetails,
|
||||
@@ -86,6 +87,10 @@ export default function EnterDetailsProvider({
|
||||
// since store is readonly
|
||||
const currentRoom = deepmerge({}, store.rooms[idx])
|
||||
|
||||
if (!currentRoom.room.isAvailable) {
|
||||
return currentRoom
|
||||
}
|
||||
|
||||
if (!currentRoom.room.bedType && storedRoom.room.bedType) {
|
||||
const sameBed = currentRoom.room.bedTypes.find(
|
||||
(bedType) => bedType.value === storedRoom.room.bedType?.roomTypeCode
|
||||
@@ -134,7 +139,9 @@ export default function EnterDetailsProvider({
|
||||
return currentRoom
|
||||
})
|
||||
|
||||
const canProceedToPayment = updatedRooms.every((room) => room.isComplete)
|
||||
const canProceedToPayment = updatedRooms.every(
|
||||
(room) => room.isComplete && room.room.isAvailable
|
||||
)
|
||||
|
||||
const nights = dt(booking.toDate).diff(booking.fromDate, "days")
|
||||
const currency = (updatedRooms[0].room.roomRate.publicRate?.localPrice
|
||||
|
||||
Reference in New Issue
Block a user