Mache die Akte zum Sammler und binde Paperless sowie E-Mail an.
Deploy Development / deploy (push) Successful in 22s

Erfassen liegt in Dialogen, Vorgaenge erscheinen als Kacheln in der Akte, und Quellen lassen Dokumente und IMAP-Nachrichten verknuepfen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-16 22:29:41 +02:00
1 parent 332be8376e
commit b03f571cd8
16 files changed
+1040 -149

No files matched your search

+113 -80
View File
@@ -1,9 +1,11 @@
import { useContext, useEffect, useState } from "react";
import { Link, useParams, useSearchParams } from "react-router-dom";
import { api, markDirty } from "../api.js";
import { api } from "../api.js";
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, ContentForms } from "./Cases.jsx";
import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx";
function pageContext(params) {
const kind = params.get("context_kind");
@@ -15,7 +17,6 @@ function pageContext(params) {
export function MatterList() {
const { session } = useContext(SessionContext);
const [items, setItems] = useState([]);
const [title, setTitle] = useState("");
const [error, setError] = useState("");
async function load() {
@@ -27,48 +28,38 @@ export function MatterList() {
load().catch((err) => setError(err.message));
}, [session.scope.id]);
async function create(event) {
event.preventDefault();
try {
await api("/api/v1/matters", { method: "POST", body: { title } });
setTitle("");
markDirty(false);
await load();
} catch (err) {
setError(err.message);
}
}
return (
<main className="page">
<header className="page-head">
<div>
<h1>Vorgänge</h1>
<p className="muted">Ein Vorgang kann ohne Akte bestehen und mehreren Akten zugeordnet werden. Neu angelegt wird er in „{session.scope.name}“.</p>
<p className="muted">Ein Vorgang gehört in eine Akte. Lege ihn dort an, dann sammelt die Akte die Arbeit.</p>
</div>
<Link className="quiet linkish" to="/cases">Zu den Akten</Link>
</header>
<form onSubmit={create} className="inline">
<input value={title} onChange={(event) => { setTitle(event.target.value); markDirty(true); }} placeholder="Neuer Vorgang" required />
<button type="submit">Vorgang anlegen</button>
</form>
<ErrorNote error={error} />
<ul className="index">
{items.map((item) => {
const context = item.contexts?.[0];
const params = new URLSearchParams();
if (context && context.kind !== "direct") {
params.set("context_kind", context.kind);
params.set("context_id", context.id);
}
const suffix = params.toString() ? `?${params}` : "";
return (
<li key={item.id}>
<Link to={`/matters/${item.id}${suffix}`}>{item.title}</Link>
<span>{item.status === "open" ? "Offen" : "Geschlossen"}</span>
</li>
);
})}
</ul>
{items.length ? (
<div className="tiles">
{items.map((item) => {
const context = item.contexts?.[0];
const params = new URLSearchParams();
if (context && context.kind !== "direct") {
params.set("context_kind", context.kind);
params.set("context_id", context.id);
}
const suffix = params.toString() ? `?${params}` : "";
return (
<Link key={item.id} className="tile" to={`/matters/${item.id}${suffix}`}>
<span className="tile__kind">Vorgang</span>
<strong>{item.title}</strong>
<span>{item.status === "open" ? "Offen" : "Geschlossen"}</span>
</Link>
);
})}
</div>
) : (
<p className="muted">Noch kein Vorgang. Öffne eine Akte und lege ihn dort an.</p>
)}
</main>
);
}
@@ -80,6 +71,8 @@ export function MatterDetail() {
const [record, setRecord] = useState(null);
const [events, setEvents] = useState([]);
const [error, setError] = useState("");
const [modal, setModal] = useState("");
const [selected, setSelected] = useState(null);
const rightsContext = inherited || { kind: "matter", id };
const placement = inherited?.kind === "case" ? { kind: "matter", id } : null;
@@ -112,57 +105,97 @@ export function MatterDetail() {
</header>
<ErrorNote error={error} />
{record.case_links?.length ? (
<section className="card">
<h2>Akten</h2>
<ul>
{record.case_links.map((link) => (
<li key={link.id}><Link to={`/cases/${link.case_id}`}>{link.title}</Link></li>
))}
</ul>
</section>
) : null}
<section className="card">
<h2>Nachverfolgung</h2>
<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 className="section">
<div className="section-bar">
<h2>Nachverfolgung</h2>
{record.rights.edit ? <button type="button" onClick={() => setModal("work")}>Aufgabe oder Frist</button> : null}
</div>
<p className="notice">Das Erledigen einer Aufgabe erfüllt eine verknüpfte Frist nicht.</p>
<WorkLists record={record} context={inherited} onChange={load} />
{record.rights.edit ? <WorkForms matterId={id} context={inherited} tasks={record.tasks} onChange={load} /> : null}
</section>
<section className="card">
<h2>Inhalte</h2>
<BindingList bindings={record.bindings} context={rightsContext} canEdit={record.rights.edit} isOwner={record.is_owner} onChange={load} />
{record.rights.edit ? (
<ContentForms context={rightsContext} placement={placement} chapters={record.chapters} onChange={load} />
) : null}
</section>
<section className="card">
<h2>Kapitel, Teilvorgänge, Querverweise</h2>
<ul>{record.chapters.map((chapter) => <li key={chapter.id}>{chapter.title}</li>)}</ul>
{record.rights.edit ? <ChapterForm path={`/api/v1/matters/${id}/chapters${inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : ""}`} onChange={load} /> : null}
{record.submatters?.length ? (
<ul>
{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>
<section className="section">
<div className="section-bar">
<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>
))}
</ul>
) : null}
{record.cross_links?.length ? (
<ul>
{record.cross_links.map((item) => (
<li key={item.id}><Link to={`/matters/${item.matter_id}`}>{item.title}</Link></li>
))}
</ul>
) : null}
{record.rights.edit ? <SubmatterForm parentId={id} context={inherited} onChange={load} /> : null}
</div>
) : (
<p className="muted">Noch nichts in diesem Vorgang.</p>
)}
</section>
{record.rights.share || record.is_owner ? (
<ShareBox path={`/api/v1/matters/${id}/grants`} grants={record.grants || []} onChange={load} />
) : null}
<section className="card">
<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">
<h2>Chronologie</h2>
<Chronology items={events} />
</section>
<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("")}>
<div className="choice">
<button type="button" onClick={() => setModal("note")}>Notiz</button>
<button type="button" onClick={() => setModal("file")}>Datei</button>
<button type="button" onClick={() => setModal("paperless")}>Paperless</button>
<button type="button" onClick={() => setModal("mail")}>E-Mail</button>
</div>
</Modal>
<Modal open={modal === "note"} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={rightsContext} placement={placement} chapters={record.chapters} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "file"} title="Datei" onClose={() => setModal("")}>
<FileForm context={rightsContext} placement={placement} chapters={record.chapters} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "paperless"} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={rightsContext} placement={placement} onDone={() => { setModal(""); load(); }} />
</Modal>
<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>
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
<ShareBox path={`/api/v1/matters/${id}/grants`} grants={record.grants || []} onChange={load} />
</Modal>
<Modal open={Boolean(selected)} title={selected?.element.title || "Unterlage"} onClose={() => setSelected(null)}>
{selected ? (
<BindingList bindings={[selected]} context={rightsContext} canEdit={record.rights.edit} isOwner={record.is_owner} onChange={() => { setSelected(null); load(); }} />
) : null}
</Modal>
</main>
);
}