From 9239c8211362593b71397740d4c25ce269ecf43a Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 21 Aug 2024 10:00:52 +1000 Subject: [PATCH] Required quantity display (#7938) * Add "required" badge to PUI part detail page * Add "required for orders" to CUI --- .../part/templates/part/part_base.html | 7 ++++++ src/frontend/src/functions/icons.tsx | 2 ++ src/frontend/src/pages/part/PartDetail.tsx | 22 ++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/backend/InvenTree/part/templates/part/part_base.html b/src/backend/InvenTree/part/templates/part/part_base.html index b29f40f751..0123fa6586 100644 --- a/src/backend/InvenTree/part/templates/part/part_base.html +++ b/src/backend/InvenTree/part/templates/part/part_base.html @@ -211,6 +211,13 @@ {% decimal on_order %} {% include "part/part_units.html" %} {% endif %} + {% if required > 0 %} + + + {% trans "Required for Orders" %} + {% decimal required %} + + {% endif %} {% if part.component %} {% if required_build_order_quantity > 0 or allocated_build_order_quantity > 0 %} diff --git a/src/frontend/src/functions/icons.tsx b/src/frontend/src/functions/icons.tsx index 7770628c6e..31c5617b00 100644 --- a/src/frontend/src/functions/icons.tsx +++ b/src/frontend/src/functions/icons.tsx @@ -19,6 +19,7 @@ import { IconCircleMinus, IconCirclePlus, IconCircleX, + IconClipboardCheck, IconClipboardList, IconClipboardText, IconCopy, @@ -212,6 +213,7 @@ const icons = { barLine: IconMinusVertical, batch: IconClipboardText, batch_code: IconClipboardText, + tick_off: IconClipboardCheck, destination: IconFlag, repeat_destination: IconFlagShare, unlink: IconUnlink, diff --git a/src/frontend/src/pages/part/PartDetail.tsx b/src/frontend/src/pages/part/PartDetail.tsx index 74343e14fb..025446c10a 100644 --- a/src/frontend/src/pages/part/PartDetail.tsx +++ b/src/frontend/src/pages/part/PartDetail.tsx @@ -130,6 +130,10 @@ export default function PartDetail() { refetchOnMount: true }); + part.required = + (part?.required_for_build_orders ?? 0) + + (part?.required_for_sales_orders ?? 0); + const detailsPanel = useMemo(() => { if (instanceQuery.isFetching) { return ; @@ -258,6 +262,13 @@ export default function PartDetail() { unit: true, hidden: !part.purchaseable || part.ordering <= 0 }, + { + type: 'string', + name: 'required', + label: t`Required for Orders`, + hidden: part.required <= 0, + icon: 'tick_off' + }, { type: 'progressbar', name: 'allocated_to_build_orders', @@ -285,7 +296,7 @@ export default function PartDetail() { type: 'string', name: 'building', unit: true, - label: t`Building`, + label: t`In Production`, hidden: !part.assembly || !part.building } ]; @@ -838,6 +849,9 @@ export default function PartDetail() { return []; } + const required = + part.required_for_build_orders + part.required_for_sales_orders; + return [ , + 0} + key="required" + />,