Add bundle deals to at the door and the kiosk
Both list the event's deals and show the Complete bundle / + cards from the register form. At the door gets the standard Back to dashboard link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Gift } from "lucide-react";
|
||||
import { apiFetch } from "@/lib/api";
|
||||
import type { BundleItem, BundleQuote, EventOption, PublicBundle } from "@/types";
|
||||
import type { BundleItem, BundleQuote, PublicBundle } from "@/types";
|
||||
import type { BasketItem } from "@/components/shared/CouponCodeField";
|
||||
|
||||
const fmt = (n: number) => `R${n.toFixed(2)}`;
|
||||
@@ -90,7 +90,14 @@ export function BundleSavings({ applications, className = "" }: {
|
||||
);
|
||||
}
|
||||
|
||||
type BuilderOption = Pick<EventOption, "id" | "name" | "stockLimit" | "availableCount" | "variants">;
|
||||
// Just what the builder reads, so pages with their own option types can pass them in.
|
||||
type BuilderOption = {
|
||||
id: string;
|
||||
name: string;
|
||||
stockLimit?: number | null;
|
||||
availableCount?: number | null;
|
||||
variants?: { id: string; name: string; stockLimit?: number | null; availableCount?: number | null }[] | null;
|
||||
};
|
||||
|
||||
/** Tickets of this item already in the basket. An "any variant" item counts every variant. */
|
||||
function itemHave(item: BundleItem, opt: BuilderOption | undefined, qty: (optionId: string, variantId: string | null) => number) {
|
||||
@@ -100,7 +107,7 @@ function itemHave(item: BundleItem, opt: BuilderOption | undefined, qty: (option
|
||||
return variants.length > 0 ? variants.reduce((s, v) => s + qty(opt.id, v.id), 0) : qty(opt.id, null);
|
||||
}
|
||||
|
||||
const leftOf = (stockLimit?: number, availableCount?: number) => ((stockLimit ?? 0) > 0 && availableCount !== undefined ? availableCount : Infinity);
|
||||
const leftOf = (stockLimit?: number | null, availableCount?: number | null) => ((stockLimit ?? 0) > 0 && availableCount !== undefined && availableCount !== null ? availableCount : Infinity);
|
||||
|
||||
/**
|
||||
* Quantities that make up `sets` full bundles, or null when there aren't enough tickets
|
||||
|
||||
Reference in New Issue
Block a user