2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-12-16 17:28:11 +00:00

tweak table

This commit is contained in:
Oliver Walters
2025-11-26 00:19:00 +00:00
parent e3f1649ed0
commit 661b62f578

View File

@@ -1,7 +1,9 @@
import { ApiEndpoints, ModelType } from '@lib/index'; import { ApiEndpoints, ModelType } from '@lib/index';
import type { TableFilter } from '@lib/types/Filters'; import type { TableFilter } from '@lib/types/Filters';
import type { TableColumn } from '@lib/types/Tables'; import type { TableColumn } from '@lib/types/Tables';
import { t } from '@lingui/core/macro';
import { type ReactNode, useMemo } from 'react'; import { type ReactNode, useMemo } from 'react';
import { CompanyColumn, PartColumn } from '../ColumnRenderers';
import ParametricDataTable from '../general/ParametricDataTable'; import ParametricDataTable from '../general/ParametricDataTable';
export default function ManufacturerPartParametricTable({ export default function ManufacturerPartParametricTable({
@@ -10,11 +12,46 @@ export default function ManufacturerPartParametricTable({
queryParams?: Record<string, any>; queryParams?: Record<string, any>;
}): ReactNode { }): ReactNode {
const customColumns: TableColumn[] = useMemo(() => { const customColumns: TableColumn[] = useMemo(() => {
return []; return [
PartColumn({
switchable: false
}),
{
accessor: 'part_detail.IPN',
title: t`IPN`,
sortable: false,
switchable: true
},
{
accessor: 'manufacturer',
sortable: true,
render: (record: any) => (
<CompanyColumn company={record?.manufacturer_detail} />
)
},
{
accessor: 'MPN',
title: t`MPN`,
sortable: true
}
];
}, []); }, []);
const customFilters: TableFilter[] = useMemo(() => { const customFilters: TableFilter[] = useMemo(() => {
return []; return [
{
name: 'part_active',
label: t`Active Part`,
description: t`Show manufacturer parts for active internal parts.`,
type: 'boolean'
},
{
name: 'manufacturer_active',
label: t`Active Manufacturer`,
description: t`Show manufacturer parts for active manufacturers.`,
type: 'boolean'
}
];
}, []); }, []);
return ( return (