Files
Personal-Finance-Management/app/templates/base.html
T
2026-05-31 23:11:13 -04:00

348 lines
14 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{% block title %}PFM{% endblock %} — Personal Finance</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=DM+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>
<style>
:root {
--sidebar-width: 240px;
--sidebar-col-width: 64px;
--sidebar-bg: #0f172a;
--sidebar-text: #94a3b8;
--sidebar-text-active: #f1f5f9;
--sidebar-hover: #1e293b;
--sidebar-active: #1e3a5f;
--accent: #3b82f6;
--topbar-h: 56px;
--body-bg: #f1f5f9;
--card-bg: #ffffff;
--text: #0f172a;
--muted: #64748b;
--border: #e2e8f0;
--income: #10b981;
--expense: #ef4444;
--invest: #3b82f6;
--trans: all 0.2s cubic-bezier(.4,0,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'DM Sans', sans-serif; background: var(--body-bg); color: var(--text); margin: 0; overflow-x: hidden; font-size: 14px; }
/* SIDEBAR */
#sidebar {
position: fixed; top: 0; left: 0; height: 100vh;
width: var(--sidebar-width); background: var(--sidebar-bg);
display: flex; flex-direction: column; z-index: 1040;
transition: var(--trans); overflow: hidden;
}
#sidebar.collapsed { width: var(--sidebar-col-width); }
.sb-brand {
display: flex; align-items: center; gap: 10px;
padding: 0 16px; height: var(--topbar-h);
border-bottom: 1px solid #1e293b; flex-shrink: 0; overflow: hidden;
}
.sb-brand .b-icon {
width: 32px; height: 32px; background: var(--accent);
border-radius: 8px; display: flex; align-items: center;
justify-content: center; flex-shrink: 0; color: #fff; font-size: 16px;
}
.sb-brand .b-text { font-size: 15px; font-weight: 600; color: var(--sidebar-text-active); white-space: nowrap; transition: var(--trans); }
#sidebar.collapsed .b-text { opacity: 0; width: 0; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.sb-section {
font-size: 10px; font-weight: 600; letter-spacing: .1em;
text-transform: uppercase; color: #475569;
padding: 14px 20px 4px; white-space: nowrap; transition: var(--trans);
}
#sidebar.collapsed .sb-section { opacity: 0; }
.sb-link {
display: flex; align-items: center; gap: 12px;
padding: 9px 16px; color: var(--sidebar-text);
text-decoration: none; font-size: 13.5px;
border-radius: 6px; margin: 1px 8px;
white-space: nowrap; overflow: hidden; transition: var(--trans); position: relative;
}
.sb-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sb-link.active { background: var(--sidebar-active); color: var(--sidebar-text-active); font-weight: 500; }
.sb-link.active::before {
content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
width: 3px; height: 60%; background: var(--accent); border-radius: 0 2px 2px 0;
}
.sb-link i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sb-link .lt { transition: var(--trans); }
#sidebar.collapsed .sb-link .lt { opacity: 0; width: 0; overflow: hidden; }
.sb-footer { padding: 8px; border-top: 1px solid #1e293b; flex-shrink: 0; }
/* TOPBAR */
#topbar {
position: fixed; top: 0; right: 0;
left: var(--sidebar-width); height: var(--topbar-h);
background: var(--card-bg); border-bottom: 1px solid var(--border);
display: flex; align-items: center; padding: 0 20px;
z-index: 1030; gap: 12px; transition: var(--trans);
}
#sidebar.collapsed ~ #topbar { left: var(--sidebar-col-width); }
.tb-toggle {
background: none; border: none; color: var(--muted);
font-size: 18px; cursor: pointer; padding: 4px 6px;
border-radius: 6px; line-height: 1; transition: var(--trans);
}
.tb-toggle:hover { background: var(--border); color: var(--text); }
.tb-title { font-size: 15px; font-weight: 600; flex: 1; }
.tb-right { display: flex; align-items: center; gap: 8px; }
/* MAIN */
#main {
margin-left: var(--sidebar-width);
margin-top: var(--topbar-h);
padding: 24px;
min-height: calc(100vh - var(--topbar-h));
transition: var(--trans);
}
#sidebar.collapsed ~ #main { margin-left: var(--sidebar-col-width); }
/* CARDS */
.pcard { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.pcard-sm { padding: 16px; }
.pcard-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
/* STAT CARDS */
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.stat-card .stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat-card .stat-value { font-size: 24px; font-weight: 600; line-height: 1.2; margin-top: 4px; font-family: 'DM Mono', monospace; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
/* FLASH */
.flash-wrap {
position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px;
z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
/* BADGES */
.badge-income { background: #d1fae5; color: #065f46; }
.badge-expense { background: #fee2e2; color: #991b1b; }
.badge-transfer { background: #dbeafe; color: #1e40af; }
/* UTILITIES */
.text-income { color: var(--income) !important; }
.text-expense { color: var(--expense) !important; }
.text-invest { color: var(--invest) !important; }
.mono { font-family: 'DM Mono', monospace; }
/* TABLE */
.pfm-table { width: 100%; border-collapse: collapse; }
.pfm-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pfm-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pfm-table tbody tr:hover { background: #f8fafc; }
.pfm-table tbody tr:last-child td { border-bottom: none; }
/* RESPONSIVE */
@media (max-width: 768px) {
#sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
#sidebar.mob-open { transform: translateX(0); }
#topbar, #sidebar.collapsed ~ #topbar { left: 0 !important; }
#main, #sidebar.collapsed ~ #main { margin-left: 0 !important; }
}
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1039; }
.sb-overlay.on { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
{% block extra_css %}{% endblock %}
</style>
</head>
<body>
<div class="sb-overlay" id="sbOverlay"></div>
<!-- SIDEBAR -->
<nav id="sidebar">
<div class="sb-brand">
<div class="b-icon"><i class="bi bi-currency-exchange"></i></div>
<span class="b-text">PFM</span>
</div>
<div class="sb-nav">
<a
href="{{ url_for('dashboard.index') }}"
class="sb-link {% if request.endpoint == 'dashboard.index' %}active{% endif %}"
>
<i class="bi bi-grid-1x2"></i><span class="lt">Dashboard</span>
</a>
<div class="sb-section">Money</div>
<a
href="{{ url_for('transactions.index') }}"
class="sb-link {% if request.blueprint == 'transactions' %}active{% endif %}"
>
<i class="bi bi-arrow-left-right"></i
><span class="lt">Transactions</span>
</a>
<a
href="{{ url_for('transactions.new', type='income') }}"
class="sb-link"
>
<i class="bi bi-arrow-down-circle"></i
><span class="lt">Add Income</span>
</a>
<a
href="{{ url_for('transactions.new', type='expense') }}"
class="sb-link"
>
<i class="bi bi-arrow-up-circle"></i
><span class="lt">Add Expense</span>
</a>
<a
href="{{ url_for('accounts.index') }}"
class="sb-link {% if request.blueprint == 'accounts' %}active{% endif %}"
>
<i class="bi bi-wallet2"></i><span class="lt">Accounts</span>
</a>
<div class="sb-section">Planning</div>
<a
href="{{ url_for('budgets.index') }}"
class="sb-link {% if request.blueprint == 'budgets' %}active{% endif %}"
>
<i class="bi bi-pie-chart"></i><span class="lt">Budgets</span>
</a>
<a
href="{{ url_for('goals.index') }}"
class="sb-link {% if request.blueprint == 'goals' %}active{% endif %}"
>
<i class="bi bi-bullseye"></i><span class="lt">Goals</span>
</a>
<div class="sb-section">Growth</div>
<a
href="{{ url_for('investments.index') }}"
class="sb-link {% if request.blueprint == 'investments' %}active{% endif %}"
>
<i class="bi bi-graph-up-arrow"></i
><span class="lt">Investments</span>
</a>
<a
href="{{ url_for('reports.index') }}"
class="sb-link {% if request.blueprint == 'reports' %}active{% endif %}"
>
<i class="bi bi-file-earmark-bar-graph"></i
><span class="lt">Reports</span>
</a>
<div class="sb-section">AI</div>
<a
href="{{ url_for('ai.index') }}"
class="sb-link {% if request.blueprint == 'ai' %}active{% endif %}"
>
<i class="bi bi-stars"></i><span class="lt">AI Assistant</span>
</a>
</div>
<div class="sb-footer">
<a
href="{{ url_for('categories.index') }}"
class="sb-link {% if request.blueprint == 'categories' %}active{% endif %}"
>
<i class="bi bi-tags"></i><span class="lt">Categories</span>
</a>
<a
href="{{ url_for('settings.index') }}"
class="sb-link {% if request.blueprint == 'settings' %}active{% endif %}"
>
<i class="bi bi-gear"></i><span class="lt">Settings</span>
</a>
<a href="{{ url_for('auth.logout') }}" class="sb-link">
<i class="bi bi-box-arrow-right"></i><span class="lt">Logout</span>
</a>
</div>
</nav>
<!-- TOPBAR -->
<header id="topbar">
<button class="tb-toggle" id="sbToggle">
<i class="bi bi-list"></i>
</button>
<span class="tb-title">{% block page_title %}{% endblock %}</span>
<div class="tb-right">
{% block topbar_actions %}{% endblock %}
<span class="d-none d-sm-inline small text-muted mono"
>{{ current_user.display_name or current_user.username }}</span
>
</div>
</header>
<!-- FLASH -->
<div class="flash-wrap">
{% with messages = get_flashed_messages(with_categories=true) %} {% for
cat, msg in messages %}
<div
class="alert alert-{{ 'danger' if cat == 'error' else cat }} alert-dismissible fade show shadow-sm mb-0 py-2 px-3"
style="font-size: 13px; border-radius: 8px"
role="alert"
>
{{ msg }}<button
type="button"
class="btn-close"
style="padding: 0.4rem"
data-bs-dismiss="alert"
></button>
</div>
{% endfor %} {% endwith %}
</div>
<!-- MAIN -->
<main id="main">{% block content %}{% endblock %}</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
(function () {
const sb = document.getElementById("sidebar");
const overlay = document.getElementById("sbOverlay");
const KEY = "pfm_sb";
const mob = () => window.innerWidth < 769;
if (!mob() && localStorage.getItem(KEY) === "1")
sb.classList.add("collapsed");
document
.getElementById("sbToggle")
.addEventListener("click", function () {
if (mob()) {
sb.classList.toggle("mob-open");
overlay.classList.toggle("on");
} else {
sb.classList.toggle("collapsed");
localStorage.setItem(
KEY,
sb.classList.contains("collapsed") ? "1" : "0",
);
}
});
overlay.addEventListener("click", function () {
sb.classList.remove("mob-open");
overlay.classList.remove("on");
});
document.querySelectorAll(".flash-wrap .alert").forEach(function (el) {
setTimeout(function () {
bootstrap.Alert.getOrCreateInstance(el).close();
}, 4500);
});
})();
</script>
{% block extra_js %}{% endblock %}
</body>
</html>