Add educator email invitations and staff notification preferences

This commit is contained in:
t.indorf
2026-10-08 11:32:38 +02:00
parent 043fed2e46
commit 90b8843cda
15 changed files with 700 additions and 39 deletions
+20
View File
@@ -119,7 +119,9 @@ export default async function PersonalPage({
calendarLeaves,
pendingLeaves,
pendingWeeks,
pendingEmails,
] = await Promise.all([
// All queries stay scoped to the current Kita and recipient permissions.
admin
? prisma.educator.findMany({
where: { kitaId: actor.kitaId },
@@ -190,6 +192,14 @@ export default async function PersonalPage({
orderBy: { weekStart: "asc" },
})
: Promise.resolve([]),
prisma.staffEmail.count({
where: {
profile: { kitaId: actor.kitaId },
...(admin ? {} : { userId: actor.id }),
sentAt: null,
skippedAt: null,
},
}),
]);
const selectedEducator =
educators.find((e) => e.id === pick("educator")) ??
@@ -279,6 +289,16 @@ export default async function PersonalPage({
</div>
)}
</header>
{pendingEmails > 0 && (
<div className="mb-6 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-[var(--hairline)] bg-[var(--surface)] p-4">
<p className="text-sm">
{pendingEmails} E-Mail-Hinweise warten noch auf den Versand.
</p>
<CommandButton command="emailRetry" profileId="" data={{}}>
Versand erneut versuchen
</CommandButton>
</div>
)}
{notifications.length > 0 && (
<details className="mb-6 rounded-xl border border-[var(--accent-mid)] bg-[var(--accent-soft)] p-4">
<summary className="cursor-pointer text-sm font-semibold">