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 link to item master from bill of material

Brad Barbin665d4c0c1f06
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
index cfd085b929..4b71d939aa 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -26,6 +26,7 @@ import {
VStack,
} from "@carbon/react";
import {
+ Link,
useFetcher,
useFetchers,
useParams,
@@ -37,6 +38,7 @@ import { useCallback, useEffect, useState } from "react";
import { flushSync } from "react-dom";
import {
LuChevronDown,
+ LuExternalLink,
LuLock,
LuSettings2,
LuSquareFunction,
@@ -79,6 +81,7 @@ import type {
ConfigurationRule,
MakeMethod,
} from "../../types";
+import { getLinkToItemDetails } from "./ItemForm";
type Material = z.infer<typeof methodMaterialValidator> & {
description: string;
@@ -373,7 +376,7 @@ const BillOfMaterial = ({
duration: 0.95,
}}
>
- <LuSettings2 className="stroke-1 h-5 w-5 text-foreground/80 hover:stroke-primary/70 " />
+ <LuSettings2 className="stroke-1 mt-3.5 h-5 w-5 text-foreground/80 hover:stroke-primary/70 " />
</motion.span>
)}
</motion.button>
@@ -862,7 +865,9 @@ function MaterialForm({
<div />
)}
- <Submit isDisabled={isReadOnly}>Save</Submit>
+ <div className="flex items-center gap-2">
+ <Submit isDisabled={isReadOnly}>Save</Submit>
+ </div>
</motion.div>
</motion.div>
</VStack>
@@ -893,7 +898,14 @@ function makeItem(
id: material.id!,
title: (
<VStack spacing={0} className="py-1 cursor-pointer">
- <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ <div className="flex items-center gap-2 group">
+ <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ {material.itemId && material.itemType && (
+ <Link to={getLinkToItemDetails(material.itemType, material.itemId)}>
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100" />
+ </Link>
+ )}
+ </div>
{material?.description && (
<span className="text-xs text-muted-foreground">
{material.description}{" "}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 7fda01c303..47ae34f26c 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -23,11 +23,16 @@ import {
useDebounce,
VStack,
} from "@carbon/react";
-import { useFetcher, useFetchers, useParams } from "@remix-run/react";
+import { Link, useFetcher, useFetchers, useParams } from "@remix-run/react";
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
-import { LuChevronDown, LuSettings2, LuX } from "react-icons/lu";
+import {
+ LuChevronDown,
+ LuExternalLink,
+ LuSettings2,
+ LuX,
+} from "react-icons/lu";
import type { z } from "zod";
import { MethodIcon, MethodItemTypeIcon, TrackingTypeIcon } from "~/components";
import {
@@ -47,6 +52,7 @@ import type {
} from "~/components/SortableList";
import { SortableList, SortableListItem } from "~/components/SortableList";
import { usePermissions, useRouteData, useUser } from "~/hooks";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
import type { MethodItemType, MethodType } from "~/modules/shared";
import { useBom } from "~/stores";
import { path } from "~/utils/path";
@@ -109,7 +115,14 @@ function makeItem(
id: material.id!,
title: (
<VStack spacing={0} className="py-1 cursor-pointer">
- <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ <div className="flex items-center gap-2 group">
+ <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ {material.itemId && material.itemType && (
+ <Link to={getLinkToItemDetails(material.itemType, material.itemId)}>
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100" />
+ </Link>
+ )}
+ </div>
{material?.description && (
<span className="text-xs text-muted-foreground">
{material.description}{" "}
@@ -461,7 +474,7 @@ const JobBillOfMaterial = ({
duration: 0.95,
}}
>
- <LuSettings2 className="stroke-1 h-5 w-5 text-foreground/80 hover:stroke-primary/70 " />
+ <LuSettings2 className="stroke-1 mt-3.5 h-5 w-5 text-foreground/80 hover:stroke-primary/70 " />
</motion.span>
)}
</motion.button>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 6a8b5d65e0..058eb81d4f 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -24,16 +24,16 @@ import {
useDebounce,
VStack,
} from "@carbon/react";
-import {
- useFetcher,
- useFetchers,
- useParams,
- useSearchParams,
-} from "@remix-run/react";
+import { Link, useFetcher, useFetchers, useParams } from "@remix-run/react";
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
-import { LuChevronDown, LuSettings2, LuX } from "react-icons/lu";
+import {
+ LuChevronDown,
+ LuExternalLink,
+ LuSettings2,
+ LuX,
+} from "react-icons/lu";
import type { z } from "zod";
import { MethodIcon, MethodItemTypeIcon, TrackingTypeIcon } from "~/components";
import {
@@ -53,6 +53,7 @@ import type {
} from "~/components/SortableList";
import { SortableList, SortableListItem } from "~/components/SortableList";
import { usePermissions, useRouteData, useUser } from "~/hooks";
+import { getLinkToItemDetails } from "~/modules/items/ui/Item/ItemForm";
import type { MethodItemType, MethodType } from "~/modules/shared";
import { useBom } from "~/stores";
import { path } from "~/utils/path";
@@ -114,7 +115,14 @@ function makeItem(
id: material.id!,
title: (
<VStack spacing={0} className="py-1 cursor-pointer">
- <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ <div className="flex items-center gap-2 group">
+ <h3 className="font-semibold truncate">{material.itemReadableId}</h3>
+ {material.itemId && material.itemType && (
+ <Link to={getLinkToItemDetails(material.itemType, material.itemId)}>
+ <LuExternalLink className="h-4 w-4 opacity-0 group-hover:opacity-100" />
+ </Link>
+ )}
+ </div>
{material?.description && (
<span className="text-xs text-muted-foreground">
{material.description}{" "}
@@ -224,8 +232,6 @@ const QuoteBillOfMaterial = ({
const { quoteId, lineId } = useParams();
if (!quoteId) throw new Error("quoteId not found");
if (!lineId) throw new Error("lineId not found");
- const [searchParams] = useSearchParams();
- const materialId = searchParams.get("materialId");
const fetcher = useFetcher<{}>();
const permissions = usePermissions();