Add sponsor a spot

Events can allow sponsorships: a "Sponsor a spot" button lets anyone
(guests included) pay through Yoco for whole spots or a custom amount,
anonymously or with a name and message. Payments land as event
donations in a sponsorship pool that supervisors assign with the
existing donation flow. Adds optional public progress towards a goal,
a sponsor receipt and Automations thank-you, pool columns in the
Donations report, and sponsorship labels/filter in Payments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 15:04:29 +02:00
co-authored by Claude Opus 5.5
parent 9bdd3250bf
commit dff83d47af
23 changed files with 594 additions and 177 deletions
@@ -989,6 +989,16 @@ function AutomationsPanel({ events, token, onInfo, onError }:{ events: any[]; to
const [enablePre, setEnablePre] = React.useState(true);
const [enableFinal, setEnableFinal] = React.useState(true);
const [enableThanks, setEnableThanks] = React.useState(true);
// Sponsors of "sponsor a spot" events get their own thank-you.
const [enableSponsors, setEnableSponsors] = React.useState(true);
const [sponsorSubject, setSponsorSubject] = React.useState('Thank you for sponsoring a spot at {{event.title}}');
const [sponsorBody, setSponsorBody] = React.useState(`Hi {{name}}
Thank you for sponsoring a spot at {{event.title}}. Because of you, someone was able to be there who otherwise couldn't.
[add a highlight or two]
With gratitude`);
const [enablePromo, setEnablePromo] = React.useState(false);
// Subjects/Bodies
@@ -1064,6 +1074,11 @@ function AutomationsPanel({ events, token, onInfo, onError }:{ events: any[]; to
if (thanksBody.trim().startsWith('<')) payload.html = thanksBody; else payload.text = thanksBody;
jobs.push(payload);
}
if (currentEvent?.allowSponsorships && enableSponsors && sponsorSubject.trim() && sponsorBody.trim() && thanksWhen) {
const payload: any = { subject: sponsorSubject, scheduledAt: new Date(thanksWhen).toISOString(), audience: 'sponsors' };
if (sponsorBody.trim().startsWith('<')) payload.html = sponsorBody; else payload.text = sponsorBody;
jobs.push(payload);
}
if (enablePromo && promoSubject.trim() && promoBody.trim() && promoWhen) {
const payload: any = { subject: promoSubject, scheduledAt: new Date(promoWhen).toISOString(), promoEventId: promoEventId || undefined };
if (promoBody.trim().startsWith('<')) payload.html = promoBody; else payload.text = promoBody;
@@ -1160,6 +1175,20 @@ function AutomationsPanel({ events, token, onInfo, onError }:{ events: any[]; to
<textarea className="w-full border rounded px-3 py-2 text-sm" rows={5} value={thanksBody} onChange={e => setThanksBody(e.target.value)} />
</fieldset>
{currentEvent?.allowSponsorships && (
<fieldset className="border rounded p-3">
<legend className="text-sm font-medium">Thank Your Sponsors</legend>
<label className="inline-flex items-center gap-2 text-sm mb-2">
<input type="checkbox" checked={enableSponsors} onChange={e => setEnableSponsors(e.target.checked)} /> Enable
</label>
<p className="text-xs text-gray-500 mb-2">Goes to everyone who sponsored a spot at this event, at the same time as the thank-you above.</p>
<label className="block text-xs text-gray-600 mb-1">Subject</label>
<input className="w-full border rounded px-3 py-2 text-sm" value={sponsorSubject} onChange={e => setSponsorSubject(e.target.value)} />
<label className="block text-xs text-gray-600 mb-1 mt-2">Message</label>
<textarea className="w-full border rounded px-3 py-2 text-sm" rows={5} value={sponsorBody} onChange={e => setSponsorBody(e.target.value)} />
</fieldset>
)}
<fieldset className="border rounded p-3">
<legend className="text-sm font-medium">Next Event Promo</legend>
<div className="flex items-center gap-4 mb-2">
@@ -774,6 +774,7 @@ interface EventDraft {
consentCollectMedical: boolean; consentCollectEmergency: boolean; consentCollectPhoto: boolean;
waitlistEnabled: boolean; waitlistOfferHours: string; waitlistPartialOffers: boolean;
allowTicketTransfer: boolean; collectGender: boolean;
allowSponsorships: boolean; sponsorshipGoalSpots: string; showSponsorshipProgress: boolean;
}
const blankDraft = (location = ""): EventDraft => ({
@@ -786,6 +787,7 @@ const blankDraft = (location = ""): EventDraft => ({
consentCollectMedical: true, consentCollectEmergency: true, consentCollectPhoto: true,
waitlistEnabled: false, waitlistOfferHours: "24", waitlistPartialOffers: true,
allowTicketTransfer: true, collectGender: false,
allowSponsorships: false, sponsorshipGoalSpots: "", showSponsorshipProgress: true,
});
const blankOptions = (): OptionDraft[] => [
@@ -826,6 +828,7 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
waitlistEnabled: !!ev.waitlistEnabled, waitlistOfferHours: String(ev.waitlistOfferHours ?? 24), waitlistPartialOffers: ev.waitlistPartialOffers !== false,
allowTicketTransfer: ev.allowTicketTransfer !== false,
collectGender: !!ev.collectGender,
allowSponsorships: !!ev.allowSponsorships, sponsorshipGoalSpots: ev.sponsorshipGoalSpots ? String(ev.sponsorshipGoalSpots) : "", showSponsorshipProgress: ev.showSponsorshipProgress !== false,
contactName: ev.contactName || "", contactPhone: ev.contactPhone || "", contactEmail: ev.contactEmail || "",
location: ev.location || "",
} : blankDraft(settings.org_address || ""));
@@ -1108,6 +1111,9 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
waitlistEnabled: draft.waitlistEnabled,
allowTicketTransfer: draft.allowTicketTransfer,
collectGender: draft.collectGender,
allowSponsorships: draft.allowSponsorships,
sponsorshipGoalSpots: draft.allowSponsorships && draft.sponsorshipGoalSpots ? parseInt(draft.sponsorshipGoalSpots, 10) || null : null,
showSponsorshipProgress: draft.showSponsorshipProgress,
waitlistOfferHours: parseInt(draft.waitlistOfferHours, 10) || 24,
waitlistPartialOffers: draft.waitlistPartialOffers,
contactName: draft.contactName || undefined,
@@ -1403,6 +1409,27 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
)}
</div>
<div className="border rounded-lg p-4 bg-gray-50 space-y-3">
<div className="text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1">Sponsor a spot</div>
<label className="flex items-start gap-2 text-sm cursor-pointer">
<input type="checkbox" className="mt-0.5" checked={draft.allowSponsorships} onChange={e => upd({ allowSponsorships: e.target.checked })} />
<span><strong>Allow sponsorships</strong> — a &quot;Sponsor a spot&quot; button on the event page lets people pay for spots (or any amount) for those who can&apos;t afford to come. The money goes into a sponsorship pool you assign under Payments → Donations</span>
</label>
{draft.allowSponsorships && (
<>
<label className="flex items-center gap-2 text-sm">
Goal
<input type="number" min="1" className="border rounded px-2 py-1 text-sm w-20" value={draft.sponsorshipGoalSpots} onChange={e => upd({ sponsorshipGoalSpots: e.target.value })} placeholder="—" />
spots (optional)
</label>
<label className="flex items-start gap-2 text-sm cursor-pointer">
<input type="checkbox" className="mt-0.5" checked={draft.showSponsorshipProgress} onChange={e => upd({ showSponsorshipProgress: e.target.checked })} />
<span>Show progress on the event page (&quot;12 of 20 spots sponsored&quot;)</span>
</label>
</>
)}
</div>
<div className="border rounded-lg p-4 bg-gray-50 space-y-3">
<div className="text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1">Ticket transfer</div>
<label className="flex items-start gap-2 text-sm cursor-pointer">
@@ -832,7 +832,7 @@ function PaymentsContent() {
return (
<li key={p.id} className={`border rounded p-2 ${isRefund ? 'bg-red-50' : ''}`}>
<div className="flex justify-between">
<div className={`font-medium ${isRefund ? 'text-red-700' : ''}`}>{isRefund ? '-' : ''}R {Math.abs(amt).toFixed(2)} {p.isDonation ? <span className="text-xs text-emerald-700">(donation)</span> : null} {isRefund ? <span className="text-xs text-red-700">(refund)</span> : null}</div>
<div className={`font-medium ${isRefund ? 'text-red-700' : ''}`}>{isRefund ? '-' : ''}R {Math.abs(amt).toFixed(2)} {p.isDonation ? <span className="text-xs text-emerald-700">({p.isSponsorship ? 'sponsorship' : 'donation'})</span> : null} {isRefund ? <span className="text-xs text-red-700">(refund)</span> : null}</div>
<div className="text-xs text-gray-500">{new Date(p.createdAt).toLocaleString()}</div>
</div>
<div className="text-xs text-gray-600">Method: {p.method || 'payment'}</div>
@@ -1171,6 +1171,7 @@ function DonationAssignSection({ payments, allUsers, registrations, regOutstandi
const [paymentId, setPaymentId] = useState<string>("");
const [amountStr, setAmountStr] = useState<string>("");
const [assigning, setAssigning] = useState(false);
const [sponsorshipsOnly, setSponsorshipsOnly] = useState(false);
const [err, setErr] = useState<string | null>(null);
useEffect(() => { setRegistrationId(""); setPaymentId(""); }, [userId]);
@@ -1219,10 +1220,11 @@ function DonationAssignSection({ payments, allUsers, registrations, regOutstandi
return payments.filter((p: any) => {
if (!p.isDonation || p.registrationId) return false;
if (String(p.eventId) !== String(eventId)) return false;
if (sponsorshipsOnly && !p.isSponsorship) return false;
const remaining = (p.amount || 0) - (legsById.get(p.id) || 0);
return remaining > 0.000001;
});
}, [payments, selectedRegistration, legsById]);
}, [payments, selectedRegistration, legsById, sponsorshipsOnly]);
const selectedDonation = useMemo(
() => payments.find((p: any) => String(p.id) === String(paymentId)),
@@ -1306,12 +1308,19 @@ function DonationAssignSection({ payments, allUsers, registrations, regOutstandi
<option value="">Select donation…</option>
{donationsForEvent.map((p: any) => {
const remaining = (p.amount || 0) - (legsById.get(p.id) || 0);
const label = `R ${remaining.toFixed(2)} of R ${(p.amount || 0).toFixed(2)} left — ${p.user?.name || p.userId || 'Donor'} — #${String(p.id).slice(0,8)}`;
const donor = p.isSponsorship ? `Sponsorship: ${p.sponsorAnonymous ? 'anonymous' : (p.sponsorName || p.user?.name || 'sponsor')}` : (p.user?.name || p.userId || 'Donor');
const label = `R ${remaining.toFixed(2)} of R ${(p.amount || 0).toFixed(2)} left — ${donor} — #${String(p.id).slice(0,8)}`;
return <option key={p.id} value={p.id} title={label}>{label}</option>;
})}
</select>
<label className="flex items-center gap-2 text-xs text-gray-600 cursor-pointer">
<input type="checkbox" checked={sponsorshipsOnly} onChange={e => { setSponsorshipsOnly(e.target.checked); setPaymentId(""); }} /> Only the sponsorship pool
</label>
{registrationId && donationsForEvent.length === 0 && (
<div className="text-xs text-gray-500">No donations with a remaining balance for this event.</div>
<div className="text-xs text-gray-500">No {sponsorshipsOnly ? "sponsorships" : "donations"} with a remaining balance for this event.</div>
)}
{selectedDonation?.isSponsorship && selectedDonation.sponsorMessage && (
<div className="text-xs text-rose-800 bg-rose-50 rounded p-2">Sponsor&apos;s message: “{selectedDonation.sponsorMessage}”</div>
)}
{selectedDonation && (
@@ -6,6 +6,7 @@ import ClientActions from "@/app/events/[id]/ClientActions";
import { ContactButton } from "@/components/events/ContactButton";
import { LocationMap } from "@/components/events/LocationMap";
import { JoinWaitlistButton, soldOutLines } from "@/components/events/JoinWaitlistButton";
import { SponsorSpot } from "@/components/events/SponsorSpot";
import { Calendar, Ticket, Paperclip, Sparkles } from "lucide-react";
export const revalidate = 60;
@@ -42,6 +43,7 @@ type Event = {
contactEmail?: string | null;
location?: string | null;
waitlistEnabled?: boolean;
allowSponsorships?: boolean;
};
import { apiFetch, ApiError, resolveToApiOrigin } from "@/lib/api";
@@ -222,6 +224,7 @@ export default async function EventDetailPage({ params }: { params: Promise<{ id
<div className="mt-4">
<RegisterCta event={event} />
</div>
{event.allowSponsorships && <SponsorSpot eventId={event.id} eventTitle={event.title} />}
</div>
</div>
@@ -235,6 +238,7 @@ export default async function EventDetailPage({ params }: { params: Promise<{ id
<div className="mt-4">
<RegisterCta event={event} />
</div>
{event.allowSponsorships && <SponsorSpot eventId={event.id} eventTitle={event.title} />}
</div>
</div>
</div>
@@ -0,0 +1,146 @@
"use client";
import React, { useEffect, useState } from "react";
import { HeartHandshake, X } from "lucide-react";
import { apiFetch } from "@/lib/api";
import { useAuth } from "@/hooks/useAuth";
type Sponsorship = { enabled: boolean; open?: boolean; spotPrice?: number | null; showProgress?: boolean; goalSpots?: number | null; spotsFunded?: number | null; sponsors?: number | null };
const inputCls = "w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-400";
const rand = (n: number) => `R${n.toLocaleString("en-ZA", { minimumFractionDigits: n % 1 ? 2 : 0, maximumFractionDigits: 2 })}`;
/**
* "Sponsor a spot": progress towards the event's sponsorship goal, and a form to fund
* one or more spots (or any amount) for people who can't afford to come. Payment is
* through Yoco; the money lands in the event's sponsorship pool.
*/
export function SponsorSpot({ eventId, eventTitle }: { eventId: string; eventTitle: string }) {
const { token, user } = useAuth();
const [data, setData] = useState<Sponsorship | null>(null);
const [open, setOpen] = useState(false);
const [mode, setMode] = useState<"spots" | "amount">("spots");
const [spots, setSpots] = useState(1);
const [amount, setAmount] = useState("");
const [anonymous, setAnonymous] = useState(false);
const [sponsorName, setSponsorName] = useState("");
const [message, setMessage] = useState("");
const [guest, setGuest] = useState({ name: "", email: "" });
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [returned, setReturned] = useState<string | null>(null);
useEffect(() => {
apiFetch<Sponsorship>(`/api/sponsorships/event/${encodeURIComponent(eventId)}`).then(setData).catch(() => setData(null));
try {
const s = new URLSearchParams(window.location.search).get("sponsored");
if (s) setReturned(s);
} catch { /* no window */ }
}, [eventId]);
if (!data?.enabled) return null;
const price = data.spotPrice || null;
const loggedIn = !!(token && user);
const total = mode === "spots" && price ? spots * price : Number(amount) || 0;
const goal = data.goalSpots || 0;
const funded = data.spotsFunded ?? 0;
const submit = async (e: React.FormEvent) => {
e.preventDefault();
setBusy(true);
setError(null);
try {
const res = await apiFetch<{ redirectUrl: string }>("/api/sponsorships/checkout", {
method: "POST",
...(loggedIn ? { authToken: token! } : {}),
body: {
eventId,
...(mode === "spots" && price ? { spots } : { amount: Number(amount) }),
anonymous,
...(!anonymous && sponsorName.trim() ? { sponsorName: sponsorName.trim() } : {}),
...(message.trim() ? { message: message.trim() } : {}),
...(!loggedIn ? { name: guest.name, email: guest.email } : {}),
},
});
window.location.href = res.redirectUrl;
} catch (err: any) {
setError(err?.message || "Couldn't start the payment");
setBusy(false);
}
};
return (
<div className="mt-4 border-t pt-4 space-y-2">
{returned === "1" && <div className="text-sm rounded-lg bg-green-50 text-green-800 p-2">Thank you for sponsoring! Your receipt is on its way.</div>}
{returned === "failed" && <div className="text-sm rounded-lg bg-red-50 text-red-800 p-2">The payment didn&apos;t go through. You can try again.</div>}
{data.showProgress && price && (goal > 0 || funded > 0) && (
<div>
<div className="flex justify-between text-xs text-gray-600 mb-1">
<span>{goal > 0 ? `${Math.min(funded, goal)} of ${goal} spots sponsored` : `${funded} spot${funded === 1 ? "" : "s"} sponsored`}</span>
{data.sponsors ? <span>{data.sponsors} sponsor{data.sponsors === 1 ? "" : "s"}</span> : null}
</div>
{goal > 0 && (
<div className="h-2 rounded-full bg-gray-100 overflow-hidden" role="progressbar" aria-valuemin={0} aria-valuemax={goal} aria-valuenow={Math.min(funded, goal)}>
<div className="h-full bg-rose-500" style={{ width: `${Math.min(100, (funded / goal) * 100)}%` }} />
</div>
)}
</div>
)}
{data.open && (
<button onClick={() => setOpen(true)} className="w-full inline-flex items-center justify-center gap-2 border border-rose-300 text-rose-700 px-4 py-2 rounded-lg hover:bg-rose-50 font-medium text-sm">
<HeartHandshake className="w-4 h-4" /> Sponsor a spot
</button>
)}
{open && (
<div className="fixed inset-0 bg-black/40 flex items-center justify-center z-50" onClick={() => setOpen(false)}>
<form onSubmit={submit} className="bg-white rounded-xl shadow-lg max-w-md w-full mx-4 p-5 space-y-3 max-h-[90vh] overflow-y-auto" onClick={e => e.stopPropagation()}>
<div className="flex items-center justify-between">
<h3 className="text-lg font-semibold flex items-center gap-2"><HeartHandshake className="w-5 h-5 text-rose-600" /> Sponsor a spot</h3>
<button type="button" onClick={() => setOpen(false)} aria-label="Close" className="p-1 rounded hover:bg-gray-100"><X className="w-4 h-4" /></button>
</div>
<p className="text-sm text-gray-600">Help someone come to {eventTitle} who couldn&apos;t otherwise afford it. Your gift goes into a sponsorship pool that the organisers use to cover places.</p>
{price ? (
<div className="flex gap-2 text-sm">
<button type="button" onClick={() => setMode("spots")} className={`flex-1 px-3 py-1.5 rounded-lg border ${mode === "spots" ? "bg-rose-600 text-white border-rose-600" : "hover:bg-gray-50"}`}>Whole spots</button>
<button type="button" onClick={() => setMode("amount")} className={`flex-1 px-3 py-1.5 rounded-lg border ${mode === "amount" ? "bg-rose-600 text-white border-rose-600" : "hover:bg-gray-50"}`}>Any amount</button>
</div>
) : null}
{mode === "spots" && price ? (
<div className="flex items-center gap-2 text-sm">
<input type="number" min={1} max={100} className={`${inputCls} w-24`} value={spots} onChange={e => setSpots(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1)))} aria-label="Number of spots" />
<span>spot{spots === 1 ? "" : "s"} × {rand(price)} = <strong>{rand(spots * price)}</strong></span>
</div>
) : (
<div>
<label className="block text-xs text-gray-600 mb-1">Amount (R)</label>
<input type="number" min={15} step="0.01" className={inputCls} value={amount} onChange={e => setAmount(e.target.value)} placeholder="e.g. 200" required />
<p className="text-xs text-gray-500 mt-1">Minimum R15.</p>
</div>
)}
{!loggedIn && (
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
<input className={inputCls} placeholder="Your name" value={guest.name} onChange={e => setGuest({ ...guest, name: e.target.value })} required />
<input type="email" className={inputCls} placeholder="Email (for your receipt)" value={guest.email} onChange={e => setGuest({ ...guest, email: e.target.value })} required />
</div>
)}
<label className="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" checked={anonymous} onChange={e => setAnonymous(e.target.checked)} /> Give anonymously
</label>
{!anonymous && (
<input className={inputCls} placeholder={`Name to show the organisers (e.g. "The Smith family")`} value={sponsorName} onChange={e => setSponsorName(e.target.value)} maxLength={100} />
)}
<textarea className={inputCls} rows={2} placeholder="A message for the organisers (optional)" value={message} onChange={e => setMessage(e.target.value)} maxLength={300} />
<p className="text-xs text-gray-500">You&apos;ll get a receipt by email. We never share who is helped by sponsorships.</p>
{error && <div className="p-2 rounded bg-red-50 text-red-800 text-sm">{error}</div>}
<button type="submit" disabled={busy || !(total >= 15)} className="w-full px-4 py-2 rounded-lg bg-rose-600 text-white hover:bg-rose-700 disabled:opacity-50 font-medium">
{busy ? "Opening payment…" : `Pay ${total > 0 ? rand(total) : ""} securely`}
</button>
</form>
</div>
)}
</div>
);
}
@@ -970,7 +970,10 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
const used = dons.reduce((s: number, p: any) => s + usedFor(evId, p.id), 0);
const unused = Math.max(total - used, 0);
grandTotal += total; grandUsed += used;
rows.push([ev?.title || evId, Number(total.toFixed(2)), Number(used.toFixed(2)), Number(unused.toFixed(2)), dons.length]);
const pool = dons.filter((p: any) => p.isSponsorship);
const poolIn = pool.reduce((s: number, p: any) => s + (p.amount || 0), 0);
const poolUsed = pool.reduce((s: number, p: any) => s + usedFor(evId, p.id), 0);
rows.push([ev?.title || evId, Number(total.toFixed(2)), Number(used.toFixed(2)), Number(unused.toFixed(2)), dons.length, Number(poolIn.toFixed(2)), Number(poolUsed.toFixed(2)), Number(Math.max(poolIn - poolUsed, 0).toFixed(2))]);
});
const grandUnused = Math.max(grandTotal - grandUsed, 0);
return {
@@ -981,7 +984,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
{ label: 'Unused', value: `R ${grandUnused.toFixed(2)}`, tone: 'amber' },
],
chart: { title: 'Used vs. unused, across all selected events', data: [{ label: "Used", value: grandUsed, displayValue: `R ${grandUsed.toFixed(2)}` }, { label: "Unused", value: grandUnused, displayValue: `R ${grandUnused.toFixed(2)}` }] },
table: { columns: ["Event", "Donations (R)", "Used (R)", "Unused (R)", "Count"], rows }
table: { columns: ["Event", "Donations (R)", "Used (R)", "Unused (R)", "Count", "Sponsorship pool (R)", "Pool assigned (R)", "Pool remaining (R)"], rows }
};
}
if (report === "consentStatus") {
@@ -1775,7 +1778,10 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
const used = dons.reduce((s: number, p: any) => s + usedFor(evId, p.id), 0);
const unused = Math.max(total - used, 0);
grandTotal += total; grandUsed += used; grandCount += dons.length;
return { evId, title: ev?.title || evId, total, used, unused, count: dons.length };
const pool = dons.filter((p: any) => p.isSponsorship);
const poolIn = pool.reduce((s: number, p: any) => s + (p.amount || 0), 0);
const poolUsed = pool.reduce((s: number, p: any) => s + usedFor(evId, p.id), 0);
return { evId, title: ev?.title || evId, total, used, unused, count: dons.length, poolIn, poolUsed, poolLeft: Math.max(poolIn - poolUsed, 0) };
});
const grandUnused = Math.max(grandTotal - grandUsed, 0);
return (
@@ -1799,6 +1805,9 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
<th className="py-2 px-3 text-right">Unused (R)</th>
<th className="py-2 px-3 text-right">Count</th>
<th className="py-2 px-3 text-right">Avg (R)</th>
<th className="py-2 px-3 text-right">Sponsorship pool (R)</th>
<th className="py-2 px-3 text-right">Pool assigned (R)</th>
<th className="py-2 px-3 text-right">Pool remaining (R)</th>
</tr>
</thead>
<tbody>
@@ -1810,6 +1819,9 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
<td className="py-2 px-3 text-right">R {row.unused.toFixed(2)}</td>
<td className="py-2 px-3 text-right">{row.count}</td>
<td className="py-2 px-3 text-right">{row.count ? `R ${(row.total / row.count).toFixed(2)}` : '-'}</td>
<td className="py-2 px-3 text-right">R {row.poolIn.toFixed(2)}</td>
<td className="py-2 px-3 text-right">R {row.poolUsed.toFixed(2)}</td>
<td className="py-2 px-3 text-right">R {row.poolLeft.toFixed(2)}</td>
</tr>
))}
<tr className="font-semibold bg-gray-50 border-t border-gray-200">
@@ -1819,6 +1831,9 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
<td className="py-2 px-3 text-right">R {grandUnused.toFixed(2)}</td>
<td className="py-2 px-3 text-right">{grandCount}</td>
<td className="py-2 px-3"></td>
<td className="py-2 px-3 text-right">R {perEvent.reduce((s, r) => s + r.poolIn, 0).toFixed(2)}</td>
<td className="py-2 px-3 text-right">R {perEvent.reduce((s, r) => s + r.poolUsed, 0).toFixed(2)}</td>
<td className="py-2 px-3 text-right">R {perEvent.reduce((s, r) => s + r.poolLeft, 0).toFixed(2)}</td>
</tr>
</tbody>
</table>
@@ -1,5 +1,5 @@
import React from "react";
import { Ticket, Tag, Share2, QrCode, Calendar, Users } from "lucide-react";
import { Ticket, Tag, Share2, QrCode, Calendar, Users, HeartHandshake } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
@@ -25,6 +25,9 @@ export const eventDetailHelpContent: HelpContent = {
<GuideItem icon={Ticket} title="Availability badges" tone="brand">
&quot;N remaining&quot; appears once stock runs low, and &quot;Sold out&quot; once an option is fully booked. Some events have a waitlist: tap &quot;Join waitlist&quot; and you&apos;ll be emailed or WhatsApped a link to claim a place if one opens up (it&apos;s held for you for a limited time).
</GuideItem>
<GuideItem icon={HeartHandshake} title="Sponsor a spot" tone="rose">
Some events let you pay for a place for someone who can&apos;t afford it. Tap &quot;Sponsor a spot&quot;, choose one or more spots (or any amount), and pay securely with Yoco. You can give anonymously or add a name and a message for the organisers. You&apos;ll get a receipt, and who is helped is never shared.
</GuideItem>
<GuideItem icon={Users} title="Registering for other people?" tone="violet">
Some events let you name each person you&apos;re booking for. Each named person gets their own ticket and their own attendee form, and you can choose to have every ticket sent to you or each person their own. On youth events, you&apos;ll give each person&apos;s date of birth; for anyone under 18, their parent or guardian is asked to give consent by email and WhatsApp before they can be checked in.
</GuideItem>
@@ -22,7 +22,7 @@ export const supervisorPaymentsHelpContent: HelpContent = {
Refund a specific payment or a registration — pick the user, target, amount and method, and a reason.
</GuideItem>
<GuideItem icon={HandHeart} title="Donations" tone="rose">
Assign an unassigned donation to a registration with an outstanding balance. Donations can be partially allocated, leaving the remainder available for another registration.
Assign an unassigned donation to a registration with an outstanding balance. Donations can be partially allocated, leaving the remainder available for another registration. Money from &quot;Sponsor a spot&quot; is marked as a sponsorship. Tick &quot;Only the sponsorship pool&quot; to assign just those, and you&apos;ll see the sponsor&apos;s message. The Donations breakdown report shows each event&apos;s pool: received, assigned and remaining.
</GuideItem>
<GuideItem icon={ScanLine} title="Reconcile" tone="green">
Match unreconciled Yoco card transactions to a registration, log them as a donation, or ignore them.