diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css index a605262..2ae101a 100644 --- a/frontend/src/assets/main.css +++ b/frontend/src/assets/main.css @@ -68,7 +68,15 @@ h1{ font-family:var(--fd); font-weight:800; font-size:30px; letter-spacing:-.01e .file-zone-sub{ font-size:11.5px; color:var(--t4); margin-top:5px; } .file-zone-sub.file-chosen-name{ font-family:var(--fm); font-size:12px; color:var(--blue); margin-top:5px; } -.fields{ display:flex; flex-wrap:wrap; gap:16px; margin-bottom:16px; } +/* .fields-row pairs the balance inputs with the Recheck Balance button - + the button sits at the row's own right edge, lining up under the + Hide/Show Source Doc toggle above it (txn-col-head is also a full-width + row with its own button at the right). Drops below the closing-balance + field on narrow viewports - see the mobile breakpoint below. */ +.fields-row{ display:flex; align-items:flex-start; gap:16px; margin-bottom:16px; } +.fields-row .fields{ flex:1 1 auto; min-width:0; margin-bottom:0; } +.btn-recheck{ flex-shrink:0; white-space:nowrap; } +.fields{ display:flex; flex-wrap:wrap; gap:16px; } .fields > div{ flex:1 1 180px; min-width:160px; } .fields label{ font-size:11.5px; color:var(--t3); display:block; margin-bottom:6px; white-space:normal; } .fields input{ @@ -306,3 +314,11 @@ tr.editing td{ background:rgba(37,99,235,.03); } .resizer{ display:none; } .txn-col{ width:100%; } } +/* Mobile: the Recheck Balance button drops below the closing-balance + field instead of sitting beside the fields at the row's right edge - + 860px (the breakpoint above) still has plenty of width for both side + by side, so this is its own, narrower cutoff. */ +@media (max-width: 640px){ + .fields-row{ flex-direction:column; align-items:stretch; } + .btn-recheck{ align-self:flex-end; } +} diff --git a/frontend/src/components/TransactionsTable.vue b/frontend/src/components/TransactionsTable.vue index 4df5857..87f42ff 100644 --- a/frontend/src/components/TransactionsTable.vue +++ b/frontend/src/components/TransactionsTable.vue @@ -19,10 +19,11 @@ * again by applyCheckResults, while closingCalc's text IS recomputed on * every recheck). */ -import { computed } from 'vue' +import { ref, computed } from 'vue' import { useExtractionStore } from '../stores/extractionStore' import { useUiStore } from '../stores/uiStore' import { fmtMoney } from '../services/formatService' +import * as extractionService from '../services/extractionService' import TransactionRow from './TransactionRow.vue' const extractionStore = useExtractionStore() @@ -42,6 +43,36 @@ const closingCalcText = computed(() => { }) const toggleLabel = computed(() => (uiStore.pdfColHidden ? 'Show Source Doc' : 'Hide Source Doc')) + +// ── Balance recheck ────────────────────────────────────────────────── +// Entering opening/closing balance AFTER extraction (e.g. the user +// forgot to type it before clicking Extract) doesn't update anything on +// its own - typing alone was never wired to a recheck, same as the +// original vanilla-JS version (it only rechecked on a row save or a +// download). This button is the explicit, deliberate trigger - same +// recheck-only (no re-extraction) call a row Save already makes. +const rechecking = ref(false) + +async function handleRecheck() { + if (!result.value || rechecking.value) return + rechecking.value = true + extractionStore.clearError() + try { + const checkResult = await extractionService.recheck( + result.value, + extractionStore.effectiveOpeningBalance, + extractionStore.effectiveClosingBalance, + ) + if (checkResult.error) { + extractionStore.setError(checkResult.error) + } else { + extractionStore.applyCheckResults(checkResult) + } + } catch (e) { + extractionStore.setError('Network error: ' + e.message) + } + rechecking.value = false +}