continuel event modal
This commit is contained in:
@@ -16,7 +16,13 @@ export default async () => {
|
||||
|
||||
const events = await prisma.event.findMany({
|
||||
include: {
|
||||
appointments: true,
|
||||
appointments: {
|
||||
where: {
|
||||
appointmentDate: {
|
||||
gte: new Date(),
|
||||
},
|
||||
},
|
||||
},
|
||||
participants: {
|
||||
where: {
|
||||
userId: user.id,
|
||||
@@ -24,6 +30,15 @@ export default async () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
const userAppointments = await prisma.eventAppointment.findMany({
|
||||
where: {
|
||||
Participants: {
|
||||
some: {
|
||||
userId: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-6 gap-4">
|
||||
@@ -35,9 +50,23 @@ export default async () => {
|
||||
|
||||
{events.map((event) => {
|
||||
if (event.type === "OBLIGATED_COURSE")
|
||||
return <ObligatedEvent user={user} event={event} key={event.id} />;
|
||||
return (
|
||||
<ObligatedEvent
|
||||
selectedAppointments={userAppointments}
|
||||
user={user}
|
||||
event={event}
|
||||
key={event.id}
|
||||
/>
|
||||
);
|
||||
if (event.type === "COURSE")
|
||||
return <KursItem user={user} event={event} key={event.id} />;
|
||||
return (
|
||||
<KursItem
|
||||
selectedAppointments={userAppointments}
|
||||
user={user}
|
||||
event={event}
|
||||
key={event.id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user