mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
add: more commits
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useMemo, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import api from "@/utils/api.util";
|
||||
|
||||
import { useCourses } from "@/contexts/AdminCoursesContext";
|
||||
import { useAuth } from "@/contexts/AuthContext";
|
||||
@@ -119,6 +120,16 @@ export default function CoursesTable() {
|
||||
onArchive={(c) => archiveCourse(c?.course_id)}
|
||||
loading={loading}
|
||||
onSuccess={handleArchiveSuccess}
|
||||
onImpactCheck={async () => {
|
||||
const { data } = await api.get(
|
||||
`/admin/courses/${archiveTarget?.course_id}/archive-impact`
|
||||
);
|
||||
const { activeCount, totalCount } = data?.data ?? {};
|
||||
return [
|
||||
{ label: "student(s) are currently taking this course", count: activeCount ?? 0 },
|
||||
{ label: "student(s) have progress in this course", count: totalCount ?? 0 },
|
||||
];
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* ── Bulk archive ── */}
|
||||
|
||||
Reference in New Issue
Block a user