feat: Add /sync-bank endpoint to trigger bank sync and inference from web UI
Adds a new GET /sync-bank route that runs sync_to_sheets (2026) + infer_payments + flush_cache, capturing all output and displaying it on a styled results page. Adds "Tools: [Sync Bank Data]" nav link to all templates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -464,6 +464,10 @@
|
||||
<a href="/reconcile-juniors">[Junior Payment Reconciliation]</a>
|
||||
<a href="/payments">[Payments Ledger]</a>
|
||||
</div>
|
||||
<div class="nav-archived">
|
||||
<span style="color: #666; margin-right: 5px;">Tools:</span>
|
||||
<a href="/sync-bank">[Sync Bank Data]</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1>Adults Dashboard</h1>
|
||||
@@ -503,7 +507,7 @@
|
||||
{{ cell.text }}
|
||||
{% if cell.status == 'unpaid' or cell.status == 'partial' %}
|
||||
<button class="pay-btn"
|
||||
onclick="showPayQR('{{ row.name|e }}', {{ cell.amount }}, '{{ cell.month|e }}')">Pay</button>
|
||||
onclick="showPayQR('{{ row.name|e }}', {{ cell.amount }}, '{{ cell.month|e }}', '{{ cell.raw_month }}')">Pay</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
@@ -511,7 +515,7 @@
|
||||
{{ "%+d"|format(row.balance) if row.balance != 0 else "0" }}
|
||||
{% if row.balance < 0 %}
|
||||
<button class="pay-btn"
|
||||
onclick="showPayQR('{{ row.name|e }}', {{ -row.balance }}, '{{ row.unpaid_periods|e }}')">Pay All</button>
|
||||
onclick="showPayQR('{{ row.name|e }}', {{ -row.balance }}, '{{ row.unpaid_periods|e }}', '{{ row.raw_unpaid_periods|e }}')">Pay All</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -857,9 +861,13 @@
|
||||
showMemberDetails(nextName);
|
||||
}
|
||||
}
|
||||
function showPayQR(name, amount, month) {
|
||||
function showPayQR(name, amount, month, rawMonth) {
|
||||
const account = "{{ bank_account }}";
|
||||
const message = `${name} / ${month}`;
|
||||
// Convert YYYY-MM to MM/YYYY for infer_payments.py compatibility
|
||||
const numericMonth = rawMonth.includes('+')
|
||||
? rawMonth.split('+').map(p => p.replace(/(\d{4})-(\d{2})/, '$2/$1')).join('+')
|
||||
: rawMonth.replace(/(\d{4})-(\d{2})/, '$2/$1');
|
||||
const message = `${name} / ${numericMonth}`;
|
||||
const qrTitle = document.getElementById('qrTitle');
|
||||
const qrImg = document.getElementById('qrImg');
|
||||
const qrAccount = document.getElementById('qrAccount');
|
||||
|
||||
Reference in New Issue
Block a user