mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-05 02:55:30 +00:00
1475 lines
66 KiB
Plaintext
1475 lines
66 KiB
Plaintext
{{ $model := . }}
|
||
<!-- Data:
|
||
type AlmanachResult struct {
|
||
Entry *dbmodels.Entry
|
||
Places []*dbmodels.Place
|
||
Series []*dbmodels.Series
|
||
Contents []*dbmodels.Content
|
||
Items []*dbmodels.Item
|
||
Agents map[string]*dbmodels.Agent // <- Key is agent id
|
||
EntriesSeries map[string]*dbmodels.REntriesSeries // <- Key is series id
|
||
EntriesAgents []*dbmodels.REntriesAgents
|
||
ContentsAgents map[string][]*dbmodels.RContentsAgents // <- Key is content id
|
||
User *dbmodels.User
|
||
|
||
Types []string
|
||
HasScans bool
|
||
}
|
||
-->
|
||
|
||
{{- $preferredSeriesTitle := "" -}}
|
||
{{- $preferredSeriesId := "" -}}
|
||
{{- $preferredSeriesMusenalmID := "" -}}
|
||
{{- $preferredRelationId := "" -}}
|
||
{{- if and $model.result $model.result.Series -}}
|
||
{{- range $i, $s := $model.result.Series -}}
|
||
{{- $rel := index $model.result.EntriesSeries $s.Id -}}
|
||
{{- if and $rel (eq $rel.Type "Bevorzugter Reihentitel") -}}
|
||
{{- $preferredSeriesTitle = $s.Title -}}
|
||
{{- $preferredSeriesId = $s.Id -}}
|
||
{{- $preferredSeriesMusenalmID = $s.MusenalmID -}}
|
||
{{- $preferredRelationId = $rel.Id -}}
|
||
{{- end -}}
|
||
{{- end -}}
|
||
{{- end -}}
|
||
|
||
<almanach-edit-page>
|
||
<duplicate-warning-checker></duplicate-warning-checker>
|
||
|
||
<div class="flex container-normal bg-slate-100 mx-auto px-8">
|
||
<div class="flex flex-row w-full justify-between">
|
||
<div class="flex flex-col justify-end-safe flex-2/5">
|
||
<div class="mb-1">
|
||
<div class="header-tabs">
|
||
{{- if and (not $model.is_new) $preferredSeriesMusenalmID -}}
|
||
<a href="/reihe/{{- $preferredSeriesMusenalmID -}}/edit" class="header-tab">
|
||
<i class="ri-book-shelf-line"></i> Reihe
|
||
</a>
|
||
{{- else -}}
|
||
<span class="header-tab header-tab-disabled">
|
||
<i class="ri-book-shelf-line"></i> Reihe
|
||
</span>
|
||
{{- end -}}
|
||
<span class="header-tab-sep">›</span>
|
||
<span class="header-tab header-tab-active">
|
||
<i class="ri-book-line"></i> Almanach
|
||
</span>
|
||
<span class="header-tab-sep">›</span>
|
||
{{- if not $model.is_new -}}
|
||
<a href="/almanach/{{- $model.result.Entry.MusenalmID -}}/contents/edit" class="header-tab">
|
||
<i class="ri-file-list-3-line"></i> Beiträge
|
||
</a>
|
||
{{- else -}}
|
||
<span class="header-tab header-tab-disabled">
|
||
<i class="ri-file-list-3-line"></i> Beiträge
|
||
</span>
|
||
{{- end -}}
|
||
</div>
|
||
</div>
|
||
<h1 class="text-2xl w-full font-bold text-slate-900 mb-1">
|
||
{{- if $model.is_new -}}
|
||
Neuen Almanach anlegen
|
||
{{- else -}}
|
||
{{- $model.result.Entry.PreferredTitle -}}
|
||
{{- end -}}
|
||
</h1>
|
||
{{- if not $model.is_new -}}
|
||
<div class="flex flex-row gap-x-3">
|
||
<div>
|
||
<a
|
||
href="/almanach/{{ $model.result.Entry.MusenalmID }}"
|
||
class="text-gray-700
|
||
hover:text-slate-950 block no-underline">
|
||
<i class="ri-eye-line"></i> Anschauen
|
||
</a>
|
||
</div>
|
||
·
|
||
<div class="flex flex-row">
|
||
{{- if $model.result.PrevByID -}}
|
||
<div>
|
||
<a href="/almanach/{{ $model.result.PrevByID.MusenalmID }}/edit/" class="text-gray-700 hover:text-slate-950 no-underline block ">
|
||
<i class="ri-arrow-left-s-line"></i>
|
||
</a>
|
||
</div>
|
||
{{- end -}}
|
||
<div class="px-1.5 py-0.5 rounded-xs bg-gray-200 w-fit font-bold">
|
||
{{ $model.result.Entry.MusenalmID }}
|
||
<tool-tip position="right" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "musenalm_id" }}</div>
|
||
<i class="ri-information-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
{{- if $model.result.NextByID -}}
|
||
<div>
|
||
<a href="/almanach/{{ $model.result.NextByID.MusenalmID }}/edit/" class="text-gray-700 hover:text-slate-950 block no-underline"><i class="ri-arrow-right-s-line"></i></a>
|
||
</div>
|
||
{{- end -}}
|
||
</div>
|
||
</div>
|
||
{{- end -}}
|
||
</div>
|
||
{{- if not $model.is_new -}}
|
||
<div class="flex flex-row" id="almanach-header-data">
|
||
<div class="flex flex-col justify-end gap-y-6 pr-20">
|
||
<div class="">
|
||
<div class="font-bold text-sm">
|
||
<i class="ri-navigation-line"></i> Navigation
|
||
</div>
|
||
<div class="flex items-center gap-2">
|
||
{{- if $model.result.PrevByTitle -}}
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ $model.result.PrevByTitle.PreferredTitle }}</div>
|
||
<a
|
||
href="/almanach/{{ $model.result.PrevByTitle.MusenalmID }}/edit/"
|
||
class="text-gray-700 hover:text-slate-950 no-underline">
|
||
<i class="ri-arrow-left-s-line"></i>
|
||
</a>
|
||
</tool-tip>
|
||
{{- else -}}
|
||
<span class="text-gray-700 opacity-0 pointer-events-none">
|
||
<i class="ri-arrow-left-s-line"></i>
|
||
</span>
|
||
{{- end -}}
|
||
<span class="text-gray-800 font-bold no-underline">
|
||
A - Z
|
||
</span>
|
||
{{- if $model.result.NextByTitle -}}
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ $model.result.NextByTitle.PreferredTitle }}</div>
|
||
<a
|
||
href="/almanach/{{ $model.result.NextByTitle.MusenalmID }}/edit/"
|
||
class="text-gray-700 hover:text-slate-950 no-underline">
|
||
<i class="ri-arrow-right-s-line"></i>
|
||
</a>
|
||
</tool-tip>
|
||
{{- else -}}
|
||
<span class="text-gray-700 opacity-0 pointer-events-none">
|
||
<i class="ri-arrow-right-s-line"></i>
|
||
</span>
|
||
{{- end -}}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="flex flex-col justify-end gap-y-6 pr-10 w-40 shrink-0">
|
||
<div class="">
|
||
<div class="font-bold text-sm">
|
||
<i class="ri-database-2-line"></i> Datenbank-ID
|
||
<tool-tip position="right" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "id" }}</div>
|
||
<i class="ri-information-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="whitespace-nowrap tabular-nums">{{ $model.result.Entry.Id }}</div>
|
||
</div>
|
||
</div>
|
||
<div class="flex flex-col justify-end gap-y-6 pr-4 w-48 shrink-0">
|
||
<div class="">
|
||
<div class="font-bold text-sm mb-1"><i class="ri-calendar-line"></i> Zuletzt bearbeitet</div>
|
||
<div>
|
||
<div class="px-1.5 py-0.5 rounded-xs bg-gray-200 w-fit whitespace-nowrap tabular-nums" id="almanach-updated-stamp">
|
||
<span id="almanach-updated-date">{{ GermanDate $model.result.Entry.Updated }}</span>,
|
||
<span id="almanach-updated-time">{{ GermanTime $model.result.Entry.Updated }}</span>h
|
||
</div>
|
||
<div
|
||
class="px-1.5 py-0.5 rounded-xs mt-1.5 bg-gray-200 w-fit {{ if not $model.result.User }}hidden{{ end }}"
|
||
id="almanach-updated-user">
|
||
<i class="ri-user-line mr-1"></i>
|
||
<span id="almanach-updated-user-name">{{- if $model.result.User -}}{{ $model.result.User.Name }}{{- end -}}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{{- end -}}
|
||
</div>
|
||
</div>
|
||
|
||
<div class="container-normal mx-auto mt-4 !px-0">
|
||
{{/* usermessage moved into action bar */}}
|
||
<form
|
||
autocomplete="off"
|
||
class="w-full dbform form-with-action-bar"
|
||
id="changealmanachform"
|
||
x-target="changealmanachform user-message almanach-header-data"
|
||
hx-boost="false"
|
||
method="POST"
|
||
data-save-endpoint="{{ if $model.is_new }}/almanach-new/save{{ else }}/almanach/{{ $model.result.Entry.MusenalmID }}/edit/save{{ end }}"
|
||
{{- if not $model.is_new -}}
|
||
data-delete-endpoint="/almanach/{{ $model.result.Entry.MusenalmID }}/edit/delete"
|
||
{{- end -}}>
|
||
<input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" />
|
||
<input type="hidden" name="last_edited" value="{{ if not $model.is_new }}{{ $model.result.Entry.Updated }}{{ end }}" />
|
||
|
||
<div class="flex gap-8">
|
||
<!-- Left Column -->
|
||
<div class="flex-1 flex flex-col gap-2">
|
||
<!-- Kurztitel -->
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="preferred-title-field-input" class="inputlabel">Kurztitel</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "preferred_title" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
</div>
|
||
<lookup-field
|
||
id="preferred-title-field"
|
||
name="preferred_title"
|
||
data-multiline="true"
|
||
data-no-enter="true"
|
||
data-required="true"
|
||
data-autocomplete="false"
|
||
data-valid-fn="lookupRequiredText"
|
||
data-dup-endpoint="/api/entries/search"
|
||
data-dup-result-key="entries"
|
||
data-dup-current-id="{{ if not $model.is_new }}{{ $model.result.Entry.Id }}{{ end }}"
|
||
value="{{- $model.result.Entry.PreferredTitle -}}">
|
||
</lookup-field>
|
||
</div>
|
||
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="preferred-series-field-input" class="inputlabel">Reihentitel</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ helpOr "entries" "series" "Bevorzugter Reihentitel für diesen Almanach." }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="flex items-center gap-3 ml-auto pr-2">
|
||
<a href="/reihen/new/" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline" target="_blank" rel="noreferrer">
|
||
<i class="ri-add-line"></i> Neue Reihe anlegen
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<lookup-field
|
||
id="preferred-series-field"
|
||
name="preferred_series_id"
|
||
data-value-name="preferred_series_id"
|
||
data-text-name=""
|
||
data-valid-fn="lookupRequiredId"
|
||
data-endpoint="/api/series/search"
|
||
data-result-key="series"
|
||
data-minchars="1"
|
||
data-limit="15"
|
||
data-link-fn="lookupSeriesLink"
|
||
data-value-fn="lookupSeriesValue"
|
||
data-required="true"
|
||
data-initial-id="{{ $preferredSeriesId }}"
|
||
data-initial-name="{{ $preferredSeriesTitle }}"
|
||
data-initial-musenalm-id="{{ $preferredSeriesMusenalmID }}"
|
||
data-preferred-relation-id="{{ $preferredRelationId }}"
|
||
data-preferred-series-id="{{ $preferredSeriesId }}">
|
||
</lookup-field>
|
||
</div>
|
||
|
||
<div class="mt-3">
|
||
<div class="flex items-center justify-between gap-2">
|
||
<div class="flex items-center gap-2 text-lg font-bold text-gray-700">
|
||
<i class="ri-book-2-line"></i>
|
||
<span>Titeldaten & Anmerkungen</span>
|
||
</div>
|
||
<div-manager dm-target="publication" class="flex items-center">
|
||
<button class="dm-menu-button text-right cursor-pointer whitespace-nowrap"><i class="ri-add-line"></i>
|
||
Felder hinzufügen</button>
|
||
|
||
<div class="inputwrapper {{ if eq $model.result.Entry.TitleStmt "" }}hidden{{ end }}" data-dm-target="titles">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="title" class="inputlabel menu-label">Titel</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "title_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="title" id="title" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.TitleStmt -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-2 inputwrapper {{ if eq $model.result.Entry.ParallelTitle "" }}hidden{{ end }}" data-dm-target="titles">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="paralleltitle" class="inputlabel menu-label">Titel
|
||
(übersetzt)</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "parallel_title" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="paralleltitle" id="paralleltitle" class="inputinput" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.ParallelTitle -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.SubtitleStmt "" }}hidden{{ end }}" data-dm-target="titles">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="subtitle" class="inputlabel menu-label">Untertitel</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "subtitle_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="subtitle" id="subtitle" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.SubtitleStmt -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.VariantTitle "" }}hidden{{ end }}" data-dm-target="titles">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="varianttitle" class="inputlabel menu-label">Titelvarianten</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "variant_title" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="varianttitle" id="varianttitle" class="inputinput" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.VariantTitle -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.IncipitStmt "" }}hidden{{ end }}" data-dm-target="titles">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="incipit" class="inputlabel menu-label">Incipit</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "incipit_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="incipit" id="incipit" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.IncipitStmt -}}</textarea>
|
||
</div>
|
||
|
||
<div class="inputwrapper {{ if eq $model.result.Entry.ResponsibilityStmt "" }}hidden{{ end }}" data-dm-target="publication">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="responsibility_statement" class="inputlabel
|
||
menu-label">Herausgeberangabe</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "responsibility_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="responsibility_statement" id="responsibility_statement" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.ResponsibilityStmt -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.PublicationStmt "" }}hidden{{ end }}" data-dm-target="publication">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="publication_statement" class="inputlabel menu-label">Publikationsangabe</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "publication_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="publication_statement" id="publication_statement" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.PublicationStmt -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.PlaceStmt "" }}hidden{{ end }}" data-dm-target="publication">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="place_statement" class="inputlabel menu-label">Ortsangabe</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "place_statement" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="place_statement" id="place_statement" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.PlaceStmt -}}</textarea>
|
||
</div>
|
||
</div-manager>
|
||
</div>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
<div class="flex flex-col gap-4 mt-4">
|
||
<!-- Titles Section -->
|
||
<div id="titles"></div>
|
||
|
||
<!-- Publication Information: Year and Edition - Always visible -->
|
||
<div class="flex gap-2">
|
||
<div class="flex-1 inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="year" class="inputlabel">Jahr</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "year" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
</div>
|
||
<input type="number" name="year" id="year" class="inputinput" placeholder="" autocomplete="off" value="{{ if not $model.is_new }}{{ $model.result.Entry.Year }}{{ end }}" />
|
||
</div>
|
||
|
||
<div class="flex-1 inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="edition" class="inputlabel">Ausgabebezeichnung</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ helpOr "entries" "edition" "Hinweis zur Ausgabe oder Edition." }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
</div>
|
||
<textarea name="edition" id="edition" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.Edition -}}</textarea>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Publication Information: Optional fields -->
|
||
<div id="publication"></div>
|
||
|
||
<!-- Annotationen -->
|
||
{{ template "_annotation_field" (Arr $model.result.Entry.Annotation "Annotationen") }}
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-3">
|
||
<div class="flex items-center gap-2 text-lg font-bold text-gray-700">
|
||
<i class="ri-links-line"></i>
|
||
<span>Normdaten & Verknüpfungen</span>
|
||
</div>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
<div class="mt-3">
|
||
<relations-editor data-prefix="entries_series" data-link-base="/reihe/" data-new-label="(Neu)" data-add-toggle-id="series-add-toggle" data-preferred-label="Bevorzugter Reihentitel">
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label class="inputlabel" for="series-section">Reihen</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ helpOr "entries" "series" "Verknüpfte Reihen für diesen Almanach." }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="flex items-center gap-3">
|
||
<a href="/reihen/new/" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline" target="_blank" rel="noreferrer">
|
||
<i class="ri-add-line"></i> Neue Reihe anlegen
|
||
</a>
|
||
<button type="button" id="series-add-toggle" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline pr-3">
|
||
<i class="ri-link"></i> Reihe verlinken
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div id="series-section" class="rel-section-container">
|
||
{{- $hasNonPreferredSeries := false -}}
|
||
{{- if $model.result.Series -}}
|
||
{{- range $i, $s := $model.result.Series -}}
|
||
{{- $rel := index $model.result.EntriesSeries $s.Id -}}
|
||
{{- if and $rel (ne $rel.Type "Bevorzugter Reihentitel") -}}
|
||
{{- $hasNonPreferredSeries = true -}}
|
||
<div data-rel-row class="entries-series-row rel-row">
|
||
<div class="rel-grid">
|
||
<div data-rel-strike class="relation-strike rel-name-col">
|
||
<a data-rel-link href="/reihe/{{ $s.MusenalmID }}" class="rel-link" target="_blank" rel="noreferrer">
|
||
<span data-rel-name>{{- $s.Title -}}</span>
|
||
</a>
|
||
{{- if $s.Pseudonyms -}}
|
||
<div data-rel-detail-container class="rel-detail"><span data-rel-detail>{{- $s.Pseudonyms -}}</span></div>
|
||
{{- end -}}
|
||
</div>
|
||
<div data-rel-strike class="relation-strike">
|
||
<select name="entries_series_type[{{ $rel.Id }}]" id="entries_series_type_{{ $rel.Id }}" autocomplete="off" class="inputselect font-bold w-full">
|
||
{{- range $t := $model.series_relations -}}
|
||
{{- if ne $t "Bevorzugter Reihentitel" -}}
|
||
<option value="{{- $t -}}" {{ if eq $rel.Type $t }}selected{{ end }}>{{- $t -}}</option>
|
||
{{- end -}}
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike rel-uncertain-container">
|
||
<input
|
||
type="checkbox"
|
||
name="entries_series_uncertain[{{ $rel.Id }}]"
|
||
id="entries_series_uncertain_{{ $rel.Id }}"
|
||
{{ if $rel.Uncertain }}checked{{ end }} />
|
||
<label for="entries_series_uncertain_{{ $rel.Id }}" class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<button
|
||
type="button"
|
||
class="text-sm"
|
||
data-delete-toggle="entries_series_delete_{{ $rel.Id }}">
|
||
<i class="ri-delete-bin-line mr-1"></i>
|
||
<span class="no-underline" data-delete-label data-delete-default="Entfernen" data-delete-active="Wird entfernt" data-delete-hover="Rückgängig">Entfernen</span>
|
||
</button>
|
||
<input type="checkbox" class="hidden" name="entries_series_delete[{{ $rel.Id }}]" id="entries_series_delete_{{ $rel.Id }}" />
|
||
</div>
|
||
</div>
|
||
<input type="hidden" name="entries_series_id[{{ $rel.Id }}]" value="{{ $rel.Id }}" />
|
||
<input type="hidden" name="entries_series_series[{{ $rel.Id }}]" value="{{ $rel.Series }}" />
|
||
</div>
|
||
{{- end -}}
|
||
{{- end -}}
|
||
{{- end -}}
|
||
{{- if not $hasNonPreferredSeries -}}
|
||
<div class="rel-empty-text">Keine Reihen verknüpft.</div>
|
||
{{- end -}}
|
||
</div>
|
||
<div data-role="relation-add-row" class="flex flex-col gap-2 mt-2 px-2"></div>
|
||
<div data-role="relation-add-panel" class="mt-2 px-2 hidden">
|
||
<div class="rel-row">
|
||
<div class="rel-grid">
|
||
<div class="min-w-0">
|
||
<label for="series-add-select" class="sr-only">Reihe suchen</label>
|
||
<single-select-remote
|
||
id="series-add-select"
|
||
data-role="relation-add-select"
|
||
name="entries_series_new_id"
|
||
placeholder="Reihe suchen..."
|
||
data-endpoint="/api/series/search"
|
||
data-result-key="series"
|
||
data-minchars="1"
|
||
data-limit="15">
|
||
</single-select-remote>
|
||
</div>
|
||
<div>
|
||
<label for="entries_series_new_type" class="sr-only">Beziehung</label>
|
||
<select data-role="relation-type-select" name="entries_series_new_type" id="entries_series_new_type" autocomplete="off" class="inputselect font-bold w-full">
|
||
{{- range $t := $model.series_relations -}}
|
||
{{- if ne $t "Bevorzugter Reihentitel" -}}
|
||
<option value="{{- $t -}}">{{- $t -}}</option>
|
||
{{- end -}}
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div class="rel-uncertain-container">
|
||
<input data-role="relation-uncertain" type="checkbox" name="entries_series_new_uncertain" id="entries_series_new_uncertain" />
|
||
<label for="entries_series_new_uncertain" class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<div class="flex items-center gap-3 text-lg">
|
||
<button type="button" data-role="relation-add-apply" class="text-gray-700 hover:text-gray-900" id="series-add-apply" aria-label="Reihe hinzufügen">
|
||
<i class="ri-check-line"></i>
|
||
</button>
|
||
<button type="button" data-role="relation-add-close" class="text-gray-700 hover:text-gray-900" id="series-add-close" aria-label="Ausblenden">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div data-role="relation-add-error" class="text-xs text-red-700 mt-2 hidden" data-error-empty="Bitte Reihe auswählen." data-error-duplicate="Diese Reihe ist bereits verknüpft.">Bitte Reihe auswählen.</div>
|
||
</div>
|
||
</div>
|
||
<template data-role="relation-new-template">
|
||
<div data-rel-row class="rel-row">
|
||
<div class="rel-grid">
|
||
<div data-rel-strike class="relation-strike rel-name-col">
|
||
<div class="text-base text-gray-800 truncate">
|
||
<a data-rel-link class="no-underline hover:text-slate-900">
|
||
<span data-rel-name></span>
|
||
</a>
|
||
<em data-rel-new class="rel-new-badge"></em>
|
||
</div>
|
||
<div data-rel-detail-container class="rel-detail"><span data-rel-detail></span></div>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike">
|
||
<select data-rel-input="type" class="inputselect font-bold w-full"></select>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike rel-uncertain-container">
|
||
<input data-rel-input="uncertain" type="checkbox" />
|
||
<label data-rel-uncertain-label class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<button type="button" class="text-sm text-red-700 hover:text-red-900" data-role="relation-new-delete">
|
||
<i class="ri-delete-bin-line mr-1"></i> Entfernen
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<input type="hidden" data-rel-input="id" />
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</relations-editor>
|
||
</div>
|
||
|
||
<div class="mt-3">
|
||
<relations-editor data-prefix="entries_agents" data-link-base="/person/" data-new-label="(Neu)" data-add-toggle-id="agents-add-toggle">
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label class="inputlabel" for="agents-section">Personen & Körperschaften</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ helpOr "entries" "agents" "Beteiligte Personen oder Körperschaften." }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="flex items-center gap-3">
|
||
<a href="/personen/new/" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline" target="_blank" rel="noreferrer">
|
||
<i class="ri-add-line"></i> Neue Person/Körperschaft anlegen
|
||
</a>
|
||
<button type="button" id="agents-add-toggle" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline pr-3">
|
||
<i class="ri-link"></i> Person verlinken
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div id="agents-section" class="rel-section-container">
|
||
{{- if $model.result.EntriesAgents -}}
|
||
{{- range $i, $r := $model.result.EntriesAgents -}}
|
||
{{- $a := index $model.result.Agents $r.Agent -}}
|
||
<div data-rel-row class="entries-agent-row rel-row">
|
||
<div class="rel-grid">
|
||
<div data-rel-strike class="relation-strike rel-name-col">
|
||
{{- if $a -}}
|
||
<a data-rel-link href="/person/{{ $a.Id }}" class="rel-link" target="_blank" rel="noreferrer">
|
||
<span data-rel-name>{{- $a.Name -}}</span>
|
||
</a>
|
||
{{- if $a.BiographicalData -}}
|
||
<div data-rel-detail-container class="rel-detail"><span data-rel-detail>{{- $a.BiographicalData -}}</span></div>
|
||
{{- end -}}
|
||
{{- else -}}
|
||
<div class="text-base text-gray-800">Unbekannte Person</div>
|
||
{{- end -}}
|
||
</div>
|
||
<div data-rel-strike class="relation-strike">
|
||
<select name="entries_agents_type[{{ $r.Id }}]" id="entries_agents_type_{{ $r.Id }}" autocomplete="off" class="inputselect font-bold w-full">
|
||
{{- range $t := $model.agent_relations -}}
|
||
<option value="{{- $t -}}" {{ if eq $r.Type $t }}selected{{ end }}>{{- $t -}}</option>
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike rel-uncertain-container">
|
||
<input
|
||
type="checkbox"
|
||
name="entries_agents_uncertain[{{ $r.Id }}]"
|
||
id="entries_agents_uncertain_{{ $r.Id }}"
|
||
{{ if $r.Uncertain }}checked{{ end }} />
|
||
<label for="entries_agents_uncertain_{{ $r.Id }}" class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<button
|
||
type="button"
|
||
class="text-sm"
|
||
data-delete-toggle="entries_agents_delete_{{ $r.Id }}">
|
||
<i class="ri-delete-bin-line mr-1"></i>
|
||
<span class="no-underline" data-delete-label data-delete-default="Entfernen" data-delete-active="Wird entfernt" data-delete-hover="Rückgängig">Entfernen</span>
|
||
</button>
|
||
<input type="checkbox" class="hidden" name="entries_agents_delete[{{ $r.Id }}]" id="entries_agents_delete_{{ $r.Id }}" />
|
||
</div>
|
||
</div>
|
||
<input type="hidden" name="entries_agents_id[{{ $r.Id }}]" value="{{ $r.Id }}" />
|
||
<input type="hidden" name="entries_agents_agent[{{ $r.Id }}]" value="{{ $r.Agent }}" />
|
||
</div>
|
||
{{- end -}}
|
||
{{- else -}}
|
||
<div class="rel-empty-text">Keine Personen verknüpft.</div>
|
||
{{- end -}}
|
||
</div>
|
||
<div data-role="relation-add-row" class="flex flex-col gap-2 mt-2 px-2"></div>
|
||
<div data-role="relation-add-panel" class="mt-2 px-2 hidden">
|
||
<div class="rel-row">
|
||
<div class="rel-grid">
|
||
<div class="min-w-0">
|
||
<label for="agents-add-select" class="sr-only">Akteur suchen</label>
|
||
<single-select-remote
|
||
id="agents-add-select"
|
||
data-role="relation-add-select"
|
||
name="entries_agents_new_id"
|
||
placeholder="Akteur suchen..."
|
||
data-endpoint="/api/agents/search"
|
||
data-result-key="agents"
|
||
data-minchars="1"
|
||
data-limit="15">
|
||
</single-select-remote>
|
||
</div>
|
||
<div>
|
||
<label for="entries_agents_new_type" class="sr-only">Beziehung</label>
|
||
<select data-role="relation-type-select" name="entries_agents_new_type" id="entries_agents_new_type" autocomplete="off" class="inputselect font-bold w-full">
|
||
{{- range $t := $model.agent_relations -}}
|
||
<option value="{{- $t -}}" {{ if eq $t "Herausgeber:in" }}selected{{ end }}>{{- $t -}}</option>
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div class="rel-uncertain-container">
|
||
<input data-role="relation-uncertain" type="checkbox" name="entries_agents_new_uncertain" id="entries_agents_new_uncertain" />
|
||
<label for="entries_agents_new_uncertain" class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<div class="flex items-center gap-3 text-lg">
|
||
<button type="button" data-role="relation-add-apply" class="text-gray-700
|
||
hover:text-gray-900" id="agents-add-apply" aria-label="Person hinzufügen">
|
||
<i class="ri-check-line"></i>
|
||
</button>
|
||
<button type="button" data-role="relation-add-close" class="text-gray-700 hover:text-gray-900" id="agents-add-close" aria-label="Ausblenden">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div data-role="relation-add-error" class="text-xs text-red-700 mt-2 hidden" data-error-empty="Bitte Akteur auswählen.">Bitte Akteur auswählen.</div>
|
||
</div>
|
||
</div>
|
||
<template data-role="relation-new-template">
|
||
<div data-rel-row class="rel-row">
|
||
<div class="rel-grid">
|
||
<div data-rel-strike class="relation-strike rel-name-col">
|
||
<div class="text-base text-gray-800 truncate">
|
||
<a data-rel-link class="no-underline hover:text-slate-900">
|
||
<span data-rel-name></span>
|
||
</a>
|
||
<em data-rel-new class="rel-new-badge"></em>
|
||
</div>
|
||
<div data-rel-detail-container class="rel-detail"><span data-rel-detail></span></div>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike">
|
||
<select data-rel-input="type" class="inputselect font-bold w-full"></select>
|
||
</div>
|
||
<div data-rel-strike class="relation-strike rel-uncertain-container">
|
||
<input data-rel-input="uncertain" type="checkbox" />
|
||
<label data-rel-uncertain-label class="rel-uncertain-label">Unsicher</label>
|
||
</div>
|
||
<div class="rel-button-container">
|
||
<button type="button" class="text-sm text-red-700 hover:text-red-900" data-role="relation-new-delete">
|
||
<i class="ri-delete-bin-line mr-1"></i> Entfernen
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<input type="hidden" data-rel-input="id" />
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</relations-editor>
|
||
</div>
|
||
|
||
<div class="flex flex-col gap-2 mt-4">
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="places" class="inputlabel">Erscheinungs- und Verlagsorte</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "places" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="flex items-center gap-3">
|
||
<a href="/orte/new/" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline" target="_blank" rel="noreferrer">
|
||
<i class="ri-add-line"></i> Neuen Ort anlegen
|
||
</a>
|
||
<button type="button" id="places-add-toggle" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline pr-3">
|
||
<i class="ri-link"></i> Ort verlinken
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="px-2">
|
||
<multi-select-simple
|
||
id="places"
|
||
name="places[]"
|
||
data-external-toggle-id="places-add-toggle"
|
||
value='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}"{{ $place.Id }}"{{- end -}}]'
|
||
placeholder="Orte suchen..."
|
||
data-toggle-label='<i class="ri-add-circle-line"></i>'
|
||
data-empty-text="Keine Orte verknüpft"
|
||
show-create-button="false"
|
||
data-endpoint="/api/places/search"
|
||
data-result-key="places"
|
||
data-minchars="1"
|
||
data-limit="15"
|
||
data-initial-options='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "{\"id\":%q,\"name\":%q,\"additional_data\":%q}" $place.Id $place.Name $place.Pseudonyms }}{{- end -}}]'
|
||
data-initial-values='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "%q" $place.Id }}{{- end -}}]'>
|
||
</multi-select-simple>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<!-- End Left Column -->
|
||
|
||
<!-- Right Column -->
|
||
<div class="w-[28rem] shrink-0 flex flex-col gap-3">
|
||
<div>
|
||
{{ template "_status_edit" (Arr $model.result.Entry "type" "type" "entries" "almanach") }}
|
||
</div>
|
||
|
||
<div>
|
||
<div class="flex items-center justify-between gap-4">
|
||
<div class="flex items-center gap-2 text-lg font-bold text-gray-700">
|
||
<i class="ri-information-line"></i>
|
||
<span>Metadaten</span>
|
||
</div>
|
||
<div-manager dm-target="physical" class="flex items-center">
|
||
<button class="dm-menu-button text-right w-full cursor-pointer"><i class="ri-add-line"></i>
|
||
Physische Beschreibung hinzufügen</button>
|
||
|
||
<div class="inputwrapper {{ if eq $model.result.Entry.Extent "" }}hidden{{ end }}">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="extent" class="inputlabel menu-label">Struktur/Umfang</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "extent" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="extent" id="extent" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.Extent -}}</textarea>
|
||
</div>
|
||
|
||
<div class="mt-3 inputwrapper {{ if eq $model.result.Entry.Dimensions "" }}hidden{{ end }}">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="dimensions" class="inputlabel menu-label">Maße</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "dimensions" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<div class="pr-2">
|
||
<button class="dm-close-button font-bold input-label">
|
||
<i class="ri-close-line"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<textarea name="dimensions" id="dimensions" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.Dimensions -}}</textarea>
|
||
</div>
|
||
</div-manager>
|
||
</div>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
<div class="flex flex-col gap-4 mt-4">
|
||
<!-- Languages -->
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="languages" class="inputlabel">Sprachen</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "language" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
<button type="button" id="languages-add-toggle" class="text-sm font-bold text-gray-700 hover:text-slate-950 no-underline pr-3">
|
||
<i class="ri-link"></i> Sprache verlinken
|
||
</button>
|
||
</div>
|
||
<div class="px-2">
|
||
<multi-select-simple
|
||
id="languages"
|
||
name="languages[]"
|
||
show-create-button="false"
|
||
placeholder="Sprachen suchen..."
|
||
data-toggle-label='<i class="ri-add-circle-line"></i>'
|
||
data-empty-text="Keine Sprachen verknüpft"
|
||
data-external-toggle-id="languages-add-toggle"
|
||
value='[{{- range $i, $lang := $model.result.Entry.Language -}}{{- if $i }},{{ end -}}"{{ $lang }}"{{- end -}}]'></multi-select-simple>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Nachweise - Always visible -->
|
||
<div class="inputwrapper">
|
||
<div class="inputlabelrow">
|
||
<div class="flex items-center gap-1">
|
||
<label for="refs" class="inputlabel">Nachweise</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "entries" "refs" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
</div>
|
||
</div>
|
||
<textarea name="refs" id="refs" class="inputinput no-enter" placeholder="" autocomplete="off" rows="1">{{- $model.result.Entry.References -}}</textarea>
|
||
</div>
|
||
|
||
<!-- Physical Description -->
|
||
<div id="physical"></div>
|
||
</div>
|
||
</div>
|
||
{{- $deprecated := $model.result.Entry.Deprecated -}}
|
||
{{- if or $deprecated.Reihentitel $deprecated.Norm (gt $deprecated.BiblioID 0) $deprecated.Status $deprecated.Gesichtet $deprecated.Erfasst -}}
|
||
<details class="mt-4">
|
||
<summary class="flex items-center gap-2 text-lg font-bold text-stone-700 cursor-pointer select-none rounded-xs py-1 hover:bg-stone-50 hover:text-stone-900">
|
||
<i class="ri-history-line"></i>
|
||
<span>Abgekündigte Access-DB-Felder</span>
|
||
<i class="ri-arrow-down-s-line text-base legacy-toggle-icon"></i>
|
||
</summary>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
<div class="text-xs leading-relaxed font-mono bg-slate-50 text-gray-600 border border-slate-200 rounded-xs px-3 py-2">
|
||
<div class="grid grid-cols-[7.5rem_1fr] gap-x-3 gap-y-1">
|
||
{{- if $deprecated.Reihentitel -}}
|
||
<div class="text-gray-500">Reihentitel</div>
|
||
<div>{{ $deprecated.Reihentitel }}</div>
|
||
{{- end -}}
|
||
{{- if $deprecated.Norm -}}
|
||
<div class="text-gray-500">Norm</div>
|
||
<div>{{ $deprecated.Norm }}</div>
|
||
{{- end -}}
|
||
{{- if gt $deprecated.BiblioID 0 -}}
|
||
<div class="text-gray-500">Biblio-ID</div>
|
||
<div>{{ $deprecated.BiblioID }}</div>
|
||
{{- end -}}
|
||
{{- if $deprecated.Status -}}
|
||
<div class="text-gray-500">Status</div>
|
||
<div>{{- range $i, $s := $deprecated.Status -}}{{- if $i }}, {{ end -}}{{- $s -}}{{- end -}}</div>
|
||
{{- end -}}
|
||
<div class="text-gray-500">Gesichtet</div>
|
||
<div>{{ if $deprecated.Gesichtet }}Ja{{ else }}Nein{{ end }}</div>
|
||
<div class="text-gray-500">Erfasst</div>
|
||
<div>{{ if $deprecated.Erfasst }}Ja{{ else }}Nein{{ end }}</div>
|
||
</div>
|
||
</div>
|
||
</details>
|
||
{{- end -}}
|
||
<details class="mt-4">
|
||
<summary class="flex items-center gap-2 text-lg font-bold text-stone-700 cursor-pointer select-none rounded-xs py-1 hover:bg-stone-50 hover:text-stone-900">
|
||
<i class="ri-article-line"></i>
|
||
<span>Beiträge</span>
|
||
<span class="text-xs bg-stone-200 text-gray-800 px-2 py-0.5 rounded-sm">{{ len $model.result.Contents }}</span>
|
||
<i class="ri-arrow-down-s-line text-base legacy-toggle-icon"></i>
|
||
</summary>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
<div class="text-sm text-gray-800 max-h-96 overflow-auto pr-1 pl-0 ml-0">
|
||
{{- if $model.result.Contents -}}
|
||
<ul class="flex flex-col pl-0 pr-0 m-0 ml-0 list-none">
|
||
{{- range $content := $model.result.Contents -}}
|
||
<li class="flex flex-col gap-1 ml-0 p-1 odd:bg-stone-100 px-1">
|
||
<div class="flex items-baseline justify-between gap-3">
|
||
<a href="/beitrag/{{ $content.MusenalmID }}" class="no-underline hover:text-slate-900 font-semibold">
|
||
{{- if $content.PreferredTitle -}}
|
||
{{- $content.PreferredTitle -}}
|
||
{{- else if $content.TitleStmt -}}
|
||
<span class="italic font-normal">{{ $content.TitleStmt }}</span>
|
||
{{- end -}}
|
||
</a>
|
||
<span class="flex items-center gap-2 text-xs text-gray-500 whitespace-nowrap">
|
||
<span class="inline-flex min-w-[4ch] justify-end text-slate-700">
|
||
{{- if $content.Extent -}}S. {{- $content.Extent -}}{{- else -}} {{- end -}}
|
||
</span>
|
||
<tool-tip position="top" class="inline">
|
||
<a
|
||
href="/almanach/{{ $model.result.Entry.MusenalmID }}/contents/{{ $content.MusenalmID }}/edit/"
|
||
class="no-underline inline-flex items-center text-slate-600 hover:text-slate-900"
|
||
aria-label="Beitrag bearbeiten">
|
||
<i class="ri-edit-line"></i>
|
||
</a>
|
||
<div class="data-tip">Bearbeiten</div>
|
||
</tool-tip>
|
||
<tool-tip position="top" class="inline">
|
||
<button
|
||
type="button"
|
||
data-role="content-delete"
|
||
data-entry-id="{{ $model.result.Entry.MusenalmID }}"
|
||
data-content-id="{{ $content.MusenalmID }}"
|
||
data-content-title="{{- if $content.PreferredTitle -}}{{ $content.PreferredTitle }}{{- else -}}Inhalt #{{ $content.MusenalmID }}{{- end -}}"
|
||
data-delete-endpoint="/almanach/{{ $model.result.Entry.MusenalmID }}/contents/delete"
|
||
class="inline-flex items-center text-red-700 hover:text-red-900"
|
||
aria-label="Beitrag löschen">
|
||
<i class="ri-delete-bin-line"></i>
|
||
</button>
|
||
<div class="data-tip">Löschen</div>
|
||
</tool-tip>
|
||
</span>
|
||
</div>
|
||
<div class="text-xs text-gray-800"></div>
|
||
</li>
|
||
{{- end -}}
|
||
</ul>
|
||
{{- else -}}
|
||
<div class="italic text-gray-500">Keine Beiträge verknüpft.</div>
|
||
{{- end -}}
|
||
</div>
|
||
</details>
|
||
<!-- Exemplare -->
|
||
<div class="">
|
||
<items-editor class="block mt-4">
|
||
<div class="flex items-center justify-between gap-4">
|
||
<div class="flex items-center gap-2 text-lg font-bold text-gray-700">
|
||
<i class="ri-archive-line"></i>
|
||
<span>Exemplare</span>
|
||
</div>
|
||
<button type="button" class="items-add-button text-gray-700 hover:text-gray-900">
|
||
<i class="ri-add-line"></i> Exemplar hinzufügen
|
||
</button>
|
||
</div>
|
||
<hr class="border-slate-400 mt-2 mb-3" />
|
||
|
||
<div class="items-list flex flex-col gap-3">
|
||
{{- range $i, $item := $model.result.Items -}}
|
||
<div class="items-row border border-stone-200 rounded-xs bg-stone-50 flex flex-col gap-3 shadow-sm" data-item-id="{{ $item.Id }}">
|
||
<input type="hidden" name="items_id[]" value="{{ $item.Id }}" />
|
||
<div class="items-summary flex flex-col gap-2">
|
||
<div class="flex items-center justify-between bg-stone-100 px-3 py-2 rounded-xs">
|
||
<div class="text-base font-bold" data-summary-container>
|
||
<span data-items-strike data-summary-field="owner" data-summary-hide-empty="true">{{ $item.Owner }}</span>
|
||
<span data-new-badge class="items-new-badge hidden text-sm text-gray-600 ml-1">(Neu)</span>
|
||
</div>
|
||
<div class="px-2 py-0.5 bg-stone-200 text-sm font-bold rounded-sm" data-summary-container>
|
||
<span data-items-strike data-summary-field="identifier" data-summary-hide-empty="true">{{ $item.Identifier }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4 px-3
|
||
py-1">
|
||
<div class="text-sm text-gray-700">
|
||
<div class="flex flex-col gap-1 text-base">
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Standort</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="location" data-summary-hide-empty="true">{{ $item.Location }}</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Vorhanden als</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="media" data-summary-hide-empty="true">
|
||
{{- range $j, $m := $item.Media -}}{{- if $j -}}, {{- end -}}{{- $m -}}{{- end -}}
|
||
</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">URL</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="uri" data-summary-hide-empty="true">
|
||
<a class="no-underline" data-summary-link href="{{ $item.Uri }}" target="_blank" rel="noopener">{{ $item.Uri }}</a>
|
||
</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Annotationen</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="annotation" data-summary-hide-empty="true">{{ $item.Annotation }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="flex justify-end mt-2 px-3">
|
||
<div class="flex flex-row gap-3 text-lg">
|
||
<button type="button" class="items-edit-button text-gray-700 hover:text-gray-900" aria-label="Bearbeiten">
|
||
<i class="ri-edit-line"></i>
|
||
</button>
|
||
<button type="button" class="items-remove-button" aria-label="Entfernen">
|
||
<i class="ri-delete-bin-line"></i>
|
||
<span class="ml-1 text-sm no-underline" data-delete-label data-delete-default="Entfernen" data-delete-active="Wird entfernt" data-delete-hover="Rückgängig">Entfernen</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="items-edit-panel hidden">
|
||
<!-- This gets used when editing an item -->
|
||
<div class="flex flex-col gap-3 mt-3">
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="owner">Besitzer</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "owner" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="owner" name="items_owner[]" autocomplete="off" value="{{ $item.Owner }}" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="identifier">Signatur</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "identifier" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="identifier" name="items_identifier[]" autocomplete="off" value="{{ $item.Identifier }}" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="location">Standort</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "location" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="location" name="items_location[]" autocomplete="off" value="{{ $item.Location }}" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="media">Vorhanden als</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "media" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<select class="inputselect" data-items-strike data-field="media" name="items_media[]" autocomplete="off" required>
|
||
{{- range $t := $model.item_types -}}
|
||
<option value="{{- $t -}}" {{ if Contains $item.Media $t }}selected{{ end }}>{{- $t -}}</option>
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="annotation">Annotationen</label>
|
||
<textarea class="inputtextarea min-h-[8rem]" data-items-strike data-field="annotation" name="items_annotation[]" autocomplete="off">{{- $item.Annotation -}}</textarea>
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="uri">URI</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "uri" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="uri" name="items_uri[]" autocomplete="off" value="{{ $item.Uri }}" />
|
||
</div>
|
||
</div>
|
||
<div class="flex justify-end gap-3 mt-3 px-3 py-2">
|
||
<button type="button" class="items-close-button resetbutton w-auto px-2 py-1 text-base">
|
||
<i class="ri-check-line mr-2"></i> Fertig
|
||
</button>
|
||
<button type="button" class="items-cancel-button resetbutton w-auto px-2 py-1 text-base">
|
||
<i class="ri-close-line mr-2"></i> Abbrechen
|
||
</button>
|
||
<button type="button" class="items-remove-button resetbutton w-auto px-2 py-1 text-base">
|
||
<i class="ri-delete-bin-line mr-2"></i>
|
||
<span class="no-underline" data-delete-label data-delete-default="Entfernen" data-delete-active="Wird entfernt" data-delete-hover="Rückgängig">Entfernen</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{{- end -}}
|
||
</div>
|
||
<template class="items-template">
|
||
<!-- This gets used when adding an item -->
|
||
<div class="items-row border border-stone-200 rounded-xs bg-stone-50 flex flex-col gap-3 shadow-sm">
|
||
<input type="hidden" name="items_id[]" value="" />
|
||
<div class="items-summary hidden flex flex-col gap-2">
|
||
<div class="flex items-center justify-between bg-stone-100 px-3 py-2 rounded-xs">
|
||
<div class="text-base font-bold" data-summary-container>
|
||
<span data-items-strike data-summary-field="owner" data-summary-hide-empty="true">—</span>
|
||
<span data-new-badge class="items-new-badge hidden text-sm text-gray-600 ml-1">(Neu)</span>
|
||
</div>
|
||
<div class="px-2 py-0.5 bg-stone-200 text-sm font-bold rounded-sm" data-summary-container>
|
||
<span data-items-strike data-summary-field="identifier" data-summary-hide-empty="true">—</span>
|
||
</div>
|
||
</div>
|
||
<div class="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4 px-3 py-1">
|
||
<div class="text-sm text-gray-700">
|
||
<div class="flex flex-col gap-1 text-base">
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Standort</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="location" data-summary-hide-empty="true">—</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Vorh. als</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="media" data-summary-hide-empty="true">—</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">URL</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="uri" data-summary-hide-empty="true">
|
||
<a class="no-underline" data-summary-link href="#" target="_blank" rel="noopener">—</a>
|
||
</span>
|
||
</div>
|
||
<div class="grid grid-cols-[6rem_1fr] gap-x-4 items-baseline" data-summary-container>
|
||
<span class="text-xs uppercase tracking-wide text-gray-500">Annotationen</span>
|
||
<span class="items-summary-value" data-items-strike data-summary-field="annotation" data-summary-hide-empty="true">—</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="flex justify-end mt-2 px-3">
|
||
<div class="flex flex-row gap-3 text-lg">
|
||
<button type="button" class="items-edit-button text-gray-700 hover:text-gray-900" aria-label="Bearbeiten">
|
||
<i class="ri-edit-line"></i>
|
||
</button>
|
||
<button type="button" class="items-remove-button" aria-label="Entfernen">
|
||
<i class="ri-delete-bin-line"></i>
|
||
<span class="ml-1 text-sm no-underline" data-delete-label data-delete-default="Entfernen" data-delete-active="Wird entfernt" data-delete-hover="Rückgängig">Entfernen</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="items-edit-panel">
|
||
<div class="flex flex-col gap-3 mt-3">
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="owner">Besitzer</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "owner" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="owner" name="items_owner[]" autocomplete="off" value="" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="identifier">Signatur</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "identifier" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="identifier" name="items_identifier[]" autocomplete="off" value="" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="location">Standort</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "location" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="location" name="items_location[]" autocomplete="off" value="" />
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="media">Vorhanden als</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "media" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<select class="inputselect" data-items-strike data-field="media" name="items_media[]" autocomplete="off" required>
|
||
{{- range $t := $model.item_types -}}
|
||
<option value="{{- $t -}}">{{- $t -}}</option>
|
||
{{- end -}}
|
||
</select>
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="annotation">Annotationen</label>
|
||
<textarea class="inputtextarea min-h-[8rem]" data-items-strike data-field="annotation" name="items_annotation[]" autocomplete="off"></textarea>
|
||
</div>
|
||
<div class="inputwrapper">
|
||
<label class="inputlabel" data-field-label="uri">URI</label>
|
||
<tool-tip position="top" class="!inline">
|
||
<div class="data-tip">{{ help "items" "uri" }}</div>
|
||
<i class="ri-question-line"></i>
|
||
</tool-tip>
|
||
<input class="inputinput" data-items-strike data-field="uri" name="items_uri[]" autocomplete="off" value="" />
|
||
</div>
|
||
</div>
|
||
<div class="flex justify-end gap-3 mt-3 px-3 py-1">
|
||
<button type="button" class="items-close-button resetbutton w-auto px-2 py-1 text-base">
|
||
<i class="ri-check-line mr-2"></i> Fertig
|
||
</button>
|
||
<button type="button" class="items-cancel-button resetbutton w-auto px-2 py-1 text-base">
|
||
<i class="ri-close-line mr-2"></i> Abbrechen
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
|
||
</items-editor>
|
||
</div>
|
||
</div>
|
||
<!-- End Right Column -->
|
||
</div>
|
||
<div class="form-action-bar">
|
||
<div class="form-action-bar-inner">
|
||
<div id="user-message" class="form-action-bar-message">
|
||
<p
|
||
id="almanach-save-feedback"
|
||
class="save-feedback {{ if $model.error }}save-feedback-error text-red-700{{ else if $model.success }}save-feedback-success text-green-700{{ else }}hidden{{ end }}"
|
||
{{ if $model.success }}data-autohide="true"{{ end }}
|
||
aria-live="polite">
|
||
{{- if $model.error -}}
|
||
{{ $model.error }}
|
||
{{- else if $model.success -}}
|
||
{{ $model.success }}
|
||
{{- end -}}
|
||
</p>
|
||
</div>
|
||
<div class="form-action-bar-actions">
|
||
<a href="{{ if $model.is_new }}/suche/baende{{ else }}/almanach/{{ $model.result.Entry.MusenalmID }}{{ end }}" class="resetbutton w-40 flex items-center gap-2 justify-center" data-role="cancel-link" data-cancel-url="{{ $model.cancel_url }}">
|
||
<i class="ri-close-line"></i>
|
||
<span>Abbrechen</span>
|
||
</a>
|
||
{{- if not $model.is_new -}}
|
||
<button
|
||
type="button"
|
||
class="resetbutton w-40 flex items-center gap-2 justify-center bg-red-50 text-red-800 hover:bg-red-100 hover:text-red-900"
|
||
data-role="almanach-delete">
|
||
<i class="ri-delete-bin-line"></i>
|
||
<span>Eintrag löschen</span>
|
||
</button>
|
||
{{- end -}}
|
||
{{- if not $model.is_new -}}
|
||
<button type="button" class="submitbutton w-40 flex items-center gap-2 justify-center" data-role="almanach-save">
|
||
<i class="ri-save-line"></i>
|
||
<span>Speichern</span>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="submitbutton flex items-center gap-2 justify-center"
|
||
data-role="almanach-save-view"
|
||
data-redirect-url="/almanach/{{ $model.result.Entry.MusenalmID }}">
|
||
<i class="ri-eye-line"></i>
|
||
<span>Speichern & Anzeigen</span>
|
||
</button>
|
||
{{- end -}}
|
||
{{- if $model.is_new -}}
|
||
<button type="button" class="submitbutton w-40 flex items-center gap-2 justify-center" data-role="almanach-save">
|
||
<i class="ri-save-line"></i>
|
||
<span>Speichern</span>
|
||
</button>
|
||
{{- end -}}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{{- if not $model.is_new -}}
|
||
<dialog data-role="almanach-delete-dialog" class="fixed inset-0 m-auto rounded-md border border-slate-200 p-0 shadow-xl backdrop:bg-black/40">
|
||
<div class="p-5 w-[22rem]">
|
||
<div class="text-base font-bold text-gray-900">Eintrag löschen?</div>
|
||
<div class="text-sm font-bold text-gray-900 mt-1">{{ $model.result.Entry.PreferredTitle }}</div>
|
||
<p class="text-sm text-gray-700 mt-2">
|
||
Der Eintrag wird dauerhaft gelöscht. Verknüpfungen, Exemplare und Beiträge werden entfernt.
|
||
</p>
|
||
<div class="flex items-center justify-end gap-3 mt-4">
|
||
<button type="button" class="resetbutton w-auto px-3 py-1 text-sm" data-role="almanach-delete-cancel">Abbrechen</button>
|
||
<button
|
||
type="button"
|
||
class="submitbutton w-auto bg-red-700 hover:bg-red-800 px-3 py-1 text-sm"
|
||
data-role="almanach-delete-confirm">
|
||
Löschen
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</dialog>
|
||
<dialog data-role="content-delete-dialog" class="dbform fixed inset-0 m-auto rounded-md border border-slate-200 p-0 shadow-xl backdrop:bg-black/40">
|
||
<div class="p-5 w-[26rem]">
|
||
<div class="text-base font-bold text-gray-900">Beitrag löschen?</div>
|
||
<div data-role="content-delete-title" class="text-sm font-bold text-gray-900 mt-1"></div>
|
||
<div data-role="content-delete-error" class="mt-2 text-sm text-red-700 hidden"></div>
|
||
<div class="flex items-center justify-end gap-3 mt-4">
|
||
<button type="button" class="resetbutton w-auto px-3 py-1 text-sm" data-role="content-delete-cancel">Abbrechen</button>
|
||
<button
|
||
type="button"
|
||
class="submitbutton w-auto bg-red-700 hover:bg-red-800 px-3 py-1 text-sm"
|
||
data-role="content-delete-confirm">
|
||
Löschen
|
||
</button>
|
||
</div>
|
||
<input type="hidden" data-role="content-delete-csrf" value="{{ $model.csrf_token }}" />
|
||
</div>
|
||
</dialog>
|
||
<script>
|
||
(() => {
|
||
const dialog = document.querySelector("[data-role='content-delete-dialog']");
|
||
if (!dialog) return;
|
||
const titleEl = dialog.querySelector("[data-role='content-delete-title']");
|
||
const errorEl = dialog.querySelector("[data-role='content-delete-error']");
|
||
const cancelBtn = dialog.querySelector("[data-role='content-delete-cancel']");
|
||
const confirmBtn = dialog.querySelector("[data-role='content-delete-confirm']");
|
||
const csrfInput = dialog.querySelector("[data-role='content-delete-csrf']");
|
||
|
||
let currentContentId = "";
|
||
let currentDeleteEndpoint = "";
|
||
|
||
const closeDialog = (event) => {
|
||
if (event) {
|
||
event.preventDefault();
|
||
}
|
||
if (dialog.open) {
|
||
dialog.close();
|
||
}
|
||
};
|
||
|
||
const openDialog = () => {
|
||
if (typeof dialog.showModal === "function") {
|
||
dialog.showModal();
|
||
}
|
||
};
|
||
|
||
const setError = (message) => {
|
||
if (!errorEl) return;
|
||
if (message) {
|
||
errorEl.textContent = message;
|
||
errorEl.classList.remove("hidden");
|
||
} else {
|
||
errorEl.textContent = "";
|
||
errorEl.classList.add("hidden");
|
||
}
|
||
};
|
||
|
||
const handleDeleteClick = (event) => {
|
||
let button = null;
|
||
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
||
for (const node of path) {
|
||
if (node && node.getAttribute && node.getAttribute("data-role") === "content-delete") {
|
||
button = node;
|
||
break;
|
||
}
|
||
}
|
||
if (!button && event.target && event.target.closest) {
|
||
button = event.target.closest("[data-role='content-delete']");
|
||
}
|
||
if (!button) return;
|
||
event.preventDefault();
|
||
event.stopPropagation();
|
||
|
||
currentContentId = button.getAttribute("data-content-id") || "";
|
||
currentDeleteEndpoint = button.getAttribute("data-delete-endpoint") || "";
|
||
const contentTitle = button.getAttribute("data-content-title") || "";
|
||
|
||
if (titleEl) {
|
||
titleEl.textContent = contentTitle ? contentTitle : "Unbekannter Beitrag";
|
||
}
|
||
setError("");
|
||
openDialog();
|
||
};
|
||
|
||
document.addEventListener("click", handleDeleteClick, true);
|
||
|
||
if (cancelBtn) {
|
||
cancelBtn.addEventListener("click", closeDialog);
|
||
}
|
||
dialog.addEventListener("cancel", closeDialog);
|
||
|
||
if (confirmBtn) {
|
||
confirmBtn.addEventListener("click", async (event) => {
|
||
event.preventDefault();
|
||
if (!currentDeleteEndpoint || !csrfInput || !currentContentId) return;
|
||
setError("");
|
||
const payload = new URLSearchParams();
|
||
payload.set("csrf_token", csrfInput.value || "");
|
||
payload.set("content_id", currentContentId);
|
||
try {
|
||
const response = await fetch(currentDeleteEndpoint, {
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/x-www-form-urlencoded",
|
||
"HX-Request": "true",
|
||
},
|
||
body: payload.toString(),
|
||
});
|
||
if (!response.ok) {
|
||
throw new Error("Löschen fehlgeschlagen.");
|
||
}
|
||
closeDialog();
|
||
if (currentContentId) {
|
||
const items = document.querySelectorAll(`[data-content-id='${CSS.escape(currentContentId)}']`);
|
||
items.forEach((item) => {
|
||
const row = item.closest("li");
|
||
if (row) row.remove();
|
||
});
|
||
}
|
||
} catch (error) {
|
||
setError(error instanceof Error ? error.message : "Löschen fehlgeschlagen.");
|
||
}
|
||
});
|
||
}
|
||
})();
|
||
</script>
|
||
{{- end -}}
|
||
</form>
|
||
</div>
|
||
</almanach-edit-page>
|