Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

remove comments

naveenkash779118723d36
diff --git a/apps/erp/app/modules/production/jobOrderStatus.ts b/apps/erp/app/modules/production/jobOrderStatus.ts
index 1182280f0f..3a7b376f9e 100644
--- a/apps/erp/app/modules/production/jobOrderStatus.ts
+++ b/apps/erp/app/modules/production/jobOrderStatus.ts
@@ -168,18 +168,13 @@ export function getCompletedJobOrderStatus(): ItemOrderStatus {
export function getJobOrderStatusCategory(
status: ItemOrderStatus | undefined
): JobOrderStatusCategory | null {
- // A completed job and a need fully met from on-hand stock both render the same
- // green "check" badge ("Completed" / "In stock"), so they share the
- // "completed" filter category.
if (status?.jobCompleted) return "completed";
// A still-unmet, priority-adjusted shortfall outranks the supply indicators —
// see JobOrderStatusBadge for why.
if (status?.needsOrder) return "needsOrder";
- // This job's need is already met from on-hand stock ("In stock" green check) —
- // outranks any "on order" indicator from a PO that's only partially received
- // for other jobs.
+ // On-hand coverage shares the "completed" category (same green check).
if (status?.coveredByOnHand) return "completed";
switch (status?.status) {
@@ -193,8 +188,6 @@ export function getJobOrderStatusCategory(
const fraction =
status.ordered > 0 ? status.received / status.ordered : 0;
if (fraction < 1) {
- // Some already received ("Received X of Y" badge) vs nothing yet
- // ("On order").
return status.received > 0 ? "received" : "onOrder";
}
break;
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
index 28fc58f095..fb222b0d05 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
@@ -104,8 +104,6 @@ const JobMaterialsTable = memo(
const [items] = useItems();
const [, setSearchParams] = useUrlParams();
- // Whether each item is bought, made, or both — drives where the row's
- // dropdown sends the user for planning (purchasing vs production).
const replenishmentByItemId = useMemo(() => {
const map = new Map<string, Item["replenishmentSystem"]>();
for (const item of items) {
@@ -209,9 +207,7 @@ const JobMaterialsTable = memo(
{ value: "awaitingApproval", label: t`Awaiting approval` },
{ value: "onOrder", label: t`On order` },
{ value: "received", label: t`Pending` },
- // `completed` category covers both a finished job ("Completed"
- // badge) and a need met from on-hand stock ("In stock"). On an
- // active job it's always the latter, so label it "In stock".
+ // `completed` is "In stock" on an active job, "Completed" once done.
{ value: "completed", label: t`In stock` }
]
}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobOrderStatus.tsx b/apps/erp/app/modules/production/ui/Jobs/JobOrderStatus.tsx
index 35c68630ef..a1e67f8b64 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobOrderStatus.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobOrderStatus.tsx
@@ -10,10 +10,8 @@ import {
type ItemOrderStatus
} from "../../jobOrderStatus";
-// The badge is purely presentational: precedence lives entirely in
-// getJobOrderStatusCategory (the single source the status filter also reads), and
-// this maps the resolved category to an icon + label. The exhaustive switch means
-// adding a category without a badge is a compile error — the two can't drift.
+// Presentation only — precedence lives in getJobOrderStatusCategory (shared with
+// the status filter); this maps the resolved category to an icon + label.
export function JobOrderStatusBadge({
status
}: {
@@ -31,8 +29,6 @@ export function JobOrderStatusBadge({
const category = getJobOrderStatusCategory(status);
switch (category) {
- // A finished job and a need met from on-hand stock share the green check;
- // the label distinguishes them.
case "completed":
return badge(
<LuCircleCheck className="text-emerald-600" />,
@@ -75,12 +71,7 @@ export function JobOrderStatusBadge({
<Trans>Job in progress</Trans>
)
);
- case null:
+ default:
return null;
- default: {
- // Exhaustiveness guard — a new category must add a case above.
- const _exhaustive: never = category;
- return _exhaustive;
- }
}
}