Lege Einstellungen je Konto mit Erbung vom Hauptnutzer an und biete die Prüfstufe für doppelte Dokumente in Mein Konto an.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
StommerandClaude Sonnet 5.5 committed 2026-10-25 09:18:17 +01:00
1 parent bee48bf4a5
commit a6dc24d8fe
11 files changed
+339 -1

No files matched your search

+2
View File
@@ -4,6 +4,7 @@ import { SessionContext } from "../session.js";
import { ErrorNote } from "../pages/widgets.jsx";
import { formatWhen } from "./admin-core.js";
import { DownloadPolicy } from "./DownloadPolicy.jsx";
import { DuplicatePreference } from "./DuplicatePreference.jsx";
import { deviceClass, readImageChoice, writeImageChoice } from "../mail-images.js";
import { isEmployee } from "./admin-core.js";
import { PasswordForm } from "./widgets.jsx";
@@ -82,6 +83,7 @@ export function Account() {
<ErrorNote error={error} />
{notice ? <p className="notice" role="status">{notice}</p> : null}
<MailImages />
<DuplicatePreference />
{isEmployee(session) ? null : (
<section className="card stack" aria-label="Herunterladen">
<h2>Herunterladen von Originalen</h2>
@@ -0,0 +1,77 @@
import { useEffect, useState } from "react";
import { api } from "../api.js";
import { ErrorNote } from "../pages/widgets.jsx";
const PATH = "/api/v1/auth/preferences/duplicate_check";
export const DUPLICATE_LEVELS = {
off: "Keine Prüfung",
case: "Nur dieser Vorgang",
case_matters: "Vorgang und verknüpfte Akten",
case_tree: "Vorgang mit Ober- und Unterordnung",
};
// Where a document that is inserted again counts as already present. Only a warning, never a block.
// An employee inherits the value of the main user and may change it unless the main user made it binding.
export function DuplicatePreference() {
const [state, setState] = useState(null);
const [error, setError] = useState("");
const [notice, setNotice] = useState("");
useEffect(() => {
let alive = true;
api(PATH).then((data) => alive && setState(data)).catch((err) => alive && setError(err.message));
return () => {
alive = false;
};
}, []);
async function save(body) {
setError("");
setNotice("");
try {
setState(await api(PATH, { method: "PUT", body }));
setNotice("Die Einstellung ist gespeichert.");
} catch (err) {
setError(err.message);
}
}
if (!state) return error ? <ErrorNote error={error} /> : null;
const ownChoice = state.can_lock ? state.own || state.default : state.own || "";
return (
<section className="card stack" aria-label="Doppelte Dokumente">
<h2>Doppelte Dokumente</h2>
<p className="muted">
Beim Einfügen eines Dokuments aus einer Quelle warnt Tsumugu, wenn es an der gewählten Stelle schon vorhanden ist. Du kannst es trotzdem
einfügen oder das vorhandene Element zusätzlich einbinden. Dasselbe Dokument in verschiedenen Vorgängen bleibt immer erlaubt.
</p>
<label>
Prüfen in
<select
value={ownChoice}
disabled={state.locked}
onChange={(event) => save({ value: event.target.value || null })}
>
{state.can_lock ? null : <option value="">Wie beim Hauptnutzer ({DUPLICATE_LEVELS[state.inherited]})</option>}
{state.allowed.map((level) => (
<option key={level} value={level}>{DUPLICATE_LEVELS[level]}</option>
))}
</select>
</label>
{state.locked ? <p className="muted">Der Hauptnutzer hat diese Einstellung für das Team vorgegeben: {DUPLICATE_LEVELS[state.value]}.</p> : null}
{state.can_lock ? (
<label className="check">
<input
type="checkbox"
checked={state.team_mode === "locked"}
onChange={(event) => save({ value: state.own, team_mode: event.target.checked ? "locked" : "free" })}
/>
Für Mitarbeiter verbindlich
</label>
) : null}
<ErrorNote error={error} />
{notice ? <p className="notice" role="status">{notice}</p> : null}
</section>
);
}