From 230e1edc003c86d5b54b9fc4c3d444f3332a2d3f Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 27 Sep 2025 14:16:13 +1000 Subject: [PATCH] Add info badge to part renderer (#10409) - Show extra information about ordering and building - Closes https://github.com/inventree/InvenTree/issues/10380 --- src/frontend/src/components/render/Part.tsx | 47 +++++++++++++++++--- src/frontend/src/components/render/Stock.tsx | 2 +- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/components/render/Part.tsx b/src/frontend/src/components/render/Part.tsx index 261db11569..78cd5aae42 100644 --- a/src/frontend/src/components/render/Part.tsx +++ b/src/frontend/src/components/render/Part.tsx @@ -34,18 +34,53 @@ export function RenderPart( badgeColor = instance.minimum_stock > stock ? 'yellow' : 'green'; } - const badge = !!badgeText ? ( - - {badgeText} - - ) : null; + const extra: ReactNode[] = []; + + // For active parts, we can display some extra information here + if (instance.active) { + if (instance.ordering) { + extra.push( + + {t`On Order`}: {formatDecimal(instance.ordering)}{' '} + + ); + } + + if (instance.building) { + extra.push( + + {t`In Production`}: {formatDecimal(instance.building)}{' '} + + ); + } + } + + const suffix: ReactNode = ( + + {badgeText && ( + + {badgeText} + + )} + {extra && ( + + )} + + ); return ( diff --git a/src/frontend/src/components/render/Stock.tsx b/src/frontend/src/components/render/Stock.tsx index 6ee29e6f17..1e5a13b25e 100644 --- a/src/frontend/src/components/render/Stock.tsx +++ b/src/frontend/src/components/render/Stock.tsx @@ -130,7 +130,7 @@ export function RenderStockItem( zIndex={10000} icon='sitemap' title={t`Location`} - extra={[{location.pathstring}]} + extra={[{location.pathstring}]} /> )}