46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import type { ColumnDef } from '@tanstack/vue-table';
|
|
import { h } from 'vue';
|
|
import { DataTableColumnHeader } from '@/components/data-table';
|
|
import type { ActivityLogListItem } from '@/types/activity-log';
|
|
import DataTableActions from './data-table-actions.vue';
|
|
|
|
export function createColumns(onView: (activityLog: ActivityLogListItem) => void): ColumnDef<ActivityLogListItem>[] {
|
|
return [
|
|
{
|
|
accessorKey: 'created_at_formatted',
|
|
enableSorting: true,
|
|
header: () => h(DataTableColumnHeader, { title: 'Waktu', column: 'created_at' }),
|
|
cell: ({ row }) => row.original.created_at_formatted ?? '-',
|
|
},
|
|
{
|
|
accessorKey: 'causer_name',
|
|
enableSorting: false,
|
|
header: 'Pengguna',
|
|
},
|
|
{
|
|
accessorKey: 'event_label',
|
|
enableSorting: true,
|
|
header: () => h(DataTableColumnHeader, { title: 'Aksi', column: 'event' }),
|
|
},
|
|
{
|
|
accessorKey: 'subject_label',
|
|
enableSorting: false,
|
|
header: 'Modul',
|
|
},
|
|
{
|
|
accessorKey: 'description',
|
|
enableSorting: true,
|
|
header: () => h(DataTableColumnHeader, { title: 'Deskripsi', column: 'description' }),
|
|
},
|
|
{
|
|
id: 'actions',
|
|
enableSorting: false,
|
|
enableHiding: false,
|
|
cell: ({ row }) => h(DataTableActions, {
|
|
activityLog: row.original,
|
|
onView: () => onView(row.original),
|
|
}),
|
|
},
|
|
];
|
|
}
|