import type { ColumnDef } from '@tanstack/vue-table'; import { h } from 'vue'; import DataTableActions from '@/components/admin/system/activity-logs/data-table-actions.vue'; import { DataTableColumnHeader } from '@/components/data-table'; import type { ActivityLogListItem } from '@/types/activity-log'; export function createColumns(onView: (activityLog: ActivityLogListItem) => void): ColumnDef[] { 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), }), }, ]; }