feat: display published Notdienst assignments in appointment calendar with custom styling for own assignments

This commit is contained in:
t.indorf
2026-05-21 13:04:52 +02:00
parent 9915c8213e
commit 339563bf4d
3 changed files with 223 additions and 13 deletions
+41
View File
@@ -148,6 +148,32 @@ export default async function KalenderPage({
orderBy: { startDate: "asc" },
});
const notdienstAssignmentRows = await prisma.notdienstAssignment.findMany({
where: {
kitaId: session.user.kitaId,
plan: {
status: "PUBLISHED",
},
},
select: {
id: true,
date: true,
child: {
select: {
firstName: true,
lastName: true,
familyId: true,
family: {
select: {
name: true,
},
},
},
},
},
orderBy: { date: "asc" },
});
const allUserTermine: CalendarListItemDto[] = [
...confirmedTermineRows.map((termin) => ({
...termin,
@@ -178,6 +204,21 @@ export default async function KalenderPage({
startDate: assignment.startDate,
endDate: assignment.endDate,
})),
...notdienstAssignmentRows.map((assignment) => {
const isOwn = assignment.child.familyId === familyIdForParticipation;
return {
kind: "notdienst" as const,
id: assignment.id,
title: isOwn
? `Mein Notdienst (${assignment.child.firstName})`
: `Notdienst (${assignment.child.family.name})`,
familyName: assignment.child.family.name,
childName: `${assignment.child.firstName} ${assignment.child.lastName}`,
isOwn,
startDate: assignment.date,
endDate: assignment.date,
};
}),
].sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
let allPendingTermine: PendingTerminDto[] = [];