"use client" import * as React from "react" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { DataTable } from "@/components/data-table/data-table" import { useDataTable } from "@/hooks/use-data-table" import { type ColumnDef } from "@tanstack/react-table" import { DataTableColumnHeader } from "@/components/data-table/data-table-column-header" interface RfqItem { id: number itemCode: string description: string | null quantity: number | null uom: string | null } interface RfqItemsTableDialogProps { open: boolean onOpenChange: (open: boolean) => void items: RfqItem[] } export function RfqItemsTableDialog({ open, onOpenChange, items, }: RfqItemsTableDialogProps) { const columns = React.useMemo[]>( () => [ { accessorKey: "itemCode", header: ({ column }) => ( ), }, { accessorKey: "description", header: ({ column }) => ( ), cell: ({ row }) => row.getValue("description") || "-", }, { accessorKey: "quantity", header: ({ column }) => ( ), cell: ({ row }) => { const quantity = row.getValue("quantity") as number | null; return (
{quantity !== null ? quantity.toLocaleString() : "-"}
); }, }, { accessorKey: "uom", header: ({ column }) => ( ), cell: ({ row }) => row.getValue("uom") || "-", }, ], [] ) const { table } = useDataTable({ data: items, columns, pageCount: 1, enablePinning: false, enableAdvancedFilter: false, }) return ( RFQ Items Items included in this RFQ
) }