diff --git a/templates/dashboard.html b/templates/dashboard.html index b44e0e2..c91d5cc 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -120,16 +120,16 @@ {{if .Stats.RecentUploads}}
{{range .Stats.RecentUploads}} -
- + + +
{{if eq .Status "processing"}} @@ -144,18 +144,13 @@ Error {{else}} - + + {{title .Category}} + {{end}}

{{formatDateTime .ProcessedAt}}

-
+ {{end}}
{{else}} @@ -397,23 +392,6 @@ }, 2000); } - async function updateCategory(id, title, newCategory) { - try { - const res = await fetch('/api/document/' + id, { - method: 'PUT', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({title: title, category: newCategory, notes: ''}) - }); - if (res.ok) { - showToast('Moved to ' + newCategory, 'success'); - } else { - showToast('Failed to update', 'error'); - } - } catch { - showToast('Failed to update', 'error'); - } - } - function showToast(message, type = 'info') { const colors = { success: 'bg-green-500', diff --git a/templates/document.html b/templates/document.html index ac343eb..8b13ae1 100644 --- a/templates/document.html +++ b/templates/document.html @@ -12,9 +12,12 @@
- - {{categoryIcon .Document.Category}} {{title .Document.Category}} - + {{if .Document.Type}} {{title .Document.Type}} @@ -376,6 +379,21 @@ function toggleEdit() { document.getElementById('edit-modal').classList.toggle('hidden'); } + + async function inlineUpdateCategory(newCategory) { + const res = await fetch('/api/document/{{.Document.ID}}', { + method: 'PUT', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({ + title: '{{.Document.Title}}', + category: newCategory, + notes: `{{.Document.Notes}}` + }) + }); + if (res.ok) { + location.reload(); + } + } function copyText() { const text = document.getElementById('ocr-text').textContent;