Oeffne den Leser aus der Anlagenliste und zeige einen Beleg mit seinem Datum, damit der Drop an der Markierung ankommt und kein Nachweis als undatierter Versand erscheint.
Deploy Development / deploy (push) Successful in 26s
Test Suite / pytest-backend (push) Successful in 1m36s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 9s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 12:24:14 +02:00
1 parent 7846830765
commit 7e8a3e865e
4 files changed
+74 -29

No files matched your search

+25 -2
View File
@@ -503,12 +503,26 @@ def export_children(conn, actor: UUID, binding: dict, page: Ctx) -> list[dict]:
)
if not children:
continue
sent = dump_date(dispatch["sent_on"]) or "undatiert"
item_rows = _item_rows(conn, dispatch["id"])
sent = dump_date(dispatch["sent_on"])
if item_rows:
title = f"Versand {sent or 'undatiert'} · {CHANNELS[dispatch['channel']]}"
label = "Versand"
else:
if not sent:
for proof in _evidence_rows(conn, dispatch["id"]):
dates = _dates(conn, proof["element_id"])
sent = dump_date(dates["document_on"]) or dump_date(dates["sent_on"])
if sent:
break
title = sent or "Beleg"
label = "Beleg"
nodes.append(
{
"id": f"dispatch:{dispatch['id']}",
"kind": "dispatch",
"title": f"Versand {sent} · {CHANNELS[dispatch['channel']]}",
"title": title,
"label": label,
"children": children,
"completeness": dispatch["completeness"],
"provenance": dispatch["provenance"],
@@ -1030,6 +1044,14 @@ def _public_dispatch(conn, actor: UUID, dispatch, page: Ctx) -> dict:
}
def _evidence_source(conn, element_id: UUID) -> str | None:
row = conn.execute(
"SELECT source FROM external_references WHERE element_id = %s",
(element_id,),
).fetchone()
return row["source"] if row else None
def _public_evidence(conn, proof, element, page: Ctx) -> dict:
del page
return {
@@ -1037,6 +1059,7 @@ def _public_evidence(conn, proof, element, page: Ctx) -> dict:
"element_id": str(element["id"]),
"title": element["title"],
"kind": element["kind"],
"source": _evidence_source(conn, element["id"]),
"role": proof["role"],
"role_label": EVIDENCE_ROLES[proof["role"]],
"source_state": proof["source_state"],
+1 -1
View File
@@ -392,7 +392,7 @@ def _spec_node(spec: dict) -> ExportNode:
reason=None,
content_kind=None,
children=[_spec_node(child) for child in spec["children"]],
label="Versand",
label=spec.get("label") or "Versand",
)
element = spec.get("element")
if spec["kind"] == "dispatch_item":
+38 -22
View File
@@ -1538,65 +1538,81 @@ export function ContentBoard({
pointerId: event.pointerId,
anchorX: event.clientX,
anchorY: event.clientY,
lastX: event.clientX,
lastY: event.clientY,
moved: false,
useBindingId: "",
release: false,
sourceNode: event.target.closest?.("[data-carry], .entry-mark") || event.target,
};
function pointOf(pointer) {
return document.elementFromPoint(pointer.clientX, pointer.clientY);
function pointOf(x, y) {
const stack = document.elementsFromPoint(x, y);
return stack.find((node) => node !== carried.sourceNode && !carried.sourceNode?.contains(node)) || null;
}
function track(pointer) {
if (carryRef.current !== carried || pointer.pointerId !== carried.pointerId) return;
if (Math.hypot(pointer.clientX - carried.anchorX, pointer.clientY - carried.anchorY) > 4) {
if (pointer.clientX || pointer.clientY) {
carried.lastX = pointer.clientX;
carried.lastY = pointer.clientY;
}
if (!carried.moved && Math.hypot(pointer.clientX - carried.anchorX, pointer.clientY - carried.anchorY) > 8) {
carried.moved = true;
if (carried.sourceNode) carried.sourceNode.dataset.dragged = "1";
try {
carried.sourceNode?.setPointerCapture?.(pointer.pointerId);
} catch {
// The window listeners still follow the pointer.
}
}
if (!carried.moved) return;
const hit = pointOf(pointer);
pointer.preventDefault();
const hit = pointOf(carried.lastX, carried.lastY);
const useId = useDropId(hit);
const ownChip = hit?.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`);
if (useId && useId !== carried.bindingId) {
carried.useBindingId = useId;
carried.release = false;
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")) {
carried.release = true;
setIndicator({ kind: "release" });
return;
}
carried.release = false;
setIndicator(null);
}
function finish(pointer) {
if (pointer && pointer.pointerId !== carried.pointerId) return;
window.removeEventListener("pointermove", track);
window.removeEventListener("pointerup", finish);
window.removeEventListener("pointercancel", finish);
if (pointer && pointer.pointerId !== carried.pointerId && pointer.pointerId !== 0) return;
window.removeEventListener("pointermove", track, true);
window.removeEventListener("pointerup", finish, true);
window.removeEventListener("pointercancel", finish, true);
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;
const x = pointer && (pointer.clientX || pointer.clientY) ? pointer.clientX : carried.lastX;
const y = pointer && (pointer.clientX || pointer.clientY) ? pointer.clientY : carried.lastY;
const hit = pointOf(x, y);
const useId = (useDropId(hit) && useDropId(hit) !== carried.bindingId ? useDropId(hit) : "") || carried.useBindingId;
if (useId && useId !== carried.bindingId) {
window.addEventListener("click", (click) => {
click.preventDefault();
click.stopPropagation();
}, { capture: true, once: true });
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.release) 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.
}
window.addEventListener("pointermove", track, true);
window.addEventListener("pointerup", finish, true);
window.addEventListener("pointercancel", finish, true);
}
function bindingByElement(elementId) {
@@ -1730,7 +1746,7 @@ export function ContentBoard({
body: {
expected_version: expected,
channel: "other",
sent_on: null,
sent_on: element?.dates?.sent_on || element?.dates?.document_on || null,
counterpart: null,
attachment_element_ids: [],
evidence: [{ element_id: payload.elementId, role, fold: "evidence" }],
+10 -4
View File
@@ -65,10 +65,16 @@ export function receiptRoleLabel(role, fallback = "") {
}
function receiptCaption(proof) {
if (proof.role === "email" && proof.kind === "file") return "Beleg";
if (proof.role === "email" && proof.source !== "imap") return "Beleg";
return receiptRoleLabel(proof.role, proof.role_label);
}
function receiptWhen(item) {
if (item.sent_on) return formatDate(item.sent_on);
const dated = (item.evidence || []).find((proof) => proof.document_on);
return dated ? formatDate(dated.document_on) : "";
}
function isShipment(item) {
const proofs = item.evidence || [];
if (item.channel === "other") return false;
@@ -78,9 +84,9 @@ function isShipment(item) {
function receiptHeading(item) {
const who = item.counterpart ? ` · ${item.counterpart}` : "";
if (!isShipment(item)) return `${item.sent_on ? formatDate(item.sent_on) : "Beleg"}${who}`;
const when = item.undated ? "undatiert" : formatDate(item.sent_on);
return `Versand ${when} · ${item.channel_label}${who}`;
const when = receiptWhen(item);
if (!isShipment(item)) return `${when || "Beleg"}${who}`;
return `Versand ${when || "undatiert"} · ${item.channel_label}${who}`;
}
export function writeAssign(event, payload) {