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 item master link to quote make methods and job make methods

Brad Barbin8e4b7b611580
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx b/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
index 15b49f3fe7..2124c82c65 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
@@ -24,11 +24,18 @@ import {
useMount,
VStack,
} from "@carbon/react";
-import { Await, useFetcher, useLocation, useParams } from "@remix-run/react";
+import {
+ Await,
+ Link,
+ useFetcher,
+ useLocation,
+ useParams,
+} from "@remix-run/react";
import type { PostgrestResponse } from "@supabase/supabase-js";
import { Suspense, useEffect, useMemo, useState } from "react";
import {
LuDownload,
+ LuExternalLink,
LuSettings,
LuSquareStack,
LuTriangleAlert,
@@ -49,9 +56,11 @@ import type {
ConfigurationParameter,
ConfigurationParameterGroup,
} from "~/modules/items";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
+import type { MethodItemType } from "~/modules/shared/types";
import { path } from "~/utils/path";
import { getJobMethodValidator } from "../../production.models";
-import type { Job, JobMethod } from "../../types";
+import type { Job, JobMaterial, JobMethod } from "../../types";
const JobBreadcrumbs = () => {
const permissions = usePermissions();
@@ -68,6 +77,19 @@ const JobBreadcrumbs = () => {
}>;
}>(path.to.job(jobId));
+ const materialRouteData = useRouteData<{
+ material: JobMaterial;
+ }>(path.to.jobMakeMethod(jobId, methodId!, materialId!));
+
+ const itemId = materialRouteData?.material?.itemId ?? routeData?.job?.itemId;
+ const itemType =
+ materialRouteData?.material?.itemType ?? routeData?.job?.itemType;
+
+ const itemLink =
+ itemType && itemId
+ ? getLinkToItemDetails(itemType as MethodItemType, itemId)
+ : null;
+
const isDisabled = ["Completed", "Cancelled", "In Progress"].includes(
routeData?.job?.status ?? ""
);
@@ -176,6 +198,13 @@ const JobBreadcrumbs = () => {
Configure
</MenubarItem>
)}
+ {itemLink && (
+ <MenubarItem leftIcon={<LuExternalLink />} asChild>
+ <Link prefetch="intent" to={itemLink}>
+ Item Master
+ </Link>
+ </MenubarItem>
+ )}
</HStack>
</HStack>
</Menubar>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
index 2785540ea7..d6f9fc884d 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
@@ -20,10 +20,17 @@ import {
useMount,
VStack,
} from "@carbon/react";
-import { Await, useFetcher, useLocation, useParams } from "@remix-run/react";
+import {
+ Await,
+ Link,
+ useFetcher,
+ useLocation,
+ useParams,
+} from "@remix-run/react";
import { Suspense, useEffect, useState } from "react";
import {
LuDownload,
+ LuExternalLink,
LuSettings,
LuTriangleAlert,
LuUpload,
@@ -36,6 +43,8 @@ import type {
ConfigurationParameter,
ConfigurationParameterGroup,
} from "~/modules/items";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
+import type { MethodItemType } from "~/modules/shared/types";
import { path } from "~/utils/path";
import { getLineMethodValidator, getMethodValidator } from "../../sales.models";
import type { Quotation, QuotationLine, QuoteMethod } from "../../types";
@@ -52,6 +61,22 @@ const QuoteMakeMethodTools = () => {
methods: Promise<Tree<QuoteMethod>[]> | Tree<QuoteMethod>[];
}>(path.to.quote(quoteId));
+ const materialRouteData = useRouteData<{
+ material: { itemId: string; itemType: MethodItemType | null };
+ }>(path.to.quoteLineMakeMethod(quoteId, lineId!, methodId!, materialId!));
+
+ const itemId =
+ materialRouteData?.material?.itemId ??
+ routeData?.lines.find((line) => line.id === lineId)?.itemId;
+ const itemType =
+ materialRouteData?.material?.itemType ??
+ routeData?.lines.find((line) => line.id === lineId)?.itemType;
+
+ const itemLink =
+ itemType && itemId
+ ? getLinkToItemDetails(itemType as MethodItemType, itemId)
+ : null;
+
const lineData = useRouteData<{
configurationParameters: Promise<{
groups: ConfigurationParameterGroup[];
@@ -168,6 +193,13 @@ const QuoteMakeMethodTools = () => {
Configure
</MenubarItem>
)}
+ {itemLink && (
+ <MenubarItem leftIcon={<LuExternalLink />} asChild>
+ <Link prefetch="intent" to={itemLink}>
+ Item Master
+ </Link>
+ </MenubarItem>
+ )}
</HStack>
</HStack>
</Menubar>