Files
threadcount-community/app/my/(app)/ward/page.tsx
T
ThreadCount f72f0626b0
Release / release (push) Has been skipped
ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 794bab5 on 2026-09-16. Licensed under the Functional Source License (FSL-1.1-ALv2).
2026-09-17 05:49:16 +10:00

26 lines
1.2 KiB
TypeScript

import { notFound, redirect } from "next/navigation";
import { prisma } from "@/lib/db";
import { currentStaff } from "@/lib/staffsession";
import { wardData } from "@/lib/managerdata";
import WardScreen from "@/components/screens/Ward";
export const dynamic = "force-dynamic";
export default async function MyWard() {
const sess = await currentStaff();
if (!sess) redirect("/my/signin");
/* The same fact, read the same way it is read everywhere else: active reports, in this facility.
*
* Counting deactivated people let this page render for somebody the rest of the app had decided
* manages nobody — the layout's `isManager`, teamTabs(), wardData() and reportsOf() all filter
* them out — so the Team shell drew itself with no tabs above an empty roster while the Team
* item was missing from the bar. Two answers to "does this person manage anybody" inside one
* screen is the defect; this is the answer the others give. */
const reports = await prisma.staff.count({
where: { facilityId: sess.facilityId, managerId: sess.staffId, inactive: false },
});
if (!reports) notFound();
const { ward, rows, anyCapped } = await wardData(sess);
return <WardScreen ward={ward} rows={rows} anyCapped={anyCapped} />;
}