import { ColumnDef, Row } from "@tanstack/react-table" import { Eye, Pencil, Trash2 } from "lucide-react" import PricePlanModel from "../model/price-plan-model" import { useRouter } from "next/navigation" export interface PricePlan { name: string type: string code: string validPeriod: string } interface Props { onClickDelete: (id: string) => void } export default function PricePlanColumns({ onClickDelete }: Props): ColumnDef[] { const router = useRouter() // const setFields = priceplandeta const onNavigate = (row: Row) => { router.push(`/main/price-plan/${row.original.getId()}`) // setFields({ // pricplanId: row.original.getId(), // name: row.original.getName(), // version: row.original.getValidPeriod() // }) } return [ { accessorKey: "name", header: () =>
Price Plan Name
, cell: ({ row }) =>
{row.getValue("name")}
, }, { accessorKey: "type", header: () =>
Price Plan Type
, cell: ({ row }) =>
{row.getValue("type")}
, }, { accessorKey: "code", header: () =>
Price Plan Code
, cell: ({ row }) =>
{row.getValue("code")}
, }, { accessorKey: "validPeriod", header: () =>
Valid Period
, cell: ({ row }) =>
{row.getValue("validPeriod")}
, }, { id: "operations", header: () =>
Action
, cell: ({row}) => { const id = row.original.getId() return
onNavigate(row)}/> onClickDelete(id)} />
}, }, ] }