Merged in fix/SW-2553-sidepeeks (pull request #1919)
Fix/SW-2553 sidepeeks * fix(SW-2553): apply sidepeek display logic * chore: move convertToChildType and getPriceType utils * fix: apply PR requested changes * fix(SW-2553): fix roomNumber for multiroom * fix(SW-2553): fix sidepeek for my-stay page Approved-by: Michael Zetterberg Approved-by: Bianca Widstam Approved-by: Matilda Landström
This commit is contained in:
committed by
Bianca Widstam
parent
f5f9aba2e5
commit
0c7836fa59
@@ -0,0 +1,20 @@
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
const bedTypeToMapEnum: Record<string, ChildBedMapEnum> = {
|
||||
Crib: ChildBedMapEnum.IN_CRIB,
|
||||
ExtraBed: ChildBedMapEnum.IN_EXTRA_BED,
|
||||
ParentsBed: ChildBedMapEnum.IN_ADULTS_BED,
|
||||
Unknown: ChildBedMapEnum.UNKNOWN,
|
||||
}
|
||||
|
||||
export function convertToChildType(
|
||||
childrenAges: number[],
|
||||
childBedPreferences: BookingConfirmation["booking"]["childBedPreferences"]
|
||||
): Child[] {
|
||||
return childBedPreferences.map((preference, index) => ({
|
||||
age: childrenAges[index],
|
||||
bed: bedTypeToMapEnum[preference.bedType] ?? ChildBedMapEnum.UNKNOWN,
|
||||
}))
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
|
||||
|
||||
export function getPriceType(
|
||||
cheques: number,
|
||||
points: number,
|
||||
vouchers: number
|
||||
): PriceTypeEnum {
|
||||
if (points > 0) return PriceTypeEnum.points
|
||||
if (vouchers > 0) return PriceTypeEnum.voucher
|
||||
if (cheques > 0) return PriceTypeEnum.cheque
|
||||
return PriceTypeEnum.money
|
||||
}
|
||||
Reference in New Issue
Block a user