feat: SW-1583 Enabled reward night in booking widget

This commit is contained in:
Hrishikesh Vaipurkar
2025-02-27 11:41:04 +01:00
parent 6232ded991
commit 51b70f3032
12 changed files with 247 additions and 69 deletions

View File

@@ -91,7 +91,6 @@ export const bookingWidgetSchema = z
redemption: z.boolean().default(false),
rooms: guestRoomsSchema,
search: z.string({ coerce: true }).min(1, "Required"),
voucher: z.boolean().default(false),
hotel: z.number().optional(),
city: z.string().optional(),
})
@@ -130,4 +129,28 @@ export const bookingWidgetSchema = z
path: ["rooms"],
})
}
if (value.rooms.length > 1 && value.redemption) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Multi-room booking is not available with reward night.",
path: ["redemption"],
})
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Multi-room booking is not available with reward night.",
path: ["rooms"],
})
}
if (value.bookingCode?.value && value.redemption) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Code and voucher is not available with reward night.",
path: ["redemption"],
})
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Code and voucher is not available with reward night.",
path: ["bookingCode.value"],
})
}
})