diff --git a/src/frontend/src/functions/icons.tsx b/src/frontend/src/functions/icons.tsx index 3dbd19298f..73fac29841 100644 --- a/src/frontend/src/functions/icons.tsx +++ b/src/frontend/src/functions/icons.tsx @@ -108,6 +108,7 @@ const icons: { [key: string]: (props: TablerIconsProps) => React.JSX.Element } = delete: IconTrash, // Part Icons + active: IconCheck, template: IconCopy, assembly: IconTool, component: IconGridDots, diff --git a/src/frontend/src/pages/part/PartDetail.tsx b/src/frontend/src/pages/part/PartDetail.tsx index a610cd58a8..b99594f488 100644 --- a/src/frontend/src/pages/part/PartDetail.tsx +++ b/src/frontend/src/pages/part/PartDetail.tsx @@ -60,7 +60,7 @@ import { useEditApiFormModal } from '../../hooks/UseForm'; import { useInstance } from '../../hooks/UseInstance'; import { apiUrl } from '../../states/ApiState'; import { useUserState } from '../../states/UserState'; -import { DetailsField, DetailsTable } from '../../tables/Details'; +import { DetailsField, DetailsTable, PartIcons } from '../../tables/Details'; import { BomTable } from '../../tables/bom/BomTable'; import { UsedInTable } from '../../tables/bom/UsedInTable'; import { BuildOrderTable } from '../../tables/build/BuildOrderTable'; @@ -116,6 +116,55 @@ export default function PartDetail() { label: t`Variant of`, model: ModelType.part, hidden: !part.variant_of + }, + { + type: 'link', + name: 'category', + label: t`Category`, + model: ModelType.partcategory + }, + { + type: 'link', + name: 'default_location', + label: t`Default Location`, + model: ModelType.stocklocation, + hidden: !part.default_location + }, + { + type: 'string', + name: 'IPN', + label: t`IPN`, + copy: true, + hidden: !part.IPN + }, + { + type: 'string', + name: 'revision', + label: t`Revision`, + copy: true, + hidden: !part.revision + }, + { + type: 'string', + name: 'units', + label: t`Units`, + copy: true, + hidden: !part.units + }, + { + type: 'string', + name: 'keywords', + label: t`Keywords`, + copy: true, + hidden: !part.keywords + }, + { + type: 'link', + name: 'link', + label: t`Link`, + external: true, + copy: true, + hidden: !part.link } ]; @@ -186,53 +235,44 @@ export default function PartDetail() { let bl: DetailsField[] = [ { - type: 'link', - name: 'category', - label: t`Category`, - model: ModelType.partcategory + type: 'boolean', + name: 'active', + label: t`Active` }, { - type: 'link', - name: 'default_location', - label: t`Default Location`, - model: ModelType.stocklocation, - hidden: !part.default_location + type: 'boolean', + name: 'template', + label: t`Template Part` }, { - type: 'string', - name: 'IPN', - label: t`IPN`, - copy: true, - hidden: !part.IPN + type: 'boolean', + name: 'assembly', + label: t`Assembled Part` }, { - type: 'string', - name: 'revision', - label: t`Revision`, - copy: true, - hidden: !part.revision + type: 'boolean', + name: 'component', + label: t`Component Part` }, { - type: 'string', - name: 'units', - label: t`Units`, - copy: true, - hidden: !part.units + type: 'boolean', + name: 'trackable', + label: t`Trackable Part` }, { - type: 'string', - name: 'keywords', - label: t`Keywords`, - copy: true, - hidden: !part.keywords + type: 'boolean', + name: 'purchaseable', + label: t`Purchaseable Part` }, { - type: 'link', - name: 'link', - label: t`Link`, - external: true, - copy: true, - hidden: !part.link + type: 'boolean', + name: 'saleable', + label: t`Saleable Part` + }, + { + type: 'boolean', + name: 'virtual', + label: t`Virtual Part` } ]; @@ -387,7 +427,10 @@ export default function PartDetail() { /> - + + + + diff --git a/src/frontend/src/tables/Details.tsx b/src/frontend/src/tables/Details.tsx index ee970b4c33..20057ba180 100644 --- a/src/frontend/src/tables/Details.tsx +++ b/src/frontend/src/tables/Details.tsx @@ -118,20 +118,11 @@ function PartIcon(icon: string) { * Generates a table cell with Part icons. * Only used for Part Model Details */ -function PartIcons({ - assembly, - template, - component, - trackable, - purchaseable, - saleable, - virtual, - active -}: PartIconsType) { +export function PartIcons({ part }: { part: any }) { return (
- {!active && ( + {!part.active && (
)} - {template && ( + {part.template && ( )} - {assembly && ( + {part.assembly && ( )} - {component && ( + {part.component && ( )} - {trackable && ( + {part.trackable && ( )} - {purchaseable && ( + {part.purchaseable && ( )} - {saleable && ( + {part.saleable && ( )} - {virtual && ( + {part.virtual && (