import type { MRT_ColumnDef } from 'material-react-table'; /** * Filter chip variant shown in Manage Filters → Column Filters. * * | Value | Chip rendered | * |---------------------|------------------------------------------------------| * | `'text'` | Free-text input (default) | * | `'date'` | Calendar date picker | * | `'select'` | Searchable single-select option list | * | `'searchable-select'` | Searchable single-select option list | * | `'number'` | Numeric input | * | `'multi-select'` | Checkbox list — pick many values, filters client-side| * * Set `enableColumnFilter: false` to hide the column from Manage Filters * entirely (e.g. for computed or numeric columns that don't need filtering). */ export type ColumnFilterType = 'text' | 'date' | 'select' | 'searchable-select' | 'number' | 'multi-select'; /** * `TValue` (second generic) is passed straight through to * `MRT_ColumnDef` and **defaults to `any`** so that * `cell.getValue()` returns `any` inside `Cell`, `muiTableBodyCellProps`, * and all other MRT callbacks — exactly as you'd expect from a plain * `MRT_ColumnDef` column. Set `TValue` explicitly only when you want * strict return-type checking on `cell.getValue()`. * * ```ts * // Default — cell.getValue() is `any` (no cast needed) * const cols: TPColumnDef[] = [ * { * accessorKey: 'name', * muiTableBodyCellProps: ({ cell }) => ({ title: cell.getValue(), className: 'body_cell' }), * }, * ]; * * // Strict — cell.getValue() is `number` * const strictCol: TPColumnDef = { * accessorKey: 'qty', * Cell: ({ cell }) => {cell.getValue().toFixed(2)}, * }; * ``` */ export type TPColumnDef = MRT_ColumnDef & { /** * Which filter chip to show in Manage Filters → Column Filters. * Omit (or set to `'text'`) for a plain text-input chip. */ filterType?: ColumnFilterType; /** * Option pairs for `'select'`, `'searchable-select'`, and `'multi-select'` * filter types. Each entry needs `label` (display text) and `value` (filter * value sent to the server / used for client-side matching). */ options?: { label: string; value: string | number; disable?: boolean; }[]; /** * Show this column's filter chip in the filter bar on first render. * * - Requires `filterType` to be set (or the column must not have * `enableColumnFilter: false`). * - Works exactly like `defaultVisible` on `ServerFilterDef` — the chip * appears without needing `defaultVisibleFilterIds` on the grid. * - Default: `false` (chip hidden until user adds from Manage Filters). * * ```ts * { * accessorKey: 'status', * header: 'Status', * filterType: 'multi-select', * options: [...], * defaultVisible: true, // ← chip shown on load * } * ``` */ defaultVisible?: boolean; /** * Text/number the Global Search box should match against for this column. * * MRT's built-in Global Search always matches the raw accessor value * (`row.getValue(columnId)`) — **never** what `Cell` renders. So a column * whose `Cell` formats or maps the raw value for display (dates, currency, * status labels, etc.) becomes unsearchable by the text a user actually * sees on screen: typing the formatted text finds nothing because it's * being compared against the untouched raw value underneath. * * Set `getSearchText` to the same formatted representation `Cell` renders, * and `GenericPaginatedGrid` will match Global Search against it instead: * * ```ts * { * accessorKey: 'InvoiceDate', * Cell: ({ cell }) => formatDate(cell.getValue()), * getSearchText: (row) => formatDate(row.InvoiceDate), // "01 Jul 2026" now matches * } * ``` * * Omit when `Cell` is absent or simply displays the raw value unchanged — * the raw accessor value is matched by default in that case. */ getSearchText?: (row: TData) => string | number | null | undefined; }; export interface InvoiceDetail { Data_from: string; FINYEAR: string; Div_Code: string; Depo_Code: string; Customer: string; category: string; Dist_Chan: string; InvoiceNo: number; BillItem: string; InvoiceDate: string; Prod_ID: number; Batch: string; Allocated_Qty: number; free_qty: number; Nettrate: number; fld_ed_diff: number; disc_val: number; Net_val: number; Nett_ed_value: number; Tax_amt_value: number; Act_Division: string; MRP: number; Inv_time: string; status: string; createdate: string; RetType: string; Mkt_nett: number; changeddate: string; SHIP_TO_PARTY: string; }