import * as React from "react"; import { ColumnDef, } from "@tanstack/react-table"; import { Eye, MoreVertical, SquarePen, Trash2, } from "lucide-react"; import { cn } from "@/lib/utils"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, DropdownMenuItem, } from "@/components/ui/dropdown-menu"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; const columns: ColumnDef[] = [ { accessorKey: "no", header: "No", cell: ({ row }) => {row.getValue("no")}, }, { accessorKey: "referenceNumber", header: "Ticket Number", cell: ({ row }) => {row.getValue("referenceNumber")}, }, { accessorKey: "title", header: "Title", cell: ({ row }) => {row.getValue("title")}, }, { accessorKey: "commentFromUserName", header: "Sender", cell: ({ row }) => {row.getValue("commentFromUserName")}, }, { accessorKey: "type", header: "Channel", cell: ({ row }) => { const type = row.getValue("type") as { name: string }; return {type?.name}; }, }, { accessorKey: "createdBy", header: "Operator", cell: ({ row }) => { const createdBy = row.getValue("createdBy") as { fullname: string }; return {createdBy?.fullname}; }, }, { accessorKey: "createdAt", header: "Tanggal Unggah ", cell: ({ row }) => ( {row.getValue("createdAt")} ), }, { accessorKey: "status", header: "Status", cell: ({ row }) => { const statusColors: Record = { open: "bg-primary/20 text-primary", close: "bg-success/20 text-success", }; const status = row.getValue("status") as { id: number, name: string };; const statusName = status?.name?.toLocaleLowerCase(); console.log(statusName); const statusStyles = statusColors[statusName] || "default"; if (statusName) { return ( {statusName} ); } } }, { id: "actions", accessorKey: "action", header: "Actions", enableHiding: false, cell: ({ row }) => { return ( View Edit Delete ); }, }, ]; export default columns;