import { ColumnDef } from "@tanstack/react-table"; import { format } from "date-fns"; // 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 columns: ColumnDef[] = [ { accessorKey: "currentStockLevel", header: () =>
Stock At Post
, }, { accessorKey: "newLevel", header: "Level Entered", }, { accessorKey: "dateAdjusted", header: "Adjustmnet", cell: ({ row }) => { if (row.getValue("dateAdjusted")) { const correctDate = format( row.original.dateAdjusted?.replace("Z", ""), "M/d/yyyy hh:mm" ); return (
{correctDate}
); } }, }, { accessorKey: "lastDateAdjusted", header: "Last Adjusted", cell: ({ row }) => { if (row.getValue("lastDateAdjusted")) { const correctDate = format( row.original.lastDateAdjusted?.replace("Z", ""), "M/d/yyyy hh:mm" ); return (
{correctDate}
); } }, }, { accessorKey: "comment", header: "Comment", }, { accessorKey: "commentAddedBy", header: "Commenter ", }, { accessorKey: "commentDate", header: "Comment Date ", cell: ({ row }) => { if (row.getValue("commentDate")) { const correctDate = format( row.original.commentDate?.replace("Z", ""), "M/d/yyyy hh:mm" ); return (
{correctDate}
); } }, }, { accessorKey: "add_user", header: "Creator", }, ];