Lege einen Beleg ohne Versandfassung ab und markiere das Zurueckziehen, damit der Drop an der Markierung ankommt und ein Nachweis kein E-Mail-Versand wird.
Deploy Development / deploy (push) Successful in 28s
Test Suite / pytest-backend (push) Successful in 2m0s
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 12:01:19 +02:00
1 parent 9f5327f3be
commit 7846830765
6 files changed
+241 -158

No files matched your search

+144 -79
View File
@@ -26,7 +26,6 @@ import {
scopeBody,
StructureAssignDialog,
UnitDetail,
writeAssign,
} from "./correspondence.jsx";
export function formatDate(value) {
@@ -890,12 +889,10 @@ function EntryMark({ element, context, assignable = false, dropId = "", onAssign
<span
className={url ? "entry-mark entry-mark--photo" : "entry-mark"}
data-use-drop={dropId || undefined}
draggable={assignable}
role={assignable ? "button" : undefined}
tabIndex={assignable ? 0 : undefined}
aria-label={assignable ? `${element.title} als Anlage oder Beleg ziehen` : undefined}
onDragStart={assignable ? onAssignStart : undefined}
onDragEnd={assignable ? onAssignEnd : undefined}
onPointerDown={assignable ? onAssignStart : undefined}
>
{url ? <img className="entry-mark__photo" alt="" draggable={false} src={url} /> : (
<>
@@ -1532,36 +1529,74 @@ export function ContentBoard({
}, 0);
}
function beginCarry(payload) {
carryRef.current = payload;
}
function endCarry(event) {
const carried = carryRef.current;
if (!carried) {
function beginCarryPointer(event, payload) {
if (pending || (event.button != null && event.button !== 0)) return;
if (event.target.closest("button, a, input, textarea, select")) return;
event.stopPropagation();
const carried = {
...payload,
pointerId: event.pointerId,
anchorX: event.clientX,
anchorY: event.clientY,
moved: false,
useBindingId: "",
sourceNode: event.target.closest?.("[data-carry], .entry-mark") || event.target,
};
function pointOf(pointer) {
return document.elementFromPoint(pointer.clientX, pointer.clientY);
}
function track(pointer) {
if (carryRef.current !== carried || pointer.pointerId !== carried.pointerId) return;
if (Math.hypot(pointer.clientX - carried.anchorX, pointer.clientY - carried.anchorY) > 4) {
carried.moved = true;
if (carried.sourceNode) carried.sourceNode.dataset.dragged = "1";
}
if (!carried.moved) return;
const hit = pointOf(pointer);
const useId = useDropId(hit);
const ownChip = hit?.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`);
if (useId && useId !== carried.bindingId) {
carried.useBindingId = useId;
setIndicator({ kind: "use", bindingId: useId });
return;
}
carried.useBindingId = "";
const inside = Boolean(hit && rootRef.current?.contains(hit));
if (inside && !ownChip && (carried.source === "attachment" || carried.source === "evidence")) {
setIndicator({ kind: "release" });
return;
}
setIndicator(null);
return;
}
carryRef.current = null;
setIndicator(null);
if (carried.settled) return;
carried.settled = true;
const x = event?.clientX || 0;
const y = event?.clientY || 0;
const pointOk = x > 0 || y > 0;
const moved = Math.hypot(x - (carried.anchorX || 0), y - (carried.anchorY || 0));
if (pointOk && moved < 8 && !carried.useBindingId) return;
const hit = pointOk ? document.elementFromPoint(x, y) : null;
if (hit && rootRef.current && !rootRef.current.contains(hit)) return;
if (!hit && !carried.useBindingId) return;
const useId = hit ? useDropId(hit) : (carried.useBindingId || "");
if (useId && useId !== carried.bindingId) {
placeUseRef.current?.(useId, carried);
return;
function finish(pointer) {
if (pointer && pointer.pointerId !== carried.pointerId) return;
window.removeEventListener("pointermove", track);
window.removeEventListener("pointerup", finish);
window.removeEventListener("pointercancel", finish);
if (carryRef.current !== carried) return;
carryRef.current = null;
setIndicator(null);
if (!carried.moved) return;
const hit = pointer ? pointOf(pointer) : null;
const useId = useDropId(hit) || carried.useBindingId;
if (useId && useId !== carried.bindingId) {
placeUseRef.current?.(useId, carried);
return;
}
const inside = Boolean(hit && rootRef.current?.contains(hit));
if (!inside) return;
if (hit.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`)) return;
if (carried.source === "attachment" || carried.source === "evidence") releaseRef.current?.(carried);
}
carryRef.current = carried;
window.addEventListener("pointermove", track);
window.addEventListener("pointerup", finish);
window.addEventListener("pointercancel", finish);
try {
carried.sourceNode.setPointerCapture?.(event.pointerId);
} catch {
// Window listeners still follow the pointer.
}
if (!hit || useId) return;
if (hit.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`)) return;
if (carried.source === "attachment" || carried.source === "evidence") releaseRef.current?.(carried);
}
function bindingByElement(elementId) {
@@ -1657,6 +1692,73 @@ export function ContentBoard({
}
}
async function placeReceipt(hostBinding, payload, element) {
if (!payload || payload.elementId === hostBinding.element.id) return;
const role = element?.external?.source === "imap" ? "email" : "other";
setPending(true);
setError("");
try {
const scope = correspondenceScope();
if (payload.source === "attachment") {
const from = bindingByElement(payload.hostElementId);
if (!from) return;
await api(`/api/v1/elements/${from.element.id}/attachments/${payload.elementId}/detach`, {
method: "POST",
body: { expected_version: from.element.version, ...scope },
});
}
if (payload.source === "evidence") {
const found = dispatchOf(payload.dispatchId);
if (!found) return;
await api(`/api/v1/dispatches/${found.dispatch.id}/evidence/${payload.elementId}/detach`, {
method: "POST",
body: { expected_version: found.dispatch.version, ...scope },
});
}
let expected = hostBinding.element.version;
if (payload.source === "attachment") {
const from = bindingByElement(payload.hostElementId);
if (from?.element.id === hostBinding.element.id) expected += 1;
}
const holder = (hostBinding.correspondence?.dispatches || []).find((item) => (
item.channel === "other"
&& !(item.items || []).some((part) => part.role === "host" || part.role === "attachment")
));
if (!holder) {
await api(`/api/v1/elements/${hostBinding.element.id}/dispatches`, {
method: "POST",
body: {
expected_version: expected,
channel: "other",
sent_on: null,
counterpart: null,
attachment_element_ids: [],
evidence: [{ element_id: payload.elementId, role, fold: "evidence" }],
historical_gap: false,
capture_editions: false,
...scope,
},
});
} else {
await api(`/api/v1/dispatches/${holder.id}/evidence`, {
method: "POST",
body: {
expected_version: holder.version,
element_id: payload.elementId,
role,
fold: "evidence",
...scope,
},
});
}
onChange();
} catch (err) {
setError(err.message);
} finally {
setPending(false);
}
}
function openPlace(hostBindingId, payload) {
const host = source.find((item) => item.id === hostBindingId);
if (!host || !payload || host.element.id === payload.elementId) return;
@@ -1692,7 +1794,8 @@ export function ContentBoard({
}
return (
<div className="contents" ref={rootRef}>
<div className={indicator?.kind === "release" ? "contents is-release-target" : "contents"} ref={rootRef}>
{indicator?.kind === "release" ? <div className="release-mark">In den Vorgang legen</div> : null}
<div className="content-toolbar">
<h2>{viewMode === "chronology" ? "Chronologie" : (activePath || listTitle || "Inhalte")} <span className="count">{shownCount}</span></h2>
<div className="content-toolbar__tools">
@@ -1812,33 +1915,8 @@ export function ContentBoard({
setDialog(null);
}}>Als Anlage</button>
<button type="button" disabled={pending} onClick={async () => {
const payload = dialog.payload;
if (payload.source === "attachment") {
const from = bindingByElement(payload.hostElementId);
if (from) {
setPending(true);
setError("");
try {
await api(`/api/v1/elements/${from.element.id}/attachments/${payload.elementId}/detach`, {
method: "POST",
body: { expected_version: from.element.version, ...correspondenceScope() },
});
} catch (err) {
setError(err.message);
setPending(false);
return;
}
setPending(false);
}
}
const found = payload.source === "evidence" ? dispatchOf(payload.dispatchId) : null;
setDialog({
type: "evidence",
binding: dialog.binding,
hosts: [dialog.host],
dispatchId: dialog.host.correspondence?.dispatches?.[0]?.id || "",
replace: found ? { dispatchId: found.dispatch.id, version: found.dispatch.version } : null,
});
await placeReceipt(dialog.host, dialog.payload, dialog.binding.element);
setDialog(null);
}}>Als Beleg</button>
<button type="button" className="quiet" onClick={() => setDialog(null)}>Abbrechen</button>
</div>
@@ -2033,32 +2111,19 @@ export function ContentBoard({
context={context}
dropId={canEdit ? binding.id : ""}
assignable={canEdit && !pending && !picking}
onAssignStart={(event) => {
event.stopPropagation();
beginCarry({
source: "list",
elementId: element.id,
bindingId: binding.id,
title: element.title,
anchorX: event.clientX,
anchorY: event.clientY,
});
writeAssign(event, {
source: "list",
elementId: element.id,
bindingId: binding.id,
title: element.title,
});
}}
onAssignEnd={endCarry}
onAssignStart={(event) => beginCarryPointer(event, {
source: "list",
elementId: element.id,
bindingId: binding.id,
title: element.title,
})}
/>
<UnitDetail
binding={binding}
canEdit={canEdit}
pending={pending}
scope={scopeBody(actionContext(), containerKind, containerId)}
onCarryStart={beginCarry}
onCarryEnd={endCarry}
onCarryStart={beginCarryPointer}
onOpen={(elementId) => {
const found = source.find((item) => item.element?.id === elementId);
if (found) onOpen?.(found);