feat: filters work together
This commit is contained in:
committed by
Michael Zetterberg
parent
31370fe711
commit
d72c84d949
@@ -63,26 +63,25 @@ export default function BookingCodeFilter() {
|
||||
appendRegularRates(room?.roomConfigurations)
|
||||
}
|
||||
|
||||
const hideFilterDespiteBookingCode =
|
||||
rooms.length &&
|
||||
rooms.every((room) =>
|
||||
room.products.every((product) => {
|
||||
const isRedemption = Array.isArray(product)
|
||||
if (isRedemption) {
|
||||
return true
|
||||
}
|
||||
const isCorporateCheque =
|
||||
product.rateDefinition?.rateType === RateTypeEnum.CorporateCheque
|
||||
const isVoucher =
|
||||
product.rateDefinition?.rateType === RateTypeEnum.Voucher
|
||||
return isCorporateCheque || isVoucher
|
||||
})
|
||||
)
|
||||
const hideFilter = rooms.some((room) =>
|
||||
room.products.some((product) => {
|
||||
const isRedemption = Array.isArray(product)
|
||||
if (isRedemption) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (
|
||||
(booking.bookingCode && hideFilterDespiteBookingCode) ||
|
||||
!booking.bookingCode
|
||||
) {
|
||||
switch (product.rateDefinition.rateType) {
|
||||
case RateTypeEnum.Arb:
|
||||
case RateTypeEnum.CorporateCheque:
|
||||
case RateTypeEnum.Voucher:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
if (hideFilter || !booking.bookingCode) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { SymbolCodepoints } from "react-material-symbols"
|
||||
import type { MaterialSymbolProps } from "react-material-symbols"
|
||||
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
|
||||
export function getIconNameByPackageCode(
|
||||
packageCode: PackageEnum
|
||||
): SymbolCodepoints {
|
||||
): MaterialSymbolProps["icon"] {
|
||||
switch (packageCode) {
|
||||
case RoomPackageCodeEnum.PET_ROOM:
|
||||
return "pets"
|
||||
|
||||
Reference in New Issue
Block a user