Ship three fully-wired admin areas end-to-end with APIs, seeds, tests and docs. Backend (new `encoach_lms_api` addon + existing addons): - Institutional: academic years/terms, departments, admission registers & admissions, courses/batches, lessons, fees (terms + student fees + invoicing with income-account auto-wiring), gradebook (assignments/grades), library, facilities (encoach.asset), student leave, result templates + marksheets (incl. delete-with-cascade). - Support: `encoach.ticket` model + CRUD/assignee routes; payment records derived from `op.student.fees.details` and `account.move`; platform settings backed by `encoach.code` and `ir.config_parameter` (packages + grading config). - Training: `encoach.vocab.item` + `encoach.grammar.rule` (plus progress models) with CRUD, pagination, search/level filters, and upsert-style progress endpoints. Odoo 19 compatibility: `_sql_constraints` replaced with `@api.constrains`; `ValidationError`/`UserError` mapped to HTTP 400. Frontend: - Rewire institutional admin pages (Academic Year Manager, Admissions, Courses, Lessons, Fees, Gradebook, Library, Facilities, Student Leave, Marksheets, Taxonomy, Resources) to real APIs with React Query invalidation and dialogs. - New typed services: `payments.service.ts`, `platformSettings.service.ts`, `training.service.ts`. Updated `fees/gradebook/lms/courseware/taxonomy/ resources/student-progress/generation` services + related types. - Rewrite `VocabularyPage`, `GrammarPage`, `PaymentRecordPage`, `SettingsPage`, `TicketsPage` to consume live data with search/filter/progress/CRUD flows. - New shared components: `TaxonomyCascade`, `MaterialViewer`, `teacher/TeacherLibrary`. - Favicons/branding assets and misc. UX polish across teacher/student pages. Tooling & QA: - Seeders: `seed_demo.py`, `seed_demo_data.py`, `seed_institutional.py` (idempotent, covers institutional + support + training fixtures incl. income-account wiring). - API write-flow test suites: `test_write_flows.py` (institutional), `test_support_flows.py` (support), `test_training_flows.py` (training), `test_ai_full.py`. All suites pass end-to-end. - Docs: add `docs/PROJECT_SUMMARY.md` with per-section scope, artifacts and QA. - `.gitignore`: ignore `pgdata_bak_*/`, `frontend/.vite/`, `frontend/dist/`, `frontend/node_modules/`. Made-with: Cursor
71 lines
3.4 KiB
TypeScript
71 lines
3.4 KiB
TypeScript
import { Card, CardContent } from "@/components/ui/card";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Progress } from "@/components/ui/progress";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Link } from "react-router-dom";
|
|
import { useMyEnrolledCourses } from "@/hooks/queries";
|
|
import { BookOpen, Users, Play } from "lucide-react";
|
|
import AiTipBanner from "@/components/ai/AiTipBanner";
|
|
|
|
export default function StudentCourses() {
|
|
const { data: enrolledData, isLoading } = useMyEnrolledCourses();
|
|
const myCourses = enrolledData?.items ?? [];
|
|
if (isLoading) return <div className="flex items-center justify-center min-h-[400px]"><div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary" /></div>;
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h1 className="text-2xl font-bold">My Courses</h1>
|
|
<p className="text-muted-foreground">Browse and continue your enrolled courses.</p>
|
|
</div>
|
|
|
|
<AiTipBanner context="student-courses" variant="recommendation" />
|
|
|
|
{myCourses.length === 0 ? (
|
|
<div className="text-center py-12">
|
|
<BookOpen className="h-12 w-12 text-muted-foreground mx-auto mb-4" />
|
|
<h3 className="text-lg font-semibold">No Enrolled Courses</h3>
|
|
<p className="text-muted-foreground mt-1">You haven't been enrolled in any courses yet. Contact your administrator.</p>
|
|
</div>
|
|
) : (
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
{myCourses.map((c) => (
|
|
<Link to={`/student/courses/${c.id}`} key={c.id}>
|
|
<Card className="hover:shadow-md transition-shadow h-full">
|
|
<div className="h-2 rounded-t-lg bg-primary" />
|
|
<CardContent className="pt-5 space-y-4">
|
|
<div>
|
|
<div className="flex items-center justify-between mb-1">
|
|
<Badge variant="secondary" className="text-xs">
|
|
{c.progress === 100 ? "Completed" : c.progress > 0 ? "In Progress" : "Not Started"}
|
|
</Badge>
|
|
<Badge variant="outline" className="text-xs">{c.code}</Badge>
|
|
</div>
|
|
<h3 className="font-semibold mt-2">{c.title || c.name}</h3>
|
|
<p className="text-sm text-muted-foreground mt-1 line-clamp-2">{c.description}</p>
|
|
</div>
|
|
<div className="flex items-center gap-4 text-xs text-muted-foreground">
|
|
<span className="flex items-center gap-1"><BookOpen className="h-3 w-3" />{c.chapter_count} chapters</span>
|
|
<span className="flex items-center gap-1"><Users className="h-3 w-3" />{c.student_count} students</span>
|
|
</div>
|
|
<div>
|
|
<div className="flex justify-between text-xs mb-1">
|
|
<span className="text-muted-foreground">Progress</span>
|
|
<span className="font-medium">{c.progress}%</span>
|
|
</div>
|
|
<Progress value={c.progress} className="h-2" />
|
|
</div>
|
|
<Button variant="outline" className="w-full" size="sm">
|
|
<Play className="mr-2 h-3 w-3" />
|
|
{c.progress > 0 ? "Continue Learning" : "Start Learning"}
|
|
</Button>
|
|
</CardContent>
|
|
</Card>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|