phase 2 and 3

This commit is contained in:
jason
2026-04-21 08:56:51 -05:00
parent b98837a72c
commit d79aaf6ef8
42 changed files with 4962 additions and 19 deletions
@@ -0,0 +1,53 @@
import { notFound } from "next/navigation";
import { prisma } from "@/lib/prisma";
import AssemblyDetailClient from "./AssemblyDetailClient";
export const dynamic = "force-dynamic";
export default async function AdminAssemblyDetailPage({
params,
}: {
params: Promise<{ id: string; assemblyId: string }>;
}) {
const { id, assemblyId } = await params;
const assembly = await prisma.assembly.findFirst({
where: { id: assemblyId, projectId: id },
include: {
project: { select: { id: true, code: true, name: true } },
parts: {
orderBy: { code: "asc" },
include: {
_count: { select: { operations: true } },
stepFile: { select: { id: true } },
drawingFile: { select: { id: true } },
cutFile: { select: { id: true } },
},
},
},
});
if (!assembly) notFound();
return (
<AssemblyDetailClient
project={assembly.project}
assembly={{
id: assembly.id,
code: assembly.code,
name: assembly.name,
qty: assembly.qty,
notes: assembly.notes,
}}
parts={assembly.parts.map((p) => ({
id: p.id,
code: p.code,
name: p.name,
material: p.material,
qty: p.qty,
hasStep: !!p.stepFile,
hasDrawing: !!p.drawingFile,
hasCut: !!p.cutFile,
operationCount: p._count.operations,
}))}
/>
);
}