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: manufacturing tab for fixture

Brad Barbin05a94e5fbeb6
diff --git a/apps/carbon/app/components/Form/Item.tsx b/apps/carbon/app/components/Form/Item.tsx
index 4adbe29e3d..52be386bab 100644
--- a/apps/carbon/app/components/Form/Item.tsx
+++ b/apps/carbon/app/components/Form/Item.tsx
@@ -74,7 +74,7 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
name: created,
description: "",
itemTrackingType: "Inventory",
- replenishmentSystem: "Buy and Make",
+ replenishmentSystem: "Make",
unitOfMeasureCode: "EA",
defaultMethodType: "Make",
active: true,
@@ -95,7 +95,7 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
description: "",
itemTrackingType: "Non-Inventory",
unitOfMeasureCode: "EA",
- replenishmentSystem: "Buy and Make",
+ replenishmentSystem: "Buy",
defaultMethodType: "Buy",
active: true,
}}
@@ -115,7 +115,7 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
description: "",
itemTrackingType: "Inventory",
unitOfMeasureCode: "EA",
- replenishmentSystem: "Buy and Make",
+ replenishmentSystem: "Make",
defaultMethodType: "Buy",
active: true,
}}
@@ -137,7 +137,7 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
materialSubstanceId: "",
itemTrackingType: "Inventory",
unitOfMeasureCode: "EA",
- replenishmentSystem: "Buy and Make",
+ replenishmentSystem: "Buy",
defaultMethodType: "Buy",
active: true,
}}
@@ -158,7 +158,7 @@ const Item = ({ type, ...props }: ItemSelectProps) => {
description: "",
itemTrackingType: "Inventory",
unitOfMeasureCode: "EA",
- replenishmentSystem: "Buy and Make",
+ replenishmentSystem: "Buy",
defaultMethodType: "Buy",
active: true,
}}
diff --git a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
index 40290d6612..5c9b509795 100644
--- a/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BoMExplorer.tsx
@@ -14,15 +14,16 @@ import { LuChevronDown, LuChevronUp, LuSearch } from "react-icons/lu";
import type { FlatTreeItem } from "~/components/TreeView/TreeView";
import { TreeView, useTree } from "~/components/TreeView/TreeView";
import { path } from "~/utils/path";
-import type { Method } from "../../types";
+import type { Method, MethodItemType } from "../../types";
import { MethodIcon } from "./MethodIcon";
type BoMExplorerProps = {
+ itemType: MethodItemType;
methods: FlatTreeItem<Method>[];
selectedId?: string;
};
-const BoMExplorer = ({ methods, selectedId }: BoMExplorerProps) => {
+const BoMExplorer = ({ itemType, methods, selectedId }: BoMExplorerProps) => {
const [filterText, setFilterText] = useState("");
const parentRef = useRef<HTMLDivElement>(null);
@@ -109,10 +110,11 @@ const BoMExplorer = ({ methods, selectedId }: BoMExplorerProps) => {
onClick={() => {
selectNode(node.id);
if (node.data.isRoot) {
- navigate(path.to.makeMethod(itemId));
+ navigate(getRootLink(itemType, itemId));
} else {
navigate(
- path.to.partManufacturingMaterial(
+ getMaterialLink(
+ itemType,
itemId,
node.data.materialMakeMethodId ??
node.data.methodType.toLowerCase(),
@@ -219,3 +221,38 @@ function TaskLine({ isSelected }: { isSelected: boolean }) {
/>
);
}
+
+function getRootLink(itemType: MethodItemType, itemId: string) {
+ switch (itemType) {
+ case "Part":
+ return path.to.partMakeMethod(itemId);
+ case "Fixture":
+ return path.to.fixtureMakeMethod(itemId);
+ default:
+ throw new Error(`Unimplemented BoMExplorer itemType: ${itemType}`);
+ }
+}
+
+function getMaterialLink(
+ itemType: MethodItemType,
+ itemId: string,
+ makeMethodId: string,
+ materialId: string
+) {
+ switch (itemType) {
+ case "Part":
+ return path.to.partManufacturingMaterial(
+ itemId,
+ makeMethodId,
+ materialId
+ );
+ case "Fixture":
+ return path.to.fixtureManufacturingMaterial(
+ itemId,
+ makeMethodId,
+ materialId
+ );
+ default:
+ throw new Error(`Unimplemented BoMExplorer itemType: ${itemType}`);
+ }
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.costing.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.costing.tsx
index 17c8d4356d..d3e4409c60 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.costing.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.costing.tsx
@@ -1,3 +1,4 @@
+import { VStack } from "@carbon/react";
import { validationError, validator } from "@carbon/remix-validated-form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
@@ -92,13 +93,15 @@ export async function action({ request, params }: ActionFunctionArgs) {
export default function FixtureCostingRoute() {
const { itemCost } = useLoaderData<typeof loader>();
return (
- <ItemCostingForm
- key={itemCost.itemId}
- initialValues={{
- ...itemCost,
- itemPostingGroupId: itemCost?.itemPostingGroupId ?? undefined,
- ...getCustomFields(itemCost.customFields),
- }}
- />
+ <VStack spacing={2} className="p-2">
+ <ItemCostingForm
+ key={itemCost.itemId}
+ initialValues={{
+ ...itemCost,
+ itemPostingGroupId: itemCost?.itemPostingGroupId ?? undefined,
+ ...getCustomFields(itemCost.customFields),
+ }}
+ />
+ </VStack>
);
}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.details.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.details.tsx
index c32278d0ab..861a5394e2 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.details.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.details.tsx
@@ -76,7 +76,7 @@ export default function FixtureDetailsRoute() {
};
return (
- <VStack spacing={4}>
+ <VStack spacing={2} className="p-2">
<FixtureForm
key={fixtureInitialValues.id}
initialValues={fixtureInitialValues}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.inventory.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.inventory.tsx
index 6378b59e0c..1485cbf44d 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.inventory.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.inventory.tsx
@@ -1,3 +1,4 @@
+import { VStack } from "@carbon/react";
import { validationError, validator } from "@carbon/remix-validated-form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
@@ -187,13 +188,15 @@ export default function FixtureInventoryRoute() {
...getCustomFields(fixtureInventory.customFields ?? {}),
};
return (
- <PickMethodForm
- key={initialValues.itemId}
- initialValues={initialValues}
- quantities={quantities}
- locations={sharedFixturesData?.locations ?? []}
- shelves={shelves}
- type="Fixture"
- />
+ <VStack spacing={2} className="p-2">
+ <PickMethodForm
+ key={initialValues.itemId}
+ initialValues={initialValues}
+ quantities={quantities}
+ locations={sharedFixturesData?.locations ?? []}
+ shelves={shelves}
+ type="Fixture"
+ />
+ </VStack>
);
}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.$makeMethodId.$materialId.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.$makeMethodId.$materialId.tsx
new file mode 100644
index 0000000000..947fdb9d51
--- /dev/null
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.$makeMethodId.$materialId.tsx
@@ -0,0 +1,124 @@
+import type { JSONContent } from "@carbon/react";
+import { VStack } from "@carbon/react";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { json, redirect, useLoaderData, useParams } from "@remix-run/react";
+
+import type { MethodItemType, MethodType } from "~/modules/items";
+import {
+ BillOfMaterial,
+ BillOfProcess,
+ ItemForm,
+ getItem,
+ getMethodMaterial,
+ getMethodMaterials,
+ getMethodOperations,
+} from "~/modules/items";
+import { requirePermissions } from "~/services/auth/auth.server";
+import { flash } from "~/services/session.server";
+import { path } from "~/utils/path";
+import { error } from "~/utils/result";
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "parts",
+ });
+
+ const { itemId, materialId, makeMethodId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!materialId) throw new Error("Could not find materialId");
+ if (!makeMethodId) throw new Error("Could not find makeMethodId");
+
+ const [material, methodMaterials, methodOperations] = await Promise.all([
+ getMethodMaterial(client, materialId),
+ getMethodMaterials(client, makeMethodId),
+ getMethodOperations(client, makeMethodId),
+ ]);
+
+ if (material.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(material.error, "Failed to load material"))
+ );
+ }
+
+ if (methodOperations.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(methodOperations.error, "Failed to load method operations")
+ )
+ );
+ }
+ if (methodMaterials.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(methodMaterials.error, "Failed to load method materials")
+ )
+ );
+ }
+
+ const item = await getItem(client, material.data.itemId);
+ if (item.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(item.error, "Failed to load item"))
+ );
+ }
+
+ return json({
+ item: {
+ ...item.data,
+ defaultMethodType: item.data.defaultMethodType ?? "Buy",
+ unitOfMeasureCode: item.data.unitOfMeasureCode ?? "EA",
+ description: item.data.description ?? "",
+ },
+ material: material.data,
+ methodMaterials:
+ methodMaterials.data?.map((m) => ({
+ ...m,
+ description: m.item?.name ?? "",
+ methodType: m.methodType as MethodType,
+ itemType: m.itemType as MethodItemType,
+ })) ?? [],
+ methodOperations:
+ methodOperations.data?.map((operation) => ({
+ ...operation,
+ equipmentTypeId: operation.equipmentTypeId ?? undefined,
+ methodOperationWorkInstruction:
+ operation.methodOperationWorkInstruction as {
+ content: JSONContent | null;
+ },
+ })) ?? [],
+ });
+}
+
+export default function MethodMaterialMakePage() {
+ const { item, methodMaterials, methodOperations } =
+ useLoaderData<typeof loader>();
+ const { itemId, makeMethodId, materialId } = useParams();
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!makeMethodId) throw new Error("Could not find makeMethodId");
+ if (!materialId) throw new Error("Could not find materialId");
+
+ return (
+ <VStack spacing={2} className="p-2">
+ <ItemForm
+ key={`item:${itemId}:${makeMethodId}:${materialId}`}
+ type={item.type}
+ initialValues={item}
+ />
+ <BillOfMaterial
+ key={`bom:${itemId}:${makeMethodId}:${materialId}`}
+ makeMethodId={makeMethodId}
+ materials={methodMaterials}
+ />
+ <BillOfProcess
+ key={`bop:${itemId}:${makeMethodId}:${materialId}`}
+ makeMethodId={makeMethodId}
+ operations={methodOperations}
+ />
+ </VStack>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing._index.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing._index.tsx
new file mode 100644
index 0000000000..4b6959d9d3
--- /dev/null
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing._index.tsx
@@ -0,0 +1,10 @@
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { redirect } from "@remix-run/node";
+import { path } from "~/utils/path";
+
+export async function loader({ params }: LoaderFunctionArgs) {
+ const { itemId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+
+ throw redirect(path.to.fixtureMakeMethod(itemId));
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.buy.$materialId.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.buy.$materialId.tsx
new file mode 100644
index 0000000000..50cdb6edd3
--- /dev/null
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.buy.$materialId.tsx
@@ -0,0 +1,62 @@
+import { VStack } from "@carbon/react";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { json, redirect, useLoaderData, useParams } from "@remix-run/react";
+
+import { ItemForm, getItem, getMethodMaterial } from "~/modules/items";
+import { requirePermissions } from "~/services/auth/auth.server";
+import { flash } from "~/services/session.server";
+import { path } from "~/utils/path";
+import { error } from "~/utils/result";
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "parts",
+ });
+
+ const { itemId, materialId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!materialId) throw new Error("Could not find materialId");
+
+ const [material] = await Promise.all([getMethodMaterial(client, materialId)]);
+
+ if (material.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(material.error, "Failed to load material"))
+ );
+ }
+
+ const item = await getItem(client, material.data.itemId);
+ if (item.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(item.error, "Failed to load item"))
+ );
+ }
+
+ return json({
+ item: {
+ ...item.data,
+ defaultMethodType: item.data.defaultMethodType ?? "Buy",
+ unitOfMeasureCode: item.data.unitOfMeasureCode ?? "EA",
+ description: item.data.description ?? "",
+ },
+ material: material.data,
+ });
+}
+
+export default function MethodMaterialPickPage() {
+ const { item } = useLoaderData<typeof loader>();
+ const { itemId, materialId } = useParams();
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!materialId) throw new Error("Could not find materialId");
+
+ return (
+ <VStack spacing={2} className="p-2">
+ <ItemForm
+ key={`item:${itemId}:${materialId}`}
+ type={item.type}
+ initialValues={item}
+ />
+ </VStack>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.method.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.method.tsx
new file mode 100644
index 0000000000..52de5fe765
--- /dev/null
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.method.tsx
@@ -0,0 +1,38 @@
+import { VStack } from "@carbon/react";
+import { useParams } from "@remix-run/react";
+import { useRouteData } from "~/hooks";
+
+import type { MakeMethod, Material, MethodOperation } from "~/modules/items";
+import { BillOfMaterial, BillOfProcess } from "~/modules/items";
+import { path } from "~/utils/path";
+
+export default function MakeMethodRoute() {
+ const { itemId } = useParams();
+ if (!itemId) throw new Error("Could not find itemId");
+
+ const manufacturingRouteData = useRouteData<{
+ makeMethod: MakeMethod;
+ methodMaterials: Material[];
+ methodOperations: MethodOperation[];
+ }>(path.to.fixtureManufacturing(itemId));
+
+ const makeMethodId = manufacturingRouteData?.makeMethod?.id;
+ if (!makeMethodId) throw new Error("Could not find makeMethodId");
+
+ return (
+ <VStack spacing={2} className="p-2">
+ <BillOfMaterial
+ key={itemId}
+ makeMethodId={makeMethodId}
+ // @ts-ignore
+ materials={manufacturingRouteData?.methodMaterials ?? []}
+ />
+ <BillOfProcess
+ key={itemId}
+ makeMethodId={makeMethodId}
+ // @ts-ignore
+ operations={manufacturingRouteData?.methodOperations ?? []}
+ />
+ </VStack>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.pick.$materialId.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.pick.$materialId.tsx
new file mode 100644
index 0000000000..50cdb6edd3
--- /dev/null
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.pick.$materialId.tsx
@@ -0,0 +1,62 @@
+import { VStack } from "@carbon/react";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { json, redirect, useLoaderData, useParams } from "@remix-run/react";
+
+import { ItemForm, getItem, getMethodMaterial } from "~/modules/items";
+import { requirePermissions } from "~/services/auth/auth.server";
+import { flash } from "~/services/session.server";
+import { path } from "~/utils/path";
+import { error } from "~/utils/result";
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ view: "parts",
+ });
+
+ const { itemId, materialId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!materialId) throw new Error("Could not find materialId");
+
+ const [material] = await Promise.all([getMethodMaterial(client, materialId)]);
+
+ if (material.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(material.error, "Failed to load material"))
+ );
+ }
+
+ const item = await getItem(client, material.data.itemId);
+ if (item.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(request, error(item.error, "Failed to load item"))
+ );
+ }
+
+ return json({
+ item: {
+ ...item.data,
+ defaultMethodType: item.data.defaultMethodType ?? "Buy",
+ unitOfMeasureCode: item.data.unitOfMeasureCode ?? "EA",
+ description: item.data.description ?? "",
+ },
+ material: material.data,
+ });
+}
+
+export default function MethodMaterialPickPage() {
+ const { item } = useLoaderData<typeof loader>();
+ const { itemId, materialId } = useParams();
+ if (!itemId) throw new Error("Could not find itemId");
+ if (!materialId) throw new Error("Could not find materialId");
+
+ return (
+ <VStack spacing={2} className="p-2">
+ <ItemForm
+ key={`item:${itemId}:${materialId}`}
+ type={item.type}
+ initialValues={item}
+ />
+ </VStack>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
index af92fabb44..f685ad9a1f 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.manufacturing.tsx
@@ -1,3 +1,234 @@
-export default function FixtureManufacturingRoute() {
- return <pre>TODO</pre>;
+import type { JSONContent } from "@carbon/react";
+import {
+ Button,
+ ClientOnly,
+ HStack,
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+ ScrollArea,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ VStack,
+} from "@carbon/react";
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import {
+ Outlet,
+ json,
+ redirect,
+ useLoaderData,
+ useParams,
+} from "@remix-run/react";
+import { LuCopy, LuLink } from "react-icons/lu";
+
+import type { FlatTreeItem } from "~/components/TreeView/TreeView";
+import { flattenTree } from "~/components/TreeView/TreeView";
+import { useRouteData } from "~/hooks";
+import type {
+ Fixture,
+ Method,
+ MethodItemType,
+ MethodType,
+} from "~/modules/items";
+import {
+ BoMExplorer,
+ getMakeMethod,
+ getMethodMaterials,
+ getMethodOperations,
+ getMethodTree,
+} from "~/modules/items";
+import { requirePermissions } from "~/services/auth/auth.server";
+import { flash } from "~/services/session.server";
+import { path } from "~/utils/path";
+import { error } from "~/utils/result";
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "parts",
+ });
+
+ const { itemId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+
+ const makeMethod = await getMakeMethod(client, itemId, companyId);
+
+ if (makeMethod.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(makeMethod.error, "Failed to load make method")
+ )
+ );
+ }
+
+ const [methodTree, methodMaterials, methodOperations] = await Promise.all([
+ getMethodTree(client, makeMethod.data.id),
+ getMethodMaterials(client, makeMethod.data.id),
+ getMethodOperations(client, makeMethod.data.id),
+ ]);
+ if (methodTree?.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(methodTree.error, "Failed to load method tree")
+ )
+ );
+ }
+
+ if (methodOperations.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(methodOperations.error, "Failed to load method operations")
+ )
+ );
+ }
+ if (methodMaterials.error) {
+ throw redirect(
+ path.to.fixtureDetails(itemId),
+ await flash(
+ request,
+ error(methodMaterials.error, "Failed to load method materials")
+ )
+ );
+ }
+
+ return json({
+ makeMethod: makeMethod.data,
+ methodMaterials:
+ methodMaterials.data?.map((m) => ({
+ ...m,
+ description: m.item?.name ?? "",
+ methodType: m.methodType as MethodType,
+ itemType: m.itemType as MethodItemType,
+ })) ?? [],
+ methodOperations:
+ methodOperations.data?.map((operation) => ({
+ ...operation,
+ equipmentTypeId: operation.equipmentTypeId ?? undefined,
+ methodOperationWorkInstruction:
+ operation.methodOperationWorkInstruction as {
+ content: JSONContent | null;
+ },
+ })) ?? [],
+ methods: (methodTree.data.length > 0
+ ? flattenTree(methodTree.data[0])
+ : []) satisfies FlatTreeItem<Method>[],
+ });
+}
+
+export default function FixtureManufacturing() {
+ const { methods } = useLoaderData<typeof loader>();
+
+ const params = useParams();
+ const { itemId } = params;
+ if (!itemId) throw new Error("Could not find itemId");
+
+ const routeData = useRouteData<{
+ fixtureSummary: Fixture;
+ }>(path.to.fixture(itemId));
+
+ return (
+ <div className="flex flex-grow overflow-hidden">
+ <ClientOnly fallback={null}>
+ {() => (
+ <ResizablePanelGroup direction="horizontal">
+ <ResizablePanel
+ order={1}
+ minSize={10}
+ defaultSize={20}
+ className="bg-card"
+ >
+ <ScrollArea className="h-[calc(100vh-99px)]">
+ <div className="grid h-full overflow-hidden p-2">
+ <BoMExplorer
+ itemType="Fixture"
+ // @ts-ignore
+ methods={methods}
+ />
+ </div>
+ </ScrollArea>
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel
+ order={2}
+ minSize={40}
+ defaultSize={60}
+ className="border-t border-border"
+ >
+ <ScrollArea className="h-[calc(100vh-99px)]">
+ <Outlet key={JSON.stringify(params)} />
+ </ScrollArea>
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel
+ order={3}
+ minSize={10}
+ defaultSize={20}
+ className="bg-card"
+ >
+ <ScrollArea className="h-[calc(100vh-99px)] px-4 py-2">
+ <VStack spacing={2}>
+ <HStack className="w-full justify-between">
+ <h3 className="text-xs text-muted-foreground">
+ Properties
+ </h3>
+ <HStack spacing={1}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ aria-label="Link"
+ size="sm"
+ className="p-1"
+ onClick={() =>
+ navigator.clipboard.writeText(
+ window.location.origin + path.to.fixture(itemId)
+ )
+ }
+ >
+ <LuLink className="w-3 h-3" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>Copy link to fixture</span>
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ aria-label="Copy"
+ size="sm"
+ className="p-1"
+ onClick={() =>
+ navigator.clipboard.writeText(
+ routeData?.fixtureSummary?.id ?? ""
+ )
+ }
+ >
+ <LuCopy className="w-3 h-3" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <span>Copy fixture number</span>
+ </TooltipContent>
+ </Tooltip>
+ </HStack>
+ </HStack>
+ <span className="text-sm">
+ {routeData?.fixtureSummary?.name}
+ </span>
+ </VStack>
+ </ScrollArea>
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ )}
+ </ClientOnly>
+ </div>
+ );
}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.purchasing.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.purchasing.tsx
index 4845904751..ca1f0ec365 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.purchasing.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.purchasing.tsx
@@ -1,3 +1,4 @@
+import { VStack } from "@carbon/react";
import { validationError, validator } from "@carbon/remix-validated-form";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
@@ -107,7 +108,7 @@ export default function FixturePurchasingRoute() {
};
return (
- <>
+ <VStack spacing={2} className="p-2">
<ItemPurchasingForm
key={initialValues.itemId}
initialValues={initialValues}
@@ -116,6 +117,6 @@ export default function FixturePurchasingRoute() {
}
/>
<BuyMethods buyMethods={buyMethods} />
- </>
+ </VStack>
);
}
diff --git a/apps/carbon/app/routes/x+/fixture+/$itemId.tsx b/apps/carbon/app/routes/x+/fixture+/$itemId.tsx
index af31e3624f..ec332406b7 100644
--- a/apps/carbon/app/routes/x+/fixture+/$itemId.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/$itemId.tsx
@@ -1,7 +1,6 @@
-import { VStack } from "@carbon/react";
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
-import { Outlet } from "@remix-run/react";
+import { Outlet, useMatches } from "@remix-run/react";
import {
FixtureHeader,
FixtureProperties,
@@ -52,16 +51,19 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
}
export default function FixtureRoute() {
+ const matches = useMatches();
+ const isManufacturing = matches.some(
+ (match) => match.id === "routes/x+/fixture+/$itemId.manufacturing"
+ );
+
return (
<div className="flex flex-col h-[calc(100vh-49px)] w-full">
<FixtureHeader />
<div className="flex h-[calc(100vh-99px)] w-full">
<div className="flex h-full w-full overflow-y-auto">
- <VStack spacing={2} className="p-2">
- <Outlet />
- </VStack>
+ <Outlet />
</div>
- <FixtureProperties />
+ {!isManufacturing && <FixtureProperties />}
</div>
</div>
);
diff --git a/apps/carbon/app/routes/x+/fixture+/new.tsx b/apps/carbon/app/routes/x+/fixture+/new.tsx
index 52bdb8891c..a756129136 100644
--- a/apps/carbon/app/routes/x+/fixture+/new.tsx
+++ b/apps/carbon/app/routes/x+/fixture+/new.tsx
@@ -61,8 +61,8 @@ export default function FixturesNewRoute() {
id: "",
name: "",
description: "",
- replenishmentSystem: "Buy" as const,
- defaultMethodType: "Buy" as const,
+ replenishmentSystem: "Make" as const,
+ defaultMethodType: "Make" as const,
itemTrackingType: "Inventory" as "Inventory",
unitOfMeasureCode: "EA",
active: true,
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing._index.tsx b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing._index.tsx
index 3968f50245..642c423749 100644
--- a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing._index.tsx
+++ b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing._index.tsx
@@ -6,5 +6,5 @@ export async function loader({ params }: LoaderFunctionArgs) {
const { itemId } = params;
if (!itemId) throw new Error("Could not find itemId");
- throw redirect(path.to.makeMethod(itemId));
+ throw redirect(path.to.partMakeMethod(itemId));
}
diff --git a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
index eafe42114c..2e4168e519 100644
--- a/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
+++ b/apps/carbon/app/routes/x+/part+/$itemId.manufacturing.tsx
@@ -146,6 +146,7 @@ export default function PartManufacturing() {
<ScrollArea className="h-[calc(100vh-99px)]">
<div className="grid h-full overflow-hidden p-2">
<BoMExplorer
+ itemType="Part"
// @ts-ignore
methods={methods}
/>
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index 506fc9cf47..072d5a996c 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -297,8 +297,18 @@ export const path = {
generatePath(`${x}/fixture/${id}/inventory`),
fixtureInventoryLocation: (id: string, locationId: string) =>
generatePath(`${x}/fixture/${id}/inventory?location=${locationId}`),
+ fixtureMakeMethod: (id: string) =>
+ generatePath(`${x}/fixture/${id}/manufacturing/method`),
fixtureManufacturing: (id: string) =>
generatePath(`${x}/fixture/${id}/manufacturing`),
+ fixtureManufacturingMaterial: (
+ itemId: string,
+ makeMethodId: string,
+ methodMaterialId: string
+ ) =>
+ generatePath(
+ `${x}/fixture/${itemId}/manufacturing/${makeMethodId}/${methodMaterialId}`
+ ),
fixturePlanning: (id: string) =>
generatePath(`${x}/fixture/${id}/planning`),
fixturePlanningLocation: (id: string, locationId: string) =>
@@ -328,8 +338,6 @@ export const path = {
locations: `${x}/resources/locations`,
login: "/login",
logout: "/logout",
- makeMethod: (id: string) =>
- generatePath(`${x}/part/${id}/manufacturing/method`),
material: (id: string) => generatePath(`${x}/material/${id}`),
materialCosting: (id: string) =>
generatePath(`${x}/material/${id}/costing`),
@@ -481,6 +489,8 @@ export const path = {
partInventory: (id: string) => generatePath(`${x}/part/${id}/inventory`),
partInventoryLocation: (id: string, locationId: string) =>
generatePath(`${x}/part/${id}/inventory?location=${locationId}`),
+ partMakeMethod: (id: string) =>
+ generatePath(`${x}/part/${id}/manufacturing/method`),
partManufacturing: (id: string) =>
generatePath(`${x}/part/${id}/manufacturing`),
partManufacturingMaterial: (