fix: restore detail tabs and refine mobile detail controls

This commit is contained in:
Sean McElwain 2026-04-26 14:17:44 -05:00
parent 9c9f9fbe0b
commit bb68af783c
4 changed files with 72 additions and 6 deletions

View File

@ -940,7 +940,7 @@ def save_document_type_route(
document.document_type = document_type.strip() or None document.document_type = document_type.strip() or None
db.commit() 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) @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") 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" active_tab = "ocr-review"
return templates.TemplateResponse( return templates.TemplateResponse(

View File

@ -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 ===== */

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Document Processor{% endblock %}</title> <title>{% block title %}Document Processor{% endblock %}</title>
<link rel="stylesheet" href="/static/app.css?v=99"> <link rel="stylesheet" href="/static/app.css?v=102">
<link rel="stylesheet" href="/static/app-shell.css?v=66"> <link rel="stylesheet" href="/static/app-shell.css?v=66">
</head> </head>
<body> <body>
@ -67,6 +67,33 @@ document.addEventListener("DOMContentLoaded", () => {
btn.addEventListener("click", () => applyMode(btn.dataset.detailMode)); 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));
});
}
}); });
</script> </script>

View File

@ -107,9 +107,6 @@
</div> </div>
<div class="queue-nav-row"> <div class="queue-nav-row">
<form method="post" action="/documents/{{ document.document_id }}/move-to-trash" class="detail-trash-form detail-trash-inline">
<button class="danger" type="submit">Move to trash</button>
</form>
<a class="button-link" href="/queue/">Back to Queue</a> <a class="button-link" href="/queue/">Back to Queue</a>
{% if next_ocr_doc %} {% if next_ocr_doc %}
<a class="button-link" href="/documents/{{ next_ocr_doc.document_id }}">Next in Queue</a> <a class="button-link" href="/documents/{{ next_ocr_doc.document_id }}">Next in Queue</a>
@ -118,6 +115,9 @@
{% elif next_doc %} {% elif next_doc %}
<a class="button-link" href="/documents/{{ next_doc.document_id }}">Next in Queue</a> <a class="button-link" href="/documents/{{ next_doc.document_id }}">Next in Queue</a>
{% endif %} {% endif %}
<form method="post" action="/documents/{{ document.document_id }}/move-to-trash" class="detail-trash-form detail-trash-inline">
<button class="danger" type="submit">Move to trash</button>
</form>
</div> </div>
</div> </div>
</div> </div>