From ecdd9c69b6900e355a751e6e92717f293b6d7b99 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 7 Aug 2026 04:13:14 +0000 Subject: [PATCH] Modified by www.SourceFiles.app --- src/routes/_authenticated/reports.tsx | 191 -------------------------- 1 file changed, 191 deletions(-) delete mode 100644 src/routes/_authenticated/reports.tsx diff --git a/src/routes/_authenticated/reports.tsx b/src/routes/_authenticated/reports.tsx deleted file mode 100644 index e1abfa3..0000000 --- a/src/routes/_authenticated/reports.tsx +++ /dev/null @@ -1,191 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { useQuery } from "@tanstack/react-query"; -import { supabase } from "@/integrations/supabase/client"; -import { useAuth } from "@/hooks/use-auth"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; -import { FileText, Printer } from "lucide-react"; -import { useState } from "react"; -import { IepProgressDoc, ReportCardDoc } from "@/components/reports"; -import { REPORT_TYPES, monthToDateRange, schoolYearRange, type ReportType } from "@/lib/reports"; - -export const Route = createFileRoute("/_authenticated/reports")({ - head: () => ({ meta: [{ title: "Reports — School Portal" }] }), - component: ReportsPage, -}); - -const ALL = "__all__"; - -function ReportsPage() { - const { user, roles, loading } = useAuth(); - const isAdmin = roles.includes("admin"); - - const [type, setType] = useState("report_card"); - const [classId, setClassId] = useState(""); - const [studentId, setStudentId] = useState(ALL); - const year = schoolYearRange(); - const [from, setFrom] = useState(year.from); - const [to, setTo] = useState(year.to); - - const { data: classes } = useQuery({ - queryKey: ["my-classes", user?.id, isAdmin], - queryFn: async () => { - let q = supabase.from("classes").select("id, name, teacher_id"); - if (!isAdmin) q = q.eq("teacher_id", user!.id); - return (await q.order("name")).data ?? []; - }, - enabled: !!user && !loading, - }); - - const { data: students } = useQuery({ - queryKey: ["report-class-students", classId], - enabled: !!classId, - queryFn: async () => - ( - await supabase - .from("students") - .select("id, first_name, last_name") - .eq("class_id", classId) - .order("last_name") - ).data ?? [], - }); - - const selected = - studentId === ALL ? (students ?? []) : (students ?? []).filter((s) => s.id === studentId); - - const applyPreset = (preset: "year" | "month") => { - const r = preset === "year" ? schoolYearRange() : monthToDateRange(); - setFrom(r.from); - setTo(r.to); - }; - - return ( -
-
-

- Reports -

-

- Build report cards, academic progress reports, and 504 / IEP goal progress reports. Print - or save as PDF from your browser — each student starts on a new page. -

- -
-
-
- - -
-
- - -
-
- - -
-
- -
-
- - {/* Uncontrolled + keyed so Safari's native picker isn't reset by React. */} - setFrom(e.target.value)} - /> -
-
- - setTo(e.target.value)} - /> -
-
- - -
-
- -
- - {classId - ? `${selected.length} document${selected.length === 1 ? "" : "s"} ready` - : "Select a class to begin."} - - -
-
-
- -
- {selected.map((s) => - type === "iep" ? ( - - ) : ( - - ), - )} -
-
- ); -}