Feedback page: results, responses, who hasn't answered, reminders (2.1.0)
- Supervisor -> Feedback (supervisors and admins, campus-scoped): every event's form with answered of asked, response rate, average rating and last reminder; per event the results per question (with the AI summary), each response, and on named forms who was asked and who has answered. - Remind those who haven't answered (or one person on a named form): a fresh link, plus the form to anyone eligible who hasn't had it; nobody gets the form or a reminder twice within 24 hours. The 3-day job is unchanged. - Anonymous forms show no names and no list of who has answered. - FeedbackInvite.reminderCount (migration 20261103120000_feedback_reminders); access log action feedback_responses; help page; dashboard and Ctrl+K links. - Roadmap: the AI helpers on the privacy pages are dropped; 2.1.0 is the feedback page. - Tests: tests/feedbackPage.test.ts, e2e/feedback.spec.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "hope-events-frontend",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "hope-events-frontend",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@hookform/resolvers": "^5.2.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hope-events-frontend",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useVisiblePolling } from "@/hooks/useVisiblePolling";
|
||||
import {
|
||||
Calendar, Banknote, Gift, Users, Ticket, QrCode, ClipboardList,
|
||||
UserPlus, FileText, MessageCircle, BarChart2, Mail, Wallet, DoorOpen, History, TicketPercent, ShieldCheck, ListChecks, WifiOff, BedDouble, Filter, ClipboardCheck, Inbox,
|
||||
Baby, HandHeart, Layers, Wrench,
|
||||
Baby, HandHeart, Layers, MessageSquareHeart, Wrench,
|
||||
} from "lucide-react";
|
||||
import { StatCard, StatCardRow } from "@/components/shared/StatCard";
|
||||
import { QuickActionTile, QuickActionGrid } from "@/components/shared/QuickActionTile";
|
||||
@@ -38,6 +38,7 @@ const QUICK_ACTIONS = [
|
||||
{ href: "/dashboard/staff/kids", label: "Kids check-in", description: "Check children in and out with pickup codes", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/kids", label: "Kids check-in setup", description: "Switch it on for an event and set up the rooms", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/volunteers", label: "Volunteer rosters", description: "Serving roles, who serves where, check-ins and hours", icon: HandHeart },
|
||||
{ href: "/dashboard/supervisor/feedback", label: "Feedback", description: "What people said after events, and reminders", icon: MessageSquareHeart },
|
||||
{ href: "/dashboard/supervisor/offline-scans", label: "Offline scanning", description: "Devices scanning offline and their synced scans", icon: WifiOff },
|
||||
{ href: "/dashboard/supervisor/attendance", label: "Attendance", description: "Who came to each session, and certificates", icon: ClipboardCheck },
|
||||
{ href: "/dashboard/supervisor/waitlist", label: "Waitlist", description: "People waiting for sold-out tickets", icon: ListChecks },
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
"use client";
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft, BellRing, MessageSquareHeart, Pencil, Send, Star } from "lucide-react";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useDismissingState } from "@/hooks/useDismissingState";
|
||||
import { apiV2Data, type V2Result } from "@/lib/apiV2";
|
||||
import { errorMessage } from "@/lib/utils";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
import { BackLink } from "@/components/shared/BackLink";
|
||||
import { AiFeedbackSummary } from "@/components/reports/AiFeedbackSummary";
|
||||
|
||||
type Row = V2Result<"/feedback", "get">["data"][number];
|
||||
type Detail = V2Result<"/events/{id}/feedback/results", "get">["data"];
|
||||
type Question = Detail["questions"][number];
|
||||
type Person = NonNullable<Detail["people"]>[number];
|
||||
type Tab = "results" | "responses" | "people";
|
||||
type Show = "all" | "sent" | "waiting";
|
||||
|
||||
// Dates arrive as ISO strings (the generated types call them unknown).
|
||||
const fmt = (d: unknown, time = true) =>
|
||||
typeof d === "string" || d instanceof Date ? new Date(d).toLocaleString("en-ZA", { day: "numeric", month: "short", year: "numeric", ...(time ? { hour: "2-digit", minute: "2-digit" } : {}) }) : "—";
|
||||
const plural = (n: number, one: string, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
||||
|
||||
const STATUS: Record<Row["status"], { label: string; cls: string }> = {
|
||||
sent: { label: "Sent", cls: "bg-green-50 text-green-700 border-green-200" },
|
||||
scheduled: { label: "Scheduled", cls: "bg-blue-50 text-blue-700 border-blue-200" },
|
||||
not_scheduled: { label: "No send time", cls: "bg-gray-50 text-gray-600 border-gray-200" },
|
||||
};
|
||||
const StatusBadge = ({ status }: { status: Row["status"] }) => (
|
||||
<span className={`inline-block rounded-full border px-2 py-0.5 text-xs font-medium ${STATUS[status].cls}`}>{STATUS[status].label}</span>
|
||||
);
|
||||
const Stars = ({ value }: { value: number | null | undefined }) =>
|
||||
value == null ? <span className="text-gray-400">—</span> : <span className="inline-flex items-center gap-1 tabular-nums"><Star className="h-3.5 w-3.5 fill-amber-400 text-amber-400" aria-hidden />{value.toFixed(1)}</span>;
|
||||
|
||||
/** A horizontal bar per choice (or star), with its count. */
|
||||
function Bars({ items, total }: { items: { label: string; value: number }[]; total: number }) {
|
||||
return (
|
||||
<ul className="space-y-1.5">
|
||||
{items.map(i => (
|
||||
<li key={i.label} className="grid grid-cols-[minmax(3rem,8rem)_1fr_3rem] items-center gap-2 text-sm">
|
||||
<span className="truncate text-gray-700" title={i.label}>{i.label}</span>
|
||||
<span className="h-2.5 rounded-full bg-gray-100"><span className="block h-2.5 rounded-full bg-brand-500" style={{ width: `${total ? (i.value / total) * 100 : 0}%` }} /></span>
|
||||
<span className="text-right tabular-nums text-gray-600">{i.value}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
function QuestionResult({ q }: { q: Question }) {
|
||||
return (
|
||||
<section className="rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="mb-3 flex flex-wrap items-baseline justify-between gap-2">
|
||||
<h3 className="font-medium text-gray-900">{q.label}</h3>
|
||||
<span className="text-xs text-gray-500">{plural(q.answered, "answer")}</span>
|
||||
</div>
|
||||
{q.type === "rating" && (
|
||||
<div className="grid gap-4 sm:grid-cols-[auto_1fr] sm:items-center">
|
||||
<div className="text-center"><div className="text-3xl font-semibold tabular-nums">{q.average != null ? q.average.toFixed(1) : "—"}</div><div className="text-xs text-gray-500">out of 5</div></div>
|
||||
<Bars items={[...(q.distribution || [])].reverse()} total={q.answered} />
|
||||
</div>
|
||||
)}
|
||||
{q.counts && <Bars items={q.counts} total={q.answered} />}
|
||||
{q.type === "numeric" && <p className="text-sm">Average: <strong className="tabular-nums">{q.average ?? "—"}</strong></p>}
|
||||
{q.texts && (q.texts.length === 0 ? <p className="text-sm text-gray-500">No answers yet.</p> : (
|
||||
<ul className="max-h-96 space-y-2 overflow-y-auto pr-1">
|
||||
{q.texts.map((t, i) => (
|
||||
<li key={i} className="rounded-lg bg-gray-50 px-3 py-2 text-sm text-gray-800">
|
||||
<p className="whitespace-pre-wrap">{t.value}</p>
|
||||
{t.name && <p className="mt-1 text-xs text-gray-500">— {t.name}</p>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** Supervisor → Feedback: every event's feedback, one event's results and answers, and reminders. */
|
||||
export default function FeedbackPage() {
|
||||
const { token } = useAuth();
|
||||
const [rows, setRows] = useState<Row[] | null>(null);
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [detail, setDetail] = useState<Detail | null>(null);
|
||||
const [tab, setTab] = useState<Tab>("results");
|
||||
const [search, setSearch] = useState("");
|
||||
const [show, setShow] = useState<Show>("all");
|
||||
const [busy, setBusy] = useState<string | null>(null);
|
||||
const [msg, setMsg] = useDismissingState<{ type: "ok" | "err"; text: string } | null>(null);
|
||||
|
||||
const loadList = useCallback(async () => {
|
||||
if (!token) return;
|
||||
try {
|
||||
setRows(await (apiV2Data("get", "/feedback", { authToken: token }) as Promise<Row[]>));
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not load feedback" });
|
||||
}
|
||||
}, [token, setMsg]);
|
||||
useExternalEffect(() => { loadList(); }, [loadList]);
|
||||
|
||||
// ?event=<id> opens that event (links from elsewhere, and the back button).
|
||||
useEffect(() => {
|
||||
const read = () => setEventId(new URLSearchParams(window.location.search).get("event") || "");
|
||||
read();
|
||||
window.addEventListener("popstate", read);
|
||||
return () => window.removeEventListener("popstate", read);
|
||||
}, []);
|
||||
const open = (id: string) => {
|
||||
window.history.pushState(null, "", id ? `?event=${encodeURIComponent(id)}` : window.location.pathname);
|
||||
setEventId(id);
|
||||
setTab("results");
|
||||
};
|
||||
|
||||
const loadDetail = useCallback(async () => {
|
||||
if (!token || !eventId) { setDetail(null); return; }
|
||||
try {
|
||||
setDetail(await (apiV2Data("get", "/events/{id}/feedback/results", { params: { id: eventId }, authToken: token }) as Promise<Detail>));
|
||||
} catch (e) {
|
||||
setDetail(null);
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not load this event's feedback" });
|
||||
}
|
||||
}, [token, eventId, setMsg]);
|
||||
useExternalEffect(() => { setDetail(null); loadDetail(); }, [loadDetail]);
|
||||
|
||||
const remind = async (userIds?: string[]) => {
|
||||
if (!detail) return;
|
||||
const who = userIds ? detail.people?.find(p => p.userId === userIds[0])?.name || "this person" : null;
|
||||
const question = who
|
||||
? `Send ${who} a reminder with a new feedback link?`
|
||||
: `Remind ${plural(detail.counts.canRemind, "person", "people")} who haven't answered${detail.counts.waiting ? `, and send the form to ${plural(detail.counts.waiting, "person", "people")} who haven't had it yet` : ""}?`;
|
||||
if (!window.confirm(question)) return;
|
||||
setBusy(userIds ? userIds[0] : "all");
|
||||
try {
|
||||
const out = await (apiV2Data("post", "/events/{id}/feedback/remind", { params: { id: detail.event.id }, authToken: token, body: { userIds: userIds ?? null } }) as Promise<{ message: string; reminded: number; newlyInvited: number }>);
|
||||
setMsg({ type: out.reminded || out.newlyInvited ? "ok" : "err", text: out.message });
|
||||
await Promise.all([loadDetail(), loadList()]);
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not send the reminders" });
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const sendNow = async () => {
|
||||
if (!detail || !window.confirm("Send the feedback form now, instead of waiting for its send time?")) return;
|
||||
setBusy("send");
|
||||
try {
|
||||
const out = await (apiV2Data("post", "/events/{id}/feedback/send-now", { params: { id: detail.event.id }, authToken: token, body: {} }) as Promise<{ message: string }>);
|
||||
setMsg({ type: "ok", text: out.message });
|
||||
await Promise.all([loadDetail(), loadList()]);
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not send the form" });
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const shown = useMemo(() => (rows || []).filter(r =>
|
||||
(show === "all" || (show === "sent" ? r.status === "sent" : r.status !== "sent")) &&
|
||||
(!search.trim() || r.event.title.toLowerCase().includes(search.trim().toLowerCase()))), [rows, show, search]);
|
||||
|
||||
const message = msg && <div role="status" className={`mb-4 rounded-lg border p-3 text-sm ${msg.type === "ok" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-800"}`}>{msg.text}</div>;
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-5xl p-6">
|
||||
<div className="mb-5 flex items-center gap-3">
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-brand-50"><MessageSquareHeart className="h-5 w-5 text-brand-600" /></div>
|
||||
<div>
|
||||
<BackLink href="/dashboard" />
|
||||
<h1 className="mt-0.5 text-2xl font-semibold text-gray-900">Feedback</h1>
|
||||
<p className="text-sm text-gray-500">What people said after your events, and who still has to answer</p>
|
||||
</div>
|
||||
</div>
|
||||
{message}
|
||||
|
||||
{!eventId && (
|
||||
<>
|
||||
<div className="mb-4 flex flex-wrap items-end gap-3">
|
||||
<label className="text-sm">
|
||||
<span className="mb-1 block text-xs text-gray-500">Search</span>
|
||||
<input type="search" value={search} onChange={e => setSearch(e.target.value)} placeholder="Event name" className="w-64 max-w-full rounded-lg border px-3 py-2 text-sm" />
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="mb-1 block text-xs text-gray-500">Show</span>
|
||||
<select value={show} onChange={e => setShow(e.target.value as Show)} className="rounded-lg border px-3 py-2 text-sm">
|
||||
<option value="all">All forms</option>
|
||||
<option value="sent">Sent</option>
|
||||
<option value="waiting">Not sent yet</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{!rows && <p className="text-sm text-gray-500">Loading…</p>}
|
||||
{rows && rows.length === 0 && (
|
||||
<div className="rounded-xl border bg-white p-6 text-sm text-gray-600 shadow-sm">
|
||||
No event has a feedback form yet. Add one in the event editor's <strong>Feedback</strong> step (<Link className="text-brand-700 underline" href="/dashboard/supervisor/events">Manage events</Link>).
|
||||
</div>
|
||||
)}
|
||||
{rows && rows.length > 0 && shown.length === 0 && <p className="text-sm text-gray-500">No forms match.</p>}
|
||||
{shown.length > 0 && (
|
||||
<div className="overflow-x-auto rounded-xl border bg-white shadow-sm">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-gray-50 text-left text-xs text-gray-500">
|
||||
<tr><th className="p-3">Event</th><th className="p-3">Form</th><th className="p-3">Answered</th><th className="p-3">Rating</th><th className="p-3">Last reminder</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shown.map(r => (
|
||||
<tr key={r.event.id} className="cursor-pointer border-t hover:bg-gray-50" onClick={() => open(r.event.id)}>
|
||||
<td className="p-3">
|
||||
<button type="button" className="text-left font-medium text-gray-900 hover:text-brand-700" onClick={e => { e.stopPropagation(); open(r.event.id); }}>{r.event.title}</button>
|
||||
<div className="text-xs text-gray-500">{fmt(r.event.startDate, false)}{r.anonymous ? " · anonymous" : ""}</div>
|
||||
</td>
|
||||
<td className="p-3"><StatusBadge status={r.status} /><div className="mt-1 text-xs text-gray-500">{r.status === "sent" ? fmt(r.sentAt) : r.status === "scheduled" ? `Goes ${fmt(r.sendAt)}` : ""}</div></td>
|
||||
<td className="p-3 tabular-nums">{r.status === "sent" ? <>{r.answered} of {r.invited}{r.responseRate != null && <span className="text-gray-500"> ({r.responseRate}%)</span>}</> : <span className="text-gray-400">—</span>}</td>
|
||||
<td className="p-3"><Stars value={r.averageRating} /></td>
|
||||
<td className="p-3 text-gray-600">{r.lastReminderAt ? fmt(r.lastReminderAt) : "—"}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{eventId && (
|
||||
<>
|
||||
<button type="button" onClick={() => open("")} className="mb-3 inline-flex items-center gap-1 text-sm text-gray-600 hover:text-gray-900"><ArrowLeft className="h-4 w-4" /> All feedback</button>
|
||||
{!detail && <p className="text-sm text-gray-500">Loading…</p>}
|
||||
{detail && (
|
||||
<>
|
||||
<div className="mb-4 rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold text-gray-900">{detail.event.title}</h2>
|
||||
<p className="text-sm text-gray-500">{fmt(detail.event.startDate, false)} · {detail.form.audience === "all" ? "everyone registered" : "people who checked in"} · {detail.form.anonymous ? "anonymous answers" : "named answers"}</p>
|
||||
<p className="mt-1 text-sm text-gray-600">
|
||||
<StatusBadge status={detail.form.status} />{" "}
|
||||
{detail.form.status === "sent" && <>Sent {fmt(detail.form.sentAt)}. {detail.form.autoReminderSent ? "The automatic reminder has gone out." : `Automatic reminder ${fmt(detail.form.autoReminderAt)}.`}</>}
|
||||
{detail.form.status === "scheduled" && <>Goes out {fmt(detail.form.sendAt)}.</>}
|
||||
{detail.form.status === "not_scheduled" && <>No send time is set.</>}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{detail.form.status !== "sent" && (
|
||||
<button type="button" onClick={sendNow} disabled={!!busy} className="inline-flex items-center gap-1.5 rounded-lg bg-brand-600 px-3 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"><Send className="h-4 w-4" /> {busy === "send" ? "Sending…" : "Send now"}</button>
|
||||
)}
|
||||
{detail.form.status === "sent" && (
|
||||
<button type="button" onClick={() => remind()} disabled={!!busy || detail.counts.canRemind + detail.counts.waiting === 0}
|
||||
title={detail.counts.canRemind + detail.counts.waiting === 0 ? (detail.counts.notAnswered ? "Everyone who hasn't answered was sent the form or a reminder in the last 24 hours" : "Everyone has answered") : undefined}
|
||||
className="inline-flex items-center gap-1.5 rounded-lg bg-brand-600 px-3 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50">
|
||||
<BellRing className="h-4 w-4" /> {busy === "all" ? "Sending…" : detail.counts.canRemind + detail.counts.waiting ? `Remind ${detail.counts.canRemind + detail.counts.waiting} who haven't answered` : "Remind those who haven't answered"}
|
||||
</button>
|
||||
)}
|
||||
<Link href={`/dashboard/supervisor/events?edit=${encodeURIComponent(detail.event.id)}`} className="inline-flex items-center gap-1.5 rounded-lg border px-3 py-2 text-sm hover:bg-gray-50"><Pencil className="h-4 w-4" /> Edit form</Link>
|
||||
</div>
|
||||
</div>
|
||||
<dl className="mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4">
|
||||
{[
|
||||
["Asked", detail.counts.invited],
|
||||
["Answered", detail.counts.answered],
|
||||
["Response rate", detail.counts.responseRate != null ? `${detail.counts.responseRate}%` : "—"],
|
||||
["Average rating", detail.averageRating != null ? `${detail.averageRating.toFixed(1)} ★` : "—"],
|
||||
].map(([k, v]) => (
|
||||
<div key={String(k)} className="rounded-lg bg-gray-50 p-3"><dt className="text-xs text-gray-500">{k}</dt><dd className="text-xl font-semibold tabular-nums text-gray-900">{v}</dd></div>
|
||||
))}
|
||||
</dl>
|
||||
{detail.form.status === "sent" && (detail.counts.notAnswered > 0 || detail.counts.waiting > 0) && (
|
||||
<p className="mt-3 text-xs text-gray-500">
|
||||
{plural(detail.counts.notAnswered, "person hasn't", "people haven't")} answered
|
||||
{detail.counts.remindedRecently > 0 && ` (${detail.counts.remindedRecently} sent the form or a reminder in the last 24 hours)`}
|
||||
{detail.counts.waiting > 0 && `; ${plural(detail.counts.waiting, "person", "people")} can still be sent the form (e.g. checked in after it went out)`}.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mb-4 flex flex-wrap gap-1 border-b" role="tablist">
|
||||
{([["results", "Results"], ["responses", `Responses (${detail.responses.length})`], ...(detail.people ? [["people", `People (${detail.people.length})`]] : [])] as [Tab, string][]).map(([id, label]) => (
|
||||
<button key={id} role="tab" aria-selected={tab === id} onClick={() => setTab(id)} className={`-mb-px border-b-2 px-3 py-2 text-sm ${tab === id ? "border-brand-600 font-medium text-brand-700" : "border-transparent text-gray-500"}`}>{label}</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{tab === "results" && (
|
||||
<div className="space-y-4">
|
||||
<AiFeedbackSummary eventId={detail.event.id} responses={detail.responses.length} />
|
||||
{detail.responses.length === 0 && <p className="text-sm text-gray-500">No answers yet.</p>}
|
||||
{detail.responses.length > 0 && detail.questions.map(q => <QuestionResult key={q.fieldId} q={q} />)}
|
||||
{detail.form.anonymous && <p className="text-xs text-gray-500">This form is anonymous: answers aren't linked to anyone, and who has or hasn't answered isn't shown.</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === "responses" && (
|
||||
<div className="space-y-3">
|
||||
{detail.responses.length === 0 && <p className="text-sm text-gray-500">No answers yet.</p>}
|
||||
{detail.responses.map((r, i) => (
|
||||
<article key={r.id} className="rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="mb-2 flex flex-wrap justify-between gap-2 text-sm">
|
||||
<strong className="text-gray-900">{r.name ?? `Response ${detail.responses.length - i}`}</strong>
|
||||
<span className="text-gray-500">{fmt(r.createdAt)}</span>
|
||||
</div>
|
||||
<dl className="space-y-2 text-sm">
|
||||
{detail.fields.map(f => (
|
||||
<div key={f.id}>
|
||||
<dt className="text-xs text-gray-500">{f.label}</dt>
|
||||
<dd className="whitespace-pre-wrap text-gray-800">{r.answers[f.id] == null ? <span className="text-gray-400">—</span> : f.type === "rating" ? `${"★".repeat(Number(r.answers[f.id]))}${"☆".repeat(5 - Number(r.answers[f.id]))}` : f.type === "yes_no" ? (r.answers[f.id] === "yes" ? "Yes" : "No") : r.answers[f.id]}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === "people" && detail.people && (
|
||||
detail.people.length === 0 ? <p className="text-sm text-gray-500">The form hasn't been sent to anyone yet.</p> : (
|
||||
<div className="overflow-x-auto rounded-xl border bg-white shadow-sm">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-gray-50 text-left text-xs text-gray-500"><tr><th className="p-3">Person</th><th className="p-3">Sent</th><th className="p-3">Answered</th><th className="p-3">Reminders</th><th className="p-3" /></tr></thead>
|
||||
<tbody>
|
||||
{detail.people.map((p: Person) => (
|
||||
<tr key={p.userId} className="border-t">
|
||||
<td className="p-3"><div className="font-medium text-gray-900">{p.name}</div><div className="text-xs text-gray-500">{[p.email, p.phoneNumber].filter(Boolean).join(" · ") || "No contact details"}</div></td>
|
||||
<td className="p-3 text-gray-600">{fmt(p.sentAt)}</td>
|
||||
<td className="p-3">{p.respondedAt ? <span className="text-green-700">{fmt(p.respondedAt)}</span> : <span className="text-amber-700">Not yet</span>}</td>
|
||||
<td className="p-3 text-gray-600">{p.reminderCount ? <>{p.reminderCount} · last {fmt(p.remindedAt)}</> : "None"}</td>
|
||||
<td className="p-3 text-right">
|
||||
{!p.respondedAt && (
|
||||
<button type="button" onClick={() => remind([p.userId])} disabled={!!busy || !p.canRemind}
|
||||
title={p.canRemind ? undefined : "Sent the form or a reminder in the last 24 hours"}
|
||||
className="rounded-lg border px-2.5 py-1 text-xs hover:bg-gray-50 disabled:opacity-50">{busy === p.userId ? "Sending…" : "Remind"}</button>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { useVisiblePolling } from "@/hooks/useVisiblePolling";
|
||||
import {
|
||||
Calendar, Banknote, Gift, Users, Ticket, QrCode, DoorOpen, Wallet,
|
||||
UserPlus, FileText, MessageCircle, BarChart2, Mail, TicketPercent, ShieldCheck, ListChecks, WifiOff, BedDouble, Filter, ClipboardCheck,
|
||||
Baby, HandHeart, Layers,
|
||||
Baby, HandHeart, Layers, MessageSquareHeart,
|
||||
} from "lucide-react";
|
||||
import { StatCard, StatCardRow } from "@/components/shared/StatCard";
|
||||
import { QuickActionTile, QuickActionGrid } from "@/components/shared/QuickActionTile";
|
||||
@@ -35,6 +35,7 @@ const QUICK_ACTIONS = [
|
||||
{ href: "/dashboard/staff/kids", label: "Kids check-in", description: "Check children in and out with pickup codes", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/kids", label: "Kids check-in setup", description: "Switch it on for an event and set up the rooms", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/volunteers", label: "Volunteer rosters", description: "Serving roles, who serves where, check-ins and hours", icon: HandHeart },
|
||||
{ href: "/dashboard/supervisor/feedback", label: "Feedback", description: "What people said after events, and reminders", icon: MessageSquareHeart },
|
||||
{ href: "/dashboard/supervisor/offline-scans", label: "Offline scanning", description: "Devices scanning offline and their synced scans", icon: WifiOff },
|
||||
{ href: "/dashboard/supervisor/attendance", label: "Attendance", description: "Who came to each session, and certificates", icon: ClipboardCheck },
|
||||
{ href: "/dashboard/supervisor/waitlist", label: "Waitlist", description: "People waiting for sold-out tickets", icon: ListChecks },
|
||||
|
||||
@@ -38,6 +38,7 @@ import { userFormsHelpContent } from "./user-forms";
|
||||
import { kidsDeskHelpContent, kidsRoomsHelpContent, kidsSetupHelpContent, userKidsHelpContent } from "./kids";
|
||||
import { staffVolunteersHelpContent, userServingHelpContent, volunteerRostersHelpContent } from "./volunteers";
|
||||
import { seriesHelpContent } from "./series";
|
||||
import { supervisorFeedbackHelpContent } from "./supervisor-feedback";
|
||||
|
||||
type HelpRegistryEntry = {
|
||||
/** Unique, stable identifier for this guide. */
|
||||
@@ -194,6 +195,11 @@ const REGISTRY: HelpRegistryEntry[] = [
|
||||
matches: pathname => pathname === "/dashboard/supervisor/volunteers",
|
||||
content: volunteerRostersHelpContent,
|
||||
},
|
||||
{
|
||||
slug: "supervisor-feedback",
|
||||
matches: pathname => pathname === "/dashboard/supervisor/feedback",
|
||||
content: supervisorFeedbackHelpContent,
|
||||
},
|
||||
{
|
||||
slug: "staff-volunteers",
|
||||
matches: pathname => pathname === "/dashboard/staff/volunteers",
|
||||
|
||||
@@ -62,7 +62,7 @@ export const supervisorEventsHelpContent: HelpContent = {
|
||||
Upload downloadable files that appear on the public event page.
|
||||
</GuideItem>
|
||||
<GuideItem icon={MessageSquareHeart} title="Feedback" tone="violet">
|
||||
Send a feedback form automatically after the event: pick when (e.g. the morning after) and whether it goes to everyone who checked in or everyone registered. Questions can be star ratings, multiple choice, yes/no or text. Answers can be anonymous. Anyone who hasn't answered gets one reminder 3 days later. Results are in Reports → Feedback summary. Rating and multiple-choice questions can also be used on the attendee form.
|
||||
Send a feedback form automatically after the event: pick when (e.g. the morning after) and whether it goes to everyone who checked in or everyone registered. Questions can be star ratings, multiple choice, yes/no or text. Answers can be anonymous. Anyone who hasn't answered gets one reminder 3 days later. See the answers and remind people yourself on the Feedback page (Dashboard → Feedback); Reports → Feedback summary compares events. Rating and multiple-choice questions can also be used on the attendee form.
|
||||
</GuideItem>
|
||||
<GuideItem icon={ClipboardCheck} title="Attendance" tone="green">
|
||||
For multi-session events: late joining (until which session, and a full, pro-rata or fixed late price for main tickets — pro-rata rounds to the nearest R10), the check-in window (the whole day of a session, or only from 2 hours before it until it ends), and reminders before each session. For any event: completion certificates — four designs, your wording and signature, and who qualifies. "Preview certificate" shows a sample.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import React from "react";
|
||||
import { BellRing, EyeOff, ListChecks, MessageSquareHeart, Pencil, Sparkles, Star, Users } from "lucide-react";
|
||||
import { GuideItem } from "@/components/shared/GuideItem";
|
||||
import type { HelpContent } from "./types";
|
||||
|
||||
/** Help content for /dashboard/supervisor/feedback. */
|
||||
export const supervisorFeedbackHelpContent: HelpContent = {
|
||||
title: "Feedback",
|
||||
subtitle: "What people said after your events, and who still has to answer.",
|
||||
tabs: [
|
||||
{
|
||||
key: "results",
|
||||
label: "Results",
|
||||
icon: Star,
|
||||
content: (
|
||||
<div className="space-y-4">
|
||||
<p>Every event with a feedback form is listed, newest first: when the form went out (or goes out), how many answered and the average star rating. Open an event to see its feedback.</p>
|
||||
<GuideItem icon={Star} title="Results" tone="brand">
|
||||
Each question with its answers: the average and spread of star ratings, how many chose each option, and every written answer.
|
||||
</GuideItem>
|
||||
<GuideItem icon={ListChecks} title="Responses" tone="gray">
|
||||
Each person's answers together, newest first. On a named form you see who gave them; looking at them is recorded in the access log.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Sparkles} title="Summarise feedback" tone="amber">
|
||||
On sites with AI, "Summarise feedback" gives the main themes, what people liked and what to improve. The answers are sent without names.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Pencil} title="Changing the form" tone="gray">
|
||||
"Edit form" opens the event's Feedback step. Once someone has answered, the questions can't change.
|
||||
</GuideItem>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "reminders",
|
||||
label: "Reminders",
|
||||
icon: BellRing,
|
||||
content: (
|
||||
<div className="space-y-4">
|
||||
<p>Everyone who hasn't answered gets one reminder automatically, 3 days after the form goes out. You can remind people yourself too.</p>
|
||||
<GuideItem icon={BellRing} title="Remind those who haven't answered" tone="brand">
|
||||
Sends each of them a new link by email or WhatsApp. It also sends the form to anyone who can have it but hasn't yet, for example someone who checked in after it went out. Nobody gets the form or a reminder twice within 24 hours.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Users} title="People" tone="green">
|
||||
On a named form, the People tab shows who was asked, who has answered and the reminders each person has had, with a Remind button for one person.
|
||||
</GuideItem>
|
||||
<GuideItem icon={EyeOff} title="Anonymous forms" tone="gray">
|
||||
Answers aren't linked to anyone, and the page doesn't show who has or hasn't answered — on a small event that would give the answers away. You can still remind everyone who hasn't answered.
|
||||
</GuideItem>
|
||||
<GuideItem icon={MessageSquareHeart} title="Before it goes out" tone="amber">
|
||||
A form that hasn't gone out yet has a "Send now" button instead.
|
||||
</GuideItem>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -69230,6 +69230,791 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/feedback": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Feedback"
|
||||
],
|
||||
"summary": "Every event with a feedback form",
|
||||
"description": "Newest event first, with how many were asked and answered, and the average star rating.\n\n**Who:** Supervisors and admins.",
|
||||
"operationId": "getFeedback",
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"event": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startDate": {},
|
||||
"endDate": {}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"title",
|
||||
"startDate",
|
||||
"endDate"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sent",
|
||||
"scheduled",
|
||||
"not_scheduled"
|
||||
],
|
||||
"description": "sent, scheduled (a send time is set) or not_scheduled"
|
||||
},
|
||||
"sendAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sentAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"anonymous": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"invited": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"answered": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"responseRate": {
|
||||
"description": "%",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"averageRating": {
|
||||
"description": "Every star rating on the form, 1–5",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"lastReminderAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"event",
|
||||
"status",
|
||||
"sendAt",
|
||||
"sentAt",
|
||||
"anonymous",
|
||||
"invited",
|
||||
"answered",
|
||||
"responseRate",
|
||||
"averageRating",
|
||||
"lastReminderAt"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"data"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Not signed in (UNAUTHENTICATED)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Not allowed for this role (FORBIDDEN)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/events/{id}/feedback/results": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Feedback"
|
||||
],
|
||||
"summary": "An event's feedback: results, responses and who was asked",
|
||||
"description": "On an anonymous form, responses have no name and `people` is null. Opening a named form's answers is recorded in the access log.\n\n**Who:** Supervisors and admins.",
|
||||
"operationId": "getEventsIdFeedbackResults",
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "The id",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"event": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"startDate": {},
|
||||
"endDate": {}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"title",
|
||||
"startDate",
|
||||
"endDate"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"form": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sent",
|
||||
"scheduled",
|
||||
"not_scheduled"
|
||||
],
|
||||
"description": "sent, scheduled (a send time is set) or not_scheduled"
|
||||
},
|
||||
"sendAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sentAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"audience": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"checked_in",
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"anonymous": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"intro": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"autoReminderAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "When the automatic reminder goes (3 days after sending)"
|
||||
},
|
||||
"autoReminderSent": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status",
|
||||
"sendAt",
|
||||
"sentAt",
|
||||
"audience",
|
||||
"anonymous",
|
||||
"intro",
|
||||
"autoReminderAt",
|
||||
"autoReminderSent"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"counts": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"invited": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"answered": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"notAnswered": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"responseRate": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"canRemind": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991,
|
||||
"description": "Not answered, and not sent the form or a reminder in the last 24 hours"
|
||||
},
|
||||
"remindedRecently": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"waiting": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991,
|
||||
"description": "Would get the form but haven't been sent it yet (e.g. checked in after it went out)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"invited",
|
||||
"answered",
|
||||
"notAnswered",
|
||||
"responseRate",
|
||||
"canRemind",
|
||||
"remindedRecently",
|
||||
"waiting"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"averageRating": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"questions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fieldId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"answered": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"average": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"distribution": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"counts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"label",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"texts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"fieldId",
|
||||
"type",
|
||||
"label",
|
||||
"answered"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"type",
|
||||
"label"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"createdAt": {},
|
||||
"name": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"answers": {
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string"
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Question id → answer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"createdAt",
|
||||
"name",
|
||||
"answers"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"people": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"phoneNumber": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sentAt": {},
|
||||
"remindedAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"reminderCount": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"respondedAt": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"canRemind": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"userId",
|
||||
"name",
|
||||
"email",
|
||||
"phoneNumber",
|
||||
"sentAt",
|
||||
"remindedAt",
|
||||
"reminderCount",
|
||||
"respondedAt",
|
||||
"canRemind"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"event",
|
||||
"form",
|
||||
"counts",
|
||||
"averageRating",
|
||||
"questions",
|
||||
"fields",
|
||||
"responses",
|
||||
"people"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"data"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation failed (VALIDATION_FAILED)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Not signed in (UNAUTHENTICATED)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Not allowed for this role (FORBIDDEN)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found (NOT_FOUND)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/events/{id}/feedback/remind": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Feedback"
|
||||
],
|
||||
"summary": "Remind people who haven't answered",
|
||||
"description": "A fresh link to everyone who hasn't answered, or to `userIds` (named forms only). Nobody is sent the form or a reminder twice within 24 hours. Without `userIds` it also sends the form to anyone who has become eligible since it went out.\n\n**Who:** Supervisors and admins.",
|
||||
"operationId": "postEventsIdFeedbackRemind",
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "The id",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userIds": {
|
||||
"description": "Only these people (named forms)",
|
||||
"anyOf": [
|
||||
{
|
||||
"maxItems": 1000,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reminded": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"newlyInvited": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"skipped": {
|
||||
"type": "integer",
|
||||
"minimum": -9007199254740991,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"reminded",
|
||||
"newlyInvited",
|
||||
"skipped",
|
||||
"message"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"data"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation failed (VALIDATION_FAILED)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Not signed in (UNAUTHENTICATED)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Not allowed for this role (FORBIDDEN)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found (NOT_FOUND)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
|
||||
+341
@@ -7236,6 +7236,72 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/feedback": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* Every event with a feedback form
|
||||
* @description Newest event first, with how many were asked and answered, and the average star rating.
|
||||
*
|
||||
* **Who:** Supervisors and admins.
|
||||
*/
|
||||
get: operations["getFeedback"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/events/{id}/feedback/results": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* An event's feedback: results, responses and who was asked
|
||||
* @description On an anonymous form, responses have no name and `people` is null. Opening a named form's answers is recorded in the access log.
|
||||
*
|
||||
* **Who:** Supervisors and admins.
|
||||
*/
|
||||
get: operations["getEventsIdFeedbackResults"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/events/{id}/feedback/remind": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/**
|
||||
* Remind people who haven't answered
|
||||
* @description A fresh link to everyone who hasn't answered, or to `userIds` (named forms only). Nobody is sent the form or a reminder twice within 24 hours. Without `userIds` it also sends the form to anyone who has become eligible since it went out.
|
||||
*
|
||||
* **Who:** Supervisors and admins.
|
||||
*/
|
||||
post: operations["postEventsIdFeedbackRemind"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
}
|
||||
export type webhooks = Record<string, never>;
|
||||
export interface components {
|
||||
@@ -38294,4 +38360,279 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
getFeedback: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
event: {
|
||||
id: string;
|
||||
title: string;
|
||||
startDate: unknown;
|
||||
endDate: unknown;
|
||||
};
|
||||
/**
|
||||
* @description sent, scheduled (a send time is set) or not_scheduled
|
||||
* @enum {string}
|
||||
*/
|
||||
status: "sent" | "scheduled" | "not_scheduled";
|
||||
sendAt: unknown | null;
|
||||
sentAt: unknown | null;
|
||||
anonymous: boolean;
|
||||
invited: number;
|
||||
answered: number;
|
||||
/** @description % */
|
||||
responseRate: number | null;
|
||||
/** @description Every star rating on the form, 1–5 */
|
||||
averageRating: number | null;
|
||||
lastReminderAt: unknown | null;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not allowed for this role (FORBIDDEN) */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
getEventsIdFeedbackResults: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The id */
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
event: {
|
||||
id: string;
|
||||
title: string;
|
||||
startDate: unknown;
|
||||
endDate: unknown;
|
||||
};
|
||||
form: {
|
||||
/**
|
||||
* @description sent, scheduled (a send time is set) or not_scheduled
|
||||
* @enum {string}
|
||||
*/
|
||||
status: "sent" | "scheduled" | "not_scheduled";
|
||||
sendAt: unknown | null;
|
||||
sentAt: unknown | null;
|
||||
/** @enum {string} */
|
||||
audience: "checked_in" | "all";
|
||||
anonymous: boolean;
|
||||
intro: string | null;
|
||||
/** @description When the automatic reminder goes (3 days after sending) */
|
||||
autoReminderAt: unknown | null;
|
||||
autoReminderSent: boolean;
|
||||
};
|
||||
counts: {
|
||||
invited: number;
|
||||
answered: number;
|
||||
notAnswered: number;
|
||||
responseRate: number | null;
|
||||
/** @description Not answered, and not sent the form or a reminder in the last 24 hours */
|
||||
canRemind: number;
|
||||
remindedRecently: number;
|
||||
/** @description Would get the form but haven't been sent it yet (e.g. checked in after it went out) */
|
||||
waiting: number;
|
||||
};
|
||||
averageRating: number | null;
|
||||
questions: {
|
||||
fieldId: string;
|
||||
type: string;
|
||||
label: string;
|
||||
answered: number;
|
||||
average?: number | null;
|
||||
distribution?: {
|
||||
label: string;
|
||||
value: number;
|
||||
}[];
|
||||
counts?: {
|
||||
label: string;
|
||||
value: number;
|
||||
}[];
|
||||
texts?: {
|
||||
value: string;
|
||||
name?: string;
|
||||
}[];
|
||||
}[];
|
||||
fields: {
|
||||
id: string;
|
||||
type: string;
|
||||
label: string;
|
||||
}[];
|
||||
responses: {
|
||||
id: string;
|
||||
createdAt: unknown;
|
||||
name: string | null;
|
||||
/** @description Question id → answer */
|
||||
answers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
}[];
|
||||
people: {
|
||||
userId: string;
|
||||
name: string;
|
||||
email: string | null;
|
||||
phoneNumber: string | null;
|
||||
sentAt: unknown;
|
||||
remindedAt: unknown | null;
|
||||
reminderCount: number;
|
||||
respondedAt: unknown | null;
|
||||
canRemind: boolean;
|
||||
}[] | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not allowed for this role (FORBIDDEN) */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not found (NOT_FOUND) */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postEventsIdFeedbackRemind: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The id */
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
/** @description Only these people (named forms) */
|
||||
userIds?: string[] | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
reminded: number;
|
||||
newlyInvited: number;
|
||||
skipped: number;
|
||||
message: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not allowed for this role (FORBIDDEN) */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not found (NOT_FOUND) */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ export const COMMAND_PAGES: CommandPage[] = [
|
||||
{ group: "Pages", label: "Waitlist", href: "/dashboard/supervisor/waitlist", roles: S, keywords: "sold out offers" },
|
||||
{ group: "Pages", label: "Parental consent", href: "/dashboard/supervisor/consent", roles: S, keywords: "youth medical" },
|
||||
{ group: "Pages", label: "Volunteer rosters", href: "/dashboard/supervisor/volunteers", roles: SUP, keywords: "serving roles cover" },
|
||||
{ group: "Pages", label: "Feedback", href: "/dashboard/supervisor/feedback", roles: SUP, keywords: "survey responses ratings comments remind" },
|
||||
{ group: "Pages", label: "Volunteers today", href: "/dashboard/staff/volunteers", roles: S, keywords: "serving check-in qr" },
|
||||
{ group: "Pages", label: "Kids check-in setup", href: "/dashboard/supervisor/kids", roles: SUP, keywords: "rooms ratios" },
|
||||
{ group: "Pages", label: "Kids room screen", href: "/dashboard/staff/kids/rooms", roles: S, keywords: "children leaders on duty" },
|
||||
|
||||
Reference in New Issue
Block a user