diff --git a/app/routes/accounts.py b/app/routes/accounts.py
index d204c6d..02d69fe 100644
--- a/app/routes/accounts.py
+++ b/app/routes/accounts.py
@@ -83,12 +83,21 @@ def index():
).group_by(Transaction.account_id).all()
monthly_charges = {row[0]: float(row[1]) for row in rows}
+ # Teller account mapping: pfm_account_id → TellerAccount
+ from app.models.teller_enrollment import TellerAccount
+ teller_accounts = TellerAccount.query.filter(
+ TellerAccount.pfm_account_id.in_([a.id for a in all_accounts]),
+ TellerAccount.is_active == True,
+ ).all()
+ teller_map = {ta.pfm_account_id: ta for ta in teller_accounts}
+
return render_template('accounts/index.html',
accounts=accounts,
tab=tab,
bank_count=len(bank_accounts),
credit_count=len(credit_accounts),
- monthly_charges=monthly_charges)
+ monthly_charges=monthly_charges,
+ teller_map=teller_map)
@accounts_bp.route('/new', methods=['GET', 'POST'])
diff --git a/app/routes/teller.py b/app/routes/teller.py
index 7c62b3e..d9d338e 100644
--- a/app/routes/teller.py
+++ b/app/routes/teller.py
@@ -294,6 +294,9 @@ def full_resync(teller_account_id):
f'Next sync will fetch the last 90 days — duplicates will be skipped automatically.',
'info'
)
+ next_url = request.form.get('next', '')
+ if next_url and next_url.startswith('/'):
+ return redirect(next_url)
return redirect(url_for('teller.index'))
diff --git a/app/templates/accounts/index.html b/app/templates/accounts/index.html
index 85812ef..8579892 100644
--- a/app/templates/accounts/index.html
+++ b/app/templates/accounts/index.html
@@ -25,6 +25,7 @@
{% if accounts %}
+
{{ acct.balance | currency }}
{% endif %}
{% if tab == 'credit' %}
-
{% set owed = [0, -acct.balance] | max %}
{% set charges = monthly_charges.get(acct.id, 0) %}
Amount Owed
-
+
{% if owed > 0 %}-{% endif %}{{ owed | currency }}
@@ -85,7 +90,7 @@
{{ acct.notes }}
{% endif %}
-
+
{% if tab == 'credit' %}
{% endfor %}
@@ -137,3 +173,61 @@
{% endif %}
{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
diff --git a/app/templates/teller/index.html b/app/templates/teller/index.html
index 2f5cdbf..d59e47d 100644
--- a/app/templates/teller/index.html
+++ b/app/templates/teller/index.html
@@ -3,15 +3,6 @@
{% block page_title %}Bank Connections{% endblock %}
{% block topbar_actions %}
-{% if enrollments %}
-
-{% endif %}
Connect a Bank
@@ -29,88 +20,45 @@
{{ enrollment.institution_name or 'Unknown Bank' }}
- Connected {{ enrollment.created_at.strftime('%b %d, %Y') }} ·
- Last synced: {{ enrollment.last_synced_at.strftime('%b %d, %H:%M') if enrollment.last_synced_at else 'Never' }}
+ Connected {{ enrollment.created_at.strftime('%b %d, %Y') }}
+ {% if enrollment.last_synced_at %}
+ · Last synced {{ enrollment.last_synced_at.strftime('%b %d, %H:%M') }}
+ {% endif %}
{% for ta in accounts %}
-
-
+
+
-
-
- {{ ta.account_name }}
- {% if ta.pfm_account %}
- {# Balance display — updated in-place by refreshBalance() #}
-
- {{ ta.pfm_account.balance | currency }}
-
- {% if ta.last_sync_date %}
-
- synced {{ ta.last_sync_date.strftime('%b %d') }}
-
- {% endif %}
- {% endif %}
-
+
+
{{ ta.account_name }}
{{ ta.account_subtype | replace('_',' ') | title }}
{% if ta.pfm_account %}
- · {{ ta.pfm_account.name }}
+ · linked to {{ ta.pfm_account.name }}
{% else %}
- · Not mapped
+ · Not mapped
{% endif %}
-
+ {% if not ta.pfm_account %}
+
Map Account
+ {% endif %}
{% endfor %}
-
-
- {% if accounts | selectattr('pfm_account_id') | list %}
-
-
-
- {% endif %}
{% endfor %}
@@ -121,6 +69,7 @@
No banks connected
Connect your US bank accounts to automatically sync transactions and balances.
+ Once connected, use the Accounts page to sync transactions and refresh balances.
Connect a Bank
@@ -178,7 +127,6 @@ function initTellerConnect(btn) {
'Content-Type': 'application/json',
'X-CSRFToken': CSRF,
},
- // Send full Teller payload: { accessToken, user, enrollment }
body: JSON.stringify(enrollment),
})
.then(r => r.json())
@@ -197,9 +145,7 @@ function initTellerConnect(btn) {
btn.innerHTML = ' Connect a Bank';
});
},
- onExit: function() {
- console.log('Teller Connect closed');
- },
+ onExit: function() {},
onFailure: function(error) {
alert('Connection failed: ' + error.message);
},
@@ -210,60 +156,5 @@ function initTellerConnect(btn) {
initTellerConnect(document.getElementById('tellerConnectBtn'));
initTellerConnect(document.getElementById('tellerConnectBtn2'));
-
-function refreshBalance(taId, btn) {
- btn.disabled = true;
- btn.innerHTML = ' ';
-
- fetch('/teller/balance/' + taId, {
- method: 'POST',
- headers: { 'X-CSRFToken': CSRF },
- })
- .then(r => r.json())
- .then(data => {
- btn.disabled = false;
- btn.innerHTML = ' ';
-
- if (data.balance != null || data.available != null) {
- const sym = '{{ current_user.currency_symbol }}';
- const fmt = v => {
- const n = parseFloat(v);
- const abs = Math.abs(n).toLocaleString(undefined, {minimumFractionDigits:2, maximumFractionDigits:2});
- return (n < 0 ? '-' : '') + sym + abs;
- };
-
- // 'balance' is the correct value for the account type (ledger for credit cards,
- // available for bank accounts). Fall back to 'available' for older responses.
- const displayVal = data.balance != null ? data.balance : data.available;
-
- // Update inline balance display
- const balEl = document.getElementById('bal-' + taId);
- if (balEl) {
- balEl.textContent = fmt(displayVal);
- balEl.style.color = displayVal < 0 ? '#ef4444' : '#10b981';
- setTimeout(() => balEl.style.color = '', 2500);
- }
-
- // Show available vs ledger in button tooltip
- const ledgerNote = (data.ledger !== data.available)
- ? ` · Ledger: ${fmt(data.ledger)}`
- : '';
- btn.title = `Available: ${fmt(data.available)}${ledgerNote} — updated just now`;
- btn.style.color = '#10b981';
- setTimeout(() => { btn.style.color = ''; btn.title = 'Pull live balance from bank'; }, 3000);
- } else {
- btn.title = data.error || 'Refresh failed';
- btn.style.color = '#ef4444';
- setTimeout(() => { btn.style.color = ''; btn.title = 'Pull live balance from bank'; }, 4000);
- }
- })
- .catch(() => {
- btn.disabled = false;
- btn.innerHTML = ' ';
- btn.title = 'Network error — try again';
- btn.style.color = '#ef4444';
- setTimeout(() => { btn.style.color = ''; btn.title = 'Pull live balance from bank'; }, 4000);
- });
-}
{% endblock %}