import DeleteModal from '@/components/inertia/delete-modal'; import { Button } from '@/components/ui/button'; import { useAuth } from '@/hooks/use-auth'; import { systemCurrency } from '@/lib/utils'; import { SharedData } from '@/types/global'; import { Link, router, usePage } from '@inertiajs/react'; import { ColumnDef } from '@tanstack/react-table'; import { ArrowUpDown, Pencil, Trash2 } from 'lucide-react'; import CourseStatusFilter from './course-status-filter'; const TableColumn = (): ColumnDef[] => { const { isAdmin } = useAuth(); const { system, translate } = usePage().props; const { table, common } = translate; const currency = systemCurrency(system.fields['selling_currency']); return [ { accessorKey: 'name', header: ({ column }) => { return (
); }, cell: ({ row }) => (

{row.original.instructor.user.name}

{row.original.instructor.user.email}

), }, { accessorKey: 'title', header: table.course_title, cell: ({ row }) => (
{row.getValue('title')}
), }, { accessorKey: 'status', header: ({ column }) => (
), cell: ({ row }) =>
{row.getValue('status')}
, }, { accessorKey: 'category', header: ({ column }) => { return (

Category

); }, cell: ({ row }) => (

{row.original.course_category.title}

), }, { accessorKey: 'category_child', header: ({ column }) => { return (

{table.category_child}

); }, cell: ({ row }) => (

{row.original.course_category_child?.title || '--'}

), }, { accessorKey: 'price', header: ({ column }) => (
), cell: ({ row }) => (

{row.original.price ? `${currency?.symbol}${row.original.price}` : common.free}

), }, { id: 'actions', header: () =>
{table.action}
, cell: ({ row }) => { const course = row.original; return (
{isAdmin && ( } /> )}
); }, }, ]; }; export default TableColumn;