140 lines
7.4 KiB
HTML
140 lines
7.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Accounts{% endblock %}
|
|
{% block page_title %}Accounts{% endblock %}
|
|
|
|
{% block topbar_actions %}
|
|
<a href="{{ url_for('accounts.new') }}" class="btn btn-sm btn-primary" style="font-size:12px;"><i class="bi bi-plus-lg me-1"></i>New Account</a>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<!-- Tabs -->
|
|
<div class="d-flex gap-1 mb-3">
|
|
<a href="{{ url_for('accounts.index', tab='bank') }}"
|
|
class="btn btn-sm {% if tab=='bank' %}btn-primary{% else %}btn-outline-secondary{% endif %}" style="font-size:13px;">
|
|
<i class="bi bi-bank me-1"></i>Bank Accounts
|
|
<span class="badge ms-1" style="font-size:10px;background:{% if tab=='bank' %}rgba(255,255,255,.25){% else %}#e2e8f0;color:#475569{% endif %};">{{ bank_count }}</span>
|
|
</a>
|
|
<a href="{{ url_for('accounts.index', tab='credit') }}"
|
|
class="btn btn-sm {% if tab=='credit' %}btn-danger{% else %}btn-outline-secondary{% endif %}" style="font-size:13px;">
|
|
<i class="bi bi-credit-card me-1"></i>Credit Cards
|
|
<span class="badge ms-1" style="font-size:10px;background:{% if tab=='credit' %}rgba(255,255,255,.25){% else %}#fee2e2;color:#991b1b{% endif %};">{{ credit_count }}</span>
|
|
</a>
|
|
</div>
|
|
|
|
{% if accounts %}
|
|
<div class="row g-3">
|
|
{% for acct in accounts %}
|
|
<div class="col-12 col-md-6 col-xl-4">
|
|
<div class="pcard" style="border-left: 4px solid {{ acct.color }};">
|
|
|
|
<!-- Header: icon + name + menu -->
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="d-flex align-items-center gap-2">
|
|
<div style="width:36px;height:36px;border-radius:9px;background:{{ acct.color }}22;color:{{ acct.color }};display:flex;align-items:center;justify-content:center;font-size:18px;">
|
|
<i class="bi {{ acct.icon }}"></i>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight:600;font-size:14px;">{{ acct.name }}</div>
|
|
<div style="font-size:11px;color:var(--muted);">{{ acct.account_type | replace('_',' ') | title }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="dropdown">
|
|
<button class="btn btn-sm" style="background:none;border:none;color:var(--muted);padding:2px 6px;" data-bs-toggle="dropdown"><i class="bi bi-three-dots"></i></button>
|
|
<ul class="dropdown-menu dropdown-menu-end" style="font-size:13px;">
|
|
<li><a class="dropdown-item" href="{{ url_for('accounts.edit', id=acct.id) }}"><i class="bi bi-pencil me-2"></i>Edit</a></li>
|
|
<li><a class="dropdown-item" href="{{ url_for('accounts.adjust_balance', id=acct.id) }}"><i class="bi bi-sliders me-2"></i>Adjust Balance</a></li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li>
|
|
<form method="POST" action="{{ url_for('accounts.delete', id=acct.id) }}" onsubmit="return confirm('Remove this account?')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="dropdown-item text-danger"><i class="bi bi-trash me-2"></i>Remove</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{% if tab == 'bank' %}
|
|
<div class="mono {% if acct.balance >= 0 %}text-income{% else %}text-expense{% endif %}" style="font-size:26px;font-weight:700;margin-top:12px;">
|
|
{{ acct.balance | currency }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if tab == 'credit' %}
|
|
<!-- Amount Owed + Monthly Charges -->
|
|
{% set owed = [0, -acct.balance] | max %}
|
|
{% set charges = monthly_charges.get(acct.id, 0) %}
|
|
<div class="d-flex gap-3 mt-3">
|
|
<div style="flex:1;background:#fff5f5;border-radius:8px;padding:10px 12px;">
|
|
<div style="font-size:10px;color:#991b1b;font-weight:600;text-transform:uppercase;letter-spacing:.04em;margin-bottom:2px;">Amount Owed</div>
|
|
<div class="mono {% if owed > 0 %}text-expense{% else %}" style="color:#10b981;{% endif %}font-size:20px;font-weight:700;">
|
|
{% if owed > 0 %}-{% endif %}{{ owed | currency }}
|
|
</div>
|
|
</div>
|
|
<div style="flex:1;background:#fafafa;border-radius:8px;padding:10px 12px;">
|
|
<div style="font-size:10px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.04em;margin-bottom:2px;">This Month</div>
|
|
<div class="mono text-expense" style="font-size:20px;font-weight:700;">
|
|
{% if charges > 0 %}-{% endif %}{{ charges | currency }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if acct.notes %}
|
|
<div style="font-size:12px;color:var(--muted);margin-top:10px;">{{ acct.notes }}</div>
|
|
{% endif %}
|
|
|
|
<!-- Action buttons -->
|
|
{% if tab == 'credit' %}
|
|
<div class="d-flex gap-2 mt-3">
|
|
<a href="{{ url_for('transactions.transfer', to_account_id=acct.id, description='Credit Card Payment — ' ~ acct.name) }}"
|
|
class="btn btn-sm flex-fill btn-danger" style="font-size:12px;">
|
|
<i class="bi bi-send me-1"></i>Pay Card
|
|
</a>
|
|
<a href="{{ url_for('transactions.index', tab='expense', account_id=acct.id) }}"
|
|
class="btn btn-sm flex-fill btn-outline-secondary" style="font-size:12px;">
|
|
<i class="bi bi-list-ul me-1"></i>Charges
|
|
</a>
|
|
<a href="{{ url_for('transactions.new', type='expense') }}"
|
|
class="btn btn-sm" style="font-size:12px;background:#f1f5f9;color:#475569;border:none;" title="Add Charge">
|
|
<i class="bi bi-plus-lg"></i>
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
<div class="d-flex gap-2 mt-3">
|
|
<a href="{{ url_for('transactions.index', tab='expense', account_id=acct.id) }}"
|
|
class="btn btn-sm flex-fill btn-outline-secondary" style="font-size:12px;">
|
|
<i class="bi bi-list-ul me-1"></i>Transactions
|
|
</a>
|
|
<a href="{{ url_for('transactions.new', type='income') }}"
|
|
class="btn btn-sm flex-fill" style="font-size:12px;background:#d1fae5;color:#065f46;border:none;">
|
|
<i class="bi bi-plus-lg me-1"></i>Add Income
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% else %}
|
|
<div class="pcard text-center py-5">
|
|
{% if tab == 'credit' %}
|
|
<i class="bi bi-credit-card text-muted" style="font-size:3rem;"></i>
|
|
<h5 class="mt-3 mb-1">No credit cards yet</h5>
|
|
<p class="text-muted small mb-3">Add a credit card account to track charges and payments.</p>
|
|
{% else %}
|
|
<i class="bi bi-bank text-muted" style="font-size:3rem;"></i>
|
|
<h5 class="mt-3 mb-1">No bank accounts yet</h5>
|
|
<p class="text-muted small mb-3">Add your checking, savings, or cash accounts.</p>
|
|
{% endif %}
|
|
<a href="{{ url_for('accounts.new') }}" class="btn btn-primary btn-sm">
|
|
<i class="bi bi-plus-lg me-1"></i>New Account
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|