import { notFound } from "next/navigation" import type { Metadata } from "next" import type { JSX } from "react" import { getTranslations } from "next-intl/server" import { getCoursePlanById, getSubjectOptions } from "@/modules/course-plans/data-access" import { getAdminClasses } from "@/modules/classes/data-access" import { getAcademicYears, getStaffOptions } from "@/modules/school/data-access" import { CoursePlanForm } from "@/modules/course-plans/components/course-plan-form" export async function generateMetadata(): Promise { const t = await getTranslations("coursePlans") return { title: `${t("edit.title")} - Next_Edu`, description: t("edit.description"), } } export const dynamic = "force-dynamic" export default async function EditCoursePlanPage({ params, }: { params: Promise<{ id: string }> }): Promise { const t = await getTranslations("coursePlans") const { id } = await params const [plan, classes, subjects, teachers, academicYears] = await Promise.all([ getCoursePlanById(id), getAdminClasses(), getSubjectOptions(), getStaffOptions(), getAcademicYears(), ]) if (!plan) notFound() return (

{t("edit.title")}

{t("edit.description")}

({ id: c.id, name: c.name }))} subjects={subjects} teachers={teachers.map((t) => ({ id: t.id, name: t.name }))} academicYears={academicYears.map((y) => ({ id: y.id, name: y.name }))} backHref={`/admin/course-plans/${plan.id}`} />
) }