Moved all student management tools into student app for global uses (working)
This commit is contained in:
+21
-17
@@ -3,20 +3,21 @@
|
|||||||
// This file is automatically updated during development when running `dev.ts`.
|
// This file is automatically updated during development when running `dev.ts`.
|
||||||
|
|
||||||
import * as $_apps_layout from "./routes/(apps)/_layout.tsx";
|
import * as $_apps_layout from "./routes/(apps)/_layout.tsx";
|
||||||
import * as $_apps_mobility_api_insert_students from "./routes/(apps)/mobility/api/insert_students.ts";
|
|
||||||
import * as $_apps_mobility_index from "./routes/(apps)/mobility/index.tsx";
|
import * as $_apps_mobility_index from "./routes/(apps)/mobility/index.tsx";
|
||||||
import * as $_apps_mobility_partials_admin_mobility from "./routes/(apps)/mobility/partials/(admin)/mobility.tsx";
|
import * as $_apps_mobility_partials_admin_mobility from "./routes/(apps)/mobility/partials/(admin)/mobility.tsx";
|
||||||
import * as $_apps_mobility_partials_index from "./routes/(apps)/mobility/partials/index.tsx";
|
import * as $_apps_mobility_partials_index from "./routes/(apps)/mobility/partials/index.tsx";
|
||||||
import * as $_apps_mobility_partials_overview from "./routes/(apps)/mobility/partials/overview.tsx";
|
import * as $_apps_mobility_partials_overview from "./routes/(apps)/mobility/partials/overview.tsx";
|
||||||
import * as $_apps_mobility_partials_students from "./routes/(apps)/mobility/partials/students.tsx";
|
|
||||||
import * as $_apps_notes_index from "./routes/(apps)/notes/index.tsx";
|
import * as $_apps_notes_index from "./routes/(apps)/notes/index.tsx";
|
||||||
import * as $_apps_notes_partials_admin_courses from "./routes/(apps)/notes/partials/(admin)/courses.tsx";
|
import * as $_apps_notes_partials_admin_courses from "./routes/(apps)/notes/partials/(admin)/courses.tsx";
|
||||||
import * as $_apps_notes_partials_admin_students from "./routes/(apps)/notes/partials/(admin)/students.tsx";
|
import * as $_apps_notes_partials_admin_students from "./routes/(apps)/notes/partials/(admin)/students.tsx";
|
||||||
import * as $_apps_notes_partials_index from "./routes/(apps)/notes/partials/index.tsx";
|
import * as $_apps_notes_partials_index from "./routes/(apps)/notes/partials/index.tsx";
|
||||||
import * as $_apps_notes_partials_notes from "./routes/(apps)/notes/partials/notes.tsx";
|
import * as $_apps_notes_partials_notes from "./routes/(apps)/notes/partials/notes.tsx";
|
||||||
import * as $_apps_students_api_example from "./routes/(apps)/students/api/example.ts";
|
import * as $_apps_students_api_insert_students from "./routes/(apps)/students/api/insert_students.ts";
|
||||||
import * as $_apps_students_index from "./routes/(apps)/students/index.tsx";
|
import * as $_apps_students_index from "./routes/(apps)/students/index.tsx";
|
||||||
|
import * as $_apps_students_partials_admin_consult from "./routes/(apps)/students/partials/(admin)/consult.tsx";
|
||||||
|
import * as $_apps_students_partials_admin_upload from "./routes/(apps)/students/partials/(admin)/upload.tsx";
|
||||||
import * as $_apps_students_partials_index from "./routes/(apps)/students/partials/index.tsx";
|
import * as $_apps_students_partials_index from "./routes/(apps)/students/partials/index.tsx";
|
||||||
|
import * as $_apps_students_partials_overview from "./routes/(apps)/students/partials/overview.tsx";
|
||||||
import * as $_404 from "./routes/_404.tsx";
|
import * as $_404 from "./routes/_404.tsx";
|
||||||
import * as $_app from "./routes/_app.tsx";
|
import * as $_app from "./routes/_app.tsx";
|
||||||
import * as $_middleware from "./routes/_middleware.ts";
|
import * as $_middleware from "./routes/_middleware.ts";
|
||||||
@@ -28,18 +29,16 @@ import * as $logout from "./routes/logout.tsx";
|
|||||||
import * as $_islands_AppNavigator from "./routes/(_islands)/AppNavigator.tsx";
|
import * as $_islands_AppNavigator from "./routes/(_islands)/AppNavigator.tsx";
|
||||||
import * as $_islands_Navbar from "./routes/(_islands)/Navbar.tsx";
|
import * as $_islands_Navbar from "./routes/(_islands)/Navbar.tsx";
|
||||||
import * as $_apps_mobility_islands_ConsultMobility from "./routes/(apps)/mobility/(_islands)/ConsultMobility.tsx";
|
import * as $_apps_mobility_islands_ConsultMobility from "./routes/(apps)/mobility/(_islands)/ConsultMobility.tsx";
|
||||||
import * as $_apps_mobility_islands_ConsultStudents from "./routes/(apps)/mobility/(_islands)/ConsultStudents.tsx";
|
|
||||||
import * as $_apps_mobility_islands_EditMobility from "./routes/(apps)/mobility/(_islands)/EditMobility.tsx";
|
import * as $_apps_mobility_islands_EditMobility from "./routes/(apps)/mobility/(_islands)/EditMobility.tsx";
|
||||||
import * as $_apps_mobility_islands_EditStudents from "./routes/(apps)/mobility/(_islands)/EditStudents.tsx";
|
|
||||||
import * as $_apps_mobility_islands_ImportFile from "./routes/(apps)/mobility/(_islands)/ImportFile.tsx";
|
import * as $_apps_mobility_islands_ImportFile from "./routes/(apps)/mobility/(_islands)/ImportFile.tsx";
|
||||||
import * as $_apps_mobility_islands_UploadStudents from "./routes/(apps)/mobility/(_islands)/UploadStudents.tsx";
|
import * as $_apps_students_islands_ConsultStudents from "./routes/(apps)/students/(_islands)/ConsultStudents.tsx";
|
||||||
|
import * as $_apps_students_islands_EditStudents from "./routes/(apps)/students/(_islands)/EditStudents.tsx";
|
||||||
|
import * as $_apps_students_islands_UploadStudents from "./routes/(apps)/students/(_islands)/UploadStudents.tsx";
|
||||||
import type { Manifest } from "$fresh/server.ts";
|
import type { Manifest } from "$fresh/server.ts";
|
||||||
|
|
||||||
const manifest = {
|
const manifest = {
|
||||||
routes: {
|
routes: {
|
||||||
"./routes/(apps)/_layout.tsx": $_apps_layout,
|
"./routes/(apps)/_layout.tsx": $_apps_layout,
|
||||||
"./routes/(apps)/mobility/api/insert_students.ts":
|
|
||||||
$_apps_mobility_api_insert_students,
|
|
||||||
"./routes/(apps)/mobility/index.tsx": $_apps_mobility_index,
|
"./routes/(apps)/mobility/index.tsx": $_apps_mobility_index,
|
||||||
"./routes/(apps)/mobility/partials/(admin)/mobility.tsx":
|
"./routes/(apps)/mobility/partials/(admin)/mobility.tsx":
|
||||||
$_apps_mobility_partials_admin_mobility,
|
$_apps_mobility_partials_admin_mobility,
|
||||||
@@ -47,8 +46,6 @@ const manifest = {
|
|||||||
$_apps_mobility_partials_index,
|
$_apps_mobility_partials_index,
|
||||||
"./routes/(apps)/mobility/partials/overview.tsx":
|
"./routes/(apps)/mobility/partials/overview.tsx":
|
||||||
$_apps_mobility_partials_overview,
|
$_apps_mobility_partials_overview,
|
||||||
"./routes/(apps)/mobility/partials/students.tsx":
|
|
||||||
$_apps_mobility_partials_students,
|
|
||||||
"./routes/(apps)/notes/index.tsx": $_apps_notes_index,
|
"./routes/(apps)/notes/index.tsx": $_apps_notes_index,
|
||||||
"./routes/(apps)/notes/partials/(admin)/courses.tsx":
|
"./routes/(apps)/notes/partials/(admin)/courses.tsx":
|
||||||
$_apps_notes_partials_admin_courses,
|
$_apps_notes_partials_admin_courses,
|
||||||
@@ -56,10 +53,17 @@ const manifest = {
|
|||||||
$_apps_notes_partials_admin_students,
|
$_apps_notes_partials_admin_students,
|
||||||
"./routes/(apps)/notes/partials/index.tsx": $_apps_notes_partials_index,
|
"./routes/(apps)/notes/partials/index.tsx": $_apps_notes_partials_index,
|
||||||
"./routes/(apps)/notes/partials/notes.tsx": $_apps_notes_partials_notes,
|
"./routes/(apps)/notes/partials/notes.tsx": $_apps_notes_partials_notes,
|
||||||
"./routes/(apps)/students/api/example.ts": $_apps_students_api_example,
|
"./routes/(apps)/students/api/insert_students.ts":
|
||||||
|
$_apps_students_api_insert_students,
|
||||||
"./routes/(apps)/students/index.tsx": $_apps_students_index,
|
"./routes/(apps)/students/index.tsx": $_apps_students_index,
|
||||||
|
"./routes/(apps)/students/partials/(admin)/consult.tsx":
|
||||||
|
$_apps_students_partials_admin_consult,
|
||||||
|
"./routes/(apps)/students/partials/(admin)/upload.tsx":
|
||||||
|
$_apps_students_partials_admin_upload,
|
||||||
"./routes/(apps)/students/partials/index.tsx":
|
"./routes/(apps)/students/partials/index.tsx":
|
||||||
$_apps_students_partials_index,
|
$_apps_students_partials_index,
|
||||||
|
"./routes/(apps)/students/partials/overview.tsx":
|
||||||
|
$_apps_students_partials_overview,
|
||||||
"./routes/_404.tsx": $_404,
|
"./routes/_404.tsx": $_404,
|
||||||
"./routes/_app.tsx": $_app,
|
"./routes/_app.tsx": $_app,
|
||||||
"./routes/_middleware.ts": $_middleware,
|
"./routes/_middleware.ts": $_middleware,
|
||||||
@@ -74,16 +78,16 @@ const manifest = {
|
|||||||
"./routes/(_islands)/Navbar.tsx": $_islands_Navbar,
|
"./routes/(_islands)/Navbar.tsx": $_islands_Navbar,
|
||||||
"./routes/(apps)/mobility/(_islands)/ConsultMobility.tsx":
|
"./routes/(apps)/mobility/(_islands)/ConsultMobility.tsx":
|
||||||
$_apps_mobility_islands_ConsultMobility,
|
$_apps_mobility_islands_ConsultMobility,
|
||||||
"./routes/(apps)/mobility/(_islands)/ConsultStudents.tsx":
|
|
||||||
$_apps_mobility_islands_ConsultStudents,
|
|
||||||
"./routes/(apps)/mobility/(_islands)/EditMobility.tsx":
|
"./routes/(apps)/mobility/(_islands)/EditMobility.tsx":
|
||||||
$_apps_mobility_islands_EditMobility,
|
$_apps_mobility_islands_EditMobility,
|
||||||
"./routes/(apps)/mobility/(_islands)/EditStudents.tsx":
|
|
||||||
$_apps_mobility_islands_EditStudents,
|
|
||||||
"./routes/(apps)/mobility/(_islands)/ImportFile.tsx":
|
"./routes/(apps)/mobility/(_islands)/ImportFile.tsx":
|
||||||
$_apps_mobility_islands_ImportFile,
|
$_apps_mobility_islands_ImportFile,
|
||||||
"./routes/(apps)/mobility/(_islands)/UploadStudents.tsx":
|
"./routes/(apps)/students/(_islands)/ConsultStudents.tsx":
|
||||||
$_apps_mobility_islands_UploadStudents,
|
$_apps_students_islands_ConsultStudents,
|
||||||
|
"./routes/(apps)/students/(_islands)/EditStudents.tsx":
|
||||||
|
$_apps_students_islands_EditStudents,
|
||||||
|
"./routes/(apps)/students/(_islands)/UploadStudents.tsx":
|
||||||
|
$_apps_students_islands_UploadStudents,
|
||||||
},
|
},
|
||||||
baseUrl: import.meta.url,
|
baseUrl: import.meta.url,
|
||||||
} satisfies Manifest;
|
} satisfies Manifest;
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ const properties: AppProperties = {
|
|||||||
index: "Homepage",
|
index: "Homepage",
|
||||||
overview: "Mobility overview",
|
overview: "Mobility overview",
|
||||||
mobility: "Mobility management",
|
mobility: "Mobility management",
|
||||||
students: "Students management",
|
|
||||||
},
|
},
|
||||||
adminOnly: ["students"],
|
adminOnly: ["mobility"],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default properties;
|
export default properties;
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import { RouteConfig } from "$fresh/server.ts";
|
|
||||||
import UploadStudents from "../(_islands)/UploadStudents.tsx";
|
|
||||||
import ConsultStudents from "../(_islands)/ConsultStudents.tsx";
|
|
||||||
//import EditStudents from "../(_islands)/EditStudents.tsx";
|
|
||||||
|
|
||||||
export const config: RouteConfig = {
|
|
||||||
skipAppWrapper: false,
|
|
||||||
skipInheritedLayouts: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Students() {
|
|
||||||
return (
|
|
||||||
<section id="students-page">
|
|
||||||
<h1>Manage Promotions</h1>
|
|
||||||
<UploadStudents />
|
|
||||||
<hr />
|
|
||||||
<ConsultStudents />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
+1
-1
@@ -21,7 +21,7 @@ export default function ConsultStudents() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/mobility/api/insert_students");
|
const response = await fetch("/students/api/insert_students");
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Error fetching data: ${response.statusText}`);
|
throw new Error(`Error fetching data: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -37,7 +37,7 @@ export default function UploadStudents() {
|
|||||||
range: 1, // Ignorer les en-têtes
|
range: 1, // Ignorer les en-têtes
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await fetch("/mobility/api/insert_students", {
|
const response = await fetch("/students/api/insert_students", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ promoName: sheetName, data }),
|
body: JSON.stringify({ promoName: sheetName, data }),
|
||||||
@@ -5,10 +5,12 @@ const properties: AppProperties = {
|
|||||||
icon: "badge",
|
icon: "badge",
|
||||||
pages: {
|
pages: {
|
||||||
index: "Homepage",
|
index: "Homepage",
|
||||||
|
overview: "Students overview",
|
||||||
upload: "Upload students",
|
upload: "Upload students",
|
||||||
|
consult: "Consult students"
|
||||||
},
|
},
|
||||||
adminOnly: ["upload"],
|
adminOnly: ["upload", "consult"],
|
||||||
hint: "See student information",
|
hint: "Create students promotion and see informations",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default properties;
|
export default properties;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import { Handlers } from "$fresh/server.ts";
|
|
||||||
|
|
||||||
export const handler: Handlers = {
|
|
||||||
async POST(request, context) {
|
|
||||||
if (request.headers.get("content-type") != "application/json") {
|
|
||||||
return new Response(null, {
|
|
||||||
status: 400,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const responseBody = {
|
|
||||||
requestBody: await request.json(),
|
|
||||||
context,
|
|
||||||
};
|
|
||||||
|
|
||||||
return new Response(JSON.stringify(responseBody), {
|
|
||||||
headers: {
|
|
||||||
"content-type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import ConsultStudents from "$root/routes/(apps)/students/(_islands)/ConsultStudents.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";
|
||||||
|
|
||||||
|
async function Students(_request: Request, _context: FreshContext<State>) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>Manage Promotions</h1>
|
||||||
|
<ConsultStudents />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = getPartialsConfig();
|
||||||
|
export default makePartials(Students);
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import UploadStudents from "$root/routes/(apps)/students/(_islands)/UploadStudents.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";
|
||||||
|
|
||||||
|
async function Students(_request: Request, _context: FreshContext<State>) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>Manage Promotions</h1>
|
||||||
|
<UploadStudents />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config = getPartialsConfig();
|
||||||
|
export default makePartials(Students);
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { Partial } from "$fresh/runtime.ts";
|
||||||
|
import { RouteConfig } from "$fresh/server.ts";
|
||||||
|
|
||||||
|
type ModulesProps = Record<string | number | symbol, never>;
|
||||||
|
|
||||||
|
export const config: RouteConfig = {
|
||||||
|
skipAppWrapper: true,
|
||||||
|
skipInheritedLayouts: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Modules(_props: ModulesProps) {
|
||||||
|
return (
|
||||||
|
<Partial name="body">
|
||||||
|
<a href="students" f-partial={"notes/partials"}>students</a>
|
||||||
|
</Partial>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user