From 9387e4166e882a88abbf50957d5feef47dadffe5 Mon Sep 17 00:00:00 2001 From: McElwain Date: Sun, 26 Apr 2026 16:04:04 -0500 Subject: [PATCH] feat: refine mobile detail tabs and editor layouts --- app/static/app.css | 664 ++++++++++++++++++++++++++++ app/templates/base.html | 2 +- app/templates/documents/detail.html | 184 ++++---- 3 files changed, 772 insertions(+), 78 deletions(-) diff --git a/app/static/app.css b/app/static/app.css index 7fdf23e..bd0dbe3 100644 --- a/app/static/app.css +++ b/app/static/app.css @@ -4613,3 +4613,667 @@ table { } } /* ===== end tighten metadata panel on mobile (real classes) ===== */ + + +/* ===== tighten non-OCR detail tabs on mobile ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="extracted-fields"], + .tab-panel[data-panel="additional-fields"], + .tab-panel[data-panel="line-items"], + .tab-panel[data-panel="versions"], + .tab-panel[data-panel="raw-ocr"], + .tab-panel[data-panel="source-options"] { + font-size: 0.8rem !important; + line-height: 1.22 !important; + } + + .tab-panel[data-panel="extracted-fields"] .card-title, + .tab-panel[data-panel="additional-fields"] .card-title, + .tab-panel[data-panel="line-items"] .card-title, + .tab-panel[data-panel="versions"] .card-title, + .tab-panel[data-panel="raw-ocr"] .card-title, + .tab-panel[data-panel="source-options"] .card-title { + font-size: 0.98rem !important; + line-height: 1.08 !important; + margin: 0 0 0.3rem 0 !important; + } + + .tab-panel[data-panel="extracted-fields"] > p, + .tab-panel[data-panel="additional-fields"] > p, + .tab-panel[data-panel="line-items"] > p, + .tab-panel[data-panel="versions"] > p, + .tab-panel[data-panel="raw-ocr"] > p, + .tab-panel[data-panel="source-options"] > p { + font-size: 0.76rem !important; + line-height: 1.15 !important; + margin: 0.08rem 0 !important; + } + + .tab-panel[data-panel="extracted-fields"] .form-grid, + .tab-panel[data-panel="additional-fields"] .form-grid { + gap: 0.42rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .form-field, + .tab-panel[data-panel="additional-fields"] .form-field { + margin: 0 !important; + } + + .tab-panel[data-panel="extracted-fields"] .form-field label, + .tab-panel[data-panel="additional-fields"] .form-field label, + .tab-panel[data-panel="line-items"] th, + .tab-panel[data-panel="versions"] th, + .tab-panel[data-panel="source-options"] .meta-label { + font-size: 0.72rem !important; + line-height: 1.1 !important; + margin-bottom: 0.14rem !important; + } + + .tab-panel[data-panel="extracted-fields"] input, + .tab-panel[data-panel="extracted-fields"] textarea, + .tab-panel[data-panel="extracted-fields"] select, + .tab-panel[data-panel="additional-fields"] input, + .tab-panel[data-panel="additional-fields"] textarea, + .tab-panel[data-panel="additional-fields"] select, + .tab-panel[data-panel="line-items"] input, + .tab-panel[data-panel="line-items"] textarea, + .tab-panel[data-panel="line-items"] select { + font-size: 0.8rem !important; + line-height: 1.2 !important; + padding-top: 0.42rem !important; + padding-bottom: 0.42rem !important; + } + + .tab-panel[data-panel="extracted-fields"] textarea, + .tab-panel[data-panel="additional-fields"] textarea { + min-height: 5.5rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .button-row, + .tab-panel[data-panel="additional-fields"] .button-row, + .tab-panel[data-panel="line-items"] .button-row, + .tab-panel[data-panel="versions"] .button-row, + .tab-panel[data-panel="raw-ocr"] .button-row, + .tab-panel[data-panel="source-options"] .button-row { + margin-top: 0.35rem !important; + margin-bottom: 0.35rem !important; + gap: 0.24rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .button-row button, + .tab-panel[data-panel="additional-fields"] .button-row button, + .tab-panel[data-panel="line-items"] .button-row button, + .tab-panel[data-panel="versions"] .button-row button, + .tab-panel[data-panel="raw-ocr"] .button-row button, + .tab-panel[data-panel="source-options"] .button-row button, + .tab-panel[data-panel="additional-fields"] .button-row .button-link, + .tab-panel[data-panel="source-options"] .button-row .button-link { + font-size: 0.74rem !important; + line-height: 1 !important; + min-height: 1.6rem !important; + height: 1.6rem !important; + padding: 0 0.42rem !important; + border-radius: 999px !important; + } + + .tab-panel[data-panel="line-items"] table th, + .tab-panel[data-panel="line-items"] table td, + .tab-panel[data-panel="versions"] table th, + .tab-panel[data-panel="versions"] table td { + padding: 0.22rem !important; + font-size: 0.72rem !important; + line-height: 1.15 !important; + } + + .tab-panel[data-panel="raw-ocr"] pre, + .tab-panel[data-panel="raw-ocr"] textarea { + font-size: 0.78rem !important; + line-height: 1.2 !important; + } + + .tab-panel[data-panel="source-options"] .meta-grid { + gap: 0.34rem !important; + } + + .tab-panel[data-panel="source-options"] .meta-item { + padding: 0.38rem 0.48rem !important; + border-radius: 0.85rem !important; + } + + .tab-panel[data-panel="source-options"] .meta-label { + font-size: 0.7rem !important; + margin-bottom: 0.12rem !important; + } + + .tab-panel[data-panel="source-options"] .meta-item, + .tab-panel[data-panel="source-options"] .meta-item div, + .tab-panel[data-panel="source-options"] .meta-item span:not(.meta-label) { + font-size: 0.76rem !important; + line-height: 1.18 !important; + } +} +/* ===== end tighten non-OCR detail tabs on mobile ===== */ + + + + +/* ===== extracted fields header inline action ===== */ +@media (max-width: 900px) { + .extracted-fields-header-row { + display: grid !important; + grid-template-columns: minmax(0, 1fr) auto !important; + align-items: center !important; + column-gap: 0.35rem !important; + margin-bottom: 0.18rem !important; + } + + .extracted-fields-header-row .card-title { + margin: 0 !important; + white-space: nowrap !important; + overflow: hidden !important; + text-overflow: ellipsis !important; + min-width: 0 !important; + font-size: 0.98rem !important; + line-height: 1.05 !important; + } + + .extracted-autofill-inline-form { + margin: 0 !important; + justify-self: end !important; + } + + .extracted-autofill-inline-form button { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + white-space: nowrap !important; + font-size: 0.72rem !important; + line-height: 1 !important; + font-weight: 500 !important; + min-height: 1.5rem !important; + height: 1.5rem !important; + padding: 0 0.34rem !important; + border-radius: 999px !important; + margin: 0 !important; + } +} +/* ===== end extracted fields header inline action ===== */ + + +/* ===== extracted version line spacing ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="extracted-fields"] > p:first-of-type { + margin-top: 0.16rem !important; + margin-bottom: 0.28rem !important; + line-height: 1.18 !important; + } + + .extracted-fields-header-row { + margin-bottom: 0.12rem !important; + } +} +/* ===== end extracted version line spacing ===== */ + + +/* ===== line items header inline action ===== */ +@media (max-width: 900px) { + .line-items-header-row { + display: grid !important; + grid-template-columns: minmax(0, 1fr) auto !important; + align-items: center !important; + column-gap: 0.35rem !important; + margin-bottom: 0.12rem !important; + } + + .line-items-header-row .card-title { + margin: 0 !important; + white-space: nowrap !important; + overflow: hidden !important; + text-overflow: ellipsis !important; + min-width: 0 !important; + font-size: 0.98rem !important; + line-height: 1.05 !important; + } + + .line-items-regenerate-inline-form { + margin: 0 !important; + justify-self: end !important; + } + + .line-items-regenerate-inline-form button { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + white-space: nowrap !important; + font-size: 0.72rem !important; + line-height: 1 !important; + font-weight: 500 !important; + min-height: 1.5rem !important; + height: 1.5rem !important; + padding: 0 0.34rem !important; + border-radius: 999px !important; + margin: 0 !important; + } + + .tab-panel[data-panel="line-items"] > p:first-of-type { + margin-top: 0.16rem !important; + margin-bottom: 0.28rem !important; + line-height: 1.18 !important; + } +} +/* ===== end line items header inline action ===== */ + + +/* ===== additional fields preset controls one row ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="additional-fields"] form[style*="margin-bottom: 1rem;"] .button-row { + display: grid !important; + grid-template-columns: minmax(0, 1fr) auto auto !important; + align-items: center !important; + gap: 0.22rem !important; + margin: 0.18rem 0 0.35rem 0 !important; + } + + .tab-panel[data-panel="additional-fields"] form[style*="margin-bottom: 1rem;"] .button-row select { + min-width: 0 !important; + width: 100% !important; + font-size: 0.78rem !important; + line-height: 1.1 !important; + height: 1.7rem !important; + padding: 0 0.45rem !important; + } + + .tab-panel[data-panel="additional-fields"] form[style*="margin-bottom: 1rem;"] .button-row button, + .tab-panel[data-panel="additional-fields"] form[style*="margin-bottom: 1rem;"] .button-row .button-link { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + white-space: nowrap !important; + font-size: 0.72rem !important; + line-height: 1 !important; + min-height: 1.7rem !important; + height: 1.7rem !important; + padding: 0 0.42rem !important; + border-radius: 999px !important; + margin: 0 !important; + } +} +/* ===== end additional fields preset controls one row ===== */ + + + + +/* ===== source options dropdown + tighter mobile layout ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="source-options"] .card-title { + margin-bottom: 0.22rem !important; + } + + .tab-panel[data-panel="source-options"] > form { + gap: 0.34rem !important; + } + + .tab-panel[data-panel="source-options"] .card { + padding: 0.56rem !important; + border-radius: 0.9rem !important; + } + + .tab-panel[data-panel="source-options"] h3 { + margin: 0 0 0.2rem 0 !important; + font-size: 0.88rem !important; + line-height: 1.05 !important; + } + + .source-options-select-row { + display: grid !important; + grid-template-columns: 4.2rem minmax(0, 1fr) !important; + gap: 0.18rem !important; + align-items: center !important; + } + + .source-options-inline-label { + font-size: 0.7rem !important; + line-height: 1.05 !important; + color: #6b7280 !important; + margin: 0 !important; + } + + .source-options-select-row select, + .tab-panel[data-panel="source-options"] select { + font-size: 0.74rem !important; + line-height: 1.05 !important; + min-height: 1.6rem !important; + height: 1.6rem !important; + padding: 0 0.4rem !important; + } + + .tab-panel[data-panel="source-options"] .button-row { + margin-top: 0.18rem !important; + margin-bottom: 0 !important; + gap: 0.18rem !important; + } + + .tab-panel[data-panel="source-options"] .button-row button, + .tab-panel[data-panel="source-options"] .button-row .button-link { + font-size: 0.7rem !important; + line-height: 1 !important; + min-height: 1.5rem !important; + height: 1.5rem !important; + padding: 0 0.36rem !important; + border-radius: 999px !important; + } +} +/* ===== end source options dropdown + tighter mobile layout ===== */ + + +/* ===== metadata card matches source-options styling ===== */ +@media (max-width: 900px) { + .meta-grid { + gap: 0.34rem !important; + } + + .meta-item { + padding: 0.56rem !important; + border-radius: 0.9rem !important; + } + + .meta-label { + font-size: 0.7rem !important; + line-height: 1.05 !important; + margin-bottom: 0.14rem !important; + color: #6b7280 !important; + } + + .meta-item, + .meta-item div, + .meta-item span:not(.meta-label) { + font-size: 0.74rem !important; + line-height: 1.18 !important; + } + + .meta-grid + .card-title, + h2.card-title + .meta-grid, + .card-title { + margin-bottom: 0.22rem !important; + } +} + /* ===== end metadata card matches source-options styling ===== */ + + +/* ===== metadata card matches source-options styling v2 ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="source-options"] > h2.card-title:last-of-type { + font-size: 0.98rem !important; + line-height: 1.08 !important; + margin: 0.1rem 0 0.22rem 0 !important; + } + + .tab-panel[data-panel="source-options"] > .meta-grid { + gap: 0.34rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] > .meta-grid > .meta-item { + padding: 0.56rem !important; + border-radius: 0.9rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] > .meta-grid > .meta-item > .meta-label { + display: block !important; + font-size: 0.7rem !important; + line-height: 1.05 !important; + margin-bottom: 0.14rem !important; + color: #6b7280 !important; + } + + .tab-panel[data-panel="source-options"] > .meta-grid > .meta-item, + .tab-panel[data-panel="source-options"] > .meta-grid > .meta-item > span:not(.meta-label), + .tab-panel[data-panel="source-options"] > .meta-grid > .meta-item > div { + font-size: 0.74rem !important; + line-height: 1.18 !important; + } +} +/* ===== end metadata card matches source-options styling v2 ===== */ + + +/* ===== data reset matches file source box ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="source-options"] .card h3 { + margin: 0 0 0.18rem 0 !important; + font-size: 0.88rem !important; + line-height: 1.05 !important; + } + + .tab-panel[data-panel="source-options"] .card:has(select[name="ocr_action"]) { + padding: 0.56rem !important; + } + + .tab-panel[data-panel="source-options"] .card:has(select[name="ocr_action"]) > div[style*="display:grid"] { + display: grid !important; + grid-template-columns: 1fr !important; + gap: 0.22rem !important; + } + + .tab-panel[data-panel="source-options"] .card:has(select[name="ocr_action"]) > div[style*="display:grid"] > div { + display: grid !important; + grid-template-columns: 7.2rem minmax(0, 1fr) !important; + align-items: center !important; + gap: 0.28rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] .card:has(select[name="ocr_action"]) label { + font-size: 0.74rem !important; + line-height: 1.1 !important; + margin: 0 !important; + color: #111827 !important; + font-weight: 600 !important; + } + + .tab-panel[data-panel="source-options"] .card:has(select[name="ocr_action"]) select { + width: 100% !important; + min-width: 0 !important; + font-size: 0.74rem !important; + line-height: 1.05 !important; + min-height: 1.6rem !important; + height: 1.6rem !important; + padding: 0 0.4rem !important; + } +} +/* ===== end data reset matches file source box ===== */ + + +/* ===== data reset relayout ===== */ +@media (max-width: 900px) { + .data-reset-grid { + display: grid !important; + grid-template-columns: 1fr !important; + gap: 0.22rem !important; + } + + .data-reset-row { + display: grid !important; + grid-template-columns: 7.2rem minmax(0, 1fr) !important; + align-items: center !important; + gap: 0.28rem !important; + margin: 0 !important; + } + + .data-reset-row label { + font-size: 0.74rem !important; + line-height: 1.1 !important; + margin: 0 !important; + color: #111827 !important; + font-weight: 600 !important; + } + + .data-reset-row select { + width: 100% !important; + min-width: 0 !important; + font-size: 0.74rem !important; + line-height: 1.05 !important; + min-height: 1.6rem !important; + height: 1.6rem !important; + padding: 0 0.4rem !important; + } +} +/* ===== end data reset relayout ===== */ + + +/* ===== source-options data reset matches file source v3 ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) { + padding: 0.56rem !important; + border-radius: 0.9rem !important; + } + + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) > h3 { + margin: 0 0 0.18rem 0 !important; + font-size: 0.88rem !important; + line-height: 1.05 !important; + } + + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) .data-reset-grid { + display: grid !important; + grid-template-columns: 1fr !important; + gap: 0.22rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) .data-reset-row { + display: grid !important; + grid-template-columns: 6.8rem minmax(0, 1fr) !important; + align-items: center !important; + gap: 0.22rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) .data-reset-row label { + font-size: 0.74rem !important; + line-height: 1.08 !important; + font-weight: 500 !important; + margin: 0 !important; + color: #6b7280 !important; + } + + .tab-panel[data-panel="source-options"] > form > .card:nth-of-type(2) .data-reset-row select { + width: 100% !important; + min-width: 0 !important; + font-size: 0.74rem !important; + line-height: 1.05 !important; + min-height: 1.6rem !important; + height: 1.6rem !important; + padding: 0 0.4rem !important; + margin: 0 !important; + } + + .tab-panel[data-panel="source-options"] > form > div:last-child { + margin-top: 0.18rem !important; + } + + .tab-panel[data-panel="source-options"] > form > div:last-child .btn { + font-size: 0.72rem !important; + line-height: 1 !important; + min-height: 1.5rem !important; + height: 1.5rem !important; + padding: 0 0.42rem !important; + border-radius: 999px !important; + } +} +/* ===== end source-options data reset matches file source v3 ===== */ + + +/* ===== extra json matches OCR editor ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-field { + margin-top: 0.12rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap { + display: block !important; + background: #f8fafc !important; + border: 1px solid #d7dce5 !important; + border-radius: 1rem !important; + overflow: hidden !important; + margin-top: 0.08rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap textarea { + display: block !important; + width: 100% !important; + min-height: 10rem !important; + border: 0 !important; + border-radius: 0 !important; + background: transparent !important; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; + font-size: 0.88rem !important; + line-height: 1.35 !important; + padding: 0.6rem 0.7rem !important; + resize: vertical !important; + box-sizing: border-box !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap textarea:focus { + outline: none !important; + box-shadow: none !important; + } +} +/* ===== end extra json matches OCR editor ===== */ + + +/* ===== extra json matches OCR editor with line numbers ===== */ +@media (max-width: 900px) { + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap { + display: grid !important; + grid-template-columns: 2.1rem minmax(0, 1fr) !important; + column-gap: 0 !important; + background: #f8fafc !important; + border: 1px solid #d7dce5 !important; + border-radius: 1rem !important; + overflow: hidden !important; + margin-top: 0.08rem !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap .line-numbers { + width: 2.1rem !important; + min-width: 2.1rem !important; + margin: 0 !important; + padding: 0.6rem 0.22rem 0.6rem 0.18rem !important; + text-align: right !important; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; + font-size: 0.88rem !important; + line-height: 1.35 !important; + color: #6b7280 !important; + background: #f3f4f6 !important; + border-right: 1px solid #d7dce5 !important; + overflow: hidden !important; + user-select: none !important; + box-sizing: border-box !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap textarea { + display: block !important; + width: 100% !important; + min-height: 10rem !important; + margin: 0 !important; + border: 0 !important; + border-radius: 0 !important; + background: transparent !important; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; + font-size: 0.88rem !important; + line-height: 1.35 !important; + padding: 0.6rem 0.7rem !important; + resize: vertical !important; + box-sizing: border-box !important; + overflow: auto !important; + white-space: pre !important; + overflow-wrap: normal !important; + } + + .tab-panel[data-panel="extracted-fields"] .extra-json-editor-wrap textarea:focus { + outline: none !important; + box-shadow: none !important; + } +} +/* ===== end extra json matches OCR editor with line numbers ===== */ diff --git a/app/templates/base.html b/app/templates/base.html index 7272a78..70bfc5b 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,7 +4,7 @@ {% block title %}Document Processor{% endblock %} - + diff --git a/app/templates/documents/detail.html b/app/templates/documents/detail.html index dbffe59..4246012 100644 --- a/app/templates/documents/detail.html +++ b/app/templates/documents/detail.html @@ -1,5 +1,27 @@ {% extends "base.html" %} -{% block title %}Document Detail{% endblock %} +{% block title %}Document Detail + + +{% endblock %} {% block content %} {% if error == "line_count_mismatch" %}
@@ -223,7 +245,14 @@
-

Extracted fields

+
+

Extracted fields

+
+ + + +
+
{% if current_extracted_version_number %} {% set current_extracted_meta = ( extracted_version_options @@ -243,13 +272,7 @@

No extracted fields saved yet.

{% endif %} -
- - -
- -
-
+
@@ -265,7 +288,13 @@
-
+
+ +
+
1
+ +
+
@@ -376,19 +405,19 @@
-

Line Items

- - {% if current_line_item_version %} +
+

Line Items

+ + + +
+{% if current_line_item_version %}

Current line item version: v{{ current_line_item_version.version_number }} — {{ current_line_item_version.created_at }}

{% else %}

No line items saved yet.

{% endif %} -
-
- -
-
+
{% set base_count = line_items|length %} @@ -514,69 +543,48 @@ function addRow() {
-

File Source

-
- - - -
+
+ + +

Data Reset

-
- OCR - -
- -
- Extracted fields - -
- -
- Additional fields - -
- -
- Line items - -
-
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
@@ -622,4 +630,26 @@ function addRow() {
Updated at{{ document.updated_at }}
+ + + {% endblock %}