47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { notFound } from "next/navigation";
|
|
import { prisma } from "@/lib/prisma";
|
|
import { PrintButton } from "@/components/print-button";
|
|
|
|
type Props = { params: Promise<{ code: string }> };
|
|
|
|
export default async function CertificatePublicPage({ params }: Props) {
|
|
const { code } = await params;
|
|
const cert = await prisma.certificate.findUnique({
|
|
where: { code },
|
|
include: {
|
|
course: { select: { title: true } },
|
|
user: { select: { name: true } },
|
|
},
|
|
});
|
|
if (!cert) notFound();
|
|
|
|
return (
|
|
<section className="section">
|
|
<div className="container">
|
|
<div className="cert-print">
|
|
<p className="muted" style={{ margin: 0 }}>
|
|
Fahrlässig Motorrad Akademie
|
|
</p>
|
|
<h1>Teilnahmebestätigung</h1>
|
|
<p className="muted" style={{ marginTop: "0.75rem" }}>
|
|
Hiermit bestätigen wir, dass
|
|
</p>
|
|
<div className="name">{cert.user.name}</div>
|
|
<p style={{ margin: "0.75rem 0 0", fontSize: "1.1rem" }}>
|
|
den Online-Kurs <strong>{cert.course.title}</strong> vollständig absolviert hat.
|
|
</p>
|
|
<p className="muted" style={{ marginTop: "1.25rem" }}>
|
|
Ausstellungsdatum: {cert.issuedAt.toLocaleDateString("de-DE")}
|
|
</p>
|
|
<p className="muted" style={{ marginTop: "0.5rem", fontSize: "0.9rem" }}>
|
|
Verifikationscode: <span style={{ fontFamily: "ui-monospace, monospace" }}>{cert.code}</span>
|
|
</p>
|
|
<div style={{ marginTop: "1.5rem" }}>
|
|
<PrintButton />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|