diff --git a/src/app/admin/bookings/page.tsx b/src/app/admin/bookings/page.tsx index 56dccfc..69e30b5 100644 --- a/src/app/admin/bookings/page.tsx +++ b/src/app/admin/bookings/page.tsx @@ -582,6 +582,9 @@ interface DashboardCounts { od: TabCounts; remindersToday: number; remindersTomorrow: number; + remindersNotAsked: number; + remindersComing: number; + remindersCancelled: number; } function countByStatus(items: { status: string }[]): TabCounts { @@ -621,13 +624,17 @@ function DashboardSummary({ statusFilter, onNavigate, onFilter }: { return adminFetch(`/api/admin/open-day/bookings?eventId=${active.id}`).then((r) => r.json()); }), adminFetch("/api/admin/reminders").then((r) => r.json()).catch(() => []), - ]).then(([gb, mc, od, rem]: [{ status: string }[], { status: string }[], { status: string }[], { eventDate: string }[]]) => { + ]).then(([gb, mc, od, rem]: [{ status: string }[], { status: string }[], { status: string }[], { eventDate: string; reminderStatus?: string }[]]) => { + const upcoming = rem.filter((r) => r.eventDate === today || r.eventDate === tomorrow); setCounts({ classes: countByStatus(gb), mc: countByStatus(mc), od: countByStatus(od), remindersToday: rem.filter((r) => r.eventDate === today).length, remindersTomorrow: rem.filter((r) => r.eventDate === tomorrow).length, + remindersNotAsked: upcoming.filter((r) => !r.reminderStatus).length, + remindersComing: upcoming.filter((r) => r.reminderStatus === "coming").length, + remindersCancelled: upcoming.filter((r) => r.reminderStatus === "cancelled").length, }); }).catch(() => {}); }, []); @@ -667,6 +674,35 @@ function DashboardSummary({ statusFilter, onNavigate, onFilter }: { {counts.remindersToday > 0 && <>{counts.remindersToday}сегодня} {counts.remindersTomorrow > 0 && <>{counts.remindersTomorrow}завтра} +
+ {counts.remindersNotAsked > 0 && ( + { e.stopPropagation(); onNavigate(c.tab); }}> + {counts.remindersNotAsked} + не спрош. + + )} + {counts.remindersComing > 0 && ( + <> + {counts.remindersNotAsked > 0 && ·} + { e.stopPropagation(); onNavigate(c.tab); }}> + {counts.remindersComing} + придёт + + + )} + {counts.remindersCancelled > 0 && ( + <> + {(counts.remindersNotAsked > 0 || counts.remindersComing > 0) && ·} + { e.stopPropagation(); onNavigate(c.tab); }}> + {counts.remindersCancelled} + не придёт + + + )} +
); }