diff --git a/frontend/edu-connect/src/app/(admin)/admin/category/_partials/CategoryTable.tsx b/frontend/edu-connect/src/app/(admin)/admin/category/_partials/CategoryTable.tsx new file mode 100644 index 0000000..6a25b7d --- /dev/null +++ b/frontend/edu-connect/src/app/(admin)/admin/category/_partials/CategoryTable.tsx @@ -0,0 +1,113 @@ +import DataTable from "@/components/(dashboard)/common/DataTable/DataTable" +import { Button } from "@/components/(dashboard)/ui/button" +import { Badge } from "@/components/ui/badge" +import { routes } from "@/lib/routes" +import { ColumnDef } from "@tanstack/react-table" +import { ArrowUpDown } from "lucide-react" + +const CategoryTable: React.FC<{ + mutate: () => void + Data: Array + isLoading: boolean +}> = ({ + mutate, + Data, + isLoading + }) => { + + 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: '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}
+ ), + }, + ] + + return( + <> + + + ) +} + +export default CategoryTable \ No newline at end of file