diff --git a/backend/app/api/routes.py b/backend/app/api/routes.py index d9bc820..7b0d3e0 100644 --- a/backend/app/api/routes.py +++ b/backend/app/api/routes.py @@ -67,6 +67,8 @@ from app.api.schemas import ( RoomIn, ScopeIn, TaskDeadlineIn, + TaskDependencyIn, + TaskElementsIn, SummaryPatch, TaskIn, TaskPatch, @@ -104,6 +106,9 @@ from app.ops import ( grant_access, link_matter_to_case, link_task_deadline, + link_task_dependency, + set_task_elements, + unlink_task_dependency, patch_case, patch_deadline, patch_matter, @@ -1054,6 +1059,47 @@ def post_task_deadline( return Response(status_code=204) +@router.put("/api/v1/tasks/{task_id}/elements", status_code=204) +def put_task_elements( + task_id: UUID, + body: TaskElementsIn, + principal: Principal = Depends(get_principal), + conn: Connection = Depends(get_conn), +): + set_task_elements(conn, principal.account_id, task_id, body.element_ids, _ctx_model(body.context)) + return Response(status_code=204) + + +@router.post("/api/v1/tasks/{task_id}/dependencies", status_code=204) +def post_task_dependency( + task_id: UUID, + body: TaskDependencyIn, + principal: Principal = Depends(get_principal), + conn: Connection = Depends(get_conn), +): + link_task_dependency(conn, principal.account_id, task_id, body.depends_on_task_id, _ctx_model(body.context)) + return Response(status_code=204) + + +@router.delete("/api/v1/tasks/{task_id}/dependencies/{depends_on_task_id}", status_code=204) +def delete_task_dependency( + task_id: UUID, + depends_on_task_id: UUID, + context_kind: str | None = None, + context_id: str | None = None, + principal: Principal = Depends(get_principal), + conn: Connection = Depends(get_conn), +): + unlink_task_dependency( + conn, + principal.account_id, + task_id, + depends_on_task_id, + parse_query_context(context_kind, context_id), + ) + return Response(status_code=204) + + @router.post("/api/v1/deadlines") def post_deadline(body: DeadlineIn, principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)): deadline = create_deadline( diff --git a/backend/app/api/schemas.py b/backend/app/api/schemas.py index 9b71878..a521ff8 100644 --- a/backend/app/api/schemas.py +++ b/backend/app/api/schemas.py @@ -282,3 +282,13 @@ class FulfillIn(APIModel): class TaskDeadlineIn(APIModel): deadline_id: UUID context: ContextIn | None = None + + +class TaskElementsIn(APIModel): + element_ids: list[UUID] = Field(default_factory=list, max_length=40) + context: ContextIn | None = None + + +class TaskDependencyIn(APIModel): + depends_on_task_id: UUID + context: ContextIn | None = None diff --git a/backend/app/fixtures.py b/backend/app/fixtures.py index 84e8962..8753294 100644 --- a/backend/app/fixtures.py +++ b/backend/app/fixtures.py @@ -52,6 +52,18 @@ _PURGE = ( WHERE owner_subject_id IN (SELECT id FROM fixture_accounts) """, """ + DELETE FROM task_element_links + WHERE task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) + OR element_id IN (SELECT id FROM elements WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) + OR created_by IN (SELECT id FROM fixture_accounts) + """, + """ + DELETE FROM task_dependencies + WHERE task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) + OR depends_on_task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) + OR created_by IN (SELECT id FROM fixture_accounts) + """, + """ DELETE FROM task_deadline_links WHERE task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) OR deadline_id IN (SELECT id FROM deadlines WHERE owner_subject_id IN (SELECT id FROM fixture_accounts)) diff --git a/backend/app/ops.py b/backend/app/ops.py index e7d234f..8c79172 100644 --- a/backend/app/ops.py +++ b/backend/app/ops.py @@ -875,6 +875,93 @@ def link_task_deadline(conn, actor: UUID, task_id: UUID, deadline_id: UUID, cont ) +def set_task_elements(conn, actor: UUID, task_id: UUID, element_ids: list[UUID], context: Ctx | None) -> None: + task = get_task(conn, task_id) + if task is None: + raise not_found() + rights = task_rights(conn, actor, task, context) + if not rights.read: + raise not_found() + if not rights.edit: + raise forbidden() + unique: list[UUID] = [] + for element_id in element_ids: + if element_id in unique: + continue + element = get_element(conn, element_id) + if element is None: + raise not_found() + visible = element_rights(conn, actor, element, context) + if not visible.read: + raise not_found() + unique.append(element_id) + conn.execute("DELETE FROM task_element_links WHERE task_id = %s", (task_id,)) + for element_id in unique: + conn.execute( + """ + INSERT INTO task_element_links (task_id, element_id, created_by) + VALUES (%s, %s, %s) + """, + (task_id, element_id, actor), + ) + + +def _dependency_chain(conn, start: UUID) -> set[UUID]: + seen: set[UUID] = set() + stack = [start] + while stack: + current = stack.pop() + if current in seen: + continue + seen.add(current) + rows = conn.execute( + "SELECT depends_on_task_id FROM task_dependencies WHERE task_id = %s", + (current,), + ).fetchall() + stack.extend(row["depends_on_task_id"] for row in rows) + return seen + + +def link_task_dependency(conn, actor: UUID, task_id: UUID, depends_on_task_id: UUID, context: Ctx | None) -> None: + if task_id == depends_on_task_id: + raise unprocessable("Eine Aufgabe kann nicht von sich selbst abhängen.") + task = get_task(conn, task_id) + earlier = get_task(conn, depends_on_task_id) + if task is None or earlier is None: + raise not_found() + rights = task_rights(conn, actor, task, context) + earlier_rights = task_rights(conn, actor, earlier, context) + if not rights.read or not earlier_rights.read: + raise not_found() + if not rights.edit: + raise forbidden() + if task_id in _dependency_chain(conn, depends_on_task_id): + raise unprocessable("Diese Abhängigkeit würde einen Kreis bilden.") + conn.execute( + """ + INSERT INTO task_dependencies (task_id, depends_on_task_id, created_by) + VALUES (%s, %s, %s) + ON CONFLICT DO NOTHING + """, + (task_id, depends_on_task_id, actor), + ) + + +def unlink_task_dependency(conn, actor: UUID, task_id: UUID, depends_on_task_id: UUID, context: Ctx | None) -> None: + task = get_task(conn, task_id) + if task is None: + raise not_found() + rights = task_rights(conn, actor, task, context) + if not rights.read: + raise not_found() + if not rights.edit: + raise forbidden() + conn.execute( + "DELETE FROM task_dependencies WHERE task_id = %s AND depends_on_task_id = %s", + (task_id, depends_on_task_id), + ) + + def set_content_order( conn, actor: UUID, diff --git a/backend/app/present.py b/backend/app/present.py index f754d26..41534dc 100644 --- a/backend/app/present.py +++ b/backend/app/present.py @@ -13,6 +13,7 @@ from app.access.policy import ( get_case, get_element, get_matter, + get_task, matter_rights, matter_title_if_readable, readable_matter_contexts, @@ -756,6 +757,30 @@ def task_payload(conn, actor: UUID, task: dict, rights=None) -> dict: action = _task_action_context(conn, actor, task) if action is not None: payload["action_context"] = action + elements = [] + for link in conn.execute( + "SELECT element_id FROM task_element_links WHERE task_id = %s ORDER BY created_at, element_id", + (task["id"],), + ).fetchall(): + element = get_element(conn, link["element_id"]) + if element is None or element["deleted_at"] is not None: + continue + if not element_rights(conn, actor, element, None).read: + continue + elements.append({"id": str(element["id"]), "title": element["title"]}) + if elements: + payload["elements"] = elements + depends_on = [] + for link in conn.execute( + "SELECT depends_on_task_id FROM task_dependencies WHERE task_id = %s ORDER BY created_at, depends_on_task_id", + (task["id"],), + ).fetchall(): + earlier = get_task(conn, link["depends_on_task_id"]) + if earlier is None or not task_rights(conn, actor, earlier, None).read: + continue + depends_on.append({"id": str(earlier["id"]), "title": earlier["title"], "status": earlier["task_status"]}) + if depends_on: + payload["depends_on"] = depends_on return payload diff --git a/backend/migrations/20261017T150000Z_task_links.sql b/backend/migrations/20261017T150000Z_task_links.sql new file mode 100644 index 0000000..133bcd2 --- /dev/null +++ b/backend/migrations/20261017T150000Z_task_links.sql @@ -0,0 +1,16 @@ +CREATE TABLE task_element_links ( + task_id uuid NOT NULL REFERENCES tasks (id), + element_id uuid NOT NULL REFERENCES elements (id), + created_by uuid NOT NULL REFERENCES auth_accounts (id), + created_at timestamptz NOT NULL DEFAULT now(), + PRIMARY KEY (task_id, element_id) +); + +CREATE TABLE task_dependencies ( + task_id uuid NOT NULL REFERENCES tasks (id), + depends_on_task_id uuid NOT NULL REFERENCES tasks (id), + created_by uuid NOT NULL REFERENCES auth_accounts (id), + created_at timestamptz NOT NULL DEFAULT now(), + PRIMARY KEY (task_id, depends_on_task_id), + CONSTRAINT task_dependencies_not_self CHECK (task_id <> depends_on_task_id) +); diff --git a/backend/tests/test_tracking.py b/backend/tests/test_tracking.py index 3ec55bc..a4de25e 100644 --- a/backend/tests/test_tracking.py +++ b/backend/tests/test_tracking.py @@ -42,6 +42,36 @@ def test_t_dl_completed_task_leaves_the_deadline_open(client, db): kept = next(item for item in open_deadlines["items"] if item["id"] == deadline["id"]) assert kept["status"] == "open" assert kept["fulfilled_at"] is None + second = ada.request( + "POST", + "/api/v1/tasks", + json={"title": "Schreiben entwerfen", "due_on": "2026-11-20", "matter_id": matter["id"]}, + status=201, + ) + ada.request( + "POST", + f"/api/v1/tasks/{second['id']}/deadline-links", + json={"deadline_id": deadline["id"]}, + status=204, + ) + ada.request( + "POST", + f"/api/v1/tasks/{second['id']}/dependencies", + json={"depends_on_task_id": task["id"]}, + status=204, + ) + ada.request( + "POST", + f"/api/v1/tasks/{task['id']}/dependencies", + json={"depends_on_task_id": second["id"]}, + status=422, + ) + detail = ada.request("GET", f"/api/v1/matters/{matter['id']}") + milestone = next(item for item in detail["deadlines"] if item["id"] == deadline["id"]) + linked = [item for item in detail["task_deadline_links"] if item["deadline_id"] == milestone["id"]] + assert len(linked) == 2 + shown = next(item for item in detail["tasks"] if item["id"] == second["id"]) + assert shown["depends_on"][0]["id"] == task["id"] def test_t_anchor_assignee_sees_the_task_but_not_the_hidden_matter(client, db): diff --git a/docs/design/LIEFERUNG_2026-10-17.md b/docs/design/LIEFERUNG_2026-10-17.md index 95a7c5b..29b0b6c 100644 --- a/docs/design/LIEFERUNG_2026-10-17.md +++ b/docs/design/LIEFERUNG_2026-10-17.md @@ -12,7 +12,7 @@ Der Leser hängt an `eintrag` und `kapitel` in der Adresse. Schließen nimmt den ## Logo -Tsumugu nutzt den offenen Pinsel-Ensō mit Aktenmappe: Vektormaster unter `frontend/brand/`, Symbol hell und dunkel, Favicon 16/32, Apple-Touch-Icon, PWA-Icons einschließlich maskable. Ein Service Worker ist bewusst nicht enthalten; Offline-Schreiben gehört nicht zu dieser Lieferung. Die übrigen Familienlogos liegen im Designpaket unter `C:\Dev\jinkendo-app-design-2026-10-17\assets\`. Andere App-Repositories sind nicht geändert. +Tsumugu bindet das große Logo unverändert aus `approved-logos-v1/tsumugu` ein: `frontend/public/brand/logo-original.png` (280×298). Die Browser-Favicons sind die Kleinform ohne Ensō aus `favicons-v2/tsumugu` unter `frontend/public/brand/favicons-v2/`. Apple-Touch-Icon und PWA-Icons bleiben die bisherigen Rasterdateien. `frontend/brand/render.mjs` zeichnet nichts und überschreibt diese Dateien nicht. Ein Service Worker ist bewusst nicht enthalten; Offline-Schreiben gehört nicht zu dieser Lieferung. Andere App-Repositories sind nicht geändert. ## Bewusste Abweichungen diff --git a/frontend/brand/enso-master.svg b/frontend/brand/enso-master.svg deleted file mode 100644 index 9a5949d..0000000 --- a/frontend/brand/enso-master.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/frontend/brand/render.mjs b/frontend/brand/render.mjs index d3873be..c94789b 100644 --- a/frontend/brand/render.mjs +++ b/frontend/brand/render.mjs @@ -1,163 +1,5 @@ -import fs from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import sharp from "sharp"; - -const here = path.dirname(fileURLToPath(import.meta.url)); -const publicDir = path.resolve(here, "../public"); -const designDir = "C:/Dev/jinkendo-app-design-2026-10-17/assets"; - -function brushRing(cx, cy, r) { - const start = -0.7; - const end = start + Math.PI * 1.78; - const steps = 96; - const outer = []; - const inner = []; - for (let i = 0; i <= steps; i += 1) { - const u = i / steps; - const angle = start + (end - start) * u; - const taper = Math.sin(Math.PI * u) ** 0.62; - const wave = 0.55 + 0.45 * Math.sin(u * Math.PI * 2.15 + 0.6); - const width = r * 0.2 * taper * wave; - const wobble = 1 + 0.028 * Math.sin(u * Math.PI * 6.2); - const radius = r * wobble; - const x = cx + radius * Math.cos(angle); - const y = cy + radius * Math.sin(angle); - const nx = Math.cos(angle); - const ny = Math.sin(angle); - outer.push([x + nx * width * 0.78, y + ny * width * 0.78]); - inner.push([x - nx * width * 0.28, y - ny * width * 0.28]); - } - const point = (pair) => pair.map((value) => value.toFixed(2)).join(" "); - let d = `M ${point(outer[0])}`; - for (const pair of outer.slice(1)) d += ` L ${point(pair)}`; - for (const pair of inner.reverse()) d += ` L ${point(pair)}`; - return `${d} Z`; -} - -const enso = brushRing(32, 32, 22.5); -const ensoSmall = brushRing(32, 32, 23.5); - -const glyphs = { - tsumugu: ` - - - `, - tsumuguSmall: ` - - `, - mitai: ` - - - - - `, - shinkan: ` - - - - - - `, - kairo: ` - - - - - - - - `, - kansho: ` - `, -}; - -function symbolSvg({ glyph, small = false }) { - const ring = small ? ensoSmall : enso; - return ` - - - ${glyph} - -`; -} - -function iconSvg(glyph, { maskable = false } = {}) { - const scale = maskable ? 0.62 : 0.74; - const offset = (64 - 64 * scale) / 2; - return ` - - - - - ${glyph} - - -`; -} - -function write(file, contents) { - fs.mkdirSync(path.dirname(file), { recursive: true }); - fs.writeFileSync(file, contents); -} - -const products = [ - ["mitai", "Mitai", "Körper und Gesundheit"], - ["shinkan", "Shinkan", "Training planen"], - ["kairo", "Kairo", "Vorhaben steuern"], - ["kansho", "Kanshō", "Reflektieren und verstehen"], - ["tsumugu", "Tsumugu", "Unterlagen ordnen"], -]; - -write(path.join(here, "enso-master.svg"), ` - - - -`); -write(path.join(publicDir, "brand/tsumugu-symbol.svg"), symbolSvg({ glyph: glyphs.tsumugu }).replaceAll("currentColor", "#085041")); -write(path.join(publicDir, "brand/tsumugu-symbol-on-dark.svg"), symbolSvg({ glyph: glyphs.tsumugu }).replaceAll("currentColor", "#9FE1CB")); -write(path.join(publicDir, "brand/tsumugu-small.svg"), symbolSvg({ glyph: glyphs.tsumuguSmall, small: true }).replaceAll("currentColor", "#9FE1CB")); -write(path.join(publicDir, "favicon.svg"), iconSvg(glyphs.tsumuguSmall)); - -write(path.join(here, "../src/enso-path.js"), `export const ENSO_PATH = ${JSON.stringify(enso)};\n`); - -for (const [id, title, subtitle] of products) { - const glyph = glyphs[id]; - const master = ` - - - - - ${glyph} - - ${title} - ${subtitle} - -`; - write(path.join(designDir, `${id}-master.svg`), master); - write(path.join(designDir, `${id}-symbol-on-dark.svg`), symbolSvg({ glyph }).replaceAll("currentColor", "#9FE1CB")); - write(path.join(designDir, `${id}-symbol-on-light.svg`), symbolSvg({ glyph }).replaceAll("currentColor", "#085041")); - write(path.join(designDir, `${id}-icon.svg`), iconSvg(glyph)); - write(path.join(designDir, `${id}-maskable.svg`), iconSvg(glyph, { maskable: true })); -} - -async function png(svg, file, size) { - await sharp(Buffer.from(svg)).resize(size, size).png().toFile(file); -} - -const tsumuguIcon = iconSvg(glyphs.tsumugu); -const tsumuguMask = iconSvg(glyphs.tsumugu, { maskable: true }); -const tsumuguSmallIcon = iconSvg(glyphs.tsumuguSmall); -await png(tsumuguSmallIcon, path.join(publicDir, "favicon-16.png"), 16); -await png(tsumuguSmallIcon, path.join(publicDir, "favicon-32.png"), 32); -await png(tsumuguIcon, path.join(publicDir, "apple-touch-icon.png"), 180); -await png(tsumuguIcon, path.join(publicDir, "icons/icon-192.png"), 192); -await png(tsumuguIcon, path.join(publicDir, "icons/icon-512.png"), 512); -await png(tsumuguMask, path.join(publicDir, "icons/icon-maskable-512.png"), 512); - -for (const [id] of products) { - const svg = fs.readFileSync(path.join(designDir, `${id}-icon.svg`)); - await png(svg, path.join(designDir, `${id}-32.png`), 32); - await png(svg, path.join(designDir, `${id}-192.png`), 192); -} -console.log("icons written"); +// Stillgelegt. Das große Logo bleibt frontend/public/brand/logo-original.png. +// Die Browser-Favicons liegen unter frontend/public/brand/favicons-v2 und dürfen +// von hier nicht erzeugt oder überschrieben werden. Dieses Skript schreibt nichts. +console.error("Logo-Renderer ist stillgelegt. Verbindlich sind die Dateien in frontend/public/brand."); +process.exit(0); diff --git a/frontend/index.html b/frontend/index.html index 2c2fa29..15372c8 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,10 +7,11 @@ Tsumugu - - - - + + + + + diff --git a/frontend/public/apple-touch-icon.png b/frontend/public/apple-touch-icon.png deleted file mode 100644 index 39e0eab..0000000 Binary files a/frontend/public/apple-touch-icon.png and /dev/null differ diff --git a/frontend/public/brand/app-icon-192.png b/frontend/public/brand/app-icon-192.png new file mode 100644 index 0000000..6f12a7d Binary files /dev/null and b/frontend/public/brand/app-icon-192.png differ diff --git a/frontend/public/brand/app-icon-512.png b/frontend/public/brand/app-icon-512.png new file mode 100644 index 0000000..90d7c68 Binary files /dev/null and b/frontend/public/brand/app-icon-512.png differ diff --git a/frontend/public/brand/app-maskable-512.png b/frontend/public/brand/app-maskable-512.png new file mode 100644 index 0000000..09ae951 Binary files /dev/null and b/frontend/public/brand/app-maskable-512.png differ diff --git a/frontend/public/brand/apple-touch-icon.png b/frontend/public/brand/apple-touch-icon.png new file mode 100644 index 0000000..3387f7c Binary files /dev/null and b/frontend/public/brand/apple-touch-icon.png differ diff --git a/frontend/public/brand/favicons-v2/favicon-16.png b/frontend/public/brand/favicons-v2/favicon-16.png new file mode 100644 index 0000000..0e25fe8 Binary files /dev/null and b/frontend/public/brand/favicons-v2/favicon-16.png differ diff --git a/frontend/public/brand/favicons-v2/favicon-32.png b/frontend/public/brand/favicons-v2/favicon-32.png new file mode 100644 index 0000000..fd47630 Binary files /dev/null and b/frontend/public/brand/favicons-v2/favicon-32.png differ diff --git a/frontend/public/brand/favicons-v2/favicon-48.png b/frontend/public/brand/favicons-v2/favicon-48.png new file mode 100644 index 0000000..d912095 Binary files /dev/null and b/frontend/public/brand/favicons-v2/favicon-48.png differ diff --git a/frontend/public/brand/favicons-v2/favicon.ico b/frontend/public/brand/favicons-v2/favicon.ico new file mode 100644 index 0000000..c4be5d6 Binary files /dev/null and b/frontend/public/brand/favicons-v2/favicon.ico differ diff --git a/frontend/public/brand/logo-original.png b/frontend/public/brand/logo-original.png new file mode 100644 index 0000000..f55afce Binary files /dev/null and b/frontend/public/brand/logo-original.png differ diff --git a/frontend/public/brand/tsumugu-small.svg b/frontend/public/brand/tsumugu-small.svg deleted file mode 100644 index d0d44f3..0000000 --- a/frontend/public/brand/tsumugu-small.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/frontend/public/brand/tsumugu-symbol-on-dark.svg b/frontend/public/brand/tsumugu-symbol-on-dark.svg deleted file mode 100644 index a4dacaf..0000000 --- a/frontend/public/brand/tsumugu-symbol-on-dark.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/frontend/public/brand/tsumugu-symbol.svg b/frontend/public/brand/tsumugu-symbol.svg deleted file mode 100644 index ec69b05..0000000 --- a/frontend/public/brand/tsumugu-symbol.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/frontend/public/favicon-16.png b/frontend/public/favicon-16.png deleted file mode 100644 index 5b7468a..0000000 Binary files a/frontend/public/favicon-16.png and /dev/null differ diff --git a/frontend/public/favicon-32.png b/frontend/public/favicon-32.png deleted file mode 100644 index c2e3260..0000000 Binary files a/frontend/public/favicon-32.png and /dev/null differ diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg deleted file mode 100644 index a0a3dad..0000000 --- a/frontend/public/favicon.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/frontend/public/icons/icon-192.png b/frontend/public/icons/icon-192.png deleted file mode 100644 index 0fa8b2d..0000000 Binary files a/frontend/public/icons/icon-192.png and /dev/null differ diff --git a/frontend/public/icons/icon-512.png b/frontend/public/icons/icon-512.png deleted file mode 100644 index 66db966..0000000 Binary files a/frontend/public/icons/icon-512.png and /dev/null differ diff --git a/frontend/public/icons/icon-maskable-512.png b/frontend/public/icons/icon-maskable-512.png deleted file mode 100644 index f295974..0000000 Binary files a/frontend/public/icons/icon-maskable-512.png and /dev/null differ diff --git a/frontend/public/manifest.webmanifest b/frontend/public/manifest.webmanifest index 1482831..8c90a1e 100644 --- a/frontend/public/manifest.webmanifest +++ b/frontend/public/manifest.webmanifest @@ -9,8 +9,8 @@ "theme_color": "#085041", "lang": "de", "icons": [ - { "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" }, - { "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }, - { "src": "/icons/icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } + { "src": "/brand/app-icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" }, + { "src": "/brand/app-icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }, + { "src": "/brand/app-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } ] } diff --git a/frontend/src/enso-path.js b/frontend/src/enso-path.js deleted file mode 100644 index dd89893..0000000 --- a/frontend/src/enso-path.js +++ /dev/null @@ -1 +0,0 @@ -export const ENSO_PATH = "M 49.21 17.51 L 50.41 18.25 L 51.45 19.16 L 52.41 20.17 L 53.29 21.26 L 54.10 22.43 L 54.80 23.66 L 55.42 24.96 L 55.92 26.30 L 56.32 27.68 L 56.60 29.10 L 56.78 30.53 L 56.84 31.98 L 56.79 33.42 L 56.64 34.86 L 56.39 36.28 L 56.04 37.68 L 55.61 39.05 L 55.10 40.39 L 54.52 41.70 L 53.87 42.97 L 53.16 44.21 L 52.39 45.40 L 51.57 46.56 L 50.69 47.68 L 49.76 48.75 L 48.78 49.78 L 47.75 50.77 L 46.66 51.70 L 45.52 52.57 L 44.34 53.38 L 43.10 54.12 L 41.82 54.79 L 40.49 55.36 L 39.12 55.85 L 37.73 56.23 L 36.30 56.51 L 34.86 56.69 L 33.42 56.75 L 31.98 56.70 L 30.55 56.54 L 29.14 56.27 L 27.76 55.90 L 26.41 55.44 L 25.12 54.88 L 23.87 54.25 L 22.67 53.54 L 21.53 52.78 L 20.44 51.96 L 19.40 51.09 L 18.41 50.19 L 17.47 49.25 L 16.57 48.29 L 15.71 47.31 L 14.89 46.29 L 14.11 45.26 L 13.36 44.20 L 12.65 43.12 L 11.97 42.00 L 11.33 40.86 L 10.74 39.68 L 10.20 38.46 L 9.72 37.22 L 9.31 35.94 L 8.96 34.63 L 8.70 33.29 L 8.53 31.93 L 8.45 30.56 L 8.47 29.18 L 8.60 27.80 L 8.82 26.43 L 9.15 25.08 L 9.59 23.76 L 10.12 22.47 L 10.74 21.23 L 11.45 20.04 L 12.23 18.90 L 13.09 17.81 L 14.01 16.79 L 14.99 15.83 L 16.02 14.93 L 17.09 14.08 L 18.20 13.30 L 19.34 12.57 L 20.51 11.90 L 21.71 11.29 L 22.94 10.74 L 24.19 10.24 L 25.46 9.80 L 26.76 9.43 L 28.08 9.14 L 29.41 8.92 L 30.76 8.78 L 32.11 8.75 L 33.47 8.82 L 34.80 9.02 L 36.09 9.50 L 36.09 9.50 L 34.74 9.55 L 33.42 9.62 L 32.11 9.75 L 30.82 9.96 L 29.56 10.22 L 28.32 10.54 L 27.10 10.91 L 25.91 11.33 L 24.74 11.78 L 23.60 12.28 L 22.47 12.82 L 21.36 13.39 L 20.27 14.01 L 19.20 14.66 L 18.16 15.37 L 17.13 16.12 L 16.14 16.92 L 15.18 17.78 L 14.27 18.70 L 13.41 19.67 L 12.60 20.71 L 11.87 21.80 L 11.21 22.95 L 10.63 24.14 L 10.15 25.38 L 9.76 26.65 L 9.47 27.95 L 9.29 29.27 L 9.20 30.60 L 9.22 31.93 L 9.34 33.26 L 9.54 34.56 L 9.84 35.85 L 10.22 37.10 L 10.66 38.33 L 11.18 39.52 L 11.76 40.67 L 12.38 41.79 L 13.06 42.88 L 13.78 43.93 L 14.54 44.94 L 15.33 45.93 L 16.17 46.88 L 17.04 47.79 L 17.96 48.67 L 18.91 49.51 L 19.91 50.31 L 20.95 51.06 L 22.04 51.76 L 23.17 52.40 L 24.34 52.97 L 25.54 53.46 L 26.79 53.87 L 28.06 54.19 L 29.35 54.41 L 30.66 54.54 L 31.98 54.57 L 33.29 54.49 L 34.59 54.31 L 35.87 54.04 L 37.12 53.67 L 38.34 53.21 L 39.51 52.67 L 40.64 52.07 L 41.73 51.39 L 42.77 50.66 L 43.76 49.89 L 44.70 49.07 L 45.60 48.22 L 46.46 47.33 L 47.28 46.42 L 48.07 45.48 L 48.82 44.52 L 49.54 43.53 L 50.22 42.51 L 50.87 41.47 L 51.48 40.39 L 52.05 39.29 L 52.57 38.14 L 53.04 36.97 L 53.44 35.76 L 53.78 34.53 L 54.04 33.26 L 54.22 31.98 L 54.30 30.68 L 54.30 29.37 L 54.19 28.06 L 53.99 26.76 L 53.69 25.48 L 53.29 24.22 L 52.79 22.99 L 52.21 21.81 L 51.55 20.67 L 50.82 19.58 L 50.02 18.53 L 49.21 17.51 Z"; diff --git a/frontend/src/pages/Cases.jsx b/frontend/src/pages/Cases.jsx index 94b7d48..dd33fbf 100644 --- a/frontend/src/pages/Cases.jsx +++ b/frontend/src/pages/Cases.jsx @@ -454,6 +454,7 @@ export function CaseDetail() { contextValue={id} onContext={parentTree ? ((next) => { if (next !== id) navigate(`/cases/${next}`); }) : null} nodes={caseNodes(record, parentTree)} + allLabel="Direkt in dieser Akte" chapters={chapters} chapterId={overview ? "" : chapterId} allCount={(record.bindings || []).length} @@ -473,7 +474,7 @@ export function CaseDetail() { { @@ -567,6 +569,7 @@ export function CaseDetail() { { setModal(""); load(); }} /> setModal("")}> +

Dieser Inhalt liegt direkt in der Akte. Er erscheint unter „Direkt in dieser Akte“ und im Überblick, nicht in einem Vorgang.

@@ -585,7 +588,7 @@ export function CaseDetail() { setModal("")}> { setModal(""); load(); }} /> - setModal("")}> + setModal("")}> { setModal(""); load(); }} /> setModal("")}> diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx index aa71d11..010216b 100644 --- a/frontend/src/pages/Login.jsx +++ b/frontend/src/pages/Login.jsx @@ -62,7 +62,7 @@ export function Login() { return (
- +

Jinkendo

Tsumugu

Akten, Vorgänge und Fristen an einem Ort. Die erste Lieferung organisiert und verfolgt.

diff --git a/frontend/src/pages/Matters.jsx b/frontend/src/pages/Matters.jsx index 457cf56..3acf724 100644 --- a/frontend/src/pages/Matters.jsx +++ b/frontend/src/pages/Matters.jsx @@ -139,8 +139,8 @@ function caseNodes(caseRecord, parentRecord, activeId, contextId) { }]; } -function loneNodes(record, query) { - const current = { +function placementNodes(record) { + const matter = { id: record.id, title: record.title, kind: record.kind_label || "Vorgang", @@ -150,22 +150,32 @@ function loneNodes(record, query) { id: item.id, title: item.title, kind: "Teilvorgang", - href: `/matters/${item.id}${query}`, + href: `/matters/${item.id}`, current: false, children: [], })), }; - if (record.parent_matter_id && record.parent_title) { - return [{ - id: record.parent_matter_id, - title: record.parent_title, - kind: "Vorgang", - href: `/matters/${record.parent_matter_id}${query}`, + const rooted = record.parent_matter_id && record.parent_title ? [{ + id: record.parent_matter_id, + title: record.parent_title, + kind: "Vorgang", + href: `/matters/${record.parent_matter_id}`, + current: false, + children: [matter], + }] : [matter]; + const cases = record.placements || []; + if (cases.length < 2) return rooted; + return [ + ...rooted, + ...cases.map((item) => ({ + id: item.case_id, + title: item.label.replaceAll("Unterakte ", "").replaceAll("Akte ", "").replaceAll(" → ", " / "), + kind: "Akte", + href: `/matters/${record.id}?context_kind=case&context_id=${item.case_id}`, current: false, - children: [current], - }]; - } - return [current]; + children: [], + })), + ]; } function objectTrail(record, query) { @@ -233,6 +243,16 @@ export function MatterDetail() { } }, [record, id, chapterId, params, setParams]); + useEffect(() => { + if (!record || record.id !== id || inherited?.kind === "case") return; + const placements = record.placements || []; + if (placements.length !== 1) return; + const next = new URLSearchParams(params); + next.set("context_kind", "case"); + next.set("context_id", placements[0].case_id); + setParams(next, { replace: true }); + }, [record, id, inherited?.kind]); + useEffect(() => { if (inherited?.kind !== "case") { setCaseTree(null); @@ -343,7 +363,7 @@ export function MatterDetail() { label: item.label.replaceAll("Unterakte ", "").replaceAll("Akte ", "").replaceAll(" → ", " / "), })); const contextValue = inherited?.kind === "case" ? inherited.id : (contexts.length === 1 ? contexts[0].id : ""); - const nodes = caseTree ? caseNodes(caseTree, parentTree, id, inherited.id) : loneNodes(record, query); + const nodes = caseTree ? caseNodes(caseTree, parentTree, id, inherited.id) : placementNodes(record); const links = [ ...(record.cross_links || []).map((item) => ({ id: `cross-${item.id}`, @@ -351,7 +371,7 @@ export function MatterDetail() { kind: "Querverweis", href: `/matters/${item.matter_id}${query}`, })), - ...(record.case_links || []).filter((item) => item.case_id !== inherited?.id).map((item) => ({ + ...(record.case_links || []).filter((item) => inherited?.kind === "case" && item.case_id !== inherited.id).map((item) => ({ id: `case-${item.id}`, title: item.title, kind: "Weitere Akte", @@ -403,7 +423,7 @@ export function MatterDetail() { >
- +

{record.title}

@@ -477,7 +497,7 @@ export function MatterDetail() { ) : null} setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> @@ -498,7 +518,7 @@ export function MatterDetail() { setModal("")}> { setModal(""); load(); }} /> - setModal("")}> + setModal("")}> { setModal(""); load(); }} /> setModal("")}> @@ -527,14 +547,35 @@ export function MatterDetail() { ); } -function WorkForms({ matterId, context, tasks, onChange }) { +function WorkForms({ matterId, context, deadlines, onChange }) { const [taskTitle, setTaskTitle] = useState(""); const [taskDue, setTaskDue] = useState(""); + const [deadlineId, setDeadlineId] = useState(""); const [deadlineTitle, setDeadlineTitle] = useState(""); const [deadlineDue, setDeadlineDue] = useState(""); - const [linkTask, setLinkTask] = useState(""); const [error, setError] = useState(""); + async function addDeadline(event) { + event.preventDefault(); + setError(""); + try { + await api("/api/v1/deadlines", { + method: "POST", + body: { + title: deadlineTitle, + due_on: deadlineDue, + matter_id: matterId, + ...(context ? { context } : {}), + }, + }); + setDeadlineTitle(""); + setDeadlineDue(""); + onChange(); + } catch (err) { + setError(err.message); + } + } + async function addTask(event) { event.preventDefault(); setError(""); @@ -548,53 +589,15 @@ function WorkForms({ matterId, context, tasks, onChange }) { ...(context ? { context } : {}), }, }); - if (linkTask === "new-deadline" && deadlineTitle && deadlineDue) { - const deadline = await api("/api/v1/deadlines", { - method: "POST", - body: { - title: deadlineTitle, - due_on: deadlineDue, - matter_id: matterId, - ...(context ? { context } : {}), - }, - }); + if (deadlineId) { await api(`/api/v1/tasks/${task.id}/deadline-links`, { method: "POST", - body: { deadline_id: deadline.id, ...(context ? { context } : {}) }, + body: { deadline_id: deadlineId, ...(context ? { context } : {}) }, }); - setDeadlineTitle(""); - setDeadlineDue(""); } setTaskTitle(""); setTaskDue(""); - setLinkTask(""); - onChange(); - } catch (err) { - setError(err.message); - } - } - - async function addDeadline(event) { - event.preventDefault(); - setError(""); - try { - const deadline = await api("/api/v1/deadlines", { - method: "POST", - body: { - title: deadlineTitle, - due_on: deadlineDue, - matter_id: matterId, - ...(context ? { context } : {}), - }, - }); - if (linkTask && linkTask !== "new-deadline") { - await api(`/api/v1/tasks/${linkTask}/deadline-links`, { - method: "POST", - body: { deadline_id: deadline.id, ...(context ? { context } : {}) }, - }); - } - setDeadlineTitle(""); - setDeadlineDue(""); + setDeadlineId(""); onChange(); } catch (err) { setError(err.message); @@ -603,23 +606,26 @@ function WorkForms({ matterId, context, tasks, onChange }) { return (
+
+

Frist

+ setDeadlineTitle(event.target.value)} placeholder="Maßgeblicher Termin" required /> + + +

Aufgabe

- setTaskTitle(event.target.value)} placeholder="Was ist zu tun?" required /> + setTaskTitle(event.target.value)} placeholder="Was ist vor der Frist zu tun?" required /> + -
-
-

Unabhängige Frist

- setDeadlineTitle(event.target.value)} placeholder="Maßgebliche Frist" required /> - - -
diff --git a/frontend/src/pages/Modal.jsx b/frontend/src/pages/Modal.jsx index fdc960e..2587613 100644 --- a/frontend/src/pages/Modal.jsx +++ b/frontend/src/pages/Modal.jsx @@ -1,7 +1,7 @@ import { useEffect, useRef } from "react"; import { isDirty, markDirty } from "../api.js"; -export function Modal({ open, title, onClose, wide = false, children }) { +export function Modal({ open, title, onClose, wide = false, split = false, children }) { const dialogRef = useRef(null); const restoreRef = useRef(null); @@ -33,7 +33,7 @@ export function Modal({ open, title, onClose, wide = false, children }) { if (!open) return null; return (
{ if (event.target === event.currentTarget) requestClose(); }}> -
+

{title}

diff --git a/frontend/src/pages/Sources.jsx b/frontend/src/pages/Sources.jsx index 27f86c8..33d9900 100644 --- a/frontend/src/pages/Sources.jsx +++ b/frontend/src/pages/Sources.jsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { api } from "../api.js"; import { TargetLine, formatDate } from "./content.jsx"; +import { NavIcon } from "./icons.jsx"; import { ErrorNote } from "./widgets.jsx"; export function Sources() { @@ -231,9 +232,12 @@ function FolderBranch({ node, mailbox, expanded, onToggle, onSelect }) { ) :
{node.children.length && open ? ( diff --git a/frontend/src/pages/content.jsx b/frontend/src/pages/content.jsx index bc0df22..553ef1c 100644 --- a/frontend/src/pages/content.jsx +++ b/frontend/src/pages/content.jsx @@ -165,11 +165,9 @@ function sectionsOf(chapters, bindings) { } export function matterOpenHref(item) { - const contexts = item?.contexts || []; - if (contexts.some((entry) => entry.kind === "direct")) return `/matters/${item.id}`; - const context = contexts.find((entry) => entry.kind === "case"); - if (!context) return `/matters/${item.id}`; - return `/matters/${item.id}?context_kind=case&context_id=${context.id}`; + const cases = (item?.contexts || []).filter((entry) => entry.kind === "case"); + if (cases.length === 1) return `/matters/${item.id}?context_kind=case&context_id=${cases[0].id}`; + return `/matters/${item.id}`; } export function Placements({ items }) { @@ -346,7 +344,25 @@ export function ContentBoard({ const visibleSections = onlyChapter ? sections.filter((section) => section.id === onlyChapter) : sections; const shownCount = onlyChapter ? (visibleSections[0]?.items.length || 0) : source.length; const canSort = sortable && record?.rights?.edit; + const canEdit = Boolean(record?.rights?.edit); + const canDestroy = Boolean(record?.is_owner); const canMoveChapters = Boolean(canSort && chapters.length > 1); + + async function removeBinding(binding, everywhere) { + const element = binding.element; + if (everywhere) { + if (!window.confirm("Überall löschen? Alle Einbindungen verschwinden. Eine Paperless-Quelle bleibt unangetastet.")) return; + await api(`/api/v1/elements/${element.id}/delete`, { method: "POST", body: { expected_version: element.version } }); + } else { + if (!window.confirm("Aus diesem Zusammenhang entfernen? Die Unterlage bleibt an anderen Stellen erhalten.")) return; + const action = context || (containerKind === "case" ? { kind: "case", id: containerId } : { kind: "matter", id: containerId }); + const search = new URLSearchParams(); + search.set("context_kind", action.kind); + search.set("context_id", action.id); + await api(`/api/v1/bindings/${binding.id}?${search}`, { method: "DELETE" }); + } + onChange(); + } const orderPath = `/api/v1/${containerKind === "case" ? "cases" : "matters"}/${containerId}`; const orderContext = context && containerKind === "matter" ? { context } : {}; @@ -794,8 +810,15 @@ export function ContentBoard({ Kapitel {(chapters.find((chapter) => chapter.id === binding.chapter_id)?.title) || ""} ) : null} - {(canSort && custom) || (canSort && chapters.length) ? ( + {(canEdit || (canSort && custom) || (canSort && chapters.length)) ? (
+ {canEdit ? ( +
+ Entfernen + + {canDestroy ? : null} +
+ ) : null} {canSort && custom ? (
Reihenfolge @@ -940,8 +963,27 @@ export function AuditLog({ items, nextCursor, onMore }) { ); } +function contentChoices(record) { + const rows = [...(record?.bindings || [])]; + for (const group of record?.contained || []) rows.push(...(group.bindings || [])); + const seen = new Set(); + return rows.flatMap((binding) => { + const element = binding.element; + if (!element?.id || seen.has(element.id)) return []; + seen.add(element.id); + return [{ id: element.id, title: element.title }]; + }); +} + +function taskContextBody(task, context) { + const taskContext = task.action_context || context; + return taskContext ? { context: taskContext } : {}; +} + export function WorkLists({ record, context, onChange }) { - const linked = new Set((record.task_deadline_links || []).map((item) => item.task_id)); + const links = record.task_deadline_links || []; + const tasks = record.tasks || []; + const elements = contentChoices(record); async function complete(task) { const body = { expected_version: task.version, status: "done" }; @@ -958,42 +1000,135 @@ export function WorkLists({ record, context, onChange }) { onChange(); } + const tasksFor = (deadlineId) => tasks.filter((task) => links.some((link) => link.deadline_id === deadlineId && link.task_id === task.id)); + const linkedIds = new Set(links.map((link) => link.task_id)); + const loose = tasks.filter((task) => !linkedIds.has(task.id)); + + async function assign(task, deadline) { + await api(`/api/v1/tasks/${task.id}/deadline-links`, { + method: "POST", + body: { deadline_id: deadline.id, ...taskContextBody(task, context) }, + }); + onChange(); + } + return (
-

Erledigen und Erfüllen bleiben getrennte Aktionen.

-
-

Aufgaben

- {record.tasks?.length ? ( -
    - {record.tasks.map((task) => ( -
  • -
    - {task.title} - {task.status === "done" ? "Erledigt" : "Offen"}{task.due_on ? ` · ${formatDate(task.due_on)}` : ""}{task.matter_title ? ` · ${task.matter_title}` : ""} - {linked.has(task.id) ? Mit einer Frist verknüpft, ohne sie zu erfüllen. : null} -
    - {task.status === "open" && task.rights?.edit !== false ? : null} -
  • - ))} -
- ) :

Keine Aufgabe.

} -
+

Eine Frist ist der maßgebliche Termin. Mehrere Aufgaben können davor liegen. Erledigen einer Aufgabe erfüllt die Frist nicht.

Fristen

{record.deadlines?.length ? (
    - {record.deadlines.map((deadline) => ( -
  • -
    - {deadline.title} - {deadline.status === "fulfilled" ? "Erfüllt" : "Offen"} · {formatDate(deadline.due_on)}{deadline.matter_title ? ` · ${deadline.matter_title}` : ""} -
    - {deadline.status === "open" ? : null} -
  • - ))} + {record.deadlines.map((deadline) => { + const assigned = tasksFor(deadline.id); + const available = tasks.filter((task) => !assigned.some((item) => item.id === task.id)); + return ( +
  • +
    + {deadline.title} + {deadline.status === "fulfilled" ? "Erfüllt" : "Offen"} · {formatDate(deadline.due_on)}{deadline.matter_title ? ` · ${deadline.matter_title}` : ""} + {assigned.length ? ( +
      + {assigned.map((task) => ( + + ))} +
    + ) : Noch keine Aufgabe vor dieser Frist.} + {available.length ? ( + + ) : null} +
    + {deadline.status === "open" ? : null} +
  • + ); + })}
) :

Keine Frist.

}
+
+

Aufgaben ohne Frist

+ {loose.length ? ( +
    + {loose.map((task) => ( +
  • + +
  • + ))} +
+ ) :

Keine Aufgabe ohne Frist.

} +
+
+ ); +} + +function TaskRow({ task, tasks, elements, context, onComplete, onChange }) { + const [elementIds, setElementIds] = useState((task.elements || []).map((item) => item.id)); + const [dependsOn, setDependsOn] = useState(""); + const others = tasks.filter((item) => item.id !== task.id); + + async function saveElements(next) { + setElementIds(next); + await api(`/api/v1/tasks/${task.id}/elements`, { + method: "PUT", + body: { element_ids: next, ...taskContextBody(task, context) }, + }); + onChange(); + } + + async function addDependency(event) { + const id = event.target.value; + setDependsOn(""); + if (!id) return; + await api(`/api/v1/tasks/${task.id}/dependencies`, { + method: "POST", + body: { depends_on_task_id: id, ...taskContextBody(task, context) }, + }); + onChange(); + } + + return ( +
+
+ {task.title} + {task.status === "done" ? "Erledigt" : "Offen"}{task.due_on ? ` · Arbeitstermin ${formatDate(task.due_on)}` : ""} + {(task.depends_on || []).length ? Hängt ab von {task.depends_on.map((item) => item.title).join(", ")}. : null} + {(task.elements || []).length ? Bezieht sich auf {task.elements.map((item) => item.title).join(", ")}. : null} +
+ {task.status === "open" && task.rights?.edit !== false ? : null} + {task.rights?.edit !== false ? ( +
+ Bezüge + +
+ Inhalte + {elements.length ? elements.map((element) => ( + + )) : In diesem Objekt liegt noch kein Inhalt.} +
+
+ ) : null}
); } diff --git a/frontend/src/pages/icons.jsx b/frontend/src/pages/icons.jsx index 62759cb..c1fb517 100644 --- a/frontend/src/pages/icons.jsx +++ b/frontend/src/pages/icons.jsx @@ -26,15 +26,15 @@ export function NavIcon({ name }) { return ; } -import { ENSO_PATH } from "../enso-path.js"; - -export function Mark({ size = 36 }) { +export function Mark({ size = 40 }) { return ( - + Tsumugu ); } diff --git a/frontend/src/pages/workspace.jsx b/frontend/src/pages/workspace.jsx index 89a9ace..aacb7a8 100644 --- a/frontend/src/pages/workspace.jsx +++ b/frontend/src/pages/workspace.jsx @@ -95,6 +95,7 @@ export function StructureNavigator({ chapters = [], chapterId = "", allCount = 0, + allLabel = "Alle Inhalte", overview = null, chapterHeading, onChapter, @@ -116,6 +117,7 @@ export function StructureNavigator({ ) : null}
+