Halte die Richtung an der einzelnen Einbindung und mach sie in der Uebersicht waehlbar.
Deploy Development / deploy (push) Successful in 28s
Deploy Development / deploy (push) Successful in 28s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2664021e7f
commit
95381030bc
12 files changed
+185
-52
No files matched your search
@@ -279,6 +279,13 @@ export function elementFacts(element, communication) {
|
||||
export function directionWord(direction) {
|
||||
if (direction === "out") return "Ausgang";
|
||||
if (direction === "in") return "Eingang";
|
||||
if (direction === "local") return "Lokal";
|
||||
return "";
|
||||
}
|
||||
|
||||
export function directionValue(communication) {
|
||||
const direction = communication?.direction;
|
||||
if (direction === "in" || direction === "out" || direction === "local") return direction;
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -298,15 +305,20 @@ export function DirectionColumn({ direction }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function DirectionChoice({ value, disabled, onChange }) {
|
||||
export function DirectionChoice({ value, disabled, onChange, compact = false, label = "Kommunikationsrichtung" }) {
|
||||
const select = (
|
||||
<select aria-label={label} value={value || ""} disabled={disabled} onChange={(event) => onChange(event.target.value)}>
|
||||
<option value="">Keine Angabe</option>
|
||||
<option value="in">Eingang</option>
|
||||
<option value="out">Ausgang</option>
|
||||
<option value="local">Lokal</option>
|
||||
</select>
|
||||
);
|
||||
if (compact) return <span className="direction-choice">{select}</span>;
|
||||
return (
|
||||
<label>
|
||||
Kommunikationsrichtung
|
||||
<select aria-label="Kommunikationsrichtung" value={value || ""} disabled={disabled} onChange={(event) => onChange(event.target.value)}>
|
||||
<option value="">Keine Angabe</option>
|
||||
<option value="in">Eingang</option>
|
||||
<option value="out">Ausgang</option>
|
||||
</select>
|
||||
{label}
|
||||
{select}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -352,7 +364,6 @@ function BezugLink({ item, label, source, onOpen, itemHref, reply = false }) {
|
||||
const className = reply ? "bezug__link bezug__link--reply" : "bezug__link";
|
||||
const body = (
|
||||
<>
|
||||
<DirectionColumn direction={item.direction} />
|
||||
<span>{label}</span>
|
||||
<strong>{formatDate(item.document_on)} · {item.title}</strong>
|
||||
{directionWord(item.direction) ? <span>{directionWord(item.direction)}</span> : null}
|
||||
@@ -491,6 +502,26 @@ export function ContentBoard({
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRowDirection(binding, value) {
|
||||
setPending(true);
|
||||
setError("");
|
||||
try {
|
||||
await api(`/api/v1/bindings/${binding.id}/communication`, {
|
||||
method: "PATCH",
|
||||
body: {
|
||||
expected_version: binding.element.version,
|
||||
direction: value || null,
|
||||
context: actionContext(),
|
||||
},
|
||||
});
|
||||
await onChange();
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function clearBezug(elementId, refersToId) {
|
||||
setPending(true);
|
||||
setError("");
|
||||
@@ -978,6 +1009,15 @@ export function ContentBoard({
|
||||
<li key={binding.id} data-binding={binding.id} className={`preview-row${linked ? " preview-row--linked" : ""}${draggingId === binding.id ? " is-dragging" : ""}${selectedId === binding.id ? " is-selected" : ""}`}>
|
||||
{indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === index ? <div className="insert-line" /> : null}
|
||||
<DirectionColumn direction={binding.communication?.direction} />
|
||||
{canEdit ? (
|
||||
<DirectionChoice
|
||||
compact
|
||||
label={`Richtung für ${element.title}`}
|
||||
value={directionValue(binding.communication)}
|
||||
disabled={pending}
|
||||
onChange={(value) => saveRowDirection(binding, value)}
|
||||
/>
|
||||
) : null}
|
||||
{canSort && custom ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -1017,7 +1057,7 @@ export function ContentBoard({
|
||||
</span>
|
||||
) : null}
|
||||
{formatDate(fachDate(element))} · {sourceLabel(element)}
|
||||
{directionWord(binding.communication?.direction) ? <span>{directionWord(binding.communication?.direction)}</span> : null}
|
||||
{!canEdit && directionWord(binding.communication?.direction) ? <span>{directionWord(binding.communication?.direction)}</span> : null}
|
||||
{mailFacts(element) ? <span>{mailFacts(element)}</span> : null}
|
||||
{dateCaption(element, binding.communication?.direction) ? <span>{dateCaption(element, binding.communication?.direction)}</span> : null}
|
||||
</span>
|
||||
|
||||
Reference in new issue
Block a user