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: rebuild traceability explorer (#718)
Sidcdc991aef59f
diff --git a/apps/erp/app/components/SearchLandingPage.tsx b/apps/erp/app/components/SearchLandingPage.tsxnew file mode 100644index 0000000000..da929cab3c--- /dev/null+++ b/apps/erp/app/components/SearchLandingPage.tsx@@ -0,0 +1,77 @@+import { cn, Heading } from "@carbon/react";+import type { ComponentType, ReactNode } from "react";++type Props = {+ icon: ComponentType<{ className?: string }>;+ heading: ReactNode;+ description?: ReactNode;+ /** Interactive surface (cmdk Command, picker, form). Rendered inside the+ * bordered shadow card. Consumer owns internal padding. */+ children: ReactNode;+ /** Optional small caption beneath the card. */+ footerTip?: ReactNode;+ /** Centered column width. Defaults to "md" (max-w-md ≈ 28rem). */+ maxWidth?: "sm" | "md" | "lg";+ className?: string;+};++const MAX_WIDTH = {+ sm: "max-w-sm",+ md: "max-w-md",+ lg: "max-w-lg"+} as const;++export function SearchLandingPage({+ icon: Icon,+ heading,+ description,+ children,+ footerTip,+ maxWidth = "md",+ className+}: Props) {+ return (+ <div+ className={cn(+ "relative flex w-full h-full flex-1 items-center justify-center bg-card overflow-hidden isolate",+ className+ )}+ >+ <div+ className={cn(+ "relative flex flex-col items-center w-full px-6 gap-6",+ MAX_WIDTH[maxWidth]+ )}+ >+ <div className="flex flex-col items-center gap-4">+ <div className="relative flex items-center justify-center size-14 rounded-2xl bg-background border border-border text-foreground shadow-sm before:absolute before:inset-0 before:rounded-2xl before:bg-linear-to-b before:from-foreground/5 before:to-transparent before:pointer-events-none">+ <Icon className="size-6" />+ </div>+ <div className="flex flex-col items-center gap-1.5 text-center">+ <Heading+ size="h1"+ className="tracking-tight text-balance font-semibold"+ >+ {heading}+ </Heading>+ {description && (+ <p className="text-sm text-muted-foreground max-w-[44ch] text-pretty leading-6">+ {description}+ </p>+ )}+ </div>+ </div>++ <div className="mt-2 w-full">{children}</div>++ {footerTip && (+ <p className="text-[11px] text-muted-foreground/70 tabular-nums">+ {footerTip}+ </p>+ )}+ </div>+ </div>+ );+}++export default SearchLandingPage;diff --git a/apps/erp/app/components/index.ts b/apps/erp/app/components/index.tsindex 80b106e65b..6fa9212f5e 100644--- a/apps/erp/app/components/index.ts+++ b/apps/erp/app/components/index.ts@@ -30,6 +30,7 @@ import Location from "./Location";import New from "./New";import RealtimeDataProvider from "./RealtimeDataProvider";import SearchFilter from "./SearchFilter";+import { SearchLandingPage } from "./SearchLandingPage";import Select from "./Select";import SupplierAvatar from "./SupplierAvatar";import Table from "./Table";@@ -64,6 +65,7 @@ export {OperationStatusIcon,RealtimeDataProvider,SearchFilter,+ SearchLandingPage,Select,SourcingTypeIcon,SupplierAvatar,diff --git a/apps/erp/app/modules/inventory/lineage.server.ts b/apps/erp/app/modules/inventory/lineage.server.tsnew file mode 100644index 0000000000..ebb3030dfb--- /dev/null+++ b/apps/erp/app/modules/inventory/lineage.server.ts@@ -0,0 +1,445 @@+import type { Database } from "@carbon/database";+import type { SupabaseClient } from "@supabase/supabase-js";+import type {+ Activity,+ ActivityInput,+ ActivityOutput,+ GraphData,+ TrackedEntity+} from "./types";+import { clampDepth } from "./ui/Traceability/constants";+import type {+ IssueContainment,+ IssueContainmentStatus,+ StepRecord+} from "./ui/Traceability/utils";++export type LineageDirection = "up" | "down" | "both";++export type LineagePayload = {+ entities: TrackedEntity[];+ inputs: ActivityInput[];+ outputs: ActivityOutput[];+ activities: Activity[];+ stepRecords?: StepRecord[];+ containments?: IssueContainment[];+};++const MAX_ENTITIES = 200;++type LineageState = {+ entities: Map<string, TrackedEntity>;+ activities: Map<string, Activity>;+ inputs: Map<string, ActivityInput>;+ outputs: Map<string, ActivityOutput>;+ visited: Set<string>;+};++function newLineageState(): LineageState {+ return {+ entities: new Map(),+ activities: new Map(),+ inputs: new Map(),+ outputs: new Map(),+ visited: new Set()+ };+}++async function expandActivitySiblings(+ client: SupabaseClient<Database>,+ state: LineageState,+ activityIds: string[]+): Promise<void> {+ const { entities, activities, inputs, outputs } = state;+ const newActivityIds = activityIds.filter((id) => !activities.has(id));+ if (newActivityIds.length > 0) {+ const fetched = await client+ .from("trackedActivity")+ .select("*")+ .in("id", newActivityIds);+ for (const row of fetched.data ?? []) {+ activities.set(row.id, row as unknown as Activity);+ }+ }++ // Pull sibling inputs/outputs for every activity so by-products (e.g. SCRAP)+ // appear even when not on the direct upstream/downstream path.+ const [siblingInputs, siblingOutputs] = await Promise.all([+ client+ .from("trackedActivityInput")+ .select("*")+ .in("trackedActivityId", activityIds),+ client+ .from("trackedActivityOutput")+ .select("*")+ .in("trackedActivityId", activityIds)+ ]);++ const siblingEntityIds = new Set<string>();+ for (const row of siblingInputs.data ?? []) {+ const key = `${row.trackedActivityId}:${row.trackedEntityId}`;+ if (!inputs.has(key)) {+ inputs.set(key, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: row.trackedEntityId,+ quantity: row.quantity+ });+ }+ if (!entities.has(row.trackedEntityId)) {+ siblingEntityIds.add(row.trackedEntityId);+ }+ }+ for (const row of siblingOutputs.data ?? []) {+ const key = `${row.trackedActivityId}:${row.trackedEntityId}`;+ if (!outputs.has(key)) {+ outputs.set(key, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: row.trackedEntityId,+ quantity: row.quantity+ });+ }+ if (!entities.has(row.trackedEntityId)) {+ siblingEntityIds.add(row.trackedEntityId);+ }+ }++ if (siblingEntityIds.size > 0) {+ const remainingCapacity = MAX_ENTITIES - entities.size;+ const idsToFetch = Array.from(siblingEntityIds).slice(0, remainingCapacity);+ if (idsToFetch.length > 0) {+ const fetched = await client+ .from("trackedEntity")+ .select("*")+ .in("id", idsToFetch);+ for (const row of fetched.data ?? []) {+ entities.set(row.id, row as TrackedEntity);+ }+ }+ }+}++async function runLineageBfs(+ client: SupabaseClient<Database>,+ state: LineageState,+ initialFrontier: string[],+ direction: LineageDirection,+ safeDepth: number+): Promise<void> {+ const { entities, inputs, outputs, visited } = state;+ let frontier = initialFrontier.filter((id) => {+ if (visited.has(id)) return true;+ visited.add(id);+ return true;+ });++ for (let hop = 0; hop < safeDepth; hop++) {+ if (frontier.length === 0) break;+ if (entities.size >= MAX_ENTITIES) break;++ const descendantsResults: {+ id: string;+ trackedActivityId: string;+ quantity: number;+ }[][] = [];+ const ancestorsResults: {+ id: string;+ trackedActivityId: string;+ quantity: number;+ }[][] = [];++ const calls: Promise<void>[] = [];+ for (const id of frontier) {+ if (direction === "down" || direction === "both") {+ calls.push(+ (async () => {+ const res = await client.rpc(+ "get_direct_descendants_of_tracked_entity_strict",+ { p_tracked_entity_id: id }+ );+ descendantsResults.push((res.data ?? []) as any);+ })()+ );+ }+ if (direction === "up" || direction === "both") {+ calls.push(+ (async () => {+ const res = await client.rpc(+ "get_direct_ancestors_of_tracked_entity_strict",+ { p_tracked_entity_id: id }+ );+ ancestorsResults.push((res.data ?? []) as any);+ })()+ );+ }+ }++ await Promise.all(calls);++ const nextFrontier = new Set<string>();+ const newEntityIds = new Set<string>();+ const activityIds = new Set<string>();++ for (let i = 0; i < frontier.length; i++) {+ const sourceId = frontier[i];+ const desc = descendantsResults[i] ?? [];+ for (const row of desc) {+ if (!row?.id) continue;+ activityIds.add(row.trackedActivityId);+ const outputKey = `${row.trackedActivityId}:${sourceId}`;+ if (!outputs.has(outputKey)) {+ outputs.set(outputKey, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: sourceId,+ quantity: row.quantity+ });+ }+ if (!visited.has(row.id)) {+ visited.add(row.id);+ newEntityIds.add(row.id);+ nextFrontier.add(row.id);+ }+ const inputKey = `${row.trackedActivityId}:${row.id}`;+ if (!inputs.has(inputKey)) {+ inputs.set(inputKey, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: row.id,+ quantity: row.quantity+ });+ }+ }++ const anc = ancestorsResults[i] ?? [];+ for (const row of anc) {+ if (!row?.id) continue;+ activityIds.add(row.trackedActivityId);+ const inputKey = `${row.trackedActivityId}:${sourceId}`;+ if (!inputs.has(inputKey)) {+ inputs.set(inputKey, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: sourceId,+ quantity: row.quantity+ });+ }+ if (!visited.has(row.id)) {+ visited.add(row.id);+ newEntityIds.add(row.id);+ nextFrontier.add(row.id);+ }+ const outputKey = `${row.trackedActivityId}:${row.id}`;+ if (!outputs.has(outputKey)) {+ outputs.set(outputKey, {+ trackedActivityId: row.trackedActivityId,+ trackedEntityId: row.id,+ quantity: row.quantity+ });+ }+ }+ }++ if (newEntityIds.size > 0) {+ const remainingCapacity = MAX_ENTITIES - entities.size;+ const idsToFetch = Array.from(newEntityIds).slice(0, remainingCapacity);+ const fetched = await client+ .from("trackedEntity")+ .select("*")+ .in("id", idsToFetch);+ for (const row of fetched.data ?? []) {+ entities.set(row.id, row as TrackedEntity);+ }+ }++ if (activityIds.size > 0) {+ await expandActivitySiblings(client, state, Array.from(activityIds));+ }++ frontier = Array.from(nextFrontier);+ }+}++export async function fetchLineageSubgraph(+ client: SupabaseClient<Database>,+ rootEntityId: string,+ depth: number,+ direction: LineageDirection = "both"+): Promise<LineagePayload> {+ const safeDepth = clampDepth(depth);++ const rootEntity = await client+ .from("trackedEntity")+ .select("*")+ .eq("id", rootEntityId)+ .maybeSingle();++ const state = newLineageState();+ if (rootEntity.data)+ state.entities.set(rootEntity.data.id, rootEntity.data as TrackedEntity);++ await runLineageBfs(client, state, [rootEntityId], direction, safeDepth);++ return {+ entities: Array.from(state.entities.values()),+ inputs: Array.from(state.inputs.values()),+ outputs: Array.from(state.outputs.values()),+ activities: Array.from(state.activities.values())+ };+}++export async function fetchJobStepRecords(+ client: SupabaseClient<Database>,+ jobId: string+): Promise<StepRecord[]> {+ const res = await client.rpc("get_job_operation_step_records", {+ p_job_id: jobId+ });+ if (!res.data) return [];+ return (res.data as any[]).map((r) => ({+ id: r.id,+ jobOperationStepId: r.jobOperationStepId,+ index: r.index,+ type: r.type,+ name: r.name,+ value: r.value,+ numericValue: r.numericValue,+ booleanValue: r.booleanValue,+ userValue: r.userValue,+ unitOfMeasureCode: r.unitOfMeasureCode,+ minValue: r.minValue,+ maxValue: r.maxValue,+ operationId: r.operationId,+ operationDescription: r.operationDescription,+ itemId: r.itemId,+ itemReadableId: r.itemReadableId,+ createdAt: r.createdAt,+ createdBy: r.createdBy+ }));+}++export async function fetchContainmentsForEntities(+ client: SupabaseClient<Database>,+ entityIds: string[]+): Promise<IssueContainment[]> {+ if (entityIds.length === 0) return [];++ const linkRes = await client+ .from("nonConformanceTrackedEntity")+ .select("nonConformanceId, trackedEntityId")+ .in("trackedEntityId", entityIds);+ const links = linkRes.data ?? [];+ if (links.length === 0) return [];++ const issueIds = Array.from(new Set(links.map((l) => l.nonConformanceId)));++ const issuesRes = await client+ .from("issues")+ .select("id, nonConformanceId, status, priority, containmentStatus")+ .in("id", issueIds);+ type IssueRow = NonNullable<typeof issuesRes.data>[number];+ const issuesById = new Map<string, IssueRow>();+ for (const row of issuesRes.data ?? []) {+ if (row.id) issuesById.set(row.id, row);+ }++ const containments: IssueContainment[] = [];+ for (const link of links) {+ const issue = issuesById.get(link.nonConformanceId);+ if (!issue) continue;+ const status = issue.containmentStatus;+ if (status !== "Contained" && status !== "Uncontained") continue;+ containments.push({+ id: issue.id ?? link.nonConformanceId,+ readableId: issue.nonConformanceId,+ containmentStatus: status as IssueContainmentStatus,+ status: issue.status ?? "",+ priority: issue.priority ?? null,+ trackedEntityId: link.trackedEntityId+ });+ }+ return containments;+}++export async function fetchJobScopedLineage(+ client: SupabaseClient<Database>,+ jobId: string,+ depth: number+): Promise<LineagePayload> {+ const safeDepth = clampDepth(depth);++ const [seedEntitiesRes, seedActivitiesRes] = await Promise.all([+ client.from("trackedEntity").select("*").eq("attributes->>Job", jobId),+ client.from("trackedActivity").select("*").eq("attributes->>Job", jobId)+ ]);++ const state = newLineageState();+ for (const row of (seedEntitiesRes.data ?? []) as TrackedEntity[]) {+ state.entities.set(row.id, row);+ }+ for (const row of (seedActivitiesRes.data ?? []) as unknown as Activity[]) {+ state.activities.set(row.id, row);+ }++ if (state.activities.size > 0) {+ await expandActivitySiblings(+ client,+ state,+ Array.from(state.activities.keys())+ );+ }++ if (state.entities.size > 0) {+ await runLineageBfs(+ client,+ state,+ Array.from(state.entities.keys()),+ "both",+ safeDepth+ );+ }++ const [stepRecords, containments] = await Promise.all([+ fetchJobStepRecords(client, jobId),+ fetchContainmentsForEntities(client, Array.from(state.entities.keys()))+ ]);++ return {+ entities: Array.from(state.entities.values()),+ inputs: Array.from(state.inputs.values()),+ outputs: Array.from(state.outputs.values()),+ activities: Array.from(state.activities.values()),+ stepRecords,+ containments+ };+}++export function toGraphData(payload: LineagePayload): GraphData {+ const nodes = [+ ...payload.entities.map((entity) => ({+ id: entity.id,+ type: "entity" as const,+ data: entity,+ parentId: null+ })),+ ...payload.activities.map((activity) => ({+ id: activity.id,+ type: "activity" as const,+ data: activity,+ parentId: null+ }))+ ];++ const links = [+ ...payload.inputs.map((input) => ({+ source: input.trackedEntityId,+ target: input.trackedActivityId,+ type: "input" as const,+ quantity: input.quantity+ })),+ ...payload.outputs.map((output) => ({+ source: output.trackedActivityId,+ target: output.trackedEntityId,+ type: "output" as const,+ quantity: output.quantity+ }))+ ];++ return { nodes, links };+}diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsxindex 7546608c69..eec70cb70b 100644--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptLines.tsx@@ -656,7 +656,7 @@ function BatchForm({.reduce((acc, [key, value]) => ({ ...acc, [key]: value || "" }), {})};});- }, [tracking?.id, tracking?.expirationDate, tracking?.readableId]);+ }, [tracking]);const updateBatchNumber = async (newValues: typeof values, isNew = false) => {if (!receipt?.id || !newValues.number.trim()) return;diff --git a/apps/erp/app/modules/inventory/ui/Traceability/ContainmentList.tsx b/apps/erp/app/modules/inventory/ui/Traceability/ContainmentList.tsxnew file mode 100644index 0000000000..7adce3432e--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/ContainmentList.tsx@@ -0,0 +1,56 @@+import { cn } from "@carbon/react";+import { LuExternalLink } from "react-icons/lu";+import { Link } from "react-router";+import { path } from "~/utils/path";+import type { IssueContainment } from "./utils";++type Props = { items: IssueContainment[] };++export function ContainmentList({ items }: Props) {+ if (items.length === 0) return null;+ return (+ <ul className="divide-y divide-border/30">+ {items.map((item) => (+ <li key={item.id}>+ <Link+ to={path.to.issueDetails(item.id)}+ className="group flex items-center justify-between gap-2 px-2 py-1.5 rounded-md hover:bg-accent/50 transition-colors"+ onClick={(e) => e.stopPropagation()}+ >+ <div className="flex items-center gap-2 min-w-0">+ <span+ className={cn(+ "size-2 rounded-full shrink-0",+ item.containmentStatus === "Uncontained"+ ? "bg-red-500"+ : "bg-amber-500"+ )}+ />+ <span className="text-sm font-medium truncate">+ {item.readableId ?? item.id.slice(0, 8)}+ </span>+ <span+ className={cn(+ "text-[10px] uppercase tracking-wide font-medium shrink-0",+ item.containmentStatus === "Uncontained"+ ? "text-red-500"+ : "text-amber-500"+ )}+ >+ {item.containmentStatus}+ </span>+ </div>+ <div className="flex items-center gap-1.5 shrink-0">+ {item.priority && (+ <span className="text-[10px] uppercase tracking-wide text-muted-foreground">+ {item.priority}+ </span>+ )}+ <LuExternalLink className="size-3 text-muted-foreground/60 group-hover:text-foreground transition-colors" />+ </div>+ </Link>+ </li>+ ))}+ </ul>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx b/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsxindex 101d6882a9..7f167fc0cd 100644--- a/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx+++ b/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx@@ -216,8 +216,8 @@ function buildSteps(// happened. For receipt-source entities this is the goods-in date.const sourceDate = entity.createdAt ?? null;const splitFrom = attrs["Split Entity ID"];- const receiptId = attrs["Receipt"];- const jobId = attrs["Job"];+ const receiptId = attrs.Receipt;+ const jobId = attrs.Job;if (typeof splitFrom === "string" && splitFrom) {out.push({step: "Source",diff --git a/apps/erp/app/modules/inventory/ui/Traceability/GraphLegend.tsx b/apps/erp/app/modules/inventory/ui/Traceability/GraphLegend.tsxnew file mode 100644index 0000000000..0ef6086614--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/GraphLegend.tsx@@ -0,0 +1,187 @@+import {+ cn,+ HStack,+ Popover,+ PopoverContent,+ PopoverTrigger,+ VStack+} from "@carbon/react";+import type { IconType } from "react-icons";+import { LuInfo } from "react-icons/lu";+import {+ ACTIVITY_KIND_META,+ type ActivityKind,+ ENTITY_STATUS_META,+ type EntityStatus+} from "./metadata";++type Entry = {+ label: string;+ color: string;+ shape: "circle" | "diamond";+ icon: IconType;+};++const ENTITY_DISPLAY_ORDER: EntityStatus[] = [+ "Available",+ "Consumed",+ "Reserved",+ "On Hold",+ "Rejected"+];++const ENTITY_ENTRIES: Entry[] = ENTITY_DISPLAY_ORDER.map((status) => {+ const meta = ENTITY_STATUS_META[status];+ return {+ label: meta.label,+ color: meta.color,+ shape: "circle",+ icon: meta.icon+ };+});++const ACTIVITY_ENTRIES: Entry[] = (+ Object.keys(ACTIVITY_KIND_META) as ActivityKind[]+).map((kind) => {+ const meta = ACTIVITY_KIND_META[kind];+ return {+ label: meta.label,+ color: meta.color,+ shape: "diamond",+ icon: meta.icon+ };+});++export function GraphLegend() {+ return (+ <div className="absolute bottom-3 left-3 z-20">+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ aria-label="Show legend"+ className={cn(+ "h-8 w-8 rounded-md flex items-center justify-center transition-colors",+ "border border-border bg-card/90 backdrop-blur shadow-sm",+ "text-muted-foreground hover:text-foreground hover:bg-accent/60",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ )}+ >+ <LuInfo className="w-4 h-4" />+ </button>+ </PopoverTrigger>+ <PopoverContent+ side="top"+ align="start"+ className="w-[420px] p-0 border-border"+ >+ <HStack spacing={0} className="items-stretch divide-x divide-border">+ <Section title="Entities" entries={ENTITY_ENTRIES} />+ <Section title="Activities" entries={ACTIVITY_ENTRIES} />+ </HStack>+ <div className="border-t border-border p-4">+ <span className="block text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-2">+ Lines+ </span>+ <VStack spacing={2}>+ <LineRow+ label="Normal flow"+ color="hsl(0 0% 55%)"+ width={1.2}+ opacity={0.6}+ />+ <LineRow+ label="Selection path"+ color="hsl(0 0% 92%)"+ width={2.5}+ opacity={1}+ />+ <LineRow+ label="Reject branch"+ color="hsl(0 72% 55%)"+ width={1.5}+ opacity={0.9}+ />+ <LineRow+ label="Cycle back-edge"+ color="hsl(0 0% 55%)"+ width={1.2}+ opacity={0.3}+ dashed+ />+ </VStack>+ </div>+ </PopoverContent>+ </Popover>+ </div>+ );+}++function Section({ title, entries }: { title: string; entries: Entry[] }) {+ return (+ <VStack spacing={3} className="p-4 flex-1 min-w-0">+ <span className="text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1">+ {title}+ </span>+ {entries.map((entry) => (+ <Row key={entry.label} entry={entry} />+ ))}+ </VStack>+ );+}++function LineRow({+ label,+ color,+ width,+ opacity,+ dashed = false+}: {+ label: string;+ color: string;+ width: number;+ opacity: number;+ dashed?: boolean;+}) {+ return (+ <HStack spacing={3} className="items-center">+ <svg width={36} height={6} className="shrink-0">+ <line+ x1={0}+ y1={3}+ x2={36}+ y2={3}+ stroke={color}+ strokeWidth={width}+ strokeOpacity={opacity}+ strokeDasharray={dashed ? "5 3" : undefined}+ />+ </svg>+ <span className="text-[13px] text-foreground truncate">{label}</span>+ </HStack>+ );+}++function Row({ entry }: { entry: Entry }) {+ const Icon = entry.icon;+ return (+ <HStack spacing={3} className="items-center">+ <div className="relative w-6 h-6 flex items-center justify-center shrink-0">+ <div+ className={cn(+ "absolute inset-0",+ entry.shape === "circle" ? "rounded-full" : "rounded"+ )}+ style={{+ background: entry.color,+ transform: entry.shape === "diamond" ? "rotate(45deg)" : undefined+ }}+ />+ <Icon className="relative w-3.5 h-3.5 text-white" />+ </div>+ <span className="text-[13px] text-foreground truncate">+ {entry.label}+ </span>+ </HStack>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx b/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsxnew file mode 100644index 0000000000..0a8753f839--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/GraphToolbar.tsx@@ -0,0 +1,472 @@+import {+ cn,+ HoverCard,+ HoverCardContent,+ HoverCardTrigger,+ HStack,+ Popover,+ PopoverContent,+ PopoverTrigger,+ VStack+} from "@carbon/react";+import { useReactFlow } from "@xyflow/react";+import {+ LuFocus,+ LuMaximize,+ LuMinus,+ LuMove,+ LuMoveDown,+ LuMoveRight,+ LuNetwork,+ LuPlus,+ LuSearch,+ LuTable+} from "react-icons/lu";+import type { LayoutDirection } from "./worker/core";++export type ViewMode = "graph" | "table";++type Props = {+ depth: number;+ onDepthChange: (next: number) => void;+ direction: LayoutDirection;+ onDirectionChange: (next: LayoutDirection) => void;+ view: ViewMode;+ onViewChange: (next: ViewMode) => void;+ isolate: boolean;+ onIsolateChange: (next: boolean) => void;+ hasSelection?: boolean;+ onRelayout?: () => void;+ onOpenSearch?: () => void;+ spacing?: number;+ onSpacingChange?: (next: number) => void;+};++const PANEL =+ "rounded-lg border border-border bg-card/95 backdrop-blur shadow-sm";++export function GraphToolbar({+ depth,+ onDepthChange,+ direction,+ onDirectionChange,+ view,+ onViewChange,+ isolate,+ onIsolateChange,+ hasSelection = false,+ onRelayout,+ onOpenSearch,+ spacing = 2,+ onSpacingChange+}: Props) {+ return (+ <>+ <ViewModeChip view={view} onViewChange={onViewChange} />+ <GraphControlsChip+ depth={depth}+ onDepthChange={onDepthChange}+ direction={direction}+ onDirectionChange={onDirectionChange}+ isolate={isolate}+ onIsolateChange={onIsolateChange}+ hasSelection={hasSelection}+ onRelayout={onRelayout}+ onOpenSearch={onOpenSearch}+ spacing={spacing}+ onSpacingChange={onSpacingChange}+ showGraphOnly={view === "graph"}+ />+ </>+ );+}++function ViewModeChip({+ view,+ onViewChange+}: {+ view: ViewMode;+ onViewChange: (next: ViewMode) => void;+}) {+ return (+ <HStack spacing={0} className={cn("absolute top-3 left-3 z-30 p-1", PANEL)}>+ <SegmentButton+ active={view === "graph"}+ onClick={() => onViewChange("graph")}+ ariaLabel="Graph view"+ >+ <LuNetwork className="w-3.5 h-3.5" />+ <span>Graph</span>+ </SegmentButton>+ <SegmentButton+ active={view === "table"}+ onClick={() => onViewChange("table")}+ ariaLabel="Table view"+ >+ <LuTable className="w-3.5 h-3.5" />+ <span>Table</span>+ </SegmentButton>+ </HStack>+ );+}++function GraphControlsChip({+ depth,+ onDepthChange,+ direction,+ onDirectionChange,+ isolate,+ onIsolateChange,+ hasSelection,+ onRelayout,+ onOpenSearch,+ spacing,+ onSpacingChange,+ showGraphOnly+}: {+ depth: number;+ onDepthChange: (next: number) => void;+ direction: LayoutDirection;+ onDirectionChange: (next: LayoutDirection) => void;+ isolate: boolean;+ onIsolateChange: (next: boolean) => void;+ hasSelection: boolean;+ onRelayout?: () => void;+ onOpenSearch?: () => void;+ spacing: number;+ onSpacingChange?: (next: number) => void;+ showGraphOnly: boolean;+}) {+ const { fitView } = useReactFlow();++ return (+ <HStack+ spacing={1}+ className={cn("absolute top-3 right-3 z-30 px-1.5 py-1", PANEL)}+ >+ {onOpenSearch && (+ <>+ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ type="button"+ onClick={onOpenSearch}+ className={cn(+ "h-7 px-2 rounded-md flex items-center gap-1 transition-colors text-xs",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ "text-muted-foreground hover:text-foreground hover:bg-accent/60"+ )}+ aria-label="Search nodes"+ >+ <LuSearch className="w-3.5 h-3.5" />+ <kbd className="text-[10px] text-muted-foreground bg-muted/50 px-1 rounded">+ /+ </kbd>+ </button>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ Search nodes+ </HoverCardContent>+ </HoverCard>+ <div className="w-px h-5 bg-border mx-1" />+ </>+ )}+ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <HStack spacing={0} className="rounded-md bg-muted/40 p-0.5">+ <button+ type="button"+ onClick={() => depth > 1 && onDepthChange(depth - 1)}+ aria-disabled={depth <= 1}+ aria-label="Decrease hops"+ className={cn(+ "h-6 w-6 rounded flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ depth <= 1+ ? "opacity-40 cursor-not-allowed text-muted-foreground"+ : "text-muted-foreground hover:text-foreground hover:bg-background"+ )}+ >+ <LuMinus className="w-3 h-3" />+ </button>+ <div className="px-2 min-w-[64px] text-center text-xs tabular-nums select-none">+ <span className="font-medium text-foreground">{depth}</span>+ <span className="text-muted-foreground ml-1">+ {depth === 1 ? "hop" : "hops"}+ </span>+ </div>+ <button+ type="button"+ onClick={() => depth < 5 && onDepthChange(depth + 1)}+ aria-disabled={depth >= 5}+ aria-label="Increase hops"+ className={cn(+ "h-6 w-6 rounded flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ depth >= 5+ ? "opacity-40 cursor-not-allowed text-muted-foreground"+ : "text-muted-foreground hover:text-foreground hover:bg-background"+ )}+ >+ <LuPlus className="w-3 h-3" />+ </button>+ </HStack>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ Max connections fetched per direction (1–5)+ </HoverCardContent>+ </HoverCard>++ {showGraphOnly && (+ <>+ <div className="w-px h-5 bg-border mx-1" />++ <HStack spacing={0} className="rounded-md bg-muted/40 p-0.5">+ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ onClick={() => onDirectionChange("TB")}+ className={cn(+ "h-6 w-6 rounded flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ direction === "TB"+ ? "bg-background text-foreground shadow-sm"+ : "text-muted-foreground hover:text-foreground"+ )}+ aria-pressed={direction === "TB"}+ aria-label="Top-down layout"+ >+ <LuMoveDown className="w-3.5 h-3.5" />+ </button>+ </HoverCardTrigger>+ <HoverCardContent side="top" sideOffset={8}>+ Top-down+ </HoverCardContent>+ </HoverCard>+ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ onClick={() => onDirectionChange("LR")}+ className={cn(+ "h-6 w-6 rounded flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ direction === "LR"+ ? "bg-background text-foreground shadow-sm"+ : "text-muted-foreground hover:text-foreground"+ )}+ aria-pressed={direction === "LR"}+ aria-label="Left-right layout"+ >+ <LuMoveRight className="w-3.5 h-3.5" />+ </button>+ </HoverCardTrigger>+ <HoverCardContent side="top" sideOffset={8}>+ Left-right+ </HoverCardContent>+ </HoverCard>+ </HStack>++ <div className="w-px h-5 bg-border mx-1" />++ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ type="button"+ onClick={() => {+ if (!hasSelection) return;+ onIsolateChange(!isolate);+ }}+ aria-disabled={!hasSelection}+ className={cn(+ "h-7 w-7 rounded-md flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ !hasSelection && "opacity-40 cursor-not-allowed",+ hasSelection &&+ !isolate &&+ "text-muted-foreground hover:text-foreground hover:bg-accent/60",+ hasSelection &&+ isolate &&+ "bg-foreground/10 text-foreground ring-1 ring-foreground/20"+ )}+ aria-pressed={isolate}+ aria-label="Isolate lineage"+ >+ <LuFocus className="w-3.5 h-3.5" />+ </button>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ {hasSelection ? "Isolate lineage" : "Select a node first"}+ </HoverCardContent>+ </HoverCard>++ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ onClick={() => fitView({ duration: 300, padding: 0.2 })}+ className={cn(+ "h-7 w-7 rounded-md flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ "text-muted-foreground hover:text-foreground hover:bg-accent/60"+ )}+ aria-label="Fit to view"+ >+ <LuMaximize className="w-3.5 h-3.5" />+ </button>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ Fit to view+ </HoverCardContent>+ </HoverCard>++ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <button+ type="button"+ onClick={() => onRelayout?.()}+ className={cn(+ "h-7 w-7 rounded-md flex items-center justify-center transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ "text-muted-foreground hover:text-foreground hover:bg-accent/60"+ )}+ aria-label="Re-layout graph"+ >+ <LuMove className="w-3.5 h-3.5" />+ </button>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ Re-layout graph+ </HoverCardContent>+ </HoverCard>++ <div className="w-px h-5 bg-border mx-1" />++ <SpacingSlider value={spacing} onChange={onSpacingChange} />+ </>+ )}+ </HStack>+ );+}++function SpacingSlider({+ value,+ onChange+}: {+ value: number;+ onChange?: (next: number) => void;+}) {+ return (+ <Popover>+ <HoverCard openDelay={150} closeDelay={50}>+ <HoverCardTrigger asChild>+ <PopoverTrigger asChild>+ <button+ type="button"+ aria-label="Layout spacing"+ className={cn(+ "h-7 px-2 rounded-md flex items-center gap-1 transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ "text-muted-foreground hover:text-foreground hover:bg-accent/60"+ )}+ >+ <span className="text-[10px] uppercase tracking-wide">+ Spacing+ </span>+ <span className="text-xs tabular-nums font-medium text-foreground">+ {value}+ </span>+ </button>+ </PopoverTrigger>+ </HoverCardTrigger>+ <HoverCardContent+ side="top"+ sideOffset={8}+ className="!w-auto !p-2 text-xs"+ >+ Spacing+ </HoverCardContent>+ </HoverCard>+ <PopoverContent+ side="bottom"+ align="end"+ sideOffset={8}+ collisionPadding={16}+ className="w-auto p-3"+ >+ <VStack spacing={2} className="items-center">+ <span className="text-[10px] uppercase tracking-wider text-muted-foreground font-semibold">+ Spacing+ </span>+ <span className="text-base font-medium tabular-nums text-foreground">+ {value}+ </span>+ <div className="relative h-32 w-6 flex items-center justify-center">+ <input+ type="range"+ min={1}+ max={5}+ step={1}+ value={value}+ onChange={(e) => onChange?.(Number(e.target.value))}+ aria-label="Layout spacing"+ className="absolute h-32 w-32 -rotate-90 cursor-pointer accent-foreground"+ style={{ accentColor: "hsl(var(--foreground))" }}+ />+ </div>+ <HStack className="w-full justify-between text-[10px] text-muted-foreground tabular-nums">+ <span>1</span>+ <span>5</span>+ </HStack>+ </VStack>+ </PopoverContent>+ </Popover>+ );+}++function SegmentButton({+ active,+ onClick,+ ariaLabel,+ children+}: {+ active: boolean;+ onClick: () => void;+ ariaLabel: string;+ children: React.ReactNode;+}) {+ return (+ <button+ onClick={onClick}+ aria-pressed={active}+ aria-label={ariaLabel}+ className={cn(+ "h-7 px-2.5 rounded-md text-xs flex items-center gap-1.5 transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ active+ ? "bg-background text-foreground shadow-sm font-medium"+ : "text-muted-foreground hover:text-foreground"+ )}+ >+ {children}+ </button>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/NodeSearchDialog.tsx b/apps/erp/app/modules/inventory/ui/Traceability/NodeSearchDialog.tsxnew file mode 100644index 0000000000..07f262eae3--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/NodeSearchDialog.tsx@@ -0,0 +1,235 @@+import {+ CommandDialog,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+ HStack+} from "@carbon/react";+import { useReactFlow } from "@xyflow/react";+import { useEffect, useMemo, useRef, useState } from "react";+import { useFetcher, useNavigate } from "react-router";+import type { Activity, TrackedEntity } from "~/modules/inventory";+import { TRACE_API } from "./constants";+import {+ ACTIVITY_KIND_META,+ activityKindFor,+ entityStatusMeta+} from "./metadata";+import { entityHeadline, type LineagePayload } from "./utils";++type Props = {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ payload: LineagePayload;+ onSelect?: (id: string) => void;+};++type SearchResult = {+ entities: TrackedEntity[];+ activities: Activity[];+};++export function NodeSearchDialog({+ open,+ onOpenChange,+ payload,+ onSelect+}: Props) {+ const { getNode, setCenter } = useReactFlow();+ const navigate = useNavigate();+ const fetcher = useFetcher<SearchResult>();+ const [query, setQuery] = useState("");+ const debounceRef = useRef<number | null>(null);++ useEffect(() => {+ if (!open) return;+ if (debounceRef.current) window.clearTimeout(debounceRef.current);+ const trimmed = query.trim();+ if (trimmed.length < 2) return;+ debounceRef.current = window.setTimeout(() => {+ const params = new URLSearchParams({ q: trimmed, kind: "all" });+ fetcher.load(`${TRACE_API.search}?${params.toString()}`);+ }, 200);+ return () => {+ if (debounceRef.current) window.clearTimeout(debounceRef.current);+ };+ }, [query, open, fetcher.load]);++ useEffect(() => {+ if (!open) setQuery("");+ }, [open]);++ const localIds = useMemo(() => {+ const e = new Set(payload.entities.map((x) => x.id));+ const a = new Set(payload.activities.map((x) => x.id));+ return { e, a };+ }, [payload]);++ const showLocal = query.trim().length < 2;+ const entities: TrackedEntity[] = showLocal+ ? payload.entities+ : (fetcher.data?.entities ?? []);+ const activities: Activity[] = showLocal+ ? payload.activities+ : (fetcher.data?.activities ?? []);++ function focusOrNavigate(kind: "entity" | "activity", id: string) {+ onOpenChange(false);+ const inGraph = kind === "entity" ? localIds.e.has(id) : localIds.a.has(id);+ if (inGraph) {+ const node = getNode(id);+ if (node) {+ const w = node.measured?.width ?? node.width ?? 44;+ const h = node.measured?.height ?? node.height ?? 44;+ setCenter(node.position.x + w / 2, node.position.y + h / 2, {+ zoom: 1.1,+ duration: 250+ });+ }+ onSelect?.(id);+ return;+ }+ const param = kind === "entity" ? "trackedEntityId" : "trackedActivityId";+ navigate(`/x/traceability/graph?${param}=${encodeURIComponent(id)}`);+ }++ const isLoading = fetcher.state !== "idle";++ return (+ <CommandDialog open={open} onOpenChange={onOpenChange}>+ <CommandInput+ placeholder="Search entities, activities, status, source doc..."+ value={query}+ onValueChange={setQuery}+ />+ <CommandList className="max-h-[420px]">+ {!showLocal &&+ isLoading &&+ entities.length === 0 &&+ activities.length === 0 ? (+ <div className="py-6 text-center text-sm text-muted-foreground">+ Searching...+ </div>+ ) : (+ <CommandEmpty className="py-6 text-center text-sm text-muted-foreground">+ No matches+ </CommandEmpty>+ )}++ {entities.length > 0 && (+ <CommandGroup+ heading={+ showLocal+ ? `Entities in graph (${entities.length})`+ : `Entities (${entities.length})`+ }+ >+ {entities.map((entity) => {+ const label = entityHeadline(entity, 12);+ const meta = entityStatusMeta(entity.status);+ const Icon = meta.icon;+ const inGraph = localIds.e.has(entity.id);+ return (+ <CommandItem+ key={entity.id}+ value={`${label} ${entity.id} ${entity.sourceDocument ?? ""} ${entity.sourceDocumentReadableId ?? ""} ${entity.readableId ?? ""} ${entity.status ?? ""}`}+ onSelect={() => focusOrNavigate("entity", entity.id)}+ className="!py-2 !px-2 gap-3"+ >+ <span+ className="w-7 h-7 rounded-md flex items-center justify-center shrink-0"+ style={{ background: meta.color }}+ >+ <Icon className="w-4 h-4 text-white" />+ </span>+ <div className="flex flex-col flex-1 min-w-0">+ <span className="text-sm font-medium truncate">+ {label}+ </span>+ <span className="text-[11px] text-muted-foreground truncate">+ {entity.sourceDocument ?? "—"}+ </span>+ </div>+ <HStack spacing={2} className="items-center shrink-0">+ <StatusPill status={entity.status} />+ <span className="text-xs tabular-nums text-muted-foreground w-10 text-right">+ {entity.quantity}+ </span>+ {!inGraph && <OpenBadge />}+ </HStack>+ </CommandItem>+ );+ })}+ </CommandGroup>+ )}++ {activities.length > 0 && (+ <CommandGroup+ heading={+ showLocal+ ? `Activities in graph (${activities.length})`+ : `Activities (${activities.length})`+ }+ >+ {activities.map((activity) => {+ const meta = ACTIVITY_KIND_META[activityKindFor(activity.type)];+ const Icon = meta.icon;+ const label = activity.type ?? meta.label;+ const inGraph = localIds.a.has(activity.id);+ return (+ <CommandItem+ key={activity.id}+ value={`${label} ${activity.id} ${activity.sourceDocument ?? ""} ${activity.sourceDocumentReadableId ?? ""}`}+ onSelect={() => focusOrNavigate("activity", activity.id)}+ className="!py-2 !px-2 gap-3"+ >+ <span+ className="w-7 h-7 rounded-md flex items-center justify-center shrink-0"+ style={{ background: meta.color }}+ >+ <Icon className="w-4 h-4 text-white" />+ </span>+ <div className="flex flex-col flex-1 min-w-0">+ <span className="text-sm font-medium truncate">+ {label}+ </span>+ <span className="text-[11px] text-muted-foreground truncate">+ {activity.sourceDocumentReadableId ??+ activity.sourceDocument ??+ "—"}+ </span>+ </div>+ {!inGraph && <OpenBadge />}+ </CommandItem>+ );+ })}+ </CommandGroup>+ )}+ </CommandList>+ </CommandDialog>+ );+}++function StatusPill({ status }: { status: string | null | undefined }) {+ if (!status) return null;+ const color = entityStatusMeta(status).color;+ return (+ <span className="inline-flex items-center gap-1 text-[10px] uppercase tracking-wide text-foreground bg-muted/60 rounded px-1.5 py-0.5 leading-none">+ <span+ className="w-1.5 h-1.5 rounded-full"+ style={{ background: color }}+ />+ {status}+ </span>+ );+}++function OpenBadge() {+ return (+ <span className="text-[9px] uppercase tracking-wider font-medium text-muted-foreground border border-border rounded px-1 py-0.5 leading-none">+ Open+ </span>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/StepRecordsList.tsx b/apps/erp/app/modules/inventory/ui/Traceability/StepRecordsList.tsxnew file mode 100644index 0000000000..4bd291a1d1--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/StepRecordsList.tsx@@ -0,0 +1,172 @@+import { Checkbox, cn } from "@carbon/react";+import { formatDateTime } from "@carbon/utils";+import { useNumberFormatter } from "@react-aria/i18n";+import { LuPaperclip } from "react-icons/lu";+import { Link } from "react-router";+import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";+import { ProcedureStepTypeIcon } from "~/components/Icons";+import { usePeople } from "~/stores";+import { getPrivateUrl, path } from "~/utils/path";+import type { StepRecord } from "./utils";++type Props = { records: StepRecord[]; jobId?: string | null };++export function StepRecordsList({ records, jobId }: Props) {+ const numberFormatter = useNumberFormatter();+ const unitOfMeasures = useUnitOfMeasure();+ const [employees] = usePeople();++ if (records.length === 0) return null;++ const href = jobId ? path.to.jobOperationStepRecords(jobId) : null;++ return (+ <ul className="divide-y divide-border/30">+ {records.map((r) => {+ const employee = employees.find((e) => e.id === r.createdBy);+ const initials = employee?.name+ ? employee.name+ .split(" ")+ .map((p) => p[0])+ .filter(Boolean)+ .slice(0, 2)+ .join("")+ .toUpperCase()+ : null;+ const body = (+ <>+ <div className="flex items-center gap-2 min-w-0">+ <ProcedureStepTypeIcon type={r.type as any} />+ <span className="text-sm truncate flex-1">{r.name}</span>+ <span className="text-sm tabular-nums shrink-0">+ <StepValue+ record={r}+ numberFormatter={numberFormatter}+ unitOfMeasures={unitOfMeasures}+ employees={employees}+ />+ </span>+ </div>+ <div className="text-[10px] text-muted-foreground/70 mt-0.5 truncate flex items-center gap-1.5">+ {r.operationDescription && (+ <span className="truncate">{r.operationDescription}</span>+ )}+ {initials && (+ <>+ <span className="text-muted-foreground/40">·</span>+ <span className="font-medium tracking-wide">{initials}</span>+ </>+ )}+ <span className="text-muted-foreground/40">·</span>+ <span className="tabular-nums">+ {formatDateTime(r.createdAt)}+ </span>+ </div>+ </>+ );+ return (+ <li key={r.id}>+ {href ? (+ <Link+ to={href}+ prefetch="intent"+ className="block px-2 py-1.5 -mx-2 rounded-md hover:bg-accent/50 transition-colors"+ onClick={(e) => e.stopPropagation()}+ >+ {body}+ </Link>+ ) : (+ <div className="py-1.5 first:pt-0 last:pb-0">{body}</div>+ )}+ </li>+ );+ })}+ </ul>+ );+}++type StepValueProps = {+ record: StepRecord;+ numberFormatter: ReturnType<typeof useNumberFormatter>;+ unitOfMeasures: ReturnType<typeof useUnitOfMeasure>;+ employees: ReturnType<typeof usePeople>[0];+};++function StepValue({+ record,+ numberFormatter,+ unitOfMeasures,+ employees+}: StepValueProps) {+ switch (record.type) {+ case "Task":+ case "Checkbox":+ return <Checkbox checked={record.booleanValue ?? false} disabled />;+ case "Value":+ case "List":+ return <span className="font-medium">{record.value ?? "—"}</span>;+ case "Measurement": {+ if (typeof record.numericValue !== "number") return null;+ const unit = unitOfMeasures.find(+ (u) => u.value === record.unitOfMeasureCode+ )?.label;+ const outOfRange =+ (record.minValue !== null &&+ record.minValue !== undefined &&+ record.numericValue < record.minValue) ||+ (record.maxValue !== null &&+ record.maxValue !== undefined &&+ record.numericValue > record.maxValue);+ return (+ <span className={cn("font-medium", outOfRange && "text-red-500")}>+ {numberFormatter.format(record.numericValue)}+ {unit ? (+ <span className="text-muted-foreground ml-1">{unit}</span>+ ) : null}+ </span>+ );+ }+ case "Timestamp":+ return (+ <span className="text-muted-foreground">+ {formatDateTime(record.value ?? "")}+ </span>+ );+ case "Person": {+ const name = employees.find((e) => e.id === record.userValue)?.name;+ return <span className="font-medium">{name ?? "—"}</span>;+ }+ case "File":+ return record.value ? (+ <a+ href={getPrivateUrl(record.value)}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-1 hover:underline"+ onClick={(e) => e.stopPropagation()}+ >+ <LuPaperclip className="size-3" />+ File+ </a>+ ) : null;+ case "Inspection":+ return (+ <span className="inline-flex items-center gap-1.5">+ {record.value && (+ <a+ href={getPrivateUrl(record.value)}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-1 hover:underline"+ onClick={(e) => e.stopPropagation()}+ >+ <LuPaperclip className="size-3" />+ </a>+ )}+ <Checkbox checked={record.booleanValue ?? false} disabled />+ </span>+ );+ default:+ return null;+ }+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsxindex 08330ba3ff..349c403499 100644--- a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx+++ b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx@@ -1,830 +1,601 @@-import { useCarbon } from "@carbon/auth";+import { cn } from "@carbon/react";import {- Button,- HStack,- Tooltip,- TooltipContent,- TooltipTrigger,- useMount,- VStack-} from "@carbon/react";-import type {- TrackedActivityAttributes,- TrackedEntityAttributes-} from "@carbon/utils";-import { useLingui } from "@lingui/react/macro";-import * as d3 from "d3";-import { motion } from "framer-motion";-import { useEffect, useRef, useState } from "react";-import { LuCopy, LuLink } from "react-icons/lu";-import {- CustomerAvatar,- EmployeeAvatar,- Hyperlink,- SupplierAvatar-} from "~/components";-import { useWorkCenters } from "~/components/Form/WorkCenter";+ Background,+ BackgroundVariant,+ type Edge,+ type EdgeTypes,+ MiniMap,+ type Node,+ type NodeMouseHandler,+ type NodeTypes,+ ReactFlow,+ ReactFlowProvider,+ useEdgesState,+ useNodesInitialized,+ useNodesState,+ useReactFlow+} from "@xyflow/react";+import "@xyflow/react/dist/style.css";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { useNavigate, useSearchParams } from "react-router";+import { useShallow } from "zustand/react/shallow";import type {Activity,- GraphData,- GraphLink,- GraphNode,+ ActivityInput,+ ActivityOutput,TrackedEntity} from "~/modules/inventory";-import { path } from "~/utils/path";-import { capitalize, copyToClipboard } from "~/utils/string";--export function TraceabilityGraph({- data,- onNodeClick,- width,- height,- selectedId-}: TraceabilityGraphProps) {- const svgRef = useRef<SVGSVGElement>(null);-- useEffect(() => {- if (!svgRef.current || !data.nodes.length) return;-- const svg = d3.select(svgRef.current);- svg.selectAll("*").remove();-- // Add definitions for filters and markers- const defs = svg.append("defs");-- // Arrow marker - increased size for bigger arrowheads- defs- .append("marker")- .attr("id", "arrow")- .attr("viewBox", "0 -4 8 8") // Increased viewBox size- .attr("refX", 24) // Adjusted refX to account for larger size- .attr("refY", 0)- .attr("markerWidth", 6) // Increased from 4 to 6- .attr("markerHeight", 6) // Increased from 4 to 6- .attr("orient", "auto")- .append("path")- .attr("d", "M0,-4L8,0L0,4") // Increased path size- .attr("fill", "currentColor"); // Use text-foreground color-- // Calculate node depths and assign radial positions- const calculateNodeDepths = () => {- // Create a map to store node depths- const nodeDepths = new Map<string, number>();- const nodeParents = new Map<string, string>();-- // Find root nodes (typically activities without incoming links)- const rootNodes = data.nodes.filter((node) => {- return (- node.type === "activity" &&- !data.links.some((link) => link.target === node.id)- );- });-- // If no clear root nodes, use the first activity- const startNodes =- rootNodes.length > 0- ? rootNodes- : data.nodes.filter((node) => node.type === "activity").slice(0, 1);-- // Initialize queue with root nodes at depth 0- const queue: [string, number, string | null][] = startNodes.map(- (node) => [node.id, 0, null]- );-- // BFS to assign depths- while (queue.length > 0) {- const [nodeId, depth, parentId] = queue.shift()!;+import { clampDepth } from "./constants";+import { QuantityEdge } from "./edges/QuantityEdge";+import { GraphLegend } from "./GraphLegend";+import { GraphToolbar } from "./GraphToolbar";+import { useExpandNode } from "./hooks/useExpandNode";+import { useProbeBoundary } from "./hooks/useProbeBoundary";+import {+ ACTIVITY_KIND_META,+ activityKindFor,+ entityStatusMeta+} from "./metadata";+import { NodeSearchDialog } from "./NodeSearchDialog";+import { ActivityNode } from "./nodes/ActivityNode";+import { EntityNode } from "./nodes/EntityNode";+import { useTraceabilityStore } from "./store";+import { TraceabilityTable } from "./TraceabilityTable";+import {+ type LineageEdge,+ type LineageNode,+ type LineagePayload,+ mergePayloads+} from "./utils";+import {+ useAsyncLayout,+ useAsyncSelectionPath,+ useTracingGraphManager+} from "./worker/hooks";++const nodeTypes: NodeTypes = {+ entity: EntityNode as any,+ activity: ActivityNode as any+};- // Skip if we've already processed this node with a shorter path- if (nodeDepths.has(nodeId) && nodeDepths.get(nodeId)! <= depth) {- continue;- }+const edgeTypes: EdgeTypes = {+ quantity: QuantityEdge as any+};- // Assign depth and parent- nodeDepths.set(nodeId, depth);- if (parentId) nodeParents.set(nodeId, parentId);+const proOptions = { hideAttribution: true };- // Find all connected nodes- const outgoingLinks = data.links.filter(- (link) => link.source === nodeId- );- for (const link of outgoingLinks) {- queue.push([link.target, depth + 1, nodeId]);- }+const EMPTY_NODES: LineageNode[] = [];+const EMPTY_EDGES: LineageEdge[] = [];- // Also consider incoming links for non-root nodes- if (depth > 0) {- const incomingLinks = data.links.filter(- (link) => link.target === nodeId && link.source !== parentId- );- for (const link of incomingLinks) {- queue.push([link.source, depth + 1, nodeId]);- }- }- }+type Props = {+ entities: TrackedEntity[];+ activities: Activity[];+ inputs: ActivityInput[];+ outputs: ActivityOutput[];+ stepRecords?: import("./utils").StepRecord[];+ containments?: import("./utils").IssueContainment[];+ rootId: string;+ rootType: "entity" | "activity" | "job";+ width: number;+ height: number;+};- return { nodeDepths, nodeParents };- };+export function TraceabilityGraph(props: Props) {+ return (+ <ReactFlowProvider>+ <TraceabilityGraphInner {...props} />+ </ReactFlowProvider>+ );+}- const { nodeDepths, nodeParents } = calculateNodeDepths();+function TraceabilityGraphInner({+ entities,+ activities,+ inputs,+ outputs,+ stepRecords,+ containments,+ rootId,+ rootType,+ width,+ height+}: Props) {+ const [searchParams] = useSearchParams();+ const navigate = useNavigate();+ const { fitView } = useReactFlow();+ const nodesInitialized = useNodesInitialized();+ const lastFitSignatureRef = useRef<string>("");++ const initialPayload = useMemo<LineagePayload>(+ () => ({+ entities,+ activities,+ inputs,+ outputs,+ stepRecords,+ containments+ }),+ [entities, activities, inputs, outputs, stepRecords, containments]+ );- // Enhance nodes with depth information- data.nodes.forEach((node) => {- node.depth = nodeDepths.get(node.id) || 0;- node.parentId = nodeParents.get(node.id) || null;- });+ const expansions = useTraceabilityStore((s) => s.expansions);+ const expandable = useTraceabilityStore((s) => s.expandable);+ const {+ addExpansion,+ removeExpansion,+ markExpandable,+ markExhausted,+ reset: resetStore,+ setDirection,+ setView,+ setSpacing,+ setIsolate,+ setSelectedSingle,+ toggleSelected+ } = useTraceabilityStore(+ useShallow((s) => ({+ addExpansion: s.addExpansion,+ removeExpansion: s.removeExpansion,+ markExpandable: s.markExpandable,+ markExhausted: s.markExhausted,+ reset: s.reset,+ setDirection: s.setDirection,+ setView: s.setView,+ setSpacing: s.setSpacing,+ setIsolate: s.setIsolate,+ setSelectedSingle: s.setSelectedSingle,+ toggleSelected: s.toggleSelected+ }))+ );+ const probeCacheRef = useRef<Map<string, LineagePayload>>(new Map());+ const probedRef = useRef<Set<string>>(new Set());- // Create a force simulation with improved forces- const simulation = d3- .forceSimulation<d3.SimulationNodeDatum & GraphNode>(data.nodes as any)- .force(- "link",- d3- .forceLink<- d3.SimulationNodeDatum & GraphNode,- d3.SimulationLinkDatum<d3.SimulationNodeDatum & GraphNode> &- GraphLink- >(data.links as any)- .id((d) => (d as any).id)- .distance((d) => {- // Increase distance based on the depth of connected nodes- const sourceNode = data.nodes.find(- (n) => n.id === (d as any).source.id- );- const targetNode = data.nodes.find(- (n) => n.id === (d as any).target.id- );- if (sourceNode && targetNode) {- const depthDiff = Math.abs(- (sourceNode.depth || 0) - (targetNode.depth || 0)- );- return 150 + depthDiff * 50; // Base distance + additional for depth difference- }- return 150;- })- )- .force("charge", d3.forceManyBody().strength(-800)) // Stronger repulsion- .force("center", d3.forceCenter(width / 2, height / 2))- .force(- "collision",- d3.forceCollide().radius((d) => {- // Larger collision radius for nodes with higher depth- const node = d as GraphNode;- return 60 + (node.depth || 0) * 5;- })- )- .force("x", d3.forceX(width / 2).strength(0.1))- .force(- "y",- d3- .forceY()- .y((d) => {- // Position nodes vertically based on their level or type- const node = d as GraphNode;- if (node.type === "activity") {- return height * 0.4; // Activities in the middle- } else {- // For entities, check if they're inputs or outputs- const isInput = data.links.some(- (link) => link.target === node.id- );- const isOutput = data.links.some(- (link) => link.source === node.id- );-- if (isInput && !isOutput) {- return height * 0.2; // Inputs at the top- } else if (isOutput && !isInput) {- return height * 0.6; // Outputs at the bottom- } else {- return height * 0.4; // Both input and output in the middle- }- }- })- .strength(0.3)- )- // Add radial force to push nodes outward based on depth- .force(- "radial",- d3- .forceRadial<d3.SimulationNodeDatum & GraphNode>(- (d) => {- const node = d as GraphNode;- // Radius increases with depth- return 100 + (node.depth || 0) * 120;- },- width / 2,- height / 2- )- .strength(0.8)- );+ // biome-ignore lint/correctness/useExhaustiveDependencies: reset on payload identity change (loader refetch)+ useEffect(() => {+ resetStore(rootId);+ probeCacheRef.current = new Map();+ probedRef.current = new Set();+ }, [initialPayload, resetStore, rootId]);++ const payload = useMemo<LineagePayload>(() => {+ let merged = initialPayload;+ for (const exp of expansions.values()) {+ merged = mergePayloads(merged, exp);+ }+ return merged;+ }, [initialPayload, expansions]);- // Create curved links with uniform size- const link = svg- .append("g")- .attr("class", "links")- .selectAll("path")- .data(data.links)- .enter()- .append("path")- .attr("stroke-width", 1.5)- .attr("stroke", "currentColor") // Use text-foreground color- .attr("marker-end", "url(#arrow)")- .attr("fill", "none")- .style("opacity", 0.8); // Increased opacity for better visibility-- // Create the nodes group- const node = svg- .append("g")- .attr("class", "nodes")- .selectAll("g")- .data(data.nodes)- .enter()- .append("g")- .call(- d3- .drag<SVGGElement, GraphNode>()- .on("start", dragstarted)- .on("drag", dragged)- .on("end", dragended) as any- );+ const direction = useTraceabilityStore((s) => s.direction);+ const view = useTraceabilityStore((s) => s.view);+ const spacing = useTraceabilityStore((s) => s.spacing);+ const isolate = useTraceabilityStore((s) => s.isolate);+ const [searchOpen, setSearchOpen] = useState(false);+ const [layoutVersion, setLayoutVersion] = useState(0);- // Add circles for the nodes with shadow and glow- node- .append("circle")- .attr("r", (d) => 20 + (d.depth || 0) * 2) // Slightly larger circles for deeper nodes- .attr("stroke", (d) => (d.data.id === selectedId ? "#2DD4BF" : "none"))- .attr("stroke-width", (d) => (d.data.id === selectedId ? 3 : 0))- .attr("fill", (d) => (d.type === "entity" ? "#2563EB" : "#7C3AED")) // blue-600 for entities, rose-600 for activities- .attr("filter", "url(#drop-shadow)")- .style("filter", "url(#glow)")- .on("click", (event, d) => {- event.stopPropagation();- onNodeClick(d);- });- // Add labels to the nodes- node- .append("text")- .text((d) => {- if (d.type === "entity") {- const entity = d.data as TrackedEntity;- return entity.sourceDocumentReadableId || entity.id.substring(0, 8);- } else {- const activity = d.data as Activity;- // Use optional chaining for properties that might not exist- return activity.type || activity.id?.substring(0, 8) || "Unknown";+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ const isMeta = (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k";+ if (e.key === "/" || isMeta) {+ const target = e.target as HTMLElement | null;+ if (+ target &&+ (target.tagName === "INPUT" ||+ target.tagName === "TEXTAREA" ||+ target.isContentEditable)+ ) {+ if (!isMeta) return;}- })- .attr("text-anchor", "middle")- .attr("dy", (d) => 30 + (d.depth || 0) * 2) // Adjust label position for larger circles- .attr("font-size", "12px")- .attr("fill", "hsl(var(--foreground))") // Use white in dark mode and black in light mode- .attr("font-weight", "bold")- .attr("font-family", "Geist");-- // Add serial number below the label- node- .append("text")- .text((d) => d.id?.substring(0, 8) || "")- .attr("text-anchor", "middle")- .attr("dy", (d) => 45 + (d.depth || 0) * 2) // Position below the main label- .attr("font-size", "10px")- .attr("fill", "currentColor")- .attr("font-family", "Geist");-- // Add title for hover tooltip- node.append("title").text((d) => {- if (d.type === "entity") {- const entity = d.data as TrackedEntity;- return `Entity: ${- entity.sourceDocumentReadableId || entity.id- }\nQuantity: ${entity.quantity}`;- } else {- const activity = d.data as Activity;- return `Activity: ${activity.type || "Unknown"}\nID: ${- activity.id || "Unknown"- }`;+ e.preventDefault();+ setSearchOpen(true);}- });-- // Update positions on each tick of the simulation- simulation.on("tick", () => {- // Keep nodes within bounds- data.nodes.forEach((d: any) => {- d.x = Math.max(30, Math.min(width - 30, d.x));- d.y = Math.max(30, Math.min(height - 30, d.y));- });-- // Update curved links- link.attr("d", (d: any) => {- const dx = d.target.x - d.source.x;- const dy = d.target.y - d.source.y;- const dr = Math.sqrt(dx * dx + dy * dy) * 1.5;- return `M${d.source.x},${d.source.y}A${dr},${dr} 0 0,1 ${d.target.x},${d.target.y}`;- });-- node.attr("transform", (d) => `translate(${d.x},${d.y})`);- });-- // Drag functions- function dragstarted(event: d3.D3DragEvent<SVGGElement, GraphNode, any>) {- if (!event.active) simulation.alphaTarget(0.3).restart();- event.subject.fx = event.subject.x;- event.subject.fy = event.subject.y;- }-- function dragged(event: d3.D3DragEvent<SVGGElement, GraphNode, any>) {- event.subject.fx = event.x;- event.subject.fy = event.y;- }-- function dragended(event: d3.D3DragEvent<SVGGElement, GraphNode, any>) {- if (!event.active) simulation.alphaTarget(0);- // Don't reset fx and fy to null to keep nodes in place after dragging- // This allows nodes to stay where they were dragged to- }-- return () => {- simulation.stop();};- }, [data, width, height, onNodeClick, selectedId]);-- return (- <motion.div- className="relative"- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- transition={{ duration: 0.3 }}- >- <svg ref={svgRef} width={width} height={height} />- </motion.div>- );-}--export function TraceabilitySidebar({- entity,- activity-}: {- entity: TrackedEntity | null;- activity: Activity | null;-}) {- const { t } = useLingui();- const selectedNode = entity ?? activity;- const selectedNodeType = entity ? "entity" : "activity";- const selectedNodeAttributes = (- entity ? (entity.attributes ?? {}) : (activity?.attributes ?? {})- ) as Record<string, any>;-- return (- <VStack- spacing={4}- className="w-96 flex-shrink-0 bg-sidebar h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent border-l border-border px-4 py-2 text-sm"- >- <VStack spacing={4}>- <HStack className="w-full justify-between">- <h3 className="text-xs text-muted-foreground">Attributes</h3>- <HStack spacing={1}>- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="ghost"- aria-label={t`Link`}- size="sm"- className="p-1"- onClick={() => copyToClipboard(window.location.href)}- >- <LuLink className="w-3 h-3" />- </Button>- </TooltipTrigger>- <TooltipContent>- <span>Copy link</span>- </TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="ghost"- aria-label={t`Copy`}- size="sm"- className="p-1"- onClick={() => copyToClipboard(selectedNode?.id ?? "")}- >- <LuCopy className="w-3 h-3" />- </Button>- </TooltipTrigger>- <TooltipContent>- <span>Copy {capitalize(selectedNodeType)} ID</span>- </TooltipContent>- </Tooltip>- </HStack>- </HStack>- <VStack spacing={0}>- <span className="text-sm font-medium">- {entity- ? entity.sourceDocumentReadableId- : activity- ? activity.type- : "No selection"}- </span>- <span className="text-xs text-muted-foreground">- {selectedNode?.id}- </span>- </VStack>-- {selectedNodeType === "entity" && (- <VStack spacing={0}>- <span className="text-xs text-muted-foreground">Status</span>- <span className="text-sm">{entity?.status}</span>- </VStack>- )}-- {selectedNodeType === "entity" && (- <VStack spacing={0}>- <span className="text-xs text-muted-foreground">Quantity</span>- <span className="text-sm">{entity?.quantity}</span>- </VStack>- )}-- {selectedNodeType === "entity" && entity?.readableId && (- <VStack spacing={0}>- <span className="text-xs text-muted-foreground">- Serial/Batch #- </span>- <span className="text-sm">{entity.readableId}</span>- </VStack>- )}-- {Object.entries(selectedNodeAttributes)- .sort((a, b) => a[0].localeCompare(b[0]))- .map(([key, value]) => {- if (key.startsWith("Operation ")) {- return null;- }+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, []);+ const handleRelayout = useCallback(() => {+ setLayoutVersion((v) => v + 1);+ }, []);- switch (- key as keyof (TrackedEntityAttributes & TrackedActivityAttributes)- ) {- case "Customer":- return <CustomerAttribute key={key} value={value} />;- case "Employee":- return <EmployeeAttribute key={key} value={value} />;- case "Inspector":- return <InspectorAttribute key={key} value={value} />;- case "Job":- return <JobAttribute key={key} jobId={value} />;- case "Job Material":- return null;- case "Job Make Method":- return (- <JobMakeMethodAttribute- key={key}- // biome-ignore lint/complexity/useLiteralKeys: suppressed due to migration- jobId={selectedNodeAttributes["Job"]}- makeMethodId={value}- materialId={selectedNodeAttributes["Job Material"]}- />- );- case "Job Operation":- return (- <JobOperationAttribute- key={key}- // biome-ignore lint/complexity/useLiteralKeys: suppressed due to migration- jobId={selectedNodeAttributes["Job"]}- operationId={value}- />- );- case "Purchase Order":- return (- <PurchaseOrderAttribute key={key} purchaseOrderId={value} />- );- case "Purchase Order Line":- return null;- case "Receipt":- return <ReceiptAttribute key={key} receiptId={value} />;- case "Receipt Line":- return null;- case "Sales Order":- return <SalesOrderAttribute key={key} salesOrderId={value} />;- case "Sales Order Line":- return null;- case "Shipment":- return <ShipmentAttribute key={key} shipmentId={value} />;- case "Shipment Line":- return null;- case "Production Event":- return (- <JobProductionEvent- key={key}- // biome-ignore lint/complexity/useLiteralKeys: suppressed due to migration- jobId={selectedNodeAttributes["Job"]}- eventId={value}- />- );- case "Supplier":- return <SupplierAttribute key={key} value={value} />;- case "Work Center":- return <WorkCenterAttribute key={key} value={value} />;- case "Consumed Quantity":- case "Original Quantity":- case "Remaining Quantity":- case "Receipt Line Index":- case "Shipment Line Index":- // Special cases can be handled here in the future- default: {- // Manual expiry-override history surfaces in the- // ExpiryTracePopover, not the graph sidebar. Render- // primitives only here — anything object-like would crash- // React's "objects are not valid as a child" guard.- if (key === "expiryOverrides") return null;- if (value === null || value === undefined) return null;- if (typeof value === "object") {- return (- <VStack spacing={0} key={key}>- <span className="text-xs text-muted-foreground">- {key}- </span>- <span className="text-sm font-mono break-all">- {JSON.stringify(value)}- </span>- </VStack>- );- }- return (- <VStack spacing={0} key={key}>- <span className="text-xs text-muted-foreground">{key}</span>- <span className="text-sm">{String(value)}</span>- </VStack>- );- }- }- })}- </VStack>- </VStack>- );-}+ const [draggedIds, setDraggedIds] = useState<Set<string>>(new Set());+ const [fitted, setFitted] = useState(false);-function CustomerAttribute({ value }: { value: string }) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Customer</span>- <CustomerAvatar customerId={value} />- </VStack>+ useEffect(() => {+ if (view === "graph") {+ lastFitSignatureRef.current = "";+ setFitted(false);+ }+ }, [view]);++ const rejectIds = useMemo(() => {+ const set = new Set<string>();+ for (const e of payload.entities)+ if (e.status === "Rejected") set.add(e.id);+ return set;+ }, [payload.entities]);++ const tracingGraphManager = useTracingGraphManager();+ const layoutResult = useAsyncLayout(+ tracingGraphManager,+ payload,+ direction,+ spacing,+ rejectIds,+ layoutVersion);-}+ const laidNodes = layoutResult?.nodes ?? EMPTY_NODES;+ const laidEdges = layoutResult?.edges ?? EMPTY_EDGES;-function EmployeeAttribute({ value }: { value: string }) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Employee</span>- <EmployeeAvatar employeeId={value} />- </VStack>+ const [nodes, setNodes, onNodesChange] = useNodesState<Node>(+ laidNodes as Node[]);-}--function InspectorAttribute({ value }: { value: string }) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Inspector</span>- <EmployeeAvatar employeeId={value} />- </VStack>+ const [edges, setEdges, onEdgesChange] = useEdgesState<Edge>(+ laidEdges as Edge[]);-}-function JobAttribute({ jobId }: { jobId: string }) {- const [job, setJob] = useState<string | null>(null);- const { carbon } = useCarbon();-- const getJob = async () => {- const response = await carbon- ?.from("job")- .select("jobId")- .eq("id", jobId)- .single();-- setJob(response?.data?.jobId ?? null);- };+ const [layoutAnimating, setLayoutAnimating] = useState(false);+ useEffect(() => {+ setNodes(laidNodes as Node[]);+ setEdges(laidEdges as Edge[]);+ setDraggedIds(new Set());+ setLayoutAnimating(true);+ const t = setTimeout(() => setLayoutAnimating(false), 260);+ return () => clearTimeout(t);+ }, [laidNodes, laidEdges, setNodes, setEdges]);++ const selectedIds = useTraceabilityStore((s) => s.selectedIds);+ const selectedIdSet = useMemo(() => new Set(selectedIds), [selectedIds]);+ const selectedId = selectedIds[0] ?? null;++ const onExpandResult = useCallback(+ (incoming: LineagePayload, originId: string) => {+ const knownEntityIds = new Set(payload.entities.map((e) => e.id));+ const knownActivityIds = new Set(payload.activities.map((a) => a.id));+ const hasNewEntity = incoming.entities.some(+ (e) => !knownEntityIds.has(e.id)+ );+ const hasNewActivity = incoming.activities.some(+ (a) => !knownActivityIds.has(a.id)+ );- useMount(() => {- getJob();- });+ if (!hasNewEntity && !hasNewActivity) {+ markExhausted(originId);+ return;+ }- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Job</span>- <Hyperlink to={path.to.jobDetails(jobId)}>{job ?? jobId}</Hyperlink>- </VStack>+ addExpansion(originId, incoming);+ },+ [payload, markExhausted, addExpansion]);-}-function JobProductionEvent({- jobId,- eventId-}: {- jobId: string;- eventId: string;-}) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Production Event</span>- {jobId && eventId ? (- <Hyperlink to={path.to.jobProductionEvent(jobId, eventId)}>- {eventId}- </Hyperlink>- ) : (- <span className="text-sm text-muted-foreground">{eventId}</span>- )}- </VStack>- );-}+ const { expand, isLoading: isExpanding } = useExpandNode(onExpandResult);-function JobOperationAttribute({- jobId,- operationId-}: {- jobId: string;- operationId: string;-}) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Job Operation</span>- {jobId && operationId ? (- <Hyperlink- to={`${path.to.jobProductionEvents(- jobId- )}?filter=jobOperationId:eq:${operationId}`}- >- {operationId}- </Hyperlink>- ) : (- <span className="text-sm text-muted-foreground">{operationId}</span>- )}- </VStack>+ const onNodeClick = useCallback<NodeMouseHandler>(+ (event, node) => {+ const shift = event.shiftKey;+ if (shift) {+ toggleSelected(node.id);+ return;+ }+ setSelectedSingle(node.id);+ },+ [setSelectedSingle, toggleSelected]);-}-function JobMakeMethodAttribute({- jobId,- makeMethodId,- materialId-}: {- jobId: string;- makeMethodId: string;- materialId: string;-}) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Job Make Method</span>- <Hyperlink- to={- materialId- ? path.to.jobMakeMethod(jobId, makeMethodId)- : path.to.jobMethod(jobId, makeMethodId)- }- >- {makeMethodId}- </Hyperlink>- </VStack>+ const onExpandNode = useCallback(+ (id: string, direction: "up" | "down" | "both") => {+ const cached = probeCacheRef.current.get(id);+ if (cached) {+ addExpansion(id, cached);+ return;+ }+ expand(id, direction, 1);+ },+ [expand, addExpansion]);-}-function PurchaseOrderAttribute({- purchaseOrderId-}: {- purchaseOrderId: string;-}) {- const [poNumber, setPoNumber] = useState<string | null>(null);- const { carbon } = useCarbon();-- const getPurchaseOrder = async () => {- const response = await carbon- ?.from("purchaseOrder")- .select("purchaseOrderId")- .eq("id", purchaseOrderId)- .single();-- setPoNumber(response?.data?.purchaseOrderId ?? null);- };-- useMount(() => {- getPurchaseOrder();- });-- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Purchase Order</span>- <Hyperlink to={path.to.purchaseOrderDetails(purchaseOrderId)}>- {poNumber ?? purchaseOrderId}- </Hyperlink>- </VStack>+ const onCollapseNode = useCallback(+ (id: string) => {+ removeExpansion(id);+ },+ [removeExpansion]);-}--function SalesOrderAttribute({ salesOrderId }: { salesOrderId: string }) {- const [soNumber, setSoNumber] = useState<string | null>(null);- const { carbon } = useCarbon();- const getSalesOrder = async () => {- const response = await carbon- ?.from("salesOrder")- .select("salesOrderId")- .eq("id", salesOrderId)- .single();+ const onPaneClick = useCallback(() => {+ setSelectedSingle(null);+ }, [setSelectedSingle]);- setSoNumber(response?.data?.salesOrderId ?? null);- };-- useMount(() => {- getSalesOrder();- });-- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Sales Order</span>- <Hyperlink to={path.to.salesOrderDetails(salesOrderId)}>- {soNumber ?? salesOrderId}- </Hyperlink>- </VStack>+ const selectionPath = useAsyncSelectionPath(+ tracingGraphManager,+ edges as unknown as LineageEdge[],+ selectedIds);-}--function ReceiptAttribute({ receiptId }: { receiptId: string }) {- const [receiptNumber, setReceiptNumber] = useState<string | null>(null);- const { carbon } = useCarbon();-- const getReceipt = async () => {- const response = await carbon- ?.from("receipt")- .select("receiptId")- .eq("id", receiptId)- .single();- setReceiptNumber(response?.data?.receiptId ?? null);- };-- useMount(() => {- getReceipt();+ const isolated = useMemo(() => {+ if (!isolate || selectedIds.length === 0) return null;+ if (selectionPath) return selectionPath;+ return {+ nodeIds: new Set(selectedIds),+ edgeIds: new Set<string>()+ };+ }, [isolate, selectedIds, selectionPath]);++ const boundaryByNode = useMemo(() => {+ const incoming = new Set<string>();+ const outgoing = new Set<string>();+ for (const e of edges) {+ incoming.add(e.target);+ outgoing.add(e.source);+ }+ return { incoming, outgoing };+ }, [edges]);++ useProbeBoundary({+ payload,+ boundaryByNode,+ markExpandable,+ markExhausted,+ probeCacheRef,+ probedRef});- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Receipt</span>- <Hyperlink to={path.to.receiptDetails(receiptId)}>- {receiptNumber ?? receiptId}- </Hyperlink>- </VStack>- );-}-function ShipmentAttribute({ shipmentId }: { shipmentId: string }) {- const [shipmentNumber, setShipmentNumber] = useState<string | null>(null);- const { carbon } = useCarbon();-- const getShipment = async () => {- const response = await carbon- ?.from("shipment")- .select("shipmentId")- .eq("id", shipmentId)- .single();-- setShipmentNumber(response?.data?.shipmentId ?? null);- };-- useMount(() => {- getShipment();- });+ const containmentByEntity = useMemo(() => {+ const m = new Map<string, "Contained" | "Uncontained">();+ for (const c of payload.containments ?? []) {+ const prev = m.get(c.trackedEntityId);+ if (c.containmentStatus === "Uncontained" || !prev) {+ m.set(c.trackedEntityId, c.containmentStatus);+ }+ }+ return m;+ }, [payload.containments]);++ const enrichedNodes = useMemo<Node[]>(() => {+ const isJobRoot = rootType === "job";+ return nodes.map((n) => {+ const isRoot = !isJobRoot && n.id === rootId;+ const selected = selectedIdSet.has(n.id);+ const inPath = selectionPath?.nodeIds.has(n.id) ?? false;+ const dimmed = isolated ? !isolated.nodeIds.has(n.id) : false;+ const isExpanded = expansions.has(n.id);+ const isEntity = (n.data as any)?.kind === "entity";+ const isExpandable = expandable.has(n.id);+ const canExpandUp =+ isEntity && isExpandable && !boundaryByNode.incoming.has(n.id);+ const canExpandDown =+ isEntity && isExpandable && !boundaryByNode.outgoing.has(n.id);+ const containmentStatus = isEntity+ ? containmentByEntity.get(n.id)+ : undefined;+ return {+ ...n,+ data: {+ ...(n.data as any),+ isRoot,+ selected,+ inPath,+ dimmed,+ isExpanded,+ canExpandUp,+ canExpandDown,+ containmentStatus,+ onExpand: onExpandNode,+ onCollapse: onCollapseNode+ },+ selected+ };+ });+ }, [+ nodes,+ rootId,+ rootType,+ selectedIdSet,+ isolated,+ expansions,+ boundaryByNode,+ expandable,+ selectionPath,+ containmentByEntity,+ onExpandNode,+ onCollapseNode+ ]);++ const enrichedEdges = useMemo<Edge[]>(() => {+ return edges.map((e) => {+ const dimmed = isolated ? !isolated.edgeIds.has(e.id) : false;+ const highlighted = selectionPath?.edgeIds.has(e.id) ?? false;+ const touchesDragged =+ draggedIds.has(e.source) || draggedIds.has(e.target);+ const baseData = { ...((e.data as any) ?? {}) };+ if (touchesDragged) baseData.points = undefined;+ return {+ ...e,+ data: { ...baseData, dimmed, highlighted }+ };+ });+ }, [edges, isolated, selectionPath, draggedIds]);- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Shipment</span>- <Hyperlink to={path.to.shipmentDetails(shipmentId)}>- {shipmentNumber ?? shipmentId}- </Hyperlink>- </VStack>+ useEffect(() => {+ if (!nodesInitialized) return;+ if (view !== "graph") return;+ if (nodes.length === 0) return;+ if (width === 0 || height === 0) return;+ const sig = `${nodes.length}:${edges.length}:${rootId}:${direction}:${width}x${height}`;+ if (lastFitSignatureRef.current === sig) return;+ const isFirstFit = lastFitSignatureRef.current === "";+ lastFitSignatureRef.current = sig;+ const raf = requestAnimationFrame(() => {+ fitView({+ padding: 0.2,+ duration: isFirstFit ? 0 : 250,+ maxZoom: 1+ });+ requestAnimationFrame(() => setFitted(true));+ });+ return () => cancelAnimationFrame(raf);+ }, [+ nodesInitialized,+ nodes.length,+ edges.length,+ rootId,+ direction,+ view,+ width,+ height,+ fitView+ ]);++ const handleDepthChange = useCallback(+ (next: number) => {+ const params = new URLSearchParams(searchParams);+ params.set("depth", String(next));+ navigate(`/x/traceability/graph?${params.toString()}`);+ },+ [navigate, searchParams]);-}-function SupplierAttribute({ value }: { value: string }) {- return (- <VStack spacing={1}>- <span className="text-xs text-muted-foreground">Supplier</span>- <SupplierAvatar supplierId={value} />- </VStack>- );-}+ if (view === "table") {+ return (+ <div className="relative w-full h-full" style={{ width, height }}>+ <div className="pt-14 w-full h-full overflow-auto">+ <TraceabilityTable+ payload={payload}+ rootId={rootId}+ selectedId={selectedId}+ onSelect={(id) => setSelectedSingle(id)}+ />+ </div>+ <GraphToolbar+ depth={clampDepth(Number(searchParams.get("depth") ?? 1))}+ onDepthChange={handleDepthChange}+ direction={direction}+ onDirectionChange={setDirection}+ view={view}+ onViewChange={setView}+ isolate={isolate}+ onIsolateChange={setIsolate}+ hasSelection={selectedIds.length > 0}+ onOpenSearch={() => setSearchOpen(true)}+ spacing={spacing}+ onSpacingChange={setSpacing}+ />+ <NodeSearchDialog+ open={searchOpen}+ onOpenChange={setSearchOpen}+ payload={payload}+ onSelect={(id) => setSelectedSingle(id)}+ />+ </div>+ );+ }-function WorkCenterAttribute({ value }: { value: string }) {- const workCenters = useWorkCenters({});- const workCenter = workCenters.options.find((wc) => wc.value === value);return (- <VStack spacing={0}>- <span className="text-xs text-muted-foreground">Work Center</span>- <span className="text-sm">{workCenter?.label}</span>- </VStack>+ <div+ className={cn(+ "relative w-full h-full",+ layoutAnimating && "trace-layout-animating"+ )}+ style={{ width, height }}+ >+ <style>{`+ .trace-layout-animating .react-flow__node {+ transition: transform 220ms cubic-bezier(0.645, 0.045, 0.355, 1);+ will-change: transform;+ }+ .trace-fade-in {+ transition: opacity 150ms cubic-bezier(0.215, 0.61, 0.355, 1);+ }+ .trace-edge-path {+ transition: opacity 150ms cubic-bezier(0.215, 0.61, 0.355, 1),+ stroke-width 150ms cubic-bezier(0.215, 0.61, 0.355, 1);+ }+ @media (prefers-reduced-motion: reduce) {+ .trace-layout-animating .react-flow__node { transition: none; }+ .trace-fade-in { transition: none; }+ .trace-edge-path { transition: none; }+ }+ `}</style>+ <ReactFlow+ nodes={enrichedNodes as Node[]}+ edges={enrichedEdges as Edge[]}+ onNodesChange={onNodesChange}+ onEdgesChange={onEdgesChange}+ onNodeClick={onNodeClick}+ onPaneClick={onPaneClick}+ className="trace-fade-in"+ style={{ opacity: fitted ? 1 : 0 }}+ onNodeDragStart={(_, node) =>+ setDraggedIds((prev) => {+ if (prev.has(node.id)) return prev;+ const next = new Set(prev);+ next.add(node.id);+ return next;+ })+ }+ nodeTypes={nodeTypes}+ edgeTypes={edgeTypes}+ proOptions={proOptions}+ minZoom={0.15}+ maxZoom={3}+ nodesDraggable+ nodesConnectable={false}+ edgesFocusable={false}+ elevateNodesOnSelect={false}+ onlyRenderVisibleElements+ defaultEdgeOptions={{ type: "quantity", zIndex: 0 }}+ >+ <Background+ variant={BackgroundVariant.Dots}+ gap={28}+ size={1}+ color="hsl(var(--muted-foreground) / 0.15)"+ />+ <MiniMap+ pannable+ zoomable+ className="!bg-card !border-border"+ nodeColor={(n) => {+ const data = (n as any).data;+ if (data?.kind === "entity") {+ return entityStatusMeta(data.entity?.status).color;+ }+ return ACTIVITY_KIND_META[activityKindFor(data?.activity?.type)]+ .color;+ }}+ nodeStrokeWidth={0}+ maskColor="hsl(var(--background) / 0.7)"+ />+ </ReactFlow>++ <GraphToolbar+ depth={Math.min(Math.max(1, Number(searchParams.get("depth") ?? 1)), 5)}+ onDepthChange={handleDepthChange}+ direction={direction}+ onDirectionChange={setDirection}+ view={view}+ onViewChange={setView}+ isolate={isolate}+ onIsolateChange={setIsolate}+ hasSelection={selectedIds.length > 0}+ onRelayout={handleRelayout}+ onOpenSearch={() => setSearchOpen(true)}+ spacing={spacing}+ onSpacingChange={setSpacing}+ />++ <GraphLegend />++ <NodeSearchDialog+ open={searchOpen}+ onOpenChange={setSearchOpen}+ payload={payload}+ onSelect={(id) => setSelectedSingle(id)}+ />++ {isExpanding && (+ <div className="absolute bottom-3 left-1/2 -translate-x-1/2 z-10 rounded-full border border-border bg-card px-3 py-1 text-xs shadow-sm">+ Loading...+ </div>+ )}+ </div>);}-type TraceabilityGraphProps = {- data: GraphData;- selectedId: string | null;- onNodeClick: (node: GraphNode) => void;- width: number;- height: number;-};diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsxnew file mode 100644index 0000000000..9ba68f1d07--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx@@ -0,0 +1,513 @@+import {+ Badge,+ Button,+ cn,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@carbon/react";+import { useLingui } from "@lingui/react/macro";+import { useMemo } from "react";+import {+ LuChevronLeft,+ LuChevronRight,+ LuCopy,+ LuExternalLink,+ LuLink+} from "react-icons/lu";+import { Link } from "react-router";+import type { Activity, TrackedEntity } from "~/modules/inventory";+import { capitalize, copyToClipboard } from "~/utils/string";+import { AttributeList, hasRenderedAttributes } from "./attributeRenderers";+import { ContainmentList } from "./ContainmentList";+import { ACTIVITY_KIND_META, activityKindFor } from "./metadata";+import { StepRecordsList } from "./StepRecordsList";+import { useTraceabilityStore } from "./store";+import TrackedEntityStatus from "./TrackedEntityStatus";+import {+ activityHeadline,+ entityHeadline,+ type LineagePayload,+ sourceLinkHref+} from "./utils";++type SidebarProps = {+ entity: TrackedEntity | null;+ activity: Activity | null;+ payload?: LineagePayload;+ onSelect?: (id: string) => void;+};++export function TraceabilitySidebar({+ entity,+ activity,+ payload,+ onSelect+}: SidebarProps) {+ const selectedIds = useTraceabilityStore((s) => s.selectedIds);+ const focusedIndex = useTraceabilityStore((s) => s.focusedIndex);+ const onFocusedIndexChange = useTraceabilityStore((s) => s.setFocusedIndex);+ const { t } = useLingui();+ const selectedNode = entity ?? activity;+ const selectedNodeType = entity ? "entity" : "activity";+ const selectedNodeAttributes = (+ entity ? (entity.attributes ?? {}) : (activity?.attributes ?? {})+ ) as Record<string, any>;++ const headline = entity+ ? entityHeadline(entity)+ : activity+ ? (activity.type ?? activity.id)+ : "No selection";++ const sourceDoc = entity?.sourceDocument ?? activity?.sourceDocument;+ const sourceDocId = entity?.sourceDocumentId ?? activity?.sourceDocumentId;+ const sourceDocReadableId =+ entity?.sourceDocumentReadableId ?? activity?.sourceDocumentReadableId;+ const sourceHref = sourceLinkHref(sourceDoc, sourceDocId);++ const { producedBy, consumedBy, inputs, outputs } = useMemo(() => {+ if (!payload) {+ return {+ producedBy: [] as RelatedActivity[],+ consumedBy: [] as RelatedActivity[],+ inputs: [] as RelatedEntity[],+ outputs: [] as RelatedEntity[]+ };+ }+ const activityById = new Map(payload.activities.map((a) => [a.id, a]));+ const entityById = new Map(payload.entities.map((e) => [e.id, e]));++ const producedBy: RelatedActivity[] = [];+ const consumedBy: RelatedActivity[] = [];+ const inputs: RelatedEntity[] = [];+ const outputs: RelatedEntity[] = [];++ if (entity) {+ for (const o of payload.outputs) {+ if (o.trackedEntityId !== entity.id) continue;+ const a = activityById.get(o.trackedActivityId);+ if (a) producedBy.push({ activity: a, quantity: o.quantity });+ }+ for (const i of payload.inputs) {+ if (i.trackedEntityId !== entity.id) continue;+ const a = activityById.get(i.trackedActivityId);+ if (a) consumedBy.push({ activity: a, quantity: i.quantity });+ }+ } else if (activity) {+ for (const i of payload.inputs) {+ if (i.trackedActivityId !== activity.id) continue;+ const e = entityById.get(i.trackedEntityId);+ if (e) inputs.push({ entity: e, quantity: i.quantity });+ }+ for (const o of payload.outputs) {+ if (o.trackedActivityId !== activity.id) continue;+ const e = entityById.get(o.trackedEntityId);+ if (e) outputs.push({ entity: e, quantity: o.quantity });+ }+ }++ return { producedBy, consumedBy, inputs, outputs };+ }, [payload, entity, activity]);++ const stepRecordsForActivity = useMemo(() => {+ if (!activity || !payload?.stepRecords?.length) return [];+ const opId = (activity.attributes as Record<string, any> | null)?.[+ "Job Operation"+ ];+ if (!opId) return [];+ return payload.stepRecords.filter((r) => r.operationId === opId);+ }, [activity, payload?.stepRecords]);++ const containmentsForEntity = useMemo(() => {+ if (!entity || !payload?.containments?.length) return [];+ return payload.containments.filter((c) => c.trackedEntityId === entity.id);+ }, [entity, payload?.containments]);++ const hasMultiSelect = selectedIds && selectedIds.length > 1;++ return (+ <aside className="w-[426px] flex-shrink-0 bg-sidebar h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent border-l border-border text-sm">+ {hasMultiSelect && (+ <div className="flex items-center justify-between gap-2 bg-muted/40 mx-3 mt-3 rounded-md px-2 py-1">+ <div className="flex items-center gap-2 min-w-0">+ <Badge+ variant="secondary"+ className="uppercase tracking-wide text-[10px]"+ >+ {selectedIds.length} selected+ </Badge>+ <span className="text-[11px] text-muted-foreground tabular-nums">+ {(focusedIndex ?? 0) + 1} / {selectedIds.length}+ </span>+ </div>+ <div className="flex items-center gap-1">+ <Button+ variant="ghost"+ size="sm"+ aria-label="Previous selected"+ className="p-1 h-6 w-6"+ onClick={() => {+ const i = focusedIndex ?? 0;+ const next = (i - 1 + selectedIds.length) % selectedIds.length;+ onFocusedIndexChange?.(next);+ }}+ >+ <LuChevronLeft className="w-3.5 h-3.5" />+ </Button>+ <Button+ variant="ghost"+ size="sm"+ aria-label="Next selected"+ className="p-1 h-6 w-6"+ onClick={() => {+ const i = focusedIndex ?? 0;+ const next = (i + 1) % selectedIds.length;+ onFocusedIndexChange?.(next);+ }}+ >+ <LuChevronRight className="w-3.5 h-3.5" />+ </Button>+ </div>+ </div>+ )}++ <header className="px-3 pt-3 pb-2.5">+ <div className="flex items-center justify-between gap-2 mb-1.5">+ <div className="flex items-center gap-1.5 min-w-0">+ {entity ? (+ <Badge+ variant="secondary"+ className="uppercase tracking-wide text-[10px] shrink-0"+ >+ Entity+ </Badge>+ ) : activity ? (+ <>+ <Badge+ variant="outline"+ className="uppercase tracking-wide text-[10px] shrink-0"+ >+ Activity+ </Badge>+ <ActivityTypeChip type={activity.type} />+ </>+ ) : null}+ </div>+ <div className="flex items-center gap-0.5 shrink-0">+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ aria-label={t`Copy link`}+ size="sm"+ className="p-1 h-7 w-7"+ onClick={() => copyToClipboard(window.location.href)}+ >+ <LuLink className="w-3.5 h-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Copy link</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ aria-label={t`Copy ID`}+ size="sm"+ className="p-1 h-7 w-7"+ onClick={() => copyToClipboard(selectedNode?.id ?? "")}+ >+ <LuCopy className="w-3.5 h-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ Copy {capitalize(selectedNodeType)} ID+ </TooltipContent>+ </Tooltip>+ </div>+ </div>+ <h2 className="text-[15px] font-semibold leading-5 text-foreground truncate">+ {headline}+ </h2>+ <p className="text-[11px] text-muted-foreground/70 font-mono break-all leading-4 mt-0.5">+ {selectedNode?.id}+ </p>+ </header>++ <div className="flex flex-col divide-y divide-border/40">+ {(selectedNodeType === "entity" || sourceDoc) && (+ <Section>+ <dl className="divide-y divide-border/30">+ {selectedNodeType === "entity" && (+ <>+ <PropRow label="Status">+ <TrackedEntityStatus status={entity?.status} />+ </PropRow>+ <PropRow label="Quantity">+ <span className="text-sm font-medium tabular-nums">+ {entity?.quantity}+ </span>+ </PropRow>+ {entity?.readableId && (+ <PropRow label="Serial / Batch">+ <span className="text-sm font-mono">+ {entity.readableId}+ </span>+ </PropRow>+ )}+ </>+ )}+ {sourceDoc && (+ <PropRow label={sourceDoc}>+ <SourceDocValue+ readableId={sourceDocReadableId}+ fallbackId={sourceDocId}+ href={sourceHref}+ />+ </PropRow>+ )}+ </dl>+ </Section>+ )}++ {producedBy.length > 0 && (+ <Section title="Produced by" count={producedBy.length}>+ <ul className="divide-y divide-border/30">+ {producedBy.map((item) => (+ <RelatedActivityRow+ key={item.activity.id}+ item={item}+ onSelect={onSelect}+ />+ ))}+ </ul>+ </Section>+ )}+ {consumedBy.length > 0 && (+ <Section title="Consumed by" count={consumedBy.length}>+ <ul className="divide-y divide-border/30">+ {consumedBy.map((item) => (+ <RelatedActivityRow+ key={item.activity.id}+ item={item}+ onSelect={onSelect}+ />+ ))}+ </ul>+ </Section>+ )}+ {inputs.length > 0 && (+ <Section title="Inputs" count={inputs.length}>+ <ul className="divide-y divide-border/30">+ {inputs.map((item) => (+ <RelatedEntityRow+ key={item.entity.id}+ item={item}+ onSelect={onSelect}+ />+ ))}+ </ul>+ </Section>+ )}+ {outputs.length > 0 && (+ <Section title="Outputs" count={outputs.length}>+ <ul className="divide-y divide-border/30">+ {outputs.map((item) => (+ <RelatedEntityRow+ key={item.entity.id}+ item={item}+ onSelect={onSelect}+ />+ ))}+ </ul>+ </Section>+ )}++ {containmentsForEntity.length > 0 && (+ <Section title="Containments" count={containmentsForEntity.length}>+ <ContainmentList items={containmentsForEntity} />+ </Section>+ )}++ {stepRecordsForActivity.length > 0 && (+ <Section title="Step records" count={stepRecordsForActivity.length}>+ <StepRecordsList+ records={stepRecordsForActivity}+ jobId={+ (activity?.attributes as Record<string, any> | null)?.Job ??+ null+ }+ />+ </Section>+ )}++ {hasRenderedAttributes(selectedNodeAttributes) && (+ <Section title="Attributes">+ <AttributeList attrs={selectedNodeAttributes} />+ </Section>+ )}+ </div>+ </aside>+ );+}++type RelatedActivity = { activity: Activity; quantity: number };+type RelatedEntity = { entity: TrackedEntity; quantity: number };++function Section({+ title,+ count,+ children+}: {+ title?: string;+ count?: number;+ children: React.ReactNode;+}) {+ return (+ <section className="px-3 py-3">+ {title && (+ <header className="flex items-center justify-between text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-2">+ <span>{title}</span>+ {typeof count === "number" && (+ <span className="tabular-nums text-muted-foreground/60">+ {count}+ </span>+ )}+ </header>+ )}+ {children}+ </section>+ );+}++function PropRow({+ label,+ children+}: {+ label: React.ReactNode;+ children: React.ReactNode;+}) {+ return (+ <div className="grid grid-cols-[8rem_1fr] items-center gap-3 py-1.5 first:pt-0 last:pb-0">+ <dt className="text-xs text-muted-foreground truncate">{label}</dt>+ <dd className="text-right min-w-0 truncate">{children}</dd>+ </div>+ );+}++function ActivityTypeChip({ type }: { type: string | null | undefined }) {+ const kind = activityKindFor(type);+ const meta = ACTIVITY_KIND_META[kind];+ const Icon = meta.icon;+ return (+ <div className="flex items-center gap-1.5 min-w-0">+ <span+ className="size-3.5 rounded-sm flex items-center justify-center shrink-0"+ style={{ background: meta.color }}+ >+ <Icon className="size-2.5 text-white" />+ </span>+ <span className="text-xs truncate">{type ?? meta.label}</span>+ </div>+ );+}++function SourceDocValue({+ readableId,+ fallbackId,+ href+}: {+ readableId: string | null | undefined;+ fallbackId: string | null | undefined;+ href: string | null;+}) {+ const label = readableId ?? fallbackId ?? "—";+ if (href) {+ return (+ <Link+ to={href}+ className="inline-flex items-center gap-1 text-sm font-medium hover:underline"+ onClick={(e) => e.stopPropagation()}+ >+ <span className="truncate">{label}</span>+ <LuExternalLink className="size-3 text-muted-foreground shrink-0" />+ </Link>+ );+ }+ return <span className="text-sm font-medium truncate">{label}</span>;+}++function RelatedActivityRow({+ item,+ onSelect+}: {+ item: RelatedActivity;+ onSelect?: (id: string) => void;+}) {+ const kind = activityKindFor(item.activity.type);+ const meta = ACTIVITY_KIND_META[kind];+ const Icon = meta.icon;+ const label = activityHeadline(item.activity, 8);+ return (+ <li>+ <button+ type="button"+ onClick={() => onSelect?.(item.activity.id)}+ className={cn(+ "group w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded-md",+ "hover:bg-accent/50 transition-colors"+ )}+ >+ <div className="flex items-center gap-2 min-w-0">+ <span+ className="size-3.5 rounded-sm flex items-center justify-center shrink-0"+ style={{ background: meta.color }}+ >+ <Icon className="size-2.5 text-white" />+ </span>+ <span className="text-sm truncate">{label}</span>+ </div>+ <div className="flex items-center gap-1 shrink-0">+ <span className="text-xs tabular-nums text-muted-foreground">+ {item.quantity}+ </span>+ <LuChevronRight className="size-3 text-muted-foreground/60 group-hover:text-foreground transition-colors" />+ </div>+ </button>+ </li>+ );+}++function RelatedEntityRow({+ item,+ onSelect+}: {+ item: RelatedEntity;+ onSelect?: (id: string) => void;+}) {+ const label = entityHeadline(item.entity, 8);+ return (+ <li>+ <button+ type="button"+ onClick={() => onSelect?.(item.entity.id)}+ className={cn(+ "group w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded-md",+ "hover:bg-accent/50 transition-colors"+ )}+ >+ <div className="flex items-center gap-2 min-w-0">+ <TrackedEntityStatus status={item.entity.status} />+ <span className="text-sm truncate">{label}</span>+ </div>+ <div className="flex items-center gap-1 shrink-0">+ <span className="text-xs tabular-nums text-muted-foreground">+ {item.quantity}+ </span>+ <LuChevronRight className="size-3 text-muted-foreground/60 group-hover:text-foreground transition-colors" />+ </div>+ </button>+ </li>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityTable.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityTable.tsxnew file mode 100644index 0000000000..f7c8237052--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/TraceabilityTable.tsx@@ -0,0 +1,416 @@+import { Badge, cn, HStack } from "@carbon/react";+import { useEffect, useMemo, useRef, useState } from "react";+import { LuChevronDown, LuChevronRight, LuExternalLink } from "react-icons/lu";+import { Link } from "react-router";+import type { Activity, TrackedEntity } from "~/modules/inventory";+import { ACTIVITY_KIND_META, activityKindFor } from "./metadata";+import TrackedEntityStatus from "./TrackedEntityStatus";+import { entityHeadline, type LineagePayload, sourceLinkHref } from "./utils";++type Props = {+ payload: LineagePayload;+ rootId: string;+ selectedId?: string | null;+ onSelect?: (id: string) => void;+};++type Row = {+ kind: "entity" | "activity";+ id: string;+ depth: number;+ edgeQuantity?: number;+ edgeKind?: "input" | "output";+ isReference?: boolean;+ isLast?: boolean;+};++export function TraceabilityTable({+ payload,+ rootId,+ selectedId,+ onSelect+}: Props) {+ const [collapsed, setCollapsed] = useState<Set<string>>(new Set());+ const rowRefs = useRef<Map<string, HTMLElement>>(new Map());++ const { entityById, activityById, downstream } = useMemo(() => {+ const entityById = new Map<string, TrackedEntity>();+ const activityById = new Map<string, Activity>();+ for (const e of payload.entities) entityById.set(e.id, e);+ for (const a of payload.activities) activityById.set(a.id, a);++ const downstream = new Map<+ string,+ { targetId: string; quantity: number; kind: "input" | "output" }[]+ >();+ const push = <K, V>(m: Map<K, V[]>, k: K, v: V) => {+ if (!m.has(k)) m.set(k, []);+ m.get(k)!.push(v);+ };++ for (const i of payload.inputs) {+ push(downstream, i.trackedEntityId, {+ targetId: i.trackedActivityId,+ quantity: i.quantity,+ kind: "input"+ });+ push(downstream, i.trackedActivityId, {+ targetId: i.trackedEntityId,+ quantity: i.quantity,+ kind: "input"+ });+ }+ for (const o of payload.outputs) {+ push(downstream, o.trackedActivityId, {+ targetId: o.trackedEntityId,+ quantity: o.quantity,+ kind: "output"+ });+ push(downstream, o.trackedEntityId, {+ targetId: o.trackedActivityId,+ quantity: o.quantity,+ kind: "output"+ });+ }++ return { entityById, activityById, downstream };+ }, [payload]);++ const rows = useMemo(() => {+ const out: Row[] = [];+ const visited = new Set<string>();++ function kindOf(id: string): "entity" | "activity" {+ return entityById.has(id) ? "entity" : "activity";+ }++ function walk(+ id: string,+ depth: number,+ edgeQuantity?: number,+ edgeKind?: "input" | "output",+ isLast = true+ ) {+ if (visited.has(id)) {+ out.push({+ kind: kindOf(id),+ id,+ depth,+ edgeQuantity,+ edgeKind,+ isReference: true,+ isLast+ });+ return;+ }+ visited.add(id);+ out.push({+ kind: kindOf(id),+ id,+ depth,+ edgeQuantity,+ edgeKind,+ isLast+ });++ if (collapsed.has(id)) return;++ const children = downstream.get(id) ?? [];+ children.forEach((c, idx) => {+ walk(+ c.targetId,+ depth + 1,+ c.quantity,+ c.kind,+ idx === children.length - 1+ );+ });+ }++ walk(rootId, 0);+ return out;+ }, [rootId, downstream, entityById, collapsed]);++ const toggle = (id: string) =>+ setCollapsed((prev) => {+ const next = new Set(prev);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ return next;+ });++ // When a selection arrives (e.g. from search), expand all ancestors and+ // scroll the row into view.+ useEffect(() => {+ if (!selectedId || selectedId === rootId) return;+ const path: string[] = [];+ const visited = new Set<string>();+ function find(id: string): boolean {+ if (visited.has(id)) return false;+ visited.add(id);+ if (id === selectedId) return true;+ const children = downstream.get(id) ?? [];+ for (const c of children) {+ if (find(c.targetId)) {+ path.push(id);+ return true;+ }+ }+ return false;+ }+ find(rootId);++ if (path.length > 0) {+ setCollapsed((prev) => {+ let changed = false;+ const next = new Set(prev);+ for (const ancestor of path) {+ if (next.has(ancestor)) {+ next.delete(ancestor);+ changed = true;+ }+ }+ return changed ? next : prev;+ });+ }++ // Scroll row into view after expansion settles+ requestAnimationFrame(() => {+ const el = rowRefs.current.get(selectedId);+ el?.scrollIntoView({ behavior: "smooth", block: "center" });+ });+ }, [selectedId, rootId, downstream]);++ return (+ <div className="w-full h-full overflow-auto py-2">+ <div className="bg-card border-y border-border/40">+ {rows.map((row, i) => (+ <TreeRow+ key={`${row.id}:${i}`}+ row={row}+ entity={entityById.get(row.id)}+ activity={activityById.get(row.id)}+ isSelected={row.id === selectedId}+ isCollapsed={collapsed.has(row.id)}+ hasChildren={+ !row.isReference && (downstream.get(row.id)?.length ?? 0) > 0+ }+ onToggle={() => toggle(row.id)}+ onSelect={() => onSelect?.(row.id)}+ registerRef={(el) => {+ if (el) rowRefs.current.set(row.id, el);+ else rowRefs.current.delete(row.id);+ }}+ />+ ))}+ </div>+ </div>+ );+}++function TreeRow({+ row,+ entity,+ activity,+ isSelected,+ isCollapsed,+ hasChildren,+ onToggle,+ onSelect,+ registerRef+}: {+ row: Row;+ entity: TrackedEntity | undefined;+ activity: Activity | undefined;+ isSelected: boolean;+ isCollapsed: boolean;+ hasChildren: boolean;+ onToggle: () => void;+ onSelect: () => void;+ registerRef?: (el: HTMLButtonElement | null) => void;+}) {+ if (row.kind === "entity") {+ if (!entity) return null;+ const headline = entityHeadline(entity, 12);+ const href = sourceLinkHref(entity.sourceDocument, entity.sourceDocumentId);+ return (+ <button+ ref={registerRef}+ type="button"+ onClick={onSelect}+ className={cn(+ "group w-full flex items-center gap-2 px-4 text-left h-12",+ "border-b border-border/40 last:border-b-0 transition-colors",+ isSelected ? "bg-accent/40" : "hover:bg-accent/20",+ row.isReference && "text-muted-foreground italic"+ )}+ >+ <Indent depth={row.depth} />+ <ToggleOrLeaf+ hasChildren={hasChildren}+ isCollapsed={isCollapsed}+ isReference={!!row.isReference}+ onToggle={onToggle}+ />+ <HStack spacing={2} className="flex-1 min-w-0 items-center">+ <span+ className={cn(+ "text-sm truncate",+ isSelected && "font-medium",+ row.isReference && "underline decoration-dotted"+ )}+ >+ {headline}+ </span>+ {row.isReference && <RefBadge />}+ {!row.isReference && <TrackedEntityStatus status={entity.status} />}+ </HStack>+ {!row.isReference && (+ <span className="text-xs tabular-nums text-muted-foreground shrink-0 w-12 text-right">+ {entity.quantity}+ </span>+ )}+ {!row.isReference && entity.sourceDocument && (+ <span className="text-[11px] text-muted-foreground truncate max-w-[140px] hidden md:inline">+ {entity.sourceDocument}+ </span>+ )}+ {href && (+ <Link+ to={href}+ onClick={(e) => e.stopPropagation()}+ className="text-muted-foreground hover:text-foreground shrink-0"+ aria-label="Open source document"+ >+ <LuExternalLink className="w-3.5 h-3.5" />+ </Link>+ )}+ </button>+ );+ }++ if (!activity) return null;+ const kind = activityKindFor(activity.type);+ const meta = ACTIVITY_KIND_META[kind];+ const Icon = meta.icon;+ const label = activity.type ?? meta.label;+ const href = sourceLinkHref(+ activity.sourceDocument,+ activity.sourceDocumentId+ );++ return (+ <button+ ref={registerRef}+ type="button"+ onClick={onSelect}+ className={cn(+ "group w-full flex items-center gap-2 px-4 text-left h-12",+ "border-b border-border/40 last:border-b-0 transition-colors",+ isSelected ? "bg-accent/40" : "hover:bg-accent/20",+ row.isReference && "text-muted-foreground italic"+ )}+ >+ <Indent depth={row.depth} />+ <ToggleOrLeaf+ hasChildren={hasChildren}+ isCollapsed={isCollapsed}+ isReference={!!row.isReference}+ onToggle={onToggle}+ />+ <HStack spacing={2} className="flex-1 min-w-0 items-center">+ <span+ className="w-4 h-4 rounded-sm flex items-center justify-center shrink-0"+ style={{ background: meta.color }}+ >+ <Icon className="w-2.5 h-2.5 text-white" />+ </span>+ <span+ className={cn(+ "text-sm truncate",+ isSelected && "font-medium",+ row.isReference && "underline decoration-dotted"+ )}+ >+ {label}+ </span>+ {row.isReference && <RefBadge />}+ </HStack>+ {!row.isReference && row.edgeQuantity != null && (+ <span className="text-xs tabular-nums text-muted-foreground shrink-0 w-12 text-right">+ {row.edgeQuantity}+ </span>+ )}+ {!row.isReference && activity.sourceDocument && (+ <span className="text-[11px] text-muted-foreground truncate max-w-[140px] hidden md:inline">+ {activity.sourceDocument}+ </span>+ )}+ {href && (+ <Link+ to={href}+ onClick={(e) => e.stopPropagation()}+ className="text-muted-foreground hover:text-foreground shrink-0"+ aria-label="Open source document"+ >+ <LuExternalLink className="w-3.5 h-3.5" />+ </Link>+ )}+ </button>+ );+}++function Indent({ depth }: { depth: number }) {+ if (depth === 0) return null;+ return (+ <div className="flex shrink-0">+ {Array.from({ length: depth }).map((_, i) => (+ <div key={i} className="w-4 h-12 border-l border-border/50 ml-px" />+ ))}+ </div>+ );+}++function ToggleOrLeaf({+ hasChildren,+ isCollapsed,+ isReference,+ onToggle+}: {+ hasChildren: boolean;+ isCollapsed: boolean;+ isReference: boolean;+ onToggle: () => void;+}) {+ if (hasChildren) {+ return (+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ onToggle();+ }}+ className="text-muted-foreground hover:text-foreground shrink-0"+ aria-label={isCollapsed ? "Expand" : "Collapse"}+ >+ {isCollapsed ? (+ <LuChevronRight className="size-4.5" />+ ) : (+ <LuChevronDown className="size-4.5" />+ )}+ </button>+ );+ }+ return <div className="w-3.5 shrink-0" />;+}++function RefBadge() {+ return (+ <Badge+ variant="outline"+ className="text-[9px] px-1 py-0 uppercase tracking-wide"+ >+ ref+ </Badge>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsxindex 0025e3012c..a4e898850e 100644--- a/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx+++ b/apps/erp/app/modules/inventory/ui/Traceability/TrackedEntitiesTable.tsx@@ -209,7 +209,7 @@ const TrackedEntitiesTable = memo(}}],- [numberFormatter, items, t, nearExpiryWarningDays]+ [numberFormatter, items, t, nearExpiryWarningDays, shelfLifePolicies]);const renderContextMenu = useCallback(diff --git a/apps/erp/app/modules/inventory/ui/Traceability/attributeRenderers.tsx b/apps/erp/app/modules/inventory/ui/Traceability/attributeRenderers.tsxnew file mode 100644index 0000000000..b167c03f13--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/attributeRenderers.tsx@@ -0,0 +1,394 @@+import { useCarbon } from "@carbon/auth";+import { cn, useMount } from "@carbon/react";+import type {+ TrackedActivityAttributes,+ TrackedEntityAttributes+} from "@carbon/utils";+import { useState } from "react";+import { Link } from "react-router";+import { CustomerAvatar, EmployeeAvatar, SupplierAvatar } from "~/components";+import { useWorkCenters } from "~/components/Form/WorkCenter";+import { path } from "~/utils/path";++function InlineLink({+ to,+ children,+ className+}: {+ to: string;+ children: React.ReactNode;+ className?: string;+}) {+ return (+ <Link+ to={to}+ prefetch="intent"+ className={cn(+ "text-sm font-medium text-foreground hover:underline truncate",+ className+ )}+ onClick={(e) => e.stopPropagation()}+ >+ {children}+ </Link>+ );+}++const SKIPPED_ATTRIBUTE_KEYS = new Set([+ "Job Material",+ "Purchase Order Line",+ "Receipt Line",+ "Sales Order Line",+ "Shipment Line",+ "expiryOverrides"+]);++export function hasRenderedAttributes(attrs: Record<string, any>): boolean {+ for (const [key, value] of Object.entries(attrs)) {+ if (SKIPPED_ATTRIBUTE_KEYS.has(key)) continue;+ if (key.startsWith("Operation ")) continue;+ if (value === null || value === undefined) continue;+ return true;+ }+ return false;+}++export function AttributeList({ attrs }: { attrs: Record<string, any> }) {+ return (+ <dl className="divide-y divide-border/30">+ {Object.entries(attrs)+ .sort((a, b) => a[0].localeCompare(b[0]))+ .map(([key, value]) => {+ if (key.startsWith("Operation ")) return null;+ switch (+ key as keyof (TrackedEntityAttributes & TrackedActivityAttributes)+ ) {+ case "Customer":+ return (+ <Row key={key} label="Customer">+ <CustomerAvatar customerId={value} />+ </Row>+ );+ case "Employee":+ return (+ <Row key={key} label="Employee">+ <EmployeeAvatar employeeId={value} />+ </Row>+ );+ case "Inspector":+ return (+ <Row key={key} label="Inspector">+ <EmployeeAvatar employeeId={value} />+ </Row>+ );+ case "Job":+ return <JobAttribute key={key} jobId={value} />;+ case "Job Material":+ return null;+ case "Job Make Method":+ return (+ <JobMakeMethodAttribute+ key={key}+ jobId={attrs.Job}+ makeMethodId={value}+ materialId={attrs["Job Material"]}+ />+ );+ case "Job Operation":+ return (+ <JobOperationAttribute+ key={key}+ jobId={attrs.Job}+ operationId={value}+ />+ );+ case "Purchase Order":+ return (+ <PurchaseOrderAttribute key={key} purchaseOrderId={value} />+ );+ case "Purchase Order Line":+ return null;+ case "Receipt":+ return <ReceiptAttribute key={key} receiptId={value} />;+ case "Receipt Line":+ return null;+ case "Sales Order":+ return <SalesOrderAttribute key={key} salesOrderId={value} />;+ case "Sales Order Line":+ return null;+ case "Shipment":+ return <ShipmentAttribute key={key} shipmentId={value} />;+ case "Shipment Line":+ return null;+ case "Production Event":+ return (+ <JobProductionEvent+ key={key}+ jobId={attrs.Job}+ eventId={value}+ />+ );+ case "Supplier":+ return (+ <Row key={key} label="Supplier">+ <SupplierAvatar supplierId={value} />+ </Row>+ );+ case "Work Center":+ case "WorkCenter" as any:+ return <WorkCenterAttribute key={key} value={value} />;+ case "Consumed Quantity":+ case "Original Quantity":+ case "Remaining Quantity":+ case "Receipt Line Index":+ case "Shipment Line Index":+ default: {+ if (key === "expiryOverrides") return null;+ if (value === null || value === undefined) return null;+ if (typeof value === "object") {+ return (+ <Row key={key} label={key}>+ <span className="text-[11px] font-mono break-all">+ {JSON.stringify(value)}+ </span>+ </Row>+ );+ }+ return (+ <Row key={key} label={key}>+ <span className="text-sm truncate">{String(value)}</span>+ </Row>+ );+ }+ }+ })}+ </dl>+ );+}++function Row({+ label,+ children+}: {+ label: string;+ children: React.ReactNode;+}) {+ return (+ <div className="grid grid-cols-[8rem_1fr] items-center gap-3 py-1.5 first:pt-0 last:pb-0">+ <dt className="text-xs text-muted-foreground truncate">{label}</dt>+ <dd className="text-right min-w-0 truncate text-sm">{children}</dd>+ </div>+ );+}++function JobAttribute({ jobId }: { jobId: string }) {+ const [job, setJob] = useState<string | null>(null);+ const { carbon } = useCarbon();++ const getJob = async () => {+ const response = await carbon+ ?.from("job")+ .select("jobId")+ .eq("id", jobId)+ .single();+ setJob(response?.data?.jobId ?? null);+ };++ useMount(() => {+ getJob();+ });++ return (+ <Row label="Job">+ <InlineLink to={path.to.jobDetails(jobId)}>{job ?? jobId}</InlineLink>+ </Row>+ );+}++function JobProductionEvent({+ jobId,+ eventId+}: {+ jobId: string;+ eventId: string;+}) {+ return (+ <Row label="Production Event">+ {jobId && eventId ? (+ <InlineLink to={path.to.jobProductionEvent(jobId, eventId)}>+ {eventId}+ </InlineLink>+ ) : (+ <span className="text-sm text-muted-foreground">{eventId}</span>+ )}+ </Row>+ );+}++function JobOperationAttribute({+ jobId,+ operationId+}: {+ jobId: string;+ operationId: string;+}) {+ return (+ <Row label="Job Operation">+ {jobId && operationId ? (+ <InlineLink+ to={`${path.to.jobProductionEvents(+ jobId+ )}?filter=jobOperationId:eq:${operationId}`}+ >+ {operationId}+ </InlineLink>+ ) : (+ <span className="text-sm text-muted-foreground truncate">+ {operationId}+ </span>+ )}+ </Row>+ );+}++function JobMakeMethodAttribute({+ jobId,+ makeMethodId,+ materialId+}: {+ jobId: string;+ makeMethodId: string;+ materialId: string;+}) {+ return (+ <Row label="Job Make Method">+ <InlineLink+ to={+ materialId+ ? path.to.jobMakeMethod(jobId, makeMethodId)+ : path.to.jobMethod(jobId, makeMethodId)+ }+ >+ {makeMethodId}+ </InlineLink>+ </Row>+ );+}++function PurchaseOrderAttribute({+ purchaseOrderId+}: {+ purchaseOrderId: string;+}) {+ const [poNumber, setPoNumber] = useState<string | null>(null);+ const { carbon } = useCarbon();++ const getPurchaseOrder = async () => {+ const response = await carbon+ ?.from("purchaseOrder")+ .select("purchaseOrderId")+ .eq("id", purchaseOrderId)+ .single();+ setPoNumber(response?.data?.purchaseOrderId ?? null);+ };++ useMount(() => {+ getPurchaseOrder();+ });++ return (+ <Row label="Purchase Order">+ <InlineLink to={path.to.purchaseOrderDetails(purchaseOrderId)}>+ {poNumber ?? purchaseOrderId}+ </InlineLink>+ </Row>+ );+}++function SalesOrderAttribute({ salesOrderId }: { salesOrderId: string }) {+ const [soNumber, setSoNumber] = useState<string | null>(null);+ const { carbon } = useCarbon();++ const getSalesOrder = async () => {+ const response = await carbon+ ?.from("salesOrder")+ .select("salesOrderId")+ .eq("id", salesOrderId)+ .single();+ setSoNumber(response?.data?.salesOrderId ?? null);+ };++ useMount(() => {+ getSalesOrder();+ });++ return (+ <Row label="Sales Order">+ <InlineLink to={path.to.salesOrderDetails(salesOrderId)}>+ {soNumber ?? salesOrderId}+ </InlineLink>+ </Row>+ );+}++function ReceiptAttribute({ receiptId }: { receiptId: string }) {+ const [receiptNumber, setReceiptNumber] = useState<string | null>(null);+ const { carbon } = useCarbon();++ const getReceipt = async () => {+ const response = await carbon+ ?.from("receipt")+ .select("receiptId")+ .eq("id", receiptId)+ .single();+ setReceiptNumber(response?.data?.receiptId ?? null);+ };++ useMount(() => {+ getReceipt();+ });++ return (+ <Row label="Receipt">+ <InlineLink to={path.to.receiptDetails(receiptId)}>+ {receiptNumber ?? receiptId}+ </InlineLink>+ </Row>+ );+}++function ShipmentAttribute({ shipmentId }: { shipmentId: string }) {+ const [shipmentNumber, setShipmentNumber] = useState<string | null>(null);+ const { carbon } = useCarbon();++ const getShipment = async () => {+ const response = await carbon+ ?.from("shipment")+ .select("shipmentId")+ .eq("id", shipmentId)+ .single();+ setShipmentNumber(response?.data?.shipmentId ?? null);+ };++ useMount(() => {+ getShipment();+ });++ return (+ <Row label="Shipment">+ <InlineLink to={path.to.shipmentDetails(shipmentId)}>+ {shipmentNumber ?? shipmentId}+ </InlineLink>+ </Row>+ );+}++function WorkCenterAttribute({ value }: { value: string }) {+ const workCenters = useWorkCenters({});+ const workCenter = workCenters.options.find((wc) => wc.value === value);+ return (+ <Row label="Work Center">+ <span className="text-sm truncate">{workCenter?.label ?? value}</span>+ </Row>+ );+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/constants.ts b/apps/erp/app/modules/inventory/ui/Traceability/constants.tsnew file mode 100644index 0000000000..79ace61c1b--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/constants.ts@@ -0,0 +1,17 @@+export const TRACE_API = {+ expand: "/api/traceability/expand",+ search: "/api/traceability/search"+} as const;++export const DEPTH = { min: 1, max: 5, default: 1 } as const;+export const SPACING = { min: 1, max: 5, default: 2 } as const;+export const NODE_SIZE = 44;+export const NODE_RADIUS = NODE_SIZE / 2;++export function clampDepth(n: number): number {+ return Math.min(Math.max(DEPTH.min, n), DEPTH.max);+}++export function clampSpacing(n: number): number {+ return Math.min(Math.max(SPACING.min, n), SPACING.max);+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/edges/QuantityEdge.tsx b/apps/erp/app/modules/inventory/ui/Traceability/edges/QuantityEdge.tsxnew file mode 100644index 0000000000..e0127cb96d--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/edges/QuantityEdge.tsx@@ -0,0 +1,100 @@+import {+ BaseEdge,+ EdgeLabelRenderer,+ type EdgeProps,+ getSimpleBezierPath+} from "@xyflow/react";+import { memo } from "react";+import type { LineageEdgeData } from "../utils";++type Props = EdgeProps & {+ data?: LineageEdgeData & {+ weight?: number;+ isReject?: boolean;+ isBackEdge?: boolean;+ highlighted?: boolean;+ points?: { x: number; y: number }[];+ };+};++function QuantityEdgeImpl({+ id,+ sourceX,+ sourceY,+ targetX,+ targetY,+ sourcePosition,+ targetPosition,+ data+}: Props) {+ const [edgePath, labelX, labelY] = getSimpleBezierPath({+ sourceX,+ sourceY,+ sourcePosition,+ targetX,+ targetY,+ targetPosition+ });++ const isReject = !!data?.isReject;+ const isBackEdge = !!data?.isBackEdge;+ const dimmed = !!data?.dimmed;+ const highlighted = !!data?.highlighted;+ const strokeWidth = highlighted ? 2.5 : isReject ? 1.5 : 1;+ const stroke = highlighted+ ? "hsl(0 0% 92%)"+ : isReject+ ? "hsl(0 72% 55%)"+ : "hsl(0 0% 45%)";+ const baseOpacity = highlighted+ ? 1+ : isReject+ ? 0.85+ : isBackEdge+ ? 0.2+ : 0.4;++ return (+ <>+ <BaseEdge+ id={id}+ path={edgePath}+ className="trace-edge-path"+ style={{+ stroke,+ strokeWidth,+ opacity: dimmed ? 0.08 : baseOpacity,+ strokeDasharray: isBackEdge ? "8 4" : undefined,+ fill: "none"+ }}+ />+ {!dimmed && data?.quantity != null && (+ <EdgeLabelRenderer>+ <div+ style={{+ position: "absolute",+ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)`,+ pointerEvents: "none",+ minWidth: 22,+ textAlign: "center",+ zIndex: 1000+ }}+ className={`text-[11px] font-medium tabular-nums leading-none px-2 py-1 rounded-full border-2 ${+ isReject+ ? "bg-background text-[hsl(0_72%_55%)] border-[hsl(0_72%_55%)]"+ : highlighted+ ? "bg-foreground text-background border-foreground"+ : isBackEdge+ ? "bg-background text-muted-foreground/60 border-border/40"+ : "bg-background text-foreground border-border"+ }`}+ >+ {data.quantity}+ </div>+ </EdgeLabelRenderer>+ )}+ </>+ );+}++export const QuantityEdge = memo(QuantityEdgeImpl);diff --git a/apps/erp/app/modules/inventory/ui/Traceability/hooks/useExpandNode.ts b/apps/erp/app/modules/inventory/ui/Traceability/hooks/useExpandNode.tsnew file mode 100644index 0000000000..f1a19a09e8--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/hooks/useExpandNode.ts@@ -0,0 +1,34 @@+import { useCallback, useEffect, useRef } from "react";+import { useFetcher } from "react-router";+import type { LineagePayload } from "../utils";++type ExpandDirection = "up" | "down" | "both";++export function useExpandNode(+ onResult: (payload: LineagePayload, originId: string) => void+) {+ const fetcher = useFetcher<LineagePayload>();+ const pendingOriginRef = useRef<string | null>(null);++ useEffect(() => {+ if (fetcher.state === "idle" && fetcher.data && pendingOriginRef.current) {+ onResult(fetcher.data, pendingOriginRef.current);+ pendingOriginRef.current = null;+ }+ }, [fetcher.state, fetcher.data, onResult]);++ const expand = useCallback(+ (entityId: string, direction: ExpandDirection = "both", depth = 1) => {+ pendingOriginRef.current = entityId;+ const params = new URLSearchParams({+ trackedEntityId: entityId,+ direction,+ depth: String(depth)+ });+ fetcher.load(`/api/traceability/expand?${params.toString()}`);+ },+ [fetcher]+ );++ return { expand, isLoading: fetcher.state !== "idle" };+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/hooks/useProbeBoundary.ts b/apps/erp/app/modules/inventory/ui/Traceability/hooks/useProbeBoundary.tsnew file mode 100644index 0000000000..ebd60f223f--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/hooks/useProbeBoundary.ts@@ -0,0 +1,74 @@+import { type MutableRefObject, useEffect } from "react";+import { TRACE_API } from "../constants";+import type { LineagePayload } from "../utils";++type Boundary = { incoming: Set<string>; outgoing: Set<string> };++type Args = {+ payload: LineagePayload;+ boundaryByNode: Boundary;+ markExpandable: (id: string) => void;+ markExhausted: (id: string) => void;+ probeCacheRef: MutableRefObject<Map<string, LineagePayload>>;+ probedRef: MutableRefObject<Set<string>>;+};++export function useProbeBoundary({+ payload,+ boundaryByNode,+ markExpandable,+ markExhausted,+ probeCacheRef,+ probedRef+}: Args) {+ useEffect(() => {+ let cancelled = false;+ const candidates = payload.entities.filter((e) => {+ if (probedRef.current.has(e.id)) return false;+ const hasIn = boundaryByNode.incoming.has(e.id);+ const hasOut = boundaryByNode.outgoing.has(e.id);+ return !hasIn || !hasOut;+ });+ if (candidates.length === 0) return;++ const knownEntityIds = new Set(payload.entities.map((e) => e.id));+ const knownActivityIds = new Set(payload.activities.map((a) => a.id));++ for (const ent of candidates) {+ probedRef.current.add(ent.id);+ const params = new URLSearchParams({+ trackedEntityId: ent.id,+ direction: "both",+ depth: "1"+ });+ fetch(`${TRACE_API.expand}?${params.toString()}`)+ .then((r) => r.json() as Promise<LineagePayload>)+ .then((res) => {+ if (cancelled) return;+ const hasNew =+ res.entities.some((e) => !knownEntityIds.has(e.id)) ||+ res.activities.some((a) => !knownActivityIds.has(a.id));+ if (hasNew) {+ probeCacheRef.current.set(ent.id, res);+ markExpandable(ent.id);+ } else {+ markExhausted(ent.id);+ }+ })+ .catch(() => {+ // probe fail = silently leave indicator off+ });+ }++ return () => {+ cancelled = true;+ };+ }, [+ payload,+ boundaryByNode,+ markExpandable,+ markExhausted,+ probeCacheRef,+ probedRef+ ]);+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/metadata.ts b/apps/erp/app/modules/inventory/ui/Traceability/metadata.tsnew file mode 100644index 0000000000..13e199c23d--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/metadata.ts@@ -0,0 +1,110 @@+import type { IconType } from "react-icons";+import {+ LuClipboardCheck,+ LuFactory,+ LuForklift,+ LuPackage,+ LuPackageCheck,+ LuPackageMinus,+ LuPackageOpen,+ LuPackagePlus,+ LuPackageX,+ LuPause,+ LuRotateCw,+ LuTruck,+ LuWrench+} from "react-icons/lu";++export type EntityStatus =+ | "Available"+ | "Reserved"+ | "On Hold"+ | "Rejected"+ | "Consumed";++export type EntityStatusMeta = {+ color: string;+ icon: IconType;+ label: string;+};++export const ENTITY_STATUS_META: Record<EntityStatus, EntityStatusMeta> = {+ Available: {+ color: "hsl(142 71% 45%)",+ icon: LuPackageCheck,+ label: "Available"+ },+ Reserved: {+ color: "hsl(220 9% 46%)",+ icon: LuPackageOpen,+ label: "Reserved"+ },+ "On Hold": { color: "hsl(25 95% 53%)", icon: LuPause, label: "On Hold" },+ Rejected: { color: "hsl(0 84% 60%)", icon: LuPackageX, label: "Rejected" },+ Consumed: {+ color: "hsl(217 91% 60%)",+ icon: LuPackageMinus,+ label: "Consumed"+ }+};++export const DEFAULT_ENTITY_STATUS: EntityStatus = "Consumed";++export function entityStatusMeta(+ status: string | null | undefined+): EntityStatusMeta {+ return (+ ENTITY_STATUS_META[(status ?? DEFAULT_ENTITY_STATUS) as EntityStatus] ??+ ENTITY_STATUS_META[DEFAULT_ENTITY_STATUS]+ );+}++export type ActivityKind =+ | "Receipt"+ | "Manufacturing"+ | "Assembly"+ | "Shipment"+ | "Transfer"+ | "Rework"+ | "Inspection"+ | "Other";++export type ActivityKindMeta = {+ label: string;+ color: string;+ icon: IconType;+};++export const ACTIVITY_KIND_META: Record<ActivityKind, ActivityKindMeta> = {+ Receipt: { label: "Receipt", color: "hsl(173 80% 40%)", icon: LuPackagePlus },+ Manufacturing: {+ label: "Manufacturing",+ color: "hsl(280 65% 60%)",+ icon: LuFactory+ },+ Assembly: { label: "Assembly", color: "hsl(265 70% 65%)", icon: LuWrench },+ Shipment: { label: "Shipment", color: "hsl(20 90% 55%)", icon: LuTruck },+ Transfer: { label: "Transfer", color: "hsl(200 80% 55%)", icon: LuForklift },+ Rework: { label: "Rework", color: "hsl(45 95% 55%)", icon: LuRotateCw },+ Inspection: {+ label: "Inspection",+ color: "hsl(330 70% 60%)",+ icon: LuClipboardCheck+ },+ Other: { label: "Other", color: "hsl(280 65% 60%)", icon: LuPackage }+};++export function activityKindFor(type: string | undefined | null): ActivityKind {+ if (!type) return "Other";+ const t = type.toLowerCase();+ if (t.includes("receipt") || t.includes("receive")) return "Receipt";+ if (t.includes("ship")) return "Shipment";+ if (t.includes("transfer")) return "Transfer";+ if (t.includes("rework")) return "Rework";+ if (t.includes("inspect") || t.includes("qc") || t.includes("quality"))+ return "Inspection";+ if (t.includes("assembly") || t.includes("assemble")) return "Assembly";+ if (t.includes("manufactur") || t.includes("mfg") || t.includes("production"))+ return "Manufacturing";+ return "Other";+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/nodes/ActivityNode.tsx b/apps/erp/app/modules/inventory/ui/Traceability/nodes/ActivityNode.tsxnew file mode 100644index 0000000000..80557fac2a--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/nodes/ActivityNode.tsx@@ -0,0 +1,103 @@+import { cn } from "@carbon/react";+import { Handle, type NodeProps, Position, useStore } from "@xyflow/react";+import { memo } from "react";+import { NODE_RADIUS, NODE_SIZE } from "../constants";+import { ACTIVITY_KIND_META, activityKindFor } from "../metadata";+import type { ActivityNodeData } from "../utils";++type Props = NodeProps & {+ data: ActivityNodeData & {+ selected?: boolean;+ isRoot?: boolean;+ };+};++function ActivityNodeImpl({ data, selected }: Props) {+ const activity = data.activity;+ const kind = activityKindFor(activity.type);+ const meta = ACTIVITY_KIND_META[kind];+ const Icon = meta.icon;+ const label = activity.type ?? meta.label;++ const zoomedIn = useStore((s) => s.transform[2] > 0.5);+ const showLabel = zoomedIn || data.isRoot || selected;++ const half = NODE_RADIUS;+ const size = NODE_SIZE;+ const iconSize = 18;++ return (+ <div+ className={cn("relative", data.dimmed && "opacity-15")}+ style={{ width: size, height: size, zIndex: 10 }}+ >+ <Handle+ type="target"+ position={Position.Top}+ className="!opacity-0 !pointer-events-none !top-1/2 !left-1/2 !-translate-x-1/2 !-translate-y-1/2 !w-1 !h-1 !min-w-0 !min-h-0 !border-0"+ />+ <Handle+ type="source"+ position={Position.Bottom}+ className="!opacity-0 !pointer-events-none !top-1/2 !left-1/2 !-translate-x-1/2 !-translate-y-1/2 !w-1 !h-1 !min-w-0 !min-h-0 !border-0"+ />+ <svg+ width={size}+ height={size}+ className="absolute inset-0 overflow-visible"+ aria-hidden+ >+ {(selected || data.isRoot) && (+ <rect+ x={-7}+ y={-7}+ width={size + 14}+ height={size + 14}+ rx={8}+ fill={meta.color}+ opacity={0.2}+ transform={`rotate(45 ${half} ${half})`}+ />+ )}+ <rect+ x={0}+ y={0}+ width={size}+ height={size}+ rx={5}+ fill={meta.color}+ stroke={+ selected || data.isRoot ? "hsl(var(--foreground))" : "transparent"+ }+ strokeWidth={selected || data.isRoot ? 2 : 0}+ transform={`rotate(45 ${half} ${half})`}+ />+ </svg>+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none text-white drop-shadow-sm">+ <Icon style={{ width: iconSize, height: iconSize }} />+ </div>+ {showLabel && (+ <div+ className={cn(+ "absolute left-1/2 -translate-x-1/2 whitespace-nowrap pointer-events-none select-none",+ data.isRoot || selected+ ? "text-foreground"+ : "text-muted-foreground"+ )}+ style={{ top: size + 8 }}+ >+ <span+ className={cn(+ "text-[11px] tracking-tight px-1.5 py-px rounded bg-background",+ (data.isRoot || selected) && "font-medium"+ )}+ >+ {label}+ </span>+ </div>+ )}+ </div>+ );+}++export const ActivityNode = memo(ActivityNodeImpl);diff --git a/apps/erp/app/modules/inventory/ui/Traceability/nodes/EntityNode.tsx b/apps/erp/app/modules/inventory/ui/Traceability/nodes/EntityNode.tsxnew file mode 100644index 0000000000..f8553bd337--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/nodes/EntityNode.tsx@@ -0,0 +1,196 @@+import { cn } from "@carbon/react";+import { Handle, type NodeProps, Position, useStore } from "@xyflow/react";+import { memo } from "react";+import { LuChevronDown, LuChevronUp, LuMinus } from "react-icons/lu";+import { NODE_RADIUS, NODE_SIZE } from "../constants";+import { entityStatusMeta } from "../metadata";+import { type EntityNodeData, entityHeadline } from "../utils";++type Props = NodeProps & {+ data: EntityNodeData & {+ selected?: boolean;+ isRoot?: boolean;+ isExpanded?: boolean;+ canExpandUp?: boolean;+ canExpandDown?: boolean;+ containmentStatus?: "Contained" | "Uncontained";+ onExpand?: (id: string, direction: "up" | "down" | "both") => void;+ onCollapse?: (id: string) => void;+ };+};++function EntityNodeImpl({ data, selected, id }: Props) {+ const entity = data.entity;+ const headline = entityHeadline(entity, 8);++ const zoomedIn = useStore((s) => s.transform[2] > 0.5);+ const showLabel = zoomedIn || data.isRoot || selected;++ const meta = entityStatusMeta(entity.status);+ const Icon = meta.icon;+ const isRejected = entity.status === "Rejected";+ const containmentStatus = data.containmentStatus;+ const radius = NODE_RADIUS;+ const size = NODE_SIZE;+ const iconSize = 18;++ return (+ <div+ className={cn("relative", data.dimmed && "opacity-15")}+ style={{ width: size, height: size, zIndex: 10 }}+ >+ <Handle+ type="target"+ position={Position.Top}+ className="!opacity-0 !pointer-events-none !top-1/2 !left-1/2 !-translate-x-1/2 !-translate-y-1/2 !w-1 !h-1 !min-w-0 !min-h-0 !border-0"+ />+ <Handle+ type="source"+ position={Position.Bottom}+ className="!opacity-0 !pointer-events-none !top-1/2 !left-1/2 !-translate-x-1/2 !-translate-y-1/2 !w-1 !h-1 !min-w-0 !min-h-0 !border-0"+ />+ <svg+ width={size}+ height={size}+ className="absolute inset-0 overflow-visible"+ aria-hidden+ >+ {(selected || data.isRoot) && (+ <circle+ cx={radius}+ cy={radius}+ r={radius + 6}+ fill={meta.color}+ opacity={0.2}+ />+ )}+ {isRejected && (+ <circle+ cx={radius}+ cy={radius}+ r={radius + 3}+ fill="none"+ stroke="hsl(0 84% 60%)"+ strokeWidth={1.5}+ strokeDasharray="3 3"+ />+ )}+ {!isRejected && containmentStatus && (+ <circle+ cx={radius}+ cy={radius}+ r={radius + 3}+ fill="none"+ stroke={+ containmentStatus === "Uncontained"+ ? "hsl(0 84% 60%)"+ : "hsl(38 95% 53%)"+ }+ strokeWidth={1.5}+ strokeDasharray="3 3"+ />+ )}+ <circle+ cx={radius}+ cy={radius}+ r={radius}+ fill={meta.color}+ stroke={+ selected || data.isRoot ? "hsl(var(--foreground))" : "transparent"+ }+ strokeWidth={selected || data.isRoot ? 2 : 0}+ />+ </svg>+ <div className="absolute inset-0 flex items-center justify-center pointer-events-none text-white drop-shadow-sm">+ <Icon style={{ width: iconSize, height: iconSize }} />+ </div>+ <div+ className="absolute -top-1 -right-1 rounded-full bg-card border border-border text-[9px] tabular-nums px-1 leading-tight pointer-events-none"+ title={`Quantity ${entity.quantity}`}+ >+ {formatQuantity(entity.quantity)}+ </div>+ {data.isExpanded ? (+ <NodeExpandToggle+ kind="collapse"+ onClick={() => data.onCollapse?.(id)}+ />+ ) : (+ <>+ {data.canExpandUp && (+ <NodeExpandToggle+ kind="up"+ onClick={() => data.onExpand?.(id, "up")}+ />+ )}+ {data.canExpandDown && (+ <NodeExpandToggle+ kind="down"+ onClick={() => data.onExpand?.(id, "down")}+ />+ )}+ </>+ )}+ {showLabel && (+ <div+ className={cn(+ "absolute left-1/2 -translate-x-1/2 whitespace-nowrap pointer-events-none select-none flex flex-col items-center",+ data.isRoot || selected+ ? "text-foreground"+ : "text-muted-foreground"+ )}+ style={{ top: size + 4 }}+ >+ <span+ className={cn(+ "text-[11px] tracking-tight px-1.5 py-px rounded bg-background",+ (data.isRoot || selected) && "font-medium"+ )}+ >+ {headline}+ </span>+ </div>+ )}+ </div>+ );+}++function formatQuantity(q: number): string {+ if (q >= 1000) return `${(q / 1000).toFixed(1)}k`;+ if (Number.isInteger(q)) return String(q);+ return q.toFixed(1);+}++const TOGGLE_META = {+ collapse: { icon: LuMinus, title: "Collapse", anchor: "top" },+ up: { icon: LuChevronUp, title: "Expand upstream", anchor: "top" },+ down: { icon: LuChevronDown, title: "Expand downstream", anchor: "bottom" }+} as const;++function NodeExpandToggle({+ kind,+ onClick+}: {+ kind: keyof typeof TOGGLE_META;+ onClick: () => void;+}) {+ const { icon: Icon, title, anchor } = TOGGLE_META[kind];+ return (+ <button+ type="button"+ className={cn(+ "nodrag absolute left-1/2 -translate-x-1/2 w-[18px] h-[18px] rounded-full bg-card border border-border text-muted-foreground hover:text-foreground hover:border-foreground/40 flex items-center justify-center ring-1 ring-background shadow-sm z-20 transition-colors",+ anchor === "top" ? "-top-2" : "-bottom-2"+ )}+ title={title}+ onClick={(e) => {+ e.stopPropagation();+ onClick();+ }}+ >+ <Icon className="w-3 h-3" strokeWidth={2.5} />+ </button>+ );+}++export const EntityNode = memo(EntityNodeImpl);diff --git a/apps/erp/app/modules/inventory/ui/Traceability/store.ts b/apps/erp/app/modules/inventory/ui/Traceability/store.tsnew file mode 100644index 0000000000..6808af1993--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/store.ts@@ -0,0 +1,156 @@+import { create } from "zustand";+import { createJSONStorage, persist } from "zustand/middleware";+import { clampSpacing, SPACING } from "./constants";+import type { LineagePayload } from "./utils";++export type LayoutDirection = "TB" | "LR";+export type ViewMode = "graph" | "table";++type TraceabilityState = {+ rootId: string | null;+ selectedIds: string[];+ focusedIndex: number;+ isolate: boolean;+ expansions: Map<string, LineagePayload>;+ expandable: Set<string>;+ exhausted: Set<string>;+ excludedIds: Set<string>;++ // persisted preferences+ direction: LayoutDirection;+ view: ViewMode;+ spacing: number;++ // actions+ reset: (rootId: string) => void;+ setSelectedIds: (ids: string[]) => void;+ setSelectedSingle: (id: string | null) => void;+ toggleSelected: (id: string) => void;+ setFocusedIndex: (i: number) => void;+ setIsolate: (next: boolean) => void;+ addExpansion: (originId: string, payload: LineagePayload) => void;+ removeExpansion: (originId: string) => void;+ resetExpansions: () => void;+ markExpandable: (id: string) => void;+ markExhausted: (id: string) => void;+ toggleExcluded: (id: string) => void;+ clearExcluded: () => void;+ setDirection: (next: LayoutDirection) => void;+ setView: (next: ViewMode) => void;+ setSpacing: (next: number) => void;+};++export const useTraceabilityStore = create<TraceabilityState>()(+ persist(+ (set) => ({+ rootId: null,+ selectedIds: [],+ focusedIndex: 0,+ isolate: false,+ expansions: new Map(),+ expandable: new Set(),+ exhausted: new Set(),+ excludedIds: new Set(),+ direction: "TB",+ view: "graph",+ spacing: SPACING.default,++ reset: (rootId) =>+ set({+ rootId,+ selectedIds: [],+ focusedIndex: 0,+ isolate: false,+ expansions: new Map(),+ expandable: new Set(),+ exhausted: new Set(),+ excludedIds: new Set()+ }),++ setSelectedIds: (ids) =>+ set((s) => ({+ selectedIds: ids,+ focusedIndex:+ ids.length === 0 ? 0 : Math.min(s.focusedIndex, ids.length - 1)+ })),++ setSelectedSingle: (id) =>+ set({+ selectedIds: id ? [id] : [],+ focusedIndex: 0+ }),++ toggleSelected: (id) =>+ set((s) => {+ const next = s.selectedIds.includes(id)+ ? s.selectedIds.filter((x) => x !== id)+ : [...s.selectedIds, id];+ return {+ selectedIds: next,+ focusedIndex:+ next.length === 0 ? 0 : Math.min(s.focusedIndex, next.length - 1)+ };+ }),++ setFocusedIndex: (i) => set({ focusedIndex: i }),++ setIsolate: (next) => set({ isolate: next }),++ addExpansion: (originId, payload) =>+ set((s) => {+ const next = new Map(s.expansions);+ next.set(originId, payload);+ return { expansions: next };+ }),++ removeExpansion: (originId) =>+ set((s) => {+ if (!s.expansions.has(originId)) return {};+ const next = new Map(s.expansions);+ next.delete(originId);+ return { expansions: next };+ }),++ resetExpansions: () => set({ expansions: new Map() }),++ markExpandable: (id) =>+ set((s) => {+ if (s.expandable.has(id)) return {};+ const next = new Set(s.expandable);+ next.add(id);+ return { expandable: next };+ }),++ markExhausted: (id) =>+ set((s) => {+ if (s.exhausted.has(id)) return {};+ const next = new Set(s.exhausted);+ next.add(id);+ return { exhausted: next };+ }),++ toggleExcluded: (id) =>+ set((s) => {+ const next = new Set(s.excludedIds);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ return { excludedIds: next };+ }),++ clearExcluded: () => set({ excludedIds: new Set() }),++ setDirection: (next) => set({ direction: next }),+ setView: (next) => set({ view: next }),+ setSpacing: (next) => set({ spacing: clampSpacing(next) })+ }),+ {+ name: "traceability:prefs:v1",+ storage: createJSONStorage(() => localStorage),+ partialize: (s) => ({+ direction: s.direction,+ view: s.view,+ spacing: s.spacing+ })+ }+ )+);diff --git a/apps/erp/app/modules/inventory/ui/Traceability/utils.ts b/apps/erp/app/modules/inventory/ui/Traceability/utils.tsnew file mode 100644index 0000000000..7b98ccb833--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/utils.ts@@ -0,0 +1,383 @@+import type { Edge, Node } from "@xyflow/react";+import type {+ Activity,+ ActivityInput,+ ActivityOutput,+ TrackedEntity+} from "~/modules/inventory";+import { NODE_SIZE } from "./constants";++export type EntityNodeData = {+ kind: "entity";+ entity: TrackedEntity;+ dimmed: boolean;+};++export type ActivityNodeData = {+ kind: "activity";+ activity: Activity;+ dimmed: boolean;+};++export type LineageNode = Node<EntityNodeData | ActivityNodeData>;++export type LineageEdgeData = {+ kind: "input" | "output";+ quantity: number;+ dimmed: boolean;+ weight?: number;+ isReject?: boolean;+ isBackEdge?: boolean;+ points?: { x: number; y: number }[];+};++export type LineageEdge = Edge<LineageEdgeData>;++export type StepRecord = {+ id: string;+ jobOperationStepId: string;+ index: number;+ type: string;+ name: string;+ value: string | null;+ numericValue: number | null;+ booleanValue: boolean | null;+ userValue: string | null;+ unitOfMeasureCode: string | null;+ minValue: number | null;+ maxValue: number | null;+ operationId: string;+ operationDescription: string | null;+ itemId: string | null;+ itemReadableId: string | null;+ createdAt: string;+ createdBy: string | null;+};++export type IssueContainmentStatus = "Contained" | "Uncontained";++export type IssueContainment = {+ id: string;+ readableId: string | null;+ containmentStatus: IssueContainmentStatus;+ status: string;+ priority: string | null;+ trackedEntityId: string;+};++export type LineagePayload = {+ entities: TrackedEntity[];+ activities: Activity[];+ inputs: ActivityInput[];+ outputs: ActivityOutput[];+ stepRecords?: StepRecord[];+ containments?: IssueContainment[];+};++export function payloadToFlow(+ payload: LineagePayload,+ positions: Map<string, { x: number; y: number }> = new Map()+): { nodes: LineageNode[]; edges: LineageEdge[] } {+ const seenNodeIds = new Set<string>();++ const entityNodes: LineageNode[] = payload.entities+ .filter((e) => {+ if (!e?.id || seenNodeIds.has(e.id)) return false;+ seenNodeIds.add(e.id);+ return true;+ })+ .map((entity) => ({+ id: entity.id,+ type: "entity",+ position: positions.get(entity.id) ?? { x: 0, y: 0 },+ width: NODE_SIZE,+ height: NODE_SIZE,+ measured: { width: NODE_SIZE, height: NODE_SIZE },+ data: { kind: "entity", entity, dimmed: false }+ }));++ const activityNodes: LineageNode[] = payload.activities+ .filter((a) => {+ if (!a?.id || seenNodeIds.has(a.id)) return false;+ seenNodeIds.add(a.id);+ return true;+ })+ .map((activity) => ({+ id: activity.id,+ type: "activity",+ position: positions.get(activity.id) ?? { x: 0, y: 0 },+ width: NODE_SIZE,+ height: NODE_SIZE,+ measured: { width: NODE_SIZE, height: NODE_SIZE },+ data: { kind: "activity", activity, dimmed: false }+ }));++ const seenEdgeIds = new Set<string>();+ const edges: LineageEdge[] = [];++ for (const input of payload.inputs) {+ const id = `in:${input.trackedActivityId}:${input.trackedEntityId}`;+ if (seenEdgeIds.has(id)) continue;+ seenEdgeIds.add(id);+ edges.push({+ id,+ type: "quantity",+ source: input.trackedEntityId,+ target: input.trackedActivityId,+ data: { kind: "input", quantity: input.quantity, dimmed: false }+ });+ }++ for (const output of payload.outputs) {+ const id = `out:${output.trackedActivityId}:${output.trackedEntityId}`;+ if (seenEdgeIds.has(id)) continue;+ seenEdgeIds.add(id);+ edges.push({+ id,+ type: "quantity",+ source: output.trackedActivityId,+ target: output.trackedEntityId,+ data: { kind: "output", quantity: output.quantity, dimmed: false }+ });+ }++ return { nodes: [...entityNodes, ...activityNodes], edges };+}++export function mergePayloads(+ base: LineagePayload,+ incoming: LineagePayload+): LineagePayload {+ const entityIds = new Set(base.entities.map((e) => e.id));+ const activityIds = new Set(base.activities.map((a) => a.id));+ const inputKeys = new Set(+ base.inputs.map((i) => `${i.trackedActivityId}:${i.trackedEntityId}`)+ );+ const outputKeys = new Set(+ base.outputs.map((o) => `${o.trackedActivityId}:${o.trackedEntityId}`)+ );+ const baseSteps = base.stepRecords ?? [];+ const baseContainments = base.containments ?? [];+ const incomingSteps = incoming.stepRecords ?? [];+ const incomingContainments = incoming.containments ?? [];+ const stepIds = new Set(baseSteps.map((s) => s.id));+ const containmentKeys = new Set(+ baseContainments.map((c) => `${c.id}:${c.trackedEntityId}`)+ );++ return {+ entities: [+ ...base.entities,+ ...incoming.entities.filter((e) => !entityIds.has(e.id))+ ],+ activities: [+ ...base.activities,+ ...incoming.activities.filter((a) => !activityIds.has(a.id))+ ],+ inputs: [+ ...base.inputs,+ ...incoming.inputs.filter(+ (i) => !inputKeys.has(`${i.trackedActivityId}:${i.trackedEntityId}`)+ )+ ],+ outputs: [+ ...base.outputs,+ ...incoming.outputs.filter(+ (o) => !outputKeys.has(`${o.trackedActivityId}:${o.trackedEntityId}`)+ )+ ],+ stepRecords:+ incomingSteps.length === 0 && baseSteps.length === 0+ ? undefined+ : [...baseSteps, ...incomingSteps.filter((s) => !stepIds.has(s.id))],+ containments:+ incomingContainments.length === 0 && baseContainments.length === 0+ ? undefined+ : [+ ...baseContainments,+ ...incomingContainments.filter(+ (c) => !containmentKeys.has(`${c.id}:${c.trackedEntityId}`)+ )+ ]+ };+}++export function lineagePathEdges(+ rootId: string,+ edges: LineageEdge[]+): { edgeIds: Set<string>; nodeIds: Set<string> } {+ const outgoing = new Map<string, LineageEdge[]>();+ for (const e of edges) {+ if (!outgoing.has(e.source)) outgoing.set(e.source, []);+ outgoing.get(e.source)!.push(e);+ }++ const edgeIds = new Set<string>();+ const nodeIds = new Set<string>([rootId]);++ const stack = [rootId];+ const visited = new Set<string>([rootId]);+ while (stack.length) {+ const cur = stack.pop()!;+ for (const e of outgoing.get(cur) ?? []) {+ edgeIds.add(e.id);+ nodeIds.add(e.target);+ if (!visited.has(e.target)) {+ visited.add(e.target);+ stack.push(e.target);+ }+ }+ }++ return { edgeIds, nodeIds };+}++export function lineagePathEdgesMulti(+ rootIds: string[],+ edges: LineageEdge[],+ excludedIds: Set<string> = new Set()+): { edgeIds: Set<string>; nodeIds: Set<string> } {+ const filteredEdges = excludedIds.size+ ? edges.filter(+ (e) => !excludedIds.has(e.source) && !excludedIds.has(e.target)+ )+ : edges;+ const edgeIds = new Set<string>();+ const nodeIds = new Set<string>();+ const rootSet = new Set(rootIds.filter((id) => !excludedIds.has(id)));+ for (const id of rootSet) {+ const r = lineagePathEdges(id, filteredEdges);+ for (const e of r.edgeIds) edgeIds.add(e);+ for (const n of r.nodeIds) nodeIds.add(n);+ }+ for (const e of filteredEdges) {+ if (rootSet.has(e.source) && rootSet.has(e.target)) {+ edgeIds.add(e.id);+ nodeIds.add(e.source);+ nodeIds.add(e.target);+ }+ }+ return { edgeIds, nodeIds };+}++export function lineageReachableMulti(+ rootIds: string[],+ edges: LineageEdge[]+): Set<string> {+ const result = new Set<string>();+ for (const id of rootIds) {+ for (const r of lineageReachable(id, edges)) result.add(r);+ }+ return result;+}++export function lineageReachable(+ rootId: string,+ edges: LineageEdge[]+): Set<string> {+ const incoming = new Map<string, string[]>();+ const outgoing = new Map<string, string[]>();+ for (const e of edges) {+ if (!outgoing.has(e.source)) outgoing.set(e.source, []);+ if (!incoming.has(e.target)) incoming.set(e.target, []);+ outgoing.get(e.source)!.push(e.target);+ incoming.get(e.target)!.push(e.source);+ }+ const result = new Set<string>([rootId]);++ const downStack = [rootId];+ const downVisited = new Set<string>([rootId]);+ while (downStack.length) {+ const cur = downStack.pop()!;+ for (const next of outgoing.get(cur) ?? []) {+ if (!downVisited.has(next)) {+ downVisited.add(next);+ result.add(next);+ downStack.push(next);+ }+ }+ }++ const upStack = [rootId];+ const upVisited = new Set<string>([rootId]);+ while (upStack.length) {+ const cur = upStack.pop()!;+ for (const prev of incoming.get(cur) ?? []) {+ if (!upVisited.has(prev)) {+ upVisited.add(prev);+ result.add(prev);+ upStack.push(prev);+ }+ }+ }++ return result;+}++export function entityHeadline(+ e: Pick<TrackedEntity, "id" | "readableId" | "sourceDocumentReadableId">,+ sliceTo?: number+): string {+ return (+ e.sourceDocumentReadableId ??+ e.readableId ??+ (sliceTo ? e.id.slice(0, sliceTo) : e.id)+ );+}++export function activityHeadline(+ a: Pick<Activity, "id" | "type" | "sourceDocumentReadableId">,+ sliceTo?: number+): string {+ return (+ a.sourceDocumentReadableId ??+ a.type ??+ (sliceTo ? a.id.slice(0, sliceTo) : a.id)+ );+}++export function sourceLinkHref(+ doc: string | null | undefined,+ id: string | null | undefined+): string | null {+ if (!doc || !id) return null;+ switch (doc) {+ case "Job":+ return `/x/job/${id}`;+ case "Receipt":+ return `/x/inventory/receipts/${id}`;+ case "Shipment":+ return `/x/inventory/shipments/${id}`;+ case "Purchase Order":+ return `/x/purchase-order/${id}`;+ case "Sales Order":+ return `/x/sales/orders/${id}`;+ default:+ return null;+ }+}++export function annotateEdgeWeights(+ edges: LineageEdge[],+ rejectIds: Set<string>+): LineageEdge[] {+ const totalsBySource = new Map<string, number>();+ for (const e of edges) {+ const q = e.data?.quantity ?? 0;+ totalsBySource.set(e.source, (totalsBySource.get(e.source) ?? 0) + q);+ }++ return edges.map((e) => {+ const total = totalsBySource.get(e.source) ?? 0;+ const q = e.data?.quantity ?? 0;+ const weight = total > 0 ? q / total : 0.5;+ return {+ ...e,+ data: {+ ...(e.data as LineageEdgeData),+ weight,+ isReject: rejectIds.has(e.target)+ }+ };+ });+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/worker/TracingGraphManager.ts b/apps/erp/app/modules/inventory/ui/Traceability/worker/TracingGraphManager.tsnew file mode 100644index 0000000000..36ae69ec95--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/worker/TracingGraphManager.ts@@ -0,0 +1,62 @@+import * as Comlink from "comlink";+import type { LineageEdge } from "../utils";+import type { LayoutInput, LayoutResult, SelectionPathResult } from "./core";++type WorkerApi = {+ layout: (input: LayoutInput) => LayoutResult;+ selection: (+ edges: LineageEdge[],+ rootIds: string[]+ ) => SelectionPathResult | null;+};++export class TracingGraphManager {+ private worker: Worker | null = null;+ private proxy: Comlink.Remote<WorkerApi> | null = null;+ private layoutSeq = 0;+ private selectionSeq = 0;+ private disposed = false;++ init(): void {+ if (this.worker || this.disposed || typeof Worker === "undefined") return;+ this.worker = new Worker(new URL("./lineage.worker.ts", import.meta.url), {+ type: "module"+ });+ this.proxy = Comlink.wrap<WorkerApi>(this.worker);+ }++ dispose(): void {+ this.disposed = true;+ this.proxy?.[Comlink.releaseProxy]();+ this.worker?.terminate();+ this.worker = null;+ this.proxy = null;+ }++ async layout(input: LayoutInput): Promise<LayoutResult | null> {+ const seq = ++this.layoutSeq;+ if (this.proxy) {+ const result = await this.proxy.layout(input);+ if (this.disposed || seq !== this.layoutSeq) return null;+ return result;+ }+ const { computeFullLayout } = await import("./core");+ if (this.disposed || seq !== this.layoutSeq) return null;+ return computeFullLayout(input);+ }++ async selection(+ edges: LineageEdge[],+ rootIds: string[]+ ): Promise<SelectionPathResult | null> {+ const seq = ++this.selectionSeq;+ if (this.proxy) {+ const result = await this.proxy.selection(edges, rootIds);+ if (this.disposed || seq !== this.selectionSeq) return null;+ return result;+ }+ const { computeSelectionPath } = await import("./core");+ if (this.disposed || seq !== this.selectionSeq) return null;+ return computeSelectionPath(edges, rootIds);+ }+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/worker/core.ts b/apps/erp/app/modules/inventory/ui/Traceability/worker/core.tsnew file mode 100644index 0000000000..d620d5032b--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/worker/core.ts@@ -0,0 +1,188 @@+import dagre from "dagre";+import {+ annotateEdgeWeights,+ type LineageEdge,+ type LineageEdgeData,+ type LineageNode,+ type LineagePayload,+ lineagePathEdgesMulti,+ payloadToFlow+} from "../utils";++export type LayoutDirection = "TB" | "LR";++export type EdgePoint = { x: number; y: number };++export type LayoutInput = {+ payload: LineagePayload;+ direction: LayoutDirection;+ spacing: number;+ rejectIds: string[];+};++export type LayoutResult = {+ nodes: LineageNode[];+ edges: LineageEdge[];+};++export type SelectionPathResult = {+ pathNodeIds: string[];+ pathEdgeIds: string[];+};++const NODE_WIDTH = 44;+const NODE_HEIGHT = 44;++const SPACING_TABLE: Record<+ number,+ { nodesep: number; ranksep: number; edgesep: number }+> = {+ 1: { nodesep: 60, ranksep: 100, edgesep: 30 },+ 2: { nodesep: 100, ranksep: 160, edgesep: 50 },+ 3: { nodesep: 160, ranksep: 240, edgesep: 80 },+ 4: { nodesep: 240, ranksep: 340, edgesep: 130 },+ 5: { nodesep: 360, ranksep: 480, edgesep: 200 }+};++function detectBackEdges(+ nodes: LineageNode[],+ edges: LineageEdge[]+): Set<string> {+ const adj = new Map<string, string[]>();+ for (const e of edges) {+ if (!adj.has(e.source)) adj.set(e.source, []);+ adj.get(e.source)!.push(e.target);+ }++ const visited = new Set<string>();+ const stack = new Set<string>();+ const back = new Set<string>();++ function dfs(id: string, path: string[]) {+ if (stack.has(id)) {+ const cycleStart = path.indexOf(id);+ if (cycleStart !== -1) {+ for (let i = cycleStart; i < path.length - 1; i++) {+ back.add(`${path[i]}->${path[i + 1]}`);+ }+ if (path.length > 0) back.add(`${path[path.length - 1]}->${id}`);+ }+ return;+ }+ if (visited.has(id)) return;+ visited.add(id);+ stack.add(id);+ path.push(id);+ for (const next of adj.get(id) ?? []) dfs(next, path);+ path.pop();+ stack.delete(id);+ }++ for (const n of nodes) if (!visited.has(n.id)) dfs(n.id, []);++ const backEdgeIds = new Set<string>();+ for (const e of edges) {+ if (back.has(`${e.source}->${e.target}`)) backEdgeIds.add(e.id);+ }+ return backEdgeIds;+}++export function computeDagreLayout(+ nodes: LineageNode[],+ edges: LineageEdge[],+ direction: LayoutDirection,+ spacingLevel: number = 2+): {+ positioned: LineageNode[];+ backEdges: Set<string>;+ edgePoints: Map<string, EdgePoint[]>;+} {+ if (nodes.length === 0) {+ return { positioned: nodes, backEdges: new Set(), edgePoints: new Map() };+ }++ const backEdges = detectBackEdges(nodes, edges);++ const g = new dagre.graphlib.Graph({ multigraph: true });+ const clamped = Math.min(Math.max(1, Math.round(spacingLevel)), 5);+ const sp = SPACING_TABLE[clamped];+ g.setGraph({+ rankdir: direction,+ nodesep: sp.nodesep,+ ranksep: sp.ranksep,+ edgesep: sp.edgesep,+ marginx: 40,+ marginy: 40,+ ranker: clamped >= 4 ? "network-simplex" : "tight-tree",+ acyclicer: "greedy"+ });+ g.setDefaultEdgeLabel(() => ({}));++ for (const n of nodes) {+ g.setNode(n.id, { width: NODE_WIDTH, height: NODE_HEIGHT });+ }++ for (const e of edges) {+ if (backEdges.has(e.id)) continue;+ g.setEdge(e.source, e.target, {}, e.id);+ }++ dagre.layout(g);++ const positioned = nodes.map((n) => {+ const p = g.node(n.id);+ if (!p) return n;+ return {+ ...n,+ position: { x: p.x - NODE_WIDTH / 2, y: p.y - NODE_HEIGHT / 2 }+ };+ });++ const edgePoints = new Map<string, EdgePoint[]>();+ for (const e of edges) {+ if (backEdges.has(e.id)) continue;+ const dagreEdge = g.edge({ v: e.source, w: e.target, name: e.id }) as+ | { points?: EdgePoint[] }+ | undefined;+ if (dagreEdge?.points && dagreEdge.points.length >= 2) {+ edgePoints.set(e.id, dagreEdge.points);+ }+ }++ return { positioned, backEdges, edgePoints };+}++export function computeFullLayout(input: LayoutInput): LayoutResult {+ const flow = payloadToFlow(input.payload);+ const weightedEdges = annotateEdgeWeights(+ flow.edges,+ new Set(input.rejectIds)+ );+ const { positioned, backEdges, edgePoints } = computeDagreLayout(+ flow.nodes,+ weightedEdges,+ input.direction,+ input.spacing+ );+ const finalEdges: LineageEdge[] = weightedEdges.map((e) => ({+ ...e,+ data: {+ ...(e.data as LineageEdgeData),+ isBackEdge: backEdges.has(e.id),+ points: edgePoints.get(e.id)+ }+ }));+ return { nodes: positioned, edges: finalEdges };+}++export function computeSelectionPath(+ edges: LineageEdge[],+ rootIds: string[]+): SelectionPathResult | null {+ if (rootIds.length === 0) return null;+ const r = lineagePathEdgesMulti(rootIds, edges);+ return {+ pathNodeIds: Array.from(r.nodeIds),+ pathEdgeIds: Array.from(r.edgeIds)+ };+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/worker/hooks.ts b/apps/erp/app/modules/inventory/ui/Traceability/worker/hooks.tsnew file mode 100644index 0000000000..6bd7d66e74--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/worker/hooks.ts@@ -0,0 +1,78 @@+import { useEffect, useMemo, useRef, useState } from "react";+import type { LineageEdge, LineagePayload } from "../utils";+import type { LayoutDirection, LayoutResult } from "./core";+import { TracingGraphManager } from "./TracingGraphManager";++export function useTracingGraphManager(): TracingGraphManager {+ const ref = useRef<TracingGraphManager | null>(null);+ if (!ref.current) ref.current = new TracingGraphManager();++ useEffect(() => {+ const mgr = ref.current;+ mgr?.init();+ return () => mgr?.dispose();+ }, []);++ return ref.current;+}++export function useAsyncLayout(+ manager: TracingGraphManager,+ payload: LineagePayload,+ direction: LayoutDirection,+ spacing: number,+ rejectIds: Set<string>,+ layoutVersion: number+): LayoutResult | null {+ const [result, setResult] = useState<LayoutResult | null>(null);+ const rejectIdsArray = useMemo(() => Array.from(rejectIds), [rejectIds]);++ // biome-ignore lint/correctness/useExhaustiveDependencies: layoutVersion is a manual relayout trigger+ useEffect(() => {+ let cancelled = false;+ manager+ .layout({ payload, direction, spacing, rejectIds: rejectIdsArray })+ .then((r) => {+ if (cancelled || r === null) return;+ setResult(r);+ });+ return () => {+ cancelled = true;+ };+ }, [manager, payload, direction, spacing, rejectIdsArray, layoutVersion]);++ return result;+}++export type SelectionPath = {+ nodeIds: Set<string>;+ edgeIds: Set<string>;+};++export function useAsyncSelectionPath(+ manager: TracingGraphManager,+ edges: LineageEdge[],+ selectedIds: string[]+): SelectionPath | null {+ const [path, setPath] = useState<SelectionPath | null>(null);++ useEffect(() => {+ if (selectedIds.length === 0) {+ setPath(null);+ return;+ }+ let cancelled = false;+ manager.selection(edges, selectedIds).then((r) => {+ if (cancelled || r === null) return;+ setPath({+ nodeIds: new Set(r.pathNodeIds),+ edgeIds: new Set(r.pathEdgeIds)+ });+ });+ return () => {+ cancelled = true;+ };+ }, [manager, edges, selectedIds]);++ return path;+}diff --git a/apps/erp/app/modules/inventory/ui/Traceability/worker/lineage.worker.ts b/apps/erp/app/modules/inventory/ui/Traceability/worker/lineage.worker.tsnew file mode 100644index 0000000000..927d0fe007--- /dev/null+++ b/apps/erp/app/modules/inventory/ui/Traceability/worker/lineage.worker.ts@@ -0,0 +1,11 @@+import * as Comlink from "comlink";+import { computeFullLayout, computeSelectionPath } from "./core";++const api = {+ layout: computeFullLayout,+ selection: computeSelectionPath+};++export type LineageWorkerApi = typeof api;++Comlink.expose(api);diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.tsindex cec97f0aa6..3cc25126bb 100644--- a/apps/erp/app/modules/production/production.service.ts+++ b/apps/erp/app/modules/production/production.service.ts@@ -1168,7 +1168,7 @@ export async function getJobOperationStepRecords(}query = setGenericQueryFilters(query, args, [- { column: "type", ascending: true }+ { column: "createdAt", ascending: false }]);return query;diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsxindex be9c4c27ff..a4417b3f99 100644--- a/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx@@ -1,5 +1,6 @@import { useLingui } from "@lingui/react/macro";import { LuUserCheck } from "react-icons/lu";+import { SearchLandingPage } from "~/components";import { type ScopeOption, ScopePicker } from "./ScopePicker";type PriceListScopeEmptyProps = {@@ -16,25 +17,20 @@ export function PriceListScopeEmpty({const { t } = useLingui();return (- <div className="flex flex-col items-center justify-center w-full h-full bg-card text-center py-12 px-6">- <div className="w-16 h-16 bg-muted rounded-full flex items-center justify-center mb-4">- <LuUserCheck className="w-8 h-8 text-muted-foreground" />- </div>- <p className="text-sm font-medium text-foreground">- {t`Select a customer or customer type`}- </p>- <p className="text-xs text-muted-foreground mt-1 max-w-[320px]">- {t`Pick a scope to view resolved prices and create price overrides.`}- </p>- <div className="mt-5 w-[260px]">+ <SearchLandingPage+ icon={LuUserCheck}+ heading={t`Price Lists`}+ description={t`Pick a customer or customer type to view their pricing.`}+ >+ <div className="flex justify-center [&>[role=combobox]]:!min-w-[400px]"><ScopePickersize="md"value={value}options={scopeOptions}onChange={onChange}- placeholder={t`Choose scope to continue`}+ placeholder={t`Search customers or types...`}/></div>- </div>+ </SearchLandingPage>);}diff --git a/apps/erp/app/modules/sales/ui/Pricing/ScopePicker.tsx b/apps/erp/app/modules/sales/ui/Pricing/ScopePicker.tsxindex 61a2075ef1..fadbdb985f 100644--- a/apps/erp/app/modules/sales/ui/Pricing/ScopePicker.tsx+++ b/apps/erp/app/modules/sales/ui/Pricing/ScopePicker.tsx@@ -26,7 +26,7 @@ type ScopePickerProps = {value: string;options: ScopeOption[];onChange: (value: string) => void;- size?: "sm" | "md";+ size?: "sm" | "md" | "lg";placeholder?: string;};diff --git a/apps/erp/app/routes/api+/traceability.expand.ts b/apps/erp/app/routes/api+/traceability.expand.tsnew file mode 100644index 0000000000..5cae1bc6b9--- /dev/null+++ b/apps/erp/app/routes/api+/traceability.expand.ts@@ -0,0 +1,39 @@+import { requirePermissions } from "@carbon/auth/auth.server";+import type { LoaderFunctionArgs } from "react-router";+import {+ fetchLineageSubgraph,+ type LineageDirection+} from "~/modules/inventory/lineage.server";++export async function loader({ request }: LoaderFunctionArgs) {+ const { client } = await requirePermissions(request, {+ view: "inventory",+ bypassRls: true+ });++ const url = new URL(request.url);+ const trackedEntityId = url.searchParams.get("trackedEntityId");+ const directionParam = url.searchParams.get("direction") ?? "both";+ const depthParam = url.searchParams.get("depth");++ if (!trackedEntityId) {+ return Response.json(+ { error: "trackedEntityId is required" },+ { status: 400 }+ );+ }++ const direction: LineageDirection =+ directionParam === "up" || directionParam === "down"+ ? directionParam+ : "both";+ const depth = Math.min(Math.max(1, Number(depthParam) || 1), 5);++ const payload = await fetchLineageSubgraph(+ client,+ trackedEntityId,+ depth,+ direction+ );+ return Response.json(payload);+}diff --git a/apps/erp/app/routes/api+/traceability.search.ts b/apps/erp/app/routes/api+/traceability.search.tsnew file mode 100644index 0000000000..6b474b17b0--- /dev/null+++ b/apps/erp/app/routes/api+/traceability.search.ts@@ -0,0 +1,68 @@+import { requirePermissions } from "@carbon/auth/auth.server";+import type { LoaderFunctionArgs } from "react-router";++export async function loader({ request }: LoaderFunctionArgs) {+ const { client, companyId } = await requirePermissions(request, {+ view: "inventory",+ bypassRls: true+ });++ const url = new URL(request.url);+ const q = (url.searchParams.get("q") ?? "").trim();+ const kind = url.searchParams.get("kind") ?? "all";++ // Allow empty query only when a specific kind is selected (browse mode).+ if (q.length < 2 && kind === "all") {+ return Response.json({ entities: [], activities: [] });+ }++ const wantEntities = kind === "all" || kind === "entity";+ const wantActivities = kind === "all" || kind === "activity";++ const escaped = q.replace(/[%_]/g, (m) => `\\${m}`);+ const pattern = q.length >= 2 ? `%${escaped}%` : null;++ const [entities, activities] = await Promise.all([+ wantEntities+ ? (() => {+ const query = client+ .from("trackedEntity")+ .select(+ "id, quantity, status, sourceDocument, sourceDocumentId, sourceDocumentReadableId, readableId, attributes, createdAt"+ )+ .eq("companyId", companyId)+ .order("createdAt", { ascending: false })+ .limit(50);+ if (pattern) {+ return query.or(+ `id.ilike.${pattern},sourceDocumentReadableId.ilike.${pattern},readableId.ilike.${pattern},attributes->>Batch Number.ilike.${pattern},attributes->>Serial Number.ilike.${pattern}`+ );+ }+ return query;+ })()+ : Promise.resolve({ data: [] as any[] }),+ wantActivities+ ? (() => {+ const query = client+ .from("trackedActivity")+ .select(+ "id, type, sourceDocument, sourceDocumentId, sourceDocumentReadableId, attributes, createdAt"+ )+ .eq("companyId", companyId)+ .order("createdAt", { ascending: false })+ .limit(50);+ if (pattern) {+ return query.or(+ `id.ilike.${pattern},type.ilike.${pattern},sourceDocumentReadableId.ilike.${pattern}`+ );+ }+ return query;+ })()+ : Promise.resolve({ data: [] as any[] })+ ]);++ return Response.json({+ entities: entities.data ?? [],+ activities: activities.data ?? []+ });+}diff --git a/apps/erp/app/routes/x+/traceability+/_index.tsx b/apps/erp/app/routes/x+/traceability+/_index.tsxindex a0e7ebf78c..e0c84931f2 100644--- a/apps/erp/app/routes/x+/traceability+/_index.tsx+++ b/apps/erp/app/routes/x+/traceability+/_index.tsx@@ -1,11 +1,23 @@import { useCarbon } from "@carbon/auth";-import { Button, cn, toast, useMount } from "@carbon/react";+import {+ Badge,+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+ HStack+} from "@carbon/react";import { msg } from "@lingui/core/macro";-import { useLingui } from "@lingui/react/macro";-import type { ComponentProps } from "react";-import { forwardRef, useState } from "react";-import { LuBarcode, LuQrCode } from "react-icons/lu";-import { useNavigate } from "react-router";+import { Trans, useLingui } from "@lingui/react/macro";+import { useEffect, useRef, useState } from "react";+import { LuQrCode, LuRoute } from "react-icons/lu";+import { useFetcher, useNavigate } from "react-router";+import { SearchLandingPage } from "~/components";+import { useUser } from "~/hooks";+import { TRACE_API } from "~/modules/inventory/ui/Traceability/constants";+import { entityStatusMeta } from "~/modules/inventory/ui/Traceability/metadata";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -15,119 +27,280 @@ export const handle: Handle = {module: "inventory"};-const RECENT_SEARCHES_KEY = "traceability-searches";+const RECENT_SEARCHES_PREFIX = "traceability-searches";++function recentSearchesKey(companyId: string): string {+ return `${RECENT_SEARCHES_PREFIX}:${companyId}`;+}++type EntityRow = {+ id: string;+ readableId: string | null;+ sourceDocument: string | null;+ sourceDocumentId: string | null;+ sourceDocumentReadableId: string | null;+ quantity: number;+ status: string | null;+ attributes: Record<string, unknown> | null;+ createdAt: string;+};++type SearchResult = {+ entities: EntityRow[];+ activities: unknown[];+};export default function TraceabilityRoute() {const { t } = useLingui();- const { carbon } = useCarbon();const navigate = useNavigate();- const [inputValue, setInputValue] = useState("");- const [recentSearches, setRecentSearches] = useState<string[]>([]);+ const fetcher = useFetcher<SearchResult>();+ const { carbon } = useCarbon();+ const { company } = useUser();+ const storageKey = recentSearchesKey(company.id);+ const [query, setQuery] = useState("");+ const [recentSearches, setRecentSearches] = useState<EntityRow[]>([]);+ const debounceRef = useRef<number | null>(null);- useMount(() => {- const stored = localStorage.getItem(RECENT_SEARCHES_KEY);- if (stored) {- setRecentSearches(JSON.parse(stored));+ useEffect(() => {+ let cancelled = false;+ const stored = localStorage.getItem(storageKey);+ if (!stored) {+ setRecentSearches([]);+ return;}- });-- const handleSearch = async (value: string) => {- if (!value.trim()) return;- if (!carbon) return;-- const response = await carbon- .from("trackedEntity")- .select("*")- .eq("id", value)- .maybeSingle();-- if (!response?.data) {- toast.error(t`Invalid tracking number`);- setInputValue("");+ let parsed: EntityRow[] = [];+ try {+ const raw = JSON.parse(stored);+ if (Array.isArray(raw)) parsed = raw;+ } catch {+ localStorage.removeItem(storageKey);+ return;+ }+ if (parsed.length === 0 || !carbon) {+ setRecentSearches(parsed);return;}+ // Show cached entries immediately, then refresh from server and drop stale.+ setRecentSearches(parsed);+ const ids = parsed.map((p) => p.id);+ carbon+ .from("trackedEntity")+ .select(+ "id, quantity, status, sourceDocument, sourceDocumentId, sourceDocumentReadableId, readableId, attributes, createdAt"+ )+ .eq("companyId", company.id)+ .in("id", ids)+ .then(({ data }) => {+ if (cancelled) return;+ const rows = (data ?? []) as unknown as EntityRow[];+ const byId = new Map(rows.map((r) => [r.id, r]));+ const next = parsed+ .map((p) => byId.get(p.id))+ .filter((e): e is EntityRow => e !== undefined);+ setRecentSearches(next);+ if (next.length === 0) localStorage.removeItem(storageKey);+ else localStorage.setItem(storageKey, JSON.stringify(next));+ });+ return () => {+ cancelled = true;+ };+ }, [storageKey, carbon, company.id]);- // Save to localStorage- const updatedSearches = [- value,- ...recentSearches.filter((search) => search !== value)- ].slice(0, 3);+ useEffect(() => {+ if (debounceRef.current) window.clearTimeout(debounceRef.current);+ const trimmed = query.trim();+ if (trimmed.length < 2) return;+ debounceRef.current = window.setTimeout(() => {+ const params = new URLSearchParams({ q: trimmed, kind: "entity" });+ fetcher.load(`${TRACE_API.search}?${params.toString()}`);+ }, 350);+ return () => {+ if (debounceRef.current) window.clearTimeout(debounceRef.current);+ };+ }, [query, fetcher.load]);- navigate(- `${path.to.traceabilityGraph}?trackedEntityId=${encodeURIComponent(- value- )}`- );-- localStorage.setItem(RECENT_SEARCHES_KEY, JSON.stringify(updatedSearches));+ const isLoading = fetcher.state !== "idle";+ const trimmed = query.trim();+ const showSearchResults = trimmed.length >= 2;+ const entities = showSearchResults ? (fetcher.data?.entities ?? []) : [];- // Navigate to graph+ const recordRecent = (entity: EntityRow) => {+ const next = [+ entity,+ ...recentSearches.filter((e) => e.id !== entity.id)+ ].slice(0, 5);+ setRecentSearches(next);+ localStorage.setItem(storageKey, JSON.stringify(next));};- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {- if (e.key === "Enter") {- handleSearch(inputValue);- }+ const openEntity = (entity: EntityRow) => {+ recordRecent(entity);+ navigate(+ `${path.to.traceabilityGraph}?trackedEntityId=${encodeURIComponent(entity.id)}`+ );};- const handleBlur = () => {- handleSearch(inputValue);+ const openId = (id: string) => {+ navigate(+ `${path.to.traceabilityGraph}?trackedEntityId=${encodeURIComponent(id)}`+ );};return (- <div className="flex w-full h-full flex-1 items-center justify-center bg-card pt-[-49px]">- <div className="flex flex-col items-center gap-4">+ <SearchLandingPage+ icon={LuRoute}+ heading={t`Traceability`}+ description={t`Scan a label or search by ID, serial number, or batch number.`}+ >+ <Command+ shouldFilter={false}+ className="rounded-md border border-border bg-background overflow-hidden"+ ><div className="relative">- <TrackingInput- placeholder={t`Scan or enter a tracking number`}- className="pr-10"- value={inputValue}- onChange={(e) => setInputValue(e.target.value)}- onKeyDown={handleKeyDown}- onBlur={handleBlur}+ <CommandInput+ placeholder={t`Scan or search...`}+ value={query}+ onValueChange={setQuery}+ className="h-12 text-base pr-12"+ autoFocus/>- <LuQrCode className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground" />+ <LuQrCode className="absolute right-4 top-1/2 -translate-y-1/2 size-5 text-muted-foreground pointer-events-none" /></div>+ <CommandList className="h-(--cmdk-list-height) max-h-[400px] min-h-0 border-t border-border transition-[height] duration-200 ease-out [&[hidden]]:hidden">+ {showSearchResults ? (+ <>+ {entities.length > 0 ? (+ <CommandGroup+ heading={t`Entities`}+ className="[&_[cmdk-group-heading]]:text-[10px] [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:pb-1.5"+ >+ {entities.map((entity) => (+ <EntityRowItem+ key={entity.id}+ entity={entity}+ onSelect={() => openEntity(entity)}+ />+ ))}+ </CommandGroup>+ ) : (+ <CommandEmpty className="text-center text-sm text-muted-foreground py-3">+ {isLoading ? <SearchSkeleton /> : <Trans>No matches</Trans>}+ </CommandEmpty>+ )}+ </>+ ) : recentSearches.length > 0 ? (+ <CommandGroup+ heading={t`Recent`}+ className="[&_[cmdk-group-heading]]:text-[10px] [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:pb-1.5"+ >+ {recentSearches.map((entity) => (+ <EntityRowItem+ key={entity.id}+ entity={entity}+ onSelect={() => openId(entity.id)}+ />+ ))}+ </CommandGroup>+ ) : null}+ </CommandList>+ </Command>+ </SearchLandingPage>+ );+}- {recentSearches.length > 0 && (- <div className="flex flex-wrap gap-2 justify-center">- {recentSearches.map((search) => (- <Button- key={search}- variant="secondary"- size="sm"- leftIcon={<LuBarcode />}- onClick={() =>- navigate(- `${- path.to.traceabilityGraph- }?trackedEntityId=${encodeURIComponent(search)}`- )- }- className="rounded-full before:rounded-full after:rounded-full"- >- {search}- </Button>- ))}- </div>+function EntityRowItem({+ entity,+ onSelect+}: {+ entity: EntityRow;+ onSelect: () => void;+}) {+ const meta = entityStatusMeta(entity.status);+ const Icon = meta.icon;+ const headline = headlineFor(entity);+ const batch = entity.attributes?.["Batch Number"] as string | undefined;+ const serial = entity.attributes?.["Serial Number"] as string | undefined;+ const trackingHint = serial+ ? `Serial · ${serial}`+ : batch+ ? `Batch · ${batch}`+ : (entity.sourceDocument ?? entity.id.slice(0, 12));++ return (+ <CommandItem+ value={`${headline} ${entity.id} ${serial ?? ""} ${batch ?? ""} ${entity.sourceDocumentReadableId ?? ""} ${entity.readableId ?? ""}`}+ onSelect={onSelect}+ className="!py-2.5 !px-3 gap-3 cursor-pointer rounded-lg"+ >+ <span+ className="size-9 rounded-lg flex items-center justify-center shrink-0 ring-1 ring-foreground/10 shadow-sm"+ style={{ background: meta.color }}+ >+ <Icon className="size-4 text-white drop-shadow-sm" />+ </span>+ <div className="flex flex-col flex-1 min-w-0 gap-0.5">+ <p className="text-sm font-medium truncate leading-5">{headline}</p>+ <p className="text-[11px] text-muted-foreground truncate leading-4">+ {trackingHint}+ </p>+ </div>+ <HStack spacing={2} className="items-center shrink-0">+ {entity.status && (+ <Badge+ variant="secondary"+ className="text-[10px] uppercase tracking-wide font-semibold px-1.5 py-0.5"+ >+ {entity.status}+ </Badge>)}+ <span className="text-xs tabular-nums font-medium text-foreground w-10 text-right">+ {entity.quantity}+ </span>+ </HStack>+ </CommandItem>+ );+}++function headlineFor(entity: EntityRow): string {+ return (+ (entity.attributes?.["Serial Number"] as string | undefined) ??+ (entity.attributes?.["Batch Number"] as string | undefined) ??+ entity.sourceDocumentReadableId ??+ entity.readableId ??+ entity.id.slice(0, 12)+ );+}++function SearchSkeleton() {+ return (+ <div role="status" aria-live="polite" aria-busy="true" className="py-2">+ <span className="sr-only">Searching</span>+ <div className="px-3 pt-1 pb-1.5">+ <div className="h-2.5 w-16 rounded-full bg-foreground/10 animate-pulse" /></div>+ {[0, 1, 2, 3].map((i) => (+ <div+ key={i}+ className="flex items-center gap-3 px-3 py-2.5 rounded-lg [animation-delay:var(--d)]"+ style={{ ["--d" as any]: `${i * 90}ms` }}+ >+ <div className="size-9 rounded-lg shrink-0 bg-foreground/10 animate-pulse" />+ <div className="flex flex-col flex-1 min-w-0 gap-1.5">+ <div+ className="h-3 rounded-full bg-foreground/10 animate-pulse"+ style={{ width: `${60 + ((i * 13) % 30)}%` }}+ />+ <div+ className="h-2.5 rounded-full bg-foreground/[0.07] animate-pulse"+ style={{ width: `${30 + ((i * 17) % 25)}%` }}+ />+ </div>+ <div className="flex items-center gap-2 shrink-0">+ <div className="h-4 w-14 rounded-md bg-foreground/10 animate-pulse" />+ <div className="h-3 w-6 rounded-full bg-foreground/10 animate-pulse" />+ </div>+ </div>+ ))}</div>);}--const TrackingInput = forwardRef<HTMLInputElement, ComponentProps<"input">>(- ({ className, ...props }, ref) => {- return (- <input- className={cn(- "min-w-[400px] min-h-[40px] flex w-full rounded-lg border border-input bg-background px-4 py-3 text-base text-foreground shadow-sm shadow-black/5 transition-shadow placeholder:text-muted-foreground/70 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50",- className- )}- ref={ref}- {...props}- />- );- }-);-TrackingInput.displayName = "TrackingInput";diff --git a/apps/erp/app/routes/x+/traceability+/graph.tsx b/apps/erp/app/routes/x+/traceability+/graph.tsxindex 2566b14353..fff86f2554 100644--- a/apps/erp/app/routes/x+/traceability+/graph.tsx+++ b/apps/erp/app/routes/x+/traceability+/graph.tsx@@ -1,33 +1,24 @@import { requirePermissions } from "@carbon/auth/auth.server";-import {- Button,- Heading,- HStack,- Loading,- useHydrated,- VStack-} from "@carbon/react";-import { useUrlParams } from "@carbon/remix";+import { Button, Loading, useHydrated, VStack } from "@carbon/react";import { msg } from "@lingui/core/macro";import { Trans } from "@lingui/react/macro";import { ParentSize } from "@visx/responsive";-import { useEffect, useMemo, useState } from "react";+import { useMemo } from "react";import type { LoaderFunctionArgs } from "react-router";import { Link, redirect, useLoaderData, useNavigation } from "react-router";import { Empty } from "~/components";-import type {- Activity,- ActivityInput,- ActivityOutput,- GraphData,- GraphLink,- GraphNode,- TrackedEntity-} from "~/modules/inventory";+import type { Activity, TrackedEntity } from "~/modules/inventory";import {- TraceabilityGraph,- TraceabilitySidebar-} from "~/modules/inventory/ui/Traceability/TraceabilityGraph";+ fetchContainmentsForEntities,+ fetchJobScopedLineage,+ fetchJobStepRecords,+ fetchLineageSubgraph+} from "~/modules/inventory/lineage.server";+import { clampDepth } from "~/modules/inventory/ui/Traceability/constants";+import { useTraceabilityStore } from "~/modules/inventory/ui/Traceability/store";+import { TraceabilityGraph } from "~/modules/inventory/ui/Traceability/TraceabilityGraph";+import { TraceabilitySidebar } from "~/modules/inventory/ui/Traceability/TraceabilitySidebar";+import type { StepRecord } from "~/modules/inventory/ui/Traceability/utils";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -44,233 +35,190 @@ export async function loader({ request }: LoaderFunctionArgs) {});const url = new URL(request.url);- const searchParams = new URLSearchParams(url.search);- const trackedEntityId = searchParams.get("trackedEntityId");- const trackedActivityId = searchParams.get("trackedActivityId");+ const trackedEntityId = url.searchParams.get("trackedEntityId");+ const trackedActivityId = url.searchParams.get("trackedActivityId");+ const jobId = url.searchParams.get("jobId");+ const depthParam = url.searchParams.get("depth");+ const depth = clampDepth(Number(depthParam) || 1);- if (!trackedEntityId && !trackedActivityId) {+ if (!trackedEntityId && !trackedActivityId && !jobId) {throw redirect(path.to.traceability);}- if (trackedEntityId) {- const [entity, descendants, ancestors] = await Promise.all([- client- .from("trackedEntity")- .select("*")- .eq("id", trackedEntityId)- .single(),- client.rpc("get_direct_descendants_of_tracked_entity_strict", {- p_tracked_entity_id: trackedEntityId- }),- client.rpc("get_direct_ancestors_of_tracked_entity_strict", {- p_tracked_entity_id: trackedEntityId- })- ]);-- const [inputs, outputs] = await Promise.all([- client- .from("trackedActivityInput")- .select("*")- .in(- "trackedEntityId",- Array.from(- new Set([- ...(descendants?.data?.map((descendant) => descendant.id) || []),- trackedEntityId- ])- )- ),- client- .from("trackedActivityOutput")- .select("*")- .in(- "trackedEntityId",- Array.from(- new Set([- trackedEntityId,- ...(ancestors?.data?.map((ancestor) => ancestor.id) || [])- ])- )- )- ]);-- const uniqueActivityIds = Array.from(- new Set([- ...(inputs?.data?.map((input) => input.trackedActivityId) || []),- ...(outputs?.data?.map((output) => output.trackedActivityId) || [])- ])- );-- const activities = await client- .from("trackedActivity")- .select("*")- .in("id", uniqueActivityIds);-+ if (jobId) {+ const payload = await fetchJobScopedLineage(client, jobId, depth);return {- entities: [- ...(entity?.data ? [entity.data] : []),- ...(descendants?.data ?? []),- ...(ancestors?.data ?? [])- ].reduce((acc, curr) => {- if (!acc.some((item) => item.id === curr.id)) {- acc.push(curr as TrackedEntity);- }- return acc;- }, [] as TrackedEntity[]),- inputs: inputs?.data ?? [],- outputs: outputs?.data ?? [],- activities: activities?.data ?? []+ ...payload,+ stepRecords: payload.stepRecords ?? [],+ containments: payload.containments ?? [],+ rootId: jobId,+ rootType: "job" as const,+ depth};}- if (trackedActivityId) {- // Get the initial activity and its direct inputs/outputs- const [activity, directInputs, directOutputs] = await Promise.all([- client.from("trackedActivity").select("*").eq("id", trackedActivityId),- client- .from("trackedActivityInput")- .select("*")- .eq("trackedActivityId", trackedActivityId),- client- .from("trackedActivityOutput")- .select("*")- .eq("trackedActivityId", trackedActivityId)- ]);-- // Get the direct entities connected to this activity- const directEntityIds = Array.from(- new Set([- ...(directInputs?.data?.map((input) => input.trackedEntityId) || []),- ...(directOutputs?.data?.map((output) => output.trackedEntityId) || [])- ])+ if (trackedEntityId) {+ const payload = await fetchLineageSubgraph(+ client,+ trackedEntityId,+ depth,+ "both");+ const [containments, stepRecords] = await Promise.all([+ fetchContainmentsForEntities(+ client,+ payload.entities.map((e) => e.id)+ ),+ collectStepRecordsForActivities(client, payload.activities)+ ]);+ return {+ ...payload,+ stepRecords,+ containments,+ rootId: trackedEntityId,+ rootType: "entity" as const,+ depth+ };+ }- // Get the direct entities- const directEntities = await client- .from("trackedEntity")+ // Legacy 1-hop activity-rooted view.+ const [activity, directInputs, directOutputs] = await Promise.all([+ client.from("trackedActivity").select("*").eq("id", trackedActivityId!),+ client+ .from("trackedActivityInput").select("*")- .in("id", directEntityIds);-- // Get additional activities connected to these entities- const [additionalInputs, additionalOutputs] = await Promise.all([- client- .from("trackedActivityInput")- .select("*")- .in("trackedEntityId", directEntityIds)- .neq("trackedActivityId", trackedActivityId),- client- .from("trackedActivityOutput")- .select("*")- .in("trackedEntityId", directEntityIds)- .neq("trackedActivityId", trackedActivityId)- ]);+ .eq("trackedActivityId", trackedActivityId!),+ client+ .from("trackedActivityOutput")+ .select("*")+ .eq("trackedActivityId", trackedActivityId!)+ ]);++ const directEntityIds = Array.from(+ new Set([+ ...(directInputs?.data?.map((input) => input.trackedEntityId) || []),+ ...(directOutputs?.data?.map((output) => output.trackedEntityId) || [])+ ])+ );- // Get additional activity IDs- const additionalActivityIds = Array.from(- new Set([- ...(additionalInputs?.data?.map((input) => input.trackedActivityId) ||- []),- ...(additionalOutputs?.data?.map(- (output) => output.trackedActivityId- ) || [])- ])- );+ const directEntities = await client+ .from("trackedEntity")+ .select("*")+ .in("id", directEntityIds);- // Get additional activities- const additionalActivities = await client- .from("trackedActivity")+ const [additionalInputs, additionalOutputs] = await Promise.all([+ client+ .from("trackedActivityInput").select("*")- .in("id", additionalActivityIds);-- // Combine all inputs and outputs- const allInputs = [- ...(directInputs?.data || []),- ...(additionalInputs?.data || [])- ];+ .in("trackedEntityId", directEntityIds)+ .neq("trackedActivityId", trackedActivityId!),+ client+ .from("trackedActivityOutput")+ .select("*")+ .in("trackedEntityId", directEntityIds)+ .neq("trackedActivityId", trackedActivityId!)+ ]);++ const additionalActivityIds = Array.from(+ new Set([+ ...(additionalInputs?.data?.map((input) => input.trackedActivityId) ||+ []),+ ...(additionalOutputs?.data?.map((output) => output.trackedActivityId) ||+ [])+ ])+ );- const allOutputs = [+ const additionalActivities = await client+ .from("trackedActivity")+ .select("*")+ .in("id", additionalActivityIds);++ const allEntities = (directEntities?.data ?? []) as TrackedEntity[];+ const allActivities = [+ ...((activity?.data || []) as unknown as Activity[]),+ ...((additionalActivities?.data || []) as unknown as Activity[])+ ];++ const [containments, stepRecords] = await Promise.all([+ fetchContainmentsForEntities(+ client,+ allEntities.map((e) => e.id)+ ),+ collectStepRecordsForActivities(client, allActivities)+ ]);++ return {+ entities: allEntities,+ inputs: [...(directInputs?.data || []), ...(additionalInputs?.data || [])],+ outputs: [...(directOutputs?.data || []),...(additionalOutputs?.data || [])- ];-- // Combine all activities- const allActivities = [- ...(activity?.data || []),- ...(additionalActivities?.data || [])- ];+ ],+ activities: allActivities,+ stepRecords,+ containments,+ rootId: trackedActivityId!,+ rootType: "activity" as const,+ depth: 1+ };+}- return {- entities: directEntities?.data ?? [],- inputs: allInputs,- outputs: allOutputs,- activities: allActivities- };+async function collectStepRecordsForActivities(+ client: Parameters<typeof fetchJobStepRecords>[0],+ activities: Activity[]+): Promise<StepRecord[]> {+ const jobIds = new Set<string>();+ for (const a of activities) {+ const jobId = (a.attributes as Record<string, unknown> | null)?.Job;+ if (typeof jobId === "string" && jobId) jobIds.add(jobId);}-- throw new Error("Invalid query parameters");+ if (jobIds.size === 0) return [];+ const results = await Promise.all(+ Array.from(jobIds).map((jobId) => fetchJobStepRecords(client, jobId))+ );+ return results.flat();}-export default function TraceabilityRoute() {- const [params, setParams] = useUrlParams();- const selectedId =- params.get("trackedEntityId") ?? params.get("trackedActivityId");-- const { entities, inputs, outputs, activities } =- useLoaderData<typeof loader>();- const [graphData, setGraphData] = useState<GraphData>({- nodes: [],- links: []- });-- const isEmpty = useMemo(() => {- return entities.length === 0 && activities.length === 0;- }, [entities, activities]);- useEffect(() => {- // Cast the data from the loader to the correct types- const validEntities = entities.filter(- Boolean- ) as unknown as TrackedEntity[];- const validActivities = activities.filter(Boolean) as unknown as Activity[];-- // Show all nodes and links- const allNodes = getAllNodes(validEntities, validActivities);- const allLinks = getAllLinks(inputs, outputs);- setGraphData({ nodes: allNodes, links: allLinks });- }, [entities, activities, inputs, outputs]);-- const handleNodeClick = (node: GraphNode) => {- if (node.data.id === selectedId) {- return;- }-- if (node.type === "entity") {- setParams({- trackedEntityId: node.data.id,- trackedActivityId: null- });- } else {- setParams({- trackedEntityId: null,- trackedActivityId: node.data.id- });- }- };+export default function TraceabilityRoute() {+ const {+ entities,+ inputs,+ outputs,+ activities,+ stepRecords,+ containments,+ rootId,+ rootType+ } = useLoaderData<typeof loader>();++ const isEmpty = useMemo(+ () => entities.length === 0 && activities.length === 0,+ [entities, activities]+ );const isHydrated = useHydrated();const navigation = useNavigation();+ const selectedIds = useTraceabilityStore((s) => s.selectedIds);+ const focusedIndex = useTraceabilityStore((s) => s.focusedIndex);+ const setSelectedSingle = useTraceabilityStore((s) => s.setSelectedSingle);+ const safeIndex =+ selectedIds.length > 0 ? Math.min(focusedIndex, selectedIds.length - 1) : 0;+ const focusedSelectedId = selectedIds[safeIndex] ?? null;+ const sidebarId = focusedSelectedId ?? rootId;++ const selectedEntity =+ (entities.find((e) => e?.id === sidebarId) as TrackedEntity | undefined) ??+ null;+ const selectedActivity =+ (activities.find((a) => a?.id === sidebarId) as Activity | undefined) ??+ null;+return (<div className="flex bg-card h-[calc(100dvh-49px)] w-full overflow-hidden scrollbar-hide">- <VStack className="flex-1 min-w-0 h-full">- <HStack className="px-4 py-6 justify-between w-full relative">- <HStack spacing={1}>- <Heading size={"h2"}>- <Trans>Traceability</Trans>- </Heading>- </HStack>- </HStack>- <div className="flex flex-1 w-full h-full overflow-y-auto scrollbar-hide p-4">- <div className="w-full max-w-full overflow-x-auto text-muted-foreground">+ <VStack className="flex-1 min-w-0 h-full" spacing={0}>+ <div className="flex flex-1 w-full h-full overflow-hidden">+ <div className="w-full h-full">{isEmpty ? (<Empty className="h-full w-full"><Button asChild>@@ -286,10 +234,15 @@ export default function TraceabilityRoute() {isLoading={!isHydrated || navigation.state !== "idle"}><TraceabilityGraph- key={`graph-${selectedId}`}- data={graphData}- onNodeClick={handleNodeClick}- selectedId={selectedId}+ key={`graph-${rootId}`}+ entities={entities as TrackedEntity[]}+ activities={activities as Activity[]}+ inputs={inputs}+ outputs={outputs}+ stepRecords={stepRecords}+ containments={containments}+ rootId={rootId}+ rootType={rootType}width={width}height={height}/>@@ -302,260 +255,20 @@ export default function TraceabilityRoute() {</VStack>{!isEmpty && (<TraceabilitySidebar- key={`sidebar-${selectedId}`}- entity={- entities- .filter(Boolean)- .find(- (entity) => entity?.id === selectedId- ) as TrackedEntity | null- }- activity={- activities- .filter(Boolean)- .find(- (activity) => activity?.id === selectedId- ) as Activity | null- }+ key={`sidebar-${sidebarId}`}+ entity={selectedEntity}+ activity={selectedActivity}+ payload={{+ entities: entities as TrackedEntity[],+ activities: activities as Activity[],+ inputs,+ outputs,+ stepRecords,+ containments+ }}+ onSelect={(id) => setSelectedSingle(id)}/>)}</div>);}--// Function to filter graph data based on selected node-export const filterGraphByNode = (- allEntities: TrackedEntity[],- allActivities: Activity[],- allInputs: ActivityInput[],- allOutputs: ActivityOutput[],- selectedNode: GraphNode | null-): GraphData => {- if (!selectedNode) {- // Return empty graph if no node is selected- return { nodes: [], links: [] };- }-- const nodes: GraphNode[] = [];- const links: GraphLink[] = [];- const nodeIds = new Set<string>();-- // Add the selected node with depth 0- nodes.push({- ...selectedNode,- depth: 0,- parentId: null- });- nodeIds.add(selectedNode.id);-- if (selectedNode.type === "entity") {- // For entity nodes, show direct parents (activities that output this entity)- // and direct children (activities that use this entity as input)-- // Find activities that output this entity- const parentActivities = allOutputs- .filter((output) => output.trackedEntityId === selectedNode.id)- .map((output) => {- const activity = allActivities.find(- (a) => a.id === output.trackedActivityId- );- if (activity && !nodeIds.has(activity.id)) {- nodeIds.add(activity.id);- return {- id: activity.id,- type: "activity" as const,- data: activity,- depth: -1, // Parent activities are at depth -1- parentId: selectedNode.id- } as GraphNode;- }- return null;- })- .filter((node): node is NonNullable<typeof node> => node !== null);-- nodes.push(...parentActivities);-- // Add links from parent activities to this entity- parentActivities.forEach((activity) => {- if (activity) {- links.push({- source: activity.id,- target: selectedNode.id,- type: "output",- quantity:- allOutputs.find(- (o) =>- o.trackedActivityId === activity.id &&- o.trackedEntityId === selectedNode.id- )?.quantity || 1- });- }- });-- // Find activities that use this entity as input- const childActivities = allInputs- .filter((input) => input.trackedEntityId === selectedNode.id)- .map((input) => {- const activity = allActivities.find(- (a) => a.id === input.trackedActivityId- );- if (activity && !nodeIds.has(activity.id)) {- nodeIds.add(activity.id);- return {- id: activity.id,- type: "activity" as const,- data: activity,- depth: 1, // Child activities are at depth 1- parentId: selectedNode.id- } as GraphNode;- }- return null;- })- .filter((node): node is NonNullable<typeof node> => node !== null);-- nodes.push(...childActivities);-- // Add links from this entity to child activities- childActivities.forEach((activity) => {- if (activity) {- links.push({- source: selectedNode.id,- target: activity.id,- type: "input",- quantity:- allInputs.find(- (i) =>- i.trackedActivityId === activity.id &&- i.trackedEntityId === selectedNode.id- )?.quantity || 1- });- }- });- } else if (selectedNode.type === "activity") {- // For activity nodes, show all input entities and all output entities-- // Find all input entities for this activity- const inputEntities = allInputs- .filter((input) => input.trackedActivityId === selectedNode.id)- .map((input) => {- const entity = allEntities.find((e) => e.id === input.trackedEntityId);- if (entity && !nodeIds.has(entity.id)) {- nodeIds.add(entity.id);- return {- id: entity.id,- type: "entity" as const,- data: entity,- depth: -1, // Input entities are at depth -1- parentId: selectedNode.id- } as GraphNode;- }- return null;- })- .filter((node): node is NonNullable<typeof node> => node !== null);-- nodes.push(...inputEntities);-- // Add links from input entities to this activity- inputEntities.forEach((entity) => {- if (entity) {- links.push({- source: entity.id,- target: selectedNode.id,- type: "input",- quantity:- allInputs.find(- (i) =>- i.trackedActivityId === selectedNode.id &&- i.trackedEntityId === entity.id- )?.quantity || 1- });- }- });-- // Find all output entities for this activity- const outputEntities = allOutputs- .filter((output) => output.trackedActivityId === selectedNode.id)- .map((output) => {- const entity = allEntities.find((e) => e.id === output.trackedEntityId);- if (entity && !nodeIds.has(entity.id)) {- nodeIds.add(entity.id);- return {- id: entity.id,- type: "entity" as const,- data: entity,- depth: 1, // Output entities are at depth 1- parentId: selectedNode.id- } as GraphNode;- }- return null;- })- .filter((node): node is NonNullable<typeof node> => node !== null);-- nodes.push(...outputEntities);-- // Add links from this activity to output entities- outputEntities.forEach((entity) => {- if (entity) {- links.push({- source: selectedNode.id,- target: entity.id,- type: "output",- quantity:- allOutputs.find(- (o) =>- o.trackedActivityId === selectedNode.id &&- o.trackedEntityId === entity.id- )?.quantity || 1- });- }- });- }-- return { nodes, links };-};--// Function to get all nodes for initial display-export const getAllNodes = (- entities: TrackedEntity[],- activities: Activity[]-): GraphNode[] => {- const entityNodes: GraphNode[] = entities.map((entity) => ({- id: entity.id,- type: "entity",- data: entity,- depth: 0,- parentId: null- }));-- const activityNodes: GraphNode[] = activities.map((activity) => ({- id: activity.id,- type: "activity",- data: activity,- depth: 0,- parentId: null- }));-- return [...entityNodes, ...activityNodes];-};--// Function to get all links-export const getAllLinks = (- inputs: ActivityInput[],- outputs: ActivityOutput[]-): GraphLink[] => {- const inputLinks: GraphLink[] = inputs.map((input) => ({- source: input.trackedEntityId,- target: input.trackedActivityId,- type: "input",- quantity: input.quantity- }));-- const outputLinks: GraphLink[] = outputs.map((output) => ({- source: output.trackedActivityId,- target: output.trackedEntityId,- type: "output",- quantity: output.quantity- }));-- return [...inputLinks, ...outputLinks];-};diff --git a/apps/erp/package.json b/apps/erp/package.jsonindex 38567ee9b0..92b4d81e01 100644--- a/apps/erp/package.json+++ b/apps/erp/package.json@@ -50,9 +50,12 @@"@vercel/analytics": "1.6.1","@vercel/react-router": "1.2.6","@visx/responsive": "2.17.0",+ "@xyflow/react": "12.10.2","ai": "5.0.172",+ "dagre": "0.8.5","assert-never": "1.4.0","clsx": "2.1.1",+ "comlink": "4.4.2","cookie": "1.1.1","d3": "7.9.0","d3-array": "3.2.4",@@ -66,6 +69,7 @@"lodash.debounce": "4.0.8","lodash.words": "4.2.0","monaco-editor": "0.44.0",+ "motion": "12.38.0","motion-number": "0.1.7","nanoid": "5.1.7","nanostores": "0.9.5",@@ -109,6 +113,7 @@"@tailwindcss/line-clamp": "0.4.4","@tailwindcss/typography": "0.5.19","@types/d3": "7.4.3",+ "@types/dagre": "0.7.52","@types/nprogress": "0.2.3","@types/papaparse": "5.5.2","@types/react": "18.3.28",diff --git a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsxindex 774b760fc2..02c0ee94b2 100644--- a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx+++ b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx@@ -186,7 +186,7 @@ export function IssueMaterialModal({// small destructive Badge for expired stock — pops in the dropdown// far better than a plain "EXPIRED" prefix in the helper line.const label = expired ? (- <span className="flex items-center gap-2">+ <span key={sn.id} className="flex items-center gap-2"><span className="truncate">{labelText}</span><Badge variant="red">Expired</Badge></span>diff --git a/package-lock.json b/package-lock.jsonindex 787db88077..3614324f10 100644--- a/package-lock.json+++ b/package-lock.json@@ -253,12 +253,15 @@"@vercel/analytics": "1.6.1","@vercel/react-router": "1.2.6","@visx/responsive": "2.17.0",+ "@xyflow/react": "12.10.2","ai": "5.0.172","assert-never": "1.4.0","clsx": "2.1.1",+ "comlink": "4.4.2","cookie": "1.1.1","d3": "7.9.0","d3-array": "3.2.4",+ "dagre": "0.8.5","dompurify": "3.4.0","emoji-mart": "5.6.0","framer-motion": "11.18.2",@@ -269,6 +272,7 @@"lodash.debounce": "4.0.8","lodash.words": "4.2.0","monaco-editor": "0.44.0",+ "motion": "12.38.0","motion-number": "0.1.7","nanoid": "5.1.7","nanostores": "0.9.5",@@ -312,6 +316,7 @@"@tailwindcss/line-clamp": "0.4.4","@tailwindcss/typography": "0.5.19","@types/d3": "7.4.3",+ "@types/dagre": "0.7.52","@types/nprogress": "0.2.3","@types/papaparse": "5.5.2","@types/react": "18.3.28",@@ -332,6 +337,13 @@"vite-tsconfig-paths": "5.1.4"}},+ "apps/erp/node_modules/@types/dagre": {+ "version": "0.7.52",+ "resolved": "https://registry.npmjs.org/@types/dagre/-/dagre-0.7.52.tgz",+ "integrity": "sha512-XKJdy+OClLk3hketHi9Qg6gTfe1F3y+UFnHxKA2rn9Dw+oXa4Gb378Ztz9HlMgZKSxpPmn4BNVh9wgkpvrK1uw==",+ "dev": true,+ "license": "MIT"+ },"apps/erp/node_modules/chokidar": {"version": "3.6.0","dev": true,@@ -2748,7 +2760,6 @@"version": "1.1.0","resolved": "https://registry.npmjs.org/@csstools/selector-resolve-nested/-/selector-resolve-nested-1.1.0.tgz","integrity": "sha512-uWvSaeRcHyeNenKg8tp17EVDRkpflmdyvbE0DHo6D/GdBb6PDnCYYU6gRpXhtICMGMcahQmj2zGxwFM/WC8hCg==",- "dev": true,"funding": [{"type": "github",@@ -2771,7 +2782,6 @@"version": "3.1.1","resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-3.1.1.tgz","integrity": "sha512-a7cxGcJ2wIlMFLlh8z2ONm+715QkPHiyJcxwQlKOz/03GPw1COpfhcmC9wm4xlZfp//jWHNNMwzjtqHXVWU9KA==",- "dev": true,"funding": [{"type": "github",@@ -3808,7 +3818,7 @@"version": "29.6.3","resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz","integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@sinclair/typebox": "^0.27.8"@@ -3821,7 +3831,7 @@"version": "29.6.3","resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz","integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@jest/schemas": "^29.6.3",@@ -3916,7 +3926,7 @@"version": "5.9.4","resolved": "https://registry.npmjs.org/@lingui/babel-plugin-lingui-macro/-/babel-plugin-lingui-macro-5.9.4.tgz","integrity": "sha512-Gj+H48MQWY6rV40TBVG7U91/KETznbXOJpJsf8U4merBRPZgOMCy6VuWZGy1i+YJZJF/LiberlsCCEiiPbBRqg==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@babel/core": "^7.20.12",@@ -4634,7 +4644,7 @@"version": "5.9.4","resolved": "https://registry.npmjs.org/@lingui/conf/-/conf-5.9.4.tgz","integrity": "sha512-crF3AQgYXg52Caz4ffJKSTXWUU/4iOGOBRnSeOkw8lsOtOYlPTaWxeSGyDTEwaGCFl6P/1aew+pvHOSCxOAyrg==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@babel/runtime": "^7.20.13",@@ -4651,7 +4661,7 @@"version": "8.3.6","resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz","integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"import-fresh": "^3.3.0",@@ -4678,7 +4688,7 @@"version": "2.6.1","resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz","integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",- "dev": true,+ "devOptional": true,"license": "MIT","bin": {"jiti": "lib/jiti-cli.mjs"@@ -15573,6 +15583,63 @@"integrity": "sha512-SoLMv7dbH+njWzXnOY6fI08dFMI5+/dQ+vY3n8RnnbdG7MdJEgiP28Xj/xWlnRnED/aB6SFw56Zop+LbmaaKqA==","license": "MIT"},+ "node_modules/@remix-run/router": {+ "version": "1.23.2",+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz",+ "integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/@remix-run/server-runtime": {+ "version": "2.17.4",+ "resolved": "https://registry.npmjs.org/@remix-run/server-runtime/-/server-runtime-2.17.4.tgz",+ "integrity": "sha512-oCsFbPuISgh8KpPKsfBChzjcntvTz5L+ggq9VNYWX8RX3yA7OgQpKspRHOSxb05bw7m0Hx+L1KRHXjf3juKX8w==",+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@remix-run/router": "1.23.2",+ "@types/cookie": "^0.6.0",+ "@web3-storage/multipart-parser": "^1.0.0",+ "cookie": "^0.7.2",+ "set-cookie-parser": "^2.4.8",+ "source-map": "^0.7.3",+ "turbo-stream": "2.4.1"+ },+ "engines": {+ "node": ">=18.0.0"+ },+ "peerDependencies": {+ "typescript": "^5.1.0"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/@remix-run/server-runtime/node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/@remix-run/server-runtime/node_modules/source-map": {+ "version": "0.7.6",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",+ "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==",+ "license": "BSD-3-Clause",+ "peer": true,+ "engines": {+ "node": ">= 12"+ }+ },"node_modules/@rollup/rollup-android-arm-eabi": {"version": "4.60.1","resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.1.tgz",@@ -16073,7 +16140,7 @@"version": "0.27.10","resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz","integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/@slack/bolt": {@@ -18042,6 +18109,13 @@"@types/node": "*"}},+ "node_modules/@types/cookie": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",+ "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",+ "license": "MIT",+ "peer": true+ },"node_modules/@types/d3": {"version": "7.4.3","resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz",@@ -18384,14 +18458,14 @@"version": "2.0.6","resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz","integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/@types/istanbul-lib-report": {"version": "3.0.3","resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz","integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@types/istanbul-lib-coverage": "*"@@ -18401,7 +18475,7 @@"version": "3.0.4","resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz","integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@types/istanbul-lib-report": "*"@@ -18611,7 +18685,7 @@"version": "18.3.7","resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz","integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",- "dev": true,+ "devOptional": true,"license": "MIT","peerDependencies": {"@types/react": "^18.0.0"@@ -18704,7 +18778,7 @@"version": "17.0.35","resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz","integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@types/yargs-parser": "*"@@ -18714,7 +18788,7 @@"version": "21.0.3","resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz","integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/@typescript/native-preview": {@@ -19509,6 +19583,13 @@"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==","license": "MIT"},+ "node_modules/@web3-storage/multipart-parser": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/@web3-storage/multipart-parser/-/multipart-parser-1.0.0.tgz",+ "integrity": "sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==",+ "license": "(Apache-2.0 AND MIT)",+ "peer": true+ },"node_modules/@xyflow/react": {"version": "12.10.2","resolved": "https://registry.npmjs.org/@xyflow/react/-/react-12.10.2.tgz",@@ -20389,7 +20470,7 @@"version": "6.3.0","resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz","integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",- "dev": true,+ "devOptional": true,"license": "MIT","engines": {"node": ">=10"@@ -21079,6 +21160,12 @@"node": ">= 0.8"}},+ "node_modules/comlink": {+ "version": "4.4.2",+ "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.2.tgz",+ "integrity": "sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==",+ "license": "Apache-2.0"+ },"node_modules/comma-separated-tokens": {"version": "2.0.3","resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",@@ -23631,7 +23718,7 @@"version": "4.13.7","resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.7.tgz","integrity": "sha512-7tN6rFgBlMgpBML5j8typ92BKFi2sFQvIdpAqLA2beia5avZDrMs0FLZiM5etShWq5irVyGcGMEA1jcDaK7A/Q==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"resolve-pkg-maps": "^1.0.0"@@ -25230,7 +25317,7 @@"version": "29.6.3","resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz","integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==",- "dev": true,+ "devOptional": true,"license": "MIT","engines": {"node": "^14.15.0 || ^16.10.0 || >=18.0.0"@@ -25240,7 +25327,7 @@"version": "29.7.0","resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz","integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@jest/types": "^29.6.3",@@ -25258,7 +25345,7 @@"version": "29.7.0","resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz","integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"@jest/schemas": "^29.6.3",@@ -25273,7 +25360,7 @@"version": "5.2.0","resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz","integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",- "dev": true,+ "devOptional": true,"license": "MIT","engines": {"node": ">=10"@@ -25286,7 +25373,7 @@"version": "18.3.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz","integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/jiti": {@@ -25411,7 +25498,7 @@"version": "4.1.1","resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz","integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"argparse": "^2.0.1"@@ -27448,6 +27535,32 @@"node": ">= 0.8"}},+ "node_modules/motion": {+ "version": "12.38.0",+ "resolved": "https://registry.npmjs.org/motion/-/motion-12.38.0.tgz",+ "integrity": "sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w==",+ "license": "MIT",+ "dependencies": {+ "framer-motion": "^12.38.0",+ "tslib": "^2.4.0"+ },+ "peerDependencies": {+ "@emotion/is-prop-valid": "*",+ "react": "^18.0.0 || ^19.0.0",+ "react-dom": "^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/is-prop-valid": {+ "optional": true+ },+ "react": {+ "optional": true+ },+ "react-dom": {+ "optional": true+ }+ }+ },"node_modules/motion-dom": {"version": "11.18.1","resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.18.1.tgz",@@ -27474,6 +27587,48 @@"integrity": "sha512-49Kt+HKjtbJKLtgO/LKj9Ld+6vw9BjH5d9sc40R/kVyH8GLAXgT42M2NnuPcJNuA3s9ZfZBUcwIgpmZWGEE+hA==","license": "MIT"},+ "node_modules/motion/node_modules/framer-motion": {+ "version": "12.38.0",+ "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.38.0.tgz",+ "integrity": "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g==",+ "license": "MIT",+ "dependencies": {+ "motion-dom": "^12.38.0",+ "motion-utils": "^12.36.0",+ "tslib": "^2.4.0"+ },+ "peerDependencies": {+ "@emotion/is-prop-valid": "*",+ "react": "^18.0.0 || ^19.0.0",+ "react-dom": "^18.0.0 || ^19.0.0"+ },+ "peerDependenciesMeta": {+ "@emotion/is-prop-valid": {+ "optional": true+ },+ "react": {+ "optional": true+ },+ "react-dom": {+ "optional": true+ }+ }+ },+ "node_modules/motion/node_modules/motion-dom": {+ "version": "12.38.0",+ "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.38.0.tgz",+ "integrity": "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA==",+ "license": "MIT",+ "dependencies": {+ "motion-utils": "^12.36.0"+ }+ },+ "node_modules/motion/node_modules/motion-utils": {+ "version": "12.36.0",+ "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.36.0.tgz",+ "integrity": "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg==",+ "license": "MIT"+ },"node_modules/ms": {"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",@@ -29076,7 +29231,6 @@"version": "12.1.5","resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-12.1.5.tgz","integrity": "sha512-N1NgI1PDCiAGWPTYrwqm8wpjv0bgDmkYHH72pNsqTCv9CObxjxftdYu6AKtGN+pnJa7FQjMm3v4sp8QJbFsYdQ==",- "dev": true,"funding": [{"type": "github",@@ -30993,7 +31147,7 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz","integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",- "dev": true,+ "devOptional": true,"license": "MIT","funding": {"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"@@ -32495,7 +32649,6 @@"version": "2.89.0","resolved": "https://registry.npmjs.org/supabase/-/supabase-2.89.0.tgz","integrity": "sha512-oYCp/NKaJQkiIdorJcgZLvy8M2vzACMvZy0mbk7f9GV5IRMPO83hNshzdtxGBoiqpgRUZIWEEiQCcuXpN4r9Xw==",- "dev": true,"hasInstallScript": true,"license": "MIT","dependencies": {@@ -32515,7 +32668,6 @@"version": "9.0.0","resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz","integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==",- "dev": true,"license": "MIT","engines": {"node": ">= 20"@@ -32525,7 +32677,6 @@"version": "9.0.0","resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-9.0.0.tgz","integrity": "sha512-/MVmHp58WkOypgFhCLk4fzpPcFQvTJ/e6LBI7irpIO2HfxUbpmYoHF+KzipzJpxxzJu7aJNWQ0xojJ/dzV2G5g==",- "dev": true,"license": "MIT","dependencies": {"agent-base": "9.0.0",@@ -32592,7 +32743,6 @@"version": "2.1.0","resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-2.1.0.tgz","integrity": "sha512-zpvY5mDs0130YzYjZKBiDaw32rygxk5RyJ4KmeHjGnwkvbjm/PszON1m4Bbt2DkMRIXlXsfNevykAESgURN4KA==",- "dev": true,"license": "MIT","engines": {"node": ">=12.13.0"@@ -32605,7 +32755,6 @@"version": "1.3.1","resolved": "https://registry.npmjs.org/tailwind-scrollbar-hide/-/tailwind-scrollbar-hide-1.3.1.tgz","integrity": "sha512-eUAvPTltKnAGHbCBRpOk5S7+UZTkFZgDKmZLZ6jZXXs4V7mRXvwshBjeMwrv3vmiWqm3IGEDFVKzUSm1JuoXKw==",- "dev": true,"license": "MIT","peerDependencies": {"tailwindcss": ">=3.0.0 || >= 4.0.0 || >= 4.0.0-beta.8 || >= 4.0.0-alpha.20"@@ -33227,7 +33376,7 @@"version": "4.21.0","resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz","integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"esbuild": "~0.27.0",@@ -33298,6 +33447,13 @@"@turbo/windows-arm64": "2.9.6"}},+ "node_modules/turbo-stream": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.1.tgz",+ "integrity": "sha512-v8kOJXpG3WoTN/+at8vK7erSzo6nW6CIaeOvNOkHQVDajfz1ZVeSxCbc6tOH4hrGZW7VUCV0TOXd8CPzYnYkrw==",+ "license": "ISC",+ "peer": true+ },"node_modules/type-is": {"version": "2.0.1","resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",@@ -35288,7 +35444,7 @@"@supabase/functions-js": "2.1.5","@supabase/supabase-js": "2.80.0","ai": "5.0.172",- "inngest": "^3.52.7",+ "inngest": "3.52.7","kysely": "0.28.15","nanoid": "5.1.7","nodemailer": "6.10.1",@@ -35306,6 +35462,89 @@"typescript": "5.8.3"}},+ "packages/jobs/node_modules/inngest": {+ "version": "3.52.7",+ "resolved": "https://registry.npmjs.org/inngest/-/inngest-3.52.7.tgz",+ "integrity": "sha512-Bj4LttRrNUfVz745MVxQio34QwHzwG7dHiAI6DmRIZqfRjQ6tdV4mg70xzbRmwsaXgN+iboa+SXP6ILkziUf4g==",+ "deprecated": "CRITICAL SECURITY: upgrade to >=3.54.0",+ "license": "Apache-2.0",+ "dependencies": {+ "@bufbuild/protobuf": "^2.2.3",+ "@inngest/ai": "^0.1.3",+ "@jpwilliams/waitgroup": "^2.1.1",+ "@opentelemetry/api": "^1.9.0",+ "@opentelemetry/auto-instrumentations-node": ">=0.66.0 <1.0.0",+ "@opentelemetry/context-async-hooks": ">=2.0.0 <3.0.0",+ "@opentelemetry/exporter-trace-otlp-http": ">=0.200.0 <0.300.0",+ "@opentelemetry/instrumentation": ">=0.200.0 <0.300.0",+ "@opentelemetry/resources": ">=2.0.0 <3.0.0",+ "@opentelemetry/sdk-trace-base": ">=2.0.0 <3.0.0",+ "@standard-schema/spec": "^1.0.0",+ "@traceloop/instrumentation-anthropic": "^0.20.0",+ "@types/debug": "^4.1.12",+ "@types/ms": "~2.1.0",+ "canonicalize": "^1.0.8",+ "chalk": "^4.1.2",+ "cross-fetch": "^4.0.0",+ "debug": "^4.3.4",+ "hash.js": "^1.1.7",+ "json-stringify-safe": "^5.0.1",+ "ms": "^2.1.3",+ "serialize-error-cjs": "^0.1.3",+ "strip-ansi": "^5.2.0",+ "temporal-polyfill": "^0.2.5",+ "ulid": "^2.3.0",+ "zod": "^3.25.0"+ },+ "engines": {+ "node": ">=20"+ },+ "peerDependencies": {+ "@sveltejs/kit": ">=1.27.3",+ "@vercel/node": ">=2.15.9",+ "aws-lambda": ">=1.0.7",+ "express": ">=4.19.2",+ "fastify": ">=4.21.0",+ "h3": ">=1.8.1",+ "hono": ">=4.2.7",+ "koa": ">=2.14.2",+ "next": ">=12.0.0",+ "typescript": ">=5.8.0",+ "zod": "^3.25.0 || ^4.0.0"+ },+ "peerDependenciesMeta": {+ "@sveltejs/kit": {+ "optional": true+ },+ "@vercel/node": {+ "optional": true+ },+ "aws-lambda": {+ "optional": true+ },+ "express": {+ "optional": true+ },+ "fastify": {+ "optional": true+ },+ "h3": {+ "optional": true+ },+ "hono": {+ "optional": true+ },+ "koa": {+ "optional": true+ },+ "next": {+ "optional": true+ },+ "typescript": {+ "optional": true+ }+ }+ },"packages/jobs/node_modules/sst": {"version": "4.6.9","resolved": "https://registry.npmjs.org/sst/-/sst-4.6.9.tgz",diff --git a/packages/config/tailwind/tailwind.config.js b/packages/config/tailwind/tailwind.config.jsindex 8ad8ab361d..6fd161327f 100644--- a/packages/config/tailwind/tailwind.config.js+++ b/packages/config/tailwind/tailwind.config.js@@ -117,6 +117,10 @@ export default {from: { height: "var(--radix-accordion-content-height)" },to: { height: "0" },},+ dashflow: {+ from: { strokeDashoffset: "20" },+ to: { strokeDashoffset: "0" },+ },},animation: {"accordion-down": "accordion-down 0.2s ease-out",diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 266000f37a..3665b9a9c6 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -1492,7 +1492,7 @@ msgstr "Zurück"msgid "Back to home"msgstr "Zurück zur Startseite"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Zurück zur Rückverfolgbarkeit"@@ -2106,10 +2106,6 @@ msgstr "Chinesisch"msgid "Choose another file"msgstr "Wählen Sie eine andere Datei"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Wählen Sie einen Bereich aus, um fortzufahren"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Wählen Sie Ihre bevorzugte Sprache für die Benutzeroberfläche."@@ -2640,7 +2636,6 @@ msgstr "Link in die Zwischenablage kopiert"msgid "Copied!"msgstr "Kopiert!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Dokumentnamen kopieren"msgid "Copy document unique identifier"msgstr "Eindeutige Dokumentkennung kopieren"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Problemvorgangsnummer kopieren"@@ -2706,6 +2705,10 @@ msgstr "Eindeutige Kennung des Problems kopieren"msgid "Copy Job number"msgstr "Job-Nummer kopieren"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Link zum Verbrauchsmaterial kopieren"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Bei Wareneingang erfasst"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entitäten"@@ -6492,10 +6496,6 @@ msgstr "Inv. Zwischenabgrenzung"msgid "Invalid Invite"msgstr "Ungültige Einladung"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Ungültige Verfolgungsnummer"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Zeilen benötigen interne Teilenummern"msgid "Lines need prices or lead times"msgstr "Zeilen benötigen Preise oder Lieferzeiten"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Keine Problemtypen konfiguriert"msgid "No logo uploaded"msgstr "Kein Logo hochgeladen"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Keine Übereinstimmungen für \"{query}\". Versuchen Sie einen anderen Suchbegriff."@@ -9596,14 +9599,14 @@ msgstr "Auswählen"msgid "Pick a column to sort by"msgstr "Wählen Sie eine Spalte zum Sortieren"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Wählen Sie ein Datum oder lassen Sie es leer, um es zu löschen."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Wählen Sie einen Bereich aus, um aufgelöste Preise anzuzeigen und Preisüberschreibungen zu erstellen."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Pickliste"@@ -9861,6 +9864,7 @@ msgstr "Preisabstufungen"msgid "Price List"msgstr "Preisliste"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Preislisten"@@ -10667,6 +10671,7 @@ msgstr "Empfangsort"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Kürzlich"@@ -11608,14 +11613,18 @@ msgstr "Ansicht speichern"msgid "Scan"msgstr "Scannen"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Scannen oder Verfolgungsnummer eingeben"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Scannen oder geben Sie die Kennung der verfolgten Entität, Seriennummer oder Chargennummer ein"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Scannen oder wählen Sie eine nachverfölgte Entität aus diesem Los aus und erfassen Sie das Inspektionsergebnis."@@ -11717,6 +11726,10 @@ msgstr "Nach Linear-Issue-Titel suchen..."msgid "Search customers and types..."msgstr "Kunden und Typen durchsuchen..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Auswählen"msgid "Select a assignee"msgstr "Wählen Sie einen Bevollmächtigten"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Wählen Sie einen Kunden oder Kundentyp"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Wählen Sie einen Standard-Genehmiger"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Summe"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Rückverfolgbarkeit"diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 697de5a744..d64f35e521 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -1492,7 +1492,7 @@ msgstr "Back"msgid "Back to home"msgstr "Back to home"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Back to traceability"@@ -2106,10 +2106,6 @@ msgstr "Chinese"msgid "Choose another file"msgstr "Choose another file"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Choose scope to continue"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Choose your preferred language for the interface."@@ -2640,7 +2636,6 @@ msgstr "Copied link to clipboard"msgid "Copied!"msgstr "Copied!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Copy document name"msgid "Copy document unique identifier"msgstr "Copy document unique identifier"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr "Copy ID"+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Copy issue number"@@ -2706,6 +2705,10 @@ msgstr "Copy issue unique identifier"msgid "Copy Job number"msgstr "Copy Job number"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr "Copy link"+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Copy link to consumable"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Entered At Receipt"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entities"@@ -6492,10 +6496,6 @@ msgstr "Inv. Interim Accrual"msgid "Invalid Invite"msgstr "Invalid Invite"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Invalid tracking number"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Lines need internal part numbers"msgid "Lines need prices or lead times"msgstr "Lines need prices or lead times"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "No issue types configured"msgid "No logo uploaded"msgstr "No logo uploaded"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr "No matches"+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "No matches for \"{query}\". Try a different search term."@@ -9596,14 +9599,14 @@ msgstr "Pick"msgid "Pick a column to sort by"msgstr "Pick a column to sort by"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr "Pick a customer or customer type to view their pricing."+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Pick a date or leave blank to clear it."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Pick a scope to view resolved prices and create price overrides."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Pick List"@@ -9861,6 +9864,7 @@ msgstr "Price Breaks"msgid "Price List"msgstr "Price List"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Price Lists"@@ -10667,6 +10671,7 @@ msgstr "Receiving Location"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Recent"@@ -11608,14 +11613,18 @@ msgstr "Save View"msgid "Scan"msgstr "Scan"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Scan or enter a tracking number"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr "Scan a label or search by ID, serial number, or batch number."#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Scan or enter tracked entity ID, serial, or batch"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr "Scan or search..."+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Scan or select a tracked entity from this lot and record the inspection result."@@ -11717,6 +11726,10 @@ msgstr "Search by linear issue title..."msgid "Search customers and types..."msgstr "Search customers and types..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr "Search customers or types..."+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Select"msgid "Select a assignee"msgstr "Select a assignee"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Select a customer or customer type"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Select a default approver"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Totaling"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Traceability"diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex 6710cb1134..cc2809dc61 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -1492,7 +1492,7 @@ msgstr "Atrás"msgid "Back to home"msgstr "Volver al inicio"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Volver a trazabilidad"@@ -2106,10 +2106,6 @@ msgstr "Chino"msgid "Choose another file"msgstr "Elegir otro archivo"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Elige un alcance para continuar"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Elige tu idioma preferido para la interfaz."@@ -2640,7 +2636,6 @@ msgstr "Enlace copiado al portapapeles"msgid "Copied!"msgstr "¡Copiado!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Copiar nombre del documento"msgid "Copy document unique identifier"msgstr "Copiar identificador único del documento"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Copiar número de incidencia"@@ -2706,6 +2705,10 @@ msgstr "Copiar identificador único del problema"msgid "Copy Job number"msgstr "Copiar número de trabajo"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Copiar enlace al consumible"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Ingresado en la Recepción"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entidades"@@ -6492,10 +6496,6 @@ msgstr "Inv. Acumulación Provisional"msgid "Invalid Invite"msgstr "Invitación Inválida"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Número de seguimiento inválido"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Las líneas necesitan números de parte internos"msgid "Lines need prices or lead times"msgstr "Las líneas necesitan precios o tiempos de entrega"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "No hay tipos de problemas configurados"msgid "No logo uploaded"msgstr "Sin logo cargado"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "No hay coincidencias para \"{query}\". Intenta un término de búsqueda diferente."@@ -9596,14 +9599,14 @@ msgstr "Seleccionar"msgid "Pick a column to sort by"msgstr "Elige una columna para ordenar"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Elige una fecha o déjala en blanco para borrarla."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Selecciona un alcance para ver los precios resueltos y crear anulaciones de precios."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Lista de Picking"@@ -9861,6 +9864,7 @@ msgstr "Desgloses de Precio"msgid "Price List"msgstr "Lista de Precios"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Listas de Precios"@@ -10667,6 +10671,7 @@ msgstr "Ubicación de Recepción"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Reciente"@@ -11608,14 +11613,18 @@ msgstr "Guardar Vista"msgid "Scan"msgstr "Escanear"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Escanear o ingresar un número de seguimiento"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Escanear o ingresar ID de entidad rastreada, serie o lote"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Escanea o selecciona una entidad rastreada de este lote y registra el resultado de la inspección."@@ -11717,6 +11726,10 @@ msgstr "Buscar por título de problema de Linear..."msgid "Search customers and types..."msgstr "Buscar clientes y tipos..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Seleccionar"msgid "Select a assignee"msgstr "Seleccionar un asignado"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Selecciona un cliente o tipo de cliente"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Selecciona un aprobador predeterminado"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Totalización"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Trazabilidad"diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex 14486c65f5..8ca24f6dcf 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -1492,7 +1492,7 @@ msgstr "Retour"msgid "Back to home"msgstr "Retour à l'accueil"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Retour à la traçabilité"@@ -2106,10 +2106,6 @@ msgstr "Chinois"msgid "Choose another file"msgstr "Choisir un autre fichier"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Choisir une portée pour continuer"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Choisissez votre langue préférée pour l'interface."@@ -2640,7 +2636,6 @@ msgstr "Lien copié dans le presse-papiers"msgid "Copied!"msgstr "Copié !"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Copier le nom du document"msgid "Copy document unique identifier"msgstr "Copier l'identifiant unique du document"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Copier le numéro du problème"@@ -2706,6 +2705,10 @@ msgstr "Copier l'identifiant unique du problème"msgid "Copy Job number"msgstr "Copier le numéro de travail"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Copier le lien vers le consommable"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Saisi à la réception"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entités"@@ -6492,10 +6496,6 @@ msgstr "Inv. Régularisation Intermédiaire"msgid "Invalid Invite"msgstr "Invitation invalide"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Numéro de suivi invalide"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Les lignes ont besoin de numéros de pièces internes"msgid "Lines need prices or lead times"msgstr "Les lignes ont besoin de prix ou de délais"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Aucun type de problème configuré"msgid "No logo uploaded"msgstr "Aucun logo téléchargé"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Aucune correspondance pour « {query} ». Essayez un terme de recherche différent."@@ -9596,14 +9599,14 @@ msgstr "Prélever"msgid "Pick a column to sort by"msgstr "Choisir une colonne pour trier"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Choisissez une date ou laissez vide pour l'effacer."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Choisissez une portée pour afficher les prix résolus et créer des remplacements de prix."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Liste de prélèvement"@@ -9861,6 +9864,7 @@ msgstr "Tranches de prix"msgid "Price List"msgstr "Liste de prix"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Listes de prix"@@ -10667,6 +10671,7 @@ msgstr "Lieu de réception"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Récent"@@ -11608,14 +11613,18 @@ msgstr "Enregistrer la vue"msgid "Scan"msgstr "Numériser"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Scannez ou entrez un numéro de suivi"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Scannez ou entrez l'ID d'entité suivie, le numéro de série ou le lot"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Scannez ou sélectionnez une entité suivie de ce lot et enregistrez le résultat de l'inspection."@@ -11717,6 +11726,10 @@ msgstr "Rechercher par titre de problème linear..."msgid "Search customers and types..."msgstr "Rechercher les clients et les types..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Sélectionner"msgid "Select a assignee"msgstr "Sélectionner un assigné"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Sélectionnez un client ou un type de client"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Sélectionner un approbateur par défaut"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Totalisation"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Traçabilité"diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex 2ee3fb590b..fbdf0f1a39 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -1492,7 +1492,7 @@ msgstr "वापस"msgid "Back to home"msgstr "घर वापस जाएं"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "ट्रेसेबिलिटी पर वापस जाएं"@@ -2106,10 +2106,6 @@ msgstr "चीनी"msgid "Choose another file"msgstr "दूसरी फ़ाइल चुनें"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "जारी रखने के लिए स्कोप चुनें"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "अपनी पसंद की भाषा इंटरफेस के लिए चुनें।"@@ -2640,7 +2636,6 @@ msgstr "क्लिपबोर्ड में लिंक कॉपी कmsgid "Copied!"msgstr "कॉपी किया गया!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "दस्तावेज़ का नाम कॉपी करें"msgid "Copy document unique identifier"msgstr "दस्तावेज़ की अद्वितीय पहचान की प्रतिलिपि बनाएँ"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "समस्या संख्या कॉपी करें"@@ -2706,6 +2705,10 @@ msgstr "समस्या की अद्वितीय पहचान कmsgid "Copy Job number"msgstr "जॉब नंबर कॉपी करें"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "उपभोग्य के लिए लिंक कॉपी करें"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "रसीद पर दर्ज"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "संस्थाएं"@@ -6492,10 +6496,6 @@ msgstr "इन्व. अंतरिम संचय"msgid "Invalid Invite"msgstr "अमान्य निमंत्रण"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "अमान्य ट्रैकिंग नंबर"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "लाइनों को आंतरिक भाग संख्यmsgid "Lines need prices or lead times"msgstr "लाइनों को कीमतों या लीड समय की आवश्यकता है"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "कोई समस्या प्रकार कॉन्फ़िगmsgid "No logo uploaded"msgstr "कोई लोगो अपलोड नहीं किया गया"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "\"{query}\" के लिए कोई मिलान नहीं। एक अलग खोज शब्द आजमाएं।"@@ -9596,14 +9599,14 @@ msgstr "चुनें"msgid "Pick a column to sort by"msgstr "सॉर्ट करने के लिए एक कॉलम चुनें"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "एक तारीख चुनें या इसे साफ करने के लिए खाली छोड़ें।"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "एक स्कोप चुनें ताकि आप समाधान की गई कीमतें देख सकें और कीमत ओवरराइड बना सकें।"-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "पिक लिस्ट"@@ -9861,6 +9864,7 @@ msgstr "मूल्य ब्रेक"msgid "Price List"msgstr "मूल्य सूची"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "मूल्य सूचियाँ"@@ -10667,6 +10671,7 @@ msgstr "प्राप्ति स्थान"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "हाल ही में"@@ -11608,14 +11613,18 @@ msgstr "दृश्य सहेजें"msgid "Scan"msgstr "स्कैन करें"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "ट्रैकिंग नंबर स्कैन करें या दर्ज करें"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "ट्रैक किए गए इकाई ID, सीरीज़ या बैच को स्कैन करें या दर्ज करें"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "इस लॉट से एक ट्रैक किए गए इकाई को स्कैन या चुनें और निरीक्षण परिणाम रिकॉर्ड करें।"@@ -11717,6 +11726,10 @@ msgstr "Linear समस्या शीर्षक द्वारा खोmsgid "Search customers and types..."msgstr "ग्राहकों और प्रकारों को खोजें..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "चुनें"msgid "Select a assignee"msgstr "एक असाइनी चुनें"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "एक ग्राहक या ग्राहक प्रकार चुनें"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "एक डिफ़ॉल्ट अनुमोदक चुनें"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "कुल"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "ट्रेसेबिलिटी"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex b09f103e2d..41e7320e35 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -1492,7 +1492,7 @@ msgstr "Indietro"msgid "Back to home"msgstr "Torna alla home"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Torna alla tracciabilità"@@ -2106,10 +2106,6 @@ msgstr "Cinese"msgid "Choose another file"msgstr "Scegli un altro file"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Scegli ambito per continuare"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Scegli la tua lingua preferita per l'interfaccia."@@ -2640,7 +2636,6 @@ msgstr "Collegamento copiato negli appunti"msgid "Copied!"msgstr "Copiato!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Copia nome documento"msgid "Copy document unique identifier"msgstr "Copia identificatore univoco documento"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Copia numero segnalazione"@@ -2706,6 +2705,10 @@ msgstr "Copia identificatore univoco del problema"msgid "Copy Job number"msgstr "Copia numero lavoro"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Copia il collegamento al consumabile"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Inserito al Ricevimento"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entità"@@ -6492,10 +6496,6 @@ msgstr "Inv. Ratei Intermedi"msgid "Invalid Invite"msgstr "Invito Non Valido"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Numero di tracciamento non valido"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Le righe necessitano di numeri di parte interni"msgid "Lines need prices or lead times"msgstr "Le righe necessitano di prezzi o tempi di consegna"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Nessun tipo di problema configurato"msgid "No logo uploaded"msgstr "Nessun logo caricato"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Nessuna corrispondenza per \"{query}\". Prova un termine di ricerca diverso."@@ -9596,14 +9599,14 @@ msgstr "Preleva"msgid "Pick a column to sort by"msgstr "Scegli una colonna per ordinare"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Scegli una data o lascia vuoto per cancellarla."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Seleziona un ambito per visualizzare i prezzi risolti e creare override di prezzo."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Elenco di prelievo"@@ -9861,6 +9864,7 @@ msgstr "Scaglioni di Prezzo"msgid "Price List"msgstr "Listino Prezzi"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Listini Prezzi"@@ -10667,6 +10671,7 @@ msgstr "Ubicazione di ricezione"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Recenti"@@ -11608,14 +11613,18 @@ msgstr "Salva Vista"msgid "Scan"msgstr "Scansiona"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Scansiona o inserisci un numero di tracciamento"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Scansiona o inserisci ID entità tracciata, numero di serie o lotto"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Scansiona o seleziona un'entità tracciata da questo lotto e registra il risultato dell'ispezione."@@ -11717,6 +11726,10 @@ msgstr "Cerca per titolo problema linear..."msgid "Search customers and types..."msgstr "Cerca clienti e tipi..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Seleziona"msgid "Select a assignee"msgstr "Seleziona un assegnatario"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Seleziona un cliente o un tipo di cliente"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Seleziona un approvatore predefinito"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Totalizzazione"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Tracciabilità"diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex 58a85de1e2..55218504c0 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -1492,7 +1492,7 @@ msgstr "戻る"msgid "Back to home"msgstr "ホームに戻る"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "トレーサビリティに戻る"@@ -2106,10 +2106,6 @@ msgstr "中国語"msgid "Choose another file"msgstr "別のファイルを選択"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "スコープを選択して続行"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "インターフェースの言語を選択してください。"@@ -2640,7 +2636,6 @@ msgstr "クリップボードにリンクをコピーしました"msgid "Copied!"msgstr "コピーしました!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "ドキュメント名をコピー"msgid "Copy document unique identifier"msgstr "ドキュメントの一意の識別子をコピー"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "課題番号をコピー"@@ -2706,6 +2705,10 @@ msgstr "問題の一意の識別子をコピー"msgid "Copy Job number"msgstr "ジョブ番号をコピー"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "消耗品へのリンクをコピー"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "受領時に入力"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "エンティティ"@@ -6492,10 +6496,6 @@ msgstr "在庫中間見越計上"msgid "Invalid Invite"msgstr "無効な招待"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "無効な追跡番号"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "ラインには内部部品番号が必要です"msgid "Lines need prices or lead times"msgstr "ラインには価格またはリードタイムが必要です"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "問題タイプが設定されていません"msgid "No logo uploaded"msgstr "ロゴがアップロードされていません"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "\"{query}\"に一致するものがありません。別の検索用語を試してください。"@@ -9596,14 +9599,14 @@ msgstr "ピック"msgid "Pick a column to sort by"msgstr "ソート対象の列を選択"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "日付を選択するか、空白のままにしてクリアしてください。"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "スコープを選択して、解決済みの価格を表示し、価格オーバーライドを作成します。"-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "ピッキングリスト"@@ -9861,6 +9864,7 @@ msgstr "価格ブレーク"msgid "Price List"msgstr "価格リスト"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "価格リスト"@@ -10667,6 +10671,7 @@ msgstr "受取場所"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "最近"@@ -11608,14 +11613,18 @@ msgstr "ビューを保存"msgid "Scan"msgstr "スキャン"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "スキャンまたは追跡番号を入力してください"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "スキャンするか、追跡対象エンティティID、シリアル番号、またはバッチ番号を入力してください"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "このロットから追跡対象エンティティをスキャンまたは選択し、検査結果を記録してください。"@@ -11717,6 +11726,10 @@ msgstr "Linear イシュータイトルで検索..."msgid "Search customers and types..."msgstr "顧客とタイプを検索..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "選択"msgid "Select a assignee"msgstr "担当者を選択"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "顧客または顧客タイプを選択"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "デフォルト承認者を選択"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "合計"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "トレーサビリティ"diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex 5f20c68dac..71df22da53 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -1492,7 +1492,7 @@ msgstr "Wstecz"msgid "Back to home"msgstr "Powrót do strony głównej"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Wróć do śledzenia"@@ -2106,10 +2106,6 @@ msgstr "Chiński"msgid "Choose another file"msgstr "Wybierz inny plik"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Wybierz zakres, aby kontynuować"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Wybierz preferowany język interfejsu."@@ -2640,7 +2636,6 @@ msgstr "Skopiowano link do schowka"msgid "Copied!"msgstr "Skopiowano!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Skopiuj nazwę dokumentu"msgid "Copy document unique identifier"msgstr "Skopiuj unikalny identyfikator dokumentu"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Skopiuj numer problemu"@@ -2706,6 +2705,10 @@ msgstr "Skopiuj unikalny identyfikator problemu"msgid "Copy Job number"msgstr "Skopiuj numer zadania"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Skopiuj link do materiału"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Wprowadzono przy odbiorze"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Jednostki"@@ -6492,10 +6496,6 @@ msgstr "Przych. Przejściowe Rozliczenia"msgid "Invalid Invite"msgstr "Nieprawidłowe zaproszenie"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Nieprawidłowy numer śledzenia"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Linie wymagają wewnętrznych numerów części"msgid "Lines need prices or lead times"msgstr "Linie wymagają cen lub czasów realizacji"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Brak skonfigurowanych typów problemów"msgid "No logo uploaded"msgstr "Nie przesłano logo"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Brak wyników dla „{query}\". Spróbuj innego terminu wyszukiwania."@@ -9596,14 +9599,14 @@ msgstr "Wybierz"msgid "Pick a column to sort by"msgstr "Wybierz kolumnę do sortowania"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Wybierz datę lub pozostaw puste pole, aby je wyczyścić."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Wybierz zakres, aby wyświetlić rozliczone ceny i utworzyć zastąpienia cen."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Lista pobrania"@@ -9861,6 +9864,7 @@ msgstr "Progi cenowe"msgid "Price List"msgstr "Lista cen"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Cenniki"@@ -10667,6 +10671,7 @@ msgstr "Lokalizacja odbioru"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Ostatnie"@@ -11608,14 +11613,18 @@ msgstr "Zapisz Widok"msgid "Scan"msgstr "Skanuj"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Skanuj lub wpisz numer śledzenia"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Skanuj lub wprowadź identyfikator śledzonej jednostki, numer seryjny lub partię"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Skanuj lub wybierz śledzony element z tej partii i zapisz wynik inspekcji."@@ -11717,6 +11726,10 @@ msgstr "Szukaj po tytule problemu Linear..."msgid "Search customers and types..."msgstr "Wyszukaj klientów i typy..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Wybierz"msgid "Select a assignee"msgstr "Wybierz osobę przydzieloną"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Wybierz klienta lub typ klienta"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Wybierz domyślnego zatwierdzającego"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Razem"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Możliwość śledzenia"diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex adeb740b7b..0862673710 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -1492,7 +1492,7 @@ msgstr "Voltar"msgid "Back to home"msgstr "Voltar para casa"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Voltar para rastreabilidade"@@ -2106,10 +2106,6 @@ msgstr "Chinês"msgid "Choose another file"msgstr "Escolher outro arquivo"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Escolha um escopo para continuar"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Escolha seu idioma preferido para a interface."@@ -2640,7 +2636,6 @@ msgstr "Link copiado para a área de transferência"msgid "Copied!"msgstr "Copiado!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Copiar nome do documento"msgid "Copy document unique identifier"msgstr "Copiar identificador único do documento"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Copiar número do problema"@@ -2706,6 +2705,10 @@ msgstr "Copiar identificador único do problema"msgid "Copy Job number"msgstr "Copiar número do trabalho"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Copiar link para consumível"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Inserido no Recebimento"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Entidades"@@ -6492,10 +6496,6 @@ msgstr "Inv. Accrual Interim"msgid "Invalid Invite"msgstr "Convite Inválido"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Número de rastreamento inválido"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "As linhas precisam de números de peça internos"msgid "Lines need prices or lead times"msgstr "As linhas precisam de preços ou prazos de entrega"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Nenhum tipo de problema configurado"msgid "No logo uploaded"msgstr "Nenhum logo enviado"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Nenhuma correspondência para \"{query}\". Tente um termo de pesquisa diferente."@@ -9596,14 +9599,14 @@ msgstr "Selecionar"msgid "Pick a column to sort by"msgstr "Escolha uma coluna para ordenar"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Escolha uma data ou deixe em branco para limpar."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Escolha um escopo para visualizar preços resolvidos e criar substituições de preço."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Lista de Coleta"@@ -9861,6 +9864,7 @@ msgstr "Quebras de Preço"msgid "Price List"msgstr "Lista de Preços"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Listas de Preços"@@ -10667,6 +10671,7 @@ msgstr "Local de Recebimento"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Recente"@@ -11608,14 +11613,18 @@ msgstr "Guardar Visualização"msgid "Scan"msgstr "Digitalizar"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Digitalize ou insira um número de rastreamento"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Digitalize ou insira ID da entidade rastreada, série ou lote"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Digitalize ou selecione uma entidade rastreada deste lote e registre o resultado da inspeção."@@ -11717,6 +11726,10 @@ msgstr "Pesquisar por título do problema Linear..."msgid "Search customers and types..."msgstr "Pesquisar clientes e tipos..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Selecionar"msgid "Select a assignee"msgstr "Selecione um responsável"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Selecione um cliente ou tipo de cliente"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Selecione um aprovador padrão"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Totalização"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Rastreabilidade"diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex fbf81391e1..c8828ca8ad 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -1492,7 +1492,7 @@ msgstr "Назад"msgid "Back to home"msgstr "Вернуться на главную"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "Вернуться к отслеживанию"@@ -2106,10 +2106,6 @@ msgstr "Китайский"msgid "Choose another file"msgstr "Выбрать другой файл"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "Выберите область для продолжения"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "Выберите предпочитаемый язык для интерфейса."@@ -2640,7 +2636,6 @@ msgstr "Ссылка скопирована в буфер обмена"msgid "Copied!"msgstr "Скопировано!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "Копировать имя документа"msgid "Copy document unique identifier"msgstr "Скопировать уникальный идентификатор документа"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "Скопировать номер проблемы"@@ -2706,6 +2705,10 @@ msgstr "Скопировать уникальный идентификаторmsgid "Copy Job number"msgstr "Скопировать номер задания"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "Скопировать ссылку на расходный материал"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "Введено при получении"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "Сущности"@@ -6492,10 +6496,6 @@ msgstr "Пром. Промежуточное начисление"msgid "Invalid Invite"msgstr "Недействительное приглашение"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "Неверный номер отслеживания"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "Строки требуют внутренние номера деталmsgid "Lines need prices or lead times"msgstr "Строки требуют цены или сроки поставки"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "Типы проблем не настроены"msgid "No logo uploaded"msgstr "Логотип не загружен"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "Нет совпадений для \"{query}\". Попробуйте другой поисковый запрос."@@ -9596,14 +9599,14 @@ msgstr "Выбрать"msgid "Pick a column to sort by"msgstr "Выберите столбец для сортировки"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "Выберите дату или оставьте пустым, чтобы очистить."-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "Выберите область для просмотра разрешённых цен и создания переопределений цен."-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "Список подбора"@@ -9861,6 +9864,7 @@ msgstr "Ценовые диапазоны"msgid "Price List"msgstr "Прайс-лист"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "Прайс-листы"@@ -10667,6 +10671,7 @@ msgstr "Место получения"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "Недавние"@@ -11608,14 +11613,18 @@ msgstr "Сохранить представление"msgid "Scan"msgstr "Сканировать"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "Отсканируйте или введите номер отслеживания"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "Отсканируйте или введите ID отслеживаемого объекта, серийный номер или партию"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "Отсканируйте или выберите отслеживаемый объект из этой партии и запишите результат проверки."@@ -11717,6 +11726,10 @@ msgstr "Поиск по названию задачи Linear..."msgid "Search customers and types..."msgstr "Поиск клиентов и типов..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "Выбрать"msgid "Select a assignee"msgstr "Выберите исполнителя"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "Выберите клиента или тип клиента"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "Выберите утверждающего по умолчанию"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "Итого"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "Отслеживаемость"diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex 45d30b52e2..544dd2c01d 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -1492,7 +1492,7 @@ msgstr "返回"msgid "Back to home"msgstr "返回主页"-#: apps/erp/app/routes/x+/traceability+/graph.tsx:278+#: apps/erp/app/routes/x+/traceability+/graph.tsx:226msgid "Back to traceability"msgstr "返回可追溯性"@@ -2106,10 +2106,6 @@ msgstr "中文"msgid "Choose another file"msgstr "选择另一个文件"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:35-msgid "Choose scope to continue"-msgstr "选择范围以继续"-#: apps/erp/app/modules/account/ui/Profile/ProfileLanguageForm.tsx:53msgid "Choose your preferred language for the interface."msgstr "选择您偏好的界面语言。"@@ -2640,7 +2636,6 @@ msgstr "已复制链接到剪贴板"msgid "Copied!"msgstr "已复制!"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:407#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:155#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:154#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:196@@ -2694,6 +2689,10 @@ msgstr "复制文档名称"msgid "Copy document unique identifier"msgstr "复制文档唯一标识符"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:216+msgid "Copy ID"+msgstr ""+#: apps/erp/app/modules/quality/ui/Issue/IssueProperties.tsx:227msgid "Copy issue number"msgstr "复制问题编号"@@ -2706,6 +2705,10 @@ msgstr "复制问题唯一标识符"msgid "Copy Job number"msgstr "复制工作单号"+#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilitySidebar.tsx:202+msgid "Copy link"+msgstr ""+#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:187msgid "Copy link to consumable"msgstr "复制消耗品链接"@@ -5041,6 +5044,7 @@ msgid "Entered At Receipt"msgstr "在收货时输入"#: apps/erp/app/modules/settings/ui/AuditLog/AuditLogTable.tsx:208+#: apps/erp/app/routes/x+/traceability+/_index.tsx:174msgid "Entities"msgstr "实体"@@ -6492,10 +6496,6 @@ msgstr "库存中期应计"msgid "Invalid Invite"msgstr "无效邀请"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:45-msgid "Invalid tracking number"-msgstr "无效的追踪号码"-#: apps/erp/app/components/Form/ConversionFactor.tsx:274#: apps/erp/app/components/Form/ConversionFactor.tsx:299#: apps/erp/app/hooks/useModules.tsx:52@@ -7213,7 +7213,6 @@ msgstr "行需要内部零件号"msgid "Lines need prices or lead times"msgstr "行需要价格或交期"-#: apps/erp/app/modules/inventory/ui/Traceability/TraceabilityGraph.tsx:391#: apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx:134#: apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceProperties.tsx:133#: apps/erp/app/modules/items/ui/Consumables/ConsumableProperties.tsx:173@@ -8731,6 +8730,10 @@ msgstr "未配置问题类型"msgid "No logo uploaded"msgstr "未上传徽标"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:187+msgid "No matches"+msgstr ""+#: apps/erp/app/components/Layout/Topbar/Search/SearchEmptyState.tsx:46msgid "No matches for \"{query}\". Try a different search term."msgstr "没有匹配\"{query}\"的结果。请尝试不同的搜索词。"@@ -9596,14 +9599,14 @@ msgstr "拣选"msgid "Pick a column to sort by"msgstr "选择要排序的列"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:23+msgid "Pick a customer or customer type to view their pricing."+msgstr ""+#: apps/erp/app/modules/inventory/ui/Traceability/EditExpiryModal.tsx:78msgid "Pick a date or leave blank to clear it."msgstr "选择日期或留空以清除。"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:27-msgid "Pick a scope to view resolved prices and create price overrides."-msgstr "选择范围以查看已解决的价格并创建价格覆盖。"-#: apps/erp/app/modules/inventory/ui/StockTransfers/StockTransferHeader.tsx:142msgid "Pick List"msgstr "拣货单"@@ -9861,6 +9864,7 @@ msgstr "价格阶梯"msgid "Price List"msgstr "价格表"+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:22#: apps/erp/app/modules/sales/ui/useSalesSubmodules.tsx:73msgid "Price Lists"msgstr "价格表"@@ -10667,6 +10671,7 @@ msgstr "收货地点"#: apps/erp/app/components/Layout/Topbar/Search.tsx:223#: apps/erp/app/modules/documents/ui/useDocumentsSubmodules.tsx:28+#: apps/erp/app/routes/x+/traceability+/_index.tsx:193msgid "Recent"msgstr "最近"@@ -11608,14 +11613,18 @@ msgstr "保存视图"msgid "Scan"msgstr "扫描"-#: apps/erp/app/routes/x+/traceability+/_index.tsx:82-msgid "Scan or enter a tracking number"-msgstr "扫描或输入追踪号"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:153+msgid "Scan a label or search by ID, serial number, or batch number."+msgstr ""#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:137msgid "Scan or enter tracked entity ID, serial, or batch"msgstr "扫描或输入跟踪实体ID、序列号或批次号"+#: apps/erp/app/routes/x+/traceability+/_index.tsx:161+msgid "Scan or search..."+msgstr ""+#: apps/erp/app/modules/quality/ui/InboundInspections/ScanInspectionSample.tsx:100msgid "Scan or select a tracked entity from this lot and record the inspection result."msgstr "扫描或从此批次中选择一个追踪实体并记录检验结果。"@@ -11717,6 +11726,10 @@ msgstr "按线性问题标题搜索..."msgid "Search customers and types..."msgstr "搜索客户和类型..."+#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:31+msgid "Search customers or types..."+msgstr ""+#: apps/erp/app/modules/resources/ui/Training/TrainingAssignmentForm.tsx:210#: apps/erp/app/routes/x+/resources+/assignments.$trainingId.tsx:267msgid "Search employees..."@@ -11796,10 +11809,6 @@ msgstr "选择"msgid "Select a assignee"msgstr "选择受理人"-#: apps/erp/app/modules/sales/ui/Pricing/PriceListScopeEmpty.tsx:24-msgid "Select a customer or customer type"-msgstr "选择客户或客户类型"-#: apps/erp/app/modules/settings/ui/Approvals/ApprovalRuleForm.tsx:127msgid "Select a default approver"msgstr "选择默认审批人"@@ -13756,9 +13765,9 @@ msgid "Totaling"msgstr "合计"#: apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx:76-#: apps/erp/app/routes/x+/traceability+/_index.tsx:13-#: apps/erp/app/routes/x+/traceability+/graph.tsx:35-#: apps/erp/app/routes/x+/traceability+/graph.tsx:268+#: apps/erp/app/routes/x+/traceability+/_index.tsx:25+#: apps/erp/app/routes/x+/traceability+/_index.tsx:152+#: apps/erp/app/routes/x+/traceability+/graph.tsx:26msgid "Traceability"msgstr "可追溯性"diff --git a/packages/react/src/Command.tsx b/packages/react/src/Command.tsxindex bcbd8d0e12..5e1d150f1b 100644--- a/packages/react/src/Command.tsx+++ b/packages/react/src/Command.tsx@@ -35,7 +35,7 @@ interface CommandDialogProps extends DialogProps {}const CommandDialog = ({ children, ...props }: CommandDialogProps) => {return (<Modal {...props}>- <ModalContent className="overflow-hidden p-0">+ <ModalContent className="overflow-hidden p-0 [&>button[type=button]]:top-1 [&>button[type=button]]:right-2 [&>button[type=button]]:p-3"><Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">{children}</Command>