Lass E-Mails ueber die Faecher finden und halte Kapitel sowie das Menue in der Akte an ihrem Ort.
Deploy Development / deploy (push) Successful in 23s
Test Suite / pytest-backend (push) Successful in 1m1s
Test Suite / smoke-dev (push) Successful in 1s
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 10:59:03 +02:00
1 parent 3465ed57f6
commit 67d48378c9
11 files changed
+696 -160

No files matched your search

+68 -41
View File
@@ -104,6 +104,53 @@ function OutlineLink({ kind, title, to }) {
);
}
function matterChapters(record, matterId) {
return (record.contained || []).find((item) => item.matter_id === matterId)?.chapters || [];
}
function ChapterLinks({ chapters, scopeId, scope, chapterId, onChapter }) {
if (!chapters.length) return null;
return (
<ul>
{chapters.map((chapter) => (
<li key={chapter.id}>
<button
type="button"
className={scope === scopeId && chapterId === chapter.id ? "hierarchy__row is-current" : "hierarchy__row"}
onClick={() => onChapter(scopeId, chapter.id)}
>
<span className="hierarchy__kind">Kapitel</span>
<strong>{chapter.title}</strong>
</button>
</li>
))}
</ul>
);
}
function MatterBranch({ matter, caseId, scope, chapterId, record, onScope, onChapter }) {
const selected = scope === matter.id && !chapterId;
return (
<li>
<div className="hierarchy__line">
<button type="button" className={selected ? "hierarchy__row is-current" : "hierarchy__row"} onClick={() => onScope(matter.id)}>
<span className="hierarchy__kind">{matter.kind_label || "Vorgang"}</span>
<strong>{matter.title}</strong>
</button>
<Link className="hierarchy__open" to={`/matters/${matter.id}?context_kind=case&context_id=${caseId}`}>Öffnen</Link>
</div>
<ChapterLinks chapters={matterChapters(record, matter.id)} scopeId={matter.id} scope={scope} chapterId={chapterId} onChapter={onChapter} />
{matter.children?.length ? (
<ul>
{matter.children.map((child) => (
<MatterBranch key={child.id} matter={child} caseId={caseId} scope={scope} chapterId={chapterId} record={record} onScope={onScope} onChapter={onChapter} />
))}
</ul>
) : null}
</li>
);
}
function CaseOutline({ record, caseId, scope, chapterId, onScope, onChapter }) {
const hasParent = Boolean(record.parent_case_id && record.parent_title);
return (
@@ -111,6 +158,7 @@ function CaseOutline({ record, caseId, scope, chapterId, onScope, onChapter }) {
<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>
<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>
) : null}
@@ -129,40 +177,7 @@ function CaseOutline({ record, caseId, scope, chapterId, onScope, onChapter }) {
<h3>Vorgänge</h3>
<ul className="hierarchy">
{record.matters.map((matter) => (
<li key={matter.id}>
<button type="button" className={scope === matter.id ? "hierarchy__row" : "hierarchy__row quiet"} onClick={() => onScope(matter.id)}>
<span className="hierarchy__kind">{matter.kind_label || "Vorgang"}</span>
<strong>{matter.title}</strong>
</button>
<Link className="muted" to={`/matters/${matter.id}?context_kind=case&context_id=${caseId}`}>Öffnen</Link>
{matter.children?.length ? (
<ul>
{matter.children.map((child) => (
<li key={child.id}>
<button type="button" className={scope === child.id ? "hierarchy__row" : "hierarchy__row quiet"} onClick={() => onScope(child.id)}>
<span className="hierarchy__kind">Teilvorgang</span>
<strong>{child.title}</strong>
</button>
</li>
))}
</ul>
) : null}
</li>
))}
</ul>
</>
) : null}
{scope === "direct" && record.chapters?.length ? (
<>
<h3>Kapitel</h3>
<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)}>
<span className="hierarchy__kind">Kapitel</span>
<strong>{chapter.title}</strong>
</button>
</li>
<MatterBranch key={matter.id} matter={matter} caseId={caseId} scope={scope} chapterId={chapterId} record={record} onScope={onScope} onChapter={onChapter} />
))}
</ul>
</>
@@ -171,16 +186,27 @@ function CaseOutline({ record, caseId, scope, chapterId, onScope, onChapter }) {
);
}
function matterOrigin(group) {
const kind = group.kind_label === "Teilvorgang" ? "Teilvorgang" : "Vorgang";
const parent = group.parent_title ? ` · Vorgang ${group.parent_title}` : "";
return `Aus ${kind} ${group.title}${parent}`;
}
function chapterOrigin(base, chapters, chapterId) {
const title = (chapters || []).find((chapter) => chapter.id === chapterId)?.title;
return title ? `${base} · Kapitel ${title}` : base;
}
function mergedCaseItems(record, direction, caseId) {
const rows = [
...(record.bindings || []).map((binding) => ({
...binding,
origin: "Direkt in dieser Akte",
origin: chapterOrigin("Direkt in dieser Akte", record.chapters, binding.chapter_id),
readerHref: `/cases/${caseId}/items/${binding.id}`,
})),
...(record.contained || []).flatMap((group) => (group.bindings || []).map((binding) => ({
...binding,
origin: `Aus Vorgang ${group.title}`,
origin: chapterOrigin(matterOrigin(group), group.chapters, binding.chapter_id),
readerHref: `/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${caseId}`,
}))),
];
@@ -239,7 +265,7 @@ export function CaseDetail() {
{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")}>Kapitel anlegen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("chapter")}>{group ? "Kapitel in diesem Vorgang anlegen" : "Kapitel anlegen"}</button> : null}
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
</ObjectMenu>
</div>
@@ -255,7 +281,7 @@ export function CaseDetail() {
scope={scope}
chapterId={chapterId}
onScope={(next) => { setScope(next); setChapterId(""); setView("contents"); setOutlineOpen(false); }}
onChapter={(next) => { setChapterId(next); setScope("direct"); setView("contents"); setOutlineOpen(false); }}
onChapter={(nextScope, nextChapter) => { setScope(nextScope); setChapterId(nextChapter); setView("contents"); setOutlineOpen(false); }}
/>
</div>
</aside>
@@ -295,6 +321,7 @@ export function CaseDetail() {
context={context}
containerKind="matter"
containerId={group.matter_id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => `/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${id}`}
/>
@@ -340,14 +367,14 @@ export function CaseDetail() {
<Modal open={modal === "paperless"} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={context} placement={addPlacement} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "mail"} title="E-Mail verbinden" onClose={() => setModal("")}>
<Modal open={modal === "mail"} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={context} placement={addPlacement} 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="Kapitel anlegen" onClose={() => setModal("")}>
<ChapterForm path={`/api/v1/cases/${id}/chapters`} onChange={() => { setModal(""); load(); }} />
<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>
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
<ShareBox path={`/api/v1/cases/${id}/grants`} grants={record.grants || []} onChange={load} />