@burdenoff/microfe-eventfullymanaged 2026.1124.1 → 2026.1124.3
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/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 +143 -111
- package/dist/eventfullymanaged/pages/certificates/CertificateIssuance.js.map +1 -1
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.d.ts +4 -0
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js +31 -0
- package/dist/eventfullymanaged/pages/certificates/CertificatePdfDownload.js.map +1 -0
- 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.d.ts +6 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js +86 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateScheduleDialog.js.map +1 -0
- package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js +71 -60
- package/dist/eventfullymanaged/pages/certificates/CertificateTemplates.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +240 -0
- package/dist/generated/wspace-operations.js +133 -30
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +651 -6
- 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
|
@@ -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","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';\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 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 receipt={receipt} />\n </section>\n );\n}\n\nfunction CertificateReceiptDetails({ receipt }: { 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 </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":";;;;;;;;;;AAkBA,IAAMA,IACJ,gMACIC,IAAY;AAUlB,SAASC,EAAqB,EAAE,YAAS,gBAA4B;CACnE,IAAMC,IAAKC,EAAM,GACXC,IAAKC,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ClC,kBAACR,GAAD,EAA0B,SAASQ,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,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,GAAeC,KAAoBN,EAAiD,IAAI,GACzF,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,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U6C;MACV,gBAAgBF,EAAW,IAAI;MAC/B,UAAA;KACD,CAAA,GACD,kBAACN,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,UAAUQ;MAC/C,UAAAA,IACG/C,EAAG,0CAA0C,aAAa,IAC1DA,EAAG,uCAAuC,cAAc;KACtD,CAAA,CACL;IACD,CAAA,CAAA;;GACN,kBAAC2C,GAAD;IAAoC;IAAkB;GAAU,CAAA;EACzD;;AAEb;AAEA,SAASA,EAA0B,EAAE,YAAS,cAAyD;CACrG,IAAM3C,IAAKC,EAAM;CAEjB,OADK6B,IAEH,kBAAC,OAAD;EAAK,aAAU;EAAS,WAAU;EAAlC,UAAA;GACE,kBAAC,MAAD;IAAI,WAAU;IAA2B,UAAAA,EAAQ;GAAU,CAAA;GAC3D,kBAAC,KAAD,EAAA,UACG9B,EAAG,kDAAkD,mBAAmB,EACvE,MAAMmD,EAAerB,EAAQ,QAAQ,EACvC,CAAC,EACA,CAAA;GACH,kBAAC,KAAD,EAAA,UACG9B,EAAG,0DAA0D,kCAAkC,EAC9F,UAAU8B,EAAQ,iBACpB,CAAC,EACA,CAAA;GACH,kBAAC,KAAD;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,31 @@
|
|
|
1
|
+
import { useEventCertificatePdfLazyQuery as e } from "../../../generated/wspace-operations.js";
|
|
2
|
+
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { downloadBase64Pdf as n } from "../../api/eventApi.js";
|
|
4
|
+
import { notify as r } from "../../lib/toast.js";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { Button as a } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
// src/eventfullymanaged/pages/certificates/CertificatePdfDownload.tsx
|
|
8
|
+
function o({ eventId: o, receiptId: s }) {
|
|
9
|
+
let c = t(), [l, { loading: u }] = e({ fetchPolicy: "no-cache" }), d = async () => {
|
|
10
|
+
if (!u) try {
|
|
11
|
+
let e = await l({ variables: {
|
|
12
|
+
eventId: o,
|
|
13
|
+
id: s
|
|
14
|
+
} }), t = e.data?.eventfullyManagedCertificatePdf;
|
|
15
|
+
if (e.error || t?.contentType !== "application/pdf" || !t.contentBase64.startsWith("JVBERi0") || !/^certificate-[a-z0-9-]+\.pdf$/i.test(t.filename)) throw Error("Certificate PDF was not confirmed.");
|
|
16
|
+
n(t.contentBase64, t.filename);
|
|
17
|
+
} catch {
|
|
18
|
+
r.error(c("eventfullymanaged.certificates.pdfError", "Could not download the certificate PDF."));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ i(a, {
|
|
22
|
+
type: "button",
|
|
23
|
+
variant: "outline",
|
|
24
|
+
disabled: u,
|
|
25
|
+
onClick: () => void d(),
|
|
26
|
+
children: u ? c("eventfullymanaged.certificates.pdfLoading", "Preparing PDF…") : c("eventfullymanaged.certificates.pdfDownload", "Download PDF")
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { o as CertificatePdfDownload };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=CertificatePdfDownload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CertificatePdfDownload.js","names":["CertificatePdfDownload","tr","useTr","readPdf","useEventCertificatePdfLazyQuery","download","response","receiptId","pdf","Button","loading"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificatePdfDownload.tsx"],"sourcesContent":["import { Button } from '@burdenoff/fe-libs/ui';\nimport { useEventCertificatePdfLazyQuery } from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { downloadBase64Pdf } from '../../api/eventApi';\nimport { notify } from '../../lib/toast';\n\nexport function CertificatePdfDownload({ eventId, receiptId }: { eventId: string; receiptId: string }) {\n const tr = useTr();\n const [readPdf, { loading }] = useEventCertificatePdfLazyQuery({ fetchPolicy: 'no-cache' });\n const download = async () => {\n if (loading) return;\n try {\n const response = await readPdf({ variables: { eventId, id: receiptId } });\n const pdf = response.data?.eventfullyManagedCertificatePdf;\n if (\n response.error ||\n pdf?.contentType !== 'application/pdf' ||\n !pdf.contentBase64.startsWith('JVBERi0') ||\n !/^certificate-[a-z0-9-]+\\.pdf$/i.test(pdf.filename)\n ) {\n throw new Error('Certificate PDF was not confirmed.');\n }\n downloadBase64Pdf(pdf.contentBase64, pdf.filename);\n } catch {\n notify.error(tr('eventfullymanaged.certificates.pdfError', 'Could not download the certificate PDF.'));\n }\n };\n\n return (\n <Button type=\"button\" variant=\"outline\" disabled={loading} onClick={() => void download()}>\n {loading\n ? tr('eventfullymanaged.certificates.pdfLoading', 'Preparing PDF…')\n : tr('eventfullymanaged.certificates.pdfDownload', 'Download PDF')}\n </Button>\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgBA,EAAuB,EAAE,YAAS,gBAAqD;CACrG,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAS,EAAE,gBAAaC,EAAgC,EAAE,aAAa,WAAW,CAAC,GACpFC,IAAW,YAAY;EAC3B,IAAI,IACJ,IAAI;GACF,IAAMC,IAAW,MAAMH,EAAQ,EAAE,WAAW;IAAE;IAAS,IAAII;GAAU,EAAE,CAAC,GAClEC,IAAMF,EAAS,MAAM;GAC3B,IACEA,EAAS,SACTE,GAAK,gBAAgB,qBACrB,CAACA,EAAI,cAAc,WAAW,SAAS,KACvC,CAAC,iCAAiC,KAAKA,EAAI,QAAQ,GAEnD,MAAU,MAAM,oCAAoC;GAEtD,EAAkBA,EAAI,eAAeA,EAAI,QAAQ;EACnD,QAAQ;GACN,EAAO,MAAMP,EAAG,2CAA2C,yCAAyC,CAAC;EACvG;CACF;CAEA,OACE,kBAACQ,GAAD;EAAQ,MAAK;EAAS,SAAQ;EAAU,UAAUC;EAAS,eAAe,KAAKL,EAAS;EACrF,UAAAK,IACGT,EAAG,6CAA6C,gBAAgB,IAChEA,EAAG,8CAA8C,cAAc;CAC7D,CAAA;AAEZ"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventCertificateTemplateFieldsFragment } from '../../../generated/wspace-operations';
|
|
2
|
+
export declare function CertificateScheduleDialog({ eventId, template, onClose, }: {
|
|
3
|
+
eventId: string;
|
|
4
|
+
template: EventCertificateTemplateFieldsFragment;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useScheduleEventCertificateIssuanceMutation as e } from "../../../generated/wspace-operations.js";
|
|
2
|
+
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { mutationSucceeded as n } from "../../lib/mutationResult.js";
|
|
4
|
+
import { notify as r } from "../../lib/toast.js";
|
|
5
|
+
import { formatDateTime as i } from "../events/eventFormUtils.js";
|
|
6
|
+
import { useState as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
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
|
+
// src/eventfullymanaged/pages/certificates/CertificateScheduleDialog.tsx
|
|
10
|
+
function m({ eventId: i, template: m, onClose: g }) {
|
|
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
|
+
let e = await v({ variables: {
|
|
14
|
+
eventId: i,
|
|
15
|
+
templateId: m.id,
|
|
16
|
+
templateRevision: m.revision,
|
|
17
|
+
sendEmail: b
|
|
18
|
+
} }), t = e.data?.eventfullyManagedScheduleCertificateIssuance;
|
|
19
|
+
n(e, t?.id, w) && t && C(t);
|
|
20
|
+
} catch {
|
|
21
|
+
r.error(w);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ o(l, {
|
|
25
|
+
open: !0,
|
|
26
|
+
onOpenChange: (e) => {
|
|
27
|
+
!e && !y && g();
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */ s(u, { children: [
|
|
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.") })] }),
|
|
31
|
+
/* @__PURE__ */ s("p", {
|
|
32
|
+
className: "break-words font-medium",
|
|
33
|
+
children: [
|
|
34
|
+
m.title,
|
|
35
|
+
" ·",
|
|
36
|
+
" ",
|
|
37
|
+
_("eventfullymanaged.certificates.revision", "Revision {{revision}}", { revision: m.revision })
|
|
38
|
+
]
|
|
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
|
+
}),
|
|
49
|
+
/* @__PURE__ */ s("div", {
|
|
50
|
+
className: "flex flex-wrap justify-end gap-2",
|
|
51
|
+
children: [/* @__PURE__ */ o(c, {
|
|
52
|
+
type: "button",
|
|
53
|
+
variant: "outline",
|
|
54
|
+
disabled: y,
|
|
55
|
+
onClick: g,
|
|
56
|
+
children: S ? _("eventfullymanaged.certificates.done", "Done") : _("eventfullymanaged.certificates.cancel", "Cancel")
|
|
57
|
+
}), S ? null : /* @__PURE__ */ o(c, {
|
|
58
|
+
type: "button",
|
|
59
|
+
disabled: y,
|
|
60
|
+
onClick: () => void T(),
|
|
61
|
+
children: y ? _("eventfullymanaged.certificates.scheduling", "Scheduling…") : _("eventfullymanaged.certificates.scheduleConfirm", "Schedule issuance")
|
|
62
|
+
})]
|
|
63
|
+
})
|
|
64
|
+
] })
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function h({ run: e }) {
|
|
68
|
+
let n = t();
|
|
69
|
+
return /* @__PURE__ */ s("div", {
|
|
70
|
+
className: "space-y-1 rounded-card border border-border-seam p-3 text-sm",
|
|
71
|
+
role: "status",
|
|
72
|
+
children: [
|
|
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") }),
|
|
75
|
+
e.status === "pending" ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.nextAttempt", "Next attempt: {{date}}", { date: i(e.nextAttemptAt) }) }) : null,
|
|
76
|
+
e.completedAt ? /* @__PURE__ */ o("p", { children: n("eventfullymanaged.certificates.runFinished", "Finished: {{date}}", { date: i(e.completedAt) }) }) : null,
|
|
77
|
+
/* @__PURE__ */ o("p", {
|
|
78
|
+
className: "break-all text-text-secondary",
|
|
79
|
+
children: e.id
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export { m as CertificateScheduleDialog };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=CertificateScheduleDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CertificateScheduleDialog.js","names":["CertificateScheduleDialog","tr","useTr","schedule","useScheduleEventCertificateIssuanceMutation","sendEmail","setSendEmail","useState","run","setRun","scheduleError","submit","result","template","scheduled","mutationSucceeded","Dialog","open","loading","onClose","DialogContent","DialogHeader","DialogTitle","DialogDescription","ScheduleReceipt","event","Button","formatDateTime"],"sources":["../../../../src/eventfullymanaged/pages/certificates/CertificateScheduleDialog.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@burdenoff/fe-libs/ui';\nimport {\n useScheduleEventCertificateIssuanceMutation,\n type EventCertificateTemplateFieldsFragment,\n type ScheduleEventCertificateIssuanceMutation,\n} from '../../../generated/wspace-operations';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { formatDateTime } from '../events/eventFormUtils';\n\ntype ScheduleRun = ScheduleEventCertificateIssuanceMutation['eventfullyManagedScheduleCertificateIssuance'];\n\nexport function CertificateScheduleDialog({\n eventId,\n template,\n onClose,\n}: {\n eventId: string;\n template: EventCertificateTemplateFieldsFragment;\n onClose: () => void;\n}) {\n const tr = useTr();\n const [schedule, { loading }] = useScheduleEventCertificateIssuanceMutation();\n const [sendEmail, setSendEmail] = useState(false);\n const [run, setRun] = useState<ScheduleRun | null>(null);\n const scheduleError = tr('eventfullymanaged.certificates.scheduleError', 'Could not schedule certificate issuance');\n\n const submit = async () => {\n if (loading || run) return;\n try {\n const result = await schedule({\n variables: { eventId, templateId: template.id, templateRevision: template.revision, sendEmail },\n });\n const scheduled = result.data?.eventfullyManagedScheduleCertificateIssuance;\n if (mutationSucceeded(result, scheduled?.id, scheduleError) && scheduled) setRun(scheduled);\n } catch {\n notify.error(scheduleError);\n }\n };\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !loading) onClose();\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{tr('eventfullymanaged.certificates.schedule', 'Schedule automatic issuance')}</DialogTitle>\n <DialogDescription>\n {tr(\n 'eventfullymanaged.certificates.scheduleHelp',\n 'Schedule issuance after the last required session ends. Scheduling the same revision opens its existing run.'\n )}\n </DialogDescription>\n </DialogHeader>\n <p className=\"break-words font-medium\">\n {template.title} ·{' '}\n {tr('eventfullymanaged.certificates.revision', 'Revision {{revision}}', {\n revision: template.revision,\n })}\n </p>\n {run ? (\n <ScheduleReceipt run={run} />\n ) : (\n <label className=\"flex min-h-10 items-center gap-2 text-sm\">\n <input\n type=\"checkbox\"\n checked={sendEmail}\n disabled={loading}\n onChange={(event) => setSendEmail(event.target.checked)}\n />\n {tr('eventfullymanaged.certificates.scheduleEmail', 'Email the PDFs to eligible attendees')}\n </label>\n )}\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" disabled={loading} onClick={onClose}>\n {run\n ? tr('eventfullymanaged.certificates.done', 'Done')\n : tr('eventfullymanaged.certificates.cancel', 'Cancel')}\n </Button>\n {run ? null : (\n <Button type=\"button\" disabled={loading} onClick={() => void submit()}>\n {loading\n ? tr('eventfullymanaged.certificates.scheduling', 'Scheduling…')\n : tr('eventfullymanaged.certificates.scheduleConfirm', 'Schedule issuance')}\n </Button>\n )}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ScheduleReceipt({ run }: { run: ScheduleRun }) {\n const tr = useTr();\n return (\n <div className=\"space-y-1 rounded-card border border-border-seam p-3 text-sm\" role=\"status\">\n <p>{tr('eventfullymanaged.certificates.scheduleStatus', 'Run status: {{status}}', { status: run.status })}</p>\n <p>\n {run.sendEmail\n ? tr('eventfullymanaged.certificates.scheduleEmailOn', 'Automatic email: On')\n : tr('eventfullymanaged.certificates.scheduleEmailOff', 'Automatic email: Off')}\n </p>\n {run.status === 'pending' ? (\n <p>\n {tr('eventfullymanaged.certificates.nextAttempt', 'Next attempt: {{date}}', {\n date: formatDateTime(run.nextAttemptAt),\n })}\n </p>\n ) : null}\n {run.completedAt ? (\n <p>\n {tr('eventfullymanaged.certificates.runFinished', 'Finished: {{date}}', {\n date: formatDateTime(run.completedAt),\n })}\n </p>\n ) : null}\n <p className=\"break-all text-text-secondary\">{run.id}</p>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgBA,EAA0B,EACxC,YACA,aACA,cAKC;CACD,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAU,EAAE,gBAAaC,EAA4C,GACtE,CAACC,GAAWC,KAAgBC,EAAS,EAAK,GAC1C,CAACC,GAAKC,KAAUF,EAA6B,IAAI,GACjDG,IAAgBT,EAAG,gDAAgD,yCAAyC,GAE5GU,IAAS,YAAY;EACzB,IAAI,OAAWH,IACf,IAAI;GACF,IAAMI,IAAS,MAAMT,EAAS,EAC5B,WAAW;IAAE;IAAS,YAAYU,EAAS;IAAI,kBAAkBA,EAAS;IAAU;GAAU,EAChG,CAAC,GACKC,IAAYF,EAAO,MAAM;GAC/B,AAAIG,EAAkBH,GAAQE,GAAW,IAAIJ,CAAa,KAAKI,KAAWL,EAAOK,CAAS;EAC5F,QAAQ;GACN,EAAO,MAAMJ,CAAa;EAC5B;CACF;CAEA,OACE,kBAACM,GAAD;EACE,MAAA;EACA,eAAe,MAAS;GACtB,AAAI,CA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C,EAAK,CAAA;GAC7G,kBAAC,KAAD,EAAA,UACGA,EAAI,YACDP,EAAG,kDAAkD,qBAAqB,IAC1EA,EAAG,mDAAmD,sBAAsB,EAC/E,CAAA;GACFO,EAAI,WAAW,YACd,kBAAC,KAAD,EAAA,UACGP,EAAG,8CAA8C,0BAA0B,EAC1E,MAAM0B,EAAenB,EAAI,aAAa,EACxC,CAAC,EACA,CAAA,IACD;GACHA,EAAI,cACH,kBAAC,KAAD,EAAA,UACGP,EAAG,8CAA8C,sBAAsB,EACtE,MAAM0B,EAAenB,EAAI,WAAW,EACtC,CAAC,EACA,CAAA,IACD;GACJ,kBAAC,KAAD;IAAG,WAAU;IAAiC,UAAAA,EAAI;GAAM,CAAA;EACrD;;AAET"}
|
|
@@ -5,24 +5,25 @@ import { ActionMenu as a } from "../../components/ActionMenu.js";
|
|
|
5
5
|
import { Pagination as o, usePagination as s } from "../../components/Pagination.js";
|
|
6
6
|
import { mutationSucceeded as c } from "../../lib/mutationResult.js";
|
|
7
7
|
import { notify as l } from "../../lib/toast.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { CertificateScheduleDialog as u } from "./CertificateScheduleDialog.js";
|
|
9
|
+
import { useId as d, useState as f } from "react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
import { Badge as h, Button as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogHeader as b, DialogTitle as x, Input as S, Label as C, Textarea as w } from "@burdenoff/fe-libs/ui";
|
|
11
12
|
// src/eventfullymanaged/pages/certificates/CertificateTemplates.tsx
|
|
12
|
-
function
|
|
13
|
-
let T = r(), E =
|
|
13
|
+
function T({ eventId: e, template: a, onClose: u, onSaved: h }) {
|
|
14
|
+
let T = r(), E = d(), D = s(), [O, k] = f(() => new Set(a?.requiredSessionIds ?? [])), [A, j] = f(!1), [M, { loading: N }] = t(), [P, { loading: F }] = n(), I = i({
|
|
14
15
|
eventId: e,
|
|
15
16
|
limit: D.limit,
|
|
16
17
|
offset: D.offset
|
|
17
18
|
}), L = I.data?.eventSessions, R = N || F, z = T("eventfullymanaged.certificates.templateSaveError", "Could not save template");
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ p(_, {
|
|
19
20
|
open: !0,
|
|
20
21
|
onOpenChange: (e) => {
|
|
21
|
-
!e && !R &&
|
|
22
|
+
!e && !R && u();
|
|
22
23
|
},
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ m(v, {
|
|
24
25
|
className: "max-h-[90dvh] overflow-y-auto",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ m(b, { children: [/* @__PURE__ */ p(x, { children: a ? T("eventfullymanaged.certificates.editTemplate", "Edit template") : T("eventfullymanaged.certificates.newTemplate", "New certificate template") }), /* @__PURE__ */ p(y, { children: T("eventfullymanaged.certificates.templateHelp", "Choose the sessions an attendee must complete to earn this certificate.") })] }), /* @__PURE__ */ p("form", {
|
|
26
27
|
onSubmit: async (t) => {
|
|
27
28
|
t.preventDefault();
|
|
28
29
|
let n = new FormData(t.currentTarget), r = String(n.get("title") ?? "").trim(), i = String(n.get("issuer") ?? "").trim(), o = String(n.get("statement") ?? "").trim() || null;
|
|
@@ -52,22 +53,22 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
52
53
|
} });
|
|
53
54
|
if (!c(t, t.data?.eventfullyManagedCreateCertificateTemplate.id, z)) return;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
h();
|
|
56
57
|
} catch {
|
|
57
58
|
l.error(z);
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
onChange: () => j(!1),
|
|
61
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ m("fieldset", {
|
|
62
63
|
disabled: R,
|
|
63
64
|
className: "space-y-4",
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ m("div", {
|
|
66
67
|
className: "space-y-1.5",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
+
children: [/* @__PURE__ */ p(C, {
|
|
68
69
|
htmlFor: E + "title",
|
|
69
70
|
children: T("eventfullymanaged.certificates.templateTitle", "Title")
|
|
70
|
-
}), /* @__PURE__ */
|
|
71
|
+
}), /* @__PURE__ */ p(S, {
|
|
71
72
|
id: E + "title",
|
|
72
73
|
name: "title",
|
|
73
74
|
defaultValue: a?.title,
|
|
@@ -75,12 +76,12 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
75
76
|
required: !0
|
|
76
77
|
})]
|
|
77
78
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ m("div", {
|
|
79
80
|
className: "space-y-1.5",
|
|
80
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ p(C, {
|
|
81
82
|
htmlFor: E + "issuer",
|
|
82
83
|
children: T("eventfullymanaged.certificates.issuer", "Issuer")
|
|
83
|
-
}), /* @__PURE__ */
|
|
84
|
+
}), /* @__PURE__ */ p(S, {
|
|
84
85
|
id: E + "issuer",
|
|
85
86
|
name: "issuer",
|
|
86
87
|
defaultValue: a?.issuerName,
|
|
@@ -88,12 +89,12 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
88
89
|
required: !0
|
|
89
90
|
})]
|
|
90
91
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ m("div", {
|
|
92
93
|
className: "space-y-1.5",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ p(C, {
|
|
94
95
|
htmlFor: E + "statement",
|
|
95
96
|
children: T("eventfullymanaged.certificates.statement", "Statement (optional)")
|
|
96
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ p(w, {
|
|
97
98
|
id: E + "statement",
|
|
98
99
|
name: "statement",
|
|
99
100
|
defaultValue: a?.statement ?? "",
|
|
@@ -101,30 +102,30 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
101
102
|
rows: 3
|
|
102
103
|
})]
|
|
103
104
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ m("fieldset", {
|
|
105
106
|
className: "space-y-2",
|
|
106
107
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ p("legend", {
|
|
108
109
|
className: "mb-2 text-sm font-medium",
|
|
109
110
|
children: T("eventfullymanaged.certificates.requiredSessions", "Required sessions")
|
|
110
111
|
}),
|
|
111
|
-
I.loading ? /* @__PURE__ */
|
|
112
|
+
I.loading ? /* @__PURE__ */ p("p", {
|
|
112
113
|
role: "status",
|
|
113
114
|
children: T("eventfullymanaged.certificates.loadingSessions", "Loading sessions…")
|
|
114
115
|
}) : null,
|
|
115
|
-
I.error ? /* @__PURE__ */
|
|
116
|
+
I.error ? /* @__PURE__ */ m("div", {
|
|
116
117
|
className: "space-y-2",
|
|
117
118
|
role: "alert",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ p("p", { children: T("eventfullymanaged.certificates.sessionError", "Could not load sessions.") }), /* @__PURE__ */ p(g, {
|
|
119
120
|
type: "button",
|
|
120
121
|
variant: "outline",
|
|
121
122
|
onClick: () => void I.refetch().catch(() => void 0),
|
|
122
123
|
children: T("eventfullymanaged.certificates.retry", "Retry")
|
|
123
124
|
})]
|
|
124
125
|
}) : null,
|
|
125
|
-
L?.items.map((e) => /* @__PURE__ */
|
|
126
|
+
L?.items.map((e) => /* @__PURE__ */ m("label", {
|
|
126
127
|
className: "flex min-h-10 items-center gap-2 text-sm",
|
|
127
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ p("input", {
|
|
128
129
|
type: "checkbox",
|
|
129
130
|
checked: O.has(e.id),
|
|
130
131
|
disabled: O.size >= 100 && !O.has(e.id),
|
|
@@ -132,13 +133,13 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
132
133
|
let n = new Set(O);
|
|
133
134
|
t.target.checked ? n.add(e.id) : n.delete(e.id), k(n);
|
|
134
135
|
}
|
|
135
|
-
}), /* @__PURE__ */
|
|
136
|
+
}), /* @__PURE__ */ p("span", { children: e.title })]
|
|
136
137
|
}, e.id)),
|
|
137
|
-
L && L.total === 0 ? /* @__PURE__ */
|
|
138
|
+
L && L.total === 0 ? /* @__PURE__ */ p("p", {
|
|
138
139
|
className: "text-sm text-text-secondary",
|
|
139
140
|
children: T("eventfullymanaged.certificates.noSessions", "Add an event session before creating a template.")
|
|
140
141
|
}) : null,
|
|
141
|
-
L ? /* @__PURE__ */
|
|
142
|
+
L ? /* @__PURE__ */ p(o, {
|
|
142
143
|
offset: D.offset,
|
|
143
144
|
limit: D.limit,
|
|
144
145
|
total: L.total,
|
|
@@ -148,26 +149,26 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
148
149
|
loading: I.loading,
|
|
149
150
|
itemLabel: "sessions"
|
|
150
151
|
}) : null,
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ p("p", {
|
|
152
153
|
className: "text-sm text-text-secondary",
|
|
153
154
|
"aria-live": "polite",
|
|
154
155
|
children: T("eventfullymanaged.certificates.requiredCount", "{{count}} selected", { count: O.size })
|
|
155
156
|
})
|
|
156
157
|
]
|
|
157
158
|
}),
|
|
158
|
-
A ? /* @__PURE__ */
|
|
159
|
+
A ? /* @__PURE__ */ p("p", {
|
|
159
160
|
role: "alert",
|
|
160
161
|
className: "text-sm text-status-error-text",
|
|
161
162
|
children: T("eventfullymanaged.certificates.invalidTemplate", "Enter a title and issuer, and select at least one session.")
|
|
162
163
|
}) : null,
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ m("div", {
|
|
164
165
|
className: "flex flex-wrap justify-end gap-2",
|
|
165
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ p(g, {
|
|
166
167
|
type: "button",
|
|
167
168
|
variant: "outline",
|
|
168
|
-
onClick:
|
|
169
|
+
onClick: u,
|
|
169
170
|
children: T("eventfullymanaged.certificates.cancel", "Cancel")
|
|
170
|
-
}), /* @__PURE__ */
|
|
171
|
+
}), /* @__PURE__ */ p(g, {
|
|
171
172
|
type: "submit",
|
|
172
173
|
disabled: !!I.error,
|
|
173
174
|
children: R ? T("eventfullymanaged.certificates.saving", "Saving…") : T("eventfullymanaged.certificates.save", "Save template")
|
|
@@ -179,82 +180,92 @@ function w({ eventId: e, template: a, onClose: m, onSaved: w }) {
|
|
|
179
180
|
})
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
-
let o = r(), [s,
|
|
183
|
+
function E({ eventId: t, templates: n, onChange: i }) {
|
|
184
|
+
let o = r(), [s, d] = f(null), [_, v] = f(null), [y] = e(), b = o("eventfullymanaged.certificates.archiveError", "Could not archive template"), x = async (e) => {
|
|
184
185
|
try {
|
|
185
|
-
let n = await
|
|
186
|
+
let n = await y({ variables: {
|
|
186
187
|
eventId: t,
|
|
187
188
|
id: e.id,
|
|
188
189
|
revision: e.revision
|
|
189
190
|
} });
|
|
190
|
-
if (c(n, n.data?.eventfullyManagedArchiveCertificateTemplate ? e.id : null,
|
|
191
|
+
if (c(n, n.data?.eventfullyManagedArchiveCertificateTemplate ? e.id : null, b)) {
|
|
191
192
|
i();
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
195
|
} catch {
|
|
195
|
-
l.error(
|
|
196
|
+
l.error(b);
|
|
196
197
|
}
|
|
197
198
|
throw Error("Certificate template archive was not confirmed.");
|
|
198
199
|
};
|
|
199
|
-
return /* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ m("section", {
|
|
200
201
|
className: "space-y-4",
|
|
201
202
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ m("div", {
|
|
203
204
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ p("h2", {
|
|
205
206
|
className: "text-lg font-semibold",
|
|
206
207
|
children: o("eventfullymanaged.certificates.templates", "Templates")
|
|
207
|
-
}), /* @__PURE__ */
|
|
208
|
+
}), /* @__PURE__ */ p(g, {
|
|
208
209
|
type: "button",
|
|
209
|
-
onClick: () =>
|
|
210
|
+
onClick: () => d("new"),
|
|
210
211
|
children: o("eventfullymanaged.certificates.newTemplate", "New certificate template")
|
|
211
212
|
})]
|
|
212
213
|
}),
|
|
213
|
-
n.length === 0 ? /* @__PURE__ */
|
|
214
|
+
n.length === 0 ? /* @__PURE__ */ p("p", {
|
|
214
215
|
className: "text-text-secondary",
|
|
215
216
|
children: o("eventfullymanaged.certificates.noTemplates", "No active templates on this page.")
|
|
216
217
|
}) : null,
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ p("ul", {
|
|
218
219
|
className: "space-y-2",
|
|
219
|
-
children: n.map((e) => /* @__PURE__ */
|
|
220
|
+
children: n.map((e) => /* @__PURE__ */ m("li", {
|
|
220
221
|
className: "flex items-start justify-between gap-3 rounded-card border border-border-seam p-3",
|
|
221
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ m("div", {
|
|
222
223
|
className: "min-w-0 space-y-1",
|
|
223
224
|
children: [
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ p("h3", {
|
|
225
226
|
className: "font-medium break-words",
|
|
226
227
|
children: e.title
|
|
227
228
|
}),
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ p("p", {
|
|
229
230
|
className: "text-sm text-text-secondary break-words",
|
|
230
231
|
children: e.issuerName
|
|
231
232
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ p(h, {
|
|
233
234
|
variant: "secondary",
|
|
234
235
|
children: o("eventfullymanaged.certificates.revision", "Revision {{revision}}", { revision: e.revision })
|
|
235
236
|
})
|
|
236
237
|
]
|
|
237
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ p(a, {
|
|
238
239
|
ariaLabel: o("eventfullymanaged.certificates.templateActions", "Actions for {{title}}", { title: e.title }),
|
|
239
240
|
entityName: e.title,
|
|
240
|
-
onEdit: () =>
|
|
241
|
+
onEdit: () => d(e),
|
|
242
|
+
extraItems: [{
|
|
243
|
+
key: "schedule",
|
|
244
|
+
label: o("eventfullymanaged.certificates.schedule", "Schedule automatic issuance"),
|
|
245
|
+
onSelect: () => v(e)
|
|
246
|
+
}],
|
|
241
247
|
deleteLabel: o("eventfullymanaged.certificates.archive", "Archive"),
|
|
242
248
|
confirmNote: o("eventfullymanaged.certificates.archiveNote", "Existing issued receipts remain available."),
|
|
243
|
-
onDelete: () =>
|
|
249
|
+
onDelete: () => x(e)
|
|
244
250
|
})]
|
|
245
251
|
}, e.id))
|
|
246
252
|
}),
|
|
247
|
-
|
|
253
|
+
_ ? /* @__PURE__ */ p(u, {
|
|
254
|
+
eventId: t,
|
|
255
|
+
template: _,
|
|
256
|
+
onClose: () => v(null)
|
|
257
|
+
}) : null,
|
|
258
|
+
s ? /* @__PURE__ */ p(T, {
|
|
248
259
|
eventId: t,
|
|
249
260
|
template: s === "new" ? void 0 : s,
|
|
250
|
-
onClose: () =>
|
|
261
|
+
onClose: () => d(null),
|
|
251
262
|
onSaved: () => {
|
|
252
|
-
|
|
263
|
+
d(null), i();
|
|
253
264
|
}
|
|
254
265
|
}, s === "new" ? "new" : s.id) : null
|
|
255
266
|
]
|
|
256
267
|
});
|
|
257
268
|
}
|
|
258
|
-
export {
|
|
269
|
+
export { E as CertificateTemplates };
|
|
259
270
|
|
|
260
271
|
//# sourceMappingURL=CertificateTemplates.js.map
|