Halte Anlagen und Versand als eigene Verwendung fest, damit die uebermittelte Fassung und ihre Nachweise spaeter nicht still mit der Arbeitsfassung verschmelzen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f21c64a944
commit
3c190c87b4
27 files changed
+3953
-71
No files matched your search
@@ -4,7 +4,7 @@ import { symbolUrl } from "../content-symbol.mjs";
|
||||
|
||||
function leafIds(node, into = []) {
|
||||
if (!node) return into;
|
||||
if (node.kind === "binding" || node.kind === "annotation") into.push(node.id);
|
||||
if (node.kind === "binding" || node.kind === "annotation" || node.kind === "attachment" || node.kind === "dispatch_item" || node.kind === "evidence") into.push(node.id);
|
||||
(node.children || []).forEach((child) => leafIds(child, into));
|
||||
return into;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ function withNode(node, selected, on) {
|
||||
function initialSelection(node) {
|
||||
const next = new Set();
|
||||
function visit(current) {
|
||||
if ((current.kind === "binding" || current.kind === "annotation") && current.exportable) {
|
||||
if ((current.kind === "binding" || current.kind === "annotation" || current.kind === "attachment" || current.kind === "dispatch_item" || current.kind === "evidence") && current.exportable) {
|
||||
next.add(current.id);
|
||||
}
|
||||
(current.children || []).forEach(visit);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { documentToText, downloadMailPart, fetchFile, fetchMailPart, fetchPaperless, markDirty, textToDocument, api } from "../api.js";
|
||||
import { ErrorNote } from "./widgets.jsx";
|
||||
import { UnitDetail } from "./correspondence.jsx";
|
||||
import { dateCaption, DateField, DirectionChoice, DirectionColumn, directionValue, directionWord, formatDate, mailFacts, MarkdownEditor, sourceLabel } from "./content.jsx";
|
||||
import { NavIcon } from "./icons.jsx";
|
||||
import workerSrc from "pdfjs-dist/build/pdf.worker.min.mjs?url";
|
||||
@@ -505,6 +506,14 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
<div className="reader-pane__stage">
|
||||
<ErrorNote error={error} />
|
||||
<Correspondence element={element} direction={shownDirection} onOpenRelated={onOpenRelated} />
|
||||
<UnitDetail
|
||||
binding={binding}
|
||||
canEdit={false}
|
||||
pending={false}
|
||||
onOpen={(elementId) => onOpenRelated?.(elementId)}
|
||||
onDetach={() => {}}
|
||||
onUnfold={() => {}}
|
||||
/>
|
||||
{isMail ? (
|
||||
<article className="mail-letter">
|
||||
<p className="mail-letter__way"><DirectionColumn direction={shownDirection} />{directionWord(shownDirection) ? <span>{directionWord(shownDirection)}</span> : null}</p>
|
||||
|
||||
@@ -72,6 +72,23 @@ export function trailWithChapter(items, chapters, chapterId, backHref) {
|
||||
return [...base, { label: path.join(" / "), href: null }];
|
||||
}
|
||||
|
||||
export function countLabel(direct, nested) {
|
||||
const here = Number(direct) || 0;
|
||||
const below = Number(nested) || 0;
|
||||
if (here && below) return `${here} direkt · ${below} in Unterkapiteln`;
|
||||
if (!here && below) return `${below} in Unterkapiteln`;
|
||||
return String(here);
|
||||
}
|
||||
|
||||
export function sectionCounts(section) {
|
||||
const direct = (section?.items || []).length;
|
||||
const nested = (section?.children || []).reduce((sum, child) => {
|
||||
const inner = sectionCounts(child);
|
||||
return sum + inner.direct + inner.nested;
|
||||
}, 0);
|
||||
return { direct, nested };
|
||||
}
|
||||
|
||||
export function findSection(nodes, id) {
|
||||
for (const node of nodes || []) {
|
||||
if (node.id === id) return node;
|
||||
|
||||
+208
-19
@@ -11,10 +11,23 @@ import { ErrorNote } from "./widgets.jsx";
|
||||
import {
|
||||
buildChapterSections,
|
||||
chapterPathLabel,
|
||||
countLabel,
|
||||
descendantChapterIds,
|
||||
findSection,
|
||||
sectionCounts,
|
||||
siblingChapterIds,
|
||||
} from "./chapters.js";
|
||||
import {
|
||||
AttachDialog,
|
||||
Chronology,
|
||||
DispatchDialog,
|
||||
EvidenceDialog,
|
||||
hostMark,
|
||||
restoreFold,
|
||||
scopeBody,
|
||||
unitMarks,
|
||||
UnitDetail,
|
||||
} from "./correspondence.jsx";
|
||||
|
||||
export function formatDate(value) {
|
||||
if (!value) return "Ohne Datum";
|
||||
@@ -756,6 +769,9 @@ function EntryActions({
|
||||
onRemove,
|
||||
onMove,
|
||||
onPlaceChapter,
|
||||
onAttach,
|
||||
onDispatch,
|
||||
onEvidence,
|
||||
}) {
|
||||
const anchorRef = useRef(null);
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -823,6 +839,9 @@ function EntryActions({
|
||||
) : null}
|
||||
{canSort && custom ? <button type="button" disabled={pending || index === 0} onClick={() => { close(); onMove(binding.id, -1); }}>Nach oben</button> : null}
|
||||
{canSort && custom ? <button type="button" disabled={pending || index === lastIndex} onClick={() => { close(); onMove(binding.id, 1); }}>Nach unten</button> : null}
|
||||
{canEdit && onAttach ? <button type="button" onClick={() => { close(); onAttach(binding); }}>Anlagen zuordnen</button> : null}
|
||||
{canEdit && onDispatch ? <button type="button" onClick={() => { close(); onDispatch(binding); }}>Versand dokumentieren</button> : null}
|
||||
{canEdit && onEvidence ? <button type="button" onClick={() => { close(); onEvidence(binding); }}>Als Versandnachweis zuordnen …</button> : null}
|
||||
{canEdit ? <button type="button" onClick={() => { close(); onRemove(binding, false); }}>Aus diesem Zusammenhang entfernen</button> : null}
|
||||
{canEdit && canDestroy ? <button type="button" className="danger" onClick={() => { close(); onRemove(binding, true); }}>Überall löschen</button> : null}
|
||||
</MenuPopover>
|
||||
@@ -919,6 +938,8 @@ export function ContentBoard({
|
||||
const chapters = record?.chapters || [];
|
||||
const [error, setError] = useState("");
|
||||
const [pending, setPending] = useState(false);
|
||||
const [dialog, setDialog] = useState(null);
|
||||
const [openUnits, setOpenUnits] = useState(() => new Set());
|
||||
const [draggingId, setDraggingId] = useState("");
|
||||
const [indicator, setIndicator] = useState(null);
|
||||
const [folded, setFolded] = useState(() => new Set());
|
||||
@@ -930,11 +951,17 @@ export function ContentBoard({
|
||||
const savingDirection = useRef(false);
|
||||
const custom = record?.content_order === "position";
|
||||
const direction = record?.content_order_dir === "desc" ? "desc" : "asc";
|
||||
const forest = buildChapterSections(chapters, source);
|
||||
const viewMode = record?.content_view === "chronology" ? "chronology" : "structure";
|
||||
const listed = source.filter((item) => !item.correspondence?.fold);
|
||||
const forest = buildChapterSections(chapters, listed);
|
||||
const loose = looseSection(forest.loose, chapters);
|
||||
const selectedSection = onlyChapter ? findSection(forest.roots, onlyChapter) : null;
|
||||
const visibleRoots = onlyChapter ? (selectedSection ? [selectedSection] : []) : forest.roots;
|
||||
const shownCount = onlyChapter ? (selectedSection?.items.length || 0) : source.length;
|
||||
const shownCount = viewMode === "chronology"
|
||||
? ""
|
||||
: onlyChapter
|
||||
? countLabel(sectionCounts(selectedSection).direct, sectionCounts(selectedSection).nested)
|
||||
: String(listed.length);
|
||||
const activePath = onlyChapter ? chapterPathLabel(chapters, onlyChapter) : "";
|
||||
const canSort = sortable && record?.rights?.edit;
|
||||
const canEdit = Boolean(record?.rights?.edit);
|
||||
@@ -1081,13 +1108,13 @@ export function ContentBoard({
|
||||
};
|
||||
}, []);
|
||||
|
||||
async function saveMode(mode, nextDirection) {
|
||||
async function saveMode(mode, nextDirection, nextView = viewMode) {
|
||||
setError("");
|
||||
setPending(true);
|
||||
try {
|
||||
await api(`${orderPath}/content-order`, {
|
||||
method: "PATCH",
|
||||
body: { expected_version: record.version, mode, direction: nextDirection, ...orderContext },
|
||||
body: { expected_version: record.version, mode, direction: nextDirection, view: nextView, ...orderContext },
|
||||
});
|
||||
onChange();
|
||||
} catch (err) {
|
||||
@@ -1097,6 +1124,30 @@ export function ContentBoard({
|
||||
}
|
||||
}
|
||||
|
||||
function orderedIds(sections) {
|
||||
const hidden = source.filter((item) => item.correspondence?.fold);
|
||||
const used = new Set();
|
||||
const ids = [];
|
||||
for (const section of sections) {
|
||||
for (const item of section.items) {
|
||||
ids.push(item.id);
|
||||
used.add(item.id);
|
||||
}
|
||||
const chapterId = section.id === "loose" ? null : section.id;
|
||||
for (const item of hidden) {
|
||||
const itemChapter = item.chapter_id || null;
|
||||
if ((chapterId ? itemChapter === chapterId : !itemChapter) && !used.has(item.id)) {
|
||||
ids.push(item.id);
|
||||
used.add(item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const item of source) {
|
||||
if (!used.has(item.id)) ids.push(item.id);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
async function persist(next, version = record.version) {
|
||||
setError("");
|
||||
setPending(true);
|
||||
@@ -1105,7 +1156,7 @@ export function ContentBoard({
|
||||
method: "POST",
|
||||
body: {
|
||||
expected_version: version,
|
||||
binding_ids: next.flatMap((section) => section.items.map((item) => item.id)),
|
||||
binding_ids: orderedIds(next),
|
||||
...orderContext,
|
||||
},
|
||||
});
|
||||
@@ -1423,7 +1474,7 @@ export function ContentBoard({
|
||||
return (
|
||||
<div className="contents" ref={rootRef}>
|
||||
<div className="content-toolbar">
|
||||
<h2>{activePath || listTitle || "Inhalte"} <span className="count">{shownCount}</span></h2>
|
||||
<h2>{viewMode === "chronology" ? "Chronologie" : (activePath || listTitle || "Inhalte")} <span className="count">{shownCount}</span></h2>
|
||||
<div className="content-toolbar__tools">
|
||||
{canSort && chapters.length && !picking ? (
|
||||
<button type="button" className="quiet content-toolbar__pick" onClick={() => { setPicking(true); setPickTarget(onlyChapter || ""); }}>Mehrere einordnen</button>
|
||||
@@ -1432,8 +1483,10 @@ export function ContentBoard({
|
||||
<OrderChoice
|
||||
mode={custom ? "position" : "date"}
|
||||
direction={direction}
|
||||
view={viewMode}
|
||||
disabled={pending}
|
||||
allowPosition
|
||||
allowChronology
|
||||
onChange={saveMode}
|
||||
/>
|
||||
) : sortable ? (
|
||||
@@ -1456,21 +1509,78 @@ export function ContentBoard({
|
||||
</select>
|
||||
</label>
|
||||
<button type="button" disabled={pending || picked.size === 0} onClick={() => placeMany([...picked], pickTarget)}>Einordnen</button>
|
||||
<button type="button" disabled={pending || picked.size === 0} onClick={() => setDialog({ type: "bulk" })}>Als Anlagen zuordnen</button>
|
||||
<button type="button" className="quiet" onClick={() => { setPicking(false); setPicked(new Set()); }}>Auswahl beenden</button>
|
||||
</div>
|
||||
) : null}
|
||||
{source.length || chapters.length ? (
|
||||
{viewMode === "chronology" ? (
|
||||
<Chronology bindings={source} direction={direction} itemHref={itemHref} selectedId={selectedId} onOpen={onOpen} />
|
||||
) : source.length || chapters.length ? (
|
||||
renderBlockList()
|
||||
) : (
|
||||
<p className="muted">Noch keine Unterlage und keine Notiz.</p>
|
||||
)}
|
||||
<Modal open={dialog?.type === "attach" || dialog?.type === "bulk"} title="Anlagen zuordnen" onClose={() => setDialog(null)}>
|
||||
{dialog?.type === "bulk" && !dialog.host ? (
|
||||
<form className="stack" onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const host = listed.find((item) => item.id === new FormData(event.currentTarget).get("host"));
|
||||
if (!host) return;
|
||||
const candidates = listed.filter((item) => picked.has(item.id) && item.id !== host.id);
|
||||
setDialog({ type: "attach", host, candidates });
|
||||
}}>
|
||||
<p>Hauptschriftstück für die ausgewählten Unterlagen wählen. Die Kapitel bleiben bestehen, bis sie separat aufgelöst werden.</p>
|
||||
<label>
|
||||
Hauptschriftstück
|
||||
<select name="host" defaultValue="">
|
||||
<option value="">Schriftstück wählen</option>
|
||||
{listed.map((item) => <option key={item.id} value={item.id}>{item.element.title}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit">Weiter zur Reihenfolge</button>
|
||||
</form>
|
||||
) : null}
|
||||
{dialog?.type === "attach" && dialog.host ? (
|
||||
<AttachDialog
|
||||
host={dialog.host}
|
||||
candidates={dialog.candidates}
|
||||
scope={scopeBody(actionContext(), containerKind, containerId)}
|
||||
pending={pending}
|
||||
onClose={() => setDialog(null)}
|
||||
onDone={() => { setDialog(null); setPicked(new Set()); setPicking(false); onChange(); }}
|
||||
/>
|
||||
) : null}
|
||||
</Modal>
|
||||
<Modal open={dialog?.type === "dispatch"} title="Versand dokumentieren" onClose={() => setDialog(null)}>
|
||||
{dialog?.type === "dispatch" ? (
|
||||
<DispatchDialog
|
||||
host={dialog.host}
|
||||
scope={scopeBody(actionContext(), containerKind, containerId)}
|
||||
pending={pending}
|
||||
onClose={() => setDialog(null)}
|
||||
onDone={() => { setDialog(null); onChange(); }}
|
||||
/>
|
||||
) : null}
|
||||
</Modal>
|
||||
<Modal open={dialog?.type === "evidence"} title="Als Versandnachweis zuordnen" onClose={() => setDialog(null)}>
|
||||
{dialog?.type === "evidence" ? (
|
||||
<EvidenceDialog
|
||||
element={dialog.binding.element}
|
||||
hosts={listed.filter((item) => item.element.id !== dialog.binding.element.id)}
|
||||
scope={scopeBody(actionContext(), containerKind, containerId)}
|
||||
pending={pending}
|
||||
onClose={() => setDialog(null)}
|
||||
onDone={() => onChange()}
|
||||
/>
|
||||
) : null}
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
|
||||
function renderBlockList() {
|
||||
const blocks = [...visibleRoots];
|
||||
if (!onlyChapter && loose) blocks.push(loose);
|
||||
return blocks.map((section) => renderBlock(section, 0, false));
|
||||
return blocks.map((section) => renderBlock(section, 0, Boolean(onlyChapter && section.id === onlyChapter)));
|
||||
}
|
||||
|
||||
function renderBlock(section, depth, hideHead) {
|
||||
@@ -1526,7 +1636,7 @@ export function ContentBoard({
|
||||
) : null}
|
||||
<ChapterHeading
|
||||
section={section}
|
||||
count={section.items.length}
|
||||
count={countLabel(sectionCounts(section).direct, sectionCounts(section).nested)}
|
||||
expanded={expanded}
|
||||
movable={movable}
|
||||
canEdit={canEdit && section.id !== "loose"}
|
||||
@@ -1572,7 +1682,8 @@ export function ContentBoard({
|
||||
const sourceSymbol = contentSourceSymbol(element);
|
||||
const way = directionWord(binding.communication?.direction) || "Keine Angabe";
|
||||
const party = counterpartLabel(element, binding.communication?.direction);
|
||||
const facts = [party, formatDate(fachDate(element)), sourceLabel(element), way].filter(Boolean).join(" · ");
|
||||
const facts = [party, formatDate(fachDate(element)), sourceLabel(element), way, unitMarks(binding)].filter(Boolean).join(" · ");
|
||||
const samePiece = hostMark(binding);
|
||||
const originText = binding.origin && section.title && !binding.origin.includes(section.title)
|
||||
? `${binding.origin}${binding.shared ? " · weitere Einbindung" : ""}`
|
||||
: binding.origin && !section.title
|
||||
@@ -1661,7 +1772,71 @@ export function ContentBoard({
|
||||
{text ? (
|
||||
<Link className="preview-row__text" to={href} onClick={openFromList}>{text}</Link>
|
||||
) : null}
|
||||
{samePiece ? <span className="preview-row__origin">{samePiece}</span> : null}
|
||||
{originText ? <span className="preview-row__origin">{originText}</span> : null}
|
||||
{(binding.correspondence?.attachments?.length || binding.correspondence?.dispatches?.length) ? (
|
||||
<button
|
||||
type="button"
|
||||
className="quiet unit-toggle"
|
||||
aria-expanded={openUnits.has(binding.id)}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOpenUnits((current) => {
|
||||
const next = new Set(current);
|
||||
if (next.has(binding.id)) next.delete(binding.id);
|
||||
else next.add(binding.id);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
>
|
||||
{openUnits.has(binding.id) ? "Anlagen zuklappen" : "Anlagen"}
|
||||
</button>
|
||||
) : null}
|
||||
{openUnits.has(binding.id) ? (
|
||||
<UnitDetail
|
||||
binding={binding}
|
||||
canEdit={canEdit}
|
||||
pending={pending}
|
||||
scope={scopeBody(actionContext(), containerKind, containerId)}
|
||||
onOpen={(elementId) => {
|
||||
const found = source.find((item) => item.element?.id === elementId);
|
||||
if (found) onOpen?.(found);
|
||||
}}
|
||||
onDetach={async (elementId) => {
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/elements/${element.id}/attachments/${elementId}/detach`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
expected_version: element.version,
|
||||
...scopeBody(actionContext(), containerKind, containerId),
|
||||
},
|
||||
});
|
||||
onChange();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}}
|
||||
onUnfold={async (elementId) => {
|
||||
const found = source.find((item) => item.element?.id === elementId);
|
||||
if (!found) return;
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await restoreFold(found.id, found.element.version, scopeBody(actionContext(), containerKind, containerId));
|
||||
onChange();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<EntryActions
|
||||
element={element}
|
||||
@@ -1681,6 +1856,13 @@ export function ContentBoard({
|
||||
onRemove={removeBinding}
|
||||
onMove={move}
|
||||
onPlaceChapter={placeChapter}
|
||||
onAttach={(row) => setDialog({
|
||||
type: "attach",
|
||||
host: row,
|
||||
candidates: listed.filter((item) => item.element.id !== row.element.id && !(row.correspondence?.attachments || []).some((entry) => entry.element_id === item.element.id)),
|
||||
})}
|
||||
onDispatch={(row) => setDialog({ type: "dispatch", host: row })}
|
||||
onEvidence={(row) => setDialog({ type: "evidence", binding: row })}
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
@@ -1698,24 +1880,31 @@ export function ContentBoard({
|
||||
}
|
||||
}
|
||||
|
||||
export function OrderChoice({ mode, direction, disabled, allowPosition = false, onChange }) {
|
||||
const value = mode === "position" ? "position" : direction === "desc" ? "date-desc" : "date-asc";
|
||||
export function OrderChoice({ mode, direction, view = "structure", disabled, allowPosition = false, allowChronology = false, onChange }) {
|
||||
const value = view === "chronology"
|
||||
? (direction === "desc" ? "chrono-desc" : "chrono-asc")
|
||||
: mode === "position" ? "position" : direction === "desc" ? "date-desc" : "date-asc";
|
||||
return (
|
||||
<label className="order-choice">
|
||||
<span>Ordnung</span>
|
||||
<span>{allowChronology ? "Ansicht" : "Ordnung"}</span>
|
||||
<select
|
||||
aria-label="Ordnung der Inhalte"
|
||||
aria-label="Ansicht und Ordnung der Inhalte"
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
onChange={(event) => {
|
||||
const next = event.target.value;
|
||||
if (next === "position") onChange("position", direction === "desc" ? "desc" : "asc");
|
||||
else onChange("date", next === "date-desc" ? "desc" : "asc");
|
||||
const kept = mode === "position" ? "position" : "date";
|
||||
if (next === "chrono-asc") onChange(kept, "asc", "chronology");
|
||||
else if (next === "chrono-desc") onChange(kept, "desc", "chronology");
|
||||
else if (next === "position") onChange("position", direction === "desc" ? "desc" : "asc", "structure");
|
||||
else onChange("date", next === "date-desc" ? "desc" : "asc", "structure");
|
||||
}}
|
||||
>
|
||||
<option value="date-asc">Fachliches Datum, aufsteigend</option>
|
||||
<option value="date-desc">Fachliches Datum, absteigend</option>
|
||||
{allowPosition ? <option value="position">Eigene Reihenfolge</option> : null}
|
||||
<option value="date-asc">{allowChronology ? "Gliederung, Datum aufsteigend" : "Fachliches Datum, aufsteigend"}</option>
|
||||
<option value="date-desc">{allowChronology ? "Gliederung, Datum absteigend" : "Fachliches Datum, absteigend"}</option>
|
||||
{allowPosition ? <option value="position">{allowChronology ? "Gliederung, eigene Reihenfolge" : "Eigene Reihenfolge"}</option> : null}
|
||||
{allowChronology ? <option value="chrono-asc">Chronologie, aufsteigend</option> : null}
|
||||
{allowChronology ? <option value="chrono-desc">Chronologie, absteigend</option> : null}
|
||||
</select>
|
||||
</label>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,547 @@
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api } from "../api.js";
|
||||
|
||||
function formatDate(value) {
|
||||
if (!value) return "Ohne Datum";
|
||||
const [year, month, day] = String(value).slice(0, 10).split("-");
|
||||
if (!year || !month || !day) return String(value);
|
||||
return `${day}.${month}.${year}`;
|
||||
}
|
||||
|
||||
export function scopeBody(context, containerKind, containerId) {
|
||||
const rights = context || { kind: containerKind, id: containerId };
|
||||
const same = rights.kind === containerKind && rights.id === containerId;
|
||||
return { context: rights, placement: same ? null : { kind: containerKind, id: containerId } };
|
||||
}
|
||||
|
||||
export function channelWord(channel) {
|
||||
if (channel === "email") return "per E-Mail";
|
||||
if (channel === "post") return "per Post";
|
||||
if (channel === "other") return "sonstiger Weg";
|
||||
return "";
|
||||
}
|
||||
|
||||
export function unitMarks(binding) {
|
||||
const pack = binding?.correspondence;
|
||||
if (!pack) return "";
|
||||
const parts = [];
|
||||
const attachments = pack.attachments || [];
|
||||
if (attachments.length === 1) parts.push("1 Anlage");
|
||||
else if (attachments.length > 1) parts.push(`${attachments.length} Anlagen`);
|
||||
const dispatches = pack.dispatches || [];
|
||||
if (dispatches.length === 1) parts.push(channelWord(dispatches[0].channel));
|
||||
else if (dispatches.length > 1) parts.push(`${dispatches.length} Versände`);
|
||||
const evidence = dispatches.reduce((sum, item) => sum + (item.evidence || []).length, 0);
|
||||
if (evidence === 1) parts.push("Nachweis");
|
||||
else if (evidence > 1) parts.push(`${evidence} Nachweise`);
|
||||
return parts.join(" · ");
|
||||
}
|
||||
|
||||
export function hostMark(binding) {
|
||||
const hosts = binding?.correspondence?.hosts || [];
|
||||
if (!hosts.length) return "";
|
||||
return `Dieselbe Unterlage · Anlage zu ${hosts.map((item) => item.title).join(", ")}`;
|
||||
}
|
||||
|
||||
function snapshotHref(dispatchId, itemId, scope) {
|
||||
const search = new URLSearchParams({
|
||||
context_kind: scope.context.kind,
|
||||
context_id: scope.context.id,
|
||||
});
|
||||
if (scope.placement) {
|
||||
search.set("placement_kind", scope.placement.kind);
|
||||
search.set("placement_id", scope.placement.id);
|
||||
}
|
||||
return `/api/v1/dispatches/${dispatchId}/items/${itemId}/content?${search}`;
|
||||
}
|
||||
|
||||
function fieldBody(scope, extra) {
|
||||
const body = { ...extra, context: scope.context };
|
||||
if (scope.placement) body.placement = scope.placement;
|
||||
return body;
|
||||
}
|
||||
|
||||
export function AttachDialog({ host, candidates, scope, pending, onClose, onDone }) {
|
||||
const initial = candidates.map((item) => item.element.id);
|
||||
const [order, setOrder] = useState(initial);
|
||||
const [chosen, setChosen] = useState(() => new Set(initial));
|
||||
const [fold, setFold] = useState("attachment");
|
||||
const [error, setError] = useState("");
|
||||
|
||||
function move(id, delta) {
|
||||
setOrder((current) => {
|
||||
const index = current.indexOf(id);
|
||||
const target = index + delta;
|
||||
if (index < 0 || target < 0 || target >= current.length) return current;
|
||||
const next = [...current];
|
||||
const [item] = next.splice(index, 1);
|
||||
next.splice(target, 0, item);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
||||
async function save(event) {
|
||||
event.preventDefault();
|
||||
const ids = order.filter((id) => chosen.has(id));
|
||||
if (!ids.length) {
|
||||
setError("Es ist keine Anlage ausgewählt.");
|
||||
return;
|
||||
}
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/elements/${host.element.id}/attachments`, {
|
||||
method: "POST",
|
||||
body: fieldBody(scope, {
|
||||
expected_version: host.element.version,
|
||||
attachment_element_ids: ids,
|
||||
fold,
|
||||
}),
|
||||
});
|
||||
onDone();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="stack" onSubmit={save}>
|
||||
<p>Anlagen von <strong>{host.element.title}</strong>. Die Dateien bleiben an ihrem Ort. Die aktuelle Liste ist nur die Zuordnung in diesem Zusammenhang.</p>
|
||||
<ol className="choice-list">
|
||||
{order.map((id, index) => {
|
||||
const item = candidates.find((entry) => entry.element.id === id);
|
||||
if (!item) return null;
|
||||
return (
|
||||
<li key={id}>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={chosen.has(id)}
|
||||
onChange={() => setChosen((current) => {
|
||||
const next = new Set(current);
|
||||
if (next.has(id)) next.delete(id);
|
||||
else next.add(id);
|
||||
return next;
|
||||
})}
|
||||
/>
|
||||
<span>{item.element.title}</span>
|
||||
<span className="muted">{formatDate(item.element.dates?.document_on)}</span>
|
||||
</label>
|
||||
<span className="choice-list__move">
|
||||
<button type="button" disabled={index === 0} onClick={() => move(id, -1)} aria-label={`${item.element.title} nach oben`}>↑</button>
|
||||
<button type="button" disabled={index === order.length - 1} onClick={() => move(id, 1)} aria-label={`${item.element.title} nach unten`}>↓</button>
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
<fieldset>
|
||||
<legend>Vorkommen in der Liste</legend>
|
||||
<label><input type="radio" name="fold" checked={fold === "keep"} onChange={() => setFold("keep")} /> Zusätzlich als eigenständige Einträge behalten</label>
|
||||
<label><input type="radio" name="fold" checked={fold === "attachment"} onChange={() => setFold("attachment")} /> Nur in der Anlagenansicht zeigen</label>
|
||||
</fieldset>
|
||||
{error ? <p className="error">{error}</p> : null}
|
||||
<button type="submit" disabled={pending}>Anlagen zuordnen</button>
|
||||
<button type="button" className="quiet" onClick={onClose}>Abbrechen</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function DispatchDialog({ host, scope, pending, onClose, onDone }) {
|
||||
const proposal = host.correspondence?.attachments || [];
|
||||
const [order, setOrder] = useState(proposal.map((item) => item.element_id));
|
||||
const [chosen, setChosen] = useState(() => new Set(proposal.map((item) => item.element_id)));
|
||||
const [channel, setChannel] = useState("email");
|
||||
const [sentOn, setSentOn] = useState("");
|
||||
const [counterpart, setCounterpart] = useState("");
|
||||
const [historical, setHistorical] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
function move(id, delta) {
|
||||
setOrder((current) => {
|
||||
const index = current.indexOf(id);
|
||||
const target = index + delta;
|
||||
if (index < 0 || target < 0 || target >= current.length) return current;
|
||||
const next = [...current];
|
||||
const [item] = next.splice(index, 1);
|
||||
next.splice(target, 0, item);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
||||
async function save(event) {
|
||||
event.preventDefault();
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/elements/${host.element.id}/dispatches`, {
|
||||
method: "POST",
|
||||
body: fieldBody(scope, {
|
||||
expected_version: host.element.version,
|
||||
channel,
|
||||
sent_on: sentOn || null,
|
||||
counterpart: counterpart.trim() || null,
|
||||
attachment_element_ids: order.filter((id) => chosen.has(id)),
|
||||
evidence: [],
|
||||
historical_gap: historical,
|
||||
}),
|
||||
});
|
||||
onDone();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="stack" onSubmit={save}>
|
||||
<p>Versand von <strong>{host.element.title}</strong> dokumentieren. Dabei wird nichts verschickt. Die Anlagenliste ist ein Vorschlag für diesen Versand.</p>
|
||||
<label>
|
||||
Weg
|
||||
<select value={channel} onChange={(event) => setChannel(event.target.value)}>
|
||||
<option value="email">E-Mail</option>
|
||||
<option value="post">Post</option>
|
||||
<option value="other">Sonstiger Weg</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Versanddatum
|
||||
<input type="date" value={sentOn} onChange={(event) => setSentOn(event.target.value)} />
|
||||
</label>
|
||||
<p className="muted">Leer lassen, wenn der Versandtag unbekannt ist. Der Erfassungszeitpunkt ersetzt ihn nicht.</p>
|
||||
<label>
|
||||
Gegenüber
|
||||
<input value={counterpart} onChange={(event) => setCounterpart(event.target.value)} maxLength={200} />
|
||||
</label>
|
||||
<p className="muted">Leer lassen, wenn das Gegenüber unbekannt ist.</p>
|
||||
<fieldset>
|
||||
<legend>Tatsächlich mitversendet</legend>
|
||||
<ol className="choice-list">
|
||||
{order.map((id, index) => {
|
||||
const item = proposal.find((entry) => entry.element_id === id);
|
||||
if (!item) return null;
|
||||
return (
|
||||
<li key={id}>
|
||||
<label>
|
||||
<input type="checkbox" checked={chosen.has(id)} onChange={() => setChosen((current) => {
|
||||
const next = new Set(current);
|
||||
if (next.has(id)) next.delete(id);
|
||||
else next.add(id);
|
||||
return next;
|
||||
})} />
|
||||
<span>{item.title}</span>
|
||||
<span className="muted">{formatDate(item.document_on)}</span>
|
||||
</label>
|
||||
<span className="choice-list__move">
|
||||
<button type="button" disabled={index === 0} onClick={() => move(id, -1)} aria-label={`${item.title} nach oben`}>↑</button>
|
||||
<button type="button" disabled={index === order.length - 1} onClick={() => move(id, 1)} aria-label={`${item.title} nach unten`}>↓</button>
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
{!proposal.length ? <p className="muted">Keine zugeordnete Anlage. Das Schreiben kann allein dokumentiert werden.</p> : null}
|
||||
</fieldset>
|
||||
<label>
|
||||
<input type="checkbox" checked={historical} onChange={(event) => setHistorical(event.target.checked)} />
|
||||
Historische Originalfassung liegt nicht mehr vor
|
||||
</label>
|
||||
{error ? <p className="error">{error}</p> : null}
|
||||
<button type="submit" disabled={pending}>Versand dokumentieren</button>
|
||||
<button type="button" className="quiet" onClick={onClose}>Abbrechen</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function EvidenceDialog({ element, hosts, scope, pending, onClose, onDone }) {
|
||||
const [hostId, setHostId] = useState(hosts[0]?.element.id || "");
|
||||
const host = hosts.find((item) => item.element.id === hostId) || null;
|
||||
const [dispatchId, setDispatchId] = useState(host?.correspondence?.dispatches?.[0]?.id || "");
|
||||
const [role, setRole] = useState("email");
|
||||
const [fold, setFold] = useState("keep");
|
||||
const [channel, setChannel] = useState("email");
|
||||
const [sentOn, setSentOn] = useState("");
|
||||
const [counterpart, setCounterpart] = useState("");
|
||||
const [result, setResult] = useState(null);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
async function save(event) {
|
||||
event.preventDefault();
|
||||
if (!host) return;
|
||||
setError("");
|
||||
try {
|
||||
let target = dispatchId;
|
||||
if (!target) {
|
||||
const created = await api(`/api/v1/elements/${host.element.id}/dispatches`, {
|
||||
method: "POST",
|
||||
body: fieldBody(scope, {
|
||||
expected_version: host.element.version,
|
||||
channel,
|
||||
sent_on: sentOn || null,
|
||||
counterpart: counterpart.trim() || null,
|
||||
attachment_element_ids: (host.correspondence?.attachments || []).map((item) => item.element_id),
|
||||
evidence: [{ element_id: element.id, role, fold }],
|
||||
historical_gap: false,
|
||||
}),
|
||||
});
|
||||
const proof = (created.evidence || []).find((item) => item.element_id === element.id);
|
||||
setResult(proof || created);
|
||||
onDone(false);
|
||||
return;
|
||||
}
|
||||
const dispatch = (host.correspondence?.dispatches || []).find((item) => item.id === target);
|
||||
const proof = await api(`/api/v1/dispatches/${target}/evidence`, {
|
||||
method: "POST",
|
||||
body: fieldBody(scope, {
|
||||
expected_version: dispatch?.version || 1,
|
||||
element_id: element.id,
|
||||
role,
|
||||
fold,
|
||||
}),
|
||||
});
|
||||
setResult(proof);
|
||||
onDone(false);
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="stack" onSubmit={save}>
|
||||
<p><strong>{element.title}</strong> als Nachweis zuordnen. Das Original bleibt vollständig erhalten.</p>
|
||||
<label>
|
||||
Hauptschriftstück
|
||||
<select value={hostId} onChange={(event) => {
|
||||
const next = event.target.value;
|
||||
setHostId(next);
|
||||
const found = hosts.find((item) => item.element.id === next);
|
||||
setDispatchId(found?.correspondence?.dispatches?.[0]?.id || "");
|
||||
}}>
|
||||
{hosts.map((item) => <option key={item.element.id} value={item.element.id}>{item.element.title}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Versand
|
||||
<select value={dispatchId} onChange={(event) => setDispatchId(event.target.value)}>
|
||||
<option value="">Neuen Versand in diesem Ablauf anlegen</option>
|
||||
{(host?.correspondence?.dispatches || []).map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.sent_on ? formatDate(item.sent_on) : "undatiert"} · {item.channel_label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{!dispatchId ? (
|
||||
<>
|
||||
<label>
|
||||
Weg
|
||||
<select value={channel} onChange={(event) => setChannel(event.target.value)}>
|
||||
<option value="email">E-Mail</option>
|
||||
<option value="post">Post</option>
|
||||
<option value="other">Sonstiger Weg</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Versanddatum<input type="date" value={sentOn} onChange={(event) => setSentOn(event.target.value)} /></label>
|
||||
<label>Gegenüber<input value={counterpart} onChange={(event) => setCounterpart(event.target.value)} maxLength={200} /></label>
|
||||
</>
|
||||
) : null}
|
||||
<label>
|
||||
Rolle
|
||||
<select value={role} onChange={(event) => setRole(event.target.value)}>
|
||||
<option value="email">E-Mail/Versanddokumentation</option>
|
||||
<option value="submission">Einlieferung</option>
|
||||
<option value="delivery">Zustellung</option>
|
||||
<option value="other">sonstiger Nachweis</option>
|
||||
</select>
|
||||
</label>
|
||||
<fieldset>
|
||||
<legend>Darstellung hier</legend>
|
||||
<label><input type="radio" name="evidence-fold" checked={fold === "evidence"} onChange={() => setFold("evidence")} /> Hier als Nachweis darstellen</label>
|
||||
<label><input type="radio" name="evidence-fold" checked={fold === "keep"} onChange={() => setFold("keep")} /> Zusätzlich als eigenständigen Eintrag behalten</label>
|
||||
</fieldset>
|
||||
{result ? <ComparisonList comparisons={result.comparisons || []} state={result.source_state} reason={result.gap_reason} /> : null}
|
||||
{error ? <p className="error">{error}</p> : null}
|
||||
<button type="submit" disabled={pending || !host}>Nachweis zuordnen</button>
|
||||
<button type="button" className="quiet" onClick={onClose}>Schließen</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function ComparisonList({ comparisons = [], state, reason }) {
|
||||
if (!comparisons.length && state !== "gap") return null;
|
||||
return (
|
||||
<div className="comparison">
|
||||
{state === "gap" ? <p>Originalfassung nicht gesichert: {reason}</p> : null}
|
||||
{state === "identified" ? <p>Nachweis manuell zugeordnet. Gleiche Dateinamen werden nicht automatisch zusammengeführt.</p> : null}
|
||||
<ul>
|
||||
{comparisons.map((item) => (
|
||||
<li key={`${item.filename}-${item.sha256}`}>
|
||||
<strong>{item.filename}</strong>
|
||||
{item.disposition === "same_bytes" ? ` · gleicher Dateiinhalt wie ${item.matches.map((match) => match.title).join(", ")} · Vorschlag, nicht automatisch zugeordnet` : null}
|
||||
{item.disposition === "same_name_different_bytes" ? ` · gleicher Name, anderer Inhalt als ${item.matches.map((match) => match.title).join(", ")}` : null}
|
||||
{item.disposition === "distinct" ? " · eigener Inhalt" : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function UnitDetail({ binding, canEdit, pending, scope, onOpen, onDetach, onUnfold }) {
|
||||
const pack = binding.correspondence || {};
|
||||
const attachments = pack.attachments || [];
|
||||
const dispatches = pack.dispatches || [];
|
||||
if (!attachments.length && !dispatches.length && !(pack.hosts || []).length) return null;
|
||||
return (
|
||||
<div className="unit-detail">
|
||||
{attachments.length ? (
|
||||
<section>
|
||||
<h4>Anlagen</h4>
|
||||
<ol>
|
||||
{attachments.map((item, index) => (
|
||||
<li key={item.id}>
|
||||
<span>{index + 1}. {item.title}</span>
|
||||
<span className="muted">{formatDate(item.document_on)}</span>
|
||||
{item.binding_id ? (
|
||||
<button type="button" className="quiet" onClick={() => onOpen(item.element_id)}>Öffnen</button>
|
||||
) : null}
|
||||
{canEdit ? (
|
||||
<button type="button" className="quiet" disabled={pending} onClick={() => onDetach(item.element_id)}>Anlage lösen</button>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</section>
|
||||
) : null}
|
||||
{dispatches.map((item) => (
|
||||
<section key={item.id}>
|
||||
<h4>
|
||||
Versand {item.undated ? "undatiert" : formatDate(item.sent_on)} · {item.channel_label}
|
||||
{item.counterpart ? ` · ${item.counterpart}` : " · Gegenüber unbekannt"}
|
||||
</h4>
|
||||
<p className="muted">
|
||||
{item.provenance === "reconstructed" ? "Rekonstruierte Dokumentation. " : "Beim Dokumentieren gesichert. "}
|
||||
{item.completeness === "secured" ? "Inhaltsstand gesichert." : null}
|
||||
{item.completeness === "partial" ? "Inhaltsstand nur teilweise gesichert." : null}
|
||||
{item.completeness === "gap" ? "Kein vollständiger gesicherter Inhaltsstand." : null}
|
||||
{item.recorded_at ? ` Erfasst ${formatDate(item.recorded_at.slice(0, 10))}.` : ""}
|
||||
</p>
|
||||
<ol>
|
||||
{item.items.map((part) => (
|
||||
<li key={part.id}>
|
||||
<span>{part.role === "host" ? "Schreiben" : "Anlage"}: {part.title}</span>
|
||||
<span className="muted">Dokumentdatum {formatDate(part.document_on)}</span>
|
||||
{part.source_state === "gap" ? <span>Lücke: {part.gap_reason}</span> : scope ? (
|
||||
<a href={snapshotHref(item.id, part.id, scope)}>Gesicherte Fassung</a>
|
||||
) : <span>Gesicherte Fassung</span>}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
{item.evidence?.length ? (
|
||||
<ul>
|
||||
{item.evidence.map((proof) => (
|
||||
<li key={proof.id}>
|
||||
<button type="button" className="quiet" onClick={() => onOpen(proof.element_id)}>
|
||||
{proof.role_label}: {proof.title}
|
||||
</button>
|
||||
<span className="muted">{formatDate(proof.document_on)}</span>
|
||||
{proof.source_state === "gap" ? <span>Lücke: {proof.gap_reason}</span> : null}
|
||||
<ComparisonList comparisons={proof.comparisons} state={proof.source_state} reason={proof.gap_reason} />
|
||||
{canEdit && proof.listed_fold === "evidence" ? (
|
||||
<button type="button" className="quiet" disabled={pending} onClick={() => onUnfold(proof.element_id)}>
|
||||
Wieder als eigenständigen Eintrag zeigen
|
||||
</button>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : <p className="muted">Vom Nutzer dokumentiert, noch ohne Nachweis.</p>}
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Chronology({ bindings, direction, itemHref, selectedId, onOpen }) {
|
||||
const events = [];
|
||||
for (const binding of bindings || []) {
|
||||
if (binding.correspondence?.fold !== "evidence") {
|
||||
events.push({
|
||||
key: `doc-${binding.id}`,
|
||||
date: binding.element?.dates?.document_on || "",
|
||||
label: "Unterlage",
|
||||
title: binding.element?.title || "",
|
||||
detail: `Dokumentdatum ${formatDate(binding.element?.dates?.document_on)}`,
|
||||
binding,
|
||||
});
|
||||
}
|
||||
for (const dispatch of binding.correspondence?.dispatches || []) {
|
||||
events.push({
|
||||
key: `send-${dispatch.id}`,
|
||||
date: dispatch.sent_on || "",
|
||||
label: "Versand",
|
||||
title: binding.element?.title || "",
|
||||
detail: [
|
||||
dispatch.undated ? "Versand undatiert" : `Versanddatum ${formatDate(dispatch.sent_on)}`,
|
||||
dispatch.channel_label,
|
||||
(dispatch.evidence || []).length === 1
|
||||
? "1 Nachweis"
|
||||
: (dispatch.evidence || []).length
|
||||
? `${dispatch.evidence.length} Nachweise`
|
||||
: "ohne Nachweis",
|
||||
].join(" · "),
|
||||
binding,
|
||||
dispatch,
|
||||
});
|
||||
}
|
||||
}
|
||||
events.sort((left, right) => {
|
||||
if (!left.date && !right.date) return left.key.localeCompare(right.key);
|
||||
if (!left.date) return 1;
|
||||
if (!right.date) return -1;
|
||||
const compared = left.date.localeCompare(right.date);
|
||||
if (compared) return direction === "desc" ? -compared : compared;
|
||||
return left.key.localeCompare(right.key);
|
||||
});
|
||||
const undated = events.filter((item) => !item.date);
|
||||
const dated = events.filter((item) => item.date);
|
||||
const ordered = direction === "desc" ? [...undated, ...dated] : [...dated, ...undated];
|
||||
const groups = [];
|
||||
for (const event of ordered) {
|
||||
const name = event.date ? formatDate(event.date) : "Ohne Datum";
|
||||
const last = groups[groups.length - 1];
|
||||
if (!last || last.name !== name) groups.push({ name, events: [event] });
|
||||
else last.events.push(event);
|
||||
}
|
||||
if (!groups.length) return <p className="muted">In dieser Ansicht ist noch nichts zu sehen.</p>;
|
||||
return (
|
||||
<div className="chrono">
|
||||
{groups.map((group) => (
|
||||
<section key={group.name}>
|
||||
<h3>{group.name}</h3>
|
||||
<ol className="preview-list">
|
||||
{group.events.map((event) => (
|
||||
<li key={event.key} className={selectedId === event.binding.id ? "preview-row is-selected" : "preview-row"}>
|
||||
<div className="preview-row__body">
|
||||
<Link to={itemHref(event.binding)} onClick={(click) => {
|
||||
if (click.metaKey || click.ctrlKey || click.shiftKey || click.altKey || click.button !== 0) return;
|
||||
click.preventDefault();
|
||||
onOpen(event.binding);
|
||||
}}>
|
||||
<strong>{event.label}: {event.title}</strong>
|
||||
</Link>
|
||||
<span className="preview-row__facts">{event.detail}</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export async function restoreFold(bindingId, version, scope) {
|
||||
await api(`/api/v1/bindings/${bindingId}/fold`, {
|
||||
method: "PATCH",
|
||||
body: fieldBody(scope, { expected_version: version, fold: null }),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user