diff --git a/routes/(apps)/mobility/(_islands)/ConsultStudents_test.tsx b/routes/(apps)/mobility/(_islands)/ConsultStudents_test.tsx deleted file mode 100644 index 3e008bc..0000000 --- a/routes/(apps)/mobility/(_islands)/ConsultStudents_test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { useEffect, useState } from "preact/hooks"; - -interface Promotion { - id: number; - name: string; -} - -interface Student { - id: number; - firstName: string; - lastName: string; - mail: string; - promotionId: number; - promotionName: string; -} - -export default function ConsultStudents_test() { - const [data, setData] = useState< - { promotions: Promotion[]; students: Student[] } | null - >(null); - const [error, setError] = useState(null); - - useEffect(() => { - const fetchData = async () => { - try { - const response = await fetch("/students/api/insert_students"); - if (!response.ok) { - throw new Error(`Error fetching data: ${response.statusText}`); - } - - const result = await response.json(); - setData(result); - } catch (err) { - console.error("Error fetching data:", err); - setError("Failed to load data. Please try again later."); - } - }; - - fetchData(); - }, []); - - return ( -
-

Consult Students

- {error &&

{error}

} - {data?.promotions.map((promo) => ( -
-

Promotion: {promo.id}

- - - - - - - - - - - {data.students - .filter((student) => student.promotionId === promo.id) - .map((student) => ( - - - - - - - ))} - -
IDFirst NameLast NameEmail
{student.id}{student.firstName}{student.lastName}{student.mail}
-
- ))} -
- ); -} diff --git a/routes/(apps)/mobility/(_props)/props.ts b/routes/(apps)/mobility/(_props)/props.ts index 75a91b4..ddaf97c 100644 --- a/routes/(apps)/mobility/(_props)/props.ts +++ b/routes/(apps)/mobility/(_props)/props.ts @@ -8,9 +8,8 @@ const properties: AppProperties = { index: "Homepage", overview: "Mobility overview", edit_mobility: "Mobility management", - consult_students_test: "Test consult students", }, - adminOnly: ["edit_mobility", "consult_students_test"], + adminOnly: ["edit_mobility"], }; export default properties; diff --git a/routes/(apps)/mobility/partials/(admin)/consult_students_test.tsx b/routes/(apps)/mobility/partials/(admin)/consult_students_test.tsx deleted file mode 100644 index 8727e5d..0000000 --- a/routes/(apps)/mobility/partials/(admin)/consult_students_test.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import ConsultStudents_test from "$root/routes/(apps)/mobility/(_islands)/ConsultStudents_test.tsx"; -import { - getPartialsConfig, - makePartials, -} from "$root/defaults/makePartials.tsx"; -import { FreshContext } from "$fresh/server.ts"; -import { State } from "$root/routes/_middleware.ts"; -//import EditStudents from "../(_islands)/EditStudents.tsx"; - -// deno-lint-ignore require-await -async function Mobility(_request: Request, _context: FreshContext) { - return ( - <> -

Test consult students

- - - ); -} - -export const config = getPartialsConfig(); -export default makePartials(Mobility); diff --git a/routes/(apps)/mobility/partials/overview.tsx b/routes/(apps)/mobility/partials/overview.tsx index c8775a6..e2d7955 100644 --- a/routes/(apps)/mobility/partials/overview.tsx +++ b/routes/(apps)/mobility/partials/overview.tsx @@ -10,7 +10,7 @@ import { State } from "$root/routes/_middleware.ts"; async function Mobility(_request: Request, _context: FreshContext) { return ( <> -

Edit mobility

+

Mobility overview

);