feat: display published Notdienst assignments in appointment calendar with custom styling for own assignments
This commit is contained in:
@@ -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[] = [];
|
||||
|
||||
Reference in New Issue
Block a user