Halte die Richtung an der einzelnen Einbindung und mach sie in der Uebersicht waehlbar.
Deploy Development / deploy (push) Successful in 28s
Deploy Development / deploy (push) Successful in 28s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2664021e7f
commit
95381030bc
12 files changed
+185
-52
No files matched your search
@@ -1027,7 +1027,7 @@ def post_file(
|
||||
settings.media_root,
|
||||
settings.upload_max_bytes,
|
||||
request.state.cleanup_files,
|
||||
communication_direction if communication_direction in {"in", "out"} else None,
|
||||
communication_direction if communication_direction in {"in", "out", "local"} else None,
|
||||
)
|
||||
return _created(f"/api/v1/elements/{element['id']}", {"id": str(element["id"]), "title": element["title"]})
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class MatterMoveIn(APIModel):
|
||||
|
||||
class CommunicationIn(APIModel):
|
||||
expected_version: int = Field(ge=1)
|
||||
direction: Literal["in", "out"] | None = None
|
||||
direction: Literal["in", "out", "local"] | None = None
|
||||
context: ContextIn | None = None
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ class NoteIn(APIModel):
|
||||
placement: ContextIn | None = None
|
||||
chapter_id: UUID | None = None
|
||||
dates: DatesIn | None = None
|
||||
communication_direction: Literal["in", "out"] | None = None
|
||||
communication_direction: Literal["in", "out", "local"] | None = None
|
||||
|
||||
|
||||
class ContentOrderIn(APIModel):
|
||||
|
||||
+11
-5
@@ -665,10 +665,14 @@ def record_dates(conn, actor: UUID, scope_id: UUID, element_id: UUID, context: C
|
||||
audit(conn, actor, scope_id, "correspondence_recorded", "element", element_id, context)
|
||||
|
||||
|
||||
def chosen_direction(value: str | None) -> str | None:
|
||||
return value if value in ("in", "out", "local") else None
|
||||
|
||||
|
||||
def store_direction(conn, binding_id: UUID, direction: str | None, explicit: bool) -> None:
|
||||
if not explicit:
|
||||
return
|
||||
if direction not in (None, "in", "out"):
|
||||
if direction not in (None, "in", "out", "local"):
|
||||
raise unprocessable("Die Richtung ist ungültig.")
|
||||
conn.execute(
|
||||
"""
|
||||
@@ -703,7 +707,8 @@ def create_note(
|
||||
(element["id"], Json(document)),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
audit(conn, actor, scope_id, "note_created", "element", element["id"], rights_context or target)
|
||||
if document_on is not None or sent_on is not None or received_on is not None:
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
@@ -792,8 +797,8 @@ def create_external(conn, actor: UUID, scope_id: UUID, title: str, source: str,
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
adopted = (detail or {}).get("direction") if source == "imap" else None
|
||||
chosen = communication_direction if communication_direction in ("in", "out") else adopted if adopted in ("in", "out") else None
|
||||
store_direction(conn, binding["id"], chosen, chosen in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction) or (adopted if adopted in ("in", "out") else None)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "external_ref_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"]}
|
||||
@@ -837,7 +842,8 @@ def create_file(conn, actor: UUID, scope_id: UUID, title: str, filename: str, da
|
||||
(element["id"], asset_id),
|
||||
)
|
||||
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
|
||||
store_direction(conn, binding["id"], communication_direction, communication_direction in ("in", "out"))
|
||||
chosen = chosen_direction(communication_direction)
|
||||
store_direction(conn, binding["id"], chosen, chosen is not None)
|
||||
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
|
||||
audit(conn, actor, scope_id, "file_added", "element", element["id"], rights_context or target)
|
||||
return element | {"binding_id": binding["id"], "asset_id": asset_id}
|
||||
|
||||
@@ -198,7 +198,7 @@ def _exception(conn, kind: str, resource_id: UUID, context: Ctx | None) -> dict
|
||||
def communication_from_row(conn, binding: dict, element: dict) -> dict:
|
||||
"""Explicit binding direction wins. An adopted mailbox direction may prefill. Dates never do."""
|
||||
stored = binding.get("communication_direction")
|
||||
stored = stored if stored in ("in", "out") else None
|
||||
stored = stored if stored in ("in", "out", "local") else None
|
||||
if binding.get("direction_explicit"):
|
||||
return {"direction": stored, "explicit": True}
|
||||
source = None
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE bindings DROP CONSTRAINT bindings_communication_direction;
|
||||
|
||||
ALTER TABLE bindings
|
||||
ADD CONSTRAINT bindings_communication_direction
|
||||
CHECK (communication_direction IS NULL OR communication_direction IN ('in', 'out', 'local'));
|
||||
@@ -194,3 +194,65 @@ def test_chapter_and_matter_can_be_renamed_and_moved(client, db):
|
||||
json={"expected_version": ada.request("GET", f"/api/v1/cases/{case['id']}")["version"]},
|
||||
)
|
||||
ada.request("GET", f"/api/v1/cases/{case['id']}", status=404)
|
||||
|
||||
|
||||
def test_one_beleg_does_not_classify_the_chapter(client, db):
|
||||
ada = Actor(client, "ada-kapitel@example.test", "Ada Kapitel")
|
||||
register(db, ada.email, ada.name)
|
||||
ada.login()
|
||||
matter = matter_of(ada, "Schriftverkehr")
|
||||
chapter = ada.request(
|
||||
"POST",
|
||||
f"/api/v1/matters/{matter['id']}/chapters",
|
||||
json={"title": "Belege"},
|
||||
status=201,
|
||||
)
|
||||
for title, external_id in (("Eingangsschreiben", "pl-1"), ("Antwortschreiben", "pl-2"), ("Rechnung", "pl-3")):
|
||||
ada.request(
|
||||
"POST",
|
||||
"/api/v1/external-refs",
|
||||
json={
|
||||
"title": title,
|
||||
"source": "paperless",
|
||||
"external_id": external_id,
|
||||
"context": {"kind": "matter", "id": matter["id"]},
|
||||
"chapter_id": chapter["id"],
|
||||
"dates": {"document_on": "2026-10-01"},
|
||||
},
|
||||
status=201,
|
||||
)
|
||||
detail = _matter(ada, matter["id"])
|
||||
incoming = _binding(detail, "Eingangsschreiben")
|
||||
reply = _binding(detail, "Antwortschreiben")
|
||||
invoice = _binding(detail, "Rechnung")
|
||||
ada.request(
|
||||
"POST",
|
||||
f"/api/v1/elements/{reply['element']['id']}/references",
|
||||
json={"refers_to_element_id": incoming["element"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
|
||||
status=204,
|
||||
)
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{incoming['id']}/communication",
|
||||
json={"expected_version": incoming["element"]["version"], "direction": "in", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
shown = _matter(ada, matter["id"])
|
||||
assert _binding(shown, "Eingangsschreiben")["communication"] == {"direction": "in", "explicit": True}
|
||||
assert _binding(shown, "Antwortschreiben")["communication"]["direction"] is None
|
||||
assert _binding(shown, "Rechnung")["communication"]["direction"] is None
|
||||
assert _binding(shown, "Antwortschreiben")["element"]["refers_to"][0]["direction"] == "in"
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{reply['id']}/communication",
|
||||
json={"expected_version": reply["element"]["version"], "direction": "out", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{invoice['id']}/communication",
|
||||
json={"expected_version": invoice["element"]["version"], "direction": "local", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
final = _matter(ada, matter["id"])
|
||||
assert _binding(final, "Eingangsschreiben")["communication"]["direction"] == "in"
|
||||
assert _binding(final, "Antwortschreiben")["communication"]["direction"] == "out"
|
||||
assert _binding(final, "Rechnung")["communication"] == {"direction": "local", "explicit": True}
|
||||
assert all(item["chapter_id"] == chapter["id"] for item in final["bindings"])
|
||||
@@ -196,7 +196,7 @@ Gemeinsame Spalten der fachlichen Ankerobjekte `cases`, `matters`, `elements`, `
|
||||
| `elements` | `kind` `note`, `correspondence`, `file` oder `external_ref` | Gemeinsamer Inhaltsträger. Rechnungen verweisen auf ein Element, sind aber eigene Finanzobjekte. |
|
||||
| `note_bodies` | `element_id`, `document_json`, `version` | Ein Text je Notiz. Begrenzter Renderbaum aus dem Datei-Blueprint, keine freie HTML-Ablage. |
|
||||
| `correspondence_dates` | `element_id`, `document_on`, `sent_on`, `received_on` | Vier getrennte Datumssachen. `recorded_at` ist `elements.created_at`. |
|
||||
| `bindings` | `element_id`, `context_kind`, `context_id`, `chapter_id` null, `position`, `release_state`, `communication_direction` null, `direction_explicit` | Kontext ist Akte, Vorgang oder Zusammenstellung. `release_state` `visible` oder `pending` für noch nicht freigegebene neue Zusammenstellungsinhalte. `communication_direction` ist `in`, `out` oder leer und gilt nur für diese Einbindung. `direction_explicit` wahr hält eine bewusste Wahl oder ein bewusstes Leeren; sonst darf nur eine übernommene IMAP-Richtung `in` oder `out` vorgefüllt werden. Versand- und Zugangsdatum sind keine Richtung. |
|
||||
| `bindings` | `element_id`, `context_kind`, `context_id`, `chapter_id` null, `position`, `release_state`, `communication_direction` null, `direction_explicit` | Kontext ist Akte, Vorgang oder Zusammenstellung. `release_state` `visible` oder `pending` für noch nicht freigegebene neue Zusammenstellungsinhalte. `communication_direction` ist `in`, `out`, `local` oder leer und gilt nur für diese Einbindung. `local` ist eine bewusste lokale Unterlage ohne Ein- oder Ausgang. `direction_explicit` wahr hält eine bewusste Wahl oder ein bewusstes Leeren; sonst darf nur eine übernommene IMAP-Richtung `in` oder `out` vorgefüllt werden. Versand- und Zugangsdatum sind keine Richtung. |
|
||||
| `context_annotations` | `binding_id`, `body`, `author_subject_id` | Gehört zur Einbindung, nicht zum gemeinsamen Text. |
|
||||
| `access_grants` | `grantee_subject_id`, `resource_kind`, `resource_id`, `context_kind`, `context_id`, `can_read`, `can_edit`, `can_share`, `can_delete` | Explizite Grants. Vererbung wird berechnet und nur bei Abweichung materialisiert. |
|
||||
| `compilations` | Ankerfelder | Virtuelle Zusammenstellung. |
|
||||
|
||||
@@ -472,4 +472,6 @@ Der Nutzer nennt folgende tatsächlich genutzte Felder. Schreibweisen sind als G
|
||||
|
||||
17.10.2026, Arbeitsstand 0.33: Sichtprüfung zu F-06e bestätigt Blatt statt Sprechblase bei Notizen und zu kleine Richtungspfeile. Paket 1.3 liefert gefüllte Dreiecke; Auftrag 1.1 verlangt führende Richtungsspalte, tatsächlichen Austausch der Notizdateien und Prüfung der ausgelieferten Inhalte. Fachliche Exportplanung aus 0.32 erhalten. Keine Anwendungscodeänderung oder Deployment durch diese Fortschreibung.
|
||||
|
||||
17.10.2026, Arbeitsstand 0.35: Richtung bleibt an der einzelnen Einbindung. Ein Beleg im Kapitel, auch mit Bezug auf einen anderen Beleg, ändert die Richtung der übrigen Einträge nicht. In der Übersicht sind Eingang, Ausgang und Lokal direkt wählbar. Lokal ist eine bewusste Unterlage ohne Ein- oder Ausgang und trägt kein Richtungsdreieck. Keine Angabe bleibt der unbestimmte Zustand.
|
||||
|
||||
Nach jeder Entscheidung diese Datei mit kurzer Begründung und Auswirkungen auf Fachmodell/MVP aktualisieren. Die historische Baseline bleibt unverändert. Keine Implementierung ohne ausdrückliche Freigabe; technische Umsetzung später anhand der dann freigegebenen Jinkendo-Blueprints.
|
||||
@@ -956,7 +956,7 @@ export function FileForm({ context, placement, chapters = [], initialChapter = "
|
||||
if (documentOn) form.set("document_on", documentOn);
|
||||
if (sentOn) form.set("sent_on", sentOn);
|
||||
if (receivedOn) form.set("received_on", receivedOn);
|
||||
if (direction === "in" || direction === "out") form.set("communication_direction", direction);
|
||||
if (direction === "in" || direction === "out" || direction === "local") form.set("communication_direction", direction);
|
||||
setError("");
|
||||
try {
|
||||
await api("/api/v1/files", { method: "POST", form });
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { documentToText, downloadMailPart, fetchFile, fetchMailPart, fetchPaperless, markDirty, textToDocument, api } from "../api.js";
|
||||
import { ErrorNote } from "./widgets.jsx";
|
||||
import { dateCaption, DirectionChoice, DirectionColumn, directionWord, formatDate, mailFacts, MarkdownEditor, sourceLabel } from "./content.jsx";
|
||||
import { dateCaption, DirectionChoice, DirectionColumn, directionValue, directionWord, formatDate, mailFacts, MarkdownEditor, sourceLabel } from "./content.jsx";
|
||||
import { NavIcon } from "./icons.jsx";
|
||||
import workerSrc from "pdfjs-dist/build/pdf.worker.min.mjs?url";
|
||||
|
||||
@@ -22,7 +22,7 @@ function MailAttachments({ files, current, onOpen }) {
|
||||
{files.map((file) => (
|
||||
<li key={`${file.index ?? "name"}-${file.filename}`}>
|
||||
{onOpen && Number.isInteger(file.index) ? (
|
||||
<button type="button" className={file.index === current ? "quiet is-current" : "quiet"} aria-current={file.index === current ? "true" : undefined} onClick={() => onOpen(file)}>{file.filename}</button>
|
||||
<button type="button" className={file.index === current ? "quiet is-current" : "quiet"} aria-pressed={file.index === current} onClick={() => onOpen(file)}>{file.filename}</button>
|
||||
) : file.filename}
|
||||
</li>
|
||||
))}
|
||||
@@ -30,7 +30,7 @@ function MailAttachments({ files, current, onOpen }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Correspondence({ element, onOpenRelated }) {
|
||||
function Correspondence({ element, direction, onOpenRelated }) {
|
||||
const refers = element.refers_to || [];
|
||||
const replies = element.referred_by || [];
|
||||
if (!refers.length && !replies.length) return null;
|
||||
@@ -38,7 +38,7 @@ function Correspondence({ element, onOpenRelated }) {
|
||||
id: element.id,
|
||||
title: element.title,
|
||||
document_on: element.dates?.document_on || null,
|
||||
direction: element.external?.detail?.direction || (element.dates?.sent_on && !element.dates?.received_on ? "out" : element.dates?.received_on && !element.dates?.sent_on ? "in" : null),
|
||||
direction: direction || null,
|
||||
current: true,
|
||||
};
|
||||
const seen = new Set();
|
||||
@@ -90,7 +90,8 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
const [notice, setNotice] = useState("");
|
||||
const [annotate, setAnnotate] = useState(false);
|
||||
const [letter, setLetter] = useState(null);
|
||||
const [shownIndex, setShownIndex] = useState(null);
|
||||
const [shownFor, setShownFor] = useState(null);
|
||||
const shownIndex = shownFor?.elementId === element?.id ? shownFor.index : null;
|
||||
const canvasRef = useRef(null);
|
||||
const objectUrl = useRef("");
|
||||
const closeRef = useRef(null);
|
||||
@@ -106,28 +107,33 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
setSentOn(element.dates?.sent_on || "");
|
||||
setReceivedOn(element.dates?.received_on || "");
|
||||
setSummary(element.summary || "");
|
||||
setError("");
|
||||
setNotice("");
|
||||
setPage(1);
|
||||
setPdf(null);
|
||||
setPages(0);
|
||||
setMedia("");
|
||||
setLetter(null);
|
||||
setShownIndex(null);
|
||||
if (objectUrl.current) {
|
||||
URL.revokeObjectURL(objectUrl.current);
|
||||
objectUrl.current = "";
|
||||
}
|
||||
setBlobUrl("");
|
||||
const mail = element.external?.source === "imap";
|
||||
setPhase(element.kind === "note" || mail ? "ready" : element.preview?.available ? "loading" : "missing");
|
||||
return undefined;
|
||||
}, [element?.id, element?.version]);
|
||||
}, [element?.id, element?.version, element?.summary, element?.document, element?.dates?.document_on, element?.dates?.sent_on, element?.dates?.received_on]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!element) return undefined;
|
||||
const mail = element.external?.source === "imap";
|
||||
if (element.kind === "note" || mail) setPhase("ready");
|
||||
else if (!element.preview?.available) setPhase("missing");
|
||||
setError("");
|
||||
return undefined;
|
||||
}, [element?.id, element?.kind, element?.external?.source, element?.preview?.available]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!element || element.kind === "note" || element.external?.source === "imap" || !element.preview?.available) return undefined;
|
||||
let alive = true;
|
||||
let url = "";
|
||||
setPage(1);
|
||||
setPdf(null);
|
||||
setPages(0);
|
||||
setMedia("");
|
||||
setLetter(null);
|
||||
if (objectUrl.current) {
|
||||
URL.revokeObjectURL(objectUrl.current);
|
||||
objectUrl.current = "";
|
||||
}
|
||||
setBlobUrl("");
|
||||
setPhase("loading");
|
||||
const load = element.external?.source === "paperless" ? fetchPaperless(element.id, context) : fetchFile(element.id, context);
|
||||
load.then(async (blob) => {
|
||||
@@ -175,15 +181,20 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
}, [element?.id, element?.kind, element?.external?.source, element?.preview?.available, context?.kind, context?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!letter?.complete) return undefined;
|
||||
const files = letter.attachments || [];
|
||||
const viewable = files.findIndex((file) => previewKind(file.content_type, file.filename) !== "other");
|
||||
setShownIndex(viewable >= 0 ? files[viewable].index : (files[0] ? files[0].index : null));
|
||||
return undefined;
|
||||
}, [letter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!element || element.external?.source !== "imap" || shownIndex === null) return undefined;
|
||||
if (!element || element.external?.source !== "imap") return undefined;
|
||||
if (shownIndex === null) {
|
||||
setPhase("ready");
|
||||
setPdf(null);
|
||||
setPages(0);
|
||||
setPage(1);
|
||||
setMedia("");
|
||||
if (objectUrl.current) {
|
||||
URL.revokeObjectURL(objectUrl.current);
|
||||
objectUrl.current = "";
|
||||
}
|
||||
setBlobUrl("");
|
||||
return undefined;
|
||||
}
|
||||
const file = (letter?.attachments || []).find((item) => item.index === shownIndex);
|
||||
if (!file) return undefined;
|
||||
let alive = true;
|
||||
@@ -473,7 +484,7 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
</header>
|
||||
<div className="reader-pane__stage">
|
||||
<ErrorNote error={error} />
|
||||
<Correspondence element={element} onOpenRelated={onOpenRelated} />
|
||||
<Correspondence element={element} direction={shownDirection} onOpenRelated={onOpenRelated} />
|
||||
{isMail ? (
|
||||
<article className="mail-letter">
|
||||
<p className="mail-letter__way"><DirectionColumn direction={shownDirection} />{directionWord(shownDirection) ? <span>{directionWord(shownDirection)}</span> : null}</p>
|
||||
@@ -482,7 +493,12 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
{mailDetail.message_cc ? <p><span>Kopie</span> {mailDetail.message_cc}</p> : null}
|
||||
{letter?.complete ? (
|
||||
<>
|
||||
<MailAttachments files={letter.attachments} current={shownIndex} onOpen={(file) => { setError(""); setShownIndex(file.index); }} />
|
||||
<MailAttachments files={letter.attachments} current={shownIndex} onOpen={(file) => {
|
||||
setError("");
|
||||
setShownFor((current) => (
|
||||
current?.elementId === element.id && current.index === file.index ? null : { elementId: element.id, index: file.index }
|
||||
));
|
||||
}} />
|
||||
{shownFile ? <p className="mail-attachment__caption">Anlage: {shownFile.filename}</p> : null}
|
||||
{shownFile && phase === "loading" ? <p className="muted">Die Anlage wird geladen …</p> : null}
|
||||
{media === "image" && blobUrl ? (
|
||||
@@ -516,7 +532,7 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
) : null}
|
||||
<form className="stack reader-direction" onSubmit={(event) => event.preventDefault()}>
|
||||
<DirectionChoice
|
||||
value={communication.explicit ? (communication.direction || "") : (shownDirection || "")}
|
||||
value={directionValue(communication)}
|
||||
disabled={!binding.rights.edit}
|
||||
onChange={saveDirection}
|
||||
/>
|
||||
|
||||
@@ -279,6 +279,13 @@ export function elementFacts(element, communication) {
|
||||
export function directionWord(direction) {
|
||||
if (direction === "out") return "Ausgang";
|
||||
if (direction === "in") return "Eingang";
|
||||
if (direction === "local") return "Lokal";
|
||||
return "";
|
||||
}
|
||||
|
||||
export function directionValue(communication) {
|
||||
const direction = communication?.direction;
|
||||
if (direction === "in" || direction === "out" || direction === "local") return direction;
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -298,15 +305,20 @@ export function DirectionColumn({ direction }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function DirectionChoice({ value, disabled, onChange }) {
|
||||
export function DirectionChoice({ value, disabled, onChange, compact = false, label = "Kommunikationsrichtung" }) {
|
||||
const select = (
|
||||
<select aria-label={label} value={value || ""} disabled={disabled} onChange={(event) => onChange(event.target.value)}>
|
||||
<option value="">Keine Angabe</option>
|
||||
<option value="in">Eingang</option>
|
||||
<option value="out">Ausgang</option>
|
||||
<option value="local">Lokal</option>
|
||||
</select>
|
||||
);
|
||||
if (compact) return <span className="direction-choice">{select}</span>;
|
||||
return (
|
||||
<label>
|
||||
Kommunikationsrichtung
|
||||
<select aria-label="Kommunikationsrichtung" value={value || ""} disabled={disabled} onChange={(event) => onChange(event.target.value)}>
|
||||
<option value="">Keine Angabe</option>
|
||||
<option value="in">Eingang</option>
|
||||
<option value="out">Ausgang</option>
|
||||
</select>
|
||||
{label}
|
||||
{select}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -352,7 +364,6 @@ function BezugLink({ item, label, source, onOpen, itemHref, reply = false }) {
|
||||
const className = reply ? "bezug__link bezug__link--reply" : "bezug__link";
|
||||
const body = (
|
||||
<>
|
||||
<DirectionColumn direction={item.direction} />
|
||||
<span>{label}</span>
|
||||
<strong>{formatDate(item.document_on)} · {item.title}</strong>
|
||||
{directionWord(item.direction) ? <span>{directionWord(item.direction)}</span> : null}
|
||||
@@ -491,6 +502,26 @@ export function ContentBoard({
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRowDirection(binding, value) {
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/bindings/${binding.id}/communication`, {
|
||||
method: "PATCH",
|
||||
body: {
|
||||
expected_version: binding.element.version,
|
||||
direction: value || null,
|
||||
context: actionContext(),
|
||||
},
|
||||
});
|
||||
await onChange();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function clearBezug(elementId, refersToId) {
|
||||
setPending(true);
|
||||
setError("");
|
||||
@@ -978,6 +1009,15 @@ export function ContentBoard({
|
||||
<li key={binding.id} data-binding={binding.id} className={`preview-row${linked ? " preview-row--linked" : ""}${draggingId === binding.id ? " is-dragging" : ""}${selectedId === binding.id ? " is-selected" : ""}`}>
|
||||
{indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === index ? <div className="insert-line" /> : null}
|
||||
<DirectionColumn direction={binding.communication?.direction} />
|
||||
{canEdit ? (
|
||||
<DirectionChoice
|
||||
compact
|
||||
label={`Richtung für ${element.title}`}
|
||||
value={directionValue(binding.communication)}
|
||||
disabled={pending}
|
||||
onChange={(value) => saveRowDirection(binding, value)}
|
||||
/>
|
||||
) : null}
|
||||
{canSort && custom ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -1017,7 +1057,7 @@ export function ContentBoard({
|
||||
</span>
|
||||
) : null}
|
||||
{formatDate(fachDate(element))} · {sourceLabel(element)}
|
||||
{directionWord(binding.communication?.direction) ? <span>{directionWord(binding.communication?.direction)}</span> : null}
|
||||
{!canEdit && directionWord(binding.communication?.direction) ? <span>{directionWord(binding.communication?.direction)}</span> : null}
|
||||
{mailFacts(element) ? <span>{mailFacts(element)}</span> : null}
|
||||
{dateCaption(element, binding.communication?.direction) ? <span>{dateCaption(element, binding.communication?.direction)}</span> : null}
|
||||
</span>
|
||||
|
||||
@@ -467,6 +467,8 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
|
||||
.icon-button--compact { width: 32px; min-width: 32px; height: 32px; }
|
||||
.icon-button--compact svg { width: 16px; height: 16px; }
|
||||
.icon-button--compact:hover, .icon-button--compact:focus-visible { background: var(--surface2); color: var(--text1); }
|
||||
.direction-choice { flex: 0 0 auto; }
|
||||
.direction-choice select { width: auto; min-width: 7.5rem; min-height: 32px; height: 32px; padding: 0 8px; font-size: 13px; }
|
||||
.direction-column { flex: 0 0 36px; width: 36px; height: 40px; display: grid; place-items: center; }
|
||||
.direction-column__icon { width: 28px; height: 28px; display: block; }
|
||||
.direction-column__icon--dark { display: none; }
|
||||
|
||||
Reference in new issue
Block a user