Halte die Vorgangsleiste sichtbar und nimm die ueberfluessigen Kapitelworte weg, damit Datum, Bezuege, Titel und mehrere Belege direkt gesetzt werden koennen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
cbd45a8997
commit
deb5d662fe
13 files changed
+423
-101
No files matched your search
@@ -1,7 +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 { dateCaption, DirectionChoice, DirectionColumn, directionValue, directionWord, formatDate, mailFacts, MarkdownEditor, sourceLabel } from "./content.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";
|
||||
|
||||
@@ -383,6 +383,21 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
}
|
||||
}
|
||||
|
||||
async function renameTitle() {
|
||||
const title = window.prompt("Titel", element.title);
|
||||
if (!title || title.trim() === element.title) return;
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/elements/${element.id}/title`, {
|
||||
method: "PATCH",
|
||||
body: { expected_version: element.version, title: title.trim(), context },
|
||||
});
|
||||
onReload();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveDate(event) {
|
||||
event.preventDefault();
|
||||
setError("");
|
||||
@@ -463,6 +478,11 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
<div className="reader-title">
|
||||
<DirectionColumn direction={shownDirection} />
|
||||
<h2>{element.title}</h2>
|
||||
{binding.rights.edit ? (
|
||||
<button type="button" className="icon-button icon-button--compact" aria-label="Titel ändern" onClick={renameTitle}>
|
||||
<NavIcon name="pencil" />
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="reader-facts">
|
||||
<span>{formatDate(element.dates?.document_on)} · {sourceLabel(element)}</span>
|
||||
@@ -615,15 +635,15 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
|
||||
<form className="stack" onSubmit={saveDate}>
|
||||
<label>
|
||||
{element.kind === "note" ? "Bezugsdatum, optional" : "Dokumentdatum, optional"}
|
||||
<input type="date" value={documentOn} onChange={(event) => { setDocumentOn(event.target.value); markDirty(true); }} />
|
||||
<DateField value={documentOn} onChange={(value) => { setDocumentOn(value); markDirty(true); }} />
|
||||
</label>
|
||||
<label>
|
||||
Versand, optional
|
||||
<input type="date" value={sentOn} onChange={(event) => { setSentOn(event.target.value); markDirty(true); }} />
|
||||
<DateField value={sentOn} onChange={(value) => { setSentOn(value); markDirty(true); }} />
|
||||
</label>
|
||||
<label>
|
||||
Zugang, optional
|
||||
<input type="date" value={receivedOn} onChange={(event) => { setReceivedOn(event.target.value); markDirty(true); }} />
|
||||
<DateField value={receivedOn} onChange={(value) => { setReceivedOn(value); markDirty(true); }} />
|
||||
</label>
|
||||
<button type="submit" className="quiet">Datum speichern</button>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user