Halte Kapitel am gewaehlten Vorgang fest und raeume die Arbeitsflaeche, damit Ziel, Auswahl und Rechte nicht an der Akte haengen bleiben.
Deploy Development / deploy (push) Successful in 23s
Test Suite / pytest-backend (push) Successful in 1m1s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 5s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 11:33:54 +02:00
1 parent 67d48378c9
commit cafa4e8b92
8 files changed
+523 -132

No files matched your search

+96
View File
@@ -413,6 +413,102 @@ def test_teilvorgang_keeps_its_parent_in_the_trail(client, db):
assert contained["Prüfung"]["bindings"][0]["element"]["title"] == "Einwendung"
def test_chapters_follow_the_container_not_the_entry(client, db):
ada = Actor(client, "ada-ziel@example.test", "Ada Ziel")
ben = Actor(client, "ben-ziel@example.test", "Ben Ziel")
register(db, ada.email, ada.name)
register(db, ben.email, ben.name)
ada.login()
case = case_of(ada, "Wohnung")
matter = matter_of(ada, "Nebenkosten 2025")
child = ada.request(
"POST",
"/api/v1/matters",
json={"title": "Belegeinsicht", "parent_matter_id": matter["id"]},
status=201,
)
ada.request("POST", f"/api/v1/matters/{matter['id']}/case-links", json={"case_id": case["id"]}, status=201)
case_chapter = ada.request("POST", f"/api/v1/cases/{case['id']}/chapters", json={"title": "Aktenkapitel"}, status=201)
abrechnung = ada.request("POST", f"/api/v1/matters/{matter['id']}/chapters", json={"title": "Abrechnung"}, status=201)
schrift = ada.request("POST", f"/api/v1/matters/{matter['id']}/chapters", json={"title": "Schriftverkehr"}, status=201)
belege = ada.request(
"POST",
f"/api/v1/matters/{child['id']}/chapters?context_kind=case&context_id={case['id']}",
json={"title": "Belege"},
status=201,
)
ada.request(
"POST",
"/api/v1/notes",
json={
"title": "Abrechnungsschreiben",
"document": document("Abrechnungstext"),
"context": {"kind": "matter", "id": matter["id"]},
"chapter_id": abrechnung["id"],
},
status=201,
)
ada.request(
"POST",
"/api/v1/notes",
json={
"title": "Einwendung",
"document": document("Einwendungstext"),
"context": {"kind": "matter", "id": child["id"]},
"chapter_id": belege["id"],
},
status=201,
)
ada.request(
"POST",
"/api/v1/notes",
json={
"title": "Fremdes Kapitel",
"document": document("nein"),
"context": {"kind": "matter", "id": matter["id"]},
"chapter_id": case_chapter["id"],
},
status=422,
)
direct = _matter(ada, matter["id"])
via_case = ada.request("GET", f"/api/v1/matters/{matter['id']}?context_kind=case&context_id={case['id']}")
assert [item["title"] for item in direct["chapters"]] == ["Abrechnung", "Schriftverkehr"]
assert [item["id"] for item in via_case["chapters"]] == [item["id"] for item in direct["chapters"]]
assert via_case["context"]["kind"] == "case"
child_view = ada.request("GET", f"/api/v1/matters/{child['id']}?context_kind=case&context_id={case['id']}")
assert [item["title"] for item in child_view["chapters"]] == ["Belege"]
case_view = ada.request("GET", f"/api/v1/cases/{case['id']}")
assert [item["title"] for item in case_view["chapters"]] == ["Aktenkapitel"]
contained = {item["title"]: item for item in case_view["contained"]}
assert [item["title"] for item in contained["Nebenkosten 2025"]["chapters"]] == ["Abrechnung", "Schriftverkehr"]
assert [item["title"] for item in contained["Belegeinsicht"]["chapters"]] == ["Belege"]
binding = binding_for(direct, "Abrechnungsschreiben")
before = len(direct["bindings"])
ada.request(
"PATCH",
f"/api/v1/bindings/{binding['id']}/chapter",
json={"expected_version": direct["version"], "chapter_id": schrift["id"]},
)
moved = _matter(ada, matter["id"])
assert binding_for(moved, "Abrechnungsschreiben")["chapter_id"] == schrift["id"]
assert binding_for(moved, "Abrechnungsschreiben")["element"]["excerpt"] == "Abrechnungstext"
assert len(moved["bindings"]) == before
grant(ada, case["id"], ben.email)
ben.login()
ben.request(
"POST",
f"/api/v1/matters/{matter['id']}/chapters?context_kind=case&context_id={case['id']}",
json={"title": "Unerlaubt"},
status=403,
)
ben.request(
"PATCH",
f"/api/v1/bindings/{binding['id']}/chapter",
json={"expected_version": moved["version"], "chapter_id": abrechnung["id"], "context": {"kind": "case", "id": case["id"]}},
status=403,
)
_PNG = bytes.fromhex(
"89504e470d0a1a0a0000000d49484452000000010000000108060000001f15c489"
"0000000a49444154789c63000100000500010d0a2db40000000049454e44ae426082"
+7 -4
View File
@@ -1,6 +1,6 @@
# Tsumugu – Ergänzung zur Bedienung, Orientierung und Aktenordnung im MVP
**Stand:** 17.10.2026 · **Fassung:** 0.2, nach zweiter Oberflächenprüfung
**Stand:** 17.10.2026 · **Fassung:** 0.2, nach zweiter Oberflächenprüfung, ergänzt um Kapitelziel und Auswahl
**Zweck:** Referenz für die Überarbeitung der bestehenden MVP-Anwendung durch den Coding-Agenten.
**Bezug:** [Fachliche Produktspezifikation](TSUMUGU_PRODUCT_SPEC.md), insbesondere S-01a–d, F-04a und F-05a; [technischer Entwurf](../architecture/TSUMUGU_TECHNICAL_SPEC.md).
@@ -96,7 +96,7 @@ Akten, Unterakten, Vorgänge, Teilvorgänge, Kapitel und Querverweise dürfen op
- Die visuelle Stabilisierung darf den tatsächlichen Handlungskontext nicht entfernen oder still wechseln. Kontextparameter, serverseitige Berechtigungsprüfung sowie Zuordnung von Anmerkungen bleiben beim Öffnen, Bearbeiten, Weiterlesen, Zurückkehren und Neuladen erhalten. Ein Kontextwechsel ist eine bewusste Auswahl und wird serverseitig geprüft. Keine Rechtevereinigung über andere Zuordnungen und kein automatischer Rückfall auf einen weitergehenden Owner-Zugriff.
- Direkteinstieg und Rücknavigation funktionieren ohne vorherigen Besuch einer Akte. Breadcrumbs dürfen keine unbekannten oder unberechtigten Herkunftsnamen offenlegen. Eine Darstellungskorrektur eröffnet keinen bisher unzulässigen Direktzugriff.
- Unterakten und Teilvorgänge sind als untergeordnete Objekte erkennbar. Querverweise werden als zusätzliche Verknüpfungen kenntlich gemacht und verändern keine fachliche Hauptzuordnung.
- Kapitel erscheinen als Gliederungsüberschriften innerhalb der Inhalte. Sie erhalten weder eigene Rechte noch einen eigenen Bearbeitungsstatus.
- Kapitel erscheinen als Gliederungsüberschriften innerhalb der Inhalte und in der Gliederung des zugehörigen Containers, auch wenn sie noch leer sind. Sie erhalten weder eigene Rechte noch einen eigenen Bearbeitungsstatus. Ein Kapitel gehört zur Akte, zum Vorgang oder zum Teilvorgang, in dem es angelegt wird, und bleibt an diesem Objekt, unabhängig vom Einstieg. Dieselbe Unterlage kann in einem anderen Container anders eingeordnet sein; die Zuordnung ändert weder Inhalt noch Freigabe. Reihenfolge und Kapitelzuordnung sind getrennte Aktionen.
Neben der zentralen Inhaltsfläche steht auf Desktop eine kompakte Gliederungsnavigation mit den relevanten Unterakten, Vorgängen und Kapiteln. Die Auswahl ist sichtbar markiert und bestimmt den betrachteten Bereich. Sie enthält keine zweite Dokumentliste. Auf schmalen Displays wird diese Navigation als ausklappbare Bereichsauswahl angeboten. Kein ständig vollständig aufgeklappter Gesamtbaum aller Akten erforderlich.
@@ -117,7 +117,9 @@ Die Aktenansicht verwendet eine gemeinsame Inhaltskomponente mit einer kompakten
Zusätzlich bietet „Alle Inhalte“ eine gemeinsame Lesesicht auf direkte Inhalte und die Inhalte der unmittelbar zugeordneten Vorgänge. Herkunft ist an jeder Vorschauzeile als kurze Angabe erkennbar, beispielsweise „Direkt in dieser Akte“ oder „Aus Vorgang Nebenkosten 2025“. In der Akte ist dies der normale Überblick; ein leerer direkter Inhaltsbereich wird nicht als zusätzlicher Block davor angezeigt. Die Bereichsauswahl kann auf direkte Einträge, einen Vorgang oder ein Kapitel einschränken. Genau eine Liste bleibt sichtbar. Eine rekursive Gesamtsicht über beliebig tiefe Hierarchien ist nicht erforderlich.
„Alle Inhalte“ ist eine abgeleitete Lesesicht, die fachlich nach Datum sortierbar ist. Sie erzeugt keine neuen Einbindungen, keine zweite manuelle Gesamtordnung und keine Änderung an den gespeicherten Ordnungen der Herkunftsvorgänge. Für „Eigene Reihenfolge“ muss ein einzelner bearbeitbarer Container ausgewählt sein; die Oberfläche bietet dafür einen verständlichen Auswahlweg. Kein mehrdeutiges Ziehen über mehrere Herkunftscontainer.
„Alle Inhalte“ ist eine abgeleitete Lesesicht, die fachlich nach Datum sortierbar ist. Sie erzeugt keine neuen Einbindungen, keine zweite manuelle Gesamtordnung und keine Änderung an den gespeicherten Ordnungen der Herkunftsvorgänge. Für „Eigene Reihenfolge“, neue Inhalte und neue Kapitel muss ein einzelner bearbeitbarer Container ausgewählt sein; die Oberfläche benennt dieses Ziel, beispielsweise „Kapitel in Vorgang Nebenkosten 2025 hinzufügen“, und bietet in der Lesesicht zuerst die Bereichsauswahl. Aktenrechte gelten nicht ungeprüft als Bearbeitungsrecht eines ausgewählten Vorgangs. Fachliches Ziel und Handlungskontext bleiben getrennt. Kein mehrdeutiges Ziehen über mehrere Herkunftscontainer.
Die Bereichs- und Kapitelauswahl gehört zum gerade geöffneten Objekt. Ein Wechsel der Akte, des Vorgangs oder des Teilvorgangs übernimmt keine fremde Auswahl. Eine zum selben Objekt gehörende Auswahl bleibt bei Neuladen, Browser-Zurück und Rückkehr aus einer Unterlage erhalten. Nach dem Anlegen ist das neue Kapitel ausgewählt und beim Hinzufügen weiterer Einträge vorausgewählt; Ziel und Kapitel sind im Formular erkennbar. Der Ordnungsmodus bleibt in einer kompakten Auswahl sichtbar, ohne eine Reihe großer Sortierschaltflächen.
Bei Mehrfachvorkommen bleibt die konkrete Einbindung eindeutig. Dasselbe Element darf in der Lesesicht nicht wie mehrere unabhängige Originale wirken: Mehrere sichtbare Herkunftseinbindungen als solche kenntlich machen, vor dem Öffnen gegebenenfalls die konkrete Einbindung auswählen. Inhalte und Anmerkungen ausschließlich aus dem gewählten geprüften Kontext öffnen. Verborgene Einbindungen weder zählen noch benennen.
@@ -253,7 +255,8 @@ Nicht Bestandteil dieses Auftrags sind Finanzfunktionen, bidirektionale Paperles
| UX-04 | Mindestens acht gemischte Einträge mit unterschiedlichen Daten, zwei gleichen Daten und zwei fehlenden Daten werden bei beiden Datumsrichtungen stabil und nachvollziehbar angezeigt. Erfassungsdatum ersetzt kein fehlendes Fachdokumentdatum. |
| UX-05 | Eine eigene Reihenfolge bleibt nach Neuladen und erneuter Anmeldung erhalten. Wechsel zu Datumsordnung und zurück erhält die eigene Ordnung. Ein neuer Eintrag wird an der dokumentierten Stelle eingefügt. |
| UX-06 | Dasselbe Element steht in zwei verschiedenen Containern an unterschiedlichen Positionen. Umordnen in A ändert B nicht. Gemeinsamer Inhalt bleibt gemeinsam; Anmerkungen bleiben kontextbezogen. |
| UX-07 | Kapitelgliederung bleibt beim Sortieren erhalten. Direkte Akteninhalte sind von Inhalten ihrer Vorgänge erkennbar unterscheidbar und im passenden Kontext erreichbar. |
| UX-07 | Kapitelgliederung bleibt beim Sortieren erhalten. Direkte Akteninhalte sind von Inhalten ihrer Vorgänge erkennbar unterscheidbar und im passenden Kontext erreichbar. Kapitel eines Vorgangs oder Teilvorgangs erscheinen unter diesem Objekt, auch aus der Akte, und entstehen nicht an der Akte, solange ein anderer Bereich ausgewählt ist. |
| UX-21 | In der Lesesicht ohne eindeutiges Ziel verlangt die Oberfläche zuerst eine Bereichsauswahl. Kapitel- und Inhaltsaktionen verwenden das Bearbeitungsrecht des gewählten Containers. Eine Auswahl eines anderen Objekts wird nicht als Filter mitgenommen; die Auswahl desselben Objekts bleibt bei Neuladen und Rückkehr aus der Unterlage erhalten. Ein neu angelegtes Kapitel ist sofort sichtbar und beim nächsten Eintrag vorausgewählt. |
| UX-08 | Unterstützte Dokumente/Notizen öffnen mit direkt nutzbarer Vorschau beziehungsweise Text als Hauptinhalt. Ein bloßer Formularbildschirm mit externem Öffnen-Button genügt dafür nicht. Für nicht verfügbare/unterstützte Vorschauen gibt es einen erklärten sicheren Öffnungsweg. Entfernen und globales Löschen dominieren die Ansicht nicht. |
| UX-09 | Änderungen bleiben im separat aufrufbaren Protokoll nachvollziehbar; auch viele Aktionen verlängern die normale Inhaltsseite nicht. Fachlicher Verlauf enthält keine mehrfachen technischen Abbilder desselben fachlichen Ereignisses. |
| UX-10 | Aufgabe und Frist lassen sich eindeutig erfassen und zentral wiederfinden. Erledigen der Vorbereitungsaufgabe lässt die unabhängige Frist offen. |
+146 -47
View File
@@ -1,11 +1,11 @@
import { useContext, useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useContext, useEffect, useRef, useState } from "react";
import { Link, useParams, useSearchParams } from "react-router-dom";
import { api, markDirty, textToDocument } from "../api.js";
import { SessionContext } from "../session.js";
import { Modal } from "./Modal.jsx";
import { MailPicker, PaperlessPicker } from "./Sources.jsx";
import { ErrorNote, ShareBox } from "./widgets.jsx";
import { ContentBoard, ObjectMenu, RecordTree, SurfaceView, Trail, WorkLists, WorkSwitch } from "./content.jsx";
import { ContentBoard, ObjectMenu, OrderChoice, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, selectionOf, withSelection, writeSelection } from "./content.jsx";
export function CaseList() {
const { session } = useContext(SessionContext);
@@ -156,8 +156,14 @@ function CaseOutline({ record, caseId, scope, chapterId, onScope, onChapter }) {
return (
<nav className="outline-nav" aria-label="Gliederung">
<h2>Gliederung</h2>
<button type="button" className={scope === "all" ? "" : "quiet"} onClick={() => onScope("all")}>Alle Inhalte</button>
<button type="button" className={scope === "direct" && !chapterId ? "" : "quiet"} onClick={() => onScope("direct")}>Direkt in dieser Akte</button>
<button type="button" className={scope === "all" ? "hierarchy__row is-current" : "hierarchy__row"} onClick={() => onScope("all")}>
<span className="hierarchy__kind">Überblick</span>
<strong>Alle Inhalte</strong>
</button>
<button type="button" className={scope === "direct" && !chapterId ? "hierarchy__row is-current" : "hierarchy__row"} onClick={() => onScope("direct")}>
<span className="hierarchy__kind">Akte</span>
<strong>Direkt in dieser Akte</strong>
</button>
<ChapterLinks chapters={record.chapters || []} scopeId="direct" scope={scope} chapterId={chapterId} onChapter={onChapter} />
{hasParent ? (
<p className="hierarchy__parent">Übergeordnet: <Link to={`/cases/${record.parent_case_id}`}>Akte {record.parent_title}</Link></p>
@@ -223,32 +229,86 @@ function mergedCaseItems(record, direction, caseId) {
export function CaseDetail() {
const { id } = useParams();
const [params, setParams] = useSearchParams();
const { scope, chapterId } = selectionOf(params);
const [record, setRecord] = useState(null);
const [error, setError] = useState("");
const [modal, setModal] = useState("");
const [view, setView] = useState("contents");
const [scope, setScope] = useState("all");
const [chapterId, setChapterId] = useState("");
const [dateDir, setDateDir] = useState("asc");
const [outlineOpen, setOutlineOpen] = useState(false);
const pendingChapter = useRef("");
const context = { kind: "case", id };
async function load() {
const detail = await api(`/api/v1/cases/${id}`);
pendingChapter.current = "";
setRecord(detail);
return detail;
}
useEffect(() => {
load().catch((err) => setError(err.message));
let alive = true;
setRecord(null);
setError("");
setView("contents");
setModal("");
setDateDir("asc");
setOutlineOpen(false);
api(`/api/v1/cases/${id}`).then((detail) => {
if (!alive) return;
pendingChapter.current = "";
setRecord(detail);
}).catch((err) => {
if (alive) setError(err.message);
});
return () => { alive = false; };
}, [id]);
useEffect(() => {
if (!record || record.id !== id) return;
const known = new Set(["all", "direct", ...(record.contained || []).map((item) => item.matter_id)]);
const nextScope = known.has(scope) ? scope : "all";
const chapters = nextScope === "direct"
? (record.chapters || [])
: (record.contained || []).find((item) => item.matter_id === nextScope)?.chapters || [];
const nextChapter = chapterId && chapters.some((chapter) => chapter.id === chapterId) ? chapterId : "";
if (chapterId && !nextChapter && pendingChapter.current === chapterId) return;
if (nextScope !== scope || nextChapter !== chapterId) writeSelection(params, setParams, nextScope, nextChapter);
}, [record, id, scope, chapterId, params, setParams]);
function choose(nextScope, nextChapter = "") {
writeSelection(params, setParams, nextScope, nextChapter);
setView("contents");
setOutlineOpen(false);
}
if (error && !record) return <main className="page"><ErrorNote error={error} /></main>;
if (!record) return <main className="page"><p className="muted">Akte wird geladen …</p></main>;
const group = (record.contained || []).find((item) => item.matter_id === scope);
const group = scope !== "all" && scope !== "direct"
? (record.contained || []).find((item) => item.matter_id === scope) || null
: null;
const target = scope === "direct"
? {
scope: "direct",
label: `Akte ${record.title}`,
edit: Boolean(record.rights?.edit),
chapters: record.chapters || [],
chapterPath: `/api/v1/cases/${id}/chapters`,
}
: group
? {
scope: group.matter_id,
label: `${group.kind_label || "Vorgang"} ${group.title}`,
edit: Boolean(group.rights?.edit),
chapters: group.chapters || [],
chapterPath: `/api/v1/matters/${group.matter_id}/chapters?context_kind=case&context_id=${id}`,
}
: null;
const activeChapter = target?.chapters.find((chapter) => chapter.id === chapterId) || null;
const merged = mergedCaseItems(record, dateDir, id);
const addPlacement = group ? { kind: "matter", id: group.matter_id } : null;
const addChapters = group?.chapters || record.chapters;
return (
<main className="page">
@@ -260,12 +320,14 @@ export function CaseDetail() {
<p className="muted">{record.status === "open" ? "Offen" : "Geschlossen"}</p>
</div>
<div className="row">
{record.rights.edit ? <button type="button" onClick={() => setModal("add")}>Inhalt hinzufügen</button> : null}
{target?.edit ? <button type="button" onClick={() => setModal("add")}>Inhalt hinzufügen</button> : null}
<ObjectMenu view={view} onView={setView}>
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("matter")}>Vorgang anlegen und zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("assign")}>Vorhandenen Vorgang zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("subcase")}>Unterakte anlegen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("chapter")}>{group ? "Kapitel in diesem Vorgang anlegen" : "Kapitel anlegen"}</button> : null}
{target?.edit ? <button type="button" className="quiet" onClick={() => setModal("chapter")}>Kapitel hinzufügen</button> : null}
{!target ? <p className="muted">Für ein Kapitel zuerst einen Bereich wählen.</p> : null}
{target && !target.edit ? <p className="muted">In {target.label} fehlt das Bearbeitungsrecht.</p> : null}
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
</ObjectMenu>
</div>
@@ -280,19 +342,25 @@ export function CaseDetail() {
caseId={id}
scope={scope}
chapterId={chapterId}
onScope={(next) => { setScope(next); setChapterId(""); setView("contents"); setOutlineOpen(false); }}
onChapter={(nextScope, nextChapter) => { setScope(nextScope); setChapterId(nextChapter); setView("contents"); setOutlineOpen(false); }}
onScope={(next) => choose(next)}
onChapter={(nextScope, nextChapter) => choose(nextScope, nextChapter)}
/>
</div>
</aside>
<div className="record-main">
<WorkSwitch view={view} onView={setView} />
{view === "contents" ? (
<p className="target-line">
{target ? (
<>Bearbeitet wird <strong>{target.label}</strong>{activeChapter ? <> · Kapitel <strong>{activeChapter.title}</strong></> : null}</>
) : (
"Lesesicht aller Inhalte. Zum Bearbeiten einen Bereich in der Gliederung wählen."
)}
</p>
) : null}
{view === "contents" && scope === "all" ? (
<div className="stack">
<div className="order-bar" role="group" aria-label="Lesesicht">
<button type="button" className={dateDir === "asc" ? "" : "quiet"} onClick={() => setDateDir("asc")}>Fachliches Datum, aufsteigend</button>
<button type="button" className={dateDir === "desc" ? "" : "quiet"} onClick={() => setDateDir("desc")}>Fachliches Datum, absteigend</button>
</div>
<OrderChoice mode="date" direction={dateDir} onChange={(_mode, next) => setDateDir(next)} />
<ContentBoard
record={{ bindings: merged, chapters: [], content_order: "date", content_order_dir: dateDir, rights: { edit: false }, version: record.version }}
bindings={merged}
@@ -311,7 +379,7 @@ export function CaseDetail() {
containerId={id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => `/cases/${id}/items/${binding.id}`}
itemHref={(binding) => withSelection(`/cases/${id}/items/${binding.id}`, params)}
/>
) : null}
{view === "contents" && group ? (
@@ -323,7 +391,7 @@ export function CaseDetail() {
containerId={group.matter_id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => `/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${id}`}
itemHref={(binding) => withSelection(`/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${id}`, params)}
/>
) : null}
{view === "contents" && scope !== "all" && scope !== "direct" && !group ? (
@@ -350,7 +418,8 @@ export function CaseDetail() {
<Modal open={modal === "assign"} title="Vorhandenen Vorgang zuordnen" onClose={() => setModal("")}>
<AssignMatter caseId={id} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "add"} title="Hinzufügen" onClose={() => setModal("")}>
<Modal open={modal === "add" && Boolean(target)} title={target ? `Hinzufügen in ${target.label}` : "Hinzufügen"} onClose={() => setModal("")}>
<TargetLine label={target?.label} chapters={target?.chapters} chapterId={activeChapter?.id || ""} />
<div className="choice">
<button type="button" onClick={() => setModal("note")}>Notiz</button>
<button type="button" onClick={() => setModal("file")}>Datei</button>
@@ -358,23 +427,33 @@ export function CaseDetail() {
<button type="button" onClick={() => setModal("mail")}>E-Mail</button>
</div>
</Modal>
<Modal open={modal === "note"} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={context} placement={addPlacement} chapters={addChapters} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "note" && Boolean(target)} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={context} placement={addPlacement} chapters={target?.chapters || []} initialChapter={activeChapter?.id || ""} targetLabel={target?.label || ""} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "file"} title="Datei" onClose={() => setModal("")}>
<FileForm context={context} placement={addPlacement} chapters={addChapters} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "file" && Boolean(target)} title="Datei" onClose={() => setModal("")}>
<FileForm context={context} placement={addPlacement} chapters={target?.chapters || []} initialChapter={activeChapter?.id || ""} targetLabel={target?.label || ""} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "paperless"} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={context} placement={addPlacement} onDone={() => { setModal(""); load(); }} />
<Modal open={modal === "paperless" && Boolean(target)} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={context} placement={addPlacement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={target?.label || ""} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "mail"} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={context} placement={addPlacement} onDone={() => { setModal(""); load(); }} />
<Modal open={modal === "mail" && Boolean(target)} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={context} placement={addPlacement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={target?.label || ""} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "subcase"} title="Unterakte anlegen" onClose={() => setModal("")}>
<NewSubcase parentId={id} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "chapter"} title={group ? "Kapitel im Vorgang" : "Kapitel anlegen"} onClose={() => setModal("")}>
<ChapterForm path={group ? `/api/v1/matters/${group.matter_id}/chapters?context_kind=case&context_id=${id}` : `/api/v1/cases/${id}/chapters`} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "chapter" && Boolean(target)} title={target ? `Kapitel in ${target.label} hinzufügen` : "Kapitel hinzufügen"} onClose={() => setModal("")}>
<ChapterForm
path={target?.chapterPath || ""}
onChange={(created) => {
setModal("");
if (created?.id && target) {
pendingChapter.current = created.id;
writeSelection(params, setParams, target.scope, created.id);
}
load();
}}
/>
</Modal>
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
<ShareBox path={`/api/v1/cases/${id}/grants`} grants={record.grants || []} onChange={load} />
@@ -523,18 +602,25 @@ function NewSubcase({ parentId, onChange }) {
export function ChapterForm({ path, onChange }) {
const [title, setTitle] = useState("");
const [error, setError] = useState("");
async function submit(event) {
event.preventDefault();
await api(path, { method: "POST", body: { title } });
setTitle("");
onChange();
setError("");
try {
const created = await api(path, { method: "POST", body: { title } });
setTitle("");
onChange(created);
} catch (err) {
setError(err.message);
}
}
return (
<form onSubmit={submit} className="inline">
<input value={title} onChange={(event) => setTitle(event.target.value)} placeholder="Kapitel" required />
<button type="submit">Kapitel</button>
<button type="submit">Hinzufügen</button>
<ErrorNote error={error} />
</form>
);
}
@@ -550,24 +636,30 @@ export function ContentForms({ context, placement, chapters, onChange }) {
}
function chapterSelect(chapters, value, setValue) {
if (!chapters?.length) return null;
return (
<select value={value} onChange={(event) => setValue(event.target.value)}>
<option value="">Ohne Kapitel</option>
{chapters.map((chapter) => (
<option key={chapter.id} value={chapter.id}>{chapter.title}</option>
))}
</select>
<label>
Kapitel
<select value={value} onChange={(event) => setValue(event.target.value)}>
<option value="">Ohne Kapitel</option>
{chapters.map((chapter) => (
<option key={chapter.id} value={chapter.id}>{chapter.title}</option>
))}
</select>
</label>
);
}
export function NoteForm({ context, placement, chapters, onChange }) {
export function NoteForm({ context, placement, chapters = [], initialChapter = "", targetLabel = "", onChange }) {
const [title, setTitle] = useState("");
const [text, setText] = useState("");
const [documentOn, setDocumentOn] = useState("");
const [chapterId, setChapterId] = useState("");
const [chapterId, setChapterId] = useState(initialChapter);
const [error, setError] = useState("");
const [pending, setPending] = useState(false);
useEffect(() => { setChapterId(initialChapter || ""); }, [initialChapter]);
async function submit(event) {
event.preventDefault();
if (pending) return;
@@ -599,6 +691,7 @@ export function NoteForm({ context, placement, chapters, onChange }) {
return (
<form onSubmit={submit} className="stack compact">
<TargetLine label={targetLabel} chapters={chapters} chapterId={chapterId} />
<h3>Notiz</h3>
<label>Titel <input value={title} onChange={(event) => { setTitle(event.target.value); markDirty(true); }} required /></label>
<label>Gemeinsamer Text <textarea rows={4} value={text} onChange={(event) => { setText(event.target.value); markDirty(true); }} /></label>
@@ -610,15 +703,17 @@ export function NoteForm({ context, placement, chapters, onChange }) {
);
}
export function FileForm({ context, placement, chapters, onChange }) {
export function FileForm({ context, placement, chapters = [], initialChapter = "", targetLabel = "", onChange }) {
const [title, setTitle] = useState("");
const [file, setFile] = useState(null);
const [chapterId, setChapterId] = useState("");
const [chapterId, setChapterId] = useState(initialChapter);
const [documentOn, setDocumentOn] = useState("");
const [sentOn, setSentOn] = useState("");
const [receivedOn, setReceivedOn] = useState("");
const [error, setError] = useState("");
useEffect(() => { setChapterId(initialChapter || ""); }, [initialChapter]);
async function submit(event) {
event.preventDefault();
if (!file) return;
@@ -649,6 +744,7 @@ export function FileForm({ context, placement, chapters, onChange }) {
return (
<form onSubmit={submit} className="stack compact">
<TargetLine label={targetLabel} chapters={chapters} chapterId={chapterId} />
<h3>Datei</h3>
<input value={title} onChange={(event) => setTitle(event.target.value)} placeholder="Titel des Schreibens" required />
<input type="file" accept="application/pdf,image/png,image/jpeg,image/webp" onChange={(event) => setFile(event.target.files?.[0] || null)} required />
@@ -662,16 +758,18 @@ export function FileForm({ context, placement, chapters, onChange }) {
);
}
function ExternalForm({ context, placement, chapters, onChange }) {
function ExternalForm({ context, placement, chapters = [], initialChapter = "", targetLabel = "", onChange }) {
const [title, setTitle] = useState("");
const [externalId, setExternalId] = useState("");
const [source, setSource] = useState("paperless");
const [chapterId, setChapterId] = useState("");
const [chapterId, setChapterId] = useState(initialChapter);
const [documentOn, setDocumentOn] = useState("");
const [sentOn, setSentOn] = useState("");
const [receivedOn, setReceivedOn] = useState("");
const [error, setError] = useState("");
useEffect(() => { setChapterId(initialChapter || ""); }, [initialChapter]);
async function submit(event) {
event.preventDefault();
setError("");
@@ -702,6 +800,7 @@ function ExternalForm({ context, placement, chapters, onChange }) {
return (
<form onSubmit={submit} className="stack compact">
<TargetLine label={targetLabel} chapters={chapters} chapterId={chapterId} />
<h3>Paperless oder andere Referenz</h3>
<input value={title} onChange={(event) => setTitle(event.target.value)} placeholder="Anzeigetitel" required />
<select value={source} onChange={(event) => setSource(event.target.value)}>
+91 -28
View File
@@ -1,4 +1,4 @@
import { useContext, useEffect, useState } from "react";
import { useContext, useEffect, useRef, useState } from "react";
import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom";
import { api, markDirty } from "../api.js";
import { SessionContext } from "../session.js";
@@ -6,7 +6,7 @@ import { Modal } from "./Modal.jsx";
import { MailPicker, PaperlessPicker } from "./Sources.jsx";
import { ErrorNote, ShareBox } from "./widgets.jsx";
import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx";
import { ContentBoard, ObjectMenu, Placements, RecordTree, SurfaceView, Trail, WorkLists, WorkSwitch, formatDate, matterOpenHref } from "./content.jsx";
import { ContentBoard, ObjectMenu, Placements, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, formatDate, matterOpenHref, writeChapter } from "./content.jsx";
function pageContext(params) {
const kind = params.get("context_kind");
@@ -87,7 +87,10 @@ function MatterOutline({ record, inherited, chapterId, onChapter }) {
return (
<nav className="outline-nav" aria-label="Gliederung">
<h2>Gliederung</h2>
<button type="button" className={chapterId ? "quiet" : ""} onClick={() => onChapter("")}>Alle Inhalte</button>
<button type="button" className={chapterId ? "hierarchy__row" : "hierarchy__row is-current"} onClick={() => onChapter("")}>
<span className="hierarchy__kind">Überblick</span>
<strong>Alle Inhalte</strong>
</button>
{hasParent ? (
<p className="hierarchy__parent">Übergeordnet: <Link to={`/matters/${record.parent_matter_id}${matterQuery}`}>Vorgang {record.parent_title}</Link></p>
) : null}
@@ -128,7 +131,7 @@ function MatterOutline({ record, inherited, chapterId, onChapter }) {
<ul className="hierarchy">
{record.chapters.map((chapter) => (
<li key={chapter.id}>
<button type="button" className={chapterId === chapter.id ? "hierarchy__row" : "hierarchy__row quiet"} onClick={() => onChapter(chapter.id)}>
<button type="button" className={chapterId === chapter.id ? "hierarchy__row is-current" : "hierarchy__row"} onClick={() => onChapter(chapter.id)}>
<span className="hierarchy__kind">Kapitel</span>
<strong>{chapter.title}</strong>
</button>
@@ -143,32 +146,69 @@ function MatterOutline({ record, inherited, chapterId, onChapter }) {
export function MatterDetail() {
const { id } = useParams();
const [params] = useSearchParams();
const [params, setParams] = useSearchParams();
const inherited = pageContext(params);
const chapterId = params.get("kapitel") || "";
const [record, setRecord] = useState(null);
const [error, setError] = useState("");
const [modal, setModal] = useState("");
const rightsContext = inherited || { kind: "matter", id };
const placement = inherited?.kind === "case" ? { kind: "matter", id } : null;
const [view, setView] = useState("contents");
const [chapterId, setChapterId] = useState("");
const [outlineOpen, setOutlineOpen] = useState(false);
const pendingChapter = useRef("");
async function load() {
const query = inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : "";
const detail = await api(`/api/v1/matters/${id}${query}`);
pendingChapter.current = "";
setRecord(detail);
return detail;
}
useEffect(() => {
let alive = true;
setRecord(null);
load().catch((err) => setError(err.message));
setError("");
setView("contents");
setModal("");
setOutlineOpen(false);
const query = inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : "";
api(`/api/v1/matters/${id}${query}`).then((detail) => {
if (!alive) return;
pendingChapter.current = "";
setRecord(detail);
}).catch((err) => {
if (alive) setError(err.message);
});
return () => { alive = false; };
}, [id, inherited?.kind, inherited?.id]);
useEffect(() => {
if (!record || record.id !== id) return;
const known = (record.chapters || []).some((chapter) => chapter.id === chapterId);
if (chapterId && !known && pendingChapter.current === chapterId) return;
if (chapterId && !known) writeChapter(params, setParams, "");
if (params.get("bereich")) {
const next = new URLSearchParams(params);
next.delete("bereich");
setParams(next, { replace: true });
}
}, [record, id, chapterId, params, setParams]);
function chooseChapter(next) {
writeChapter(params, setParams, next);
setView("contents");
setOutlineOpen(false);
}
if (error && !record) return <main className="page"><ErrorNote error={error} /></main>;
if (!record) return <main className="page"><p className="muted">Vorgang wird geladen …</p></main>;
const query = inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : "";
const targetLabel = `${record.kind_label || "Vorgang"} ${record.title}`;
const activeChapter = (record.chapters || []).find((chapter) => chapter.id === chapterId) || null;
const canEdit = Boolean(record.rights?.edit);
return (
<main className="page">
@@ -181,11 +221,12 @@ export function MatterDetail() {
<p className="muted">{record.status === "open" ? "Offen" : "Geschlossen"}</p>
</div>
<div className="row">
{record.rights.edit ? <button type="button" onClick={() => setModal("add")}>Inhalt hinzufügen</button> : null}
{canEdit ? <button type="button" onClick={() => setModal("add")}>Inhalt hinzufügen</button> : null}
<ObjectMenu view={view} onView={setView}>
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("submatter")}>Teilvorgang anlegen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("cross")}>Querverweis</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("chapter")}>Kapitel anlegen</button> : null}
{canEdit ? <button type="button" className="quiet" onClick={() => setModal("submatter")}>Teilvorgang anlegen</button> : null}
{canEdit ? <button type="button" className="quiet" onClick={() => setModal("cross")}>Querverweis</button> : null}
{canEdit ? <button type="button" className="quiet" onClick={() => setModal("chapter")}>Kapitel hinzufügen</button> : null}
{!canEdit ? <p className="muted">In {targetLabel} fehlt das Bearbeitungsrecht.</p> : null}
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
</ObjectMenu>
</div>
@@ -195,21 +236,32 @@ export function MatterDetail() {
<aside className={outlineOpen ? "outline is-open" : "outline"}>
<button type="button" className="outline__toggle" onClick={() => setOutlineOpen((open) => !open)}>{outlineOpen ? "Bereiche schließen" : "Bereiche"}</button>
<div className="outline__body">
<MatterOutline record={record} inherited={inherited} chapterId={chapterId} onChapter={(next) => { setChapterId(next); setView("contents"); setOutlineOpen(false); }} />
<MatterOutline record={record} inherited={inherited} chapterId={chapterId} onChapter={chooseChapter} />
</div>
</aside>
<div className="record-main">
<WorkSwitch view={view} onView={setView} />
{view === "contents" ? (
<ContentBoard
record={record}
context={inherited}
containerKind="matter"
containerId={id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => `/matters/${id}/items/${binding.id}${query}`}
/>
<>
<p className="target-line">
Bearbeitet wird <strong>{targetLabel}</strong>
{activeChapter ? <> · Kapitel <strong>{activeChapter.title}</strong></> : null}
</p>
<ContentBoard
record={record}
context={inherited}
containerKind="matter"
containerId={id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => {
const search = new URLSearchParams(query.replace(/^\?/, ""));
if (chapterId) search.set("kapitel", chapterId);
const next = search.toString();
return `/matters/${id}/items/${binding.id}${next ? `?${next}` : ""}`;
}}
/>
</>
) : null}
{view === "work" ? (
<div className="stack">
@@ -237,7 +289,8 @@ export function MatterDetail() {
<Modal open={modal === "work"} title="Aufgabe oder Frist" onClose={() => setModal("")}>
<WorkForms matterId={id} context={inherited} tasks={record.tasks} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "add"} title="Hinzufügen" onClose={() => setModal("")}>
<Modal open={modal === "add"} title={`Hinzufügen in ${targetLabel}`} onClose={() => setModal("")}>
<TargetLine label={targetLabel} chapters={record.chapters} chapterId={activeChapter?.id || ""} />
<div className="choice">
<button type="button" onClick={() => setModal("note")}>Notiz</button>
<button type="button" onClick={() => setModal("file")}>Datei</button>
@@ -246,16 +299,16 @@ export function MatterDetail() {
</div>
</Modal>
<Modal open={modal === "note"} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={rightsContext} placement={placement} chapters={record.chapters} onChange={() => { setModal(""); load(); }} />
<NoteForm context={rightsContext} placement={placement} chapters={record.chapters} initialChapter={activeChapter?.id || ""} targetLabel={targetLabel} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "file"} title="Datei" onClose={() => setModal("")}>
<FileForm context={rightsContext} placement={placement} chapters={record.chapters} onChange={() => { setModal(""); load(); }} />
<FileForm context={rightsContext} placement={placement} chapters={record.chapters} initialChapter={activeChapter?.id || ""} targetLabel={targetLabel} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "paperless"} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={rightsContext} placement={placement} onDone={() => { setModal(""); load(); }} />
<PaperlessPicker context={rightsContext} placement={placement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={targetLabel} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "mail"} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={rightsContext} placement={placement} onDone={() => { setModal(""); load(); }} />
<MailPicker context={rightsContext} placement={placement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={targetLabel} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "submatter"} title="Teilvorgang anlegen" onClose={() => setModal("")}>
<SubmatterForm parentId={id} context={inherited} onChange={() => { setModal(""); load(); }} />
@@ -263,8 +316,18 @@ export function MatterDetail() {
<Modal open={modal === "cross"} title="Querverweis" onClose={() => setModal("")}>
<CrossLinkForm matterId={id} context={inherited} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "chapter"} title="Kapitel anlegen" onClose={() => setModal("")}>
<ChapterForm path={`/api/v1/matters/${id}/chapters${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "chapter"} title={`Kapitel in ${targetLabel} hinzufügen`} onClose={() => setModal("")}>
<ChapterForm
path={`/api/v1/matters/${id}/chapters${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`}
onChange={(created) => {
setModal("");
if (created?.id) {
pendingChapter.current = created.id;
writeChapter(params, setParams, created.id);
}
load();
}}
/>
</Modal>
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
<ShareBox path={`/api/v1/matters/${id}/grants`} grants={record.grants || []} onChange={load} />
+24 -2
View File
@@ -11,6 +11,28 @@ function pageContext(params) {
return { kind, id };
}
function returnHref(kind, id, params) {
const bereich = params.get("bereich");
const kapitel = params.get("kapitel");
const contextKind = params.get("context_kind");
const contextId = params.get("context_id");
if (kind === "matters" && bereich && contextKind === "case" && contextId) {
const search = new URLSearchParams();
search.set("bereich", bereich);
if (kapitel) search.set("kapitel", kapitel);
return `/cases/${contextId}?${search}`;
}
const search = new URLSearchParams();
if (kind === "matters" && contextKind && contextId && contextKind !== "direct") {
search.set("context_kind", contextKind);
search.set("context_id", contextId);
}
if (kind === "cases" && bereich) search.set("bereich", bereich);
if (kapitel) search.set("kapitel", kapitel);
const query = search.toString();
return `/${kind}/${id}${query ? `?${query}` : ""}`;
}
export function Reader() {
const location = useLocation();
const kind = location.pathname.startsWith("/cases") ? "cases" : "matters";
@@ -86,13 +108,13 @@ export function Reader() {
}, [record?.binding?.id]);
if (error && !record?.binding) {
return <main className="page"><ErrorNote error={error} /><p><Link to={`/${kind}/${id}${query}`}>Zurück</Link></p></main>;
return <main className="page"><ErrorNote error={error} /><p><Link to={returnHref(kind, id, params)}>Zurück</Link></p></main>;
}
if (!record?.binding) return <main className="page"><p className="muted">Unterlage wird geladen …</p></main>;
const binding = record.binding;
const element = binding.element;
const back = `/${kind}/${id}${query}`;
const back = returnHref(kind, id, params);
async function openFile() {
setError("");
+7 -3
View File
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api } from "../api.js";
import { formatDate } from "./content.jsx";
import { TargetLine, formatDate } from "./content.jsx";
import { ErrorNote } from "./widgets.jsx";
export function Sources() {
@@ -134,7 +134,7 @@ function MailForm({ onSaved, onError }) {
);
}
export function PaperlessPicker({ context, placement, onDone }) {
export function PaperlessPicker({ context, placement, chapterId = "", chapterTitle = "", targetLabel = "", onDone }) {
const [query, setQuery] = useState("");
const [items, setItems] = useState([]);
const [error, setError] = useState("");
@@ -161,6 +161,7 @@ export function PaperlessPicker({ context, placement, onDone }) {
external_id: item.id,
context,
...(placement ? { placement } : {}),
...(chapterId ? { chapter_id: chapterId } : {}),
...(item.document_on || item.correspondent || item.open_url
? {
dates: { document_on: item.document_on || null, sent_on: null, received_on: null },
@@ -180,6 +181,7 @@ export function PaperlessPicker({ context, placement, onDone }) {
return (
<div className="stack">
<TargetLine label={targetLabel} chapterId={chapterId} chapterTitle={chapterTitle} />
<form onSubmit={search} className="inline">
<input value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Titel oder Stichwort" />
<button type="submit">Suchen</button>
@@ -195,7 +197,7 @@ export function PaperlessPicker({ context, placement, onDone }) {
);
}
export function MailPicker({ context, placement, onDone }) {
export function MailPicker({ context, placement, chapterId = "", chapterTitle = "", targetLabel = "", onDone }) {
const [accounts, setAccounts] = useState([]);
const [accountId, setAccountId] = useState("");
const [folders, setFolders] = useState([]);
@@ -319,6 +321,7 @@ export function MailPicker({ context, placement, onDone }) {
external_id: item.id,
context,
...(placement ? { placement } : {}),
...(chapterId ? { chapter_id: chapterId } : {}),
...(item.document_on ? { dates: { document_on: item.document_on, sent_on: null, received_on: null } } : {}),
...(item.message_from ? { detail: { message_from: item.message_from } } : {}),
},
@@ -331,6 +334,7 @@ export function MailPicker({ context, placement, onDone }) {
return (
<div className="stack">
<TargetLine label={targetLabel} chapterId={chapterId} chapterTitle={chapterTitle} />
<label>
Konto
<select value={accountId} onChange={(event) => setAccountId(event.target.value)}>
+96 -29
View File
@@ -17,6 +17,51 @@ export function formatStamp(value) {
return `${formatDate(day)} ${time.replace("Z", " UTC").slice(0, 8)}`.trim();
}
export function selectionOf(params) {
return {
scope: params.get("bereich") || "all",
chapterId: params.get("kapitel") || "",
};
}
export function writeSelection(params, setParams, scope, chapterId) {
const next = new URLSearchParams(params);
if (!scope || scope === "all") next.delete("bereich");
else next.set("bereich", scope);
if (chapterId) next.set("kapitel", chapterId);
else next.delete("kapitel");
setParams(next, { replace: true });
}
export function writeChapter(params, setParams, chapterId) {
const next = new URLSearchParams(params);
if (chapterId) next.set("kapitel", chapterId);
else next.delete("kapitel");
setParams(next, { replace: true });
}
export function withSelection(href, params) {
const url = new URL(href, "http://tsumugu.local");
for (const key of ["bereich", "kapitel"]) {
const value = params.get(key);
if (value && !url.searchParams.has(key)) url.searchParams.set(key, value);
}
const search = url.searchParams.toString();
return `${url.pathname}${search ? `?${search}` : ""}`;
}
export function TargetLine({ label, chapters = [], chapterId = "", chapterTitle = "" }) {
if (!label) return null;
const chapter = chapters.find((item) => item.id === chapterId);
const namedChapter = chapter?.title || chapterTitle;
return (
<p className="target-line">
Ziel: <strong>{label}</strong>
{namedChapter ? <> · Kapitel <strong>{namedChapter}</strong></> : null}
</p>
);
}
export function kindLabel(kind) {
if (kind === "note") return "Notiz";
if (kind === "file") return "Datei";
@@ -417,20 +462,16 @@ export function ContentBoard({
return (
<div className="contents" ref={rootRef}>
{canSort ? (
<div className="order-bar" role="group" aria-label="Ordnung der Inhalte">
<button type="button" className={record.content_order !== "position" && direction === "asc" ? "" : "quiet"} disabled={pending} onClick={() => saveMode("date", "asc")}>
Fachliches Datum, aufsteigend
</button>
<button type="button" className={record.content_order !== "position" && direction === "desc" ? "" : "quiet"} disabled={pending} onClick={() => saveMode("date", "desc")}>
Fachliches Datum, absteigend
</button>
<button type="button" className={custom ? "" : "quiet"} disabled={pending} onClick={() => saveMode("position", direction)}>
Eigene Reihenfolge
</button>
</div>
) : (
<p className="muted">{sortable ? (custom ? "Eigene Reihenfolge" : `Fachliches Datum, ${direction === "desc" ? "absteigend" : "aufsteigend"}`) : "Lesesicht nach fachlichem Datum. Zum Ordnen einen einzelnen Bereich wählen."}</p>
)}
<OrderChoice
mode={custom ? "position" : "date"}
direction={direction}
disabled={pending}
allowPosition
onChange={saveMode}
/>
) : sortable ? (
<p className="muted">{custom ? "Eigene Reihenfolge" : `Fachliches Datum, ${direction === "desc" ? "absteigend" : "aufsteigend"}`}</p>
) : null}
{pending ? <p className="muted">Ordnung wird gespeichert …</p> : null}
<ErrorNote error={error} />
{source.length || chapters.length ? (
@@ -473,25 +514,28 @@ export function ContentBoard({
{text ? <span className="preview-row__text">{text}</span> : null}
{binding.origin ? <span className="preview-row__origin">{binding.origin}{binding.shared ? " · weitere Einbindung" : ""}</span> : null}
</Link>
{canSort && (custom || chapters.length) ? (
<details className="row-menu">
<summary>{custom ? "Ordnen" : "Einordnen"}</summary>
{custom ? (
<>
{(canSort && custom) || (canSort && chapters.length) ? (
<div className="preview-row__actions">
{canSort && custom ? (
<details className="row-menu">
<summary>Reihenfolge</summary>
<button type="button" aria-label={`${element.title} nach oben`} disabled={pending || index === 0} onClick={() => move(binding.id, -1)}>Nach oben</button>
<button type="button" aria-label={`${element.title} nach unten`} disabled={pending || index === section.items.length - 1} onClick={() => move(binding.id, 1)}>Nach unten</button>
</>
</details>
) : null}
{chapters.length ? (
<label>
In Kapitel einordnen
<select value={binding.chapter_id || ""} disabled={pending} onChange={(event) => placeChapter(binding.id, event.target.value)}>
<option value="">Ohne Kapitel</option>
{chapters.map((chapter) => <option key={chapter.id} value={chapter.id}>{chapter.title}</option>)}
</select>
</label>
{canSort && chapters.length ? (
<details className="row-menu">
<summary>In Kapitel einordnen</summary>
<label>
Kapitel
<select value={binding.chapter_id || ""} disabled={pending} onChange={(event) => placeChapter(binding.id, event.target.value)}>
<option value="">Ohne Kapitel</option>
{chapters.map((chapter) => <option key={chapter.id} value={chapter.id}>{chapter.title}</option>)}
</select>
</label>
</details>
) : null}
</details>
</div>
) : null}
</li>
);
@@ -507,6 +551,29 @@ export function ContentBoard({
);
}
export function OrderChoice({ mode, direction, disabled, allowPosition = false, onChange }) {
const value = mode === "position" ? "position" : direction === "desc" ? "date-desc" : "date-asc";
return (
<label className="order-choice">
<span>Ordnung</span>
<select
aria-label="Ordnung der Inhalte"
value={value}
disabled={disabled}
onChange={(event) => {
const next = event.target.value;
if (next === "position") onChange("position", direction === "desc" ? "desc" : "asc");
else onChange("date", next === "date-desc" ? "desc" : "asc");
}}
>
<option value="date-asc">Fachliches Datum, aufsteigend</option>
<option value="date-desc">Fachliches Datum, absteigend</option>
{allowPosition ? <option value="position">Eigene Reihenfolge</option> : null}
</select>
</label>
);
}
export function CourseList({ items }) {
if (!items) return <p className="muted">Verlauf wird geladen …</p>;
if (!items.length) return <p className="muted">Noch kein fachlicher Verlauf.</p>;
+56 -19
View File
@@ -47,7 +47,7 @@ body {
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-dark); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h1, .page-title { font-size: 20px; margin-bottom: 4px; }
h1, .page-title { font-size: 28px; margin-bottom: 4px; letter-spacing: -0.02em; line-height: 1.2; }
h2, h3 { font-size: 15px; }
p { margin: 0; }
@@ -362,8 +362,8 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.modal h2 { font-size: 18px; color: var(--text1); text-transform: none; letter-spacing: 0; margin: 0; }
.modal h3 { font-size: 13px; }
.page { display: grid; gap: 16px; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; flex-wrap: wrap; }
.page { display: grid; gap: 22px; }
.page-head { display: flex; justify-content: space-between; gap: 16px 24px; align-items: start; flex-wrap: wrap; }
.page-head > * { min-width: 0; }
.page-head > :first-child { flex: 1 1 16rem; }
.split, .forms { display: grid; gap: 12px; }
@@ -408,14 +408,14 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.trail { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 15px; margin-bottom: 10px; }
.trail a, .trail [aria-current="page"] { font-weight: 700; }
.trail__sep { color: var(--text3); }
.hierarchy { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.hierarchy ul { list-style: none; margin: 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--border); display: grid; gap: 4px; }
.hierarchy { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.hierarchy ul { list-style: none; margin: 0; padding: 2px 0 2px 12px; border-left: 2px solid var(--border); display: grid; gap: 2px; }
.hierarchy__line { display: flex; align-items: center; gap: 8px; }
.hierarchy__line .hierarchy__row { flex: 1; }
.hierarchy__open { flex: 0 0 auto; font-size: 13px; }
.hierarchy__row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; min-height: 36px; padding: 4px 8px; text-decoration: none; color: inherit; border-radius: 8px; }
.hierarchy__row.is-current { background: var(--accent-light); }
.hierarchy__kind { min-width: 7.2rem; color: var(--accent-dark); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.hierarchy__row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; min-height: 34px; padding: 6px 8px; text-decoration: none; color: inherit; border-radius: 8px; }
.hierarchy__row.is-current { background: var(--accent-light); box-shadow: inset 3px 0 0 var(--accent); }
.hierarchy__kind { min-width: 5.6rem; color: var(--accent-dark); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.hierarchy__parent { margin-bottom: 8px; }
.order-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.order-bar button { min-height: 44px; }
@@ -435,7 +435,12 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.content-row__title { font-weight: 650; }
.content-row__kind { color: var(--text3); font-size: 13px; }
.content-row__move { display: flex; gap: 4px; }
.chapter-title { margin: 14px 0 4px; font-size: 14px; }
.chapter-title { margin: 22px 0 4px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text3); }
.order-choice { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; max-width: 36rem; font-size: 14px; }
.order-choice select { width: auto; min-width: 16rem; flex: 1; }
.target-line { margin: 0; color: var(--text2); overflow-wrap: break-word; }
.target-line strong { color: var(--text1); }
.content-section { display: grid; gap: 2px; }
.fold { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); margin-top: 16px; }
.fold summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.tree { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
@@ -465,7 +470,7 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.app-header { grid-template-columns: 1fr; }
.app-main {
padding: 24px 32px 32px;
max-width: 1200px;
max-width: 1280px;
margin-left: auto;
margin-right: auto;
width: 100%;
@@ -478,23 +483,29 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.timeline li, .item-head, .index li, .work li { display: grid; }
}
.record-layout { display: grid; gap: 20px; align-items: start; }
.outline-nav { display: grid; gap: 8px; }
.record-layout { display: grid; gap: 28px; align-items: start; }
.record-main { display: grid; gap: 16px; align-content: start; min-width: 0; }
.outline-nav { display: grid; gap: 6px; }
.outline { padding: 4px 0 8px; }
.outline-nav h2, .outline-nav h3 { margin: 8px 0 0; }
.outline__toggle { display: none; }
button.hierarchy__row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; font-weight: 600; cursor: pointer; }
.preview-list { list-style: none; margin: 0; padding: 0; }
.preview-row {
display: flex;
gap: 10px;
flex-wrap: wrap;
gap: 14px;
align-items: flex-start;
padding: 10px 0;
padding: 14px 0;
border-top: 1px solid var(--border);
position: relative;
min-width: 0;
}
.preview-row.is-dragging { opacity: 0.4; }
.preview-row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.preview-row__meta, .preview-row__origin { color: var(--text2); font-size: 13px; }
.preview-row__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 18rem; color: inherit; text-decoration: none; }
.preview-row__main strong { font-size: 16px; line-height: 1.35; overflow-wrap: break-word; }
.preview-row__meta, .preview-row__origin { color: var(--text2); font-size: 13px; overflow-wrap: break-word; }
.preview-row__actions { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: auto; align-items: flex-start; }
.preview-row__text {
color: var(--text);
display: -webkit-box;
@@ -539,7 +550,23 @@ button.hierarchy__row { width: 100%; border: 0; background: transparent; text-al
background-size: 5px 5px;
}
.insert-line { height: 4px; background: var(--accent); border-radius: 2px; list-style: none; margin: 2px 0; }
.row-menu { font-size: 14px; }
.row-menu { font-size: 13px; align-content: start; }
.row-menu summary {
cursor: pointer;
color: var(--text2);
font-size: 13px;
font-weight: 600;
min-height: 32px;
display: flex;
align-items: center;
}
.row-menu button {
min-height: 36px;
padding: 6px 10px;
background: var(--surface2);
color: var(--text2);
border: 1px solid var(--border2);
}
.row-menu, .menu-list { display: grid; gap: 8px; }
.menu-list button { width: 100%; justify-content: flex-start; }
.placements { margin: 4px 0 0; overflow-wrap: anywhere; }
@@ -570,7 +597,17 @@ button.hierarchy__row { width: 100%; border: 0; background: transparent; text-al
.mail-row span:last-child { grid-column: 2; color: var(--text2); font-size: 13px; overflow-wrap: anywhere; }
@media (min-width: 900px) {
.record-layout { grid-template-columns: 240px minmax(0, 1fr); }
.record-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
}
@media (max-width: 720px) {
h1, .page-title { font-size: 24px; }
.order-choice { align-items: stretch; flex-direction: column; max-width: none; }
.order-choice select { width: 100%; min-width: 0; }
.preview-row { gap: 10px 12px; }
.preview-row__main { flex-basis: 12rem; }
.preview-row__actions { flex-basis: 100%; margin-left: 0; }
.thumb { width: 56px; height: 74px; flex-basis: 56px; }
}
@media (max-width: 899px) {