Files
revenue-fe/src/pages/groups/Column.tsx
2025-04-15 21:11:09 +07:00

50 lines
996 B
TypeScript

import { KeenIcon } from '@/components';
import { ColumnDef } from '@tanstack/react-table';
export type Group = {
no: number;
created_at: Date;
name: string;
status: string;
description: string;
};
export const getColumns = (handleUpdate: (data: any) => void): ColumnDef<Group>[] => [
{
accessorKey: 'no',
header: 'ID'
},
{
accessorKey: 'created_at',
header: 'Created Date',
cell: ({ row }) => new Date(row.original.created_at).toLocaleDateString()
},
{
accessorKey: 'name',
header: 'Name'
},
{
accessorKey: 'status',
header: 'Status'
},
{
accessorKey: 'description',
header: 'Description'
},
{
id: 'actions',
cell: ({ row }) => {
const dataMembers = row.original;
return (
<button
className="btn btn-sm btn-icon btn-clear btn-light"
onClick={() => handleUpdate(dataMembers)}
>
<KeenIcon icon="notepad-edit" />
</button>
);
}
}
];