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.

feat: add navigation for non-conformance

Brad Barbine5a799058403
diff --git a/apps/erp/app/modules/quality/ui/NonConformance/useNonConformanceNavigation.tsx b/apps/erp/app/modules/quality/ui/NonConformance/useNonConformanceNavigation.tsx
index 561781b551..7b427b1f52 100644
--- a/apps/erp/app/modules/quality/ui/NonConformance/useNonConformanceNavigation.tsx
+++ b/apps/erp/app/modules/quality/ui/NonConformance/useNonConformanceNavigation.tsx
@@ -1,12 +1,16 @@
import { useParams } from "@remix-run/react";
-import { LuFileText } from "react-icons/lu";
-import { usePermissions, useRouteData } from "~/hooks";
+import {
+ LuClipboardPen,
+ LuContainer,
+ LuFileText,
+ LuListChecks,
+} from "react-icons/lu";
+import { useRouteData } from "~/hooks";
import { path } from "~/utils/path";
import type { NonConformance } from "../../types";
export function useNonConformanceNavigation() {
- const permissions = usePermissions();
const { id } = useParams();
if (!id) throw new Error("id not found");
@@ -15,6 +19,12 @@ export function useNonConformanceNavigation() {
);
if (!routeData?.nonConformance?.source)
throw new Error("Could not find source in routeData");
+ const hasTasks =
+ (routeData.nonConformance.investigationTypes?.length ?? 0) > 0 ||
+ (routeData.nonConformance.requiredActions?.length ?? 0) > 0;
+
+ const requiresManagementReview =
+ routeData.nonConformance.approvalRequirements?.includes("MRB");
const isExternal = routeData.nonConformance.source === "External";
@@ -24,7 +34,26 @@ export function useNonConformanceNavigation() {
to: path.to.nonConformanceDetails(id),
icon: LuFileText,
shortcut: "Command+Shift+d",
- isDisabled: false,
+ },
+ {
+ name: "Supplier",
+ to: path.to.nonConformanceSupplier(id),
+ icon: LuContainer,
+ shortcut: "Command+Shift+s",
+ isDisabled: !isExternal,
+ },
+ {
+ name: "Tasks",
+ to: path.to.nonConformanceTasks(id),
+ icon: LuListChecks,
+ shortcut: "Command+Shift+t",
+ isDisabled: !hasTasks,
+ },
+ {
+ name: "Review",
+ to: path.to.nonConformanceReview(id),
+ icon: LuClipboardPen,
+ isDisabled: !requiresManagementReview,
},
].filter((item) => !item.isDisabled);
}
diff --git a/apps/erp/app/routes/x+/non-conformance+/$id.tasks.tsx b/apps/erp/app/routes/x+/non-conformance+/$id.tasks.tsx
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/apps/erp/app/routes/x+/non-conformance+/$id.tsx b/apps/erp/app/routes/x+/non-conformance+/$id.tsx
index 9b9c5bc932..c242c662d1 100644
--- a/apps/erp/app/routes/x+/non-conformance+/$id.tsx
+++ b/apps/erp/app/routes/x+/non-conformance+/$id.tsx
@@ -13,7 +13,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Parts",
+ breadcrumb: "Non-Conformances",
to: path.to.parts,
module: "items",
};
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index e938fcd87f..f82492c78b 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -804,6 +804,12 @@ export const path = {
nonConformance: (id: string) => generatePath(`${x}/non-conformance/${id}`),
nonConformanceDetails: (id: string) =>
generatePath(`${x}/non-conformance/${id}/details`),
+ nonConformanceSupplier: (id: string) =>
+ generatePath(`${x}/non-conformance/${id}/supplier`),
+ nonConformanceTasks: (id: string) =>
+ generatePath(`${x}/non-conformance/${id}/tasks`),
+ nonConformanceReview: (id: string) =>
+ generatePath(`${x}/non-conformance/${id}/review`),
nonConformanceWorkflow: (id: string) =>
generatePath(`${x}/non-conformance-workflow/${id}`),
nonConformanceWorkflows: `${x}/quality/non-conformance-workflows`,