Lege am Dokument-Symbol an und gib zugeordnete Unterlagen in ein Kapitel zurueck, damit der Zug im Vorgang ankommt.
Deploy Development / deploy (push) Successful in 26s
Test Suite / pytest-backend (push) Successful in 1m58s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 13:11:44 +02:00
1 parent f8cb9f8d4b
commit 9b9a09b97c
2 files changed
+99 -35

No files matched your search

+81 -35
View File
@@ -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 (
<span
className={url ? "entry-mark entry-mark--photo" : "entry-mark"}
data-use-drop={dropId || undefined}
className={[url ? "entry-mark entry-mark--photo" : "entry-mark", hot ? "is-assign-hot" : ""].filter(Boolean).join(" ")}
data-assign-drop={dropId || undefined}
role={assignable ? "button" : undefined}
tabIndex={assignable ? 0 : undefined}
aria-label={assignable ? `${element.title} als Anlage oder Beleg ziehen` : undefined}
@@ -1104,20 +1104,29 @@ export function ContentBoard({
if (carried) {
event.preventDefault();
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
const release = event.target?.closest?.("[data-release-drop]");
if (release && (carried.source === "attachment" || carried.source === "evidence")) {
carried.useBindingId = "";
carried.release = true;
setIndicator({ kind: "release" });
return;
}
const row = event.target?.closest?.(".preview-row");
const useId = row?.getAttribute("data-binding") || "";
const blocked = !useId || useId === carried.bindingId || useId === carried.hostBindingId || carried.sourceNode?.contains(row);
const mark = event.target?.closest?.("[data-assign-drop]");
const useId = mark?.getAttribute("data-assign-drop") || "";
const blocked = !useId || useId === carried.bindingId || useId === carried.hostBindingId || carried.sourceNode?.contains(mark);
if (!blocked) {
carried.useBindingId = useId;
carried.release = false;
carried.place = false;
setIndicator({ kind: "use", bindingId: useId });
return;
}
if (carried.source === "attachment" || carried.source === "evidence") {
const section = event.target?.closest?.("[data-section]");
carried.useBindingId = "";
carried.release = true;
carried.place = Boolean(section);
carried.chapterId = section && section.getAttribute("data-section") !== "loose" ? section.getAttribute("data-section") : "";
const loose = !section || section.getAttribute("data-section") === "loose";
setIndicator({
kind: "release",
place: carried.place,
chapterId: carried.chapterId,
title: loose ? "" : (section.getAttribute("data-chapter-title") || ""),
});
}
return;
}
@@ -1151,15 +1160,22 @@ export function ContentBoard({
event.preventDefault();
if (carried.settled) return;
carried.settled = true;
const release = event.target?.closest?.("[data-release-drop]");
const row = event.target?.closest?.(".preview-row");
const useId = row?.getAttribute("data-binding") || carried.useBindingId || "";
const mark = event.target?.closest?.("[data-assign-drop]");
const useId = mark?.getAttribute("data-assign-drop") || "";
const section = event.target?.closest?.("[data-section]");
const assign = useId && useId !== carried.bindingId && useId !== carried.hostBindingId && !carried.sourceNode?.contains(mark);
carryRef.current = null;
setIndicator(null);
setCarrying(null);
document.body.classList.remove("is-carrying");
if (release && (carried.source === "attachment" || carried.source === "evidence")) releaseRef.current?.(carried);
else if (useId && useId !== carried.bindingId && useId !== carried.hostBindingId) placeUseRef.current?.(useId, carried);
if (assign) placeUseRef.current?.(useId, carried);
else if ((carried.source === "attachment" || carried.source === "evidence") && (section || event.target?.closest?.("[data-release-drop]"))) {
releaseRef.current?.({
...carried,
place: Boolean(section),
chapterId: section && section.getAttribute("data-section") !== "loose" ? section.getAttribute("data-section") : "",
});
}
return;
}
const drag = dragRef.current;
@@ -1575,38 +1591,57 @@ export function ContentBoard({
}
function hitAt(x, y) {
const nodes = document.elementsFromPoint(x, y);
if (nodes.some((node) => 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({
<div className={carrying ? "contents is-carrying" : "contents"} ref={rootRef}>
{carrying ? (
carrying.source === "attachment" || carrying.source === "evidence" ? (
<div className={indicator?.kind === "release" ? "release-lane is-hot" : "release-lane"} data-release-drop="1">
In den Vorgang legen
<div className={indicator?.kind === "release" && !indicator.place ? "release-lane is-hot" : "release-lane"} data-release-drop="1">
{indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"}
</div>
) : (
<div className="release-lane">Auf ein Schriftstück loslassen</div>
<div className="release-lane">Auf das Dokument-Symbol loslassen</div>
)
) : null}
<div className="content-toolbar">
@@ -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 ? <div className="insert-line" aria-hidden="true" /> : null}
@@ -2146,7 +2191,7 @@ export function ContentBoard({
const rowClass = [
"preview-row",
draggingId === binding.id ? "is-dragging" : "",
indicator?.kind === "use" && indicator.bindingId === binding.id ? "is-use-target" : "",
carrying && (binding.id === carrying.bindingId || binding.id === carrying.hostBindingId) ? "is-carry-source" : "",
selectedId === binding.id ? "is-selected" : "",
picking && picked.has(binding.id) ? "is-picked" : "",
picking ? "preview-row--picking" : "",
@@ -2224,7 +2269,8 @@ export function ContentBoard({
<EntryMark
element={element}
context={context}
assignable={false}
dropId={canEdit && (!carrying || (binding.id !== carrying.bindingId && binding.id !== carrying.hostBindingId)) ? binding.id : ""}
hot={indicator?.kind === "use" && indicator.bindingId === binding.id}
/>
<UnitDetail
binding={binding}
+18
View File
@@ -1364,6 +1364,24 @@ button.unit-switch[aria-expanded="true"] { color: var(--brand); }
-webkit-user-drag: none;
}
body.is-carrying, body.is-carrying * { user-select: none !important; cursor: grabbing; }
body.is-carrying .entry-mark[data-assign-drop] {
box-shadow: inset 0 0 0 2px var(--accent);
background: var(--accent-light);
cursor: copy;
}
body.is-carrying .entry-mark[data-assign-drop]::after {
content: "";
position: absolute;
inset: -8px;
}
.entry-mark.is-assign-hot {
box-shadow: inset 0 0 0 3px var(--accent);
background: #fff;
}
.content-section.is-release-target {
background: var(--accent-light);
box-shadow: inset 0 0 0 2px var(--accent);
}
.release-lane {
position: sticky;
top: 0;