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
feat: add expand/collapse all functionality to BoM explorers and update QuoteBoMExplorer props
naveenkashb4e9a68f397e
diff --git a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsxindex 0463065bd8..e29dd25e0d 100644--- a/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx+++ b/apps/erp/app/modules/items/ui/Item/BoMExplorer.tsx@@ -6,6 +6,7 @@ import {DropdownMenuContent,DropdownMenuIcon,DropdownMenuItem,+ DropdownMenuSeparator,DropdownMenuSub,DropdownMenuSubContent,DropdownMenuSubTrigger,@@ -28,6 +29,7 @@ import {LuBraces,LuChevronDown,LuChevronRight,+ LuChevronsUpDown,LuDownload,LuEllipsisVertical,LuExternalLink,@@ -112,6 +114,11 @@ const BoMExplorer = ({isEager: true});+ const allExpanded = useMemo(+ () => methods.every((m) => !m.hasChildren || nodes[m.id]?.expanded),+ [methods, nodes]+ );+// Generate hierarchical BOM IDs (1, 1.1, 1.1.1, etc.)const bomIds = useMemo(() => generateBomIds(methods), [methods]);const bomIdMap = useMemo(@@ -178,6 +185,23 @@ const BoMExplorer = ({/></DropdownMenuTrigger><DropdownMenuContent align="end">+ <DropdownMenuItem+ onClick={() => {+ if (allExpanded) {+ collapseAllBelowDepth(1);+ } else {+ expandAllBelowDepth(0);+ }+ }}+ >+ <DropdownMenuIcon icon={<LuChevronsUpDown />} />+ {allExpanded ? (+ <Trans>Collapse all</Trans>+ ) : (+ <Trans>Expand all</Trans>+ )}+ </DropdownMenuItem>+ <DropdownMenuSeparator /><DropdownMenuSub><DropdownMenuSubTrigger><DropdownMenuIcon icon={<LuDownload />} />diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsxindex e5c8d5ccec..8c6341dc34 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBoMExplorer.tsx@@ -6,6 +6,7 @@ import {DropdownMenuContent,DropdownMenuIcon,DropdownMenuItem,+ DropdownMenuSeparator,DropdownMenuTrigger,HoverCard,HoverCardContent,@@ -24,6 +25,7 @@ import {LuBraces,LuChevronDown,LuChevronRight,+ LuChevronsUpDown,LuEllipsisVertical,LuExternalLink,LuSearch,@@ -68,6 +70,7 @@ const JobBoMExplorer = ({ method }: JobBoMExplorerProps) => {// Generate hierarchical BOM IDs (1, 1.1, 1.1.1, etc.)const bomIds = useMemo(() => generateBomIds(method), [method]);+const bomIdMap = useMemo(() => new Map(method.map((node, index) => [node.id, bomIds[index]])),[method, bomIds]@@ -104,6 +107,11 @@ const JobBoMExplorer = ({ method }: JobBoMExplorerProps) => {isEager: true});+ const allExpanded = useMemo(+ () => method.every((m) => !m.hasChildren || nodes[m.id]?.expanded),+ [method, nodes]+ );+const [searchParams, setSearchParams] = useSearchParams();const selectedMaterialId = searchParams.get("materialId");const isDetailsRoute =@@ -170,6 +178,23 @@ const JobBoMExplorer = ({ method }: JobBoMExplorerProps) => {/></DropdownMenuTrigger><DropdownMenuContent align="end">+ <DropdownMenuItem+ onClick={() => {+ if (allExpanded) {+ collapseAllBelowDepth(1);+ } else {+ expandAllBelowDepth(0);+ }+ }}+ >+ <DropdownMenuIcon icon={<LuChevronsUpDown />} />+ {allExpanded ? (+ <Trans>Collapse all</Trans>+ ) : (+ <Trans>Expand all</Trans>+ )}+ </DropdownMenuItem>+ <DropdownMenuSeparator /><DropdownMenuItem asChild><ahref={path.to.api.jobBillOfMaterialsCsv(jobId, false)}diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsxindex 476f50bcf2..b8f1386314 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx@@ -43,11 +43,13 @@ import type { QuoteMethod } from "../../types";type QuoteBoMExplorerProps = {methods: FlatTree<QuoteMethod>;isSearchExpanded?: boolean;+ isAllExpanded?: boolean;};const QuoteBoMExplorer = ({methods,- isSearchExpanded = false+ isSearchExpanded = false,+ isAllExpanded = false}: QuoteBoMExplorerProps) => {const { t } = useLingui();const parentRef = useRef<HTMLDivElement>(null);@@ -108,6 +110,15 @@ const QuoteBoMExplorer = ({isEager: true});+ // biome-ignore lint/correctness/useExhaustiveDependencies: only react to isAllExpanded changes+ useEffect(() => {+ if (isAllExpanded) {+ expandAllBelowDepth(0);+ } else {+ collapseAllBelowDepth(1);+ }+ }, [isAllExpanded]);+const params = useParams();const [searchParams, setSearchParams] = useSearchParams();const selectedMaterialId = searchParams.get("materialId");diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsxindex 8a8ba77f3f..3a0390b4f2 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx@@ -30,6 +30,7 @@ import { useMemo, useRef, useState } from "react";import {LuBraces,LuChevronDown,+ LuChevronsUpDown,LuCirclePlus,LuDownload,LuEllipsisVertical,@@ -440,6 +441,7 @@ function QuoteLineItem({const disclosure = useDisclosure();const searchDisclosure = useDisclosure();+ const expansionDisclosure = useDisclosure();useMount(() => {if (lineId === line.id) {@@ -550,6 +552,14 @@ function QuoteLineItem({<DropdownMenuIcon icon={<LuSearch />} /><Trans>Search</Trans></DropdownMenuItem>+ <DropdownMenuItem onClick={expansionDisclosure.onToggle}>+ <DropdownMenuIcon icon={<LuChevronsUpDown />} />+ {expansionDisclosure.isOpen ? (+ <Trans>Collapse all</Trans>+ ) : (+ <Trans>Expand all</Trans>+ )}+ </DropdownMenuItem><DropdownMenuSub><DropdownMenuSubTrigger><DropdownMenuIcon icon={<LuDownload />} />@@ -665,6 +675,7 @@ function QuoteLineItem({<QuoteBoMExplorermethods={flattenedMethods}isSearchExpanded={searchDisclosure.isOpen}+ isAllExpanded={expansionDisclosure.isOpen}/></VStack>)}