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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
style: update headers and stub out bom import
Brad Barbin570420f8e2b1
diff --git a/apps/erp/app/components/Table/components/TableHeader.tsx b/apps/erp/app/components/Table/components/TableHeader.tsxindex 8db49d7e75..aafd9cc9fd 100644--- a/apps/erp/app/components/Table/components/TableHeader.tsx+++ b/apps/erp/app/components/Table/components/TableHeader.tsx@@ -30,7 +30,13 @@ import type {} from "@tanstack/react-table";import { useEffect, useState, type ReactNode } from "react";import { BsThreeDotsVertical } from "react-icons/bs";-import { LuCheck, LuFilePen, LuImport, LuLayers, LuLock } from "react-icons/lu";+import {+ LuCheck,+ LuDownload,+ LuFilePen,+ LuLayers,+ LuLock,+} from "react-icons/lu";import { SearchFilter } from "~/components";import { ImportCSVModal } from "~/components/ImportCSVModal";import { CollapsibleSidebarTrigger } from "~/components/Layout/Navigation";@@ -219,7 +225,7 @@ const TableHeader = <T extends object>({setImportCSVTable(table);}}>- <DropdownMenuIcon icon={<LuImport />} />+ <DropdownMenuIcon icon={<LuDownload />} />Import {label} CSV</DropdownMenuItem>))}diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsxindex 8046961806..159ffe1043 100644--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx@@ -1,5 +1,6 @@import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -23,10 +24,10 @@ import {LuTruck,} from "react-icons/lu";+import ConfirmDelete from "~/components/Modals/ConfirmDelete";import { usePermissions, useRouteData } from "~/hooks";import type { ItemTracking, Receipt, ReceiptLine } from "~/modules/inventory";import { ReceiptPostModal, ReceiptStatus } from "~/modules/inventory";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";import { path } from "~/utils/path";const ReceiptHeader = () => {@@ -78,12 +79,14 @@ const ReceiptHeader = () => {<span>{routeData?.receipt?.receiptId}</span></Heading></Link>+ <Copy text={routeData?.receipt?.receiptId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -142,8 +145,7 @@ const ReceiptHeader = () => {action={path.to.deleteReceipt(receiptId)}isOpen={deleteModal.isOpen}name={routeData?.receipt?.receiptId ?? "receipt"}- text={`Are you sure you want to delete ${routeData?.receipt- ?.receiptId}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.receipt?.receiptId}? This cannot be undone.`}onCancel={() => {deleteModal.onClose();}}@@ -166,7 +168,7 @@ function SourceDocumentLink({sourceDocumentReadableId?: string;}) {const permissions = usePermissions();-+if (!sourceDocument || !sourceDocumentId || !sourceDocumentReadableId)return null;switch (sourceDocument) {diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsxindex ced2559bf6..178a7a163e 100644--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentHeader.tsx@@ -1,5 +1,6 @@import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -26,9 +27,9 @@ import {LuTrash,LuTruck,} from "react-icons/lu";+import ConfirmDelete from "~/components/Modals/ConfirmDelete";import { usePermissions, useRouteData } from "~/hooks";import type { ItemTracking, Shipment, ShipmentLine } from "~/modules/inventory";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";import type { TrackedEntityAttributes } from "@carbon/utils";import { labelSizes } from "@carbon/utils";@@ -110,12 +111,14 @@ const ShipmentHeader = () => {<span>{routeData?.shipment?.shipmentId}</span></Heading></Link>+ <Copy text={routeData?.shipment?.shipmentId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -378,8 +381,7 @@ const ShipmentHeader = () => {action={path.to.deleteShipment(shipmentId)}isOpen={deleteModal.isOpen}name={routeData?.shipment?.shipmentId ?? "shipment"}- text={`Are you sure you want to delete ${routeData?.shipment- ?.shipmentId}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.shipment?.shipmentId}? This cannot be undone.`}onCancel={() => {deleteModal.onClose();}}diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsxindex 19289d069d..a76f29813c 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceHeader.tsx@@ -1,6 +1,7 @@import { useCarbon } from "@carbon/auth";import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -159,12 +160,14 @@ const PurchaseInvoiceHeader = () => {<span>{routeData?.purchaseInvoice?.invoiceId}</span></Heading></Link>+ <Copy text={routeData?.purchaseInvoice?.invoiceId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -314,8 +317,7 @@ const PurchaseInvoiceHeader = () => {action={path.to.deletePurchaseInvoice(invoiceId)}isOpen={deleteModal.isOpen}name={routeData?.purchaseInvoice?.invoiceId ?? "purchase invoice"}- text={`Are you sure you want to delete ${routeData?.purchaseInvoice- ?.invoiceId}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.purchaseInvoice?.invoiceId}? This cannot be undone.`}onCancel={() => {deleteModal.onClose();}}diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsxindex ed642d7d50..2a812bc280 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx@@ -1,6 +1,7 @@import { useCarbon } from "@carbon/auth";import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -167,6 +168,7 @@ const SalesInvoiceHeader = () => {<span>{routeData?.salesInvoice?.invoiceId}</span></Heading></Link>+ <Copy text={routeData?.salesInvoice?.invoiceId ?? ""} /><SalesInvoiceStatus status={salesInvoice.status} /></HStack><HStack>diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsxindex 0b8849640b..7c0db6b8d0 100644--- a/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx@@ -42,12 +42,16 @@ const ConsumableHeader = () => {{routeData?.consumableSummary?.readableIdWithRevision}</Heading></Link>+ <Copy+ text={routeData?.consumableSummary?.readableIdWithRevision ?? ""}+ /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -64,9 +68,6 @@ const ConsumableHeader = () => {</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <Copy- text={routeData?.consumableSummary?.readableIdWithRevision ?? ""}- /></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsxindex 7305a93c15..c987706596 100644--- a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx+++ b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx@@ -6,6 +6,9 @@ import {DropdownMenuContent,DropdownMenuIcon,DropdownMenuItem,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,HStack,HoverCard,@@ -17,6 +20,7 @@ import {InputLeftElement,VStack,cn,+ useDisclosure,useMount,} from "@carbon/react";import { useOptimisticLocation } from "@carbon/remix";@@ -27,12 +31,14 @@ import {LuChevronDown,LuChevronRight,LuDownload,+ LuEllipsisVertical,LuExternalLink,LuSearch,LuTable,} from "react-icons/lu";import { MethodIcon, MethodItemTypeIcon } from "~/components";import { OnshapeStatus } from "~/components/Icons";+import { ImportCSVModal } from "~/components/ImportCSVModal";import { OnshapeSync } from "~/components/OnshapeSync";import type { FlatTreeItem } from "~/components/TreeView";import { LevelLine, TreeView, useTree } from "~/components/TreeView";@@ -125,146 +131,152 @@ const BoMExplorer = ({}});+ const importBomDisclosure = useDisclosure();+return (- <VStack className="h-full">- <HStack className="w-full justify-between flex-shrink-0">- <InputGroup size="sm" className="flex flex-grow">- <InputLeftElement>- <LuSearch className="h-4 w-4" />- </InputLeftElement>- <Input- placeholder="Search..."- value={filterText}- onChange={(e) => setFilterText(e.target.value)}- />- </InputGroup>+ <>+ <VStack className="h-full">+ <HStack className="w-full justify-between flex-shrink-0">+ <InputGroup size="sm" className="flex flex-grow">+ <InputLeftElement>+ <LuSearch className="h-4 w-4" />+ </InputLeftElement>+ <Input+ placeholder="Search..."+ value={filterText}+ onChange={(e) => setFilterText(e.target.value)}+ />+ </InputGroup>- <DropdownMenu>- <DropdownMenuTrigger>- <IconButton- aria-label="Actions"- variant="ghost"- icon={<LuDownload />}+ <DropdownMenu>+ <DropdownMenuTrigger>+ <IconButton+ aria-label="Actions"+ variant="secondary"+ size="sm"+ icon={<LuEllipsisVertical />}+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>+ <DropdownMenuIcon icon={<LuDownload />} />+ Export+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ <DropdownMenuItem asChild>+ <a+ href={path.to.api.billOfMaterialsCsv(makeMethodId, false)}+ target="_blank"+ rel="noreferrer"+ >+ <DropdownMenuIcon icon={<LuTable />} />+ <div className="flex flex-grow items-center gap-4 justify-between">+ <span>BoM</span>+ <Badge variant="green" className="text-xs">+ CSV+ </Badge>+ </div>+ </a>+ </DropdownMenuItem>+ <DropdownMenuItem asChild>+ <a+ href={path.to.api.billOfMaterialsCsv(makeMethodId, true)}+ target="_blank"+ rel="noreferrer"+ >+ <DropdownMenuIcon icon={<LuTable />} />+ <div className="flex flex-grow items-center gap-4 justify-between">+ <span>BoM + BoP</span>+ <Badge variant="green" className="text-xs">+ CSV+ </Badge>+ </div>+ </a>+ </DropdownMenuItem>+ <DropdownMenuItem asChild>+ <a+ href={path.to.api.billOfMaterials(makeMethodId, false)}+ target="_blank"+ rel="noreferrer"+ >+ <DropdownMenuIcon icon={<LuBraces />} />+ <div className="flex flex-grow items-center gap-4 justify-between">+ <span>BoM</span>+ <Badge variant="outline" className="text-xs">+ JSON+ </Badge>+ </div>+ </a>+ </DropdownMenuItem>+ <DropdownMenuItem asChild>+ <a+ href={path.to.api.billOfMaterials(makeMethodId, true)}+ target="_blank"+ rel="noreferrer"+ >+ <DropdownMenuIcon icon={<LuBraces />} />+ <div className="flex flex-grow items-center gap-4 justify-between">+ <span>BoM + BoP</span>+ <Badge variant="outline" className="text-xs">+ JSON+ </Badge>+ </div>+ </a>+ </DropdownMenuItem>+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ {/* <DropdownMenuItem onClick={importBomDisclosure.onOpen}>+ <DropdownMenuIcon icon={<LuUpload />} />+ Import+ </DropdownMenuItem> */}+ </DropdownMenuContent>+ </DropdownMenu>+ </HStack>+ {integrations.has("onshape") && (+ <div className="flex flex-shrink-0 w-full">+ <OnshapeSync+ makeMethodId={makeMethodId}+ itemId={itemId}+ isDisabled={makeMethodStatus !== "Draft"}/>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem asChild>- <a- href={path.to.api.billOfMaterialsCsv(makeMethodId, false)}- target="_blank"- rel="noreferrer"- >- <DropdownMenuIcon icon={<LuTable />} />- <div className="flex flex-grow items-center gap-4 justify-between">- <span>BoM</span>- <Badge variant="green" className="text-xs">- CSV- </Badge>- </div>- </a>- </DropdownMenuItem>- <DropdownMenuItem asChild>- <a- href={path.to.api.billOfMaterialsCsv(makeMethodId, true)}- target="_blank"- rel="noreferrer"- >- <DropdownMenuIcon icon={<LuTable />} />- <div className="flex flex-grow items-center gap-4 justify-between">- <span>BoM + BoP</span>- <Badge variant="green" className="text-xs">- CSV- </Badge>- </div>- </a>- </DropdownMenuItem>- <DropdownMenuItem asChild>- <a- href={path.to.api.billOfMaterials(makeMethodId, false)}- target="_blank"- rel="noreferrer"- >- <DropdownMenuIcon icon={<LuBraces />} />- <div className="flex flex-grow items-center gap-4 justify-between">- <span>BoM</span>- <Badge variant="outline" className="text-xs">- JSON- </Badge>- </div>- </a>- </DropdownMenuItem>- <DropdownMenuItem asChild>- <a- href={path.to.api.billOfMaterials(makeMethodId, true)}- target="_blank"- rel="noreferrer"- >- <DropdownMenuIcon icon={<LuBraces />} />- <div className="flex flex-grow items-center gap-4 justify-between">- <span>BoM + BoP</span>- <Badge variant="outline" className="text-xs">- JSON- </Badge>- </div>- </a>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </HStack>- {integrations.has("onshape") && (- <div className="flex flex-shrink-0 w-full">- <OnshapeSync- makeMethodId={makeMethodId}- itemId={itemId}- isDisabled={makeMethodStatus !== "Draft"}- />- </div>- )}- <div className="flex flex-1 min-h-0 w-full">- <TreeView- parentRef={parentRef}- virtualizer={virtualizer}- autoFocus- tree={methods}- nodes={nodes}- getNodeProps={getNodeProps}- getTreeProps={getTreeProps}- parentClassName="h-full"- renderNode={({ node, state }) => {- return (- <HoverCard>- <HoverCardTrigger asChild>- <div- key={node.id}- className={cn(- "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1 group/node",- state.selected- ? "bg-muted hover:bg-muted/90"- : "bg-transparent hover:bg-muted/90"- )}- onClick={() => {- selectNode(node.id);- setSelectedMaterialId(node.data.methodMaterialId);- if (node.data.isRoot) {- if (- location.pathname !==- getRootLink(itemType, itemId, methodId)- ) {- navigate(getRootLink(itemType, itemId, methodId));- }- } else {- if (- location.pathname !==- getMaterialLink(- itemType,- itemId,- methodId,- node.data.methodType === "Make"- ? node.data.materialMakeMethodId- : node.data.makeMethodId- )- ) {- navigate(+ </div>+ )}+ <div className="flex flex-1 min-h-0 w-full">+ <TreeView+ parentRef={parentRef}+ virtualizer={virtualizer}+ autoFocus+ tree={methods}+ nodes={nodes}+ getNodeProps={getNodeProps}+ getTreeProps={getTreeProps}+ parentClassName="h-full"+ renderNode={({ node, state }) => {+ return (+ <HoverCard>+ <HoverCardTrigger asChild>+ <div+ key={node.id}+ className={cn(+ "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2 gap-1 group/node",+ state.selected+ ? "bg-muted hover:bg-muted/90"+ : "bg-transparent hover:bg-muted/90"+ )}+ onClick={() => {+ selectNode(node.id);+ setSelectedMaterialId(node.data.methodMaterialId);+ if (node.data.isRoot) {+ if (+ location.pathname !==+ getRootLink(itemType, itemId, methodId)+ ) {+ navigate(getRootLink(itemType, itemId, methodId));+ }+ } else {+ if (+ location.pathname !==getMaterialLink(itemType,itemId,@@ -273,79 +285,96 @@ const BoMExplorer = ({? node.data.materialMakeMethodId: node.data.makeMethodId)- );+ ) {+ navigate(+ getMaterialLink(+ itemType,+ itemId,+ methodId,+ node.data.methodType === "Make"+ ? node.data.materialMakeMethodId+ : node.data.makeMethodId+ )+ );+ }}- }- }}- >- <div className="flex h-8 items-center">- {Array.from({ length: node.level }).map((_, index) => (- <LevelLine key={index} isSelected={state.selected} />- ))}- <div- className={cn(- "flex h-8 w-4 items-center",- node.hasChildren && "hover:bg-accent"- )}- onClick={(e) => {- e.stopPropagation();- if (e.altKey) {- if (state.expanded) {- collapseAllBelowDepth(node.level);+ }}+ >+ <div className="flex h-8 items-center">+ {Array.from({ length: node.level }).map((_, index) => (+ <LevelLine key={index} isSelected={state.selected} />+ ))}+ <div+ className={cn(+ "flex h-8 w-4 items-center",+ node.hasChildren && "hover:bg-accent"+ )}+ onClick={(e) => {+ e.stopPropagation();+ if (e.altKey) {+ if (state.expanded) {+ collapseAllBelowDepth(node.level);+ } else {+ expandAllBelowDepth(node.level);+ }} else {- expandAllBelowDepth(node.level);+ toggleExpandNode(node.id);}- } else {- toggleExpandNode(node.id);- }- scrollToNode(node.id);- }}- >- {node.hasChildren ? (- state.expanded ? (- <LuChevronDown className="h-4 w-4 text-gray-400 flex-shrink-0 ml-1" />+ scrollToNode(node.id);+ }}+ >+ {node.hasChildren ? (+ state.expanded ? (+ <LuChevronDown className="h-4 w-4 text-gray-400 flex-shrink-0 ml-1" />+ ) : (+ <LuChevronRight className="h-4 w-4 text-gray-400 flex-shrink-0 ml-1" />+ )) : (- <LuChevronRight className="h-4 w-4 text-gray-400 flex-shrink-0 ml-1" />- )- ) : (- <div className="h-8 w-4" />- )}+ <div className="h-8 w-4" />+ )}+ </div></div>- </div>- <div className="flex w-full items-center justify-between gap-2">- <div className="flex items-center gap-2 overflow-x-hidden">- <MethodIcon- type={- // node.data.isRoot ? "Method" :- node.data.methodType- }- isKit={node.data.kit}- className="h-4 min-h-4 w-4 min-w-4 flex-shrink-0"- />- <NodeText node={node} />- </div>- <div className="flex items-center gap-1">- {node.data.isRoot ? (- <Badge variant="outline" className="text-xs">- V{makeMethodVersion}- </Badge>- ) : (- <NodeData node={node} />- )}+ <div className="flex w-full items-center justify-between gap-2">+ <div className="flex items-center gap-2 overflow-x-hidden">+ <MethodIcon+ type={+ // node.data.isRoot ? "Method" :+ node.data.methodType+ }+ isKit={node.data.kit}+ className="h-4 min-h-4 w-4 min-w-4 flex-shrink-0"+ />+ <NodeText node={node} />+ </div>+ <div className="flex items-center gap-1">+ {node.data.isRoot ? (+ <Badge variant="outline" className="text-xs">+ V{makeMethodVersion}+ </Badge>+ ) : (+ <NodeData node={node} />+ )}+ </div></div></div>- </div>- </HoverCardTrigger>- <HoverCardContent side="right">- <NodePreview node={node} />- </HoverCardContent>- </HoverCard>- );- }}+ </HoverCardTrigger>+ <HoverCardContent side="right">+ <NodePreview node={node} />+ </HoverCardContent>+ </HoverCard>+ );+ }}+ />+ </div>+ </VStack>+ {importBomDisclosure.isOpen && (+ <ImportCSVModal+ table={"methodMaterial"}+ onClose={() => importBomDisclosure.onClose()}/>- </div>- </VStack>+ )}+ </>);};diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsxindex 32e2dde0a7..ea53a1eb43 100644--- a/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx+++ b/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx@@ -43,13 +43,16 @@ const MaterialHeader = () => {<span>{routeData?.materialSummary?.readableIdWithRevision}</span></Heading></Link>-+ <Copy+ text={routeData?.materialSummary?.readableIdWithRevision ?? ""}+ /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -66,9 +69,6 @@ const MaterialHeader = () => {</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <Copy- text={routeData?.materialSummary?.readableIdWithRevision ?? ""}- /></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx b/apps/erp/app/modules/items/ui/Parts/PartHeader.tsxindex c80aaf1b2a..6c6976662c 100644--- a/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx+++ b/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx@@ -43,13 +43,14 @@ const PartHeader = () => {<span>{routeData?.partSummary?.readableIdWithRevision}</span></Heading></Link>-+ <Copy text={routeData?.partSummary?.readableIdWithRevision ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ size="sm"+ variant="secondary"/></DropdownMenuTrigger><DropdownMenuContent>@@ -66,7 +67,6 @@ const PartHeader = () => {</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <Copy text={routeData?.partSummary?.readableIdWithRevision ?? ""} /></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx b/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsxindex 5053c34814..c4a227c17b 100644--- a/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx+++ b/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx@@ -41,12 +41,14 @@ const ToolHeader = () => {<span>{routeData?.toolSummary?.readableIdWithRevision}</span></Heading></Link>+ <Copy text={routeData?.toolSummary?.readableIdWithRevision ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -63,7 +65,6 @@ const ToolHeader = () => {</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <Copy text={routeData?.toolSummary?.readableIdWithRevision ?? ""} /></HStack></VStack><VStack spacing={0} className="flex-shrink justify-center items-end">diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsxindex b8184841a3..078f0cbd1c 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx@@ -1016,6 +1016,8 @@ function StepsForm({.map((step) => step.id || ""));+ const disclosure = useDisclosure();+// Update sort order when steps changeuseEffect(() => {if (steps && steps.length > 0) {@@ -1104,121 +1106,130 @@ function StepsForm({className="flex flex-col gap-6"isLoading={fetcher.state !== "idle"}>- <div className="p-6 border rounded-lg bg-card mb-6">- <ValidatedForm- action={path.to.newJobOperationStep}- method="post"- validator={operationStepValidator}- fetcher={fetcher}- resetAfterSubmit- defaultValues={{- id: undefined,- name: "",- description: "",- type: "Task",- unitOfMeasureCode: "",- minValue: 0,- maxValue: 0,- listValues: [],- sortOrder:- steps.reduce((acc, a) => Math.max(acc, a.sortOrder ?? 0), 0) + 1,- operationId,- }}- onSubmit={() => {- setType("Value");- }}- className="w-full"- >- <Hidden name="operationId" />- <Hidden name="sortOrder" />- <Hidden name="description" value={JSON.stringify(description)} />- <VStack spacing={4}>- <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">- <SelectControlled- name="type"- label="Type"- options={typeOptions}- value={type}- onChange={(option) => {- if (option) {- setType(option.value as OperationStep["type"]);- }- }}- />- <Input name="name" label="Name" />- </div>-- <VStack spacing={2} className="w-full col-span-2">- <Label>Description</Label>- <Editor- initialValue={description}- onUpload={onUploadImage}- onChange={(value) => {- setDescription(value);- }}- className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"- />- </VStack>-- {type === "Measurement" && (+ {disclosure.isOpen ? (+ <div className="p-6 border rounded-lg bg-card mb-6">+ <ValidatedForm+ action={path.to.newJobOperationStep}+ method="post"+ validator={operationStepValidator}+ fetcher={fetcher}+ resetAfterSubmit+ defaultValues={{+ id: undefined,+ name: "",+ description: "",+ type: "Task",+ unitOfMeasureCode: "",+ minValue: 0,+ maxValue: 0,+ listValues: [],+ sortOrder:+ steps.reduce((acc, a) => Math.max(acc, a.sortOrder ?? 0), 0) ++ 1,+ operationId,+ }}+ onSubmit={() => {+ setType("Value");+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <Hidden name="sortOrder" />+ <Hidden name="description" value={JSON.stringify(description)} />+ <VStack spacing={4}><div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">- <UnitOfMeasure- name="unitOfMeasureCode"- label="Unit of Measure"+ <SelectControlled+ name="type"+ label="Type"+ options={typeOptions}+ value={type}+ onChange={(option) => {+ if (option) {+ setType(option.value as OperationStep["type"]);+ }+ }}/>+ <Input name="name" label="Name" />+ </div>- <ToggleGroup- type="multiple"- value={numericControls}- onValueChange={setNumericControls}- className="justify-start items-start mt-6"- >- <ToggleGroupItem size="sm" value="min">- <LuMinimize2 className="mr-2" />- Minimum- </ToggleGroupItem>- <ToggleGroupItem size="sm" value="max">- <LuMaximize2 className="mr-2" />- Maximum- </ToggleGroupItem>- </ToggleGroup>+ <VStack spacing={2} className="w-full col-span-2">+ <Label>Description</Label>+ <Editor+ initialValue={description}+ onUpload={onUploadImage}+ onChange={(value) => {+ setDescription(value);+ }}+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"+ />+ </VStack>- {numericControls.includes("min") && (- <Number- name="minValue"- label="Minimum"- formatOptions={{- minimumFractionDigits: 0,- maximumFractionDigits: 10,- }}- />- )}- {numericControls.includes("max") && (- <Number- name="maxValue"- label="Maximum"- formatOptions={{- minimumFractionDigits: 0,- maximumFractionDigits: 10,- }}+ {type === "Measurement" && (+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <UnitOfMeasure+ name="unitOfMeasureCode"+ label="Unit of Measure"/>- )}- </div>- )}- {type === "List" && (- <ArrayInput name="listValues" label="List Options" />- )}- <Submit- leftIcon={<LuCirclePlus />}- isDisabled={isDisabled || fetcher.state !== "idle"}- isLoading={fetcher.state !== "idle"}- >- Save Step- </Submit>- </VStack>- </ValidatedForm>- </div>+ <ToggleGroup+ type="multiple"+ value={numericControls}+ onValueChange={setNumericControls}+ className="justify-start items-start mt-6"+ >+ <ToggleGroupItem size="sm" value="min">+ <LuMinimize2 className="mr-2" />+ Minimum+ </ToggleGroupItem>+ <ToggleGroupItem size="sm" value="max">+ <LuMaximize2 className="mr-2" />+ Maximum+ </ToggleGroupItem>+ </ToggleGroup>++ {numericControls.includes("min") && (+ <Number+ name="minValue"+ label="Minimum"+ formatOptions={{+ minimumFractionDigits: 0,+ maximumFractionDigits: 10,+ }}+ />+ )}+ {numericControls.includes("max") && (+ <Number+ name="maxValue"+ label="Maximum"+ formatOptions={{+ minimumFractionDigits: 0,+ maximumFractionDigits: 10,+ }}+ />+ )}+ </div>+ )}+ {type === "List" && (+ <ArrayInput name="listValues" label="List Options" />+ )}++ <Submit+ leftIcon={<LuCirclePlus />}+ isDisabled={isDisabled || fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Save Step+ </Submit>+ </VStack>+ </ValidatedForm>+ </div>+ ) : (+ <div className="flex justify-end mb-4">+ <Button onClick={disclosure.onOpen} leftIcon={<LuCirclePlus />}>+ Add Step+ </Button>+ </div>+ )}{steps.length > 0 && (<div className="border rounded-lg ">diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsxindex e79c5e9bb3..cb3470dd5f 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx@@ -24,7 +24,7 @@ import {LuBraces,LuChevronDown,LuChevronRight,- LuDownload,+ LuEllipsisVertical,LuExternalLink,LuSearch,LuTable,@@ -133,7 +133,8 @@ const JobBoMExplorer = ({ method }: JobBoMExplorerProps) => {<IconButtonaria-label="Actions"variant="ghost"- icon={<LuDownload />}+ size="sm"+ icon={<LuEllipsisVertical />}/></DropdownMenuTrigger><DropdownMenuContent align="end">diff --git a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsxindex ea2bab1280..c7a3147634 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx@@ -3,6 +3,7 @@ import {AlertDescription,AlertTitle,Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -133,12 +134,14 @@ const JobHeader = () => {<span>{routeData?.job?.jobId}</span></Heading></Link>+ <Copy text={routeData?.job?.jobId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>diff --git a/apps/erp/app/modules/production/ui/Procedures/ProcedureHeader.tsx b/apps/erp/app/modules/production/ui/Procedures/ProcedureHeader.tsxindex 913d68cec2..4fba8ba335 100644--- a/apps/erp/app/modules/production/ui/Procedures/ProcedureHeader.tsx+++ b/apps/erp/app/modules/production/ui/Procedures/ProcedureHeader.tsx@@ -1,6 +1,7 @@import {Badge,Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -69,12 +70,14 @@ const ProcedureHeader = () => {<Badge variant="secondary">V{routeData?.procedure?.version}</Badge><ProcedureStatus status={routeData?.procedure?.status} /></Heading>+ <Copy text={routeData?.procedure?.name ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -161,8 +164,7 @@ const ProcedureHeader = () => {action={path.to.deleteProcedure(id)}isOpen={deleteDisclosure.isOpen}name={routeData?.procedure?.name ?? "procedure"}- text={`Are you sure you want to delete ${routeData?.procedure- ?.name}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.procedure?.name}? This cannot be undone.`}onCancel={() => {deleteDisclosure.onClose();}}diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsxindex dd0808026b..2c620dff7c 100644--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderHeader.tsx@@ -1,6 +1,7 @@import {Badge,Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -102,12 +103,14 @@ const PurchaseOrderHeader = () => {{routeData?.purchaseOrder?.purchaseOrderId}</Heading></Link>+ <Copy text={routeData?.purchaseOrder?.purchaseOrderId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -452,8 +455,7 @@ const PurchaseOrderHeader = () => {action={path.to.deletePurchaseOrder(orderId)}isOpen={deleteModal.isOpen}name={routeData?.purchaseOrder?.purchaseOrderId ?? "purchase order"}- text={`Are you sure you want to delete ${routeData?.purchaseOrder- ?.purchaseOrderId}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.purchaseOrder?.purchaseOrderId}? This cannot be undone.`}onCancel={() => {deleteModal.onClose();}}diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsxindex 72973ec667..b3e8699fed 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteHeader.tsx@@ -1,5 +1,6 @@import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -68,12 +69,14 @@ const SupplierQuoteHeader = () => {<span>{routeData?.quote?.supplierQuoteId}</span></Heading></Link>+ <Copy text={routeData?.quote?.supplierQuoteId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>@@ -126,8 +129,7 @@ const SupplierQuoteHeader = () => {action={path.to.deleteSupplierQuote(id)}isOpen={deleteModal.isOpen}name={routeData?.quote?.supplierQuoteId ?? "supplier quote"}- text={`Are you sure you want to delete ${routeData?.quote- ?.supplierQuoteId}? This cannot be undone.`}+ text={`Are you sure you want to delete ${routeData?.quote?.supplierQuoteId}? This cannot be undone.`}onCancel={() => {deleteModal.onClose();}}diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsxindex a07194a34e..c1a47497fa 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx@@ -321,7 +321,7 @@ function QuoteLineItem({<DropdownMenuSub><DropdownMenuSubTrigger><DropdownMenuIcon icon={<LuDownload />} />- Download+ Export</DropdownMenuSubTrigger><DropdownMenuSubContent><DropdownMenuItem asChild>diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsxindex 93b85d6251..73cd9f7cf6 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteHeader.tsx@@ -117,12 +117,14 @@ const QuoteHeader = () => {)}</Heading></Link>+ <Copy text={routeData?.quote?.quoteId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsxindex 700526579a..738665994b 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderHeader.tsx@@ -1,5 +1,6 @@import {Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -243,12 +244,14 @@ const SalesOrderHeader = () => {<span>{routeData?.salesOrder?.salesOrderId}</span></Heading></Link>+ <Copy text={routeData?.salesOrder?.salesOrderId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsxindex cb1024be0e..6396762cda 100644--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQHeader.tsx@@ -3,6 +3,7 @@ import {AlertDescription,AlertTitle,Button,+ Copy,DropdownMenu,DropdownMenuContent,DropdownMenuIcon,@@ -88,12 +89,14 @@ const SalesRFQHeader = () => {<span>{routeData?.rfqSummary?.rfqId}</span></Heading></Link>+ <Copy text={routeData?.rfqSummary?.rfqId ?? ""} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtonaria-label="More options"icon={<LuEllipsisVertical />}- variant="ghost"+ variant="secondary"+ size="sm"/></DropdownMenuTrigger><DropdownMenuContent>diff --git a/apps/erp/app/modules/shared/imports.models.ts b/apps/erp/app/modules/shared/imports.models.tsindex ed90eb9a51..d8b088452b 100644--- a/apps/erp/app/modules/shared/imports.models.ts+++ b/apps/erp/app/modules/shared/imports.models.ts@@ -743,6 +743,68 @@ export const fieldMappings = {},},},+ methodMaterial: {+ level: {+ label: "Level",+ required: false,+ type: "string",+ },+ partId: {+ label: "Part ID",+ required: true,+ type: "string",+ },+ description: {+ label: "Description",+ required: false,+ type: "string",+ },+ methodType: {+ label: "Method Type",+ required: true,+ type: "enum",+ enumData: {+ description:+ "The method type of the part, which describes whether it is bought or made",+ options: methodType,+ default: "Pick",+ },+ },+ quantity: {+ label: "Quantity",+ required: true,+ type: "number",+ },+ unitOfMeasureCode: {+ label: "Unit of Measure",+ required: true,+ type: "enum",+ enumData: {+ description: "The unit of measure of the part",+ fetcher: async (+ client: SupabaseClient<Database>,+ companyId: string+ ) => {+ const { data, error } = await client+ .from("unitOfMeasure")+ .select("name, code")+ .eq("companyId", companyId);++ if (error) {+ return { data: null, error };+ }++ return {+ data: data.map((item) => ({+ name: item.name,+ id: item.code,+ })),+ };+ },+ default: "EA",+ },+ },+ },} as const;export const importPermissions: Record<keyof typeof fieldMappings, string> = {@@ -752,6 +814,7 @@ export const importPermissions: Record<keyof typeof fieldMappings, string> = {supplierContact: "purchasing",part: "parts",material: "parts",+ methodMaterial: "parts",tool: "parts",fixture: "parts",consumable: "parts",@@ -1109,4 +1172,23 @@ export const importSchemas: Record<.optional().describe("The unit of measure of the material"),}),+ methodMaterial: z.object({+ level: z.string().optional().describe("The level of the material"),+ partId: z+ .string()+ .min(1, { message: "Part ID is required" })+ .describe("The id of the part"),+ description: z.string().optional().describe("The description of the part"),+ quantity: z.string().describe("The quantity of the part"),+ methodType: z+ .string()+ .optional()+ .describe(+ "The method type of the part, which describes whether it is bought or made"+ ),+ unitOfMeasureCode: z+ .string()+ .optional()+ .describe("The unit of measure of the part"),+ }),} as const;diff --git a/apps/erp/app/routes/api+/ai+/csv+/$table.columns.tsx b/apps/erp/app/routes/api+/ai+/csv+/$table.columns.tsxindex 993dc5757e..1f3c864dbe 100644--- a/apps/erp/app/routes/api+/ai+/csv+/$table.columns.tsx+++ b/apps/erp/app/routes/api+/ai+/csv+/$table.columns.tsx@@ -14,9 +14,7 @@ const inputSchema = z.object({});export async function action({ request, params }: ActionFunctionArgs) {- await requirePermissions(request, {- update: "settings",- });+ await requirePermissions(request, {});const { table } = params;if (!table) {diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsxindex b056672019..3d6610801a 100644--- a/apps/mes/app/components/JobOperation.tsx+++ b/apps/mes/app/components/JobOperation.tsx@@ -1529,7 +1529,7 @@ export const JobOperation = ({);return (- <div className="flex flex-col items-end justify-center gap-1 w-full px-4">+ <div className="flex items-end justify-between gap-1 w-full px-4 pb-2 border-b"><div className="flex items-center gap-1">{showNavigation && !parentIsSerial && (<>diff --git a/packages/database/supabase/functions/import-csv/index.ts b/packages/database/supabase/functions/import-csv/index.tsindex 976ac35bb1..6c7d75d7f3 100644--- a/packages/database/supabase/functions/import-csv/index.ts+++ b/packages/database/supabase/functions/import-csv/index.ts@@ -19,6 +19,7 @@ const importCsvValidator = z.object({"customerContact","fixture","material",+ "methodMaterial","part","supplier","supplierContact",@@ -854,6 +855,10 @@ serve(async (req: Request) => {break;}+ case "methodMaterial": {+ throw new Error("Not implemented");+ break;+ }default: {throw new Error(`Invalid table: ${table}`);}