import { Button } from "@/components/ui/button"; import { ColumnDef } from "@tanstack/react-table"; import { format } from "date-fns-tz"; import { Trash } from "lucide-react"; // This type is used to define the shape of our data. // You can use a Zod schema here if you want. export type Adjustmnets = { siloAdjust_id: string; currentStockLevel: string; newLevel: number; dateAdjusted: string; lastDateAdjusted: string; comment: string; commentAddedBy: string; commentDate: string; add_user: string; }; export const ocpColumns = ( clearLog: (label: any) => void ): ColumnDef[] => [ { accessorKey: "message", header: () =>
Error Message
, cell: ({ row }) => { if (row.getValue("message")) { return (
{row.getValue("message")}
); } }, }, { accessorKey: "created_at", header: "Error Date", cell: ({ row }) => { if (row.getValue("created_at")) { const correctDate: any = row.getValue("created_at"); const strippedDate = correctDate.replace("Z", ""); // Remove Z const formattedDate = format(strippedDate, "MM/dd/yyyy HH:mm"); return (
{formattedDate}
); } }, }, { accessorKey: "clear", header: "Clear", cell: ({ row }) => { const label = row.original; return ( ); }, }, ];