Zeige die Strukturhierarchie direkt auf Akte und Vorgang.
Deploy Development / deploy (push) Successful in 21s
Deploy Development / deploy (push) Successful in 21s
Unterakten, Teilvorgaenge, Kapitel und Querverweise sind sichtbar und lassen sich oeffnen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
871c7d3ad5
commit
528fc191e8
4 files changed
+193
-61
No files matched your search
@@ -196,6 +196,10 @@ def case_detail(conn, actor: UUID, case: dict, rights) -> dict:
|
||||
payload = case_summary(case, rights)
|
||||
payload["home_scope_name"] = room_name(conn, case["home_scope_id"])
|
||||
payload["is_owner"] = case["owner_subject_id"] == actor
|
||||
if case["parent_case_id"]:
|
||||
parent = get_case(conn, case["parent_case_id"])
|
||||
if parent is not None and case_rights(conn, actor, parent).read:
|
||||
payload["parent_title"] = parent["title"]
|
||||
payload["chapters"] = _chapters(conn, "case", case["id"])
|
||||
subcases = []
|
||||
for row in conn.execute(
|
||||
@@ -287,6 +291,7 @@ def matter_detail(conn, actor: UUID, matter: dict, rights, context: Ctx | None)
|
||||
"status": matter["record_status"],
|
||||
"version": matter["version"],
|
||||
"parent_matter_id": str(matter["parent_matter_id"]) if matter["parent_matter_id"] else None,
|
||||
"parent_title": matter_title_if_readable(conn, actor, matter["parent_matter_id"]),
|
||||
"home_scope_id": str(matter["home_scope_id"]),
|
||||
"home_scope_name": room_name(conn, matter["home_scope_id"]),
|
||||
"is_owner": matter["owner_subject_id"] == actor,
|
||||
|
||||
@@ -127,6 +127,9 @@ export function CaseDetail() {
|
||||
<main className="page">
|
||||
<header className="page-head">
|
||||
<div>
|
||||
{record.parent_case_id && record.parent_title ? (
|
||||
<p className="crumb"><Link to={`/cases/${record.parent_case_id}`}>Akte {record.parent_title}</Link></p>
|
||||
) : null}
|
||||
<p className="eyebrow">{record.home_scope_name}</p>
|
||||
<h1>{record.title}</h1>
|
||||
<p className="muted">{rightsText(record.rights)} {record.status === "open" ? "Offen" : "Geschlossen"}.</p>
|
||||
@@ -157,34 +160,34 @@ export function CaseDetail() {
|
||||
<h2>Unterlagen</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("add")}>Hinzufügen</button> : null}
|
||||
</div>
|
||||
{record.bindings.length ? (
|
||||
<div className="tiles">
|
||||
{record.bindings.map((binding) => (
|
||||
<button key={binding.id} type="button" className="tile" onClick={() => setSelected(binding)}>
|
||||
<span className="tile__kind">{sourceKind(binding.element)}</span>
|
||||
<strong>{binding.element.title}</strong>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Noch keine Notiz, Datei oder Verknüpfung.</p>
|
||||
)}
|
||||
</section>
|
||||
{record.subcases?.length ? (
|
||||
<section className="section">
|
||||
<section className="section">
|
||||
<div className="section-bar">
|
||||
<h2>Unterakten</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("subcase")}>Unterakte anlegen</button> : null}
|
||||
</div>
|
||||
{record.subcases?.length ? (
|
||||
<div className="tiles">
|
||||
{record.subcases.map((item) => (
|
||||
<Link key={item.id} className="tile" to={`/cases/${item.id}`}>
|
||||
<span className="tile__kind">Unterakte</span>
|
||||
<strong>{item.title}</strong>
|
||||
<span>{item.rights_mode === "explicit" ? "Eigene Rechte" : "Rechte der Akte"}</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
) : (
|
||||
<p className="muted">Keine Unterakte. Ein eigener Bereich mit abweichenden Rechten wird hier angelegt.</p>
|
||||
)}
|
||||
</section>
|
||||
<section className="section">
|
||||
<div className="section-bar">
|
||||
<h2>Kapitel</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("chapter")}>Kapitel anlegen</button> : null}
|
||||
</div>
|
||||
<ChapterBoard chapters={record.chapters} bindings={record.bindings} onOpen={setSelected} />
|
||||
</section>
|
||||
<div className="row">
|
||||
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("more")}>Kapitel und Unterakte</button> : null}
|
||||
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
|
||||
</div>
|
||||
<section className="section">
|
||||
@@ -214,11 +217,11 @@ export function CaseDetail() {
|
||||
<Modal open={modal === "mail"} title="E-Mail verbinden" onClose={() => setModal("")}>
|
||||
<MailPicker context={context} onDone={() => { setModal(""); load(); }} />
|
||||
</Modal>
|
||||
<Modal open={modal === "more"} title="Struktur" onClose={() => setModal("")}>
|
||||
<div className="stack">
|
||||
<ChapterForm path={`/api/v1/cases/${id}/chapters`} onChange={load} />
|
||||
<NewSubcase parentId={id} onChange={load} />
|
||||
</div>
|
||||
<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>
|
||||
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
|
||||
<ShareBox path={`/api/v1/cases/${id}/grants`} grants={record.grants || []} onChange={load} />
|
||||
@@ -232,6 +235,44 @@ export function CaseDetail() {
|
||||
);
|
||||
}
|
||||
|
||||
export function ChapterBoard({ chapters, bindings, onOpen }) {
|
||||
const loose = bindings.filter((item) => !item.chapter_id);
|
||||
return (
|
||||
<div className="stack">
|
||||
{chapters.map((chapter) => (
|
||||
<div key={chapter.id} className="chapter">
|
||||
<h3>{chapter.title}</h3>
|
||||
<BindingTiles items={bindings.filter((item) => item.chapter_id === chapter.id)} onOpen={onOpen} />
|
||||
</div>
|
||||
))}
|
||||
{loose.length || !chapters.length ? (
|
||||
<div className="chapter">
|
||||
{chapters.length ? <h3>Ohne Kapitel</h3> : null}
|
||||
<BindingTiles
|
||||
items={loose}
|
||||
onOpen={onOpen}
|
||||
empty={chapters.length ? "Außerhalb der Kapitel liegt noch nichts." : "Noch keine Notiz, Datei oder Verknüpfung."}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function BindingTiles({ items, onOpen, empty }) {
|
||||
if (!items.length) return <p className="muted">{empty || "In diesem Kapitel liegt noch nichts."}</p>;
|
||||
return (
|
||||
<div className="tiles">
|
||||
{items.map((binding) => (
|
||||
<button key={binding.id} type="button" className="tile" onClick={() => onOpen(binding)}>
|
||||
<span className="tile__kind">{sourceKind(binding.element)}</span>
|
||||
<strong>{binding.element.title}</strong>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function sourceKind(element) {
|
||||
if (element.kind === "note") return "Notiz";
|
||||
if (element.kind === "file") return "Datei";
|
||||
|
||||
+121
-39
@@ -5,7 +5,7 @@ import { SessionContext } from "../session.js";
|
||||
import { Modal } from "./Modal.jsx";
|
||||
import { MailPicker, PaperlessPicker } from "./Sources.jsx";
|
||||
import { BindingList, Chronology, ErrorNote, ShareBox } from "./widgets.jsx";
|
||||
import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx";
|
||||
import { ChapterBoard, ChapterForm, FileForm, NoteForm } from "./Cases.jsx";
|
||||
|
||||
function pageContext(params) {
|
||||
const kind = params.get("context_kind");
|
||||
@@ -98,24 +98,71 @@ export function MatterDetail() {
|
||||
<main className="page">
|
||||
<header className="page-head">
|
||||
<div>
|
||||
{record.parent_matter_id && record.parent_title ? (
|
||||
<p className="crumb">
|
||||
<Link to={`/matters/${record.parent_matter_id}${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`}>
|
||||
Vorgang {record.parent_title}
|
||||
</Link>
|
||||
</p>
|
||||
) : null}
|
||||
<p className="eyebrow">{record.home_scope_name}{inherited ? " · über die Akte geöffnet" : ""}</p>
|
||||
<h1>{record.title}</h1>
|
||||
<p className="muted">{record.status === "open" ? "Offen" : "Geschlossen"}. Eine Aufgabe und eine Frist bleiben unabhängig.</p>
|
||||
</div>
|
||||
</header>
|
||||
<ErrorNote error={error} />
|
||||
{record.case_links?.length ? (
|
||||
<div className="tiles">
|
||||
{record.case_links.map((link) => (
|
||||
<Link key={link.id} className="tile" to={`/cases/${link.case_id}`}>
|
||||
<span className="tile__kind">Akte</span>
|
||||
<strong>{link.title}</strong>
|
||||
</Link>
|
||||
))}
|
||||
<section className="section">
|
||||
<h2>Akten</h2>
|
||||
{record.case_links?.length ? (
|
||||
<div className="tiles">
|
||||
{record.case_links.map((link) => (
|
||||
<Link key={link.id} className="tile" to={`/cases/${link.case_id}`}>
|
||||
<span className="tile__kind">Akte</span>
|
||||
<strong>{link.title}</strong>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Dieser Vorgang liegt noch in keiner Akte.</p>
|
||||
)}
|
||||
</section>
|
||||
<section className="section">
|
||||
<div className="section-bar">
|
||||
<h2>Teilvorgänge</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("submatter")}>Teilvorgang anlegen</button> : null}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Dieser Vorgang liegt noch in keiner Akte.</p>
|
||||
)}
|
||||
{record.submatters?.length ? (
|
||||
<div className="tiles">
|
||||
{record.submatters.map((item) => (
|
||||
<Link key={item.id} className="tile" to={`/matters/${item.id}${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`}>
|
||||
<span className="tile__kind">Teilvorgang</span>
|
||||
<strong>{item.title}</strong>
|
||||
<span>{item.status === "open" ? "Offen" : "Geschlossen"}</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Kein Teilvorgang. Ein untergeordneter Sachverhalt wird hier angelegt.</p>
|
||||
)}
|
||||
</section>
|
||||
<section className="section">
|
||||
<div className="section-bar">
|
||||
<h2>Querverweise</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("cross")}>Querverweis</button> : null}
|
||||
</div>
|
||||
{record.cross_links?.length ? (
|
||||
<div className="tiles">
|
||||
{record.cross_links.map((item) => (
|
||||
<Link key={item.id} className="tile" to={`/matters/${item.matter_id}`}>
|
||||
<span className="tile__kind">Querverweis</span>
|
||||
<strong>{item.title}</strong>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Kein Querverweis. Er zeigt denselben Vorgang woanders, ohne ihn zu kopieren.</p>
|
||||
)}
|
||||
</section>
|
||||
<section className="section">
|
||||
<div className="section-bar">
|
||||
<h2>Nachverfolgung</h2>
|
||||
@@ -129,21 +176,12 @@ export function MatterDetail() {
|
||||
<h2>Unterlagen</h2>
|
||||
{record.rights.edit ? <button type="button" onClick={() => setModal("add")}>Hinzufügen</button> : null}
|
||||
</div>
|
||||
{record.bindings.length ? (
|
||||
<div className="tiles">
|
||||
{record.bindings.map((binding) => (
|
||||
<button key={binding.id} type="button" className="tile" onClick={() => setSelected(binding)}>
|
||||
<span className="tile__kind">{binding.element.kind === "note" ? "Notiz" : binding.element.kind === "file" ? "Datei" : binding.element.external?.source === "imap" ? "E-Mail" : "Paperless"}</span>
|
||||
<strong>{binding.element.title}</strong>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted">Noch nichts in diesem Vorgang.</p>
|
||||
)}
|
||||
<ChapterBoard chapters={record.chapters} bindings={record.bindings} onOpen={setSelected} />
|
||||
{record.rights.edit ? (
|
||||
<button type="button" className="quiet" onClick={() => setModal("chapter")}>Kapitel anlegen</button>
|
||||
) : null}
|
||||
</section>
|
||||
<div className="row">
|
||||
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("more")}>Kapitel und Teilvorgang</button> : null}
|
||||
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
|
||||
</div>
|
||||
<section className="section">
|
||||
@@ -173,20 +211,14 @@ export function MatterDetail() {
|
||||
<Modal open={modal === "mail"} title="E-Mail verbinden" onClose={() => setModal("")}>
|
||||
<MailPicker context={rightsContext} placement={placement} onDone={() => { setModal(""); load(); }} />
|
||||
</Modal>
|
||||
<Modal open={modal === "more"} title="Struktur" onClose={() => setModal("")}>
|
||||
<div className="stack">
|
||||
<ChapterForm path={`/api/v1/matters/${id}/chapters${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`} onChange={load} />
|
||||
<SubmatterForm parentId={id} context={inherited} onChange={load} />
|
||||
{record.submatters?.length ? (
|
||||
<ul className="index">
|
||||
{record.submatters.map((item) => (
|
||||
<li key={item.id}>
|
||||
<Link to={`/matters/${item.id}${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`}>{item.title}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</div>
|
||||
<Modal open={modal === "submatter"} title="Teilvorgang anlegen" onClose={() => setModal("")}>
|
||||
<SubmatterForm parentId={id} context={inherited} onChange={() => { setModal(""); load(); }} />
|
||||
</Modal>
|
||||
<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>
|
||||
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
|
||||
<ShareBox path={`/api/v1/matters/${id}/grants`} grants={record.grants || []} onChange={load} />
|
||||
@@ -354,6 +386,56 @@ function WorkForms({ matterId, context, tasks, onChange }) {
|
||||
);
|
||||
}
|
||||
|
||||
function CrossLinkForm({ matterId, context, onChange }) {
|
||||
const [targets, setTargets] = useState([]);
|
||||
const [targetId, setTargetId] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
api("/api/v1/placement-targets")
|
||||
.then((data) => setTargets(data.items.filter((item) => item.kind === "matter" && item.id !== matterId)))
|
||||
.catch((err) => setError(err.message));
|
||||
}, [matterId]);
|
||||
|
||||
async function submit(event) {
|
||||
event.preventDefault();
|
||||
const target = targets.find((item) => item.id === targetId);
|
||||
if (!target) return;
|
||||
const via = (target.contexts || []).find((item) => item.kind === "direct") || target.contexts?.[0];
|
||||
const targetContext = !via || via.kind === "direct" ? { kind: "matter", id: target.id } : { kind: via.kind, id: via.id };
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/matters/${matterId}/cross-links`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
target_matter_id: target.id,
|
||||
target_context: targetContext,
|
||||
...(context ? { source_context: context } : {}),
|
||||
},
|
||||
});
|
||||
onChange();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={submit} className="stack">
|
||||
<label>
|
||||
Vorgang
|
||||
<select value={targetId} onChange={(event) => setTargetId(event.target.value)} required>
|
||||
<option value="">Auswählen</option>
|
||||
{targets.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.title}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit" disabled={!targetId}>Verweisen</button>
|
||||
<ErrorNote error={error} />
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function SubmatterForm({ parentId, context, onChange }) {
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
|
||||
@@ -295,6 +295,10 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
|
||||
}
|
||||
.desktop-sidebar__logout:hover { color: var(--danger); background: rgba(216, 90, 48, 0.08); }
|
||||
|
||||
.crumb { margin: 0 0 6px; }
|
||||
.crumb a { font-weight: 600; text-decoration: none; }
|
||||
.chapter { display: grid; gap: 8px; }
|
||||
.chapter h3 { font-size: 15px; color: var(--text1); text-transform: none; letter-spacing: 0; }
|
||||
.section { display: grid; gap: 10px; }
|
||||
.section-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
|
||||
.section-bar h2, .section > h2 {
|
||||
|
||||
Reference in new issue
Block a user