From 9b9a09b97cc4fa72300fbe3a8f18d2dc9719ef9d Mon Sep 17 00:00:00 2001 From: Lars Date: Sun, 18 Oct 2026 13:11:44 +0200 Subject: [PATCH] Lege am Dokument-Symbol an und gib zugeordnete Unterlagen in ein Kapitel zurueck, damit der Zug im Vorgang ankommt. Co-authored-by: Cursor --- frontend/src/pages/content.jsx | 116 +++++++++++++++++++++++---------- frontend/src/styles.css | 18 +++++ 2 files changed, 99 insertions(+), 35 deletions(-) diff --git a/frontend/src/pages/content.jsx b/frontend/src/pages/content.jsx index 4beff5b..03cee3c 100644 --- a/frontend/src/pages/content.jsx +++ b/frontend/src/pages/content.jsx @@ -864,7 +864,7 @@ function useDropId(node) { return node?.closest?.("[data-use-drop]")?.getAttribute("data-use-drop") || ""; } -function EntryMark({ element, context, assignable = false, dropId = "", onAssignStart, onAssignEnd }) { +function EntryMark({ element, context, assignable = false, dropId = "", hot = false, onAssignStart, onAssignEnd }) { const symbol = elementSymbol(element); const photo = symbol === "image" && Boolean(element.preview?.available); const [url, setUrl] = useState(""); @@ -887,8 +887,8 @@ function EntryMark({ element, context, assignable = false, dropId = "", onAssign }, [photo, element.id, element.preview?.source, context?.kind, context?.id]); return ( node.closest?.("[data-release-drop]"))) return { release: true }; for (const node of nodes) { if (carried.sourceNode?.contains(node)) continue; - const row = node.closest?.(".preview-row"); - if (!row || carried.sourceNode?.contains(row)) continue; - const useId = row.getAttribute("data-binding") || ""; + const mark = node.closest?.("[data-assign-drop]"); + if (!mark || carried.sourceNode?.contains(mark)) continue; + const useId = mark.getAttribute("data-assign-drop") || ""; if (!useId || useId === carried.bindingId || useId === carried.hostBindingId) continue; return { useId }; } + if (carried.source !== "attachment" && carried.source !== "evidence") return {}; + if (nodes.some((node) => node.closest?.("[data-release-drop]"))) return { release: true, place: false, chapterId: "" }; + for (const node of nodes) { + if (carried.sourceNode?.contains(node)) continue; + const section = node.closest?.("[data-section]"); + if (!section || !rootRef.current?.contains(section)) continue; + const id = section.getAttribute("data-section") || ""; + return { + release: true, + place: true, + chapterId: id === "loose" ? "" : id, + title: id === "loose" ? "" : (section.getAttribute("data-chapter-title") || ""), + }; + } return {}; } function remember(x, y, sticky) { const found = hitAt(x, y); - if (found.release) { - carried.useBindingId = ""; - carried.release = true; - setIndicator({ kind: "release" }); - return; - } if (found.useId) { carried.useBindingId = found.useId; carried.release = false; + carried.place = false; + carried.chapterId = ""; setIndicator({ kind: "use", bindingId: found.useId }); return; } - if (sticky && carried.useBindingId) { + if (found.release) { + carried.useBindingId = ""; + carried.release = true; + carried.place = Boolean(found.place); + carried.chapterId = found.chapterId || ""; + setIndicator({ kind: "release", place: carried.place, chapterId: carried.chapterId, title: found.title || "" }); + return; + } + if (sticky && carried.useBindingId && !(x || y)) { carried.release = false; setIndicator({ kind: "use", bindingId: carried.useBindingId }); return; } carried.useBindingId = ""; carried.release = false; + carried.place = false; + carried.chapterId = ""; setIndicator(null); } function cleanup() { @@ -1667,7 +1702,9 @@ export function ContentBoard({ placeUseRef.current?.(useId, carried); return; } - if (release && (carried.source === "attachment" || carried.source === "evidence")) releaseRef.current?.(carried); + if (release && (carried.source === "attachment" || carried.source === "evidence")) { + releaseRef.current?.({ ...carried, place: carried.place, chapterId: carried.chapterId }); + } } carried.cancel = () => { if (carried.settled) return; @@ -1721,6 +1758,12 @@ export function ContentBoard({ if (item?.correspondence?.fold) { await restoreFold(item.id, item.element.version, scope); } + if (payload.place && item && (item.chapter_id || "") !== (payload.chapterId || "")) { + await api(`/api/v1/bindings/${item.id}/chapter`, { + method: "PATCH", + body: { expected_version: record.version, chapter_id: payload.chapterId || null, ...orderContext }, + }); + } onChange(); } catch (err) { setError(err.message); @@ -1881,11 +1924,11 @@ export function ContentBoard({
{carrying ? ( carrying.source === "attachment" || carrying.source === "evidence" ? ( -
- In den Vorgang legen +
+ {indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"}
) : ( -
Auf ein Schriftstück loslassen
+
Auf das Dokument-Symbol loslassen
) ) : null}
@@ -2049,6 +2092,7 @@ export function ContentBoard({ if (section.title) classes.push("content-section--group"); if (draggingId === section.id) classes.push("is-dragging"); if (!expanded) classes.push("is-collapsed"); + if (indicator?.kind === "release" && indicator.place && (indicator.chapterId || "loose") === section.id) classes.push("is-release-target"); const sameParent = (indicator?.parentId || "") === (section.parentId || ""); const insertBefore = indicator?.kind === "chapter" && sameParent && fromIndex > indicator.index && siblingIndex === indicator.index; const insertAfter = indicator?.kind === "chapter" && sameParent && fromIndex >= 0 && fromIndex < indicator.index && siblingIndex === indicator.index; @@ -2059,6 +2103,7 @@ export function ContentBoard({ className={classes.join(" ")} data-section={section.id} data-chapter={section.id === "loose" ? undefined : section.id} + data-chapter-title={section.title || ""} data-chapter-parent={section.parentId || ""} > {insertBefore ?