diff --git a/controllers/almanach.go b/controllers/almanach.go
index 1292f9b..2dfb38b 100644
--- a/controllers/almanach.go
+++ b/controllers/almanach.go
@@ -64,6 +64,7 @@ type AlmanachResult struct {
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
@@ -109,6 +110,11 @@ func NewAlmanachResult(app core.App, id string, params BeitraegeFilterParameters
return nil, err
}
+ items, err := dbmodels.Items_Entry(app, entry.Id)
+ if err != nil {
+ return nil, err
+ }
+
types := Types_Contents(contents)
hs := HasScans(contents)
@@ -171,6 +177,7 @@ func NewAlmanachResult(app core.App, id string, params BeitraegeFilterParameters
Places: places,
Series: series,
Contents: contents,
+ Items: items,
Agents: agentsMap,
EntriesSeries: srelationsMap,
EntriesAgents: entriesagents,
diff --git a/controllers/almanach_edit.go b/controllers/almanach_edit.go
index 46b2750..ef9f8fe 100644
--- a/controllers/almanach_edit.go
+++ b/controllers/almanach_edit.go
@@ -51,6 +51,7 @@ func (p *AlmanachEditPage) GET(engine *templating.Engine, app core.App) HandleFu
data["result"] = result
data["filters"] = filters
data["csrf_token"] = req.Session().Token
+ data["item_types"] = dbmodels.ITEM_TYPE_VALUES
abbrs, err := pagemodels.GetAbks(app)
if err == nil {
diff --git a/dbmodels/queries.go b/dbmodels/queries.go
index 8640077..fac7685 100644
--- a/dbmodels/queries.go
+++ b/dbmodels/queries.go
@@ -1,6 +1,7 @@
package dbmodels
import (
+ "github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
)
@@ -186,6 +187,17 @@ func Contents_Entry(app core.App, id string) ([]*Content, error) {
)
}
+func Items_Entry(app core.App, id string) ([]*Item, error) {
+ var ret []*Item
+ err := app.RecordQuery(ITEMS_TABLE).
+ Where(dbx.NewExp(
+ ENTRIES_TABLE+" = {:id} OR (json_valid("+ENTRIES_TABLE+") = 1 AND EXISTS (SELECT 1 FROM json_each("+ENTRIES_TABLE+") WHERE value = {:id}))",
+ dbx.Params{"id": id},
+ )).
+ All(&ret)
+ return ret, err
+}
+
func Contents_MusenalmID(app core.App, id string) (*Content, error) {
ret, err := TableByField[Content](app, CONTENTS_TABLE, MUSENALMID_FIELD, id)
return &ret, err
diff --git a/migrations/seed/items.go b/migrations/seed/items.go
index 4adbdb5..e87fccf 100644
--- a/migrations/seed/items.go
+++ b/migrations/seed/items.go
@@ -27,6 +27,7 @@ func ItemsFromBändeAndBIBLIO(
}
for i := 0; i < len(entries.Bände); i++ {
+ bandItems := []*dbmodels.Item{}
band := entries.Bände[i]
banddb, ok := entriesmap[band.ID]
if !ok {
@@ -81,6 +82,7 @@ func ItemsFromBändeAndBIBLIO(
}
records = append(records, exem)
+ bandItems = append(bandItems, exem)
}
for nr, m := range t {
@@ -102,11 +104,12 @@ func ItemsFromBändeAndBIBLIO(
if exem.Identifier() != "" {
records = append(records, exem)
+ bandItems = append(bandItems, exem)
}
}
- if len(records) > 0 {
- for _, exem := range records {
+ if len(bandItems) > 0 {
+ for _, exem := range bandItems {
exem.SetEntry(banddb.Id)
exem.SetOwner("Theodor Springmann Stiftung")
diff --git a/views/assets/scripts.js b/views/assets/scripts.js
index 23ed85f..9a9d6a5 100644
--- a/views/assets/scripts.js
+++ b/views/assets/scripts.js
@@ -1,11 +1,11 @@
-var ue = Object.defineProperty;
+var pe = Object.defineProperty;
var O = (a) => {
throw TypeError(a);
};
-var me = (a, i, e) => i in a ? ue(a, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[i] = e;
-var m = (a, i, e) => me(a, typeof i != "symbol" ? i + "" : i, e), T = (a, i, e) => i.has(a) || O("Cannot " + e);
-var C = (a, i, e) => (T(a, i, "read from private field"), e ? e.call(a) : i.get(a)), p = (a, i, e) => i.has(a) ? O("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(a) : i.set(a, e), g = (a, i, e, t) => (T(a, i, "write to private field"), t ? t.call(a, e) : i.set(a, e), e), b = (a, i, e) => (T(a, i, "access private method"), e);
-class pe extends HTMLElement {
+var _e = (a, i, e) => i in a ? pe(a, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[i] = e;
+var p = (a, i, e) => _e(a, typeof i != "symbol" ? i + "" : i, e), y = (a, i, e) => i.has(a) || O("Cannot " + e);
+var C = (a, i, e) => (y(a, i, "read from private field"), e ? e.call(a) : i.get(a)), _ = (a, i, e) => i.has(a) ? O("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(a) : i.set(a, e), b = (a, i, e, t) => (y(a, i, "write to private field"), t ? t.call(a, e) : i.set(a, e), e), E = (a, i, e) => (y(a, i, "access private method"), e);
+class fe extends HTMLElement {
constructor() {
super(), this._value = "", this.render();
}
@@ -74,13 +74,13 @@ class pe extends HTMLElement {
`;
}
}
-const E = "filter-list-list", _e = "filter-list-item", fe = "filter-list-input", B = "filter-list-searchable";
-var d, f, M;
-class ge extends HTMLElement {
+const S = "filter-list-list", ge = "filter-list-item", be = "filter-list-input", R = "filter-list-searchable";
+var u, g, B;
+class Ee extends HTMLElement {
constructor() {
super();
- p(this, f);
- p(this, d, !1);
+ _(this, g);
+ _(this, u, !1);
this._items = [], this._url = "", this._filterstart = !1, this._placeholder = "Liste filtern...", this._queryparam = "", this._startparams = null, this.render();
}
static get observedAttributes() {
@@ -93,7 +93,7 @@ class ge extends HTMLElement {
return this._items;
}
connectedCallback() {
- this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._queryparam = this.getAttribute("data-queryparam") || "", this._queryparam, this._filterstart && g(this, d, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this));
+ this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._queryparam = this.getAttribute("data-queryparam") || "", this._queryparam, this._filterstart && b(this, u, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this));
}
attributeChangedCallback(e, t, s) {
e === "data-url" && t !== s && (this._url = s, this.render()), e === "data-filterstart" && t !== s && (this._filterstart = s === "true", this.render()), e === "data-placeholder" && t !== s && (this._placeholder = s, this.render()), e === "data-queryparam" && t !== s && (this._queryparam = s, this.render());
@@ -102,14 +102,14 @@ class ge extends HTMLElement {
e.target && e.target.tagName.toLowerCase() === "input" && (this._filter = e.target.value, this.renderList());
}
onGainFocus(e) {
- e.target && e.target.tagName.toLowerCase() === "input" && (g(this, d, !1), this.renderList());
+ e.target && e.target.tagName.toLowerCase() === "input" && (b(this, u, !1), this.renderList());
}
onLoseFocus(e) {
let t = this.querySelector("input");
if (e.target && e.target === t) {
if (relatedElement = e.relatedTarget, relatedElement && this.contains(relatedElement))
return;
- t.value = "", this._filter = "", this._filterstart && g(this, d, !0), this.renderList();
+ t.value = "", this._filter = "", this._filterstart && b(this, u, !0), this.renderList();
}
}
onEnter(e) {
@@ -122,10 +122,10 @@ class ge extends HTMLElement {
mark() {
if (typeof Mark != "function")
return;
- let e = this.querySelector("#" + E);
+ let e = this.querySelector("#" + S);
if (!e)
return;
- let t = new Mark(e.querySelectorAll("." + B));
+ let t = new Mark(e.querySelectorAll("." + R));
this._filter && t.mark(this._filter, {
separateWordSearch: !0
});
@@ -165,7 +165,7 @@ class ge extends HTMLElement {
}
getLinkText(e) {
let t = this.getSearchText(e);
- return t === "" ? "" : `${t}`;
+ return t === "" ? "" : `${t}`;
}
getURL(e) {
if (this._queryparam) {
@@ -175,7 +175,7 @@ class ge extends HTMLElement {
return this._url + this.getHREFEncoded(e);
}
renderList() {
- let e = this.querySelector("#" + E);
+ let e = this.querySelector("#" + S);
e && (e.outerHTML = this.List()), this.mark();
}
render() {
@@ -187,7 +187,7 @@ class ge extends HTMLElement {
`, htmx && htmx.process(this);
}
ActiveDot(e) {
- return b(this, f, M).call(this, e), "";
+ return E(this, g, B).call(this, e), "";
}
NoItems(e) {
return e.length === 0 ? '
Keine Einträge gefunden
' : "";
@@ -200,7 +200,7 @@ class ge extends HTMLElement {
+ class="${be} w-full placeholder:italic px-2 py-0.5" />
`;
@@ -215,7 +215,7 @@ class ge extends HTMLElement {
e = this._items.filter((s) => t.every((n) => this.getSearchText(s).toLowerCase().includes(n.toLowerCase())));
}
return `
-
+
${e.map(
(t, s) => `
+ class="${ge} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${s % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}"
+ ${E(this, g, B).call(this, t) ? 'aria-current="page"' : ""}>
${this.ActiveDot(t)}
${this.getLinkText(t)}
@@ -236,13 +236,13 @@ class ge extends HTMLElement {
`;
}
}
-d = new WeakMap(), f = new WeakSet(), M = function(e) {
+u = new WeakMap(), g = new WeakSet(), B = function(e) {
if (!e)
return !1;
let t = this.getHREF(e);
return t === "" ? !1 : this._queryparam && (new URLSearchParams(window.location.search).get(this._queryparam) || "") === t ? !0 : !!window.location.href.endsWith(t);
};
-class be extends HTMLElement {
+class Se extends HTMLElement {
constructor() {
super(), this.handleScroll = this.handleScroll.bind(this), this.scrollToTop = this.scrollToTop.bind(this);
}
@@ -278,7 +278,7 @@ class be extends HTMLElement {
window.scrollTo({ top: 0, behavior: "smooth" });
}
}
-class Ee extends HTMLElement {
+class ve extends HTMLElement {
static get observedAttributes() {
return ["position", "timeout"];
}
@@ -379,7 +379,7 @@ class Ee extends HTMLElement {
}
}
}
-class Se extends HTMLElement {
+class Le extends HTMLElement {
constructor() {
super(), this.overlay = null, this._others = null, this._thisindex = -1, this._preview = null, this._description = null, this._imageURL = "", this._hideDLButton = !1;
}
@@ -487,7 +487,7 @@ class Se extends HTMLElement {
this.overlay.parentNode.removeChild(this.overlay), this.overlay = null;
}
}
-class ve extends HTMLElement {
+class Te extends HTMLElement {
static get observedAttributes() {
}
constructor() {
@@ -575,7 +575,7 @@ class ve extends HTMLElement {
return null;
}
}
-class _ extends HTMLElement {
+class f extends HTMLElement {
static get observedAttributes() {
return ["data-text", "data-abbrevmap"];
}
@@ -638,7 +638,7 @@ class _ extends HTMLElement {
};
}
constructor() {
- super(), this._abbrevMap = _.defaultAbbrevMap;
+ super(), this._abbrevMap = f.defaultAbbrevMap;
}
connectedCallback() {
this.render();
@@ -648,13 +648,13 @@ class _ extends HTMLElement {
}
_parseAndSetAbbrevMap(i) {
if (!i) {
- this._abbrevMap = _.defaultAbbrevMap;
+ this._abbrevMap = f.defaultAbbrevMap;
return;
}
try {
this._abbrevMap = JSON.parse(i);
} catch {
- this._abbrevMap = _.defaultAbbrevMap;
+ this._abbrevMap = f.defaultAbbrevMap;
}
}
setAbbrevMap(i) {
@@ -704,7 +704,7 @@ class _ extends HTMLElement {
return /\s|[.,;:!?]/.test(i);
}
}
-class Le extends HTMLElement {
+class Ie extends HTMLElement {
constructor() {
super();
}
@@ -722,11 +722,11 @@ class Le extends HTMLElement {
}
}
}
-var L;
-class Ie extends HTMLElement {
+var T;
+class Ae extends HTMLElement {
constructor() {
super();
- p(this, L, 176);
+ _(this, T, 176);
this._images = [];
}
connectedCallback() {
@@ -742,17 +742,17 @@ class Ie extends HTMLElement {
calculateShownImages() {
const e = this.getBoundingClientRect();
console.log(e);
- const t = Math.floor(e.width / (C(this, L) + 10));
+ const t = Math.floor(e.width / (C(this, T) + 10));
for (let s = 0; s < this._images.length; s++)
s < t - 1 ? this._images[s].classList.remove("hidden") : this._images[s].classList.add("hidden");
}
}
-L = new WeakMap();
-const Ae = "msr-component-wrapper", R = "msr-selected-items-container", $ = "msr-placeholder-no-selection-text", Te = "msr-selected-item-pill", Ce = "msr-selected-item-text", ye = "msr-item-name", we = "msr-item-additional-data", xe = "msr-selected-item-role", N = "msr-selected-item-delete-btn", ke = "msr-controls-area", P = "msr-pre-add-button", D = "msr-input-area-wrapper", S = "msr-input-area-default-border", y = "msr-input-area-staged", H = "msr-staging-area-container", Me = "msr-staged-item-pill", Oe = "msr-staged-item-text", w = "msr-staged-role-select", q = "msr-staged-cancel-btn", U = "msr-text-input", F = "msr-add-button", K = "msr-options-list", z = "msr-option-item", Be = "msr-option-item-name", Re = "msr-option-item-detail", V = "msr-option-item-highlighted", x = "msr-hidden-select", $e = "msr-state-no-selection", Ne = "msr-state-has-selection", Pe = "msr-state-list-open", De = "msr-state-item-staged";
-class ae extends HTMLElement {
+T = new WeakMap();
+const ye = "msr-component-wrapper", $ = "msr-selected-items-container", N = "msr-placeholder-no-selection-text", Ce = "msr-selected-item-pill", we = "msr-selected-item-text", xe = "msr-item-name", Me = "msr-item-additional-data", ke = "msr-selected-item-role", D = "msr-selected-item-delete-btn", Be = "msr-controls-area", P = "msr-pre-add-button", H = "msr-input-area-wrapper", v = "msr-input-area-default-border", w = "msr-input-area-staged", q = "msr-staging-area-container", Oe = "msr-staged-item-pill", Re = "msr-staged-item-text", x = "msr-staged-role-select", U = "msr-staged-cancel-btn", F = "msr-text-input", V = "msr-add-button", K = "msr-options-list", z = "msr-option-item", $e = "msr-option-item-name", Ne = "msr-option-item-detail", W = "msr-option-item-highlighted", M = "msr-hidden-select", De = "msr-state-no-selection", Pe = "msr-state-has-selection", He = "msr-state-list-open", qe = "msr-state-item-staged";
+class re extends HTMLElement {
constructor() {
super();
- m(this, "_blurTimeout", null);
+ p(this, "_blurTimeout", null);
this.internals_ = this.attachInternals(), this._value = [], this._stagedItem = null, this._showAddButton = !0, this._placeholderNoSelection = "Keine Elemente ausgewählt", this._placeholderSearch = "Elemente suchen...", this._placeholderRoleSelect = "Rolle auswählen...", this._options = [], this._roles = [
"Leitung",
"Unterstützung",
@@ -829,22 +829,22 @@ class ae extends HTMLElement {
_setupTemplates() {
this.optionTemplate = document.createElement("template"), this.optionTemplate.innerHTML = `
-
-
+
+
`, this.selectedItemTemplate = document.createElement("template"), this.selectedItemTemplate.innerHTML = `
-
-
-
+
+
+
`, this.stagedPlacePillTemplate = document.createElement("template"), this.stagedPlacePillTemplate.innerHTML = `
-
-
+
+
`, this.stagedCancelBtnTemplate = document.createElement("template"), this.stagedCancelBtnTemplate.innerHTML = `
-
+
`, this.stagedRoleSelectTemplate = document.createElement("template"), this.stagedRoleSelectTemplate.innerHTML = `
-