Add bundle types: pick any, buy X get Y free, group discount
Bundles get a kind: exact (as before), mix (any setSize of the qualifying tickets for a set price), free (cheapest freeCount in each set free) and group (setSize or more qualifying tickets at a per-ticket price or % off, applied once). The supervisor page has a type picker, buyers see a one-line description of each deal, and the Complete bundle cards handle every type. Demo: Family Fun Day adds a Lunch for four deal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,9 +243,9 @@ function addSection(event, name, options) {
|
||||
return section;
|
||||
}
|
||||
|
||||
/** A bundle deal: items are [option, quantity] pairs. */
|
||||
/** A bundle deal: items are [option, quantity] pairs (quantity 1 for pick-any and the other kinds). */
|
||||
function addBundle(event, data, items) {
|
||||
const bundle = add('eventBundle', { id: uuidv4(), eventId: event.id, description: null, isActive: true, validFrom: null, validUntil: null, order: 0, createdAt: addTime(NOW, -30 * DAY), updatedAt: NOW, ...data });
|
||||
const bundle = add('eventBundle', { id: uuidv4(), eventId: event.id, description: null, kind: 'exact', setSize: null, freeCount: null, groupPricing: null, isActive: true, validFrom: null, validUntil: null, order: 0, createdAt: addTime(NOW, -30 * DAY), updatedAt: NOW, ...data });
|
||||
for (const [option, quantity] of items) add('eventBundleItem', { id: uuidv4(), bundleId: bundle.id, eventOptionId: option.id, variantId: null, quantity });
|
||||
return bundle;
|
||||
}
|
||||
@@ -454,6 +454,7 @@ function buildFamilyFunDay(people) {
|
||||
const child = addOption(event, { name: 'Child (3–12)', price: 40 });
|
||||
const lunch = addOption(event, { name: 'Lunch pack', price: 65, isMainTicket: false });
|
||||
addBundle(event, { name: 'Family deal', price: 220, description: 'Two adults and three kids, R60 less than buying them separately.' }, [[adult, 2], [child, 3]]);
|
||||
addBundle(event, { name: 'Lunch for four', kind: 'mix', setSize: 4, price: 220, description: 'Any four lunch packs for R220.' }, [[lunch, 1]]);
|
||||
|
||||
add('coupon', {
|
||||
id: uuidv4(), code: 'FUNDAY20', description: 'R20 off for first-time visitors', type: 'fixed', value: 20,
|
||||
|
||||
Reference in New Issue
Block a user