forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'dev' into main

Browse files at this commit

d19a43de325d42801415ddfde571d52b9b683494Burak BoduroğluParent: aba07efc5534b3
- builder console, license modules page, student and teacher rosters
- full role navigation coverage and parent tab routes
- Figma coverage and navigation sync documentation
docs/auth/role-scope-matrix.mdmodified+24 -2
@@ -29,6 +29,25 @@
2929 | Settings `/management/settings` | ❌ | ❌ | ✅ | ✅ |
3030 | Terms `/management/terms` | ❌ | ❌ | ✅ | ✅ |
3131 | User management `/admin/users` | ❌ | ❌ | ❌ | ✅ |
32+| License & modules `/management/modules` (read-only) | ❌ | ❌ | ❌ | ✅ |
33+| Student pomodoro lookup `/management/pomodoros` | ❌ | ✅ | ✅ | ✅ |
34+
35+Parent pages: `/students` (progress report) plus `/students/attendance`,
36+`/students/exams`, `/students/study` — the same page opening a linked child on
37+that tab. Study reads `GET /pomodoro/{user}` (parent link), shown only when the
38+school has the `pomodoro` module.
39+
40+## Builder (Operator) Surface
41+
42+Not a school role. A builder session (`builder.` cookie) is 401 on every school
43+route and a school session is 401 here, so these pages carry their own
44+`BuilderProvider`/`BuilderGuard` instead of `RouteGuard`.
45+
46+| Page | Purpose |
47+|---|---|
48+| `/builder/login` | Operator sign-in (linked from the school login footer) |
49+| `/builder` | School list: create (with first admin + module set), suspend/activate, delete |
50+| `/builder/schools/:slug` | Rename/status, module switchboard (per module + per package), admin password reset, enter as admin |
3251
3352 ## Primary Navigation per Role
3453
@@ -44,8 +63,11 @@
4463 | Meals `/meals` | ❌ | ❌ | ❌ | ❌ | ✅ |
4564
4665 Primary destinations stay compact. Every role-valid list page is also exposed
47-in the grouped sidebar/mobile drawer; Education and Community are collapsible.
48-Appointments is directly available there for every role. Detail pages remain
66+in the grouped sidebar/mobile drawer, gated by the school's modules:
67+courses, notes, questions, events, meals, appointments and messages for every
68+role the backend serves them to; terms, student marks/pomodoro lookups and the
69+work log for staff; license modules for admin. Appointments is directly
70+available there for every role. Detail pages remain
4971 reachable from their parent lists, and Guide remains in the account menu.
5072
5173 ## Dashboard Scope per Role
docs/ui/figma-migration-coverage.mdmodified+31 -8
@@ -20,6 +20,7 @@ must always be replaced with real application data.
2020 | Student | `3:7` | 11 screens plus 2 modal variants audited |
2121 | Parent | `3:8` | 8 screens audited |
2222 | System | `103:2` | 7 screens audited |
23+| Builder — Operatör | `205:23536` | BLD-01 login, BLD-02 schools, BLD-02a new school panel, BLD-03 school detail, BLD-03a enter-school panel |
2324 | Mobile Kit | `40:2` | Shared 393px mobile primitives audited |
2425 | Student Mobile | `40:3` | 9 screens audited |
2526 | Parent Mobile | `40:4` | 6 screens audited |
@@ -29,6 +30,22 @@ The Cover manifest also names a Foundations page, but no Foundations node URL
2930 was supplied. Exact values already exposed by component and dark-mode contexts
3031 are used; unknown values are not inferred.
3132
33+## Navigation sync (2026-09-13)
34+
35+The four `Web / Sidebar / *` components mirror `src/components/layout/nav-items.ts`
36+as an accordion, the way the app renders them: `Web / Nav Group` headers
37+(Collapsed/Open) over `Web / Nav Group Item` rows (Default/Active, "Yakında"
38+badge). Each screen overrides only its open group and active row. When the
39+nav tree changes in code, update the sidebar component, not individual
40+screens. `Web / Switch` (Off/On) backs module and review toggles.
41+
42+The shell matches the app too: `Web / Sidebar / *` is full height with the
43+`Brand / Logo Mark` row on top and the account row at the bottom, and
44+`Web / Top Bar` is the 1180px content header (back, route label, command
45+center, messages, notifications, Çelebi'ye sor) at x=260. Screens added from
46+the running app are `generate_figma_design` captures whose sidebar and top bar
47+were swapped for these component instances; their content is raw layers.
48+
3249 ## Implemented foundation
3350
3451 - Figma semantic light/dark aliases with the landing page's `#00ADD8` brand
@@ -71,9 +88,21 @@ are used; unknown values are not inferred.
7188 | `/management/payments` | Admin payments | Keep ledger and permission behavior |
7289 | `/management/staff-work` | Admin staff work | Keep existing read/update/delete contract |
7390 | `/admin/users`, `/admin/users/:id` | Admin users and roles | Keep admin guard and critical confirmations |
91+| `/management/students` | ADM-02 Öğrenciler | Real roster + class/term filters; mastery, attendance, plan and risk columns stay "yakında" |
92+| `/management/teachers` | ADM-08 Öğretmenler | Real roster + homeroom class count; branch, load, AI acceptance and status stay "yakında" |
93+| `/management/modules` | ADM-05 Lisans ve modüller | Real enabled/total modules per package; price, seats, renewal and invoices stay "yakında" |
7494 | `/students` | Parent development views | Keep linked-child authorization |
7595 | `/meals`, `/meals/:id` | Admin cafeteria | Keep menu, booking, balance, and attendance behavior |
7696 | `/payments` | Parent/student statement | Remain read-only until a payment-provider API exists |
97+| `/management/terms` | ADM-25 Dönemler | Captured from the running app |
98+| `/events`, `/events/:id` | ADM-26 Etkinlikler, ADM-26a Etkinlik Detayı | Captured from the running app |
99+| `/management/pomodoros` | ADM-27 Öğrenci Pomodoroları | Captured from the running app |
100+| `/questions`, `/questions/:id` | TCH-15 Soru Havuzu, STU-13 Soru Detayı | Captured from the running app |
101+| `/notes` | STU-12 Defter | Captured from the running app |
102+| `/guide`, `/profile/me`, `/register` | SYS-08 Rehber, SYS-09 Profilim, SYS-10 Kayıt Ol | Captured from the running app |
103+| `/builder/login` | BLD-01 Operatör Girişi | Builder session only; linked from the SYS-01/login footer |
104+| `/builder` | BLD-02 Okullar, BLD-02a Yeni Okul | Create, suspend/activate, delete |
105+| `/builder/schools/:slug` | BLD-03 Okul Detayı, BLD-03a Okula Gir | Module switchboard, password reset, enter as admin |
77106
78107 ## Figma features blocked by product or backend scope
79108
@@ -99,17 +128,11 @@ false actions:
99128
100129 Keep the current UI and behavior until a specific design is added:
101130
102-- `/register`
103-- `/guide`
104-- `/profile/me`, `/profile/:userId`
105-- `/notes`
106-- `/questions`, `/questions/:id`
107-- `/events`, `/events/:id`
131+- `/profile/:userId` (another user's profile)
108132 - `/exam-room/:id`
109133 - `/exams/:id/live`
110-- `/management/pomodoros`
111-- `/management/terms`
112134 - `/whiteboards/:id` live canvas details beyond the list concept
135+- `/students/attendance`, `/students/exams`, `/students/study` parent tab routes
113136 - `/meals/:id` detailed account/service/management tabs
114137 - `/studies`, `/clubs`, and `/attendance` redirect aliases
115138
src/api/__tests__/builder/builder.test.tsadded+44 -0
@@ -0,0 +1,44 @@
1+import { afterEach, describe, expect, it, vi } from "vitest";
2+import { getBuilderMe } from "../../builder";
3+import { postBuilderLogin } from "../../builder";
4+import { postBuilderLogout } from "../../builder";
5+import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";
6+
7+describe("builder API", () => {
8+ afterEach(() => {
9+ vi.restoreAllMocks();
10+ });
11+
12+ it("postBuilderLogin posts credentials to /builder/login", async () => {
13+ const builder = { id: "b1", username: "operator" };
14+ mockFetchSuccess(builder);
15+
16+ const result = await postBuilderLogin({ username: "operator", password: "correct horse" });
17+ expect(result).toEqual(builder);
18+
19+ const [url, init] = lastFetchCall();
20+ expect(url).toBe("/api/builder/login");
21+ expect(init?.method).toBe("POST");
22+ expect(init?.body).toBe(JSON.stringify({ username: "operator", password: "correct horse" }));
23+ });
24+
25+ it("postBuilderLogout posts to /builder/logout", async () => {
26+ mockFetch204();
27+
28+ await postBuilderLogout();
29+
30+ const [url, init] = lastFetchCall();
31+ expect(url).toBe("/api/builder/logout");
32+ expect(init?.method).toBe("POST");
33+ });
34+
35+ it("getBuilderMe reads /builder/me", async () => {
36+ mockFetchSuccess({ id: "b1", username: "operator" });
37+
38+ await getBuilderMe();
39+
40+ const [url, init] = lastFetchCall();
41+ expect(url).toBe("/api/builder/me");
42+ expect(init?.method).toBe("GET");
43+ });
44+});
src/api/__tests__/schools/schools.test.tsadded+141 -0
@@ -0,0 +1,141 @@
1+import { afterEach, describe, expect, it, vi } from "vitest";
2+import { deleteSchoolBySlug } from "../../schools";
3+import { deleteSchoolModule } from "../../schools";
4+import { getSchoolBySlug } from "../../schools";
5+import { getSchoolModules } from "../../schools";
6+import { getSchools } from "../../schools";
7+import { patchSchoolBySlug } from "../../schools";
8+import { patchSchoolModules } from "../../schools";
9+import { postSchool } from "../../schools";
10+import { postSchoolAdminPassword } from "../../schools";
11+import { postSchoolEnter } from "../../schools";
12+import { postSchoolModule } from "../../schools";
13+import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";
14+
15+const school = { slug: "ata-koleji", name: "Ata Koleji", status: "active", created_at: 1, modules: ["courses"] };
16+const modules = { enabled: ["courses"], disabled: ["exams"] };
17+
18+describe("schools API", () => {
19+ afterEach(() => {
20+ vi.restoreAllMocks();
21+ });
22+
23+ it("getSchools pages /schools", async () => {
24+ mockFetchSuccess({ items: [school], total: 1, limit: 20, offset: 0 });
25+
26+ const result = await getSchools({ limit: 20, offset: 0 });
27+ expect(result.items).toEqual([school]);
28+
29+ const [url, init] = lastFetchCall();
30+ expect(url).toBe("/api/schools?limit=20&offset=0");
31+ expect(init?.method).toBe("GET");
32+ });
33+
34+ it("getSchoolBySlug reads /schools/{slug}", async () => {
35+ mockFetchSuccess(school);
36+
37+ await getSchoolBySlug("ata-koleji");
38+
39+ const [url, init] = lastFetchCall();
40+ expect(url).toBe("/api/schools/ata-koleji");
41+ expect(init?.method).toBe("GET");
42+ });
43+
44+ it("postSchool posts the school and its first admin", async () => {
45+ mockFetchSuccess(school, 201);
46+ const body = { slug: "ata-koleji", name: "Ata Koleji", admin_username: "admin", admin_password: "secret123", modules: ["courses"] };
47+
48+ await postSchool(body);
49+
50+ const [url, init] = lastFetchCall();
51+ expect(url).toBe("/api/schools");
52+ expect(init?.method).toBe("POST");
53+ expect(init?.body).toBe(JSON.stringify(body));
54+ });
55+
56+ it("patchSchoolBySlug patches name and status", async () => {
57+ mockFetchSuccess({ ...school, status: "suspended" });
58+
59+ await patchSchoolBySlug("ata-koleji", { status: "suspended" });
60+
61+ const [url, init] = lastFetchCall();
62+ expect(url).toBe("/api/schools/ata-koleji");
63+ expect(init?.method).toBe("PATCH");
64+ expect(init?.body).toBe(JSON.stringify({ status: "suspended" }));
65+ });
66+
67+ it("deleteSchoolBySlug deletes /schools/{slug}", async () => {
68+ mockFetch204();
69+
70+ await deleteSchoolBySlug("ata-koleji");
71+
72+ const [url, init] = lastFetchCall();
73+ expect(url).toBe("/api/schools/ata-koleji");
74+ expect(init?.method).toBe("DELETE");
75+ });
76+
77+ it("postSchoolAdminPassword re-keys an admin", async () => {
78+ mockFetch204();
79+
80+ await postSchoolAdminPassword("ata-koleji", { username: "admin", password: "newsecret" });
81+
82+ const [url, init] = lastFetchCall();
83+ expect(url).toBe("/api/schools/ata-koleji/admin-password");
84+ expect(init?.method).toBe("POST");
85+ expect(init?.body).toBe(JSON.stringify({ username: "admin", password: "newsecret" }));
86+ });
87+
88+ it("postSchoolEnter enters as a named admin", async () => {
89+ mockFetchSuccess({ id: "u1", username: "admin", role: "admin" });
90+
91+ await postSchoolEnter("ata-koleji", { username: "admin" });
92+
93+ const [url, init] = lastFetchCall();
94+ expect(url).toBe("/api/schools/ata-koleji/enter");
95+ expect(init?.method).toBe("POST");
96+ expect(init?.body).toBe(JSON.stringify({ username: "admin" }));
97+ });
98+
99+ it("getSchoolModules reads both halves of the catalog", async () => {
100+ mockFetchSuccess(modules);
101+
102+ const result = await getSchoolModules("ata-koleji");
103+ expect(result).toEqual(modules);
104+
105+ const [url, init] = lastFetchCall();
106+ expect(url).toBe("/api/schools/ata-koleji/modules");
107+ expect(init?.method).toBe("GET");
108+ });
109+
110+ it("patchSchoolModules re-sells the shelf in one write", async () => {
111+ mockFetchSuccess(modules);
112+ const body = { enable: ["exams"], disable_packages: ["ai"] };
113+
114+ await patchSchoolModules("ata-koleji", body);
115+
116+ const [url, init] = lastFetchCall();
117+ expect(url).toBe("/api/schools/ata-koleji/modules");
118+ expect(init?.method).toBe("PATCH");
119+ expect(init?.body).toBe(JSON.stringify(body));
120+ });
121+
122+ it("postSchoolModule enables one module", async () => {
123+ mockFetchSuccess(modules);
124+
125+ await postSchoolModule("ata-koleji", "exams");
126+
127+ const [url, init] = lastFetchCall();
128+ expect(url).toBe("/api/schools/ata-koleji/modules/exams");
129+ expect(init?.method).toBe("POST");
130+ });
131+
132+ it("deleteSchoolModule disables one module", async () => {
133+ mockFetchSuccess(modules);
134+
135+ await deleteSchoolModule("ata-koleji", "exams");
136+
137+ const [url, init] = lastFetchCall();
138+ expect(url).toBe("/api/schools/ata-koleji/modules/exams");
139+ expect(init?.method).toBe("DELETE");
140+ });
141+});
src/api/builder/getBuilderMe.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+import type { Builder } from "../client";
3+
4+export function getBuilderMe(signal?: AbortSignal): Promise<Builder> {
5+ return client<Builder>("/builder/me", { signal });
6+}
src/api/builder/index.tsadded+3 -0
@@ -0,0 +1,3 @@
1+export * from "./getBuilderMe";
2+export * from "./postBuilderLogin";
3+export * from "./postBuilderLogout";
src/api/builder/postBuilderLogin.tsadded+13 -0
@@ -0,0 +1,13 @@
1+import { client } from "../client";
2+import type { Builder } from "../client";
3+
4+export type BuilderLoginBody = {
5+ username: string;
6+ password: string;
7+};
8+
9+// Sets a `builder.`-prefixed session cookie, which replaces any school session
10+// in this browser: the two are mutually exclusive (each is 401 on the other side).
11+export function postBuilderLogin(body: BuilderLoginBody): Promise<Builder> {
12+ return client<Builder>("/builder/login", { method: "POST", body });
13+}
src/api/builder/postBuilderLogout.tsadded+5 -0
@@ -0,0 +1,5 @@
1+import { client } from "../client";
2+
3+export function postBuilderLogout(): Promise<void> {
4+ return client<void>("/builder/logout", { method: "POST" });
5+}
src/api/client/client.tsmodified+13 -0
@@ -105,6 +105,19 @@ const API_ERROR_MESSAGES: Record<string, Record<Locale, string>> = {
105105 en: "The repeated slots overlap each other.",
106106 tr: "Tekrarlanan müsaitlikler birbiriyle çakışıyor.",
107107 },
108+ // Builder surface (web/builder.rs, tenant.rs) — byte-exact.
109+ "school slug already taken": {
110+ en: "That school code is already taken.",
111+ tr: "Bu okul kodu zaten kullanılıyor.",
112+ },
113+ "that account is not an admin of this school": {
114+ en: "That account exists but is not an admin of this school.",
115+ tr: "Bu hesap var ama bu okulun yöneticisi değil.",
116+ },
117+ "school is suspended": {
118+ en: "This school is suspended.",
119+ tr: "Bu okul askıya alınmış.",
120+ },
108121 // Booking/decision conflicts from domain/appointment.rs — byte-exact.
109122 "the slot is already booked": {
110123 en: "Someone else booked this time first.",
src/api/client/types.tsmodified+26 -0
@@ -133,6 +133,32 @@ export type NoteFile = {
133133 size: number;
134134 };
135135
136+/** The deployment operator behind a `builder.` session cookie — no role, no school. */
137+export type Builder = {
138+ id: string;
139+ username: string;
140+};
141+
142+export type SchoolStatus = "active" | "suspended";
143+
144+/** One school of the deployment, as the builder surface sees it. */
145+export type School = {
146+ slug: string;
147+ name: string;
148+ /** A suspended school refuses every one of its own users, login included. */
149+ status: SchoolStatus;
150+ /** UTC unix-milliseconds. */
151+ created_at: number;
152+ /** Bought modules, sorted by name. */
153+ modules: string[];
154+};
155+
156+/** One school's entitlements, both halves of the catalog. */
157+export type SchoolModules = {
158+ enabled: string[];
159+ disabled: string[];
160+};
161+
136162 /** The caller's school entitlements: every switched-on module, sorted by name. */
137163 export type EnabledModules = {
138164 enabled: string[];
src/api/schools/deleteSchoolBySlug.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+
3+// Destroys the school's data and uploaded files for good.
4+export function deleteSchoolBySlug(slug: string): Promise<void> {
5+ return client<void>(`/schools/${encodeURIComponent(slug)}`, { method: "DELETE" });
6+}
src/api/schools/deleteSchoolModule.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import type { SchoolModules } from "../client";
3+
4+export function deleteSchoolModule(slug: string, module: string): Promise<SchoolModules> {
5+ return client<SchoolModules>(`/schools/${encodeURIComponent(slug)}/modules/${encodeURIComponent(module)}`, {
6+ method: "DELETE",
7+ });
8+}
src/api/schools/getSchoolBySlug.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+import type { School } from "../client";
3+
4+export function getSchoolBySlug(slug: string, signal?: AbortSignal): Promise<School> {
5+ return client<School>(`/schools/${encodeURIComponent(slug)}`, { signal });
6+}
src/api/schools/getSchoolModules.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+import type { SchoolModules } from "../client";
3+
4+export function getSchoolModules(slug: string, signal?: AbortSignal): Promise<SchoolModules> {
5+ return client<SchoolModules>(`/schools/${encodeURIComponent(slug)}/modules`, { signal });
6+}
src/api/schools/getSchools.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import { normalizePage, pageQuery, type Page, type PageParams } from "../client";
3+import type { School } from "../client";
4+
5+export async function getSchools(params?: PageParams, signal?: AbortSignal): Promise<Page<School>> {
6+ const data = await client<unknown>(`/schools${pageQuery(params)}`, { signal });
7+ return normalizePage<School>(data);
8+}
src/api/schools/index.tsadded+11 -0
@@ -0,0 +1,11 @@
1+export * from "./getSchools";
2+export * from "./getSchoolBySlug";
3+export * from "./postSchool";
4+export * from "./patchSchoolBySlug";
5+export * from "./deleteSchoolBySlug";
6+export * from "./postSchoolAdminPassword";
7+export * from "./postSchoolEnter";
8+export * from "./getSchoolModules";
9+export * from "./patchSchoolModules";
10+export * from "./postSchoolModule";
11+export * from "./deleteSchoolModule";
src/api/schools/patchSchoolBySlug.tsadded+11 -0
@@ -0,0 +1,11 @@
1+import { client } from "../client";
2+import type { School, SchoolStatus } from "../client";
3+
4+export type UpdateSchoolBody = {
5+ name?: string;
6+ status?: SchoolStatus;
7+};
8+
9+export function patchSchoolBySlug(slug: string, body: UpdateSchoolBody): Promise<School> {
10+ return client<School>(`/schools/${encodeURIComponent(slug)}`, { method: "PATCH", body });
11+}
src/api/schools/patchSchoolModules.tsadded+14 -0
@@ -0,0 +1,14 @@
1+import { client } from "../client";
2+import type { SchoolModules } from "../client";
3+
4+export type PatchSchoolModulesBody = {
5+ enable?: string[];
6+ disable?: string[];
7+ enable_packages?: string[];
8+ disable_packages?: string[];
9+};
10+
11+// One atomic re-sell: a 409 names every broken dependency and nothing is written.
12+export function patchSchoolModules(slug: string, body: PatchSchoolModulesBody): Promise<SchoolModules> {
13+ return client<SchoolModules>(`/schools/${encodeURIComponent(slug)}/modules`, { method: "PATCH", body });
14+}
src/api/schools/postSchool.tsadded+16 -0
@@ -0,0 +1,16 @@
1+import { client } from "../client";
2+import type { School } from "../client";
3+
4+export type CreateSchoolBody = {
5+ /** Immutable once taken: names the school's database, blobs and cookie prefix. */
6+ slug: string;
7+ name: string;
8+ admin_username: string;
9+ admin_password: string;
10+ /** Omitted sells the whole catalog. */
11+ modules?: string[];
12+};
13+
14+export function postSchool(body: CreateSchoolBody): Promise<School> {
15+ return client<School>("/schools", { method: "POST", body });
16+}
src/api/schools/postSchoolAdminPassword.tsadded+11 -0
@@ -0,0 +1,11 @@
1+import { client } from "../client";
2+
3+export type SchoolAdminPasswordBody = {
4+ username: string;
5+ password: string;
6+};
7+
8+// Re-keys an admin of that school and revokes every session the account held.
9+export function postSchoolAdminPassword(slug: string, body: SchoolAdminPasswordBody): Promise<void> {
10+ return client<void>(`/schools/${encodeURIComponent(slug)}/admin-password`, { method: "POST", body });
11+}
src/api/schools/postSchoolEnter.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import type { User } from "../client";
3+
4+// Support access: swaps the builder cookie for an ordinary session of one of
5+// the school's admins. Refused (403) on a suspended school.
6+export function postSchoolEnter(slug: string, body: { username: string }): Promise<User> {
7+ return client<User>(`/schools/${encodeURIComponent(slug)}/enter`, { method: "POST", body });
8+}
src/api/schools/postSchoolModule.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import type { SchoolModules } from "../client";
3+
4+export function postSchoolModule(slug: string, module: string): Promise<SchoolModules> {
5+ return client<SchoolModules>(`/schools/${encodeURIComponent(slug)}/modules/${encodeURIComponent(module)}`, {
6+ method: "POST",
7+ });
8+}
src/components/builder/builder-guard.tsxadded+26 -0
@@ -0,0 +1,26 @@
1+import { Navigate } from "@tanstack/solid-router";
2+import { type ParentProps, Show } from "solid-js";
3+import { formatApiError } from "@/api/client";
4+import { ErrorAlert } from "@/components/ui/error-alert";
5+import { PageSpinner } from "@/components/ui/page-spinner";
6+import { useBuilder } from "@/stores/builder-context";
7+
8+/** Renders its children only for a live builder session; otherwise sends the visitor to /builder/login. */
9+export function BuilderGuard(props: ParentProps) {
10+ const session = useBuilder();
11+
12+ return (
13+ <Show when={!session.loading()} fallback={<PageSpinner />}>
14+ <Show
15+ when={session.builder()}
16+ fallback={
17+ <Show when={session.error()} fallback={<Navigate to="/builder/login" />}>
18+ <ErrorAlert message={formatApiError(session.error())} onRetry={session.refresh} />
19+ </Show>
20+ }
21+ >
22+ {props.children}
23+ </Show>
24+ </Show>
25+ );
26+}
src/components/builder/builder-header.tsxadded+33 -0
@@ -0,0 +1,33 @@
1+import { Link, useNavigate } from "@tanstack/solid-router";
2+import { Button } from "@/components/ui/button";
3+import { IconLogout, IconShieldCheck } from "@/components/ui/icons";
4+import { useBuilder } from "@/stores/builder-context";
5+import { useT } from "@/stores/preferences-context";
6+
7+/** The operator strip over every builder page: where you are, who you are, the way out. */
8+export function BuilderHeader() {
9+ const session = useBuilder();
10+ const navigate = useNavigate();
11+ const t = useT();
12+
13+ const logout = async () => {
14+ await session.logout();
15+ void navigate({ to: "/builder/login" });
16+ };
17+
18+ return (
19+ <div class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border-line bg-surface-base px-4 py-2.5">
20+ <Link to="/builder" class="flex min-w-0 items-center gap-2 text-sm font-semibold text-text-strong">
21+ <IconShieldCheck class="h-4 w-4 shrink-0 text-primary" />
22+ <span class="truncate">{t("builder.console")}</span>
23+ </Link>
24+ <div class="flex min-w-0 items-center gap-3">
25+ <span class="truncate text-sm text-text-subtle">@{session.builder()?.username}</span>
26+ <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => void logout()}>
27+ <IconLogout class="h-4 w-4" />
28+ {t("builder.logout")}
29+ </Button>
30+ </div>
31+ </div>
32+ );
33+}
src/components/builder/create-school-panel.tsxadded+129 -0
@@ -0,0 +1,129 @@
1+import { Show, createResource, createSignal } from "solid-js";
2+import { getModulesCatalog } from "@/api/modules";
3+import { postSchool } from "@/api/schools";
4+import type { School } from "@/api/client";
5+import { ModuleCatalogGrid } from "@/components/modules/module-catalog-grid";
6+import { formatModuleError } from "@/lib/module-labels";
7+import { Alert } from "@/components/ui/alert";
8+import { Button } from "@/components/ui/button";
9+import { Input } from "@/components/ui/input";
10+import { Label } from "@/components/ui/label";
11+import { SidePanel } from "@/components/ui/side-panel";
12+import { useT } from "@/stores/preferences-context";
13+
14+const SLUG_PATTERN = "[a-z0-9][a-z0-9-]{1,31}";
15+
16+/** Creates a school with its first admin and, optionally, a hand-picked module set. */
17+export function CreateSchoolPanel(props: { open: boolean; onOpenChange: (open: boolean) => void; onCreated: (school: School) => void }) {
18+ const t = useT();
19+ const [catalog] = createResource(() => props.open || undefined, () => getModulesCatalog());
20+ const [slug, setSlug] = createSignal("");
21+ const [name, setName] = createSignal("");
22+ const [adminUsername, setAdminUsername] = createSignal("");
23+ const [adminPassword, setAdminPassword] = createSignal("");
24+ const [everything, setEverything] = createSignal(true);
25+ const [picked, setPicked] = createSignal<string[]>([]);
26+ const [error, setError] = createSignal("");
27+ const [pending, setPending] = createSignal(false);
28+
29+ const reset = () => {
30+ setSlug("");
31+ setName("");
32+ setAdminUsername("");
33+ setAdminPassword("");
34+ setEverything(true);
35+ setPicked([]);
36+ setError("");
37+ };
38+
39+ const packageModules = (pkg: string) => catalog()?.packages.find((entry) => entry.package === pkg)?.modules ?? [];
40+
41+ const submit = async (event: SubmitEvent) => {
42+ event.preventDefault();
43+ setError("");
44+ setPending(true);
45+ try {
46+ const school = await postSchool({
47+ slug: slug().trim(),
48+ name: name().trim(),
49+ admin_username: adminUsername().trim(),
50+ admin_password: adminPassword(),
51+ // Omitted sells the whole catalog; an explicit list is checked for
52+ // missing dependencies before anything is created (409).
53+ modules: everything() ? undefined : picked(),
54+ });
55+ reset();
56+ props.onCreated(school);
57+ } catch (err) {
58+ setError(formatModuleError(err, t));
59+ } finally {
60+ setPending(false);
61+ }
62+ };
63+
64+ return (
65+ <SidePanel
66+ size="wide"
67+ open={props.open}
68+ onOpenChange={(open) => {
69+ props.onOpenChange(open);
70+ if (!open) reset();
71+ }}
72+ title={t("builder.createSchool")}
73+ description={t("builder.createSchoolHint")}
74+ >
75+ <form class="space-y-4" onSubmit={submit}>
76+ <Show when={error()}>
77+ <Alert variant="destructive">{error()}</Alert>
78+ </Show>
79+ <div class="grid gap-4 sm:grid-cols-2">
80+ <div class="space-y-1.5">
81+ <Label for="school-slug">{t("builder.slug")}</Label>
82+ <Input id="school-slug" class="rounded-lg" required pattern={SLUG_PATTERN} minlength={2} maxlength={32} value={slug()} onInput={(e) => setSlug(e.currentTarget.value.toLowerCase())} />
83+ <p class="text-xs text-text-subtle">{t("builder.slugHint")}</p>
84+ </div>
85+ <div class="space-y-1.5">
86+ <Label for="school-name">{t("builder.schoolName")}</Label>
87+ <Input id="school-name" class="rounded-lg" required maxlength={120} value={name()} onInput={(e) => setName(e.currentTarget.value)} />
88+ </div>
89+ <div class="space-y-1.5">
90+ <Label for="school-admin-username">{t("builder.adminUsername")}</Label>
91+ <Input id="school-admin-username" class="rounded-lg" required minlength={3} maxlength={32} autocomplete="off" value={adminUsername()} onInput={(e) => setAdminUsername(e.currentTarget.value)} />
92+ </div>
93+ <div class="space-y-1.5">
94+ <Label for="school-admin-password">{t("builder.adminPassword")}</Label>
95+ <Input id="school-admin-password" class="rounded-lg" type="password" required minlength={6} maxlength={128} autocomplete="new-password" value={adminPassword()} onInput={(e) => setAdminPassword(e.currentTarget.value)} />
96+ </div>
97+ </div>
98+ <label class="flex items-center gap-2 text-sm">
99+ <input type="checkbox" checked={everything()} onChange={(e) => setEverything(e.currentTarget.checked)} />
100+ {t("builder.sellEverything")}
101+ </label>
102+ <Show when={!everything() && catalog()}>
103+ {(value) => (
104+ <ModuleCatalogGrid
105+ stacked
106+ catalog={value()}
107+ enabled={picked()}
108+ onToggle={(module, next) => setPicked((current) => (next ? [...current, module] : current.filter((name) => name !== module)))}
109+ onTogglePackage={(pkg, next) =>
110+ setPicked((current) => {
111+ const modules = packageModules(pkg);
112+ return next ? [...new Set([...current, ...modules])] : current.filter((name) => !modules.includes(name));
113+ })
114+ }
115+ />
116+ )}
117+ </Show>
118+ <div class="flex flex-wrap items-center gap-2">
119+ <Button type="button" variant="outline" class="h-10 rounded-lg" onClick={() => props.onOpenChange(false)}>
120+ {t("common.cancel")}
121+ </Button>
122+ <Button type="submit" class="h-10 rounded-lg" disabled={pending()}>
123+ {t("common.create")}
124+ </Button>
125+ </div>
126+ </form>
127+ </SidePanel>
128+ );
129+}
src/components/builder/school-admin-access-panel.tsxadded+95 -0
@@ -0,0 +1,95 @@
1+import { Show, createSignal } from "solid-js";
2+import { formatApiError } from "@/api/client";
3+import { postSchoolAdminPassword, postSchoolEnter } from "@/api/schools";
4+import { Alert } from "@/components/ui/alert";
5+import { Button } from "@/components/ui/button";
6+import { Input } from "@/components/ui/input";
7+import { Label } from "@/components/ui/label";
8+import { SidePanel } from "@/components/ui/side-panel";
9+import { useT } from "@/stores/preferences-context";
10+
11+export type AdminAccessMode = "enter" | "password";
12+
13+/**
14+ * The two support doors into a school, both naming one of its admins:
15+ * `enter` swaps the builder cookie for that admin's session, `password`
16+ * re-keys the admin and revokes every session it held.
17+ */
18+export function SchoolAdminAccessPanel(props: {
19+ slug: string;
20+ mode: AdminAccessMode | null;
21+ onClose: () => void;
22+ onEntered: () => void;
23+ onPasswordReset: () => void;
24+}) {
25+ const t = useT();
26+ const [username, setUsername] = createSignal("");
27+ const [password, setPassword] = createSignal("");
28+ const [error, setError] = createSignal("");
29+ const [pending, setPending] = createSignal(false);
30+
31+ const reset = () => {
32+ setUsername("");
33+ setPassword("");
34+ setError("");
35+ };
36+
37+ const submit = async (event: SubmitEvent) => {
38+ event.preventDefault();
39+ setError("");
40+ setPending(true);
41+ try {
42+ if (props.mode === "enter") {
43+ await postSchoolEnter(props.slug, { username: username().trim() });
44+ reset();
45+ props.onEntered();
46+ } else {
47+ await postSchoolAdminPassword(props.slug, { username: username().trim(), password: password() });
48+ reset();
49+ props.onPasswordReset();
50+ }
51+ } catch (err) {
52+ setError(formatApiError(err));
53+ } finally {
54+ setPending(false);
55+ }
56+ };
57+
58+ return (
59+ <SidePanel
60+ open={props.mode != null}
61+ onOpenChange={(open) => {
62+ if (!open) {
63+ reset();
64+ props.onClose();
65+ }
66+ }}
67+ title={props.mode === "enter" ? t("builder.enterSchool") : t("builder.resetAdminPassword")}
68+ description={props.mode === "enter" ? t("builder.enterSchoolHint") : t("builder.resetAdminPasswordHint")}
69+ >
70+ <form class="space-y-4" onSubmit={submit}>
71+ <Show when={error()}>
72+ <Alert variant="destructive">{error()}</Alert>
73+ </Show>
74+ <div class="space-y-1.5">
75+ <Label for="school-access-username">{t("builder.adminUsername")}</Label>
76+ <Input id="school-access-username" class="rounded-lg" required minlength={3} maxlength={32} autocomplete="off" value={username()} onInput={(e) => setUsername(e.currentTarget.value)} />
77+ </div>
78+ <Show when={props.mode === "password"}>
79+ <div class="space-y-1.5">
80+ <Label for="school-access-password">{t("builder.newPassword")}</Label>
81+ <Input id="school-access-password" class="rounded-lg" type="password" required minlength={6} maxlength={128} autocomplete="new-password" value={password()} onInput={(e) => setPassword(e.currentTarget.value)} />
82+ </div>
83+ </Show>
84+ <div class="flex flex-wrap items-center gap-2">
85+ <Button type="button" variant="outline" class="h-10 rounded-lg" onClick={props.onClose}>
86+ {t("common.cancel")}
87+ </Button>
88+ <Button type="submit" class="h-10 rounded-lg" disabled={pending()}>
89+ {props.mode === "enter" ? t("builder.enterSchool") : t("builder.resetAdminPassword")}
90+ </Button>
91+ </div>
92+ </form>
93+ </SidePanel>
94+ );
95+}
src/components/builder/school-status-badge.tsxadded+12 -0
@@ -0,0 +1,12 @@
1+import type { SchoolStatus } from "@/api/client";
2+import { Badge } from "@/components/ui/badge";
3+import { useT } from "@/stores/preferences-context";
4+
5+export function SchoolStatusBadge(props: { status: SchoolStatus }) {
6+ const t = useT();
7+ return (
8+ <Badge variant={props.status === "active" ? "success" : "warning"} class="rounded-full">
9+ {props.status === "active" ? t("builder.statusActive") : t("builder.statusSuspended")}
10+ </Badge>
11+ );
12+}
src/components/layout/nav-items.test.tsmodified+64 -16
@@ -16,7 +16,7 @@ test("invalid role destinations stay hidden", () => {
1616 expect(visibleNavItems("parent").map((item) => item.to)).not.toContain("/management/staff-work");
1717 });
1818
19-test("admin's sidebar mirrors the Figma Operasyon / Yapay zekâ / Kurum tree", () => {
19+test("admin's sidebar keeps the Figma Operasyon / Yapay zekâ / Kurum tree plus every backed page", () => {
2020 expect(
2121 visibleNavGroups("admin").map((group) => ({
2222 id: group.id,
@@ -29,10 +29,20 @@ test("admin's sidebar mirrors the Figma Operasyon / Yapay zekâ / Kurum tree", (
2929 "students-roster",
3030 "teachers-roster",
3131 "class-groups",
32+ "courses",
33+ "terms",
3234 "schedule",
35+ "events",
3336 "student-attendance",
37+ "student-marks",
38+ "student-pomodoros",
39+ "homework",
3440 "exams",
3541 "question-bank",
42+ "questions",
43+ "notes",
44+ "whiteboards",
45+ "appointments",
3646 "mock-exams",
3747 "optical-reading",
3848 "payments-collection",
@@ -41,46 +51,62 @@ test("admin's sidebar mirrors the Figma Operasyon / Yapay zekâ / Kurum tree", (
4151 { id: "ai", items: ["hezarfen-zeka", "celebi", "sound-studio"] },
4252 {
4353 id: "institution",
44- items: ["reports", "license-modules", "users", "data-protection", "school-meals", "staff-work", "settings"],
54+ items: ["reports", "license-modules", "users", "data-protection", "school-meals", "staff-work", "work", "settings"],
4555 },
4656 ]);
4757 });
4858
4959 test("manager sees the same admin tree minus the admin-only entries", () => {
5060 const institution = visibleNavGroups("manager").find((group) => group.id === "institution");
51- expect(institution?.items.map((item) => item.id)).toEqual(["reports", "school-meals", "staff-work", "settings"]);
61+ expect(institution?.items.map((item) => item.id)).toEqual(["reports", "school-meals", "staff-work", "work", "settings"]);
5262 expect(institution?.items.map((item) => item.id)).not.toContain("license-modules");
5363 expect(institution?.items.map((item) => item.id)).not.toContain("users");
5464 expect(institution?.items.map((item) => item.id)).not.toContain("data-protection");
5565 });
5666
57-test("teacher's sidebar mirrors the Figma Sınıfım / Yapay zekâ / Diğer tree", () => {
67+test("teacher's sidebar keeps the Figma Sınıfım / Yapay zekâ / Diğer tree plus every backed page", () => {
5868 expect(
5969 visibleNavGroups("teacher").map((group) => ({
6070 id: group.id,
6171 items: group.items.map((item) => item.id),
6272 })),
6373 ).toEqual([
64- { id: "my-classroom", items: ["my-classes", "my-schedule", "student-attendance", "homework", "exams", "whiteboards"] },
74+ {
75+ id: "my-classroom",
76+ items: [
77+ "my-classes",
78+ "my-schedule",
79+ "courses",
80+ "student-attendance",
81+ "student-marks",
82+ "student-pomodoros",
83+ "homework",
84+ "exams",
85+ "question-bank",
86+ "questions",
87+ "notes",
88+ "whiteboards",
89+ ],
90+ },
6591 { id: "ai", items: ["student-analysis", "pending-approvals", "question-generation", "sound-studio"] },
66- { id: "other", items: ["parent-communication", "work", "settings-teacher"] },
92+ { id: "other", items: ["parent-communication", "appointments", "events", "meals", "work", "settings-teacher"] },
6793 ]);
6894 });
6995
70-test("student's sidebar mirrors the Figma Çalışma / Yapay zekâ / Diğer tree", () => {
96+test("student's sidebar keeps the Figma Çalışma / Yapay zekâ / Diğer tree plus every backed page", () => {
7197 expect(
7298 visibleNavGroups("student").map((group) => ({
7399 id: group.id,
74100 items: group.items.map((item) => item.id),
75101 })),
76102 ).toEqual([
77- { id: "study", items: ["study-plan", "topic-mastery", "exam-results", "my-homework", "whiteboards", "pomodoro"] },
103+ { id: "study", items: ["study-plan", "topic-mastery", "exam-results", "my-homework", "courses", "notes", "questions", "whiteboards", "pomodoro"] },
78104 { id: "ai", items: ["celebi", "sound-studio"] },
79- { id: "other", items: ["calendar", "settings-student"] },
105+ { id: "other", items: ["calendar", "events", "messages", "appointments", "meals", "settings-student"] },
80106 ]);
81107 });
82108
83-test("parent's sidebar mirrors the Figma Öğrencim / Kurum tree", () => {
109+test("parent's sidebar keeps the Figma Öğrencim / Kurum tree plus every backed page", () => {
84110 expect(
85111 visibleNavGroups("parent").map((group) => ({
86112 id: group.id,
@@ -88,18 +114,40 @@ test("parent's sidebar mirrors the Figma Öğrencim / Kurum tree", () => {
88114 })),
89115 ).toEqual([
90116 { id: "my-student", items: ["progress-report", "absence", "child-exam-results", "child-study-plan"] },
91- { id: "institution", items: ["payment-statement", "appointments", "settings-parent"] },
117+ { id: "institution", items: ["payment-statement", "appointments", "messages", "calendar", "events", "meals", "settings-parent"] },
92118 ]);
93119 });
94120
95-test("appointments is a parent-only sidebar entry, matching the Figma parent screen", () => {
96- expect(visibleNavGroups("parent").flatMap((g) => g.items).map((i) => i.to)).toContain("/appointments");
97- for (const role of ["student", "teacher", "manager", "admin"] as const) {
98- const paths = [...primaryNavItems(role).map((i) => i.to), ...visibleNavGroups(role).flatMap((g) => g.items.map((i) => i.to))];
99- expect(paths).not.toContain("/appointments");
121+test("appointments and meals are reachable from every role's sidebar", () => {
122+ for (const role of ["student", "parent", "teacher", "manager", "admin"] as const) {
123+ const paths = visibleNavGroups(role).flatMap((g) => g.items.map((i) => i.to));
124+ expect(paths).toContain("/appointments");
125+ expect(paths).toContain("/meals");
100126 }
101127 });
102128
129+test("parent's child entries open the progress page on their own tab, not a placeholder", () => {
130+ const items = visibleNavGroups("parent").flatMap((g) => g.items);
131+ expect(items.filter((i) => i.soon).map((i) => i.id)).toEqual([]);
132+ expect(routeNavItem("/students/attendance", "parent")?.id).toBe("absence");
133+ expect(routeNavItem("/students/exams", "parent")?.id).toBe("child-exam-results");
134+ expect(routeNavItem("/students/study", "parent")?.id).toBe("child-study-plan");
135+ expect(routeNavItem("/students", "parent")?.id).toBe("progress-report");
136+});
137+
138+test("license modules is a real admin page and the work log includes admin", () => {
139+ const admin = visibleNavGroups("admin").flatMap((g) => g.items);
140+ const licenseModules = admin.find((i) => i.id === "license-modules");
141+ expect(licenseModules?.to).toBe("/management/modules");
142+ expect(licenseModules?.soon).toBeFalsy();
143+ expect(admin.map((i) => i.to)).toContain("/work");
144+ expect(admin.filter((i) => i.id.endsWith("-roster")).map((i) => [i.to, i.soon ?? false])).toEqual([
145+ ["/management/students", false],
146+ ["/management/teachers", false],
147+ ]);
148+ expect(visibleNavGroups("manager").flatMap((g) => g.items).map((i) => i.id)).not.toContain("license-modules");
149+});
150+
103151 test("entries with no backend yet are flagged soon and route to the shared placeholder", () => {
104152 const hezarfenZeka = visibleNavGroups("admin")
105153 .flatMap((g) => g.items)
src/components/layout/nav-items.tsmodified+41 -7
@@ -2,8 +2,10 @@ import type { Component } from "solid-js";
22 import type { Role } from "@/api/client";
33 import {
44 IconArchive,
5+ IconBook,
56 IconBotSquare,
67 IconBriefcase,
8+ IconCalendar,
79 IconCalendarDays,
810 IconChalkboardTeacher,
911 IconChart,
@@ -16,6 +18,7 @@ import {
1618 IconHomework,
1719 IconHome,
1820 IconMessage,
21+ IconNote,
1922 IconPackage,
2023 IconReportAnalytics,
2124 IconScan,
@@ -94,13 +97,23 @@ const ADMIN_GROUPS: NavGroup[] = [
9497 labelKey: "nav.group.operations",
9598 Icon: IconSchool,
9699 items: [
97- { id: "students-roster", to: "/coming-soon/ogrenciler", labelKey: "nav.studentsRoster", Icon: IconUsers, soon: true, minRole: "manager" },
98- { id: "teachers-roster", to: "/coming-soon/ogretmenler", labelKey: "nav.teachersRoster", Icon: IconChalkboardTeacher, soon: true, minRole: "manager" },
100+ { id: "students-roster", to: "/management/students", labelKey: "nav.studentsRoster", Icon: IconUsers, minRole: "manager" },
101+ { id: "teachers-roster", to: "/management/teachers", labelKey: "nav.teachersRoster", Icon: IconChalkboardTeacher, minRole: "manager" },
99102 { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconSchool, minRole: "teacher" },
103+ { id: "courses", to: "/courses", labelKey: "nav.courses", Icon: IconBook, module: "courses" },
104+ { id: "terms", to: "/management/terms", labelKey: "nav.terms", Icon: IconCalendar, minRole: "manager" },
100105 { id: "schedule", to: "/calendar", labelKey: "nav.schedule", Icon: IconCalendarDays, minRole: "manager" },
106+ { id: "events", to: "/events", labelKey: "nav.events", Icon: IconCalendarDays, module: "events" },
101107 { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, minRole: "teacher", module: "attendance" },
108+ { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher", module: "marks" },
109+ { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, minRole: "teacher", module: "pomodoro" },
110+ { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework, module: "homework" },
102111 { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, minRole: "teacher", module: "exams" },
103112 { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, minRole: "teacher", module: "bank_questions" },
113+ { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" },
114+ { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" },
115+ { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" },
116+ { id: "appointments", to: "/appointments", labelKey: "nav.appointments", Icon: IconClock, module: "appointments" },
104117 { id: "mock-exams", to: "/coming-soon/deneme-sinavlari", labelKey: "nav.mockExams", Icon: IconTarget, soon: true, minRole: "manager" },
105118 { id: "optical-reading", to: "/coming-soon/optik-okuma", labelKey: "nav.opticalReading", Icon: IconScan, soon: true, minRole: "manager" },
106119 { id: "payments-collection", to: "/management/payments", labelKey: "nav.payments", Icon: IconReportAnalytics, minRole: "manager", module: "payments" },
@@ -122,11 +135,12 @@ const ADMIN_GROUPS: NavGroup[] = [
122135 Icon: IconUserCog,
123136 items: [
124137 { id: "reports", to: "/coming-soon/raporlar", labelKey: "nav.reports", Icon: IconChartPie, soon: true, minRole: "manager" },
125- { id: "license-modules", to: "/coming-soon/lisans-modulleri", labelKey: "nav.licenseModules", Icon: IconPackage, soon: true, minRole: "admin" },
138+ { id: "license-modules", to: "/management/modules", labelKey: "nav.licenseModules", Icon: IconPackage, minRole: "admin" },
126139 { id: "users", to: "/admin/users", labelKey: "nav.users", Icon: IconUserCog, minRole: "admin" },
127140 { id: "data-protection", to: "/coming-soon/kvkk-denetim", labelKey: "nav.dataProtection", Icon: IconShieldCheck, soon: true, minRole: "admin" },
128141 { id: "school-meals", to: "/meals", labelKey: "nav.schoolMeals", Icon: IconUtensils, minRole: "manager", module: "meals" },
129142 { id: "staff-work", to: "/management/staff-work", labelKey: "nav.staffWork", Icon: IconBriefcase, minRole: "manager", module: "work" },
143+ { id: "work", to: "/work", labelKey: "nav.work", Icon: IconClock, minRole: "teacher", module: "work" },
130144 { id: "settings", to: "/management/settings", labelKey: "nav.settings", Icon: IconSettings, minRole: "manager" },
131145 ],
132146 },
@@ -140,9 +154,15 @@ const TEACHER_GROUPS: NavGroup[] = [
140154 items: [
141155 { id: "my-classes", to: "/management/classes", labelKey: "nav.myClasses", Icon: IconSchool },
142156 { id: "my-schedule", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays },
157+ { id: "courses", to: "/courses", labelKey: "nav.courses", Icon: IconBook, module: "courses" },
143158 { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, module: "attendance" },
159+ { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, module: "marks" },
160+ { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, module: "pomodoro" },
144161 { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework, module: "homework" },
145162 { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, module: "exams" },
163+ { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, module: "bank_questions" },
164+ { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" },
165+ { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" },
146166 { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" },
147167 ],
148168 },
@@ -163,7 +183,10 @@ const TEACHER_GROUPS: NavGroup[] = [
163183 Icon: IconMessage,
164184 items: [
165185 { id: "parent-communication", to: "/messages", labelKey: "nav.parentCommunication", Icon: IconMessage, module: "messages" },
166- { id: "work", to: "/work", labelKey: "nav.work", Icon: IconClock, minRole: "teacher", maxRole: "manager", module: "work" },
186+ { id: "appointments", to: "/appointments", labelKey: "nav.appointments", Icon: IconClock, module: "appointments" },
187+ { id: "events", to: "/events", labelKey: "nav.events", Icon: IconCalendarDays, module: "events" },
188+ { id: "meals", to: "/meals", labelKey: "nav.meals", Icon: IconUtensils, module: "meals" },
189+ { id: "work", to: "/work", labelKey: "nav.work", Icon: IconBriefcase, minRole: "teacher", module: "work" },
167190 settingsAction("settings-teacher"),
168191 ],
169192 },
@@ -179,6 +202,9 @@ const STUDENT_GROUPS: NavGroup[] = [
179202 { id: "topic-mastery", to: "/marks", labelKey: "nav.topicMastery", Icon: IconChart, exactRole: "student", module: "marks" },
180203 { id: "exam-results", to: "/exams", labelKey: "nav.examResults", Icon: IconExam, module: "exams" },
181204 { id: "my-homework", to: "/homework", labelKey: "nav.myHomework", Icon: IconHomework, module: "homework" },
205+ { id: "courses", to: "/courses", labelKey: "nav.courses", Icon: IconBook, module: "courses" },
206+ { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" },
207+ { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" },
182208 { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" },
183209 { id: "pomodoro", to: "/pomodoro", labelKey: "nav.pomodoro", Icon: IconClock, exactRole: "student", module: "pomodoro" },
184210 ],
@@ -195,6 +221,10 @@ const STUDENT_GROUPS: NavGroup[] = [
195221 Icon: IconCalendarDays,
196222 items: [
197223 { id: "calendar", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays },
224+ { id: "events", to: "/events", labelKey: "nav.events", Icon: IconCalendarDays, module: "events" },
225+ { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage, module: "messages" },
226+ { id: "appointments", to: "/appointments", labelKey: "nav.appointments", Icon: IconClock, module: "appointments" },
227+ { id: "meals", to: "/meals", labelKey: "nav.meals", Icon: IconUtensils, module: "meals" },
198228 settingsAction("settings-student"),
199229 ],
200230 },
@@ -207,9 +237,9 @@ const PARENT_GROUPS: NavGroup[] = [
207237 Icon: IconUsers,
208238 items: [
209239 { id: "progress-report", to: "/students", labelKey: "nav.progressReport", Icon: IconReportAnalytics, exactRole: "parent" },
210- { id: "absence", to: "/coming-soon/devamsizlik", labelKey: "nav.absence", Icon: IconClipboardCheck, soon: true },
211- { id: "child-exam-results", to: "/coming-soon/sinav-sonuclari-veli", labelKey: "nav.childExamResults", Icon: IconExam, soon: true },
212- { id: "child-study-plan", to: "/coming-soon/calisma-plani", labelKey: "nav.childStudyPlan", Icon: IconClock, soon: true },
240+ { id: "absence", to: "/students/attendance", labelKey: "nav.absence", Icon: IconClipboardCheck, exactRole: "parent", module: "attendance" },
241+ { id: "child-exam-results", to: "/students/exams", labelKey: "nav.childExamResults", Icon: IconExam, exactRole: "parent", module: "marks" },
242+ { id: "child-study-plan", to: "/students/study", labelKey: "nav.childStudyPlan", Icon: IconClock, exactRole: "parent", module: "pomodoro" },
213243 ],
214244 },
215245 {
@@ -219,6 +249,10 @@ const PARENT_GROUPS: NavGroup[] = [
219249 items: [
220250 { id: "payment-statement", to: "/payments", labelKey: "nav.payments", Icon: IconReportAnalytics, exactRole: "parent", module: "payments" },
221251 { id: "appointments", to: "/appointments", labelKey: "nav.appointmentsAndCommunication", Icon: IconClock, exactRole: "parent", module: "appointments" },
252+ { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage, module: "messages" },
253+ { id: "calendar", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays },
254+ { id: "events", to: "/events", labelKey: "nav.events", Icon: IconCalendarDays, module: "events" },
255+ { id: "meals", to: "/meals", labelKey: "nav.meals", Icon: IconUtensils, module: "meals" },
222256 settingsAction("settings-parent"),
223257 ],
224258 },
src/components/modules/module-catalog-grid.tsxadded+112 -0
@@ -0,0 +1,112 @@
1+import { For, Show } from "solid-js";
2+import type { ModuleCatalog } from "@/api/client";
3+import { Badge } from "@/components/ui/badge";
4+import { moduleLabel, packageLabel } from "@/lib/module-labels";
5+import { useT } from "@/stores/preferences-context";
6+
7+/**
8+ * The deployment catalog grouped by package, each module marked on/off for one
9+ * school. Read-only without `onToggle` (a school admin's view); with it, every
10+ * module row becomes a switch (the builder's switchboard).
11+ */
12+export function ModuleCatalogGrid(props: {
13+ catalog: ModuleCatalog;
14+ enabled: readonly string[];
15+ onToggle?: (module: string, next: boolean) => void;
16+ onTogglePackage?: (pkg: string, next: boolean) => void;
17+ disabled?: boolean;
18+ /** One column regardless of viewport — for narrow hosts like a SidePanel. */
19+ stacked?: boolean;
20+}) {
21+ const t = useT();
22+ const isOn = (module: string) => props.enabled.includes(module);
23+ const requiresOf = (module: string) => props.catalog.modules.find((entry) => entry.module === module)?.requires ?? [];
24+
25+ return (
26+ <div class={props.stacked ? "grid gap-4" : "grid gap-4 md:grid-cols-2"}>
27+ <For each={props.catalog.packages}>
28+ {(pkg) => {
29+ const onCount = () => pkg.modules.filter(isOn).length;
30+ return (
31+ <section class="data-shell space-y-3 p-4">
32+ <div class="flex items-center justify-between gap-3">
33+ <div class="min-w-0">
34+ <h2 class="truncate font-semibold text-text-strong">{packageLabel(pkg.package, t)}</h2>
35+ <p class="text-xs text-text-subtle">{t("modules.enabledCount", { on: String(onCount()), total: String(pkg.modules.length) })}</p>
36+ </div>
37+ <Show when={props.onTogglePackage}>
38+ {(toggle) => (
39+ <div class="flex shrink-0 gap-2">
40+ <button
41+ type="button"
42+ class="rounded-md px-2 py-1 text-xs font-medium text-primary hover:bg-muted/60 disabled:opacity-50"
43+ disabled={props.disabled || onCount() === pkg.modules.length}
44+ onClick={() => toggle()(pkg.package, true)}
45+ >
46+ {t("modules.enableAll")}
47+ </button>
48+ <button
49+ type="button"
50+ class="rounded-md px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/60 disabled:opacity-50"
51+ disabled={props.disabled || onCount() === 0}
52+ onClick={() => toggle()(pkg.package, false)}
53+ >
54+ {t("modules.disableAll")}
55+ </button>
56+ </div>
57+ )}
58+ </Show>
59+ </div>
60+ <ul class="divide-y divide-border-hairline">
61+ <For each={pkg.modules}>
62+ {(module) => (
63+ <li class="flex items-center justify-between gap-3 py-2">
64+ <div class="min-w-0">
65+ <p class="truncate text-sm font-medium text-foreground">{moduleLabel(module, t)}</p>
66+ <Show when={requiresOf(module).length > 0}>
67+ <p class="truncate text-xs text-text-subtle">
68+ {t("modules.requires")}: {requiresOf(module).map((name) => moduleLabel(name, t)).join(", ")}
69+ </p>
70+ </Show>
71+ </div>
72+ <Show
73+ when={props.onToggle}
74+ fallback={
75+ <Badge variant={isOn(module) ? "success" : "secondary"} class="shrink-0 rounded-full">
76+ {isOn(module) ? t("modules.on") : t("modules.off")}
77+ </Badge>
78+ }
79+ >
80+ {(toggle) => (
81+ <label class="relative shrink-0 cursor-pointer" title={moduleLabel(module, t)}>
82+ <input
83+ type="checkbox"
84+ class="peer sr-only"
85+ aria-label={moduleLabel(module, t)}
86+ checked={isOn(module)}
87+ disabled={props.disabled}
88+ onChange={(event) => {
89+ const next = event.currentTarget.checked;
90+ // The switch shows `enabled`, not the click: snap back
91+ // now and let a successful write move it, so a refused
92+ // (409) toggle never leaves it in the wrong position.
93+ event.currentTarget.checked = isOn(module);
94+ toggle()(module, next);
95+ }}
96+ />
97+ <span class="block h-6 w-10 rounded-full bg-input ring-1 ring-inset ring-black/5 transition-colors peer-checked:bg-primary peer-disabled:opacity-60 peer-focus-visible:ring-2 peer-focus-visible:ring-ring dark:ring-white/10" />
98+ <span class="pointer-events-none absolute left-1 top-1 h-4 w-4 rounded-full bg-white shadow-sm transition-transform peer-checked:translate-x-4" />
99+ </label>
100+ )}
101+ </Show>
102+ </li>
103+ )}
104+ </For>
105+ </ul>
106+ </section>
107+ );
108+ }}
109+ </For>
110+ </div>
111+ );
112+}
src/components/pomodoro/pomodoro-log-view.tsxadded+39 -0
@@ -0,0 +1,39 @@
1+import { createMemo } from "solid-js";
2+import type { ColumnDef } from "@tanstack/solid-table";
3+import type { PomodoroLog, PomodoroSession } from "@/api/client";
4+import { DataTable } from "@/components/ui/data-table";
5+import { formatDateTime, formatDurationClock } from "@/lib/format";
6+import { usePreferences, useT } from "@/stores/preferences-context";
7+
8+/** A student's pomodoro log: lifetime focus total over the paged stint list. */
9+export function PomodoroLogView(props: { log: PomodoroLog }) {
10+ const t = useT();
11+ const { locale } = usePreferences();
12+ const columns = createMemo<ColumnDef<PomodoroSession>[]>(() => [
13+ {
14+ accessorKey: "started_at",
15+ header: t("pomodoro.startedAt"),
16+ cell: (cell) => <span class="mono whitespace-nowrap">{formatDateTime(cell.row.original.started_at, locale())}</span>,
17+ },
18+ {
19+ accessorKey: "finished_at",
20+ header: t("pomodoro.finishedAt"),
21+ cell: (cell) => <span class="mono whitespace-nowrap">{formatDateTime(cell.row.original.finished_at, locale())}</span>,
22+ },
23+ {
24+ accessorKey: "duration_ms",
25+ header: t("pomodoro.duration"),
26+ cell: (cell) => <span class="mono tabular-nums">{formatDurationClock(cell.row.original.duration_ms)}</span>,
27+ },
28+ ]);
29+
30+ return (
31+ <div class="space-y-4">
32+ <div class="detail-metric-card">
33+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("pomodoro.total")}</p>
34+ <p class="mono mt-2 text-3xl font-semibold tabular-nums">{formatDurationClock(props.log.total_focus_ms)}</p>
35+ </div>
36+ <DataTable columns={columns()} data={props.log.items} empty={t("pomodoro.empty")} enablePagination pageSize={10} />
37+ </div>
38+ );
39+}
src/components/users/roster-person-cell.tsxadded+16 -0
@@ -0,0 +1,16 @@
1+import type { PersonRef } from "@/api/client";
2+import { UserAvatar } from "@/components/users/user-avatar";
3+import { personLabel } from "@/lib/person";
4+
5+/** Avatar initials, display name and @username — the first column of the ADM-02/ADM-08 rosters. */
6+export function RosterPersonCell(props: { person: PersonRef }) {
7+ return (
8+ <div class="flex min-w-0 items-center gap-2.5">
9+ <UserAvatar userId={props.person.id} name={personLabel(props.person)} hasAvatar={false} size="sm" />
10+ <div class="min-w-0">
11+ <p class="truncate text-sm font-medium text-text-strong">{personLabel(props.person)}</p>
12+ <p class="truncate text-xs text-text-subtle">@{props.person.username}</p>
13+ </div>
14+ </div>
15+ );
16+}
src/i18n/messages.tsmodified+351 -0
@@ -305,6 +305,123 @@ export type MessageKey =
305305 | "comingSoon.description"
306306 | "comingSoon.emptyTitle"
307307 | "comingSoon.emptyDescription"
308+ | "roster.student"
309+ | "roster.teacher"
310+ | "roster.class"
311+ | "roster.classAll"
312+ | "roster.term"
313+ | "roster.termAll"
314+ | "roster.mastery"
315+ | "roster.attendance"
316+ | "roster.planAdherence"
317+ | "roster.status"
318+ | "roster.branch"
319+ | "roster.weeklyLessons"
320+ | "roster.suggestionAcceptance"
321+ | "roster.tabAll"
322+ | "roster.tabActive"
323+ | "roster.tabNew"
324+ | "roster.tabAtRisk"
325+ | "roster.tabLeft"
326+ | "roster.tabPermanent"
327+ | "roster.tabContract"
328+ | "roster.tabAdvisor"
329+ | "roster.import"
330+ | "roster.addStudent"
331+ | "roster.addTeacher"
332+ | "roster.studentsSubtitle"
333+ | "roster.teachersSubtitle"
334+ | "roster.searchStudents"
335+ | "roster.searchTeachers"
336+ | "roster.noTeachers"
337+ | "builder.console"
338+ | "builder.logout"
339+ | "builder.loginTitle"
340+ | "builder.loginSubtitle"
341+ | "builder.backToSchoolLogin"
342+ | "builder.operatorLogin"
343+ | "builder.statusActive"
344+ | "builder.statusSuspended"
345+ | "builder.createSchool"
346+ | "builder.createSchoolHint"
347+ | "builder.slug"
348+ | "builder.slugHint"
349+ | "builder.schoolName"
350+ | "builder.adminUsername"
351+ | "builder.adminPassword"
352+ | "builder.sellEverything"
353+ | "builder.schools"
354+ | "builder.schoolsSubtitle"
355+ | "builder.status"
356+ | "builder.modules"
357+ | "builder.createdAt"
358+ | "builder.suspend"
359+ | "builder.activate"
360+ | "builder.noSchools"
361+ | "builder.deleteSchool"
362+ | "builder.deleteSchoolWarning"
363+ | "builder.enterSchool"
364+ | "builder.enterSchoolHint"
365+ | "builder.enterSuspendedHint"
366+ | "builder.resetAdminPassword"
367+ | "builder.resetAdminPasswordHint"
368+ | "builder.newPassword"
369+ | "builder.passwordResetDone"
370+ | "builder.modulesHint"
371+ | "builder.editSchool"
372+ | "builder.editSchoolHint"
373+ | "builder.suspendHint"
374+ | "modules.subtitle"
375+ | "modules.readOnlyHint"
376+ | "modules.enabledCount"
377+ | "modules.enableAll"
378+ | "modules.disableAll"
379+ | "modules.requires"
380+ | "modules.on"
381+ | "modules.off"
382+ | "modules.module"
383+ | "modules.active"
384+ | "modules.unitPrice"
385+ | "modules.activeSeats"
386+ | "modules.annualAmount"
387+ | "modules.annualTotal"
388+ | "modules.tabOverview"
389+ | "modules.tabUsage"
390+ | "modules.tabInvoices"
391+ | "modules.tabContract"
392+ | "modules.downloadInvoices"
393+ | "modules.addLicense"
394+ | "modules.fullPackage"
395+ | "modules.customPackage"
396+ | "modules.renewal"
397+ | "modules.recentInvoices"
398+ | "modules.conflictRequires"
399+ | "modules.conflictRequiredBy"
400+ | "module.appointments"
401+ | "module.attendance"
402+ | "module.bank_questions"
403+ | "module.boards"
404+ | "module.chatbot"
405+ | "module.classes"
406+ | "module.course_notes"
407+ | "module.courses"
408+ | "module.events"
409+ | "module.exams"
410+ | "module.homework"
411+ | "module.marks"
412+ | "module.meals"
413+ | "module.messages"
414+ | "module.notes"
415+ | "module.payments"
416+ | "module.pomodoro"
417+ | "module.questions"
418+ | "module.sessions"
419+ | "module.subjects"
420+ | "module.work"
421+ | "package.academics"
422+ | "package.ai"
423+ | "package.communication"
424+ | "package.operations"
308425 | "nav.darkMode"
309426 | "rightPanel.messagesTitle"
310427 | "rightPanel.calendarTitle"
@@ -2015,6 +2132,123 @@ const en: Dict = {
20152132 "comingSoon.description": "This module is on its way — there is nothing to show here yet.",
20162133 "comingSoon.emptyTitle": "Not available yet",
20172134 "comingSoon.emptyDescription": "This part of Hezarfen is still being built. Check back soon.",
2135+ "roster.student": "Student",
2136+ "roster.teacher": "Teacher",
2137+ "roster.class": "Class",
2138+ "roster.classAll": "Class: All",
2139+ "roster.term": "Term",
2140+ "roster.termAll": "Term: All",
2141+ "roster.mastery": "Topic mastery",
2142+ "roster.attendance": "Attendance",
2143+ "roster.planAdherence": "Plan adherence",
2144+ "roster.status": "Status",
2145+ "roster.branch": "Branch",
2146+ "roster.weeklyLessons": "Weekly lessons",
2147+ "roster.suggestionAcceptance": "Suggestion acceptance",
2148+ "roster.tabAll": "All",
2149+ "roster.tabActive": "Active",
2150+ "roster.tabNew": "New enrolment",
2151+ "roster.tabAtRisk": "At risk",
2152+ "roster.tabLeft": "Left",
2153+ "roster.tabPermanent": "Permanent",
2154+ "roster.tabContract": "Contract",
2155+ "roster.tabAdvisor": "Advisor",
2156+ "roster.import": "Import",
2157+ "roster.addStudent": "Add student",
2158+ "roster.addTeacher": "Add teacher",
2159+ "roster.studentsSubtitle": "Every student in the school, with their class.",
2160+ "roster.teachersSubtitle": "Every teacher in the school and the classes they lead.",
2161+ "roster.searchStudents": "Search student name or username…",
2162+ "roster.searchTeachers": "Search teacher name or username…",
2163+ "roster.noTeachers": "No teachers yet.",
2164+ "builder.console": "Operator console",
2165+ "builder.logout": "Sign out",
2166+ "builder.loginTitle": "Operator sign-in",
2167+ "builder.loginSubtitle": "Manage the schools on this deployment.",
2168+ "builder.backToSchoolLogin": "Back to school sign-in",
2169+ "builder.operatorLogin": "Operator sign-in",
2170+ "builder.statusActive": "Active",
2171+ "builder.statusSuspended": "Suspended",
2172+ "builder.createSchool": "New school",
2173+ "builder.createSchoolHint": "Creates the school's database and its first admin in one step.",
2174+ "builder.slug": "School code",
2175+ "builder.slugHint": "Lowercase letters, digits and hyphens. Cannot be changed later.",
2176+ "builder.schoolName": "School name",
2177+ "builder.adminUsername": "Admin username",
2178+ "builder.adminPassword": "Admin password",
2179+ "builder.sellEverything": "Enable every module in the catalog",
2180+ "builder.schools": "Schools",
2181+ "builder.schoolsSubtitle": "Every school on this deployment",
2182+ "builder.status": "Status",
2183+ "builder.modules": "Modules",
2184+ "builder.createdAt": "Created",
2185+ "builder.suspend": "Suspend",
2186+ "builder.activate": "Activate",
2187+ "builder.noSchools": "No schools yet.",
2188+ "builder.deleteSchool": "Delete school",
2189+ "builder.deleteSchoolWarning": "All of this school's data and uploaded files are destroyed for good. This cannot be undone.",
2190+ "builder.enterSchool": "Enter school",
2191+ "builder.enterSchoolHint": "Signs this browser in as one of the school's admins for support. Your operator session ends.",
2192+ "builder.enterSuspendedHint": "A suspended school cannot be entered.",
2193+ "builder.resetAdminPassword": "Reset admin password",
2194+ "builder.resetAdminPasswordHint": "Sets a new password for an admin of this school and signs that account out everywhere.",
2195+ "builder.newPassword": "New password",
2196+ "builder.passwordResetDone": "Password reset. That admin's sessions were revoked.",
2197+ "builder.modulesHint": "Changes apply on the school's very next request.",
2198+ "builder.editSchool": "Edit school",
2199+ "builder.editSchoolHint": "Rename the school or change its status.",
2200+ "builder.suspendHint": "Suspension is immediate: every user of the school is refused, login included.",
2201+ "modules.subtitle": "Modular by design: the school has only the components it needs.",
2202+ "modules.readOnlyHint": "Modules are enabled or disabled by your Hezarfen provider.",
2203+ "modules.enabledCount": "{on} of {total} enabled",
2204+ "modules.enableAll": "Enable all",
2205+ "modules.disableAll": "Disable all",
2206+ "modules.requires": "Requires",
2207+ "modules.on": "On",
2208+ "modules.conflictRequires": "{module} needs {needed}, which is not enabled.",
2209+ "modules.conflictRequiredBy": "{module} cannot be turned off: {dependents} depend on it.",
2210+ "modules.module": "Module",
2211+ "modules.active": "Active",
2212+ "modules.unitPrice": "Unit price",
2213+ "modules.activeSeats": "Active seats",
2214+ "modules.annualAmount": "Annual amount",
2215+ "modules.annualTotal": "annual total",
2216+ "modules.tabOverview": "Overview",
2217+ "modules.tabUsage": "Usage",
2218+ "modules.tabInvoices": "Invoices",
2219+ "modules.tabContract": "Contract",
2220+ "modules.downloadInvoices": "Download invoices",
2221+ "modules.addLicense": "Add license",
2222+ "modules.fullPackage": "Full package",
2223+ "modules.customPackage": "Custom package",
2224+ "modules.renewal": "Renewal",
2225+ "modules.recentInvoices": "Recent invoices",
2226+ "modules.off": "Off",
2227+ "module.appointments": "Appointments",
2228+ "module.attendance": "Attendance",
2229+ "module.bank_questions": "Question bank",
2230+ "module.boards": "Board",
2231+ "module.chatbot": "Çelebi assistant",
2232+ "module.classes": "Classes",
2233+ "module.course_notes": "Course notes",
2234+ "module.courses": "Courses",
2235+ "module.events": "Events",
2236+ "module.exams": "Exams",
2237+ "module.homework": "Homework",
2238+ "module.marks": "Marks",
2239+ "module.meals": "Meals",
2240+ "module.messages": "Messages",
2241+ "module.notes": "Notebook",
2242+ "module.payments": "Payments",
2243+ "module.pomodoro": "Pomodoro",
2244+ "module.questions": "Question pool",
2245+ "module.sessions": "Lesson sessions",
2246+ "module.subjects": "Subjects",
2247+ "module.work": "Shift",
2248+ "package.academics": "Academics",
2249+ "package.ai": "AI",
2250+ "package.communication": "Communication",
2251+ "package.operations": "Operations",
20182252 "nav.darkMode": "Dark mode",
20192253 "parents.title": "My Students",
20202254 "parents.subtitle": "Review academic records for the students linked to your account.",
@@ -3713,6 +3947,123 @@ const tr: Dict = {
37133947 "comingSoon.description": "Bu modül hazırlanıyor — henüz gösterecek bir şey yok.",
37143948 "comingSoon.emptyTitle": "Henüz kullanıma açık değil",
37153949 "comingSoon.emptyDescription": "Hezarfen'in bu bölümü hâlâ hazırlanıyor. Yakında tekrar bakın.",
3950+ "roster.student": "Öğrenci",
3951+ "roster.teacher": "Öğretmen",
3952+ "roster.class": "Sınıf",
3953+ "roster.classAll": "Sınıf: Tümü",
3954+ "roster.term": "Dönem",
3955+ "roster.termAll": "Dönem: Tümü",
3956+ "roster.mastery": "Konu yetkinliği",
3957+ "roster.attendance": "Devam",
3958+ "roster.planAdherence": "Plan uyumu",
3959+ "roster.status": "Durum",
3960+ "roster.branch": "Branş",
3961+ "roster.weeklyLessons": "Haftalık ders",
3962+ "roster.suggestionAcceptance": "Öneri kabulü",
3963+ "roster.tabAll": "Tümü",
3964+ "roster.tabActive": "Aktif",
3965+ "roster.tabNew": "Yeni kayıt",
3966+ "roster.tabAtRisk": "Risk altında",
3967+ "roster.tabLeft": "Ayrılan",
3968+ "roster.tabPermanent": "Kadrolu",
3969+ "roster.tabContract": "Ücretli",
3970+ "roster.tabAdvisor": "Danışman",
3971+ "roster.import": "İçe aktar",
3972+ "roster.addStudent": "Öğrenci ekle",
3973+ "roster.addTeacher": "Öğretmen ekle",
3974+ "roster.studentsSubtitle": "Kurumdaki tüm öğrenciler, sınıflarıyla birlikte.",
3975+ "roster.teachersSubtitle": "Kurumdaki öğretmenler ve sınıf öğretmenliği yaptıkları sınıflar.",
3976+ "roster.searchStudents": "Öğrenci adı veya kullanıcı adı ara…",
3977+ "roster.searchTeachers": "Öğretmen adı veya kullanıcı adı ara…",
3978+ "roster.noTeachers": "Henüz öğretmen yok.",
3979+ "builder.console": "Operatör konsolu",
3980+ "builder.logout": "Çıkış yap",
3981+ "builder.loginTitle": "Operatör girişi",
3982+ "builder.loginSubtitle": "Bu kurulumdaki okulları yönet.",
3983+ "builder.backToSchoolLogin": "Okul girişine dön",
3984+ "builder.operatorLogin": "Operatör girişi",
3985+ "builder.statusActive": "Aktif",
3986+ "builder.statusSuspended": "Askıda",
3987+ "builder.createSchool": "Yeni okul",
3988+ "builder.createSchoolHint": "Okulun veritabanını ve ilk yöneticisini tek adımda oluşturur.",
3989+ "builder.slug": "Okul kodu",
3990+ "builder.slugHint": "Küçük harf, rakam ve tire. Sonradan değiştirilemez.",
3991+ "builder.schoolName": "Okul adı",
3992+ "builder.adminUsername": "Yönetici kullanıcı adı",
3993+ "builder.adminPassword": "Yönetici şifresi",
3994+ "builder.sellEverything": "Katalogdaki tüm modülleri aç",
3995+ "builder.schools": "Okullar",
3996+ "builder.schoolsSubtitle": "Bu kurulumdaki tüm okullar",
3997+ "builder.status": "Durum",
3998+ "builder.modules": "Modüller",
3999+ "builder.createdAt": "Oluşturulma",
4000+ "builder.suspend": "Askıya al",
4001+ "builder.activate": "Aktifleştir",
4002+ "builder.noSchools": "Henüz okul yok.",
4003+ "builder.deleteSchool": "Okulu sil",
4004+ "builder.deleteSchoolWarning": "Bu okulun tüm verileri ve yüklenen dosyaları kalıcı olarak silinir. Geri alınamaz.",
4005+ "builder.enterSchool": "Okula gir",
4006+ "builder.enterSchoolHint": "Destek için bu tarayıcıda okulun bir yöneticisi olarak oturum açar. Operatör oturumun kapanır.",
4007+ "builder.enterSuspendedHint": "Askıdaki bir okula girilemez.",
4008+ "builder.resetAdminPassword": "Yönetici şifresini sıfırla",
4009+ "builder.resetAdminPasswordHint": "Bu okulun bir yöneticisine yeni şifre verir ve o hesabın tüm oturumlarını kapatır.",
4010+ "builder.newPassword": "Yeni şifre",
4011+ "builder.passwordResetDone": "Şifre sıfırlandı. O yöneticinin oturumları kapatıldı.",
4012+ "builder.modulesHint": "Değişiklikler okulun bir sonraki isteğinde geçerli olur.",
4013+ "builder.editSchool": "Okulu düzenle",
4014+ "builder.editSchoolHint": "Okulun adını veya durumunu değiştir.",
4015+ "builder.suspendHint": "Askıya alma anında geçerlidir: okulun tüm kullanıcıları, giriş dahil, reddedilir.",
4016+ "modules.subtitle": "Modüler yapı: okulun yalnızca ihtiyaç duyduğu bileşenlere sahip olur.",
4017+ "modules.readOnlyHint": "Modüller Hezarfen sağlayıcın tarafından açılır veya kapatılır.",
4018+ "modules.enabledCount": "{total} modülden {on} açık",
4019+ "modules.enableAll": "Hepsini aç",
4020+ "modules.disableAll": "Hepsini kapat",
4021+ "modules.requires": "Gerektirir",
4022+ "modules.on": "Açık",
4023+ "modules.conflictRequires": "{module} için {needed} açık olmalı.",
4024+ "modules.conflictRequiredBy": "{module} kapatılamaz: {dependents} buna bağlı.",
4025+ "modules.module": "Modül",
4026+ "modules.active": "Etkin",
4027+ "modules.unitPrice": "Birim fiyat",
4028+ "modules.activeSeats": "Aktif lisans",
4029+ "modules.annualAmount": "Yıllık tutar",
4030+ "modules.annualTotal": "yıllık toplam",
4031+ "modules.tabOverview": "Genel bakış",
4032+ "modules.tabUsage": "Kullanım",
4033+ "modules.tabInvoices": "Faturalar",
4034+ "modules.tabContract": "Sözleşme",
4035+ "modules.downloadInvoices": "Faturaları indir",
4036+ "modules.addLicense": "Lisans ekle",
4037+ "modules.fullPackage": "Tam paket",
4038+ "modules.customPackage": "Özel paket",
4039+ "modules.renewal": "Yenileme",
4040+ "modules.recentInvoices": "Son faturalar",
4041+ "modules.off": "Kapalı",
4042+ "module.appointments": "Randevular",
4043+ "module.attendance": "Yoklama",
4044+ "module.bank_questions": "Soru bankası",
4045+ "module.boards": "Tahta",
4046+ "module.chatbot": "Çelebi asistanı",
4047+ "module.classes": "Sınıflar",
4048+ "module.course_notes": "Ders notları",
4049+ "module.courses": "Dersler",
4050+ "module.events": "Etkinlikler",
4051+ "module.exams": "Sınavlar",
4052+ "module.homework": "Ödevler",
4053+ "module.marks": "Notlar",
4054+ "module.meals": "Yemekler",
4055+ "module.messages": "Mesajlar",
4056+ "module.notes": "Defter",
4057+ "module.payments": "Ödemeler",
4058+ "module.pomodoro": "Pomodoro",
4059+ "module.questions": "Soru havuzu",
4060+ "module.sessions": "Ders oturumları",
4061+ "module.subjects": "Konular",
4062+ "module.work": "Mesai",
4063+ "package.academics": "Akademik",
4064+ "package.ai": "Yapay zekâ",
4065+ "package.communication": "İletişim",
4066+ "package.operations": "Operasyon",
37164067 "nav.darkMode": "Karanlık mod",
37174068 "parents.title": "Öğrencilerim",
37184069 "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.",
src/lib/module-labels.test.tsadded+22 -0
@@ -0,0 +1,22 @@
1+import { ApiError } from "@/api/client";
2+import { formatModuleError, moduleLabel } from "@/lib/module-labels";
3+
4+const t = (key: string, params?: Record<string, string>) =>
5+ params ? `${key}(${Object.entries(params).map(([k, v]) => `${k}=${v}`).join(",")})` : key;
6+
7+test("unknown modules fall back to their wire name", () => {
8+ expect(moduleLabel("kantin", t)).toBe("kantin");
9+ expect(moduleLabel("exams", t)).toBe("module.exams");
10+});
11+
12+test("a missing-requirement 409 names every violation with localized modules", () => {
13+ const err = new ApiError(409, "conflict: exams requires courses, which is not enabled; exams requires subjects, which is not enabled");
14+ expect(formatModuleError(err, t)).toBe(
15+ "modules.conflictRequires(module=module.exams,needed=module.courses) modules.conflictRequires(module=module.exams,needed=module.subjects)",
16+ );
17+});
18+
19+test("a required-by 409 lists the dependents", () => {
20+ const err = new ApiError(409, "courses is required by exams, subjects");
21+ expect(formatModuleError(err, t)).toBe("modules.conflictRequiredBy(module=module.courses,dependents=module.exams, module.subjects)");
22+});
src/lib/module-labels.tsadded+69 -0
@@ -0,0 +1,69 @@
1+import { ApiError, formatApiError } from "@/api/client";
2+import type { MessageKey } from "@/i18n/messages";
3+
4+type Translate = (key: MessageKey, params?: Record<string, string>) => string;
5+
6+const MODULE_KEYS: Record<string, MessageKey> = {
7+ appointments: "module.appointments",
8+ attendance: "module.attendance",
9+ bank_questions: "module.bank_questions",
10+ boards: "module.boards",
11+ chatbot: "module.chatbot",
12+ classes: "module.classes",
13+ course_notes: "module.course_notes",
14+ courses: "module.courses",
15+ events: "module.events",
16+ exams: "module.exams",
17+ homework: "module.homework",
18+ marks: "module.marks",
19+ meals: "module.meals",
20+ messages: "module.messages",
21+ notes: "module.notes",
22+ payments: "module.payments",
23+ pomodoro: "module.pomodoro",
24+ questions: "module.questions",
25+ sessions: "module.sessions",
26+ subjects: "module.subjects",
27+ work: "module.work",
28+};
29+
30+const PACKAGE_KEYS: Record<string, MessageKey> = {
31+ academics: "package.academics",
32+ ai: "package.ai",
33+ communication: "package.communication",
34+ operations: "package.operations",
35+};
36+
37+/** Localized module name; a module newer than this table falls back to its wire name. */
38+export function moduleLabel(module: string, t: Translate): string {
39+ const key = MODULE_KEYS[module];
40+ return key ? t(key) : module;
41+}
42+
43+export function packageLabel(pkg: string, t: Translate): string {
44+ const key = PACKAGE_KEYS[pkg];
45+ return key ? t(key) : pkg;
46+}
47+
48+/**
49+ * A module write refused with 409 names its broken dependencies in fixed
50+ * English (module.rs `validate`, builder.rs `refuse_if_needed`); render them
51+ * with localized module names instead of the generic error line.
52+ */
53+export function formatModuleError(err: unknown, t: Translate): string {
54+ if (err instanceof ApiError && err.status === 409) {
55+ const text = err.message.replace(/^conflict:\s*/i, "");
56+ const missing = [...text.matchAll(/([a-z_]+) requires ([a-z_]+), which is not enabled/g)];
57+ if (missing.length > 0) {
58+ return missing
59+ .map((match) => t("modules.conflictRequires", { module: moduleLabel(match[1], t), needed: moduleLabel(match[2], t) }))
60+ .join(" ");
61+ }
62+ const requiredBy = text.match(/^([a-z_]+) is required by ([a-z_, ]+)$/);
63+ if (requiredBy) {
64+ const dependents = requiredBy[2].split(",").map((name) => moduleLabel(name.trim(), t)).join(", ");
65+ return t("modules.conflictRequiredBy", { module: moduleLabel(requiredBy[1], t), dependents });
66+ }
67+ }
68+ return formatApiError(err);
69+}
src/pages/builder-login-page.tsxadded+123 -0
@@ -0,0 +1,123 @@
1+import { Link, Navigate, useNavigate } from "@tanstack/solid-router";
2+import { Show, createSignal } from "solid-js";
3+import { postBuilderLogin } from "@/api/builder";
4+import { ApiError, formatApiError, formatApiErrorMessage } from "@/api/client";
5+import { LogoMark } from "@/components/brand/logo-mark";
6+import { Button } from "@/components/ui/button";
7+import { Input } from "@/components/ui/input";
8+import { Label } from "@/components/ui/label";
9+import { PageSpinner } from "@/components/ui/page-spinner";
10+import { useAuth } from "@/stores/auth-context";
11+import { BuilderProvider, useBuilder } from "@/stores/builder-context";
12+import { useT } from "@/stores/preferences-context";
13+
14+// Backend BuilderCredentials bounds (hezarfen_backend src/web/builder.rs).
15+const MIN_USERNAME_LEN = 3;
16+const MAX_USERNAME_LEN = 32;
17+const MIN_PASSWORD_LEN = 6;
18+const MAX_PASSWORD_LEN = 128;
19+
20+export default function BuilderLoginPage() {
21+ return (
22+ <BuilderProvider>
23+ <BuilderLoginGate />
24+ </BuilderProvider>
25+ );
26+}
27+
28+function BuilderLoginGate() {
29+ const session = useBuilder();
30+ return (
31+ <Show when={!session.loading()} fallback={<PageSpinner />}>
32+ <Show when={!session.builder()} fallback={<Navigate to="/builder" />}>
33+ <BuilderLoginForm />
34+ </Show>
35+ </Show>
36+ );
37+}
38+
39+function BuilderLoginForm() {
40+ const auth = useAuth();
41+ const session = useBuilder();
42+ const navigate = useNavigate();
43+ const t = useT();
44+ const [username, setUsername] = createSignal("");
45+ const [password, setPassword] = createSignal("");
46+ const [error, setError] = createSignal("");
47+ const [pending, setPending] = createSignal(false);
48+
49+ const submit = async (event: SubmitEvent) => {
50+ event.preventDefault();
51+ setError("");
52+ setPending(true);
53+ try {
54+ await postBuilderLogin({ username: username().trim(), password: password() });
55+ // The builder cookie replaced any school session this browser held.
56+ await auth.refresh();
57+ session.refresh();
58+ void navigate({ to: "/builder" });
59+ } catch (err) {
60+ setError(
61+ err instanceof ApiError && err.status === 401
62+ ? formatApiErrorMessage("invalid credentials")
63+ : formatApiError(err),
64+ );
65+ } finally {
66+ setPending(false);
67+ }
68+ };
69+
70+ return (
71+ <div class="flex min-h-[70vh] items-center justify-center">
72+ <div class="w-full max-w-[420px] rounded-xl border border-border-line bg-surface-base px-6 pb-8 pt-9 shadow-[0_10px_24px_-4px_rgba(0,0,0,0.10)] sm:px-10">
73+ <div class="mb-8 text-center">
74+ <div class="mx-auto mb-5 flex h-12 w-12 items-center justify-center text-text-strong">
75+ <LogoMark size={44} />
76+ </div>
77+ <h1 class="text-2xl font-semibold tracking-[-0.025em] text-text-strong">{t("builder.loginTitle")}</h1>
78+ <p class="mt-2 text-sm text-text-subtle">{t("builder.loginSubtitle")}</p>
79+ </div>
80+ <form class="space-y-[18px]" onSubmit={submit}>
81+ <div class="space-y-2">
82+ <Label for="builder-username">{t("auth.username")}</Label>
83+ <Input
84+ id="builder-username"
85+ class="h-9"
86+ autocomplete="username"
87+ required
88+ minlength={MIN_USERNAME_LEN}
89+ maxlength={MAX_USERNAME_LEN}
90+ value={username()}
91+ onInput={(e) => setUsername(e.currentTarget.value)}
92+ />
93+ </div>
94+ <div class="space-y-2">
95+ <Label for="builder-password">{t("auth.password")}</Label>
96+ <Input
97+ id="builder-password"
98+ class="h-9"
99+ type="password"
100+ autocomplete="current-password"
101+ required
102+ minlength={MIN_PASSWORD_LEN}
103+ maxlength={MAX_PASSWORD_LEN}
104+ value={password()}
105+ onInput={(e) => setPassword(e.currentTarget.value)}
106+ />
107+ </div>
108+ <Show when={error()}>
109+ <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>
110+ </Show>
111+ <Button type="submit" class="h-9 w-full text-sm" disabled={pending()}>
112+ {t("auth.login")}
113+ </Button>
114+ </form>
115+ <p class="mt-8 border-t border-border-hairline pt-6 text-center text-sm text-text-subtle">
116+ <Link to="/login" class="font-semibold text-primary underline-offset-4 hover:underline">
117+ {t("builder.backToSchoolLogin")}
118+ </Link>
119+ </p>
120+ </div>
121+ </div>
122+ );
123+}
src/pages/builder-school-detail-page.tsxadded+254 -0
@@ -0,0 +1,254 @@
1+import { Show, Suspense, createEffect, createResource, createSignal } from "solid-js";
2+import { useNavigate, useParams } from "@tanstack/solid-router";
3+import { getModulesCatalog } from "@/api/modules";
4+import {
5+ deleteSchoolBySlug,
6+ deleteSchoolModule,
7+ getSchoolBySlug,
8+ getSchoolModules,
9+ patchSchoolBySlug,
10+ patchSchoolModules,
11+ postSchoolModule,
12+} from "@/api/schools";
13+import { formatApiError, type SchoolStatus } from "@/api/client";
14+import { PageHeader } from "@/components/layout/page-header";
15+import { BuilderGuard } from "@/components/builder/builder-guard";
16+import { BuilderHeader } from "@/components/builder/builder-header";
17+import { SchoolAdminAccessPanel, type AdminAccessMode } from "@/components/builder/school-admin-access-panel";
18+import { SchoolStatusBadge } from "@/components/builder/school-status-badge";
19+import { ModuleCatalogGrid } from "@/components/modules/module-catalog-grid";
20+import { formatModuleError } from "@/lib/module-labels";
21+import { Alert } from "@/components/ui/alert";
22+import { Button } from "@/components/ui/button";
23+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
24+import { ErrorAlert } from "@/components/ui/error-alert";
25+import { IconEdit, IconExternalLink, IconLock, IconTrash } from "@/components/ui/icons";
26+import { Input } from "@/components/ui/input";
27+import { Label } from "@/components/ui/label";
28+import { PageSpinner } from "@/components/ui/page-spinner";
29+import { Select } from "@/components/ui/select";
30+import { SidePanel } from "@/components/ui/side-panel";
31+import { createFlash } from "@/lib/flash";
32+import { formatDateTime } from "@/lib/format";
33+import { useAuth } from "@/stores/auth-context";
34+import { BuilderProvider } from "@/stores/builder-context";
35+import { usePreferences, useT } from "@/stores/preferences-context";
36+
37+export default function BuilderSchoolDetailPage() {
38+ return (
39+ <BuilderProvider>
40+ <BuilderGuard>
41+ <BuilderSchoolDetailContent />
42+ </BuilderGuard>
43+ </BuilderProvider>
44+ );
45+}
46+
47+function BuilderSchoolDetailContent() {
48+ const t = useT();
49+ const { locale } = usePreferences();
50+ const auth = useAuth();
51+ const navigate = useNavigate();
52+ const params = useParams({ from: "/builder/schools/$slug" });
53+ const slug = () => params().slug;
54+
55+ const [school, { refetch: refetchSchool }] = createResource(slug, (value) => getSchoolBySlug(value));
56+ const [catalog] = createResource(() => getModulesCatalog());
57+ const [modules] = createResource(slug, (value) => getSchoolModules(value));
58+
59+ // The switchboard owns a local copy: each switch is one write whose response
60+ // is the school's whole new set, so there is nothing to refetch.
61+ const [enabled, setEnabled] = createSignal<string[]>([]);
62+ createEffect(() => {
63+ const value = modules();
64+ if (value) setEnabled(value.enabled);
65+ });
66+ const [modulesSaving, setModulesSaving] = createSignal(false);
67+ const [modulesError, setModulesError] = createSignal("");
68+
69+ const [editOpen, setEditOpen] = createSignal(false);
70+ const [name, setName] = createSignal("");
71+ const [status, setStatus] = createSignal<SchoolStatus>("active");
72+ const [editError, setEditError] = createSignal("");
73+ const [accessMode, setAccessMode] = createSignal<AdminAccessMode | null>(null);
74+ const [deleteOpen, setDeleteOpen] = createSignal(false);
75+ const [error, setError] = createSignal("");
76+ const [flash, setFlash] = createFlash();
77+
78+ const writeModules = async (write: () => Promise<{ enabled: string[] }>) => {
79+ if (modulesSaving()) return;
80+ setModulesSaving(true);
81+ setModulesError("");
82+ try {
83+ const next = await write();
84+ setEnabled(next.enabled);
85+ } catch (err) {
86+ // A 409 names the broken dependency; the switch stays where it was.
87+ setModulesError(formatModuleError(err, t));
88+ } finally {
89+ setModulesSaving(false);
90+ }
91+ };
92+
93+ const openEdit = () => {
94+ const current = school();
95+ if (!current) return;
96+ setName(current.name);
97+ setStatus(current.status);
98+ setEditError("");
99+ setEditOpen(true);
100+ };
101+
102+ const saveEdit = async (event: SubmitEvent) => {
103+ event.preventDefault();
104+ setEditError("");
105+ try {
106+ await patchSchoolBySlug(slug(), { name: name().trim(), status: status() });
107+ setEditOpen(false);
108+ await refetchSchool();
109+ setFlash(t("common.saved"));
110+ } catch (err) {
111+ setEditError(formatApiError(err));
112+ }
113+ };
114+
115+ return (
116+ <div class="space-y-6">
117+ <BuilderHeader />
118+ <Suspense fallback={<PageSpinner />}>
119+ <Show when={school.error}>
120+ <ErrorAlert message={formatApiError(school.error)} onRetry={() => void refetchSchool()} />
121+ </Show>
122+ <Show when={!school.error && school()}>
123+ {(current) => (
124+ <>
125+ <PageHeader
126+ eyebrow={t("builder.schools")}
127+ title={current().name}
128+ description={`${current().slug} · ${t("builder.createdAt")}: ${formatDateTime(current().created_at, locale())}`}
129+ actions={
130+ <div class="flex flex-wrap items-center gap-2">
131+ <SchoolStatusBadge status={current().status} />
132+ <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={openEdit}>
133+ <IconEdit class="h-4 w-4" />
134+ {t("common.edit")}
135+ </Button>
136+ <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => setAccessMode("password")}>
137+ <IconLock class="h-4 w-4" />
138+ {t("builder.resetAdminPassword")}
139+ </Button>
140+ <Button type="button" size="sm" class="rounded-lg" disabled={current().status === "suspended"} title={current().status === "suspended" ? t("builder.enterSuspendedHint") : undefined} onClick={() => setAccessMode("enter")}>
141+ <IconExternalLink class="h-4 w-4" />
142+ {t("builder.enterSchool")}
143+ </Button>
144+ <Button type="button" variant="destructive" size="sm" class="rounded-lg" onClick={() => setDeleteOpen(true)}>
145+ <IconTrash class="h-4 w-4" />
146+ {t("common.delete")}
147+ </Button>
148+ </div>
149+ }
150+ />
151+ <Show when={flash()}>
152+ <Alert variant="success">{flash()}</Alert>
153+ </Show>
154+ <Show when={error()}>
155+ <Alert variant="destructive">{error()}</Alert>
156+ </Show>
157+
158+ <section class="space-y-3">
159+ <div>
160+ <h2 class="font-semibold text-text-strong">{t("builder.modules")}</h2>
161+ <p class="text-sm text-text-subtle">{t("builder.modulesHint")}</p>
162+ </div>
163+ <Show when={modulesError()}>
164+ <Alert variant="destructive">{modulesError()}</Alert>
165+ </Show>
166+ <Show when={modules.error || catalog.error}>
167+ <ErrorAlert message={formatApiError(modules.error ?? catalog.error)} />
168+ </Show>
169+ <Show when={!modules.error && !catalog.error && catalog()}>
170+ {(value) => (
171+ <ModuleCatalogGrid
172+ catalog={value()}
173+ enabled={enabled()}
174+ disabled={modulesSaving()}
175+ onToggle={(module, next) =>
176+ void writeModules(() => (next ? postSchoolModule(slug(), module) : deleteSchoolModule(slug(), module)))
177+ }
178+ onTogglePackage={(pkg, next) =>
179+ void writeModules(() => patchSchoolModules(slug(), next ? { enable_packages: [pkg] } : { disable_packages: [pkg] }))
180+ }
181+ />
182+ )}
183+ </Show>
184+ </section>
185+ </>
186+ )}
187+ </Show>
188+ </Suspense>
189+
190+ <SidePanel open={editOpen()} onOpenChange={setEditOpen} title={t("builder.editSchool")} description={t("builder.editSchoolHint")}>
191+ <form class="space-y-4" onSubmit={saveEdit}>
192+ <Show when={editError()}>
193+ <Alert variant="destructive">{editError()}</Alert>
194+ </Show>
195+ <div class="space-y-1.5">
196+ <Label for="school-edit-name">{t("builder.schoolName")}</Label>
197+ <Input id="school-edit-name" class="rounded-lg" required maxlength={120} value={name()} onInput={(e) => setName(e.currentTarget.value)} />
198+ </div>
199+ <div class="space-y-1.5">
200+ <Label for="school-edit-status">{t("builder.status")}</Label>
201+ <Select id="school-edit-status" value={status()} onChange={(e) => setStatus(e.currentTarget.value as SchoolStatus)}>
202+ <option value="active">{t("builder.statusActive")}</option>
203+ <option value="suspended">{t("builder.statusSuspended")}</option>
204+ </Select>
205+ <p class="text-xs text-text-subtle">{t("builder.suspendHint")}</p>
206+ </div>
207+ <div class="flex flex-wrap items-center gap-2">
208+ <Button type="button" variant="outline" class="h-10 rounded-lg" onClick={() => setEditOpen(false)}>
209+ {t("common.cancel")}
210+ </Button>
211+ <Button type="submit" class="h-10 rounded-lg">
212+ {t("common.save")}
213+ </Button>
214+ </div>
215+ </form>
216+ </SidePanel>
217+
218+ <SchoolAdminAccessPanel
219+ slug={slug()}
220+ mode={accessMode()}
221+ onClose={() => setAccessMode(null)}
222+ onPasswordReset={() => {
223+ setAccessMode(null);
224+ setFlash(t("builder.passwordResetDone"));
225+ }}
226+ onEntered={async () => {
227+ setAccessMode(null);
228+ // The builder cookie is gone; this browser is now that admin.
229+ await auth.refresh();
230+ void navigate({ to: "/" });
231+ }}
232+ />
233+
234+ <ConfirmDialog
235+ open={deleteOpen()}
236+ onOpenChange={setDeleteOpen}
237+ title={t("builder.deleteSchool")}
238+ description={t("builder.deleteSchoolWarning")}
239+ variant="destructive"
240+ summary={school() ? `${school()!.name} · ${school()!.slug}` : ""}
241+ onConfirm={async () => {
242+ try {
243+ await deleteSchoolBySlug(slug());
244+ void navigate({ to: "/builder" });
245+ } catch (err) {
246+ setError(formatApiError(err));
247+ } finally {
248+ setDeleteOpen(false);
249+ }
250+ }}
251+ />
252+ </div>
253+ );
254+}
src/pages/builder-schools-page.tsxadded+175 -0
@@ -0,0 +1,175 @@
1+import { Show, Suspense, createMemo, createResource, createSignal } from "solid-js";
2+import { useNavigate } from "@tanstack/solid-router";
3+import type { ColumnDef } from "@tanstack/solid-table";
4+import { deleteSchoolBySlug, getSchools, patchSchoolBySlug } from "@/api/schools";
5+import { formatApiError, type School } from "@/api/client";
6+import { BuilderGuard } from "@/components/builder/builder-guard";
7+import { BuilderHeader } from "@/components/builder/builder-header";
8+import { CreateSchoolPanel } from "@/components/builder/create-school-panel";
9+import { SchoolStatusBadge } from "@/components/builder/school-status-badge";
10+import { Alert } from "@/components/ui/alert";
11+import { Button } from "@/components/ui/button";
12+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
13+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
14+import { ErrorAlert } from "@/components/ui/error-alert";
15+import { IconEye, IconLock, IconPlus, IconRotateCcw, IconTrash } from "@/components/ui/icons";
16+import { TableRowActions } from "@/components/ui/table-row-actions";
17+import { createFlash } from "@/lib/flash";
18+import { formatDateTime } from "@/lib/format";
19+import { BuilderProvider } from "@/stores/builder-context";
20+import { usePreferences, useT } from "@/stores/preferences-context";
21+
22+const SCHOOL_PAGE_SIZE = 15;
23+
24+export default function BuilderSchoolsPage() {
25+ return (
26+ <BuilderProvider>
27+ <BuilderGuard>
28+ <BuilderSchoolsContent />
29+ </BuilderGuard>
30+ </BuilderProvider>
31+ );
32+}
33+
34+function BuilderSchoolsContent() {
35+ const t = useT();
36+ const { locale } = usePreferences();
37+ const navigate = useNavigate();
38+ const [list, { refetch }] = createResource(async () => (await getSchools()).items);
39+ const [createOpen, setCreateOpen] = createSignal(false);
40+ const [deleteTarget, setDeleteTarget] = createSignal<School | null>(null);
41+ const [error, setError] = createSignal("");
42+ const [flash, setFlash] = createFlash();
43+
44+ const open = (school: School) => void navigate({ to: "/builder/schools/$slug", params: { slug: school.slug } });
45+
46+ const setStatus = async (school: School, status: School["status"]) => {
47+ setError("");
48+ try {
49+ await patchSchoolBySlug(school.slug, { status });
50+ await refetch();
51+ setFlash(t("common.saved"));
52+ } catch (err) {
53+ setError(formatApiError(err));
54+ }
55+ };
56+
57+ const columns = createMemo<ColumnDef<School>[]>(() => [
58+ {
59+ accessorKey: "name",
60+ header: t("builder.schoolName"),
61+ cell: (cell) => <span class="font-medium">{cell.row.original.name}</span>,
62+ },
63+ {
64+ accessorKey: "slug",
65+ header: t("builder.slug"),
66+ cell: (cell) => <span class="mono text-sm">{cell.row.original.slug}</span>,
67+ },
68+ {
69+ accessorKey: "status",
70+ header: t("builder.status"),
71+ cell: (cell) => <SchoolStatusBadge status={cell.row.original.status} />,
72+ },
73+ {
74+ id: "modules",
75+ header: t("builder.modules"),
76+ meta: { align: "right", cellClass: "mono tabular-nums" },
77+ cell: (cell) => cell.row.original.modules.length,
78+ },
79+ {
80+ accessorKey: "created_at",
81+ header: t("builder.createdAt"),
82+ cell: (cell) => <span class="mono text-sm">{formatDateTime(cell.row.original.created_at, locale())}</span>,
83+ },
84+ {
85+ id: "actions",
86+ header: t("common.actions"),
87+ meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" },
88+ cell: (cell) => (
89+ <TableRowActions
90+ label={t("common.actions")}
91+ actions={[
92+ { label: t("common.view"), icon: <IconEye class="h-4 w-4" />, onSelect: () => open(cell.row.original) },
93+ cell.row.original.status === "active"
94+ ? { label: t("builder.suspend"), icon: <IconLock class="h-4 w-4" />, onSelect: () => void setStatus(cell.row.original, "suspended") }
95+ : { label: t("builder.activate"), icon: <IconRotateCcw class="h-4 w-4" />, onSelect: () => void setStatus(cell.row.original, "active") },
96+ { label: t("common.delete"), icon: <IconTrash class="h-4 w-4" />, destructive: true, onSelect: () => setDeleteTarget(cell.row.original) },
97+ ]}
98+ />
99+ ),
100+ },
101+ ]);
102+
103+ return (
104+ <div class="space-y-6">
105+ <BuilderHeader />
106+ <Show when={flash()}>
107+ <Alert variant="success">{flash()}</Alert>
108+ </Show>
109+ <Show when={error()}>
110+ <Alert variant="destructive">{error()}</Alert>
111+ </Show>
112+
113+ <section class="data-shell space-y-4 p-4">
114+ <Suspense fallback={<DataTableSkeleton columns={5} rows={6} />}>
115+ <Show when={list.error}>
116+ <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} />
117+ </Show>
118+ <Show when={!list.error}>
119+ <DataTable
120+ title={t("builder.schools")}
121+ description={t("builder.schoolsSubtitle")}
122+ actions={
123+ <Button type="button" size="sm" class="min-w-[7.5rem] rounded-lg" onClick={() => setCreateOpen(true)}>
124+ <IconPlus class="h-4 w-4" />
125+ {t("builder.createSchool")}
126+ </Button>
127+ }
128+ columns={columns()}
129+ data={list() ?? []}
130+ tableClass="min-w-176"
131+ empty={t("builder.noSchools")}
132+ filterColumn="name"
133+ enablePagination
134+ pageSize={SCHOOL_PAGE_SIZE}
135+ onRowClick={open}
136+ />
137+ </Show>
138+ </Suspense>
139+ </section>
140+
141+ <CreateSchoolPanel
142+ open={createOpen()}
143+ onOpenChange={setCreateOpen}
144+ onCreated={(school) => {
145+ setCreateOpen(false);
146+ setFlash(t("common.created"));
147+ void refetch();
148+ open(school);
149+ }}
150+ />
151+
152+ <ConfirmDialog
153+ open={deleteTarget() != null}
154+ onOpenChange={(value) => !value && setDeleteTarget(null)}
155+ title={t("builder.deleteSchool")}
156+ description={t("builder.deleteSchoolWarning")}
157+ variant="destructive"
158+ summary={deleteTarget() ? `${deleteTarget()!.name} · ${deleteTarget()!.slug}` : ""}
159+ onConfirm={async () => {
160+ const school = deleteTarget();
161+ if (!school) return;
162+ try {
163+ await deleteSchoolBySlug(school.slug);
164+ await refetch();
165+ setFlash(t("common.deleted"));
166+ } catch (err) {
167+ setError(formatApiError(err));
168+ } finally {
169+ setDeleteTarget(null);
170+ }
171+ }}
172+ />
173+ </div>
174+ );
175+}
src/pages/coming-soon-page.tsxmodified+0 -6
@@ -18,17 +18,11 @@ const COMING_SOON_LABELS: Record<string, MessageKey> = {
1818 "deneme-sinavlari": "nav.mockExams",
1919 "optik-okuma": "nav.opticalReading",
2020 raporlar: "nav.reports",
21- "lisans-modulleri": "nav.licenseModules",
2221 "kvkk-denetim": "nav.dataProtection",
23- ogrenciler: "nav.studentsRoster",
24- ogretmenler: "nav.teachersRoster",
2522 "ogrenci-analizi": "nav.studentAnalysis",
2623 "bekleyen-onaylar": "nav.pendingApprovals",
2724 "soru-uretimi": "nav.questionGeneration",
2825 "calisma-programim": "nav.studyPlan",
29- devamsizlik: "nav.absence",
30- "sinav-sonuclari-veli": "nav.childExamResults",
31- "calisma-plani": "nav.childStudyPlan",
3226 };
3327
3428 export default function ComingSoonPage() {
src/pages/dashboard-page.test.tsxmodified+4 -0
@@ -35,6 +35,10 @@ const DAY = 24 * 60 * 60 * 1000;
3535 const page = <T,>(items: T[]) => ({ items, total: items.length, limit: 50, offset: 0 });
3636 const course = { id: "course-1", title: "Algebra", capacity: 24 };
3737
38+vi.mock("@/stores/modules-context", () => ({
39+ useModules: () => ({ enabled: () => null, isEnabled: () => true, refresh: () => {} }),
40+}));
41+vi.mock("@/api/modules", () => ({ getModulesCatalog: async () => ({ modules: [], packages: [] }) }));
3842 vi.mock("@/api/time/getTime", () => ({ getTime: async () => ({ now }) }));
3943 vi.mock("@/api/courses", () => ({
4044 getCourses: async () => page([course]),
src/pages/dashboard-page.tsxmodified+32 -1
@@ -37,6 +37,7 @@ import {
3737 IconSearch,
3838 IconUsers,
3939 IconUtensils,
40+ IconPackage,
4041 } from "@/components/ui/icons";
4142 import { PageSpinner } from "@/components/ui/page-spinner";
4243 import type { MessageKey } from "@/i18n/messages";
@@ -44,7 +45,10 @@ import { cn } from "@/lib/cn";
4445 import { formatDateTime } from "@/lib/format";
4546 import { formatTry } from "@/lib/meals";
4647 import { personLabel } from "@/lib/person";
48+import { packageLabel } from "@/lib/module-labels";
4749 import { hasMinRole } from "@/lib/roles";
50+import { getModulesCatalog } from "@/api/modules";
51+import { useModules } from "@/stores/modules-context";
4852 import { useAuth } from "@/stores/auth-context";
4953 import { usePreferences, useT } from "@/stores/preferences-context";
5054
@@ -310,6 +314,28 @@ function DashboardContent() {
310314 })),
311315 );
312316
317+ // The school's own entitlements per package: the catalog is deploy-constant,
318+ // the enabled set is already in the shell's modules context.
319+ const schoolModules = useModules();
320+ const [moduleCatalog] = createResource(
321+ () => (isAdminHome() ? true : null),
322+ () => getModulesCatalog().catch(() => null),
323+ );
324+ const moduleQuickLinks = createMemo<QuickLinkRow[]>(() => {
325+ const catalog = moduleCatalog();
326+ const enabled = schoolModules.enabled();
327+ if (!catalog || !enabled) return [];
328+ return catalog.packages.map((pkg) => {
329+ const on = pkg.modules.filter((module) => enabled.includes(module));
330+ return {
331+ id: pkg.package,
332+ primary: packageLabel(pkg.package, t),
333+ secondary: `${on.length}/${pkg.modules.length}`,
334+ Icon: IconPackage,
335+ };
336+ });
337+ });
338+
313339 // Hero search. `/users/search` is the only search endpoint the app has, so
314340 // this box only ever finds students — it never claims to search classes,
315341 // exams, or modules the way the Figma copy does.
@@ -685,7 +711,12 @@ function DashboardContent() {
685711 empty={t("dashboard.quicklinks.empty")}
686712 onOpen={(row) => navigate({ to: "/management/classes/$id", params: { id: row.id } })}
687713 />
688- <ComingSoonPanel class="text-left" title={t("dashboard.quicklinks.modules")} />
714+ <QuickLinkColumn
715+ title={t("dashboard.quicklinks.modules")}
716+ rows={moduleQuickLinks()}
717+ empty={t("dashboard.quicklinks.empty")}
718+ onOpen={() => navigate({ to: "/management/modules" })}
719+ />
689720 </div>
690721 </header>
691722 </Show>
src/pages/license-modules-page.tsxadded+172 -0
@@ -0,0 +1,172 @@
1+import type { ColumnDef } from "@tanstack/solid-table";
2+import { For, Show, Suspense, createMemo, createResource } from "solid-js";
3+import { getModules, getModulesCatalog } from "@/api/modules";
4+import { formatApiError } from "@/api/client";
5+import { RouteGuard } from "@/components/layout/route-guard";
6+import { Badge } from "@/components/ui/badge";
7+import { Button } from "@/components/ui/button";
8+import { ComingSoonBadge, ComingSoonPanel, ComingSoonValue } from "@/components/ui/coming-soon";
9+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
10+import { ErrorAlert } from "@/components/ui/error-alert";
11+import { IconDownload, IconPackage, IconPlus } from "@/components/ui/icons";
12+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
13+import { moduleLabel, packageLabel } from "@/lib/module-labels";
14+import { useT } from "@/stores/preferences-context";
15+
16+type ModuleRow = { module: string; package: string; requires: string[]; enabled: boolean };
17+
18+export default function LicenseModulesPage() {
19+ return (
20+ <RouteGuard minRole="admin">
21+ <LicenseModulesContent />
22+ </RouteGuard>
23+ );
24+}
25+
26+// ADM-05. What the school has is real (GET /modules over the catalog); price,
27+// seat count, renewal and invoices belong to a billing API that does not
28+// exist, so those slots say "yakında". Selling a module is the operator's
29+// act on /builder, never a school admin's.
30+function LicenseModulesContent() {
31+ const t = useT();
32+ const [data, { refetch }] = createResource(async () => {
33+ const [catalog, mine] = await Promise.all([getModulesCatalog(), getModules()]);
34+ const rows: ModuleRow[] = catalog.modules.map((entry) => ({
35+ module: entry.module,
36+ package: entry.package,
37+ requires: entry.requires,
38+ enabled: mine.enabled.includes(entry.module),
39+ }));
40+ return { rows, packages: catalog.packages };
41+ });
42+
43+ const enabledCount = () => (data()?.rows ?? []).filter((row) => row.enabled).length;
44+ const totalCount = () => data()?.rows.length ?? 0;
45+ const isFull = () => totalCount() > 0 && enabledCount() === totalCount();
46+ const enabledPackages = () =>
47+ (data()?.packages ?? [])
48+ .filter((pkg) => pkg.modules.some((module) => data()?.rows.find((row) => row.module === module)?.enabled))
49+ .map((pkg) => packageLabel(pkg.package, t));
50+
51+ const columns = createMemo<ColumnDef<ModuleRow>[]>(() => [
52+ {
53+ id: "module",
54+ header: t("modules.module"),
55+ cell: (cell) => (
56+ <div class="flex min-w-0 items-center gap-2.5">
57+ <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-surface-tint text-text-subtle">
58+ <IconPackage class="h-4 w-4" />
59+ </span>
60+ <div class="min-w-0">
61+ <p class="truncate text-sm font-medium text-text-strong">{moduleLabel(cell.row.original.module, t)}</p>
62+ <p class="truncate text-xs text-text-subtle">
63+ {packageLabel(cell.row.original.package, t)}
64+ <Show when={cell.row.original.requires.length > 0}>
65+ {` · ${t("modules.requires")}: ${cell.row.original.requires.map((name) => moduleLabel(name, t)).join(", ")}`}
66+ </Show>
67+ </p>
68+ </div>
69+ </div>
70+ ),
71+ },
72+ {
73+ id: "status",
74+ header: t("builder.status"),
75+ cell: (cell) => (
76+ <Badge variant={cell.row.original.enabled ? "success" : "secondary"} class="rounded-full">
77+ {cell.row.original.enabled ? t("modules.active") : t("modules.off")}
78+ </Badge>
79+ ),
80+ },
81+ { id: "unitPrice", header: t("modules.unitPrice"), meta: { align: "right" }, enableSorting: false, cell: () => <ComingSoonValue /> },
82+ { id: "seats", header: t("modules.activeSeats"), meta: { align: "right" }, enableSorting: false, cell: () => <ComingSoonValue /> },
83+ { id: "annual", header: t("modules.annualAmount"), meta: { align: "right" }, enableSorting: false, cell: () => <ComingSoonValue /> },
84+ ]);
85+
86+ return (
87+ <div class="space-y-5">
88+ <Tabs value="overview">
89+ <TabsList>
90+ <TabsTrigger value="overview">{t("modules.tabOverview")}</TabsTrigger>
91+ <For each={["modules.tabUsage", "modules.tabInvoices", "modules.tabContract"] as const}>
92+ {(key) => (
93+ <TabsTrigger value={key} disabled title={t("comingSoon.title")}>
94+ {t(key)}
95+ <ComingSoonBadge class="ml-1.5" />
96+ </TabsTrigger>
97+ )}
98+ </For>
99+ </TabsList>
100+ </Tabs>
101+
102+ <div class="flex flex-wrap items-start justify-between gap-3">
103+ <div class="space-y-1">
104+ <h1 class="text-2xl font-semibold tracking-tight text-text-strong">{t("nav.licenseModules")}</h1>
105+ <p class="text-sm text-text-subtle">{t("modules.subtitle")}</p>
106+ </div>
107+ <div class="flex flex-wrap gap-2">
108+ <Button size="sm" variant="outline" class="min-w-[7.5rem] rounded-lg" disabled title={t("comingSoon.title")}>
109+ <IconDownload class="h-4 w-4" />
110+ {t("modules.downloadInvoices")}
111+ <ComingSoonBadge class="ml-1.5" />
112+ </Button>
113+ <Button size="sm" class="min-w-[7.5rem] rounded-lg" disabled title={t("modules.readOnlyHint")}>
114+ <IconPlus class="h-4 w-4" />
115+ {t("modules.addLicense")}
116+ <ComingSoonBadge class="ml-1.5" />
117+ </Button>
118+ </div>
119+ </div>
120+
121+ <Suspense fallback={<DataTableSkeleton columns={5} rows={8} />}>
122+ <Show when={data.error}>
123+ <ErrorAlert message={formatApiError(data.error)} onRetry={() => void refetch()} />
124+ </Show>
125+ <Show when={!data.error && data()}>
126+ {(value) => (
127+ <>
128+ <section class="data-shell space-y-4 p-5">
129+ <div class="flex flex-wrap items-start justify-between gap-4">
130+ <div class="min-w-0 space-y-1">
131+ <div class="flex items-center gap-2">
132+ <h2 class="text-2xl font-semibold tracking-tight text-text-strong">
133+ {isFull() ? t("modules.fullPackage") : t("modules.customPackage")}
134+ </h2>
135+ <Badge variant="success" class="rounded-full">{t("modules.active")}</Badge>
136+ </div>
137+ <p class="text-sm text-text-subtle">{enabledPackages().join(" + ") || "—"}</p>
138+ </div>
139+ <div class="text-right">
140+ <ComingSoonValue class="justify-end" />
141+ <p class="mt-1 text-xs text-text-subtle">{t("modules.annualTotal")}</p>
142+ </div>
143+ </div>
144+ <div class="h-2 overflow-hidden rounded-full bg-surface-tint" role="progressbar" aria-valuemin={0} aria-valuemax={totalCount()} aria-valuenow={enabledCount()}>
145+ <div class="h-full rounded-full bg-primary" style={{ width: `${totalCount() ? (enabledCount() / totalCount()) * 100 : 0}%` }} />
146+ </div>
147+ <div class="flex flex-wrap items-center justify-between gap-2 text-sm">
148+ <span class="text-text-subtle">{t("modules.enabledCount", { on: String(enabledCount()), total: String(totalCount()) })}</span>
149+ <span class="flex items-center gap-2 text-text-default">
150+ {t("modules.renewal")}: <ComingSoonValue />
151+ </span>
152+ </div>
153+ </section>
154+
155+ <DataTable
156+ title={t("builder.modules")}
157+ description={t("modules.readOnlyHint")}
158+ columns={columns()}
159+ data={value().rows}
160+ tableClass="min-w-[760px]"
161+ enablePagination={false}
162+ storageKey="license-modules"
163+ />
164+
165+ <ComingSoonPanel title={t("modules.recentInvoices")} />
166+ </>
167+ )}
168+ </Show>
169+ </Suspense>
170+ </div>
171+ );
172+}
src/pages/login-page.tsxmodified+5 -0
@@ -154,6 +154,11 @@ function LoginForm() {
154154 {t("auth.register")}
155155 </Link>
156156 </p>
157+ <p class="mt-3 text-center text-xs text-text-subtle">
158+ <Link to="/builder/login" class="underline-offset-4 hover:text-foreground hover:underline">
159+ {t("builder.operatorLogin")}
160+ </Link>
161+ </p>
157162 </div>
158163 </div>
159164 );
src/pages/my-students-page.tsxmodified+61 -11
@@ -1,27 +1,39 @@
11 import { For, Match, Show, Suspense, Switch, createEffect, createMemo, createResource, createSignal, type Component } from "solid-js";
2-import { useNavigate } from "@tanstack/solid-router";
2+import { useLocation, useNavigate } from "@tanstack/solid-router";
33 import type { ColumnDef } from "@tanstack/solid-table";
44 import { getClassesByUserId } from "@/api/classes";
55 import { getMyStudents } from "@/api/parents";
6+import { getPomodoroByUser } from "@/api/pomodoro";
67 import { getUserMarks } from "@/api/reports";
78 import { getUserAttendance } from "@/api/reports";
8-import type { MarksReport, PersonRef } from "@/api/client";
9+import { formatApiError, type MarksReport, type PersonRef } from "@/api/client";
910 import { HomeworkReportView } from "@/components/homework/homework-report-view";
1011 import { RouteGuard } from "@/components/layout/route-guard";
1112 import { PageHeader } from "@/components/layout/page-header";
1213 import { EmptyState } from "@/components/ui/empty-state";
14+import { ErrorAlert } from "@/components/ui/error-alert";
1315 import { PageSpinner } from "@/components/ui/page-spinner";
1416 import { SidePanel } from "@/components/ui/side-panel";
1517 import { Button } from "@/components/ui/button";
1618 import { DataTable, DataTableEmpty } from "@/components/ui/data-table";
1719 import { personLabel } from "@/lib/person";
1820 import { useT } from "@/stores/preferences-context";
19-import { IconChart, IconChevronRight, IconClipboardCheck, IconExam, IconExternalLink, IconHomework, IconMessage } from "@/components/ui/icons";
21+import { IconChart, IconChevronRight, IconClipboardCheck, IconClock, IconExam, IconExternalLink, IconHomework, IconMessage } from "@/components/ui/icons";
2022 import { MarksReportView } from "@/components/marks/marks-report-view";
2123 import { AttendanceReportView } from "@/components/attendance/attendance-report-view";
24+import { PomodoroLogView } from "@/components/pomodoro/pomodoro-log-view";
25+import { useModules } from "@/stores/modules-context";
2226 import { examKindLabel } from "@/lib/exam-labels";
2327
24-type StudentTab = "marks" | "attendance" | "exams" | "homework";
28+type StudentTab = "marks" | "attendance" | "exams" | "homework" | "study";
29+
30+// /students opens a child on the progress report; the parent sidebar's
31+// Devamsızlık / Sınav sonuçları / Çalışma planı entries are the same page
32+// landing on another tab (/students/attendance, /students/exams, /students/study).
33+function tabFromPath(pathname: string): StudentTab {
34+ const segment = pathname.split("/")[2];
35+ return segment === "attendance" || segment === "exams" || segment === "study" ? segment : "marks";
36+}
2537 type CourseRow = MarksReport["courses"][number];
2638 type ExamRow = CourseRow["results"][number] & { courseTitle: string };
2739
@@ -41,7 +53,18 @@ export default function MyStudentsPage() {
4153 function MyStudentsContent() {
4254 const t = useT();
4355 const [list] = createResource(async () => (await getMyStudents()).items);
56+ const location = useLocation();
4457 const [selectedStudent, setSelectedStudent] = createSignal<PersonRef | null>(null);
58+ const routeTab = () => tabFromPath(location().pathname);
59+ // A parent with a single linked child has nothing to pick: open that child
60+ // once, so a sidebar tab entry lands straight on its data.
61+ let autoOpened = false;
62+ createEffect(() => {
63+ const items = list();
64+ if (autoOpened || !items || items.length !== 1) return;
65+ autoOpened = true;
66+ setSelectedStudent(items[0]);
67+ });
4568
4669 return (
4770 <div class="space-y-6">
@@ -73,14 +96,15 @@ function MyStudentsContent() {
7396 </Show>
7497 </Suspense>
7598
76- <StudentDetailPanel student={selectedStudent()} onClose={() => setSelectedStudent(null)} />
99+ <StudentDetailPanel student={selectedStudent()} initialTab={routeTab()} onClose={() => setSelectedStudent(null)} />
77100 </div>
78101 );
79102 }
80103
81-function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => void }) {
104+function StudentDetailPanel(props: { student: PersonRef | null; initialTab: StudentTab; onClose: () => void }) {
82105 const t = useT();
83106 const navigate = useNavigate();
107+ const modules = useModules();
84108 const [activeTab, setActiveTab] = createSignal<StudentTab>("marks");
85109
86110 const [marksRes] = createResource(
@@ -99,8 +123,24 @@ function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => v
99123 );
100124 const studentClass = () => classesRes()?.[0] ?? null;
101125
126+ // Fetched only once the tab is opened: the pomodoro nest can be switched
127+ // off per school, and the other tabs must not pay for it.
128+ const [studyError, setStudyError] = createSignal("");
129+ const [pomodoroRes] = createResource(
130+ () => (activeTab() === "study" ? props.student?.id : undefined),
131+ async (id) => {
132+ setStudyError("");
133+ try {
134+ return await getPomodoroByUser(id, { limit: 50 });
135+ } catch (err) {
136+ setStudyError(formatApiError(err));
137+ return null;
138+ }
139+ },
140+ );
141+
102142 createEffect(() => {
103- if (props.student?.id) setActiveTab("marks");
143+ if (props.student?.id) setActiveTab(props.initialTab);
104144 });
105145
106146 const report = () => marksRes() ?? null;
@@ -147,12 +187,13 @@ function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => v
147187 // Ordered to match the Figma per-child screen set (Gelişim raporu →
148188 // Devamsızlık → Sınav sonuçları); "Ödevler" has no Figma screen of its own
149189 // but is kept — real, working functionality with nowhere else to live.
150- const tabs: Array<{ key: StudentTab; icon: Component<{ class?: string }>; label: string }> = [
190+ const tabs = createMemo<Array<{ key: StudentTab; icon: Component<{ class?: string }>; label: string }>>(() => [
151191 { key: "marks", icon: IconChart, label: t("nav.progressReport") },
152192 { key: "attendance", icon: IconClipboardCheck, label: t("nav.attendance") },
153- { key: "exams", icon: IconExam, label: t("nav.examResults") },
193+ { key: "exams", icon: IconExam, label: t("nav.childExamResults") },
154194 { key: "homework", icon: IconHomework, label: t("nav.homework") },
155- ];
195+ ...(modules.isEnabled("pomodoro") ? [{ key: "study" as const, icon: IconClock, label: t("nav.childStudyPlan") }] : []),
196+ ]);
156197
157198 return (
158199 <SidePanel open={!!props.student} onOpenChange={(open) => !open && props.onClose()} title={props.student ? personLabel(props.student) : ""} description={`@${props.student?.username}`}>
@@ -198,7 +239,7 @@ function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => v
198239 </Button>
199240 </div>
200241 <div class="flex flex-wrap gap-2">
201- <For each={tabs}>
242+ <For each={tabs()}>
202243 {(tab) => {
203244 const Icon = tab.icon;
204245 return (
@@ -233,6 +274,15 @@ function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => v
233274 </Show>
234275 </Match>
235276
277+ <Match when={activeTab() === "study"}>
278+ <Show when={studyError()}>
279+ <ErrorAlert message={studyError()} />
280+ </Show>
281+ <Show when={pomodoroRes()}>
282+ {(log) => <PomodoroLogView log={log()} />}
283+ </Show>
284+ </Match>
285+
236286 <Match when={activeTab() === "attendance"}>
237287 <Show when={attendanceRes()} fallback={<PageSpinner />}>
238288 <AttendanceReportView report={attendanceRes()!} />
src/pages/student-pomodoro-page.tsxmodified+4 -30
@@ -2,18 +2,18 @@ import { Show, createMemo, createResource, createSignal } from "solid-js";
22 import type { ColumnDef } from "@tanstack/solid-table";
33 import { getPomodoroByUser } from "@/api/pomodoro";
44 import { getUserSearch } from "@/api/users";
5-import type { PersonRef, PomodoroSession } from "@/api/client";
5+import type { PersonRef } from "@/api/client";
66 import { ApiError, formatApiError } from "@/api/client";
77 import { RouteGuard } from "@/components/layout/route-guard";
8+import { PomodoroLogView } from "@/components/pomodoro/pomodoro-log-view";
89 import { Alert } from "@/components/ui/alert";
910 import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
1011 import { ErrorAlert } from "@/components/ui/error-alert";
1112 import { IconEye } from "@/components/ui/icons";
1213 import { SidePanel } from "@/components/ui/side-panel";
1314 import { TableRowActions } from "@/components/ui/table-row-actions";
14-import { formatDateTime, formatDurationClock } from "@/lib/format";
1515 import { personLabel } from "@/lib/person";
16-import { usePreferences, useT } from "@/stores/preferences-context";
16+import { useT } from "@/stores/preferences-context";
1717
1818 const PAGE_SIZE = 10;
1919
@@ -27,7 +27,6 @@ export default function StudentPomodoroPage() {
2727
2828 function StudentPomodoroContent() {
2929 const t = useT();
30- const { locale } = usePreferences();
3130 const [viewUser, setViewUser] = createSignal<PersonRef | null>(null);
3231 const [error, setError] = createSignal("");
3332
@@ -98,23 +97,6 @@ function StudentPomodoroContent() {
9897 ),
9998 },
10099 ]);
101- const logColumns = createMemo<ColumnDef<PomodoroSession>[]>(() => [
102- {
103- accessorKey: "started_at",
104- header: t("pomodoro.startedAt"),
105- cell: (cell) => <span class="mono whitespace-nowrap">{formatDateTime(cell.row.original.started_at, locale())}</span>,
106- },
107- {
108- accessorKey: "finished_at",
109- header: t("pomodoro.finishedAt"),
110- cell: (cell) => <span class="mono whitespace-nowrap">{formatDateTime(cell.row.original.finished_at, locale())}</span>,
111- },
112- {
113- accessorKey: "duration_ms",
114- header: t("pomodoro.duration"),
115- cell: (cell) => <span class="mono tabular-nums">{formatDurationClock(cell.row.original.duration_ms)}</span>,
116- },
117- ]);
118100
119101 return (
120102 <div class="space-y-6">
@@ -163,15 +145,7 @@ function StudentPomodoroContent() {
163145 <p class="text-sm text-muted-foreground">{t("common.loading")}</p>
164146 </Show>
165147 <Show when={log()}>
166- {(p) => (
167- <div class="space-y-4">
168- <div class="detail-metric-card">
169- <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("pomodoro.total")}</p>
170- <p class="mono mt-2 text-3xl font-semibold tabular-nums">{formatDurationClock(p().total_focus_ms)}</p>
171- </div>
172- <DataTable columns={logColumns()} data={p().items} empty={t("pomodoro.empty")} enablePagination pageSize={10} />
173- </div>
174- )}
148+ {(p) => <PomodoroLogView log={p()} />}
175149 </Show>
176150 </div>
177151 </SidePanel>
src/pages/students-roster-page.tsxadded+173 -0
@@ -0,0 +1,173 @@
1+import { useNavigate } from "@tanstack/solid-router";
2+import type { ColumnDef } from "@tanstack/solid-table";
3+import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js";
4+import { getClassMembers, getClasses } from "@/api/classes";
5+import { getTerms } from "@/api/terms";
6+import { getUserSearch } from "@/api/users";
7+import { formatApiError, type ClassGroup, type PersonRef } from "@/api/client";
8+import { RouteGuard } from "@/components/layout/route-guard";
9+import { RosterPersonCell } from "@/components/users/roster-person-cell";
10+import { Button } from "@/components/ui/button";
11+import { ComingSoonBadge, ComingSoonValue } from "@/components/ui/coming-soon";
12+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
13+import { ErrorAlert } from "@/components/ui/error-alert";
14+import { IconEye, IconPlus, IconUploadCloud } from "@/components/ui/icons";
15+import { Select } from "@/components/ui/select";
16+import { TableRowActions } from "@/components/ui/table-row-actions";
17+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
18+import { useT } from "@/stores/preferences-context";
19+
20+const ROSTER_PAGE_SIZE = 10;
21+
22+type StudentRow = { person: PersonRef; classes: ClassGroup[] };
23+
24+export default function StudentsRosterPage() {
25+ return (
26+ <RouteGuard minRole="manager">
27+ <StudentsRosterContent />
28+ </RouteGuard>
29+ );
30+}
31+
32+// ADM-02. The roster, class and term are real; topic mastery, plan adherence
33+// and the risk status are AI/analytics fields no endpoint serves, so their
34+// columns keep the design's slot and say "yakında" instead of a number.
35+function StudentsRosterContent() {
36+ const t = useT();
37+ const navigate = useNavigate();
38+ const [classFilter, setClassFilter] = createSignal("");
39+ const [termFilter, setTermFilter] = createSignal("");
40+
41+ const [data, { refetch }] = createResource(async () => {
42+ const [students, classes, terms] = await Promise.all([
43+ getUserSearch("", undefined, "student"),
44+ getClasses(),
45+ getTerms().catch(() => ({ items: [] })),
46+ ]);
47+ // No endpoint maps students to classes in bulk; one members read per class
48+ // is bounded by the class count, not the student count.
49+ const memberships = await Promise.all(
50+ classes.items.map(async (cls) => ({ cls, members: (await getClassMembers(cls.id)).items })),
51+ );
52+ const byStudent = new Map<string, ClassGroup[]>();
53+ for (const { cls, members } of memberships) {
54+ for (const member of members) byStudent.set(member.user.id, [...(byStudent.get(member.user.id) ?? []), cls]);
55+ }
56+ const rows: StudentRow[] = students.items.map((person) => ({ person, classes: byStudent.get(person.id) ?? [] }));
57+ return { rows, classes: classes.items, terms: terms.items };
58+ });
59+
60+ const rows = createMemo(() =>
61+ (data()?.rows ?? []).filter((row) => {
62+ if (classFilter() && !row.classes.some((cls) => cls.id === classFilter())) return false;
63+ if (termFilter() && !row.classes.some((cls) => cls.term === termFilter())) return false;
64+ return true;
65+ }),
66+ );
67+
68+ const open = (row: StudentRow) => void navigate({ to: "/profile/$userId", params: { userId: row.person.id } });
69+
70+ const columns = createMemo<ColumnDef<StudentRow>[]>(() => [
71+ {
72+ id: "student", size: 220,
73+ header: t("roster.student"),
74+ cell: (cell) => <RosterPersonCell person={cell.row.original.person} />,
75+ },
76+ {
77+ id: "class",
78+ size: 90,
79+ header: t("roster.class"),
80+ cell: (cell) => (
81+ <span class="truncate text-sm">{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span>
82+ ),
83+ },
84+ { id: "mastery", size: 130, header: t("roster.mastery"), enableSorting: false, cell: () => <ComingSoonValue /> },
85+ { id: "attendance", size: 130, header: t("roster.attendance"), enableSorting: false, cell: () => <ComingSoonValue /> },
86+ { id: "plan", size: 130, header: t("roster.planAdherence"), enableSorting: false, cell: () => <ComingSoonValue /> },
87+ { id: "status", size: 130, header: t("roster.status"), enableSorting: false, cell: () => <ComingSoonValue /> },
88+ {
89+ id: "actions",
90+ header: t("common.actions"),
91+ meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" },
92+ cell: (cell) => (
93+ <TableRowActions
94+ label={t("common.actions")}
95+ actions={[{ label: t("common.view"), icon: <IconEye class="h-4 w-4" />, onSelect: () => open(cell.row.original) }]}
96+ />
97+ ),
98+ },
99+ ]);
100+
101+ return (
102+ <div class="space-y-5">
103+ <Tabs value="all">
104+ <TabsList>
105+ <TabsTrigger value="all">{t("roster.tabAll")}</TabsTrigger>
106+ <For each={["roster.tabActive", "roster.tabNew", "roster.tabAtRisk", "roster.tabLeft"] as const}>
107+ {(key) => (
108+ <TabsTrigger value={key} disabled title={t("comingSoon.title")}>
109+ {t(key)}
110+ <ComingSoonBadge class="ml-1.5" />
111+ </TabsTrigger>
112+ )}
113+ </For>
114+ </TabsList>
115+ </Tabs>
116+
117+ <div class="flex flex-wrap items-start justify-between gap-3">
118+ <div class="space-y-1">
119+ <h1 class="text-2xl font-semibold tracking-tight text-text-strong">{t("nav.studentsRoster")}</h1>
120+ <p class="text-sm text-text-subtle">{t("roster.studentsSubtitle")}</p>
121+ </div>
122+ <div class="flex flex-wrap gap-2">
123+ <Button size="sm" variant="outline" class="min-w-[7.5rem] rounded-lg" disabled title={t("comingSoon.title")}>
124+ <IconUploadCloud class="h-4 w-4" />
125+ {t("roster.import")}
126+ <ComingSoonBadge class="ml-1.5" />
127+ </Button>
128+ <Button size="sm" class="min-w-[7.5rem] rounded-lg" disabled title={t("comingSoon.title")}>
129+ <IconPlus class="h-4 w-4" />
130+ {t("roster.addStudent")}
131+ <ComingSoonBadge class="ml-1.5" />
132+ </Button>
133+ </div>
134+ </div>
135+
136+ <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}>
137+ <Show when={data.error}>
138+ <ErrorAlert message={formatApiError(data.error)} onRetry={() => void refetch()} />
139+ </Show>
140+ <Show when={!data.error && data()}>
141+ {(value) => (
142+ <DataTable
143+ columns={columns()}
144+ data={rows()}
145+ tableClass="min-w-[940px]"
146+ empty={t("form.noStudents")}
147+ filterPlaceholder={t("roster.searchStudents")}
148+ searchPredicate={(row, query) =>
149+ [row.person.username, row.person.display_name ?? ""].join(" ").toLocaleLowerCase().includes(query.toLocaleLowerCase())
150+ }
151+ filters={
152+ <>
153+ <Select aria-label={t("roster.class")} value={classFilter()} onChange={(e) => setClassFilter(e.currentTarget.value)} wrapperClass="w-auto">
154+ <option value="">{t("roster.classAll")}</option>
155+ <For each={value().classes}>{(cls) => <option value={cls.id}>{cls.name}</option>}</For>
156+ </Select>
157+ <Select aria-label={t("roster.term")} value={termFilter()} onChange={(e) => setTermFilter(e.currentTarget.value)} wrapperClass="w-auto">
158+ <option value="">{t("roster.termAll")}</option>
159+ <For each={value().terms}>{(term) => <option value={term.id}>{term.name}</option>}</For>
160+ </Select>
161+ </>
162+ }
163+ enablePagination
164+ pageSize={ROSTER_PAGE_SIZE}
165+ storageKey="students-roster"
166+ onRowClick={open}
167+ />
168+ )}
169+ </Show>
170+ </Suspense>
171+ </div>
172+ );
173+}
src/pages/teachers-roster-page.tsxadded+134 -0
@@ -0,0 +1,134 @@
1+import { useNavigate } from "@tanstack/solid-router";
2+import type { ColumnDef } from "@tanstack/solid-table";
3+import { For, Show, Suspense, createMemo, createResource } from "solid-js";
4+import { getClasses } from "@/api/classes";
5+import { getUserSearch } from "@/api/users";
6+import { formatApiError, type PersonRef } from "@/api/client";
7+import { RouteGuard } from "@/components/layout/route-guard";
8+import { RosterPersonCell } from "@/components/users/roster-person-cell";
9+import { Button } from "@/components/ui/button";
10+import { ComingSoonBadge, ComingSoonValue } from "@/components/ui/coming-soon";
11+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
12+import { ErrorAlert } from "@/components/ui/error-alert";
13+import { IconEye, IconPlus, IconUploadCloud } from "@/components/ui/icons";
14+import { TableRowActions } from "@/components/ui/table-row-actions";
15+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
16+import { useT } from "@/stores/preferences-context";
17+
18+const ROSTER_PAGE_SIZE = 10;
19+
20+type TeacherRow = { person: PersonRef; homeroomClasses: number };
21+
22+export default function TeachersRosterPage() {
23+ return (
24+ <RouteGuard minRole="manager">
25+ <TeachersRosterContent />
26+ </RouteGuard>
27+ );
28+}
29+
30+// ADM-08. "Sınıf" is the number of classes the teacher is homeroom teacher of
31+// (ClassGroup.teacher); branch, weekly load, AI acceptance and employment
32+// status have no field anywhere, so they stay "yakında".
33+function TeachersRosterContent() {
34+ const t = useT();
35+ const navigate = useNavigate();
36+
37+ const [data, { refetch }] = createResource(async () => {
38+ const [teachers, classes] = await Promise.all([getUserSearch("", undefined, "teacher"), getClasses()]);
39+ const homeroom = new Map<string, number>();
40+ for (const cls of classes.items) {
41+ if (cls.teacher) homeroom.set(cls.teacher.id, (homeroom.get(cls.teacher.id) ?? 0) + 1);
42+ }
43+ return teachers.items.map<TeacherRow>((person) => ({ person, homeroomClasses: homeroom.get(person.id) ?? 0 }));
44+ });
45+
46+ const open = (row: TeacherRow) => void navigate({ to: "/profile/$userId", params: { userId: row.person.id } });
47+
48+ const columns = createMemo<ColumnDef<TeacherRow>[]>(() => [
49+ { id: "teacher", size: 220, header: t("roster.teacher"), cell: (cell) => <RosterPersonCell person={cell.row.original.person} /> },
50+ { id: "branch", size: 130, header: t("roster.branch"), enableSorting: false, cell: () => <ComingSoonValue /> },
51+ {
52+ accessorKey: "homeroomClasses",
53+ size: 90,
54+ header: t("roster.class"),
55+ meta: { cellClass: "mono tabular-nums" },
56+ cell: (cell) => (cell.row.original.homeroomClasses > 0 ? cell.row.original.homeroomClasses : "—"),
57+ },
58+ { id: "weekly", size: 130, header: t("roster.weeklyLessons"), enableSorting: false, cell: () => <ComingSoonValue /> },
59+ { id: "acceptance", size: 130, header: t("roster.suggestionAcceptance"), enableSorting: false, cell: () => <ComingSoonValue /> },
60+ { id: "status", size: 130, header: t("roster.status"), enableSorting: false, cell: () => <ComingSoonValue /> },
61+ {
62+ id: "actions",
63+ header: t("common.actions"),
64+ meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" },
65+ cell: (cell) => (
66+ <TableRowActions
67+ label={t("common.actions")}
68+ actions={[{ label: t("common.view"), icon: <IconEye class="h-4 w-4" />, onSelect: () => open(cell.row.original) }]}
69+ />
70+ ),
71+ },
72+ ]);
73+
74+ return (
75+ <div class="space-y-5">
76+ <Tabs value="all">
77+ <TabsList>
78+ <TabsTrigger value="all">{t("roster.tabAll")}</TabsTrigger>
79+ <For each={["roster.tabPermanent", "roster.tabContract", "roster.tabAdvisor"] as const}>
80+ {(key) => (
81+ <TabsTrigger value={key} disabled title={t("comingSoon.title")}>
82+ {t(key)}
83+ <ComingSoonBadge class="ml-1.5" />
84+ </TabsTrigger>
85+ )}
86+ </For>
87+ </TabsList>
88+ </Tabs>
89+
90+ <div class="flex flex-wrap items-start justify-between gap-3">
91+ <div class="space-y-1">
92+ <h1 class="text-2xl font-semibold tracking-tight text-text-strong">{t("nav.teachersRoster")}</h1>
93+ <p class="text-sm text-text-subtle">{t("roster.teachersSubtitle")}</p>
94+ </div>
95+ <div class="flex flex-wrap gap-2">
96+ <Button size="sm" variant="outline" class="min-w-[7.5rem] rounded-lg" disabled title={t("comingSoon.title")}>
97+ <IconUploadCloud class="h-4 w-4" />
98+ {t("roster.import")}
99+ <ComingSoonBadge class="ml-1.5" />
100+ </Button>
101+ <Button size="sm" class="min-w-[7.5rem] rounded-lg" disabled title={t("comingSoon.title")}>
102+ <IconPlus class="h-4 w-4" />
103+ {t("roster.addTeacher")}
104+ <ComingSoonBadge class="ml-1.5" />
105+ </Button>
106+ </div>
107+ </div>
108+
109+ <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}>
110+ <Show when={data.error}>
111+ <ErrorAlert message={formatApiError(data.error)} onRetry={() => void refetch()} />
112+ </Show>
113+ <Show when={!data.error && data()}>
114+ {(rows) => (
115+ <DataTable
116+ columns={columns()}
117+ data={rows()}
118+ tableClass="min-w-[940px]"
119+ empty={t("roster.noTeachers")}
120+ filterPlaceholder={t("roster.searchTeachers")}
121+ searchPredicate={(row, query) =>
122+ [row.person.username, row.person.display_name ?? ""].join(" ").toLocaleLowerCase().includes(query.toLocaleLowerCase())
123+ }
124+ enablePagination
125+ pageSize={ROSTER_PAGE_SIZE}
126+ storageKey="teachers-roster"
127+ onRowClick={open}
128+ />
129+ )}
130+ </Show>
131+ </Suspense>
132+ </div>
133+ );
134+}
src/pages/work-log-page.tsxmodified+1 -1
@@ -22,7 +22,7 @@ const WORK_PAGE_SIZE = 15;
2222
2323 export default function WorkLogPage() {
2424 return (
25- <RouteGuard minRole="teacher" maxRole="manager">
25+ <RouteGuard minRole="teacher">
2626 <WorkLogContent />
2727 </RouteGuard>
2828 );
src/routes/router.tsxmodified+71 -6
@@ -68,6 +68,12 @@ const PaymentStatementPage = lazyRoute(() => import("@/pages/payment-statement-p
6868 const WhiteboardsPage = lazyRoute(() => import("@/pages/whiteboards-page"));
6969 const WhiteboardPage = lazyRoute(() => import("@/pages/whiteboard-page"));
7070 const ComingSoonPage = lazyRoute(() => import("@/pages/coming-soon-page"));
71+const StudentsRosterPage = lazyRoute(() => import("@/pages/students-roster-page"));
72+const TeachersRosterPage = lazyRoute(() => import("@/pages/teachers-roster-page"));
73+const LicenseModulesPage = lazyRoute(() => import("@/pages/license-modules-page"));
74+const BuilderLoginPage = lazyRoute(() => import("@/pages/builder-login-page"));
75+const BuilderSchoolsPage = lazyRoute(() => import("@/pages/builder-schools-page"));
76+const BuilderSchoolDetailPage = lazyRoute(() => import("@/pages/builder-school-detail-page"));
7177
7278 function RootComponent() {
7379 return (
@@ -325,6 +331,24 @@ const myStudentsRoute = createRoute({
325331 component: MyStudentsPage,
326332 });
327333
334+const myStudentsAttendanceRoute = createRoute({
335+ getParentRoute: () => rootRoute,
336+ path: "/students/attendance",
337+ component: MyStudentsPage,
338+});
339+
340+const myStudentsExamsRoute = createRoute({
341+ getParentRoute: () => rootRoute,
342+ path: "/students/exams",
343+ component: MyStudentsPage,
344+});
345+
346+const myStudentsStudyRoute = createRoute({
347+ getParentRoute: () => rootRoute,
348+ path: "/students/study",
349+ component: MyStudentsPage,
350+});
351+
328352 const questionsRoute = createRoute({
329353 getParentRoute: () => rootRoute,
330354 path: "/questions",
@@ -391,6 +415,44 @@ const whiteboardRoute = createRoute({
391415 component: WhiteboardPage,
392416 });
393417
418+const studentsRosterRoute = createRoute({
419+ getParentRoute: () => rootRoute,
420+ path: "/management/students",
421+ component: StudentsRosterPage,
422+});
423+
424+const teachersRosterRoute = createRoute({
425+ getParentRoute: () => rootRoute,
426+ path: "/management/teachers",
427+ component: TeachersRosterPage,
428+});
429+
430+const licenseModulesRoute = createRoute({
431+ getParentRoute: () => rootRoute,
432+ path: "/management/modules",
433+ component: LicenseModulesPage,
434+});
435+
436+// The vendor surface: a builder session, not a school user, so none of these
437+// render the school shell's sidebar (there is no school user to draw it for).
438+const builderLoginRoute = createRoute({
439+ getParentRoute: () => rootRoute,
440+ path: "/builder/login",
441+ component: BuilderLoginPage,
442+});
443+
444+const builderSchoolsRoute = createRoute({
445+ getParentRoute: () => rootRoute,
446+ path: "/builder",
447+ component: BuilderSchoolsPage,
448+});
449+
450+const builderSchoolDetailRoute = createRoute({
451+ getParentRoute: () => rootRoute,
452+ path: "/builder/schools/$slug",
453+ component: BuilderSchoolDetailPage,
454+});
455+
394456 // One route per Figma menu entry with no backend yet — each gets its own URL
395457 // (so breadcrumbs, back and direct links behave normally) but all render the
396458 // same "not ready" page. Slugs are read back by coming-soon-page.tsx.
@@ -400,17 +462,11 @@ const COMING_SOON_SLUGS = [
400462 "deneme-sinavlari",
401463 "optik-okuma",
402464 "raporlar",
403- "lisans-modulleri",
404465 "kvkk-denetim",
405- "ogrenciler",
406- "ogretmenler",
407466 "ogrenci-analizi",
408467 "bekleyen-onaylar",
409468 "soru-uretimi",
410469 "calisma-programim",
411- "devamsizlik",
412- "sinav-sonuclari-veli",
413- "calisma-plani",
414470 ] as const;
415471
416472 const comingSoonRoutes = COMING_SOON_SLUGS.map((slug) =>
@@ -457,6 +513,9 @@ const routeTree = rootRoute.addChildren([
457513 adminUserDetailRoute,
458514 guideRoute,
459515 myStudentsRoute,
516+ myStudentsAttendanceRoute,
517+ myStudentsExamsRoute,
518+ myStudentsStudyRoute,
460519 questionsRoute,
461520 questionDetailRoute,
462521 calendarRoute,
@@ -468,6 +527,12 @@ const routeTree = rootRoute.addChildren([
468527 paymentStatementRoute,
469528 whiteboardsRoute,
470529 whiteboardRoute,
530+ studentsRosterRoute,
531+ teachersRosterRoute,
532+ licenseModulesRoute,
533+ builderLoginRoute,
534+ builderSchoolsRoute,
535+ builderSchoolDetailRoute,
471536 myProfileRoute,
472537 userProfileRoute,
473538 ...comingSoonRoutes,
src/stores/builder-context.tsxadded+54 -0
@@ -0,0 +1,54 @@
1+import { type Accessor, type ParentProps, createContext, createResource, useContext } from "solid-js";
2+import { getBuilderMe, postBuilderLogout } from "@/api/builder";
3+import { ApiError, type Builder } from "@/api/client";
4+
5+type BuilderContextValue = {
6+ /** undefined while resolving, null when this browser holds no builder session. */
7+ builder: Accessor<Builder | null | undefined>;
8+ loading: Accessor<boolean>;
9+ error: Accessor<unknown>;
10+ refresh: () => void;
11+ logout: () => Promise<void>;
12+};
13+
14+const BuilderContext = createContext<BuilderContextValue>();
15+
16+/**
17+ * The deployment operator's session. Separate from AuthProvider on purpose: a
18+ * builder cookie is 401 on every school route and a school cookie is 401 here,
19+ * so the two never describe the same browser at once.
20+ */
21+export function BuilderProvider(props: ParentProps) {
22+ let failure: unknown = null;
23+ const [me, { refetch, mutate }] = createResource(async () => {
24+ failure = null;
25+ try {
26+ return await getBuilderMe();
27+ } catch (err) {
28+ if (!(err instanceof ApiError && err.status === 401)) failure = err;
29+ return null;
30+ }
31+ });
32+
33+ const value: BuilderContextValue = {
34+ builder: () => me(),
35+ loading: () => me.loading,
36+ error: () => (me() === null ? failure : null),
37+ refresh: () => void refetch(),
38+ logout: async () => {
39+ try {
40+ await postBuilderLogout();
41+ } finally {
42+ mutate(null);
43+ }
44+ },
45+ };
46+
47+ return <BuilderContext.Provider value={value}>{props.children}</BuilderContext.Provider>;
48+}
49+
50+export function useBuilder(): BuilderContextValue {
51+ const ctx = useContext(BuilderContext);
52+ if (!ctx) throw new Error("useBuilder must be used within BuilderProvider");
53+ return ctx;
54+}