From bb68af783c7c5738df5cb258ffefcc4093c707ba Mon Sep 17 00:00:00 2001 From: McElwain Date: Sun, 26 Apr 2026 14:17:44 -0500 Subject: [PATCH] fix: restore detail tabs and refine mobile detail controls --- app/routes/documents.py | 4 +-- app/static/app.css | 39 +++++++++++++++++++++++++++++ app/templates/base.html | 29 ++++++++++++++++++++- app/templates/documents/detail.html | 6 ++--- 4 files changed, 72 insertions(+), 6 deletions(-) diff --git a/app/routes/documents.py b/app/routes/documents.py index 62e4e90..9492019 100644 --- a/app/routes/documents.py +++ b/app/routes/documents.py @@ -940,7 +940,7 @@ def save_document_type_route( document.document_type = document_type.strip() or None db.commit() - return RedirectResponse(url=f"/documents/{document.document_id}?tab=ocr-review&success=rerun_ocr", status_code=303) + return RedirectResponse(url=f"/documents/{document.document_id}?tab=ocr-review&success=saved_document_type", status_code=303) @router.post("/{document_id}/rerun-ocr", response_class=RedirectResponse) @@ -1650,7 +1650,7 @@ def document_detail(document_id: str, request: Request, queue: str | None = None ] active_tab = request.query_params.get("tab", "ocr-review") - if active_tab not in {"ocr-review", "extracted-fields", "additional-fields", "versions", "raw-ocr", "source-options"}: + if active_tab not in {"ocr-review", "extracted-fields", "additional-fields", "line-items", "versions", "raw-ocr", "source-options"}: active_tab = "ocr-review" return templates.TemplateResponse( diff --git a/app/static/app.css b/app/static/app.css index 548dff7..083b275 100644 --- a/app/static/app.css +++ b/app/static/app.css @@ -4219,3 +4219,42 @@ table { + + +/* ===== save document far right ===== */ +@media (max-width: 900px) { + .detail-sticky-header .queue-nav-row::before { + order: 99 !important; + margin-left: auto !important; + } +} +/* ===== end save document far right ===== */ + + +/* ===== save button blue + nav row spacing ===== */ +@media (max-width: 900px) { + .detail-sticky-header .queue-nav-row { + display: flex !important; + flex-wrap: wrap !important; + align-items: center !important; + gap: 0.14rem !important; + row-gap: 0.12rem !important; + } + + .detail-sticky-header .queue-nav-row .button-link, + .detail-trash-inline button { + margin: 0 !important; + } + + .detail-sticky-header .queue-nav-row::before { + order: 99 !important; + margin-left: auto !important; + + background: #2563eb !important; + color: #ffffff !important; + border-color: #2563eb !important; + + box-shadow: none !important; + } +} +/* ===== end save button blue + nav row spacing ===== */ diff --git a/app/templates/base.html b/app/templates/base.html index e701e72..2809cea 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,7 +4,7 @@ {% block title %}Document Processor{% endblock %} - + @@ -67,6 +67,33 @@ document.addEventListener("DOMContentLoaded", () => { btn.addEventListener("click", () => applyMode(btn.dataset.detailMode)); }); } + + + const tabButtons = document.querySelectorAll("[data-tab]"); + const tabPanels = document.querySelectorAll("[data-panel]"); + + if (tabButtons.length && tabPanels.length) { + const activateTab = (tabName) => { + tabButtons.forEach((btn) => { + btn.classList.toggle("active", btn.dataset.tab === tabName); + }); + + tabPanels.forEach((panel) => { + panel.classList.toggle("active", panel.dataset.panel === tabName); + }); + }; + + const initialActive = + document.querySelector(".tab-button.active")?.dataset.tab || + "ocr-review"; + + activateTab(initialActive); + + tabButtons.forEach((btn) => { + btn.addEventListener("click", () => activateTab(btn.dataset.tab)); + }); + } + }); diff --git a/app/templates/documents/detail.html b/app/templates/documents/detail.html index 8d98cd6..e91b0f4 100644 --- a/app/templates/documents/detail.html +++ b/app/templates/documents/detail.html @@ -107,9 +107,6 @@
-
- -
Back to Queue {% if next_ocr_doc %} Next in Queue @@ -118,6 +115,9 @@ {% elif next_doc %} Next in Queue {% endif %} +
+ +