fix: apply logic for full prices filter
This commit is contained in:
committed by
Michael Zetterberg
parent
3942ab1ff4
commit
8a7c55edff
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
import { useEffect } from "react"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
import { useRatesStore } from "@/stores/select-rate"
|
||||
|
||||
@@ -17,17 +18,27 @@ export default function RoomProvider({
|
||||
room,
|
||||
}: RoomProviderProps) {
|
||||
const lang = useLang()
|
||||
const { activeRoom, booking, roomAvailability, selectedFilter } =
|
||||
useRatesStore((state) => ({
|
||||
activeRoom: state.activeRoom,
|
||||
booking: state.booking,
|
||||
roomAvailability: state.roomsAvailability?.[idx],
|
||||
selectedFilter: state.rooms[idx].selectedFilter,
|
||||
}))
|
||||
const {
|
||||
activeRoom,
|
||||
booking,
|
||||
roomAvailability,
|
||||
searchParams,
|
||||
selectedFilter,
|
||||
} = useRatesStore((state) => ({
|
||||
activeRoom: state.activeRoom,
|
||||
booking: state.booking,
|
||||
roomAvailability: state.roomsAvailability?.[idx],
|
||||
searchParams: state.searchParams,
|
||||
selectedFilter: state.rooms[idx].selectedFilter,
|
||||
}))
|
||||
const { appendRegularRates, ...actions } = room.actions
|
||||
const roomNr = idx + 1
|
||||
|
||||
const hasRedemptionRates = room.rooms.some((room) => room.redemptions.length)
|
||||
const redemptionSearch = searchParams.has("searchType")
|
||||
? searchParams.get("searchType") === REDEMPTION
|
||||
: false
|
||||
const hasRedemptionRates =
|
||||
redemptionSearch || room.rooms.some((room) => room.redemptions.length)
|
||||
const hasCorporateChequeOrVoucherRates = room.rooms.some((room) =>
|
||||
room.code.some((product) => {
|
||||
if ("corporateCheque" in product) {
|
||||
@@ -48,7 +59,7 @@ export default function RoomProvider({
|
||||
// duplicate data
|
||||
const enabled = !!(
|
||||
booking.bookingCode &&
|
||||
selectedFilter === BookingCodeFilterEnum.All &&
|
||||
selectedFilter !== BookingCodeFilterEnum.Discounted &&
|
||||
!dontShowRegularRates
|
||||
)
|
||||
// Extra query needed to fetch regular rates upon user
|
||||
|
||||
Reference in New Issue
Block a user