@burdenoff/microfe-atheletebridge 2026.1110.1 → 2026.1110.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atheletebridge/AthleteBridgeRoutes.js +22 -6
- package/dist/atheletebridge/AthleteBridgeRoutes.js.map +1 -1
- package/dist/atheletebridge/components/StatusBadge.js +8 -0
- package/dist/atheletebridge/components/StatusBadge.js.map +1 -1
- package/dist/atheletebridge/hooks/useAuditApi.d.ts +14 -0
- package/dist/atheletebridge/hooks/useAuditApi.js +38 -0
- package/dist/atheletebridge/hooks/useAuditApi.js.map +1 -0
- package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +15 -0
- package/dist/atheletebridge/hooks/useRegistrationApi.js +38 -19
- package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
- package/dist/atheletebridge/pages/audit/AuditLogPage.d.ts +11 -0
- package/dist/atheletebridge/pages/audit/AuditLogPage.js +277 -0
- package/dist/atheletebridge/pages/audit/AuditLogPage.js.map +1 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.d.ts +11 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.js +208 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.js.map +1 -0
- package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js +126 -65
- package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js +243 -217
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js +136 -83
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +173 -146
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
- package/dist/atheletebridge/types/audit.d.ts +47 -0
- package/dist/atheletebridge/types/registration.d.ts +22 -1
- package/package.json +1 -1
|
@@ -2,16 +2,16 @@ import { PageLayout as e } from "../../components/PageLayout.js";
|
|
|
2
2
|
import { ErrorState as t, LoadingState as n } from "../../components/LoadingState.js";
|
|
3
3
|
import { FormField as r, fieldInputClass as i } from "../../components/form.js";
|
|
4
4
|
import { useAthleteBridge as a } from "../../context/AthleteBridgeContext.js";
|
|
5
|
-
import {
|
|
6
|
-
import { useCreateRegistrationForm as
|
|
7
|
-
import { minorToInput as
|
|
8
|
-
import { keyFromLabel as
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { ArrowDown as
|
|
11
|
-
import { useParams as
|
|
12
|
-
import { jsx as
|
|
5
|
+
import { useFixtures as o, useTeams as s } from "../../hooks/useAthleteBridgeApi.js";
|
|
6
|
+
import { useCreateRegistrationForm as c, useRegistrationForm as l, useUpdateRegistrationForm as u } from "../../hooks/useRegistrationApi.js";
|
|
7
|
+
import { minorToInput as d, parseMoney as f } from "../../utils/money.js";
|
|
8
|
+
import { keyFromLabel as p } from "../../utils/registration.js";
|
|
9
|
+
import { useEffect as m, useRef as h, useState as g } from "react";
|
|
10
|
+
import { ArrowDown as _, ArrowLeft as v, ArrowUp as y, Loader2 as b, Plus as x, Save as S, Trash2 as C } from "lucide-react";
|
|
11
|
+
import { useParams as w } from "react-router";
|
|
12
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
13
13
|
// src/atheletebridge/pages/registrations/RegistrationFormBuilderPage.tsx
|
|
14
|
-
var
|
|
14
|
+
var D = {
|
|
15
15
|
SHORT_TEXT: "Short text",
|
|
16
16
|
LONG_TEXT: "Paragraph",
|
|
17
17
|
EMAIL: "Email",
|
|
@@ -20,7 +20,7 @@ var E = {
|
|
|
20
20
|
DATE: "Date",
|
|
21
21
|
SELECT: "Dropdown",
|
|
22
22
|
CHECKBOX: "Checkbox (yes / consent)"
|
|
23
|
-
},
|
|
23
|
+
}, O = [
|
|
24
24
|
"USD",
|
|
25
25
|
"INR",
|
|
26
26
|
"GBP",
|
|
@@ -29,11 +29,12 @@ var E = {
|
|
|
29
29
|
"CAD",
|
|
30
30
|
"SGD",
|
|
31
31
|
"AED"
|
|
32
|
-
],
|
|
32
|
+
], k = () => `draft-${crypto.randomUUID()}`, A = {
|
|
33
33
|
title: "",
|
|
34
34
|
description: "",
|
|
35
35
|
season: "",
|
|
36
36
|
teamId: "",
|
|
37
|
+
fixtureId: "",
|
|
37
38
|
slug: "",
|
|
38
39
|
currency: "USD",
|
|
39
40
|
opensAt: "",
|
|
@@ -43,28 +44,29 @@ var E = {
|
|
|
43
44
|
questions: [],
|
|
44
45
|
fees: []
|
|
45
46
|
};
|
|
46
|
-
function
|
|
47
|
+
function j(e) {
|
|
47
48
|
if (!e) return "";
|
|
48
49
|
let t = new Date(e), n = t.getTimezoneOffset() * 6e4;
|
|
49
50
|
return new Date(t.getTime() - n).toISOString().slice(0, 16);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function M(e) {
|
|
52
53
|
return e ? new Date(e).toISOString() : void 0;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function N(e) {
|
|
55
56
|
return {
|
|
56
57
|
title: e.title,
|
|
57
58
|
description: e.description ?? "",
|
|
58
59
|
season: e.season ?? "",
|
|
59
60
|
teamId: e.teamId ?? "",
|
|
61
|
+
fixtureId: e.fixtureId ?? "",
|
|
60
62
|
slug: e.slug,
|
|
61
63
|
currency: e.currency,
|
|
62
|
-
opensAt:
|
|
63
|
-
closesAt:
|
|
64
|
+
opensAt: j(e.opensAt),
|
|
65
|
+
closesAt: j(e.closesAt),
|
|
64
66
|
maxSubmissions: e.maxSubmissions == null ? "" : String(e.maxSubmissions),
|
|
65
67
|
waiverText: e.waiverText ?? "",
|
|
66
68
|
questions: e.fields.map((e) => ({
|
|
67
|
-
uid:
|
|
69
|
+
uid: k(),
|
|
68
70
|
key: e.key,
|
|
69
71
|
label: e.label,
|
|
70
72
|
fieldType: e.fieldType,
|
|
@@ -73,41 +75,41 @@ function M(e) {
|
|
|
73
75
|
helpText: e.helpText ?? ""
|
|
74
76
|
})),
|
|
75
77
|
fees: e.fees.map((t) => ({
|
|
76
|
-
uid:
|
|
78
|
+
uid: k(),
|
|
77
79
|
name: t.name,
|
|
78
|
-
amountText:
|
|
80
|
+
amountText: d(t.amount, e.currency),
|
|
79
81
|
feeType: t.feeType,
|
|
80
82
|
description: t.description ?? ""
|
|
81
83
|
}))
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
|
-
function
|
|
86
|
+
function P(e, t, n) {
|
|
85
87
|
let r = t + n;
|
|
86
88
|
if (r < 0 || r >= e.length) return e;
|
|
87
89
|
let i = [...e], [a] = i.splice(t, 1);
|
|
88
90
|
return a !== void 0 && i.splice(r, 0, a), i;
|
|
89
91
|
}
|
|
90
|
-
var
|
|
91
|
-
function
|
|
92
|
-
let { id:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
let
|
|
92
|
+
var F = "inline-flex h-8 w-8 items-center justify-center rounded-md border border-border-seam text-text-secondary transition-colors hover:bg-bg-sunken disabled:opacity-40";
|
|
93
|
+
function I() {
|
|
94
|
+
let { id: d } = w(), j = !!d, { navigateTo: I } = a(), L = l(d), R = s({ pagination: { limit: 100 } }), z = o({ pagination: { limit: 100 } }), B = c(), V = u(), [H, U] = g(A), [W, G] = g(null), K = h(null);
|
|
95
|
+
m(() => {
|
|
96
|
+
j && L.data && K.current !== L.data.id && (K.current = L.data.id, U(N(L.data)));
|
|
97
|
+
}, [j, L.data]);
|
|
98
|
+
let q = j && (L.data?.submissionCount ?? 0) > 0, J = (e, t) => U((n) => ({
|
|
97
99
|
...n,
|
|
98
100
|
[e]: t
|
|
99
|
-
})),
|
|
101
|
+
})), Y = (e, t) => J("questions", H.questions.map((n) => n.uid === e ? {
|
|
100
102
|
...n,
|
|
101
103
|
...t
|
|
102
|
-
} : n)),
|
|
104
|
+
} : n)), X = (e, t) => J("fees", H.fees.map((n) => n.uid === e ? {
|
|
103
105
|
...n,
|
|
104
106
|
...t
|
|
105
|
-
} : n)),
|
|
106
|
-
let e = new Set(
|
|
107
|
-
for (let n of
|
|
107
|
+
} : n)), Z = () => {
|
|
108
|
+
let e = new Set(H.questions.map((e) => e.key).filter(Boolean)), t = [];
|
|
109
|
+
for (let n of H.questions) {
|
|
108
110
|
let r = n.label.trim();
|
|
109
111
|
if (!r) return "Every question needs a label.";
|
|
110
|
-
let i = n.key ||
|
|
112
|
+
let i = n.key || p(r, e);
|
|
111
113
|
e.add(i);
|
|
112
114
|
let a = n.optionsText.split(",").map((e) => e.trim()).filter(Boolean);
|
|
113
115
|
if (n.fieldType === "SELECT" && a.length === 0) return `Add at least one option to the dropdown "${r}".`;
|
|
@@ -121,10 +123,10 @@ function F() {
|
|
|
121
123
|
});
|
|
122
124
|
}
|
|
123
125
|
let n = [];
|
|
124
|
-
for (let e of
|
|
126
|
+
for (let e of H.fees) {
|
|
125
127
|
let t = e.name.trim();
|
|
126
128
|
if (!t) return "Every fee needs a name.";
|
|
127
|
-
let r =
|
|
129
|
+
let r = f(e.amountText, H.currency);
|
|
128
130
|
if (r === null) return `Enter a valid amount for "${t}".`;
|
|
129
131
|
n.push({
|
|
130
132
|
name: t,
|
|
@@ -137,151 +139,175 @@ function F() {
|
|
|
137
139
|
fields: t,
|
|
138
140
|
fees: n
|
|
139
141
|
};
|
|
140
|
-
},
|
|
141
|
-
if (e.preventDefault(),
|
|
142
|
-
|
|
142
|
+
}, ee = async (e) => {
|
|
143
|
+
if (e.preventDefault(), G(null), !H.title.trim()) {
|
|
144
|
+
G("Give the form a title.");
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
|
-
let t =
|
|
147
|
+
let t = H.maxSubmissions.trim() ? Number.parseInt(H.maxSubmissions, 10) : void 0;
|
|
146
148
|
if (t !== void 0 && (Number.isNaN(t) || t < 1)) {
|
|
147
|
-
|
|
149
|
+
G("Capacity must be a positive number.");
|
|
148
150
|
return;
|
|
149
151
|
}
|
|
150
|
-
let n =
|
|
151
|
-
if (typeof n == "string")
|
|
152
|
+
let n = q ? null : Z();
|
|
153
|
+
if (typeof n == "string") G(n);
|
|
152
154
|
else try {
|
|
153
|
-
if (
|
|
154
|
-
id:
|
|
155
|
+
if (j && d) await V.mutateAsync({
|
|
156
|
+
id: d,
|
|
155
157
|
input: {
|
|
156
|
-
title:
|
|
157
|
-
description:
|
|
158
|
-
season:
|
|
159
|
-
teamId:
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
title: H.title.trim(),
|
|
159
|
+
description: H.description.trim() || null,
|
|
160
|
+
season: H.season.trim() || null,
|
|
161
|
+
teamId: H.teamId || null,
|
|
162
|
+
fixtureId: H.fixtureId || null,
|
|
163
|
+
opensAt: M(H.opensAt) ?? null,
|
|
164
|
+
closesAt: M(H.closesAt) ?? null,
|
|
162
165
|
maxSubmissions: t ?? null,
|
|
163
|
-
waiverText:
|
|
166
|
+
waiverText: H.waiverText.trim() || null,
|
|
164
167
|
...n ? {
|
|
165
|
-
currency:
|
|
168
|
+
currency: H.currency,
|
|
166
169
|
fields: n.fields,
|
|
167
170
|
fees: n.fees
|
|
168
171
|
} : {}
|
|
169
172
|
}
|
|
170
|
-
}),
|
|
173
|
+
}), I(`/registrations/${d}`);
|
|
171
174
|
else if (n) {
|
|
172
|
-
let e = await
|
|
173
|
-
title:
|
|
174
|
-
description:
|
|
175
|
-
season:
|
|
176
|
-
teamId:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
let e = await B.mutateAsync({
|
|
176
|
+
title: H.title.trim(),
|
|
177
|
+
description: H.description.trim() || void 0,
|
|
178
|
+
season: H.season.trim() || void 0,
|
|
179
|
+
teamId: H.teamId || void 0,
|
|
180
|
+
fixtureId: H.fixtureId || void 0,
|
|
181
|
+
slug: H.slug.trim() || void 0,
|
|
182
|
+
currency: H.currency,
|
|
183
|
+
opensAt: M(H.opensAt),
|
|
184
|
+
closesAt: M(H.closesAt),
|
|
181
185
|
maxSubmissions: t,
|
|
182
|
-
waiverText:
|
|
186
|
+
waiverText: H.waiverText.trim() || void 0,
|
|
183
187
|
fields: n.fields,
|
|
184
188
|
fees: n.fees
|
|
185
189
|
});
|
|
186
|
-
|
|
190
|
+
I(`/registrations/${e.id}`);
|
|
187
191
|
}
|
|
188
192
|
} catch (e) {
|
|
189
|
-
|
|
193
|
+
G(e instanceof Error ? e.message : "Failed to save the registration form.");
|
|
190
194
|
}
|
|
191
|
-
},
|
|
192
|
-
return
|
|
193
|
-
title:
|
|
194
|
-
children: /* @__PURE__ */
|
|
195
|
-
}) :
|
|
196
|
-
title:
|
|
197
|
-
children: /* @__PURE__ */
|
|
195
|
+
}, Q = B.isPending || V.isPending, $ = j ? "Edit registration form" : "New registration form";
|
|
196
|
+
return j && L.isLoading ? /* @__PURE__ */ T(e, {
|
|
197
|
+
title: $,
|
|
198
|
+
children: /* @__PURE__ */ T(n, { label: "Loading registration form…" })
|
|
199
|
+
}) : j && (L.isError || !L.data) ? /* @__PURE__ */ T(e, {
|
|
200
|
+
title: $,
|
|
201
|
+
children: /* @__PURE__ */ T(t, {
|
|
198
202
|
title: "Registration form not found",
|
|
199
203
|
message: "This form does not exist or you do not have access to it.",
|
|
200
|
-
onRetry: () =>
|
|
204
|
+
onRetry: () => I("/registrations")
|
|
201
205
|
})
|
|
202
|
-
}) : /* @__PURE__ */
|
|
203
|
-
title:
|
|
206
|
+
}) : /* @__PURE__ */ T(e, {
|
|
207
|
+
title: $,
|
|
204
208
|
description: "Set the details, the questions families answer and the fees they pay.",
|
|
205
|
-
actions: /* @__PURE__ */
|
|
209
|
+
actions: /* @__PURE__ */ E("button", {
|
|
206
210
|
type: "button",
|
|
207
|
-
onClick: () =>
|
|
211
|
+
onClick: () => I(j && d ? `/registrations/${d}` : "/registrations"),
|
|
208
212
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
213
|
+
children: [/* @__PURE__ */ T(v, { className: "h-4 w-4" }), " Cancel"]
|
|
210
214
|
}),
|
|
211
|
-
children: /* @__PURE__ */
|
|
212
|
-
onSubmit:
|
|
215
|
+
children: /* @__PURE__ */ E("form", {
|
|
216
|
+
onSubmit: ee,
|
|
213
217
|
className: "max-w-3xl space-y-8",
|
|
214
218
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ E("section", {
|
|
216
220
|
className: "space-y-5",
|
|
217
221
|
children: [
|
|
218
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ T(r, {
|
|
219
223
|
label: "Form title",
|
|
220
224
|
htmlFor: "title",
|
|
221
225
|
required: !0,
|
|
222
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ T("input", {
|
|
223
227
|
id: "title",
|
|
224
228
|
className: i,
|
|
225
|
-
value:
|
|
226
|
-
onChange: (e) =>
|
|
229
|
+
value: H.title,
|
|
230
|
+
onChange: (e) => J("title", e.target.value),
|
|
227
231
|
placeholder: "e.g. U12 Boys — 2026/27 season registration"
|
|
228
232
|
})
|
|
229
233
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ T(r, {
|
|
231
235
|
label: "Description",
|
|
232
236
|
htmlFor: "description",
|
|
233
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ T("textarea", {
|
|
234
238
|
id: "description",
|
|
235
239
|
rows: 3,
|
|
236
240
|
className: i,
|
|
237
|
-
value:
|
|
238
|
-
onChange: (e) =>
|
|
241
|
+
value: H.description,
|
|
242
|
+
onChange: (e) => J("description", e.target.value),
|
|
239
243
|
placeholder: "Who this is for, training days, what is included."
|
|
240
244
|
})
|
|
241
245
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ E("div", {
|
|
243
247
|
className: "grid grid-cols-1 gap-5 sm:grid-cols-3",
|
|
244
248
|
children: [
|
|
245
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ T(r, {
|
|
246
250
|
label: "Season",
|
|
247
251
|
htmlFor: "season",
|
|
248
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ T("input", {
|
|
249
253
|
id: "season",
|
|
250
254
|
className: i,
|
|
251
|
-
value:
|
|
252
|
-
onChange: (e) =>
|
|
255
|
+
value: H.season,
|
|
256
|
+
onChange: (e) => J("season", e.target.value),
|
|
253
257
|
placeholder: "2026/27"
|
|
254
258
|
})
|
|
255
259
|
}),
|
|
256
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ T(r, {
|
|
257
261
|
label: "Team",
|
|
258
262
|
htmlFor: "teamId",
|
|
259
263
|
hint: "Optional squad this registers for.",
|
|
260
|
-
children: /* @__PURE__ */
|
|
264
|
+
children: /* @__PURE__ */ E("select", {
|
|
261
265
|
id: "teamId",
|
|
262
266
|
className: i,
|
|
263
|
-
value:
|
|
264
|
-
onChange: (e) =>
|
|
265
|
-
children: [/* @__PURE__ */
|
|
267
|
+
value: H.teamId,
|
|
268
|
+
onChange: (e) => J("teamId", e.target.value),
|
|
269
|
+
children: [/* @__PURE__ */ T("option", {
|
|
266
270
|
value: "",
|
|
267
271
|
children: "No specific team"
|
|
268
|
-
}), (
|
|
272
|
+
}), (R.data?.items ?? []).map((e) => /* @__PURE__ */ T("option", {
|
|
269
273
|
value: e.id,
|
|
270
274
|
children: e.name
|
|
271
275
|
}, e.id))]
|
|
272
276
|
})
|
|
273
277
|
}),
|
|
274
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ T(r, {
|
|
279
|
+
label: "Fixture",
|
|
280
|
+
htmlFor: "fixtureId",
|
|
281
|
+
hint: "Optional tournament or match this form takes sign-ups for. Families use the same share link.",
|
|
282
|
+
children: /* @__PURE__ */ E("select", {
|
|
283
|
+
id: "fixtureId",
|
|
284
|
+
className: i,
|
|
285
|
+
value: H.fixtureId,
|
|
286
|
+
onChange: (e) => J("fixtureId", e.target.value),
|
|
287
|
+
children: [/* @__PURE__ */ T("option", {
|
|
288
|
+
value: "",
|
|
289
|
+
children: "Not tied to a fixture"
|
|
290
|
+
}), (z.data?.items ?? []).map((e) => /* @__PURE__ */ T("option", {
|
|
291
|
+
value: e.id,
|
|
292
|
+
children: [
|
|
293
|
+
e.competition ?? "Fixture",
|
|
294
|
+
e.homeTeam?.name ?? null,
|
|
295
|
+
e.awayTeam?.name ? `vs ${e.awayTeam.name}` : null
|
|
296
|
+
].filter(Boolean).join(" — ")
|
|
297
|
+
}, e.id))]
|
|
298
|
+
})
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ T(r, {
|
|
275
301
|
label: "Currency",
|
|
276
302
|
htmlFor: "currency",
|
|
277
|
-
hint:
|
|
278
|
-
children: /* @__PURE__ */
|
|
303
|
+
hint: q ? "Locked after the first registration." : void 0,
|
|
304
|
+
children: /* @__PURE__ */ T("select", {
|
|
279
305
|
id: "currency",
|
|
280
306
|
className: i,
|
|
281
|
-
value:
|
|
282
|
-
disabled:
|
|
283
|
-
onChange: (e) =>
|
|
284
|
-
children: [.../* @__PURE__ */ new Set([
|
|
307
|
+
value: H.currency,
|
|
308
|
+
disabled: q,
|
|
309
|
+
onChange: (e) => J("currency", e.target.value),
|
|
310
|
+
children: [.../* @__PURE__ */ new Set([H.currency, ...O])].map((e) => /* @__PURE__ */ T("option", {
|
|
285
311
|
value: e,
|
|
286
312
|
children: e
|
|
287
313
|
}, e))
|
|
@@ -289,77 +315,77 @@ function F() {
|
|
|
289
315
|
})
|
|
290
316
|
]
|
|
291
317
|
}),
|
|
292
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ E("div", {
|
|
293
319
|
className: "grid grid-cols-1 gap-5 sm:grid-cols-3",
|
|
294
320
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ T(r, {
|
|
296
322
|
label: "Opens",
|
|
297
323
|
htmlFor: "opensAt",
|
|
298
324
|
hint: "Leave empty to open on publish.",
|
|
299
|
-
children: /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */ T("input", {
|
|
300
326
|
id: "opensAt",
|
|
301
327
|
type: "datetime-local",
|
|
302
328
|
className: i,
|
|
303
|
-
value:
|
|
304
|
-
onChange: (e) =>
|
|
329
|
+
value: H.opensAt,
|
|
330
|
+
onChange: (e) => J("opensAt", e.target.value)
|
|
305
331
|
})
|
|
306
332
|
}),
|
|
307
|
-
/* @__PURE__ */
|
|
333
|
+
/* @__PURE__ */ T(r, {
|
|
308
334
|
label: "Closes",
|
|
309
335
|
htmlFor: "closesAt",
|
|
310
336
|
hint: "Leave empty to close manually.",
|
|
311
|
-
children: /* @__PURE__ */
|
|
337
|
+
children: /* @__PURE__ */ T("input", {
|
|
312
338
|
id: "closesAt",
|
|
313
339
|
type: "datetime-local",
|
|
314
340
|
className: i,
|
|
315
|
-
value:
|
|
316
|
-
onChange: (e) =>
|
|
341
|
+
value: H.closesAt,
|
|
342
|
+
onChange: (e) => J("closesAt", e.target.value)
|
|
317
343
|
})
|
|
318
344
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ T(r, {
|
|
320
346
|
label: "Capacity",
|
|
321
347
|
htmlFor: "maxSubmissions",
|
|
322
348
|
hint: "Maximum registrations.",
|
|
323
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ T("input", {
|
|
324
350
|
id: "maxSubmissions",
|
|
325
351
|
inputMode: "numeric",
|
|
326
352
|
className: i,
|
|
327
|
-
value:
|
|
328
|
-
onChange: (e) =>
|
|
353
|
+
value: H.maxSubmissions,
|
|
354
|
+
onChange: (e) => J("maxSubmissions", e.target.value),
|
|
329
355
|
placeholder: "Unlimited"
|
|
330
356
|
})
|
|
331
357
|
})
|
|
332
358
|
]
|
|
333
359
|
}),
|
|
334
|
-
!
|
|
360
|
+
!j && /* @__PURE__ */ T(r, {
|
|
335
361
|
label: "Share-link name",
|
|
336
362
|
htmlFor: "slug",
|
|
337
363
|
hint: "Optional. Lowercase letters, digits and dashes. Generated from the title when empty.",
|
|
338
|
-
children: /* @__PURE__ */
|
|
364
|
+
children: /* @__PURE__ */ T("input", {
|
|
339
365
|
id: "slug",
|
|
340
366
|
className: i,
|
|
341
|
-
value:
|
|
342
|
-
onChange: (e) =>
|
|
367
|
+
value: H.slug,
|
|
368
|
+
onChange: (e) => J("slug", e.target.value),
|
|
343
369
|
placeholder: "u12-boys-2026"
|
|
344
370
|
})
|
|
345
371
|
})
|
|
346
372
|
]
|
|
347
373
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ E("section", {
|
|
349
375
|
className: "space-y-3",
|
|
350
376
|
"aria-labelledby": "builder-questions",
|
|
351
377
|
children: [
|
|
352
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ E("div", {
|
|
353
379
|
className: "flex items-center justify-between",
|
|
354
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
355
381
|
id: "builder-questions",
|
|
356
382
|
className: "text-base font-semibold text-text-primary",
|
|
357
383
|
children: "Questions"
|
|
358
|
-
}), /* @__PURE__ */
|
|
384
|
+
}), /* @__PURE__ */ E("button", {
|
|
359
385
|
type: "button",
|
|
360
|
-
disabled:
|
|
361
|
-
onClick: () =>
|
|
362
|
-
uid:
|
|
386
|
+
disabled: q,
|
|
387
|
+
onClick: () => J("questions", [...H.questions, {
|
|
388
|
+
uid: k(),
|
|
363
389
|
key: "",
|
|
364
390
|
label: "",
|
|
365
391
|
fieldType: "SHORT_TEXT",
|
|
@@ -368,107 +394,107 @@ function F() {
|
|
|
368
394
|
helpText: ""
|
|
369
395
|
}]),
|
|
370
396
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
|
|
371
|
-
children: [/* @__PURE__ */
|
|
397
|
+
children: [/* @__PURE__ */ T(x, { className: "h-4 w-4" }), " Add question"]
|
|
372
398
|
})]
|
|
373
399
|
}),
|
|
374
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ E("p", {
|
|
375
401
|
className: "text-xs text-text-secondary",
|
|
376
|
-
children: ["Participant name and contact details are always collected.",
|
|
402
|
+
children: ["Participant name and contact details are always collected.", q && " Questions are locked because this form already has registrations."]
|
|
377
403
|
}),
|
|
378
|
-
|
|
404
|
+
H.questions.map((e, t) => /* @__PURE__ */ E("div", {
|
|
379
405
|
className: "space-y-3 rounded-lg border border-border-seam bg-bg-surface p-4",
|
|
380
406
|
"data-testid": "builder-question",
|
|
381
407
|
children: [
|
|
382
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ E("div", {
|
|
383
409
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-[1fr_12rem]",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
410
|
+
children: [/* @__PURE__ */ T(r, {
|
|
385
411
|
label: `Question ${t + 1}`,
|
|
386
412
|
htmlFor: `q-label-${e.uid}`,
|
|
387
|
-
children: /* @__PURE__ */
|
|
413
|
+
children: /* @__PURE__ */ T("input", {
|
|
388
414
|
id: `q-label-${e.uid}`,
|
|
389
415
|
className: i,
|
|
390
416
|
value: e.label,
|
|
391
|
-
disabled:
|
|
392
|
-
onChange: (t) =>
|
|
417
|
+
disabled: q,
|
|
418
|
+
onChange: (t) => Y(e.uid, { label: t.target.value }),
|
|
393
419
|
placeholder: "e.g. Date of birth"
|
|
394
420
|
})
|
|
395
|
-
}), /* @__PURE__ */
|
|
421
|
+
}), /* @__PURE__ */ T(r, {
|
|
396
422
|
label: "Answer type",
|
|
397
423
|
htmlFor: `q-type-${e.uid}`,
|
|
398
|
-
children: /* @__PURE__ */
|
|
424
|
+
children: /* @__PURE__ */ T("select", {
|
|
399
425
|
id: `q-type-${e.uid}`,
|
|
400
426
|
className: i,
|
|
401
427
|
value: e.fieldType,
|
|
402
|
-
disabled:
|
|
403
|
-
onChange: (t) =>
|
|
404
|
-
children: Object.keys(
|
|
428
|
+
disabled: q,
|
|
429
|
+
onChange: (t) => Y(e.uid, { fieldType: t.target.value }),
|
|
430
|
+
children: Object.keys(D).map((e) => /* @__PURE__ */ T("option", {
|
|
405
431
|
value: e,
|
|
406
|
-
children:
|
|
432
|
+
children: D[e]
|
|
407
433
|
}, e))
|
|
408
434
|
})
|
|
409
435
|
})]
|
|
410
436
|
}),
|
|
411
|
-
e.fieldType === "SELECT" && /* @__PURE__ */
|
|
437
|
+
e.fieldType === "SELECT" && /* @__PURE__ */ T(r, {
|
|
412
438
|
label: "Options",
|
|
413
439
|
htmlFor: `q-options-${e.uid}`,
|
|
414
440
|
hint: "Comma-separated.",
|
|
415
|
-
children: /* @__PURE__ */
|
|
441
|
+
children: /* @__PURE__ */ T("input", {
|
|
416
442
|
id: `q-options-${e.uid}`,
|
|
417
443
|
className: i,
|
|
418
444
|
value: e.optionsText,
|
|
419
|
-
disabled:
|
|
420
|
-
onChange: (t) =>
|
|
445
|
+
disabled: q,
|
|
446
|
+
onChange: (t) => Y(e.uid, { optionsText: t.target.value }),
|
|
421
447
|
placeholder: "XS, S, M, L"
|
|
422
448
|
})
|
|
423
449
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ T(r, {
|
|
425
451
|
label: "Help text",
|
|
426
452
|
htmlFor: `q-help-${e.uid}`,
|
|
427
|
-
children: /* @__PURE__ */
|
|
453
|
+
children: /* @__PURE__ */ T("input", {
|
|
428
454
|
id: `q-help-${e.uid}`,
|
|
429
455
|
className: i,
|
|
430
456
|
value: e.helpText,
|
|
431
|
-
disabled:
|
|
432
|
-
onChange: (t) =>
|
|
457
|
+
disabled: q,
|
|
458
|
+
onChange: (t) => Y(e.uid, { helpText: t.target.value })
|
|
433
459
|
})
|
|
434
460
|
}),
|
|
435
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ E("div", {
|
|
436
462
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
437
|
-
children: [/* @__PURE__ */
|
|
463
|
+
children: [/* @__PURE__ */ E("label", {
|
|
438
464
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
439
|
-
children: [/* @__PURE__ */
|
|
465
|
+
children: [/* @__PURE__ */ T("input", {
|
|
440
466
|
type: "checkbox",
|
|
441
467
|
checked: e.required,
|
|
442
|
-
disabled:
|
|
443
|
-
onChange: (t) =>
|
|
468
|
+
disabled: q,
|
|
469
|
+
onChange: (t) => Y(e.uid, { required: t.target.checked }),
|
|
444
470
|
className: "h-4 w-4 rounded border-border-seam text-action-primary-bg focus:ring-[var(--color-focus-ring)]"
|
|
445
471
|
}), "Required"]
|
|
446
|
-
}), /* @__PURE__ */
|
|
472
|
+
}), /* @__PURE__ */ E("span", {
|
|
447
473
|
className: "flex gap-2",
|
|
448
474
|
children: [
|
|
449
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ T("button", {
|
|
450
476
|
type: "button",
|
|
451
477
|
"aria-label": "Move question up",
|
|
452
|
-
className:
|
|
453
|
-
disabled:
|
|
454
|
-
onClick: () =>
|
|
455
|
-
children: /* @__PURE__ */
|
|
478
|
+
className: F,
|
|
479
|
+
disabled: q || t === 0,
|
|
480
|
+
onClick: () => J("questions", P(H.questions, t, -1)),
|
|
481
|
+
children: /* @__PURE__ */ T(y, { className: "h-4 w-4" })
|
|
456
482
|
}),
|
|
457
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ T("button", {
|
|
458
484
|
type: "button",
|
|
459
485
|
"aria-label": "Move question down",
|
|
460
|
-
className:
|
|
461
|
-
disabled:
|
|
462
|
-
onClick: () =>
|
|
463
|
-
children: /* @__PURE__ */
|
|
486
|
+
className: F,
|
|
487
|
+
disabled: q || t === H.questions.length - 1,
|
|
488
|
+
onClick: () => J("questions", P(H.questions, t, 1)),
|
|
489
|
+
children: /* @__PURE__ */ T(_, { className: "h-4 w-4" })
|
|
464
490
|
}),
|
|
465
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ T("button", {
|
|
466
492
|
type: "button",
|
|
467
493
|
"aria-label": "Remove question",
|
|
468
|
-
className:
|
|
469
|
-
disabled:
|
|
470
|
-
onClick: () =>
|
|
471
|
-
children: /* @__PURE__ */
|
|
494
|
+
className: F,
|
|
495
|
+
disabled: q,
|
|
496
|
+
onClick: () => J("questions", H.questions.filter((t) => t.uid !== e.uid)),
|
|
497
|
+
children: /* @__PURE__ */ T(C, { className: "h-4 w-4" })
|
|
472
498
|
})
|
|
473
499
|
]
|
|
474
500
|
})]
|
|
@@ -477,126 +503,126 @@ function F() {
|
|
|
477
503
|
}, e.uid))
|
|
478
504
|
]
|
|
479
505
|
}),
|
|
480
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ E("section", {
|
|
481
507
|
className: "space-y-3",
|
|
482
508
|
"aria-labelledby": "builder-fees",
|
|
483
509
|
children: [
|
|
484
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ E("div", {
|
|
485
511
|
className: "flex items-center justify-between",
|
|
486
|
-
children: [/* @__PURE__ */
|
|
512
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
487
513
|
id: "builder-fees",
|
|
488
514
|
className: "text-base font-semibold text-text-primary",
|
|
489
515
|
children: "Fees"
|
|
490
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ E("button", {
|
|
491
517
|
type: "button",
|
|
492
|
-
disabled:
|
|
493
|
-
onClick: () =>
|
|
494
|
-
uid:
|
|
518
|
+
disabled: q,
|
|
519
|
+
onClick: () => J("fees", [...H.fees, {
|
|
520
|
+
uid: k(),
|
|
495
521
|
name: "",
|
|
496
522
|
amountText: "",
|
|
497
523
|
feeType: "REQUIRED",
|
|
498
524
|
description: ""
|
|
499
525
|
}]),
|
|
500
526
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
527
|
+
children: [/* @__PURE__ */ T(x, { className: "h-4 w-4" }), " Add fee"]
|
|
502
528
|
})]
|
|
503
529
|
}),
|
|
504
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ T("p", {
|
|
505
531
|
className: "text-xs text-text-secondary",
|
|
506
532
|
children: "Required fees are charged on every registration; optional ones (kit, tournament entry) are opt-in. Payments are recorded by the club office as they arrive."
|
|
507
533
|
}),
|
|
508
|
-
|
|
534
|
+
H.fees.map((e) => /* @__PURE__ */ E("div", {
|
|
509
535
|
className: "grid grid-cols-1 gap-3 rounded-lg border border-border-seam bg-bg-surface p-4 sm:grid-cols-[1fr_9rem_9rem_auto]",
|
|
510
536
|
"data-testid": "builder-fee",
|
|
511
537
|
children: [
|
|
512
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ T(r, {
|
|
513
539
|
label: "Fee name",
|
|
514
540
|
htmlFor: `f-name-${e.uid}`,
|
|
515
|
-
children: /* @__PURE__ */
|
|
541
|
+
children: /* @__PURE__ */ T("input", {
|
|
516
542
|
id: `f-name-${e.uid}`,
|
|
517
543
|
className: i,
|
|
518
544
|
value: e.name,
|
|
519
|
-
disabled:
|
|
520
|
-
onChange: (t) =>
|
|
545
|
+
disabled: q,
|
|
546
|
+
onChange: (t) => X(e.uid, { name: t.target.value }),
|
|
521
547
|
placeholder: "Membership"
|
|
522
548
|
})
|
|
523
549
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
label: `Amount (${
|
|
550
|
+
/* @__PURE__ */ T(r, {
|
|
551
|
+
label: `Amount (${H.currency})`,
|
|
526
552
|
htmlFor: `f-amount-${e.uid}`,
|
|
527
|
-
children: /* @__PURE__ */
|
|
553
|
+
children: /* @__PURE__ */ T("input", {
|
|
528
554
|
id: `f-amount-${e.uid}`,
|
|
529
555
|
inputMode: "decimal",
|
|
530
556
|
className: i,
|
|
531
557
|
value: e.amountText,
|
|
532
|
-
disabled:
|
|
533
|
-
onChange: (t) =>
|
|
558
|
+
disabled: q,
|
|
559
|
+
onChange: (t) => X(e.uid, { amountText: t.target.value }),
|
|
534
560
|
placeholder: "150.00"
|
|
535
561
|
})
|
|
536
562
|
}),
|
|
537
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ T(r, {
|
|
538
564
|
label: "Type",
|
|
539
565
|
htmlFor: `f-type-${e.uid}`,
|
|
540
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ E("select", {
|
|
541
567
|
id: `f-type-${e.uid}`,
|
|
542
568
|
className: i,
|
|
543
569
|
value: e.feeType,
|
|
544
|
-
disabled:
|
|
545
|
-
onChange: (t) =>
|
|
546
|
-
children: [/* @__PURE__ */
|
|
570
|
+
disabled: q,
|
|
571
|
+
onChange: (t) => X(e.uid, { feeType: t.target.value }),
|
|
572
|
+
children: [/* @__PURE__ */ T("option", {
|
|
547
573
|
value: "REQUIRED",
|
|
548
574
|
children: "Required"
|
|
549
|
-
}), /* @__PURE__ */
|
|
575
|
+
}), /* @__PURE__ */ T("option", {
|
|
550
576
|
value: "OPTIONAL",
|
|
551
577
|
children: "Optional"
|
|
552
578
|
})]
|
|
553
579
|
})
|
|
554
580
|
}),
|
|
555
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ T("div", {
|
|
556
582
|
className: "flex items-end",
|
|
557
|
-
children: /* @__PURE__ */
|
|
583
|
+
children: /* @__PURE__ */ T("button", {
|
|
558
584
|
type: "button",
|
|
559
585
|
"aria-label": "Remove fee",
|
|
560
|
-
className:
|
|
561
|
-
disabled:
|
|
562
|
-
onClick: () =>
|
|
563
|
-
children: /* @__PURE__ */
|
|
586
|
+
className: F,
|
|
587
|
+
disabled: q,
|
|
588
|
+
onClick: () => J("fees", H.fees.filter((t) => t.uid !== e.uid)),
|
|
589
|
+
children: /* @__PURE__ */ T(C, { className: "h-4 w-4" })
|
|
564
590
|
})
|
|
565
591
|
})
|
|
566
592
|
]
|
|
567
593
|
}, e.uid))
|
|
568
594
|
]
|
|
569
595
|
}),
|
|
570
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ T("section", { children: /* @__PURE__ */ T(r, {
|
|
571
597
|
label: "Waiver / consent",
|
|
572
598
|
htmlFor: "waiverText",
|
|
573
599
|
hint: "Optional. When set, registrants must accept it to submit.",
|
|
574
|
-
children: /* @__PURE__ */
|
|
600
|
+
children: /* @__PURE__ */ T("textarea", {
|
|
575
601
|
id: "waiverText",
|
|
576
602
|
rows: 4,
|
|
577
603
|
className: i,
|
|
578
|
-
value:
|
|
579
|
-
onChange: (e) =>
|
|
604
|
+
value: H.waiverText,
|
|
605
|
+
onChange: (e) => J("waiverText", e.target.value)
|
|
580
606
|
})
|
|
581
607
|
}) }),
|
|
582
|
-
|
|
608
|
+
W && /* @__PURE__ */ T("p", {
|
|
583
609
|
role: "alert",
|
|
584
610
|
className: "text-sm text-status-error-text",
|
|
585
|
-
children:
|
|
611
|
+
children: W
|
|
586
612
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ T("div", {
|
|
588
614
|
className: "pt-2",
|
|
589
|
-
children: /* @__PURE__ */
|
|
615
|
+
children: /* @__PURE__ */ E("button", {
|
|
590
616
|
type: "submit",
|
|
591
|
-
disabled:
|
|
617
|
+
disabled: Q,
|
|
592
618
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60",
|
|
593
|
-
children: [
|
|
619
|
+
children: [Q ? /* @__PURE__ */ T(b, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ T(S, { className: "h-4 w-4" }), j ? "Save changes" : "Create form"]
|
|
594
620
|
})
|
|
595
621
|
})
|
|
596
622
|
]
|
|
597
623
|
})
|
|
598
624
|
});
|
|
599
625
|
}
|
|
600
|
-
export {
|
|
626
|
+
export { I as RegistrationFormBuilderPage };
|
|
601
627
|
|
|
602
628
|
//# sourceMappingURL=RegistrationFormBuilderPage.js.map
|