diff --git a/static/app.js b/static/app.js
index 2123426..6ceb1a4 100644
--- a/static/app.js
+++ b/static/app.js
@@ -159,6 +159,7 @@ $("#search-form").addEventListener("submit", async (e) => {
${esc(r.title)}
${esc(r.authors)}
${r.narrator ? `🎙 ${esc(r.narrator)}` : ""}
+ ${r.series && r.media_type ? `📚 ${esc(r.series)}${r.volume != null ? " #" + r.volume : ""}` : ""}
${r.year ?? ""} ${r.external_id ? "· " + esc(r.external_id) : ""}
${type === "comic" ? `` : ""}
@@ -184,7 +185,7 @@ $("#search-form").addEventListener("submit", async (e) => {
title: r.title, authors: r.authors, narrator: r.narrator || "",
external_id: r.external_id,
year: r.year, series: r.series, cover_url: r.cover_url,
- volume: volInput && volInput.value ? parseInt(volInput.value) : null,
+ volume: volInput && volInput.value ? parseInt(volInput.value) : (r.volume ?? null),
}),
});
setLastLib(type, libId);
@@ -368,28 +369,50 @@ function openDetail(id, status) {
img.hidden = !r.cover_url;
$("#detail-nocover").hidden = !!r.cover_url;
if (r.cover_url) img.src = r.cover_url;
+ $("#detail-retag").hidden = !(r.status === "imported" && r.media_type === "audiobook");
$("#detail-dialog").showModal();
}
+async function saveDetail(form) {
+ await api("/api/requests/" + detailRequest.id, {
+ method: "PUT",
+ body: JSON.stringify({
+ library_id: parseInt(form.library_id.value),
+ title: form.title.value,
+ authors: form.authors.value,
+ narrator: form.narrator.value,
+ series: form.series.value,
+ volume: form.volume.value ? parseInt(form.volume.value) : null,
+ year: form.year.value ? parseInt(form.year.value) : null,
+ external_id: form.external_id.value,
+ cover_url: detailRequest.cover_url || "",
+ }),
+ });
+}
+
+$("#detail-retag").addEventListener("click", async () => {
+ if (!detailRequest) return;
+ const btn = $("#detail-retag");
+ btn.disabled = true;
+ btn.innerHTML = '
Tagge…';
+ try {
+ await saveDetail($("#detail-form"));
+ const res = await api(`/api/requests/${detailRequest.id}/retag`, { method: "POST" });
+ toast(`${res.files} Datei(en) neu getaggt`);
+ $("#detail-dialog").close();
+ loadRequests(detailRequest.status);
+ } catch (err) { toast(err.message, true); }
+ finally {
+ btn.disabled = false;
+ btn.textContent = "Speichern & neu taggen";
+ }
+});
+
$("#detail-form").addEventListener("submit", async (e) => {
if (e.submitter && e.submitter.value === "cancel") return;
if (!detailRequest) return;
- const form = e.target;
try {
- await api("/api/requests/" + detailRequest.id, {
- method: "PUT",
- body: JSON.stringify({
- library_id: parseInt(form.library_id.value),
- title: form.title.value,
- authors: form.authors.value,
- narrator: form.narrator.value,
- series: form.series.value,
- volume: form.volume.value ? parseInt(form.volume.value) : null,
- year: form.year.value ? parseInt(form.year.value) : null,
- external_id: form.external_id.value,
- cover_url: detailRequest.cover_url || "",
- }),
- });
+ await saveDetail(e.target);
toast("Anfrage gespeichert");
loadRequests(detailRequest.status);
} catch (err) { toast(err.message, true); }
@@ -603,6 +626,7 @@ async function runQuickSearch() {
${esc(r.title)}
${esc(r.authors)}
${r.narrator ? `
🎙 ${esc(r.narrator)}` : ""}
+ ${r.series && r.media_type ? `
📚 ${esc(r.series)}${r.volume != null ? " #" + r.volume : ""}` : ""}
${r.year ?? ""}
@@ -634,7 +658,7 @@ async function pickQuickResult(r) {
body: JSON.stringify({
library_id: parseInt(libId),
title: r.title, authors: r.authors, narrator: r.narrator || "",
- external_id: r.external_id,
+ external_id: r.external_id, volume: r.volume ?? null,
year: r.year, series: r.series, cover_url: r.cover_url,
}),
});
diff --git a/static/index.html b/static/index.html
index 9991ed7..466e6c4 100644
--- a/static/index.html
+++ b/static/index.html
@@ -246,6 +246,9 @@