Show Source Document and Transactions panels before upload

The opening/closing balance fields live in TransactionsTable, which was
only rendered after a successful extraction - so there was no way to
type a balance before clicking Extract, even though both fields are
submitted as part of that same request. Confirmed this wasn't introduced
by the Vue rewrite - the original vanilla-JS version had the identical
behavior (#resultSection stayed display:none until renderResult ran).

Both panels are now always visible. Each shows an empty-state message
("No Source Document to Display..."/"No Transactions to Display...")
until there's something real to show instead - SourceDocumentPanel until
a file is chosen, TransactionsTable's table (not the balance fields
above it) until an extraction result exists.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
JasonFraser 2026-10-12 06:50:04 -04:00
parent 6e4da3f385
commit bcebc50466
4 changed files with 48 additions and 12 deletions

View File

@ -227,6 +227,17 @@ tr.editing td{ background:rgba(37,99,235,.03); }
background:var(--navy-3); overflow:auto; display:block;
}
.img-preview-wrap img{ display:block; }
/* Both panels are visible from the start (before any file is chosen),
so the opening/closing balance fields in TransactionsTable are
reachable before clicking Extract - each shows one of these until
there's something real to display instead. */
.empty-panel{
display:flex; align-items:center; justify-content:center; text-align:center;
color:var(--t4); font-size:13px; line-height:1.6; padding:40px 24px;
border:1px solid var(--border-2); border-radius:10px; background:var(--navy-3);
}
.empty-panel-source{ width:100%; height:82vh; }
.empty-panel-table{ min-height:260px; margin-top:4px; }
.resizer{
flex:0 0 28px; align-self:stretch; cursor:col-resize;
display:flex; align-items:center; justify-content:center;

View File

@ -5,6 +5,10 @@
* The Source Document card: a PDF gets the browser's native viewer (with
* its own zoom toolbar) in an iframe; an image has no such chrome, so it
* gets its own zoomable/scrollable panel instead - see useImageZoom.js.
* Before any file is chosen, shows an empty-state message instead - this
* panel is always visible (not gated on an extraction result existing),
* so the opening/closing balance fields in TransactionsTable are
* reachable before clicking Extract.
*
* Data flow:
* previewUrl (string|null) - blob URL for the chosen file
@ -36,7 +40,10 @@ const pdfSrc = computed(() => (props.previewUrl ? props.previewUrl + '#toolbar=1
<button type="button" title="Reset zoom to fit" @click="resetZoom">Fit</button>
</div>
</div>
<iframe v-if="!isImage" :src="pdfSrc" title="Statement PDF preview"></iframe>
<div v-if="!previewUrl" class="empty-panel empty-panel-source">
<p>No Source Document to Display.<br>Upload one to get started.</p>
</div>
<iframe v-else-if="!isImage" :src="pdfSrc" title="Statement PDF preview"></iframe>
<div v-else ref="wrapRef" class="img-preview-wrap">
<img ref="imgRef" :src="previewUrl" alt="Statement image preview" @load="onImageLoad">
</div>

View File

@ -3,7 +3,11 @@
* TransactionsTable.vue
*
* Opening/closing balance inputs + their calculated readouts, the
* Hide/Show Source Doc toggle, and the transactions table itself.
* Hide/Show Source Doc toggle, and the transactions table itself. Always
* rendered (not gated on an extraction result existing) so the balance
* fields are enterable BEFORE clicking Extract, since they're submitted
* as part of that same request - the table itself shows an empty state
* until there's a result to display.
*
* The opening-balance readout is deliberately a snapshot of the
* ORIGINAL extraction's own opening_balance - the backend never returns
@ -58,8 +62,12 @@ const toggleLabel = computed(() => (uiStore.pdfColHidden ? 'Show Source Doc' : '
</div>
</div>
<div class="note">This statement format may not print a clean opening/closing balance — enter them here to run the full statement balance check; otherwise it's marked "not available" rather than guessed.</div>
<div class="note">Click the pencil on a row to edit it, then Save to commit - edits are saved to this browser as you confirm them, row by row.</div>
<div class="table-wrap">
<div v-if="result" class="note">Click the pencil on a row to edit it, then Save to commit - edits are saved to this browser as you confirm them, row by row.</div>
<div v-if="!result" class="empty-panel empty-panel-table">
<p>No Transactions to Display.<br>Upload a source document to get started.</p>
</div>
<div v-else class="table-wrap">
<table>
<colgroup>
<col style="width:34px">

View File

@ -62,13 +62,23 @@ onMounted(restoreOnLoad)
<div v-if="extractionStore.currentResult">
<RestoreBanner />
<ResultCard />
<ResizablePanels>
<template #source>
<SourceDocumentPanel :preview-url="currentPdfUrl" :is-image="isImage" />
</template>
<template #transactions>
<TransactionsTable />
</template>
</ResizablePanels>
</div>
<!--
Source Document and Transactions (and the opening/closing balance
fields that live in the latter) are always visible, even before a
file is chosen - the balance fields need to be enterable BEFORE
clicking Extract, since they're submitted as part of that same
request. Each panel shows its own empty state until there's
something to display - see SourceDocumentPanel.vue/
TransactionsTable.vue.
-->
<ResizablePanels>
<template #source>
<SourceDocumentPanel :preview-url="currentPdfUrl" :is-image="isImage" />
</template>
<template #transactions>
<TransactionsTable />
</template>
</ResizablePanels>
</template>