import { addKitComponent, buildAssembly } from "@/lib/actions"; import { getAssembliesWithComponents, getParts } from "@/lib/repository"; export default async function AssembliesPage({ searchParams }: { searchParams?: Promise<{ error?: string; success?: string }>; }) { const params = (await searchParams) ?? {}; const parts = getParts(); const assemblies = parts.filter((part) => part.kind === "assembly"); const components = parts.filter((part) => part.kind === "part"); const kitRows = getAssembliesWithComponents(); return (
{params.error ?

{params.error}

: null} {params.success ?

{params.success}

: null}

Bill of Materials

Define which stocked parts are consumed to build each assembly. Start typing to filter large inventories quickly.

{assemblies.map((assembly) => ( ))}
{components.map((component) => ( ))}

Build Assembly

Consume component stock and create finished kit inventory in one transaction flow. This only works after the assembly has a BOM and enough component stock exists.

{assemblies.map((assembly) => ( ))}

Current Assemblies

{kitRows.length === 0 ? ( ) : ( kitRows.map((row, index) => ( )) )}
AssemblyNameComponentComponent NameQty Per
Add an assembly on the Parts page, then define its bill of materials here.
{row.assemblySku}{row.assemblyName}{row.componentSku}{row.componentName}{row.quantity}
); }