diff --git a/docs/ui/figma-migration-coverage.md b/docs/ui/figma-migration-coverage.md index b547d43..3141ad4 100644 --- a/docs/ui/figma-migration-coverage.md +++ b/docs/ui/figma-migration-coverage.md @@ -71,6 +71,9 @@ are used; unknown values are not inferred. | `/management/payments` | Admin payments | Keep ledger and permission behavior | | `/management/staff-work` | Admin staff work | Keep existing read/update/delete contract | | `/admin/users`, `/admin/users/:id` | Admin users and roles | Keep admin guard and critical confirmations | +| `/management/students` | ADM-02 Öğrenciler | Real roster + class/term filters; mastery, attendance, plan and risk columns stay "yakında" | +| `/management/teachers` | ADM-08 Öğretmenler | Real roster + homeroom class count; branch, load, AI acceptance and status stay "yakında" | +| `/management/modules` | ADM-05 Lisans ve modüller | Real enabled/total modules per package; price, seats, renewal and invoices stay "yakında" | | `/students` | Parent development views | Keep linked-child authorization | | `/meals`, `/meals/:id` | Admin cafeteria | Keep menu, booking, balance, and attendance behavior | | `/payments` | Parent/student statement | Remain read-only until a payment-provider API exists | @@ -110,6 +113,8 @@ Keep the current UI and behavior until a specific design is added: - `/management/pomodoros` - `/management/terms` - `/whiteboards/:id` live canvas details beyond the list concept +- `/builder/login`, `/builder`, `/builder/schools/:slug` (vendor operator console) +- `/students/attendance`, `/students/exams`, `/students/study` parent tab routes - `/meals/:id` detailed account/service/management tabs - `/studies`, `/clubs`, and `/attendance` redirect aliases diff --git a/src/components/layout/nav-items.test.ts b/src/components/layout/nav-items.test.ts index acf536b..dbf44ac 100644 --- a/src/components/layout/nav-items.test.ts +++ b/src/components/layout/nav-items.test.ts @@ -141,6 +141,10 @@ test("license modules is a real admin page and the work log includes admin", () expect(licenseModules?.to).toBe("/management/modules"); expect(licenseModules?.soon).toBeFalsy(); expect(admin.map((i) => i.to)).toContain("/work"); + expect(admin.filter((i) => i.id.endsWith("-roster")).map((i) => [i.to, i.soon ?? false])).toEqual([ + ["/management/students", false], + ["/management/teachers", false], + ]); expect(visibleNavGroups("manager").flatMap((g) => g.items).map((i) => i.id)).not.toContain("license-modules"); }); diff --git a/src/components/layout/nav-items.ts b/src/components/layout/nav-items.ts index 0ca0ccd..329b19c 100644 --- a/src/components/layout/nav-items.ts +++ b/src/components/layout/nav-items.ts @@ -97,8 +97,8 @@ const ADMIN_GROUPS: NavGroup[] = [ labelKey: "nav.group.operations", Icon: IconSchool, items: [ - { id: "students-roster", to: "/coming-soon/ogrenciler", labelKey: "nav.studentsRoster", Icon: IconUsers, soon: true, minRole: "manager" }, - { id: "teachers-roster", to: "/coming-soon/ogretmenler", labelKey: "nav.teachersRoster", Icon: IconChalkboardTeacher, soon: true, minRole: "manager" }, + { id: "students-roster", to: "/management/students", labelKey: "nav.studentsRoster", Icon: IconUsers, minRole: "manager" }, + { id: "teachers-roster", to: "/management/teachers", labelKey: "nav.teachersRoster", Icon: IconChalkboardTeacher, minRole: "manager" }, { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconSchool, minRole: "teacher" }, { id: "courses", to: "/courses", labelKey: "nav.courses", Icon: IconBook, module: "courses" }, { id: "terms", to: "/management/terms", labelKey: "nav.terms", Icon: IconCalendar, minRole: "manager" }, diff --git a/src/components/users/roster-person-cell.tsx b/src/components/users/roster-person-cell.tsx new file mode 100644 index 0000000..05c3daf --- /dev/null +++ b/src/components/users/roster-person-cell.tsx @@ -0,0 +1,16 @@ +import type { PersonRef } from "@/api/client"; +import { UserAvatar } from "@/components/users/user-avatar"; +import { personLabel } from "@/lib/person"; + +/** Avatar initials, display name and @username — the first column of the ADM-02/ADM-08 rosters. */ +export function RosterPersonCell(props: { person: PersonRef }) { + return ( +
+ +
+

{personLabel(props.person)}

+

@{props.person.username}

+
+
+ ); +} diff --git a/src/i18n/messages.ts b/src/i18n/messages.ts index 6463192..eff215f 100644 --- a/src/i18n/messages.ts +++ b/src/i18n/messages.ts @@ -305,6 +305,35 @@ export type MessageKey = | "comingSoon.description" | "comingSoon.emptyTitle" | "comingSoon.emptyDescription" + | "roster.student" + | "roster.teacher" + | "roster.class" + | "roster.classAll" + | "roster.term" + | "roster.termAll" + | "roster.mastery" + | "roster.attendance" + | "roster.planAdherence" + | "roster.status" + | "roster.branch" + | "roster.weeklyLessons" + | "roster.suggestionAcceptance" + | "roster.tabAll" + | "roster.tabActive" + | "roster.tabNew" + | "roster.tabAtRisk" + | "roster.tabLeft" + | "roster.tabPermanent" + | "roster.tabContract" + | "roster.tabAdvisor" + | "roster.import" + | "roster.addStudent" + | "roster.addTeacher" + | "roster.studentsSubtitle" + | "roster.teachersSubtitle" + | "roster.searchStudents" + | "roster.searchTeachers" + | "roster.noTeachers" | "builder.console" | "builder.logout" | "builder.loginTitle" @@ -350,6 +379,22 @@ export type MessageKey = | "modules.requires" | "modules.on" | "modules.off" + | "modules.module" + | "modules.active" + | "modules.unitPrice" + | "modules.activeSeats" + | "modules.annualAmount" + | "modules.annualTotal" + | "modules.tabOverview" + | "modules.tabUsage" + | "modules.tabInvoices" + | "modules.tabContract" + | "modules.downloadInvoices" + | "modules.addLicense" + | "modules.fullPackage" + | "modules.customPackage" + | "modules.renewal" + | "modules.recentInvoices" | "modules.conflictRequires" | "modules.conflictRequiredBy" | "module.appointments" @@ -2087,6 +2132,35 @@ const en: Dict = { "comingSoon.description": "This module is on its way — there is nothing to show here yet.", "comingSoon.emptyTitle": "Not available yet", "comingSoon.emptyDescription": "This part of Hezarfen is still being built. Check back soon.", + "roster.student": "Student", + "roster.teacher": "Teacher", + "roster.class": "Class", + "roster.classAll": "Class: All", + "roster.term": "Term", + "roster.termAll": "Term: All", + "roster.mastery": "Topic mastery", + "roster.attendance": "Attendance", + "roster.planAdherence": "Plan adherence", + "roster.status": "Status", + "roster.branch": "Branch", + "roster.weeklyLessons": "Weekly lessons", + "roster.suggestionAcceptance": "Suggestion acceptance", + "roster.tabAll": "All", + "roster.tabActive": "Active", + "roster.tabNew": "New enrolment", + "roster.tabAtRisk": "At risk", + "roster.tabLeft": "Left", + "roster.tabPermanent": "Permanent", + "roster.tabContract": "Contract", + "roster.tabAdvisor": "Advisor", + "roster.import": "Import", + "roster.addStudent": "Add student", + "roster.addTeacher": "Add teacher", + "roster.studentsSubtitle": "Every student in the school, with their class.", + "roster.teachersSubtitle": "Every teacher in the school and the classes they lead.", + "roster.searchStudents": "Search student name or username…", + "roster.searchTeachers": "Search teacher name or username…", + "roster.noTeachers": "No teachers yet.", "builder.console": "Operator console", "builder.logout": "Sign out", "builder.loginTitle": "Operator sign-in", @@ -2124,7 +2198,7 @@ const en: Dict = { "builder.editSchool": "Edit school", "builder.editSchoolHint": "Rename the school or change its status.", "builder.suspendHint": "Suspension is immediate: every user of the school is refused, login included.", - "modules.subtitle": "The modules your school has, grouped by package.", + "modules.subtitle": "Modular by design: the school has only the components it needs.", "modules.readOnlyHint": "Modules are enabled or disabled by your Hezarfen provider.", "modules.enabledCount": "{on} of {total} enabled", "modules.enableAll": "Enable all", @@ -2133,6 +2207,22 @@ const en: Dict = { "modules.on": "On", "modules.conflictRequires": "{module} needs {needed}, which is not enabled.", "modules.conflictRequiredBy": "{module} cannot be turned off: {dependents} depend on it.", + "modules.module": "Module", + "modules.active": "Active", + "modules.unitPrice": "Unit price", + "modules.activeSeats": "Active seats", + "modules.annualAmount": "Annual amount", + "modules.annualTotal": "annual total", + "modules.tabOverview": "Overview", + "modules.tabUsage": "Usage", + "modules.tabInvoices": "Invoices", + "modules.tabContract": "Contract", + "modules.downloadInvoices": "Download invoices", + "modules.addLicense": "Add license", + "modules.fullPackage": "Full package", + "modules.customPackage": "Custom package", + "modules.renewal": "Renewal", + "modules.recentInvoices": "Recent invoices", "modules.off": "Off", "module.appointments": "Appointments", "module.attendance": "Attendance", @@ -3857,6 +3947,35 @@ const tr: Dict = { "comingSoon.description": "Bu modül hazırlanıyor — henüz gösterecek bir şey yok.", "comingSoon.emptyTitle": "Henüz kullanıma açık değil", "comingSoon.emptyDescription": "Hezarfen'in bu bölümü hâlâ hazırlanıyor. Yakında tekrar bakın.", + "roster.student": "Öğrenci", + "roster.teacher": "Öğretmen", + "roster.class": "Sınıf", + "roster.classAll": "Sınıf: Tümü", + "roster.term": "Dönem", + "roster.termAll": "Dönem: Tümü", + "roster.mastery": "Konu yetkinliği", + "roster.attendance": "Devam", + "roster.planAdherence": "Plan uyumu", + "roster.status": "Durum", + "roster.branch": "Branş", + "roster.weeklyLessons": "Haftalık ders", + "roster.suggestionAcceptance": "Öneri kabulü", + "roster.tabAll": "Tümü", + "roster.tabActive": "Aktif", + "roster.tabNew": "Yeni kayıt", + "roster.tabAtRisk": "Risk altında", + "roster.tabLeft": "Ayrılan", + "roster.tabPermanent": "Kadrolu", + "roster.tabContract": "Ücretli", + "roster.tabAdvisor": "Danışman", + "roster.import": "İçe aktar", + "roster.addStudent": "Öğrenci ekle", + "roster.addTeacher": "Öğretmen ekle", + "roster.studentsSubtitle": "Kurumdaki tüm öğrenciler, sınıflarıyla birlikte.", + "roster.teachersSubtitle": "Kurumdaki öğretmenler ve sınıf öğretmenliği yaptıkları sınıflar.", + "roster.searchStudents": "Öğrenci adı veya kullanıcı adı ara…", + "roster.searchTeachers": "Öğretmen adı veya kullanıcı adı ara…", + "roster.noTeachers": "Henüz öğretmen yok.", "builder.console": "Operatör konsolu", "builder.logout": "Çıkış yap", "builder.loginTitle": "Operatör girişi", @@ -3894,7 +4013,7 @@ const tr: Dict = { "builder.editSchool": "Okulu düzenle", "builder.editSchoolHint": "Okulun adını veya durumunu değiştir.", "builder.suspendHint": "Askıya alma anında geçerlidir: okulun tüm kullanıcıları, giriş dahil, reddedilir.", - "modules.subtitle": "Okulunun sahip olduğu modüller, paketlere göre.", + "modules.subtitle": "Modüler yapı: okulun yalnızca ihtiyaç duyduğu bileşenlere sahip olur.", "modules.readOnlyHint": "Modüller Hezarfen sağlayıcın tarafından açılır veya kapatılır.", "modules.enabledCount": "{total} modülden {on} açık", "modules.enableAll": "Hepsini aç", @@ -3903,6 +4022,22 @@ const tr: Dict = { "modules.on": "Açık", "modules.conflictRequires": "{module} için {needed} açık olmalı.", "modules.conflictRequiredBy": "{module} kapatılamaz: {dependents} buna bağlı.", + "modules.module": "Modül", + "modules.active": "Etkin", + "modules.unitPrice": "Birim fiyat", + "modules.activeSeats": "Aktif lisans", + "modules.annualAmount": "Yıllık tutar", + "modules.annualTotal": "yıllık toplam", + "modules.tabOverview": "Genel bakış", + "modules.tabUsage": "Kullanım", + "modules.tabInvoices": "Faturalar", + "modules.tabContract": "Sözleşme", + "modules.downloadInvoices": "Faturaları indir", + "modules.addLicense": "Lisans ekle", + "modules.fullPackage": "Tam paket", + "modules.customPackage": "Özel paket", + "modules.renewal": "Yenileme", + "modules.recentInvoices": "Son faturalar", "modules.off": "Kapalı", "module.appointments": "Randevular", "module.attendance": "Yoklama", diff --git a/src/pages/coming-soon-page.tsx b/src/pages/coming-soon-page.tsx index 246c1dc..84da871 100644 --- a/src/pages/coming-soon-page.tsx +++ b/src/pages/coming-soon-page.tsx @@ -19,8 +19,6 @@ const COMING_SOON_LABELS: Record = { "optik-okuma": "nav.opticalReading", raporlar: "nav.reports", "kvkk-denetim": "nav.dataProtection", - ogrenciler: "nav.studentsRoster", - ogretmenler: "nav.teachersRoster", "ogrenci-analizi": "nav.studentAnalysis", "bekleyen-onaylar": "nav.pendingApprovals", "soru-uretimi": "nav.questionGeneration", diff --git a/src/pages/license-modules-page.tsx b/src/pages/license-modules-page.tsx index 59a0339..ed982d0 100644 --- a/src/pages/license-modules-page.tsx +++ b/src/pages/license-modules-page.tsx @@ -1,14 +1,20 @@ -import { Show, Suspense, createResource } from "solid-js"; +import type { ColumnDef } from "@tanstack/solid-table"; +import { For, Show, Suspense, createMemo, createResource } from "solid-js"; import { getModules, getModulesCatalog } from "@/api/modules"; import { formatApiError } from "@/api/client"; -import { PageHeader } from "@/components/layout/page-header"; import { RouteGuard } from "@/components/layout/route-guard"; -import { ModuleCatalogGrid } from "@/components/modules/module-catalog-grid"; -import { Alert } from "@/components/ui/alert"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { ComingSoonBadge, ComingSoonPanel, ComingSoonValue } from "@/components/ui/coming-soon"; +import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; import { ErrorAlert } from "@/components/ui/error-alert"; -import { PageSpinner } from "@/components/ui/page-spinner"; +import { IconDownload, IconPackage, IconPlus } from "@/components/ui/icons"; +import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { moduleLabel, packageLabel } from "@/lib/module-labels"; import { useT } from "@/stores/preferences-context"; +type ModuleRow = { module: string; package: string; requires: string[]; enabled: boolean }; + export default function LicenseModulesPage() { return ( @@ -17,25 +23,148 @@ export default function LicenseModulesPage() { ); } -// Read-only: a school sees what it bought. Selling a module is the operator's -// act on the builder surface (/builder), never a school admin's. +// ADM-05. What the school has is real (GET /modules over the catalog); price, +// seat count, renewal and invoices belong to a billing API that does not +// exist, so those slots say "yakında". Selling a module is the operator's +// act on /builder, never a school admin's. function LicenseModulesContent() { const t = useT(); const [data, { refetch }] = createResource(async () => { const [catalog, mine] = await Promise.all([getModulesCatalog(), getModules()]); - return { catalog, enabled: mine.enabled }; + const rows: ModuleRow[] = catalog.modules.map((entry) => ({ + module: entry.module, + package: entry.package, + requires: entry.requires, + enabled: mine.enabled.includes(entry.module), + })); + return { rows, packages: catalog.packages }; }); + const enabledCount = () => (data()?.rows ?? []).filter((row) => row.enabled).length; + const totalCount = () => data()?.rows.length ?? 0; + const isFull = () => totalCount() > 0 && enabledCount() === totalCount(); + const enabledPackages = () => + (data()?.packages ?? []) + .filter((pkg) => pkg.modules.some((module) => data()?.rows.find((row) => row.module === module)?.enabled)) + .map((pkg) => packageLabel(pkg.package, t)); + + const columns = createMemo[]>(() => [ + { + id: "module", + header: t("modules.module"), + cell: (cell) => ( +
+ + + +
+

{moduleLabel(cell.row.original.module, t)}

+

+ {packageLabel(cell.row.original.package, t)} + 0}> + {` · ${t("modules.requires")}: ${cell.row.original.requires.map((name) => moduleLabel(name, t)).join(", ")}`} + +

+
+
+ ), + }, + { + id: "status", + header: t("builder.status"), + cell: (cell) => ( + + {cell.row.original.enabled ? t("modules.active") : t("modules.off")} + + ), + }, + { id: "unitPrice", header: t("modules.unitPrice"), meta: { align: "right" }, enableSorting: false, cell: () => }, + { id: "seats", header: t("modules.activeSeats"), meta: { align: "right" }, enableSorting: false, cell: () => }, + { id: "annual", header: t("modules.annualAmount"), meta: { align: "right" }, enableSorting: false, cell: () => }, + ]); + return ( -
- - {t("modules.readOnlyHint")} - }> +
+ + + {t("modules.tabOverview")} + + {(key) => ( + + {t(key)} + + + )} + + + + +
+
+

{t("nav.licenseModules")}

+

{t("modules.subtitle")}

+
+
+ + +
+
+ + }> void refetch()} /> - {(value) => } + {(value) => ( + <> +
+
+
+
+

+ {isFull() ? t("modules.fullPackage") : t("modules.customPackage")} +

+ {t("modules.active")} +
+

{enabledPackages().join(" + ") || "—"}

+
+
+ +

{t("modules.annualTotal")}

+
+
+
+
+
+
+ {t("modules.enabledCount", { on: String(enabledCount()), total: String(totalCount()) })} + + {t("modules.renewal")}: + +
+
+ + + + + + )}
diff --git a/src/pages/students-roster-page.tsx b/src/pages/students-roster-page.tsx new file mode 100644 index 0000000..cce47a8 --- /dev/null +++ b/src/pages/students-roster-page.tsx @@ -0,0 +1,173 @@ +import { useNavigate } from "@tanstack/solid-router"; +import type { ColumnDef } from "@tanstack/solid-table"; +import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; +import { getClassMembers, getClasses } from "@/api/classes"; +import { getTerms } from "@/api/terms"; +import { getUserSearch } from "@/api/users"; +import { formatApiError, type ClassGroup, type PersonRef } from "@/api/client"; +import { RouteGuard } from "@/components/layout/route-guard"; +import { RosterPersonCell } from "@/components/users/roster-person-cell"; +import { Button } from "@/components/ui/button"; +import { ComingSoonBadge, ComingSoonValue } from "@/components/ui/coming-soon"; +import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; +import { ErrorAlert } from "@/components/ui/error-alert"; +import { IconEye, IconPlus, IconUploadCloud } from "@/components/ui/icons"; +import { Select } from "@/components/ui/select"; +import { TableRowActions } from "@/components/ui/table-row-actions"; +import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { useT } from "@/stores/preferences-context"; + +const ROSTER_PAGE_SIZE = 10; + +type StudentRow = { person: PersonRef; classes: ClassGroup[] }; + +export default function StudentsRosterPage() { + return ( + + + + ); +} + +// ADM-02. The roster, class and term are real; topic mastery, plan adherence +// and the risk status are AI/analytics fields no endpoint serves, so their +// columns keep the design's slot and say "yakında" instead of a number. +function StudentsRosterContent() { + const t = useT(); + const navigate = useNavigate(); + const [classFilter, setClassFilter] = createSignal(""); + const [termFilter, setTermFilter] = createSignal(""); + + const [data, { refetch }] = createResource(async () => { + const [students, classes, terms] = await Promise.all([ + getUserSearch("", undefined, "student"), + getClasses(), + getTerms().catch(() => ({ items: [] })), + ]); + // No endpoint maps students to classes in bulk; one members read per class + // is bounded by the class count, not the student count. + const memberships = await Promise.all( + classes.items.map(async (cls) => ({ cls, members: (await getClassMembers(cls.id)).items })), + ); + const byStudent = new Map(); + for (const { cls, members } of memberships) { + for (const member of members) byStudent.set(member.user.id, [...(byStudent.get(member.user.id) ?? []), cls]); + } + const rows: StudentRow[] = students.items.map((person) => ({ person, classes: byStudent.get(person.id) ?? [] })); + return { rows, classes: classes.items, terms: terms.items }; + }); + + const rows = createMemo(() => + (data()?.rows ?? []).filter((row) => { + if (classFilter() && !row.classes.some((cls) => cls.id === classFilter())) return false; + if (termFilter() && !row.classes.some((cls) => cls.term === termFilter())) return false; + return true; + }), + ); + + const open = (row: StudentRow) => void navigate({ to: "/profile/$userId", params: { userId: row.person.id } }); + + const columns = createMemo[]>(() => [ + { + id: "student", size: 220, + header: t("roster.student"), + cell: (cell) => , + }, + { + id: "class", + size: 90, + header: t("roster.class"), + cell: (cell) => ( + {cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"} + ), + }, + { id: "mastery", size: 130, header: t("roster.mastery"), enableSorting: false, cell: () => }, + { id: "attendance", size: 130, header: t("roster.attendance"), enableSorting: false, cell: () => }, + { id: "plan", size: 130, header: t("roster.planAdherence"), enableSorting: false, cell: () => }, + { id: "status", size: 130, header: t("roster.status"), enableSorting: false, cell: () => }, + { + id: "actions", + header: t("common.actions"), + meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" }, + cell: (cell) => ( + , onSelect: () => open(cell.row.original) }]} + /> + ), + }, + ]); + + return ( +
+ + + {t("roster.tabAll")} + + {(key) => ( + + {t(key)} + + + )} + + + + +
+
+

{t("nav.studentsRoster")}

+

{t("roster.studentsSubtitle")}

+
+
+ + +
+
+ + }> + + void refetch()} /> + + + {(value) => ( + + [row.person.username, row.person.display_name ?? ""].join(" ").toLocaleLowerCase().includes(query.toLocaleLowerCase()) + } + filters={ + <> + + + + } + enablePagination + pageSize={ROSTER_PAGE_SIZE} + storageKey="students-roster" + onRowClick={open} + /> + )} + + +
+ ); +} diff --git a/src/pages/teachers-roster-page.tsx b/src/pages/teachers-roster-page.tsx new file mode 100644 index 0000000..cc21a1a --- /dev/null +++ b/src/pages/teachers-roster-page.tsx @@ -0,0 +1,134 @@ +import { useNavigate } from "@tanstack/solid-router"; +import type { ColumnDef } from "@tanstack/solid-table"; +import { For, Show, Suspense, createMemo, createResource } from "solid-js"; +import { getClasses } from "@/api/classes"; +import { getUserSearch } from "@/api/users"; +import { formatApiError, type PersonRef } from "@/api/client"; +import { RouteGuard } from "@/components/layout/route-guard"; +import { RosterPersonCell } from "@/components/users/roster-person-cell"; +import { Button } from "@/components/ui/button"; +import { ComingSoonBadge, ComingSoonValue } from "@/components/ui/coming-soon"; +import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; +import { ErrorAlert } from "@/components/ui/error-alert"; +import { IconEye, IconPlus, IconUploadCloud } from "@/components/ui/icons"; +import { TableRowActions } from "@/components/ui/table-row-actions"; +import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { useT } from "@/stores/preferences-context"; + +const ROSTER_PAGE_SIZE = 10; + +type TeacherRow = { person: PersonRef; homeroomClasses: number }; + +export default function TeachersRosterPage() { + return ( + + + + ); +} + +// ADM-08. "Sınıf" is the number of classes the teacher is homeroom teacher of +// (ClassGroup.teacher); branch, weekly load, AI acceptance and employment +// status have no field anywhere, so they stay "yakında". +function TeachersRosterContent() { + const t = useT(); + const navigate = useNavigate(); + + const [data, { refetch }] = createResource(async () => { + const [teachers, classes] = await Promise.all([getUserSearch("", undefined, "teacher"), getClasses()]); + const homeroom = new Map(); + for (const cls of classes.items) { + if (cls.teacher) homeroom.set(cls.teacher.id, (homeroom.get(cls.teacher.id) ?? 0) + 1); + } + return teachers.items.map((person) => ({ person, homeroomClasses: homeroom.get(person.id) ?? 0 })); + }); + + const open = (row: TeacherRow) => void navigate({ to: "/profile/$userId", params: { userId: row.person.id } }); + + const columns = createMemo[]>(() => [ + { id: "teacher", size: 220, header: t("roster.teacher"), cell: (cell) => }, + { id: "branch", size: 130, header: t("roster.branch"), enableSorting: false, cell: () => }, + { + accessorKey: "homeroomClasses", + size: 90, + header: t("roster.class"), + meta: { cellClass: "mono tabular-nums" }, + cell: (cell) => (cell.row.original.homeroomClasses > 0 ? cell.row.original.homeroomClasses : "—"), + }, + { id: "weekly", size: 130, header: t("roster.weeklyLessons"), enableSorting: false, cell: () => }, + { id: "acceptance", size: 130, header: t("roster.suggestionAcceptance"), enableSorting: false, cell: () => }, + { id: "status", size: 130, header: t("roster.status"), enableSorting: false, cell: () => }, + { + id: "actions", + header: t("common.actions"), + meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" }, + cell: (cell) => ( + , onSelect: () => open(cell.row.original) }]} + /> + ), + }, + ]); + + return ( +
+ + + {t("roster.tabAll")} + + {(key) => ( + + {t(key)} + + + )} + + + + +
+
+

{t("nav.teachersRoster")}

+

{t("roster.teachersSubtitle")}

+
+
+ + +
+
+ + }> + + void refetch()} /> + + + {(rows) => ( + + [row.person.username, row.person.display_name ?? ""].join(" ").toLocaleLowerCase().includes(query.toLocaleLowerCase()) + } + enablePagination + pageSize={ROSTER_PAGE_SIZE} + storageKey="teachers-roster" + onRowClick={open} + /> + )} + + +
+ ); +} diff --git a/src/routes/router.tsx b/src/routes/router.tsx index a1115ed..ea6292a 100644 --- a/src/routes/router.tsx +++ b/src/routes/router.tsx @@ -68,6 +68,8 @@ const PaymentStatementPage = lazyRoute(() => import("@/pages/payment-statement-p const WhiteboardsPage = lazyRoute(() => import("@/pages/whiteboards-page")); const WhiteboardPage = lazyRoute(() => import("@/pages/whiteboard-page")); const ComingSoonPage = lazyRoute(() => import("@/pages/coming-soon-page")); +const StudentsRosterPage = lazyRoute(() => import("@/pages/students-roster-page")); +const TeachersRosterPage = lazyRoute(() => import("@/pages/teachers-roster-page")); const LicenseModulesPage = lazyRoute(() => import("@/pages/license-modules-page")); const BuilderLoginPage = lazyRoute(() => import("@/pages/builder-login-page")); const BuilderSchoolsPage = lazyRoute(() => import("@/pages/builder-schools-page")); @@ -413,6 +415,18 @@ const whiteboardRoute = createRoute({ component: WhiteboardPage, }); +const studentsRosterRoute = createRoute({ + getParentRoute: () => rootRoute, + path: "/management/students", + component: StudentsRosterPage, +}); + +const teachersRosterRoute = createRoute({ + getParentRoute: () => rootRoute, + path: "/management/teachers", + component: TeachersRosterPage, +}); + const licenseModulesRoute = createRoute({ getParentRoute: () => rootRoute, path: "/management/modules", @@ -449,8 +463,6 @@ const COMING_SOON_SLUGS = [ "optik-okuma", "raporlar", "kvkk-denetim", - "ogrenciler", - "ogretmenler", "ogrenci-analizi", "bekleyen-onaylar", "soru-uretimi", @@ -515,6 +527,8 @@ const routeTree = rootRoute.addChildren([ paymentStatementRoute, whiteboardsRoute, whiteboardRoute, + studentsRosterRoute, + teachersRosterRoute, licenseModulesRoute, builderLoginRoute, builderSchoolsRoute,