@burdenoff/microfe-eventfullymanaged 2026.1124.2 → 2026.1124.4
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/eventfullymanaged/components/AiOperationsPanel.d.ts +10 -0
- package/dist/eventfullymanaged/components/AiOperationsPanel.js +560 -0
- package/dist/eventfullymanaged/components/AiOperationsPanel.js.map +1 -0
- package/dist/eventfullymanaged/components/AttendanceForecast.js +62 -39
- package/dist/eventfullymanaged/components/AttendanceForecast.js.map +1 -1
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.d.ts +6 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js +141 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateEmailControls.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js +121 -100
- package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js.map +1 -1
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.d.ts +8 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js +43 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateReceiptSearch.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js +20 -10
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js.map +1 -1
- package/dist/eventfullymanaged/pages/modules/AnalyticsPage.js +109 -107
- package/dist/eventfullymanaged/pages/modules/AnalyticsPage.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +648 -0
- package/dist/generated/wspace-operations.js +374 -37
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +396 -2
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +23 -0
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
- package/dist/node_modules/@apollo/client/errors/utils.js +15 -0
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -5,36 +5,38 @@ import { mutationSucceeded as s } from "../../lib/mutationResult.js";
|
|
|
5
5
|
import { notify as c } from "../../lib/toast.js";
|
|
6
6
|
import { formatDateTime as l } from "../events/eventFormUtils.js";
|
|
7
7
|
import { CertificatePdfDownload as u } from "./CertificatePdfDownload.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { CertificateEmailControls as d } from "./CertificateEmailControls.js";
|
|
9
|
+
import { CertificateReceiptSearch as f } from "./CertificateReceiptSearch.js";
|
|
10
|
+
import { useId as p, useState as m } from "react";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { Button as _, Input as v, Label as y } from "@burdenoff/fe-libs/ui";
|
|
11
13
|
// src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let u = i(),
|
|
14
|
+
var b = "min-h-10 w-full rounded-input border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus", x = "space-y-4 rounded-card border border-border-seam bg-bg-surface p-4";
|
|
15
|
+
function S({ eventId: t, templates: l }) {
|
|
16
|
+
let u = i(), d = p(), v = o(), S = n({
|
|
15
17
|
variables: {
|
|
16
18
|
eventId: t,
|
|
17
|
-
limit:
|
|
18
|
-
offset:
|
|
19
|
+
limit: v.limit,
|
|
20
|
+
offset: v.offset
|
|
19
21
|
},
|
|
20
22
|
fetchPolicy: "no-cache"
|
|
21
|
-
}), w = S.data?.eventfullyManagedRegistrations, [
|
|
23
|
+
}), w = S.data?.eventfullyManagedRegistrations, [E, D] = m(""), [O, k] = m(""), [A, j] = m(null), [M, N] = m(null), [P, { loading: F }] = e({ fetchPolicy: "no-cache" }), [I, { loading: L }] = r(), R = l.find((e) => e.id === O), z = w?.items.find((e) => e.id === E), B = JSON.stringify([
|
|
24
|
+
z?.id,
|
|
22
25
|
R?.id,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
A(null);
|
|
26
|
+
R?.revision,
|
|
27
|
+
R?.requiredSessionIds
|
|
28
|
+
]), V = A?.key === B ? A.result : void 0, H = M?.key === B ? M.value : null, U = F || L, W = u("eventfullymanaged.certificates.issuanceError", "Could not confirm certificate issuance"), G = async () => {
|
|
29
|
+
if (R && z && !U) {
|
|
30
|
+
j(null);
|
|
29
31
|
try {
|
|
30
|
-
let e = await
|
|
32
|
+
let e = await P({ variables: {
|
|
31
33
|
eventId: t,
|
|
32
|
-
registrationId:
|
|
33
|
-
requiredSessionIds:
|
|
34
|
+
registrationId: z.id,
|
|
35
|
+
requiredSessionIds: R.requiredSessionIds
|
|
34
36
|
} });
|
|
35
37
|
if (e.error || !e.data?.eventfullyManagedCertificateEligibility) throw Error("Eligibility not confirmed");
|
|
36
|
-
|
|
37
|
-
key:
|
|
38
|
+
j({
|
|
39
|
+
key: B,
|
|
38
40
|
result: e.data.eventfullyManagedCertificateEligibility
|
|
39
41
|
});
|
|
40
42
|
} catch {
|
|
@@ -42,70 +44,73 @@ function b({ eventId: t, templates: l }) {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
+
return /* @__PURE__ */ h("form", {
|
|
48
|
+
className: x,
|
|
47
49
|
onSubmit: async (e) => {
|
|
48
|
-
if (e.preventDefault(),
|
|
49
|
-
let e = await
|
|
50
|
+
if (e.preventDefault(), R && z && V?.eligible && !U) try {
|
|
51
|
+
let e = await I({ variables: {
|
|
50
52
|
eventId: t,
|
|
51
|
-
registrationId:
|
|
52
|
-
templateId:
|
|
53
|
+
registrationId: z.id,
|
|
54
|
+
templateId: R.id
|
|
53
55
|
} }), n = e.data?.eventfullyManagedIssueCertificate;
|
|
54
|
-
if (!s(e, n?.id,
|
|
55
|
-
|
|
56
|
+
if (!s(e, n?.id, W) || !n) return;
|
|
57
|
+
N({
|
|
58
|
+
key: B,
|
|
59
|
+
value: n
|
|
60
|
+
});
|
|
56
61
|
} catch {
|
|
57
|
-
c.error(
|
|
62
|
+
c.error(W);
|
|
58
63
|
}
|
|
59
64
|
},
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
-
disabled:
|
|
65
|
+
children: /* @__PURE__ */ g("fieldset", {
|
|
66
|
+
disabled: U,
|
|
62
67
|
className: "space-y-4",
|
|
63
68
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ h("legend", {
|
|
65
70
|
className: "mb-3 text-lg font-semibold",
|
|
66
71
|
children: u("eventfullymanaged.certificates.manualIssue", "Issue a certificate")
|
|
67
72
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ g("div", {
|
|
69
74
|
className: "space-y-1.5",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
id:
|
|
72
|
-
htmlFor:
|
|
75
|
+
children: [/* @__PURE__ */ h(y, {
|
|
76
|
+
id: d + "templateLabel",
|
|
77
|
+
htmlFor: d + "template",
|
|
73
78
|
children: u("eventfullymanaged.certificates.template", "Certificate template")
|
|
74
|
-
}), /* @__PURE__ */
|
|
75
|
-
id:
|
|
76
|
-
"aria-labelledby":
|
|
77
|
-
className:
|
|
78
|
-
value:
|
|
79
|
+
}), /* @__PURE__ */ g("select", {
|
|
80
|
+
id: d + "template",
|
|
81
|
+
"aria-labelledby": d + "templateLabel",
|
|
82
|
+
className: b,
|
|
83
|
+
value: R?.id ?? "",
|
|
79
84
|
onChange: (e) => {
|
|
80
|
-
|
|
85
|
+
k(e.target.value), j(null);
|
|
81
86
|
},
|
|
82
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ h("option", {
|
|
83
88
|
value: "",
|
|
84
89
|
children: u("eventfullymanaged.certificates.chooseTemplate", "Choose a template")
|
|
85
|
-
}), l.map((e) => /* @__PURE__ */
|
|
90
|
+
}), l.map((e) => /* @__PURE__ */ h("option", {
|
|
86
91
|
value: e.id,
|
|
87
92
|
children: e.title
|
|
88
93
|
}, e.id))]
|
|
89
94
|
})]
|
|
90
95
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ g("div", {
|
|
92
97
|
className: "space-y-1.5",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
-
id:
|
|
95
|
-
htmlFor:
|
|
98
|
+
children: [/* @__PURE__ */ h(y, {
|
|
99
|
+
id: d + "registrationLabel",
|
|
100
|
+
htmlFor: d + "registration",
|
|
96
101
|
children: u("eventfullymanaged.certificates.registration", "Attendee registration")
|
|
97
|
-
}), /* @__PURE__ */
|
|
98
|
-
id:
|
|
99
|
-
"aria-labelledby":
|
|
100
|
-
className:
|
|
101
|
-
value:
|
|
102
|
+
}), /* @__PURE__ */ g("select", {
|
|
103
|
+
id: d + "registration",
|
|
104
|
+
"aria-labelledby": d + "registrationLabel",
|
|
105
|
+
className: b,
|
|
106
|
+
value: z?.id ?? "",
|
|
102
107
|
onChange: (e) => {
|
|
103
|
-
|
|
108
|
+
D(e.target.value), j(null);
|
|
104
109
|
},
|
|
105
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ h("option", {
|
|
106
111
|
value: "",
|
|
107
112
|
children: u("eventfullymanaged.certificates.chooseRegistration", "Choose a registration")
|
|
108
|
-
}), w?.items.map((e) => /* @__PURE__ */
|
|
113
|
+
}), w?.items.map((e) => /* @__PURE__ */ g("option", {
|
|
109
114
|
value: e.id,
|
|
110
115
|
children: [
|
|
111
116
|
e.attendeeName || e.id,
|
|
@@ -115,13 +120,13 @@ function b({ eventId: t, templates: l }) {
|
|
|
115
120
|
}, e.id))]
|
|
116
121
|
})]
|
|
117
122
|
}),
|
|
118
|
-
S.error ? /* @__PURE__ */
|
|
123
|
+
S.error ? /* @__PURE__ */ g("p", {
|
|
119
124
|
role: "alert",
|
|
120
125
|
className: "text-sm text-status-error-text",
|
|
121
126
|
children: [
|
|
122
127
|
u("eventfullymanaged.certificates.registrationsError", "Could not load registrations."),
|
|
123
128
|
" ",
|
|
124
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ h(_, {
|
|
125
130
|
type: "button",
|
|
126
131
|
variant: "outline",
|
|
127
132
|
onClick: () => void S.refetch().catch(() => void 0),
|
|
@@ -129,63 +134,73 @@ function b({ eventId: t, templates: l }) {
|
|
|
129
134
|
})
|
|
130
135
|
]
|
|
131
136
|
}) : null,
|
|
132
|
-
w ? /* @__PURE__ */
|
|
133
|
-
offset:
|
|
134
|
-
limit:
|
|
137
|
+
w ? /* @__PURE__ */ h(a, {
|
|
138
|
+
offset: v.offset,
|
|
139
|
+
limit: v.limit,
|
|
135
140
|
total: w.total,
|
|
136
141
|
loadedCount: w.items.length,
|
|
137
|
-
onPrev:
|
|
138
|
-
onNext:
|
|
142
|
+
onPrev: v.prevPage,
|
|
143
|
+
onNext: v.nextPage,
|
|
139
144
|
loading: S.loading,
|
|
140
145
|
itemLabel: "registrations"
|
|
141
146
|
}) : null,
|
|
142
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ g("div", {
|
|
143
148
|
className: "flex flex-wrap gap-2",
|
|
144
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ h(_, {
|
|
145
150
|
type: "button",
|
|
146
151
|
variant: "outline",
|
|
147
|
-
disabled: !
|
|
148
|
-
onClick: () => void
|
|
149
|
-
children:
|
|
150
|
-
}), /* @__PURE__ */
|
|
152
|
+
disabled: !R || !z,
|
|
153
|
+
onClick: () => void G(),
|
|
154
|
+
children: F ? u("eventfullymanaged.certificates.checking", "Checking…") : u("eventfullymanaged.certificates.checkEligibility", "Check eligibility")
|
|
155
|
+
}), /* @__PURE__ */ h(_, {
|
|
151
156
|
type: "submit",
|
|
152
|
-
disabled: !
|
|
153
|
-
children:
|
|
157
|
+
disabled: !V?.eligible,
|
|
158
|
+
children: L ? u("eventfullymanaged.certificates.issuing", "Issuing…") : u("eventfullymanaged.certificates.issue", "Issue certificate")
|
|
154
159
|
})]
|
|
155
160
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ h(C, { eligibility: V }),
|
|
162
|
+
/* @__PURE__ */ h(f, {
|
|
163
|
+
eventId: t,
|
|
164
|
+
registrationId: z?.id,
|
|
165
|
+
templateId: R?.id,
|
|
166
|
+
disabled: U,
|
|
167
|
+
onFound: (e) => N(e ? {
|
|
168
|
+
key: B,
|
|
169
|
+
value: e
|
|
170
|
+
} : null)
|
|
171
|
+
}, B),
|
|
172
|
+
/* @__PURE__ */ h(T, {
|
|
158
173
|
eventId: t,
|
|
159
|
-
receipt:
|
|
174
|
+
receipt: H
|
|
160
175
|
})
|
|
161
176
|
]
|
|
162
177
|
})
|
|
163
178
|
});
|
|
164
179
|
}
|
|
165
|
-
function
|
|
180
|
+
function C({ eligibility: e }) {
|
|
166
181
|
let t = i();
|
|
167
|
-
return e ? e.eligible ? /* @__PURE__ */
|
|
182
|
+
return e ? e.eligible ? /* @__PURE__ */ h("p", {
|
|
168
183
|
className: "text-sm",
|
|
169
184
|
"aria-live": "polite",
|
|
170
185
|
children: t("eventfullymanaged.certificates.eligible", "Eligible for this certificate.")
|
|
171
|
-
}) : /* @__PURE__ */
|
|
186
|
+
}) : /* @__PURE__ */ h("p", {
|
|
172
187
|
className: "text-sm",
|
|
173
188
|
"aria-live": "polite",
|
|
174
189
|
children: e.registrationEligible ? t("eventfullymanaged.certificates.sessionsIneligible", "Required sessions without completed attendance: {{count}}.", { count: e.missingSessionIds.length }) : t("eventfullymanaged.certificates.registrationIneligible", "The registration must be confirmed or checked in.")
|
|
175
190
|
}) : null;
|
|
176
191
|
}
|
|
177
|
-
function
|
|
178
|
-
let n = i(), r =
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
-
className:
|
|
192
|
+
function w({ eventId: e }) {
|
|
193
|
+
let n = i(), r = p(), [a, o] = m(null), [s, { loading: l }] = t({ fetchPolicy: "no-cache" });
|
|
194
|
+
return /* @__PURE__ */ g("section", {
|
|
195
|
+
className: x,
|
|
181
196
|
"aria-labelledby": r + "receiptHeading",
|
|
182
197
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ h("h2", {
|
|
184
199
|
id: r + "receiptHeading",
|
|
185
200
|
className: "text-lg font-semibold",
|
|
186
201
|
children: n("eventfullymanaged.certificates.issuedReceipt", "Issuance receipt")
|
|
187
202
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ g("form", {
|
|
189
204
|
className: "space-y-2",
|
|
190
205
|
onSubmit: async (t) => {
|
|
191
206
|
t.preventDefault();
|
|
@@ -204,18 +219,20 @@ function S({ eventId: e }) {
|
|
|
204
219
|
}
|
|
205
220
|
}
|
|
206
221
|
},
|
|
207
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ h(y, {
|
|
208
223
|
htmlFor: r + "receipt",
|
|
209
224
|
children: n("eventfullymanaged.certificates.receiptId", "Receipt ID")
|
|
210
|
-
}), /* @__PURE__ */
|
|
225
|
+
}), /* @__PURE__ */ g("div", {
|
|
211
226
|
className: "flex flex-wrap items-center gap-2",
|
|
212
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ h(v, {
|
|
213
228
|
id: r + "receipt",
|
|
214
229
|
name: "receiptId",
|
|
215
230
|
className: "flex-1",
|
|
216
231
|
maxLength: 128,
|
|
232
|
+
disabled: l,
|
|
233
|
+
onChange: () => o(null),
|
|
217
234
|
required: !0
|
|
218
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ h(_, {
|
|
219
236
|
type: "submit",
|
|
220
237
|
variant: "outline",
|
|
221
238
|
disabled: l,
|
|
@@ -223,42 +240,46 @@ function S({ eventId: e }) {
|
|
|
223
240
|
})]
|
|
224
241
|
})]
|
|
225
242
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ h(T, {
|
|
227
244
|
eventId: e,
|
|
228
245
|
receipt: a
|
|
229
246
|
})
|
|
230
247
|
]
|
|
231
248
|
});
|
|
232
249
|
}
|
|
233
|
-
function
|
|
250
|
+
function T({ eventId: e, receipt: t }) {
|
|
234
251
|
let n = i();
|
|
235
|
-
return t ? /* @__PURE__ */
|
|
252
|
+
return t ? /* @__PURE__ */ g("div", {
|
|
236
253
|
"aria-live": "polite",
|
|
237
254
|
className: "space-y-2 rounded-card border border-border-seam p-3 text-sm",
|
|
238
255
|
children: [
|
|
239
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ h("h3", {
|
|
240
257
|
className: "font-medium break-words",
|
|
241
258
|
children: t.title
|
|
242
259
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ h("p", { children: n("eventfullymanaged.certificates.receiptIssuedAt", "Issued {{date}}", { date: l(t.issuedAt) }) }),
|
|
261
|
+
/* @__PURE__ */ h("p", { children: n("eventfullymanaged.certificates.receiptTemplateRevision", "Template revision {{revision}}", { revision: t.templateRevision }) }),
|
|
262
|
+
/* @__PURE__ */ h("p", {
|
|
246
263
|
className: "break-all text-text-secondary",
|
|
247
264
|
children: t.id
|
|
248
265
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ h(u, {
|
|
250
267
|
eventId: e,
|
|
251
268
|
receiptId: t.id
|
|
252
|
-
})
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ h(d, {
|
|
271
|
+
eventId: e,
|
|
272
|
+
certificateId: t.id
|
|
273
|
+
}, t.id)
|
|
253
274
|
]
|
|
254
275
|
}) : null;
|
|
255
276
|
}
|
|
256
|
-
function
|
|
257
|
-
return /* @__PURE__ */
|
|
277
|
+
function E(e) {
|
|
278
|
+
return /* @__PURE__ */ g("div", {
|
|
258
279
|
className: "grid gap-4 lg:grid-cols-2",
|
|
259
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ h(S, { ...e }), /* @__PURE__ */ h(w, { eventId: e.eventId })]
|
|
260
281
|
});
|
|
261
282
|
}
|
|
262
|
-
export {
|
|
283
|
+
export { E as CertificateIssuance };
|
|
263
284
|
|
|
264
285
|
//# sourceMappingURL=CertificateIssuance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CertificateIssuance.js","names":["selectClass","cardClass","CertificateIssueForm","tr","useTr","id","useId","paging","usePagination","registrations","useEventCertificateRegistrationsQuery","registrationPage","registrationId","setRegistrationId","useState","templateId","setTemplateId","checked","setChecked","receipt","setReceipt","readEligibility","checking","useEventCertificateEligibilityLazyQuery","issueCertificate","issuing","useIssueEventCertificateMutation","template","templates","item","registration","checkKey","eligibility","busy","issueError","check","result","event","issued","mutationSucceeded","Label","Button","Pagination","AttendanceOutcome","CertificateReceiptDetails","CertificateReceiptLookup","findReceipt","finding","useEventCertificateReceiptLazyQuery","receiptId","Input","formatDateTime","CertificatePdfDownload","CertificateIssuance","props"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx"],"sourcesContent":["import { useId, useState, type FormEvent } from 'react';\nimport { Button, Input, Label } from '@burdenoff/fe-libs/ui';\nimport {\n useEventCertificateEligibilityLazyQuery,\n useEventCertificateReceiptLazyQuery,\n useEventCertificateRegistrationsQuery,\n useIssueEventCertificateMutation,\n type EventCertificateEligibilityQuery,\n type EventCertificateReceiptFieldsFragment,\n type EventCertificateRegistrationsQuery,\n type EventCertificateTemplateFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { Pagination, usePagination } from '../../components/Pagination';\nimport { mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\nimport { CertificatePdfDownload } from './CertificatePdfDownload';\n\nconst selectClass =\n 'min-h-10 w-full rounded-input border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus';\nconst cardClass = 'space-y-4 rounded-card border border-border-seam bg-bg-surface p-4';\n\ntype Eligibility = EventCertificateEligibilityQuery['eventfullyManagedCertificateEligibility'];\ntype Receipt = EventCertificateReceiptFieldsFragment;\n\ntype IssuanceProps = {\n eventId: string;\n templates: EventCertificateTemplateFieldsFragment[];\n};\n\nfunction CertificateIssueForm({ eventId, templates }: IssuanceProps) {\n const tr = useTr();\n const id = useId();\n const paging = usePagination();\n const registrations = useEventCertificateRegistrationsQuery({\n variables: { eventId, limit: paging.limit, offset: paging.offset },\n fetchPolicy: 'no-cache',\n });\n const registrationPage: EventCertificateRegistrationsQuery['eventfullyManagedRegistrations'] | undefined =\n registrations.data?.eventfullyManagedRegistrations;\n const [registrationId, setRegistrationId] = useState('');\n const [templateId, setTemplateId] = useState('');\n const [checked, setChecked] = useState<{ key: string; result: Eligibility } | null>(null);\n const [receipt, setReceipt] = useState<Receipt | null>(null);\n const [readEligibility, { loading: checking }] = useEventCertificateEligibilityLazyQuery({ fetchPolicy: 'no-cache' });\n const [issueCertificate, { loading: issuing }] = useIssueEventCertificateMutation();\n const template = templates.find((item) => item.id === templateId);\n const registration = registrationPage?.items.find((item) => item.id === registrationId);\n const checkKey = JSON.stringify([registration?.id, template?.id, template?.revision, template?.requiredSessionIds]);\n const eligibility = checked?.key === checkKey ? checked.result : undefined;\n const busy = checking || issuing;\n const issueError = tr('eventfullymanaged.certificates.issuanceError', 'Could not confirm certificate issuance');\n\n const check = async () => {\n if (!template || !registration || busy) return;\n setChecked(null);\n try {\n const result = await readEligibility({\n variables: { eventId, registrationId: registration.id, requiredSessionIds: template.requiredSessionIds },\n });\n if (result.error || !result.data?.eventfullyManagedCertificateEligibility)\n throw new Error('Eligibility not confirmed');\n setChecked({ key: checkKey, result: result.data.eventfullyManagedCertificateEligibility });\n } catch {\n notify.error(tr('eventfullymanaged.certificates.eligibilityError', 'Could not confirm attendance eligibility'));\n }\n };\n\n const issue = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!template || !registration || !eligibility?.eligible || busy) return;\n try {\n const result = await issueCertificate({\n variables: { eventId, registrationId: registration.id, templateId: template.id },\n });\n const issued = result.data?.eventfullyManagedIssueCertificate;\n if (!mutationSucceeded(result, issued?.id, issueError) || !issued) return;\n setReceipt(issued);\n } catch {\n notify.error(issueError);\n }\n };\n\n return (\n <form className={cardClass} onSubmit={issue}>\n <fieldset disabled={busy} className=\"space-y-4\">\n <legend className=\"mb-3 text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.manualIssue', 'Issue a certificate')}\n </legend>\n <div className=\"space-y-1.5\">\n <Label id={id + 'templateLabel'} htmlFor={id + 'template'}>\n {tr('eventfullymanaged.certificates.template', 'Certificate template')}\n </Label>\n <select\n id={id + 'template'}\n aria-labelledby={id + 'templateLabel'}\n className={selectClass}\n value={template?.id ?? ''}\n onChange={(event) => {\n setTemplateId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseTemplate', 'Choose a template')}</option>\n {templates.map((item) => (\n <option key={item.id} value={item.id}>\n {item.title}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-1.5\">\n <Label id={id + 'registrationLabel'} htmlFor={id + 'registration'}>\n {tr('eventfullymanaged.certificates.registration', 'Attendee registration')}\n </Label>\n <select\n id={id + 'registration'}\n aria-labelledby={id + 'registrationLabel'}\n className={selectClass}\n value={registration?.id ?? ''}\n onChange={(event) => {\n setRegistrationId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseRegistration', 'Choose a registration')}</option>\n {registrationPage?.items.map((item) => (\n <option key={item.id} value={item.id}>\n {item.attendeeName || item.id} · {item.status}\n </option>\n ))}\n </select>\n </div>\n {registrations.error ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {tr('eventfullymanaged.certificates.registrationsError', 'Could not load registrations.')}{' '}\n <Button type=\"button\" variant=\"outline\" onClick={() => void registrations.refetch().catch(() => undefined)}>\n {tr('eventfullymanaged.certificates.retry', 'Retry')}\n </Button>\n </p>\n ) : null}\n {registrationPage ? (\n <Pagination\n offset={paging.offset}\n limit={paging.limit}\n total={registrationPage.total}\n loadedCount={registrationPage.items.length}\n onPrev={paging.prevPage}\n onNext={paging.nextPage}\n loading={registrations.loading}\n itemLabel=\"registrations\"\n />\n ) : null}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={!template || !registration} onClick={() => void check()}>\n {checking\n ? tr('eventfullymanaged.certificates.checking', 'Checking…')\n : tr('eventfullymanaged.certificates.checkEligibility', 'Check eligibility')}\n </Button>\n <Button type=\"submit\" disabled={!eligibility?.eligible}>\n {issuing\n ? tr('eventfullymanaged.certificates.issuing', 'Issuing…')\n : tr('eventfullymanaged.certificates.issue', 'Issue certificate')}\n </Button>\n </div>\n <AttendanceOutcome eligibility={eligibility} />\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </fieldset>\n </form>\n );\n}\n\nfunction AttendanceOutcome({ eligibility }: { eligibility?: Eligibility }) {\n const tr = useTr();\n if (!eligibility) return null;\n if (eligibility.eligible) {\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {tr('eventfullymanaged.certificates.eligible', 'Eligible for this certificate.')}\n </p>\n );\n }\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {!eligibility.registrationEligible\n ? tr(\n 'eventfullymanaged.certificates.registrationIneligible',\n 'The registration must be confirmed or checked in.'\n )\n : tr(\n 'eventfullymanaged.certificates.sessionsIneligible',\n 'Required sessions without completed attendance: {{count}}.',\n {\n count: eligibility.missingSessionIds.length,\n }\n )}\n </p>\n );\n}\n\nfunction CertificateReceiptLookup({ eventId }: { eventId: string }) {\n const tr = useTr();\n const id = useId();\n const [receipt, setReceipt] = useState<Receipt | null>(null);\n const [findReceipt, { loading: finding }] = useEventCertificateReceiptLazyQuery({ fetchPolicy: 'no-cache' });\n\n const lookup = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const receiptId = String(new FormData(event.currentTarget).get('receiptId') ?? '').trim();\n if (!receiptId || finding) return;\n setReceipt(null);\n try {\n const result = await findReceipt({ variables: { eventId, id: receiptId } });\n if (result.error || !result.data?.eventfullyManagedCertificate) throw new Error('Receipt not confirmed');\n setReceipt(result.data.eventfullyManagedCertificate);\n } catch {\n notify.error(tr('eventfullymanaged.certificates.receiptError', 'Could not find that receipt for this event'));\n }\n };\n\n return (\n <section className={cardClass} aria-labelledby={id + 'receiptHeading'}>\n <h2 id={id + 'receiptHeading'} className=\"text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.issuedReceipt', 'Issuance receipt')}\n </h2>\n <form className=\"space-y-2\" onSubmit={lookup}>\n <Label htmlFor={id + 'receipt'}>{tr('eventfullymanaged.certificates.receiptId', 'Receipt ID')}</Label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Input id={id + 'receipt'} name=\"receiptId\" className=\"flex-1\" maxLength={128} required />\n <Button type=\"submit\" variant=\"outline\" disabled={finding}>\n {finding\n ? tr('eventfullymanaged.certificates.finding', 'Looking up…')\n : tr('eventfullymanaged.certificates.find', 'Find receipt')}\n </Button>\n </div>\n </form>\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </section>\n );\n}\n\nfunction CertificateReceiptDetails({ eventId, receipt }: { eventId: string; receipt: Receipt | null }) {\n const tr = useTr();\n if (!receipt) return null;\n return (\n <div aria-live=\"polite\" className=\"space-y-2 rounded-card border border-border-seam p-3 text-sm\">\n <h3 className=\"font-medium break-words\">{receipt.title}</h3>\n <p>\n {tr('eventfullymanaged.certificates.receiptIssuedAt', 'Issued {{date}}', {\n date: formatDateTime(receipt.issuedAt),\n })}\n </p>\n <p>\n {tr('eventfullymanaged.certificates.receiptTemplateRevision', 'Template revision {{revision}}', {\n revision: receipt.templateRevision,\n })}\n </p>\n <p className=\"break-all text-text-secondary\">{receipt.id}</p>\n <CertificatePdfDownload eventId={eventId} receiptId={receipt.id} />\n </div>\n );\n}\n\nexport function CertificateIssuance(props: IssuanceProps) {\n return (\n <div className=\"grid gap-4 lg:grid-cols-2\">\n <CertificateIssueForm {...props} />\n <CertificateReceiptLookup eventId={props.eventId} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAmBA,IAAMA,IACJ,gMACIC,IAAY;AAUlB,SAASC,EAAqB,EAAE,YAAS,gBAA4B;CACnE,IAAMC,IAAKC,EAAM,GACXC,IAAKC,EAAM,GACXC,IAASC,EAAc,GACvBC,IAAgBC,EAAsC;EAC1D,WAAW;GAAE;GAAS,OAAOH,EAAO;GAAO,QAAQA,EAAO;EAAO;EACjE,aAAa;CACf,CAAC,GACKI,IACJF,EAAc,MAAM,gCAChB,CAACG,GAAgBC,KAAqBC,EAAS,EAAE,GACjD,CAACC,GAAYC,KAAiBF,EAAS,EAAE,GACzC,CAACG,GAASC,KAAcJ,EAAsD,IAAI,GAClF,CAACK,GAASC,KAAcN,EAAyB,IAAI,GACrD,CAACO,GAAiB,EAAE,SAASC,OAAcC,EAAwC,EAAE,aAAa,WAAW,CAAC,GAC9G,CAACC,GAAkB,EAAE,SAASC,OAAaC,EAAiC,GAC5EC,IAAWC,EAAU,MAAM,MAASC,EAAK,OAAOd,CAAU,GAC1De,IAAenB,GAAkB,MAAM,MAAM,MAASkB,EAAK,OAAOjB,CAAc,GAChFmB,IAAW,KAAK,UAAU;EAACD,GAAc;EAAIH,GAAU;EAAIA,GAAU;EAAUA,GAAU;CAAkB,CAAC,GAC5GK,IAAcf,GAAS,QAAQc,IAAWd,EAAQ,SAAS,KAAA,GAC3DgB,IAAOX,KAAYG,GACnBS,IAAa/B,EAAG,gDAAgD,wCAAwC,GAExGgC,IAAQ,YAAY;EACxB,IAAKR,KAA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AAA,EAAQ;GAAU,CAAA;GAC3D,kBAAC,KAAD,EAAA,UACGhB,EAAG,kDAAkD,mBAAmB,EACvE,MAAMgD,EAAehC,EAAQ,QAAQ,EACvC,CAAC,EACA,CAAA;GACH,kBAAC,KAAD,EAAA,UACGhB,EAAG,0DAA0D,kCAAkC,EAC9F,UAAUgB,EAAQ,iBACpB,CAAC,EACA,CAAA;GACH,kBAAC,KAAD;IAAG,WAAU;IAAiC,UAAAA,EAAQ;GAAM,CAAA;GAC5D,kBAACiC,GAAD;IAAiC;IAAS,WAAWjC,EAAQ;GAAK,CAAA;EAC/D;C,KAhBc;AAkBvB;AAEA,SAAgBkC,EAAoB,GAAsB;CACxD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACnD,GAAD,EAAsB,GAAIoD,EAAQ,CAAA,GAClC,kBAACT,GAAD,EAA0B,SAASS,EAAM,QAAU,CAAA,CAChD;;AAET"}
|
|
1
|
+
{"version":3,"file":"CertificateIssuance.js","names":["selectClass","cardClass","CertificateIssueForm","tr","useTr","id","useId","paging","usePagination","registrations","useEventCertificateRegistrationsQuery","registrationPage","registrationId","setRegistrationId","useState","templateId","setTemplateId","checked","setChecked","issuedReceipt","setIssuedReceipt","readEligibility","checking","useEventCertificateEligibilityLazyQuery","issueCertificate","issuing","useIssueEventCertificateMutation","template","templates","item","registration","checkKey","eligibility","receipt","busy","issueError","check","result","event","issued","mutationSucceeded","Label","Button","Pagination","AttendanceOutcome","CertificateReceiptSearch","CertificateReceiptDetails","CertificateReceiptLookup","setReceipt","findReceipt","finding","useEventCertificateReceiptLazyQuery","receiptId","Input","formatDateTime","CertificatePdfDownload","CertificateEmailControls","CertificateIssuance","props"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateIssuance.tsx"],"sourcesContent":["import { useId, useState, type FormEvent } from 'react';\nimport { Button, Input, Label } from '@burdenoff/fe-libs/ui';\nimport {\n useEventCertificateEligibilityLazyQuery,\n useEventCertificateReceiptLazyQuery,\n useEventCertificateRegistrationsQuery,\n useIssueEventCertificateMutation,\n type EventCertificateEligibilityQuery,\n type EventCertificateReceiptFieldsFragment,\n type EventCertificateRegistrationsQuery,\n type EventCertificateTemplateFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { Pagination, usePagination } from '../../components/Pagination';\nimport { mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\nimport { CertificatePdfDownload } from './CertificatePdfDownload';\nimport { CertificateEmailControls } from './CertificateEmailControls';\nimport { CertificateReceiptSearch } from './CertificateReceiptSearch';\n\nconst selectClass =\n 'min-h-10 w-full rounded-input border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus';\nconst cardClass = 'space-y-4 rounded-card border border-border-seam bg-bg-surface p-4';\n\ntype Eligibility = EventCertificateEligibilityQuery['eventfullyManagedCertificateEligibility'];\ntype Receipt = EventCertificateReceiptFieldsFragment;\n\ntype IssuanceProps = {\n eventId: string;\n templates: EventCertificateTemplateFieldsFragment[];\n};\n\nfunction CertificateIssueForm({ eventId, templates }: IssuanceProps) {\n const tr = useTr();\n const id = useId();\n const paging = usePagination();\n const registrations = useEventCertificateRegistrationsQuery({\n variables: { eventId, limit: paging.limit, offset: paging.offset },\n fetchPolicy: 'no-cache',\n });\n const registrationPage: EventCertificateRegistrationsQuery['eventfullyManagedRegistrations'] | undefined =\n registrations.data?.eventfullyManagedRegistrations;\n const [registrationId, setRegistrationId] = useState('');\n const [templateId, setTemplateId] = useState('');\n const [checked, setChecked] = useState<{ key: string; result: Eligibility } | null>(null);\n const [issuedReceipt, setIssuedReceipt] = useState<{ key: string; value: Receipt } | null>(null);\n const [readEligibility, { loading: checking }] = useEventCertificateEligibilityLazyQuery({ fetchPolicy: 'no-cache' });\n const [issueCertificate, { loading: issuing }] = useIssueEventCertificateMutation();\n const template = templates.find((item) => item.id === templateId);\n const registration = registrationPage?.items.find((item) => item.id === registrationId);\n const checkKey = JSON.stringify([registration?.id, template?.id, template?.revision, template?.requiredSessionIds]);\n const eligibility = checked?.key === checkKey ? checked.result : undefined;\n const receipt = issuedReceipt?.key === checkKey ? issuedReceipt.value : null;\n const busy = checking || issuing;\n const issueError = tr('eventfullymanaged.certificates.issuanceError', 'Could not confirm certificate issuance');\n\n const check = async () => {\n if (!template || !registration || busy) return;\n setChecked(null);\n try {\n const result = await readEligibility({\n variables: { eventId, registrationId: registration.id, requiredSessionIds: template.requiredSessionIds },\n });\n if (result.error || !result.data?.eventfullyManagedCertificateEligibility)\n throw new Error('Eligibility not confirmed');\n setChecked({ key: checkKey, result: result.data.eventfullyManagedCertificateEligibility });\n } catch {\n notify.error(tr('eventfullymanaged.certificates.eligibilityError', 'Could not confirm attendance eligibility'));\n }\n };\n\n const issue = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!template || !registration || !eligibility?.eligible || busy) return;\n try {\n const result = await issueCertificate({\n variables: { eventId, registrationId: registration.id, templateId: template.id },\n });\n const issued = result.data?.eventfullyManagedIssueCertificate;\n if (!mutationSucceeded(result, issued?.id, issueError) || !issued) return;\n setIssuedReceipt({ key: checkKey, value: issued });\n } catch {\n notify.error(issueError);\n }\n };\n\n return (\n <form className={cardClass} onSubmit={issue}>\n <fieldset disabled={busy} className=\"space-y-4\">\n <legend className=\"mb-3 text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.manualIssue', 'Issue a certificate')}\n </legend>\n <div className=\"space-y-1.5\">\n <Label id={id + 'templateLabel'} htmlFor={id + 'template'}>\n {tr('eventfullymanaged.certificates.template', 'Certificate template')}\n </Label>\n <select\n id={id + 'template'}\n aria-labelledby={id + 'templateLabel'}\n className={selectClass}\n value={template?.id ?? ''}\n onChange={(event) => {\n setTemplateId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseTemplate', 'Choose a template')}</option>\n {templates.map((item) => (\n <option key={item.id} value={item.id}>\n {item.title}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-1.5\">\n <Label id={id + 'registrationLabel'} htmlFor={id + 'registration'}>\n {tr('eventfullymanaged.certificates.registration', 'Attendee registration')}\n </Label>\n <select\n id={id + 'registration'}\n aria-labelledby={id + 'registrationLabel'}\n className={selectClass}\n value={registration?.id ?? ''}\n onChange={(event) => {\n setRegistrationId(event.target.value);\n setChecked(null);\n }}\n >\n <option value=\"\">{tr('eventfullymanaged.certificates.chooseRegistration', 'Choose a registration')}</option>\n {registrationPage?.items.map((item) => (\n <option key={item.id} value={item.id}>\n {item.attendeeName || item.id} · {item.status}\n </option>\n ))}\n </select>\n </div>\n {registrations.error ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {tr('eventfullymanaged.certificates.registrationsError', 'Could not load registrations.')}{' '}\n <Button type=\"button\" variant=\"outline\" onClick={() => void registrations.refetch().catch(() => undefined)}>\n {tr('eventfullymanaged.certificates.retry', 'Retry')}\n </Button>\n </p>\n ) : null}\n {registrationPage ? (\n <Pagination\n offset={paging.offset}\n limit={paging.limit}\n total={registrationPage.total}\n loadedCount={registrationPage.items.length}\n onPrev={paging.prevPage}\n onNext={paging.nextPage}\n loading={registrations.loading}\n itemLabel=\"registrations\"\n />\n ) : null}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={!template || !registration} onClick={() => void check()}>\n {checking\n ? tr('eventfullymanaged.certificates.checking', 'Checking…')\n : tr('eventfullymanaged.certificates.checkEligibility', 'Check eligibility')}\n </Button>\n <Button type=\"submit\" disabled={!eligibility?.eligible}>\n {issuing\n ? tr('eventfullymanaged.certificates.issuing', 'Issuing…')\n : tr('eventfullymanaged.certificates.issue', 'Issue certificate')}\n </Button>\n </div>\n <AttendanceOutcome eligibility={eligibility} />\n <CertificateReceiptSearch\n key={checkKey}\n eventId={eventId}\n registrationId={registration?.id}\n templateId={template?.id}\n disabled={busy}\n onFound={(receipt) => setIssuedReceipt(receipt ? { key: checkKey, value: receipt } : null)}\n />\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </fieldset>\n </form>\n );\n}\n\nfunction AttendanceOutcome({ eligibility }: { eligibility?: Eligibility }) {\n const tr = useTr();\n if (!eligibility) return null;\n if (eligibility.eligible) {\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {tr('eventfullymanaged.certificates.eligible', 'Eligible for this certificate.')}\n </p>\n );\n }\n return (\n <p className=\"text-sm\" aria-live=\"polite\">\n {!eligibility.registrationEligible\n ? tr(\n 'eventfullymanaged.certificates.registrationIneligible',\n 'The registration must be confirmed or checked in.'\n )\n : tr(\n 'eventfullymanaged.certificates.sessionsIneligible',\n 'Required sessions without completed attendance: {{count}}.',\n {\n count: eligibility.missingSessionIds.length,\n }\n )}\n </p>\n );\n}\n\nfunction CertificateReceiptLookup({ eventId }: { eventId: string }) {\n const tr = useTr();\n const id = useId();\n const [receipt, setReceipt] = useState<Receipt | null>(null);\n const [findReceipt, { loading: finding }] = useEventCertificateReceiptLazyQuery({ fetchPolicy: 'no-cache' });\n\n const lookup = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n const receiptId = String(new FormData(event.currentTarget).get('receiptId') ?? '').trim();\n if (!receiptId || finding) return;\n setReceipt(null);\n try {\n const result = await findReceipt({ variables: { eventId, id: receiptId } });\n if (result.error || !result.data?.eventfullyManagedCertificate) throw new Error('Receipt not confirmed');\n setReceipt(result.data.eventfullyManagedCertificate);\n } catch {\n notify.error(tr('eventfullymanaged.certificates.receiptError', 'Could not find that receipt for this event'));\n }\n };\n\n return (\n <section className={cardClass} aria-labelledby={id + 'receiptHeading'}>\n <h2 id={id + 'receiptHeading'} className=\"text-lg font-semibold\">\n {tr('eventfullymanaged.certificates.issuedReceipt', 'Issuance receipt')}\n </h2>\n <form className=\"space-y-2\" onSubmit={lookup}>\n <Label htmlFor={id + 'receipt'}>{tr('eventfullymanaged.certificates.receiptId', 'Receipt ID')}</Label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Input\n id={id + 'receipt'}\n name=\"receiptId\"\n className=\"flex-1\"\n maxLength={128}\n disabled={finding}\n onChange={() => setReceipt(null)}\n required\n />\n <Button type=\"submit\" variant=\"outline\" disabled={finding}>\n {finding\n ? tr('eventfullymanaged.certificates.finding', 'Looking up…')\n : tr('eventfullymanaged.certificates.find', 'Find receipt')}\n </Button>\n </div>\n </form>\n <CertificateReceiptDetails eventId={eventId} receipt={receipt} />\n </section>\n );\n}\n\nfunction CertificateReceiptDetails({ eventId, receipt }: { eventId: string; receipt: Receipt | null }) {\n const tr = useTr();\n if (!receipt) return null;\n return (\n <div aria-live=\"polite\" className=\"space-y-2 rounded-card border border-border-seam p-3 text-sm\">\n <h3 className=\"font-medium break-words\">{receipt.title}</h3>\n <p>\n {tr('eventfullymanaged.certificates.receiptIssuedAt', 'Issued {{date}}', {\n date: formatDateTime(receipt.issuedAt),\n })}\n </p>\n <p>\n {tr('eventfullymanaged.certificates.receiptTemplateRevision', 'Template revision {{revision}}', {\n revision: receipt.templateRevision,\n })}\n </p>\n <p className=\"break-all text-text-secondary\">{receipt.id}</p>\n <CertificatePdfDownload eventId={eventId} receiptId={receipt.id} />\n <CertificateEmailControls key={receipt.id} eventId={eventId} certificateId={receipt.id} />\n </div>\n );\n}\n\nexport function CertificateIssuance(props: IssuanceProps) {\n return (\n <div className=\"grid gap-4 lg:grid-cols-2\">\n <CertificateIssueForm {...props} />\n <CertificateReceiptLookup eventId={props.eventId} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAMA,IACJ,gMACIC,IAAY;AAUlB,SAASC,EAAqB,EAAE,YAAS,gBAA4B;CACnE,IAAMC,IAAKC,EAAM,GACXC,IAAKC,EAAM,GACXC,IAASC,EAAc,GACvBC,IAAgBC,EAAsC;EAC1D,WAAW;GAAE;GAAS,OAAOH,EAAO;GAAO,QAAQA,EAAO;EAAO;EACjE,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AD;IAAG,WAAU;IAAiC,UAAAA,EAAQ;GAAM,CAAA;GAC5D,kBAACsB,GAAD;IAAiC;IAAS,WAAWtB,EAAQ;GAAK,CAAA;GAClE,kBAACuB,GAAD;IAAoD;IAAS,eAAevB,EAAQ;GAAK,GAA1DA,EAAQ,EAAkD;EACtF;C,KAjBc;AAmBvB;AAEA,SAAgBwB,EAAoB,GAAsB;CACxD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACvD,GAAD,EAAsB,GAAIwD,EAAQ,CAAA,GAClC,kBAACX,GAAD,EAA0B,SAASW,EAAM,QAAU,CAAA,CAChD;;AAET"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EventCertificateReceiptFieldsFragment } from '../../../generated/wspace-operations';
|
|
2
|
+
export declare function CertificateReceiptSearch({ disabled, eventId, registrationId, templateId, onFound, }: {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
eventId: string;
|
|
5
|
+
registrationId?: string;
|
|
6
|
+
templateId?: string;
|
|
7
|
+
onFound: (receipt: EventCertificateReceiptFieldsFragment | null) => void;
|
|
8
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEventIssuedCertificateLazyQuery as e } from "../../../generated/wspace-operations.js";
|
|
2
|
+
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { notify as n } from "../../lib/toast.js";
|
|
4
|
+
import { useState as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { Button as o } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
// src/eventfullymanaged/pages/certificates/CertificateReceiptSearch.tsx
|
|
8
|
+
function s({ disabled: s, eventId: c, registrationId: l, templateId: u, onFound: d }) {
|
|
9
|
+
let f = t(), [p, m] = r(!1), [h, { loading: g }] = e({ fetchPolicy: "no-cache" }), _ = async () => {
|
|
10
|
+
if (l && u && !g && !s) {
|
|
11
|
+
m(!1), d(null);
|
|
12
|
+
try {
|
|
13
|
+
let e = await h({ variables: {
|
|
14
|
+
eventId: c,
|
|
15
|
+
registrationId: l,
|
|
16
|
+
templateId: u
|
|
17
|
+
} });
|
|
18
|
+
if (e.error || !e.data) throw Error("Certificate lookup was not confirmed.");
|
|
19
|
+
let t = e.data.eventfullyManagedIssuedCertificate;
|
|
20
|
+
t ? d(t) : m(!0);
|
|
21
|
+
} catch {
|
|
22
|
+
n.error(f("eventfullymanaged.certificates.selectedReceiptError", "Could not look up an issued certificate."));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ a("div", {
|
|
27
|
+
className: "space-y-2",
|
|
28
|
+
children: [/* @__PURE__ */ i(o, {
|
|
29
|
+
type: "button",
|
|
30
|
+
variant: "outline",
|
|
31
|
+
disabled: s || g || !l || !u,
|
|
32
|
+
onClick: () => void _(),
|
|
33
|
+
children: g ? f("eventfullymanaged.certificates.finding", "Looking up…") : f("eventfullymanaged.certificates.findIssued", "Find issued certificate")
|
|
34
|
+
}), p ? /* @__PURE__ */ i("p", {
|
|
35
|
+
role: "status",
|
|
36
|
+
className: "text-sm text-text-secondary",
|
|
37
|
+
children: f("eventfullymanaged.certificates.noIssuedCertificate", "No certificate has been issued for this registration and template.")
|
|
38
|
+
}) : null]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { s as CertificateReceiptSearch };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=CertificateReceiptSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CertificateReceiptSearch.js","names":["CertificateReceiptSearch","tr","useTr","missing","setMissing","useState","find","useEventIssuedCertificateLazyQuery","search","registrationId","templateId","onFound","result","receipt","Button","disabled","loading"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateReceiptSearch.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport {\n useEventIssuedCertificateLazyQuery,\n type EventCertificateReceiptFieldsFragment,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { notify } from '../../lib/toast';\n\nexport function CertificateReceiptSearch({\n disabled,\n eventId,\n registrationId,\n templateId,\n onFound,\n}: {\n disabled?: boolean;\n eventId: string;\n registrationId?: string;\n templateId?: string;\n onFound: (receipt: EventCertificateReceiptFieldsFragment | null) => void;\n}) {\n const tr = useTr();\n const [missing, setMissing] = useState(false);\n const [find, { loading }] = useEventIssuedCertificateLazyQuery({ fetchPolicy: 'no-cache' });\n\n const search = async () => {\n if (!registrationId || !templateId || loading || disabled) return;\n setMissing(false);\n onFound(null);\n try {\n const result = await find({ variables: { eventId, registrationId, templateId } });\n if (result.error || !result.data) throw new Error('Certificate lookup was not confirmed.');\n const receipt = result.data.eventfullyManagedIssuedCertificate;\n if (receipt) onFound(receipt);\n else setMissing(true);\n } catch {\n notify.error(\n tr('eventfullymanaged.certificates.selectedReceiptError', 'Could not look up an issued certificate.')\n );\n }\n };\n\n return (\n <div className=\"space-y-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={disabled || loading || !registrationId || !templateId}\n onClick={() => void search()}\n >\n {loading\n ? tr('eventfullymanaged.certificates.finding', 'Looking up…')\n : tr('eventfullymanaged.certificates.findIssued', 'Find issued certificate')}\n </Button>\n {missing ? (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n {tr(\n 'eventfullymanaged.certificates.noIssuedCertificate',\n 'No certificate has been issued for this registration and template.'\n )}\n </p>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;AASA,SAAgBA,EAAyB,EACvC,aACA,YACA,mBACA,eACA,cAOC;CACD,IAAMC,IAAKC,EAAM,GACX,CAACC,GAASC,KAAcC,EAAS,EAAK,GACtC,CAACC,GAAM,EAAE,gBAAaC,EAAmC,EAAE,aAAa,WAAW,CAAC,GAEpFC,IAAS,YAAY;EACzB,IAAKC,KAAmBC,KAAc,MAAW,IACjD;GACA,AADAN,EAAW,EAAK,GAChBO,EAAQ,IAAI;GACZ,IAAI;IACF,IAAMC,IAAS,MAAMN,EAAK,EAAE,WAAW;KAAE;KAAS;KAAgB;IAAW,EAAE,CAAC;IAChF,IAAIM,EAAO,SAAS,CAACA,EAAO,MAAM,MAAU,MAAM,uCAAuC;IACzF,IAAMC,IAAUD,EAAO,KAAK;IAC5B,AAAIC,IAASF,EAAQE,CAAO,IACvBT,EAAW,EAAI;GACtB,QAAQ;IACN,EAAO,MACLH,EAAG,uDAAuD,0CAA0C,CACtG;GACF;EAZgB;CAalB;CAEA,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACa,GAAD;GACE,MAAK;GACL,SAAQ;GACR,UAAUC,KAAYC,KAAW,CAACP,KAAkB,CAACC;GACrD,eAAe,KAAKF,EAAO;GAE1B,UAAAQ,IACGf,EAAG,0CAA0C,aAAa,IAC1DA,EAAG,6CAA6C,yBAAyB;EACvE,CAAA,GACPE,IACC,kBAAC,KAAD;GAAG,MAAK;GAAS,WAAU;GACxB,UAAAF,EACC,sDACA,oEACF;EACC,CAAA,IACD,IACD;;AAET"}
|
|
@@ -8,16 +8,17 @@ import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
|
8
8
|
import { Button as c, Dialog as l, DialogContent as u, DialogDescription as d, DialogHeader as f, DialogTitle as p } from "@burdenoff/fe-libs/ui";
|
|
9
9
|
// src/eventfullymanaged/pages/certificates/CertificateScheduleDialog.tsx
|
|
10
10
|
function m({ eventId: i, template: m, onClose: g }) {
|
|
11
|
-
let _ = t(), [v, { loading: y }] = e(), [b, x] = a(
|
|
12
|
-
if (!(y ||
|
|
11
|
+
let _ = t(), [v, { loading: y }] = e(), [b, x] = a(!1), [S, C] = a(null), w = _("eventfullymanaged.certificates.scheduleError", "Could not schedule certificate issuance"), T = async () => {
|
|
12
|
+
if (!(y || S)) try {
|
|
13
13
|
let e = await v({ variables: {
|
|
14
14
|
eventId: i,
|
|
15
15
|
templateId: m.id,
|
|
16
|
-
templateRevision: m.revision
|
|
16
|
+
templateRevision: m.revision,
|
|
17
|
+
sendEmail: b
|
|
17
18
|
} }), t = e.data?.eventfullyManagedScheduleCertificateIssuance;
|
|
18
|
-
n(e, t?.id,
|
|
19
|
+
n(e, t?.id, w) && t && C(t);
|
|
19
20
|
} catch {
|
|
20
|
-
r.error(
|
|
21
|
+
r.error(w);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
return /* @__PURE__ */ o(l, {
|
|
@@ -26,7 +27,7 @@ function m({ eventId: i, template: m, onClose: g }) {
|
|
|
26
27
|
!e && !y && g();
|
|
27
28
|
},
|
|
28
29
|
children: /* @__PURE__ */ s(u, { children: [
|
|
29
|
-
/* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: _("eventfullymanaged.certificates.schedule", "Schedule automatic issuance") }), /* @__PURE__ */ o(d, { children: _("eventfullymanaged.certificates.scheduleHelp", "Schedule
|
|
30
|
+
/* @__PURE__ */ s(f, { children: [/* @__PURE__ */ o(p, { children: _("eventfullymanaged.certificates.schedule", "Schedule automatic issuance") }), /* @__PURE__ */ o(d, { children: _("eventfullymanaged.certificates.scheduleHelp", "Schedule issuance after the last required session ends. Scheduling the same revision opens its existing run.") })] }),
|
|
30
31
|
/* @__PURE__ */ s("p", {
|
|
31
32
|
className: "break-words font-medium",
|
|
32
33
|
children: [
|
|
@@ -36,7 +37,15 @@ function m({ eventId: i, template: m, onClose: g }) {
|
|
|
36
37
|
_("eventfullymanaged.certificates.revision", "Revision {{revision}}", { revision: m.revision })
|
|
37
38
|
]
|
|
38
39
|
}),
|
|
39
|
-
|
|
40
|
+
S ? /* @__PURE__ */ o(h, { run: S }) : /* @__PURE__ */ s("label", {
|
|
41
|
+
className: "flex min-h-10 items-center gap-2 text-sm",
|
|
42
|
+
children: [/* @__PURE__ */ o("input", {
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
checked: b,
|
|
45
|
+
disabled: y,
|
|
46
|
+
onChange: (e) => x(e.target.checked)
|
|
47
|
+
}), _("eventfullymanaged.certificates.scheduleEmail", "Email the PDFs to eligible attendees")]
|
|
48
|
+
}),
|
|
40
49
|
/* @__PURE__ */ s("div", {
|
|
41
50
|
className: "flex flex-wrap justify-end gap-2",
|
|
42
51
|
children: [/* @__PURE__ */ o(c, {
|
|
@@ -44,11 +53,11 @@ function m({ eventId: i, template: m, onClose: g }) {
|
|
|
44
53
|
variant: "outline",
|
|
45
54
|
disabled: y,
|
|
46
55
|
onClick: g,
|
|
47
|
-
children:
|
|
48
|
-
}),
|
|
56
|
+
children: S ? _("eventfullymanaged.certificates.done", "Done") : _("eventfullymanaged.certificates.cancel", "Cancel")
|
|
57
|
+
}), S ? null : /* @__PURE__ */ o(c, {
|
|
49
58
|
type: "button",
|
|
50
59
|
disabled: y,
|
|
51
|
-
onClick: () => void
|
|
60
|
+
onClick: () => void T(),
|
|
52
61
|
children: y ? _("eventfullymanaged.certificates.scheduling", "Scheduling…") : _("eventfullymanaged.certificates.scheduleConfirm", "Schedule issuance")
|
|
53
62
|
})]
|
|
54
63
|
})
|
|
@@ -62,6 +71,7 @@ function h({ run: e }) {
|
|
|
62
71
|
role: "status",
|
|
63
72
|
children: [
|
|
64
73
|
/* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.scheduleStatus", "Run status: {{status}}", { status: e.status }) }),
|
|
74
|
+
/* @__PURE__ */ o("p", { children: e.sendEmail ? n("eventfullymanaged.certificates.scheduleEmailOn", "Automatic email: On") : n("eventfullymanaged.certificates.scheduleEmailOff", "Automatic email: Off") }),
|
|
65
75
|
e.status === "pending" ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.nextAttempt", "Next attempt: {{date}}", { date: i(e.nextAttemptAt) }) }) : null,
|
|
66
76
|
e.completedAt ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.runFinished", "Finished: {{date}}", { date: i(e.completedAt) }) }) : null,
|
|
67
77
|
/* @__PURE__ */ o("p", {
|