mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-23 09:27:39 +00:00
[UI] Category Parameters (#10633)
- Add category parameters table to the part category page
This commit is contained in:
@@ -3,6 +3,7 @@ import { Group, LoadingOverlay, Skeleton, Stack, Text } from '@mantine/core';
|
||||
import {
|
||||
IconCategory,
|
||||
IconInfoCircle,
|
||||
IconListCheck,
|
||||
IconListDetails,
|
||||
IconPackages,
|
||||
IconSitemap
|
||||
@@ -41,6 +42,7 @@ import { useInstance } from '../../hooks/UseInstance';
|
||||
import { useUserState } from '../../states/UserState';
|
||||
import ParametricPartTable from '../../tables/part/ParametricPartTable';
|
||||
import { PartCategoryTable } from '../../tables/part/PartCategoryTable';
|
||||
import PartCategoryTemplateTable from '../../tables/part/PartCategoryTemplateTable';
|
||||
import { PartListTable } from '../../tables/part/PartTable';
|
||||
import { StockItemTable } from '../../tables/stock/StockItemTable';
|
||||
|
||||
@@ -297,6 +299,13 @@ export default function CategoryDetail() {
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'category_parameters',
|
||||
label: t`Category Parameters`,
|
||||
icon: <IconListCheck />,
|
||||
hidden: !id || !category.pk,
|
||||
content: <PartCategoryTemplateTable categoryId={category?.pk} />
|
||||
},
|
||||
{
|
||||
name: 'parameters',
|
||||
label: t`Part Parameters`,
|
||||
|
@@ -23,17 +23,24 @@ import { useTable } from '../../hooks/UseTable';
|
||||
import { useUserState } from '../../states/UserState';
|
||||
import { InvenTreeTable } from '../InvenTreeTable';
|
||||
|
||||
export default function PartCategoryTemplateTable() {
|
||||
export default function PartCategoryTemplateTable({
|
||||
categoryId
|
||||
}: {
|
||||
categoryId?: number;
|
||||
}) {
|
||||
const table = useTable('part-category-parameter-templates');
|
||||
const user = useUserState();
|
||||
|
||||
const formFields: ApiFormFieldSet = useMemo(() => {
|
||||
return {
|
||||
category: {},
|
||||
category: {
|
||||
value: categoryId,
|
||||
disabled: categoryId !== undefined
|
||||
},
|
||||
parameter_template: {},
|
||||
default_value: {}
|
||||
};
|
||||
}, []);
|
||||
}, [categoryId]);
|
||||
|
||||
const [selectedTemplate, setSelectedTemplate] = useState<number>(0);
|
||||
|
||||
@@ -153,7 +160,10 @@ export default function PartCategoryTemplateTable() {
|
||||
rowActions: rowActions,
|
||||
tableFilters: tableFilters,
|
||||
tableActions: tableActions,
|
||||
enableDownload: true
|
||||
enableDownload: true,
|
||||
params: {
|
||||
category: categoryId
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
|
Reference in New Issue
Block a user