[] = [
- {
- accessorKey: "sn",
- header: "SN",
- cell: ({ row }) => (
- {row.index + 1}
- ),
- },
- {
- id: 'name',
- accessorFn: (row: any) => row.original?.data,
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => (
-
-
-
-
-
{row?.original?.firstName}
-
- ),
- },
- {
- id: 'email',
- accessorFn: (row: any) => row.original?.email,
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => (
- {row.original?.email}
- ),
- },
- {
- id: 'dateOfBirth',
- accessorFn: (row: any) => row.original?.dateOfBirth,
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => (
- {row.original?.dateOfBirth}
- ),
- },
- {
- id: 'isActivated',
- accessorFn: (row: any) => row.original?.isActivated,
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => (
- {row.original?.isActivated ? Active : Deactive}
- ),
- },
- {
- id: 'last_online_at',
- accessorFn: (row: any) => row.original?.lastOnline,
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => (
-
- {row.original?.lastOnline ?? '-'}
-
- ),
- },
-]
- return(
- <>
-
- >
- )
+ const columns: ColumnDef[] = [
+ {
+ accessorKey: "sn",
+ header: "SN",
+ cell: ({ row }) => (
+ {row.index + 1}
+ ),
+ },
+ {
+ id: 'name',
+ accessorFn: (row: any) => row.original?.name,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+
+
+
+
+
{row.original?.name}
+
+ ),
+ },
+ {
+ id: 'description',
+ accessorFn: (row: any) => row.original?.description,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+ {row.original?.description ?? '-'}
+ ),
+ },
+ {
+ id: 'author',
+ accessorFn: (row: any) => row.original?.author?.firstName,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+ {row.original?.author?.firstName} {row.original?.author?.lastName}
+ ),
+ },
+ {
+ id: 'category',
+ accessorFn: (row: any) => row.original?.category?.name,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+ {row.original?.category?.name}
+ ),
+ },
+ {
+ id: 'creationDate',
+ accessorFn: (row: any) => row.original?.creationDate,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+
+ {row.original?.creationDate ? new Date(row.original.creationDate).toLocaleDateString() : '-'}
+
+ ),
+ },
+ {
+ id: 'isActive',
+ accessorFn: (row: any) => row.original?.isActive,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+ {row.original?.isActive ? Active : Deactive}
+ ),
+ },
+ {
+ id: 'totalEnrolled',
+ accessorFn: (row: any) => row.original?.totalEnrolled,
+ header: ({ column }) => (
+
+ ),
+ cell: ({ row }) => (
+
+ {row.original?.totalEnrolled ?? '-'}
+
+ ),
+ },
+ ]
+
+ return(
+ <>
+
+ >
+ )
}
-export default UserTable
\ No newline at end of file
+export default CourseTable
\ No newline at end of file
diff --git a/frontend/edu-connect/src/app/(admin)/admin/course/page.tsx b/frontend/edu-connect/src/app/(admin)/admin/course/page.tsx
index 77c56fa..3f840e6 100644
--- a/frontend/edu-connect/src/app/(admin)/admin/course/page.tsx
+++ b/frontend/edu-connect/src/app/(admin)/admin/course/page.tsx
@@ -1,7 +1,5 @@
'use client'
-import UserTabContent from "@/app/user/profile/_partials/UserTabContent"
import BreadCrumbNav from "@/components/(dashboard)/common/BreadCumbNav/BreadCrumbNav"
-import DataTable from "@/components/(dashboard)/common/DataTable/DataTable"
import ContentContainer from "@/components/(dashboard)/elements/ContentContainer"
import { PageHeading } from "@/components/(dashboard)/ui/title"
import CommonContainer from "@/components/elements/CommonContainer"
@@ -11,46 +9,40 @@ import { routes } from "@/lib/routes"
import { APP_BASE_URL } from "@/utils/constants"
import AdminView from "@/views/AdminView"
import useSWR from "swr"
-import UserTable from "./_partials/UserTable"
+import CourseTable from "./_partials/CourseTable"
-const UsersIndexPage = () => {
- const UserListURL = `${APP_BASE_URL}/api/admin/stats/userDetail`
- const { data : UsersList , mutate , isLoading} = useSWR(UserListURL , defaultFetcher);
+const CourseIndexPage = () => {
+ const CourseListURL = `${APP_BASE_URL}/api/course/listall`
+ const { data, mutate, isLoading } = useSWR(CourseListURL, defaultFetcher);
-
- console.log(UsersList)
-
- return(
- <>
-
-
-
- Users
-
-
-
-
-
-
-
-
-
- >
- )
+ return (
+
+
+
+ Courses
+
+
+
+
+
+
+
+
+
+ )
}
-export default UsersIndexPage
-
+export default CourseIndexPage
\ No newline at end of file
diff --git a/frontend/edu-connect/src/lib/routes.ts b/frontend/edu-connect/src/lib/routes.ts
index 011951d..d13a759 100644
--- a/frontend/edu-connect/src/lib/routes.ts
+++ b/frontend/edu-connect/src/lib/routes.ts
@@ -5,7 +5,9 @@ export const routes = {
DASHBOARD_ROUTE : '/admin/dashboard',
PROFILE_ROUTE : '/user/profile',
MY_COURSES_INDEX : '/my-courses',
- USER_INDEX_PAGE : '/admin/users'
+ USER_INDEX_PAGE : '/admin/users',
+ COURSE_INDEX_PAGE: '/admin/course',
+ CATEGORY_INDEX_PAGE: '/admin/category'
}
export const privateRoutes = ['/user/profile']