35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import type { ColumnDef } from '@tanstack/vue-table';
|
|
import { h } from 'vue';
|
|
import DataTableActions from '@/components/admin/master/customers/data-table-actions.vue';
|
|
import { DataTableColumnHeader } from '@/components/data-table';
|
|
import type { CustomerListItem } from '@/types/customer';
|
|
|
|
export function createColumns(onEdit: (customer: CustomerListItem) => void): ColumnDef<CustomerListItem>[] {
|
|
return [
|
|
{
|
|
accessorKey: 'name',
|
|
enableSorting: true,
|
|
header: () => h(DataTableColumnHeader, { title: 'Nama', column: 'name' }),
|
|
},
|
|
{
|
|
accessorKey: 'phone_number',
|
|
enableSorting: false,
|
|
header: () => h(DataTableColumnHeader, { title: 'Telepon', column: 'phone_number' }),
|
|
},
|
|
{
|
|
accessorKey: 'address',
|
|
enableSorting: false,
|
|
header: () => h(DataTableColumnHeader, { title: 'Alamat', column: 'address' }),
|
|
},
|
|
{
|
|
id: 'actions',
|
|
enableSorting: false,
|
|
enableHiding: false,
|
|
cell: ({ row }) => h(DataTableActions, {
|
|
customer: row.original,
|
|
onEdit: () => onEdit(row.original),
|
|
}),
|
|
},
|
|
];
|
|
}
|