Fix AI chatbot role mapping, add markdown formatting, update system prompts, and handle OpenRouter API errors

This commit is contained in:
Atharv1705
2026-07-20 12:14:58 +05:30
parent 756547a22c
commit c2e22902c8
168 changed files with 11556 additions and 2 deletions
+123
View File
@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>About Us — BookKeepro</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/base.css?v=4">
<link rel="stylesheet" href="/css/components.css?v=4">
<link rel="stylesheet" href="/css/marketing.css?v=4">
<script src="/js/theme.js?v=2"></script>
</head>
<body>
<!-- NAVBAR -->
{% include 'partials/navbar.html' %}
<!-- HERO -->
<div class="page-hero">
<div>
<h1>About Us</h1>
<p>Our People Are Passionate About What We Do</p>
</div>
</div>
<!-- CONTENT -->
<div class="about-wrapper">
<div class="about-block">
<div class="about-text">
<h2>Who We Are</h2>
<p>
Our journey began in 1998 as a Chartered Accountant firm in India,
built on strong fundamentals of accounting, compliance, integrity,
and long-term client relationships.
</p>
<br>
<p>
In 2018, we strengthened our presence in Pune & Mumbai — transitioning
from a traditional CA practice into a scalable financial services
organization.
</p>
</div>
<img class="about-img"
src="./images/about-us-block-1.webp"
alt="Bookkeepro Team">
</div>
<div class="about-block reverse">
<div class="about-text">
<h2>About Bookkeepro</h2>
<p>
As our client base expanded globally — especially across the US — we aligned
our operating model to support international growth.
</p>
<br>
<p>
In 2023, we launched:
<br><br>
<b>• Bookkeeping Business Solutions Pvt Ltd (India)</b><br>
<b>• Bookkeeping Business Solutions LLC (USA)</b>
</p>
<br>
<p>
Today, Bookkeepro serves global businesses, startups & enterprises with
scalable, compliant bookkeeping and financial operations support.
</p>
</div>
<img class="about-img"
src="./images/about-us-block-2.webp"
alt="About Bookkeepro">
</div>
</div>
<div class="about-block" style="width:min(1200px,92%);margin:auto;">
<div class="about-text">
<h2>Who We Are Today</h2>
<p>
✔️ 25+ years of accounting & compliance expertise<br>
✔️ Operations across India & USA<br>
✔️ Secure, process-driven financial workflows<br>
✔️ Strong confidentiality & data protection practices
</p>
<br>
<p>
We help businesses build financial clarity, compliance confidence,
and operational efficiency.
</p>
</div>
<img class="about-img"
src="./images/Gemini_Generated_Image_5pqvpl5pqvpl5pqv.webp"
alt="Global Bookkeepro Team">
</div>
<!-- FOOTER -->
{% include 'partials/footer.html' %}
<script>
function toggleMenu(){
document.getElementById("navMenu").classList.toggle("active");
}
</script>
</body>
</html>
+350
View File
@@ -0,0 +1,350 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Admin Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
rel="stylesheet" />
<link rel="stylesheet" href="/css/base.css" />
<link rel="stylesheet" href="/css/components.css" />
<link rel="stylesheet" href="/css/animations.css" />
<link rel="stylesheet" href="/css/chatbot.css" />
<style>
.users-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
margin-top: 20px;
}
</style>
<style>
html {
height: 100%;
}
</style>
<script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="window.location.href='/admin-dashboard'"
alt="BookKeepPro" />
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-secondary btn-sm" onclick="window.location.href='/profile'">My Profile</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main-wide page-enter">
<!-- Stats Row -->
<div class="stat-row" id="statRow" style="margin-bottom:24px;"></div>
<!-- Heading + Search -->
<div class="flex-between" style="flex-wrap:wrap;gap:12px;margin-bottom:8px;">
<div>
<div style="display:flex; gap: 16px; margin-bottom: 4px; align-items: baseline;">
<h1 id="tabUsersBtn" style="cursor:pointer;" onclick="switchAdminTab('users')">Users</h1>
<h1 id="tabTemplatesBtn" style="cursor:pointer; color: var(--muted);" onclick="switchAdminTab('templates')" class="super-admin-only">Templates</h1>
</div>
<p class="text-muted" id="userCount" style="font-size:13px;"></p>
</div>
<div class="search-bar" id="userSearchDiv">
<span class="search-icon"></span>
<input type="text" id="searchInput" placeholder="Search by name or email…" oninput="filterUsers()" />
</div>
</div>
<div id="usersTab" class="admin-tab">
<div id="users" class="users-grid">
<div class="empty-state" style="grid-column:1/-1;">
<div class="empty-icon"><span class="material-symbols-outlined">pending</span></div>
<div class="empty-title">Loading users…</div>
</div>
</div>
</div>
<div id="templatesTab" class="admin-tab" style="display:none;">
<div class="card">
<h3>Manage Required Templates</h3>
<p class="text-sm">Upload new templates for users to download.</p>
<div style="margin-top: 20px; display:flex; gap: 12px; flex-wrap: wrap;">
<select id="tplCategory" class="select-input" style="width: auto;" onchange="loadAdminTemplates()">
<option value="personal">Personal</option>
<option value="business">Business</option>
</select>
<select id="tplYear" class="select-input" style="width: auto;" onchange="loadAdminTemplates()"></select>
<button class="btn btn-secondary btn-sm" onclick="loadAdminTemplates()">Load Templates</button>
</div>
<div id="tplList" style="margin-top: 20px;"></div>
<hr style="margin: 20px 0;">
<h4>Upload New Template</h4>
<form id="tplForm" onsubmit="handleTplUpload(event)" style="display:flex; flex-direction: column; gap: 12px; margin-top: 12px; max-width: 400px;">
<input type="text" id="tplName" class="input" placeholder="Template Name (e.g. Individual Tax Organizer)" required />
<input type="file" id="tplFile" class="input" accept=".pdf,.doc,.docx" />
<button type="submit" class="btn btn-primary">Upload Template</button>
</form>
</div>
</div>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
<small>© 2026 Bookkeeping Business Solutions</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/spinner.js"></script>
<script>
const token = localStorage.getItem("token");
const role = localStorage.getItem("role");
const isSuperAdmin = role === "super_admin";
if (!token || (role !== "admin" && role !== "super_admin")) window.location.href = "/login";
initSessionWarning();
let allUsers = [];
async function changeRole(userId, selectEl, btnEl) {
const newRole = selectEl.value;
btnEl.disabled = true; btnEl.textContent = "Saving…";
const res = await authFetch(`/api/auth/admin/users/${userId}/role`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ role: newRole }) });
if (!res) return;
if (!res.ok) { const e = await res.json().catch(() => { }); showToast(e?.detail || "Role change failed", "error"); btnEl.disabled = false; btnEl.textContent = "Save"; return; }
const data = await res.json();
showToast(data.message || "Role updated", "success");
const badge = selectEl.closest(".user-card")?.querySelector(".role-badge");
if (badge) { badge.textContent = newRole; badge.className = `badge badge-${newRole === "admin" ? "orange" : "blue"} role-badge`; }
btnEl.disabled = false; btnEl.textContent = "Save";
}
function buildCard(u) {
const card = document.createElement("div");
card.className = "user-card stagger fade-up";
card.dataset.name = (u.name || "").toLowerCase();
card.dataset.email = (u.email || "").toLowerCase();
const canEditRole = isSuperAdmin && u.role !== "super_admin";
const myUserId = parseInt(localStorage.getItem("user_id") || "0");
const isSelf = u.id === myUserId;
let roleSection = "";
if (canEditRole && !isSelf) {
roleSection = `
<div class="role-controls" onclick="event.stopPropagation()">
<select class="role-select" id="rs-${u.id}">
<option value="user" ${u.role === "user" ? "selected" : ""}>User</option>
<option value="admin" ${u.role === "admin" ? "selected" : ""}>Admin</option>
</select>
<button class="role-save-btn" onclick="changeRole(${u.id},document.getElementById('rs-${u.id}'),this)">Save</button>
</div>`;
} else {
const cls = u.role === "super_admin" ? "badge-red" : u.role === "admin" ? "badge-orange" : "badge-blue";
roleSection = `<span class="badge ${cls} role-badge">${u.role}</span>`;
}
card.innerHTML = `
<div class="user-top">
<div class="user-avatar"></div>
<div class="user-info">
<div class="u-name"></div>
<div class="u-email"></div>
</div>
</div>
<div class="user-bottom">
${roleSection}
</div>
<div class="click-layer"></div>`;
card.querySelector(".user-avatar").textContent = (u.name || "U").charAt(0).toUpperCase();
card.querySelector(".u-name").textContent = u.name || "—";
card.querySelector(".u-email").textContent = u.email || "—";
if (u.pending_docs > 0) {
const badge = document.createElement("span");
badge.className = "badge badge-orange pulse"; badge.style.cursor = "default";
badge.textContent = `${u.pending_docs} pending`;
card.querySelector(".user-bottom").appendChild(badge);
}
card.addEventListener("click", () => window.location.href = `/admin-user-detail?user_id=${u.id}`);
return card;
}
function renderUsers(users) {
const container = document.getElementById("users");
container.innerHTML = "";
if (!users.length) {
container.innerHTML = `<div class="empty-state" style="grid-column:1/-1;"><div class="empty-icon"><span class="material-symbols-outlined">search</span></div><div class="empty-title">No users found</div><div class="empty-hint">Try a different search term.</div></div>`;
return;
}
users.forEach(u => container.appendChild(buildCard(u)));
}
function filterUsers() {
const q = document.getElementById("searchInput").value.toLowerCase().trim();
if (!q) { renderUsers(allUsers); return; }
renderUsers(allUsers.filter(u => u.name?.toLowerCase().includes(q) || u.email?.toLowerCase().includes(q)));
}
function buildStats(users) {
const total = users.length;
const pending = users.reduce((s, u) => s + (u.pending_docs || 0), 0);
const admins = users.filter(u => u.role === "admin" || u.role === "super_admin").length;
const row = document.getElementById("statRow");
row.innerHTML = `
<div class="stat-card accent-blue">
<div class="stat-icon"><span class="material-symbols-outlined">group</span></div>
<div class="stat-value">${total}</div>
<div class="stat-label">Total Users</div>
</div>
<div class="stat-card accent-orange">
<div class="stat-icon"><span class="material-symbols-outlined">pending</span></div>
<div class="stat-value">${pending}</div>
<div class="stat-label">Pending Docs</div>
</div>
<div class="stat-card">
<div class="stat-icon"><span class="material-symbols-outlined">security</span></div>
<div class="stat-value">${admins}</div>
<div class="stat-label">Admin Accounts</div>
</div>`;
}
async function loadUsers() {
const container = document.getElementById("users");
showSpinner(container);
try {
const res = await authFetch("/api/auth/admin/users");
if (!res) return;
const payload = await res.json();
allUsers = Array.isArray(payload) ? payload : (payload.users || []);
document.getElementById("userCount").textContent = `${allUsers.length} user${allUsers.length !== 1 ? "s" : ""}`;
buildStats(allUsers);
renderUsers(allUsers);
} catch (err) {
console.error(err);
container.innerHTML = `<div class="empty-state" style="grid-column:1/-1;"><div class="empty-icon"><span class="material-symbols-outlined">warning</span></div><div class="empty-title">Error loading users</div></div>`;
}
}
buildYearOptions("tplYear");
loadUsers();
if (!isSuperAdmin) {
document.querySelectorAll(".super-admin-only").forEach(el => el.style.display = 'none');
}
function switchAdminTab(tabName) {
document.getElementById('usersTab').style.display = tabName === 'users' ? 'block' : 'none';
document.getElementById('templatesTab').style.display = tabName === 'templates' ? 'block' : 'none';
document.getElementById('tabUsersBtn').style.color = tabName === 'users' ? 'var(--navy)' : 'var(--muted)';
document.getElementById('tabTemplatesBtn').style.color = tabName === 'templates' ? 'var(--navy)' : 'var(--muted)';
document.getElementById('userSearchDiv').style.display = tabName === 'users' ? 'flex' : 'none';
if (tabName === 'templates') {
loadAdminTemplates();
}
}
async function loadAdminTemplates() {
const category = document.getElementById("tplCategory").value;
const year = document.getElementById("tplYear").value;
const listDiv = document.getElementById("tplList");
showSpinner(listDiv);
try {
const res = await authFetch(`/api/upload/templates?category=${category}&tax_year=${year}`);
const data = await res.json();
hideSpinner(listDiv, "");
if (!data || data.length === 0) {
listDiv.innerHTML = `<p class="text-muted">No templates found for ${category} ${year}.</p>`;
return;
}
listDiv.innerHTML = data.map(t => `
<div class="card-flat" style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<div>
<h5 style="margin-bottom:4px;">${t.name}</h5>
${t.download ? `<a href="${t.download}" target="_blank" class="text-sm" style="color:var(--blue)">View File</a>` : `<span class="text-sm text-muted">No file</span>`}
</div>
<button class="btn btn-danger btn-sm" onclick="deleteTemplate(${t.id})">Delete</button>
</div>
`).join("");
} catch (e) {
hideSpinner(listDiv, `<p class="text-muted" style="color:var(--error);">Failed to load templates.</p>`);
}
}
async function handleTplUpload(e) {
e.preventDefault();
const btn = e.target.querySelector("button[type=submit]");
btn.disabled = true;
btn.textContent = "Uploading...";
const category = document.getElementById("tplCategory").value;
const year = document.getElementById("tplYear").value;
const name = document.getElementById("tplName").value;
const fileInput = document.getElementById("tplFile");
const fd = new FormData();
fd.append("category", category);
fd.append("tax_year", year);
fd.append("name", name);
if (fileInput.files.length > 0) fd.append("file", fileInput.files[0]);
try {
const res = await authFetch("/api/upload/admin/templates", {
method: "POST",
body: fd
});
if (res.ok) {
showToast("Template uploaded successfully", "success");
e.target.reset();
loadAdminTemplates();
} else {
const err = await res.json();
showToast(err.detail || "Upload failed", "error");
}
} catch (err) {
showToast("Error uploading template", "error");
}
btn.disabled = false;
btn.textContent = "Upload Template";
}
async function deleteTemplate(id) {
if (!confirm("Are you sure you want to delete this template?")) return;
try {
const res = await authFetch(`/api/upload/admin/templates/${id}`, { method: "DELETE" });
if (res.ok) {
showToast("Template deleted", "success");
loadAdminTemplates();
} else {
showToast("Failed to delete template", "error");
}
} catch (err) {
showToast("Error deleting template", "error");
}
}
</script>
<script src="/js/admin-chatbot.js"></script>
</body>
</html>
+456
View File
@@ -0,0 +1,456 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>BookKeepPro | User Detail</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<link rel="stylesheet" href="/css/chatbot.css"/>
<style>
.approval-row {
display:flex; align-items:flex-start; gap:16px;
padding:14px 0; border-bottom:1px solid var(--border);
}
.approval-row:last-child { border-bottom:none; }
.ar-left { flex:1; min-width:0; }
.ar-name { font-weight:600; font-size:13px; color:var(--navy); }
.ar-type { font-size:12px; color:var(--muted); margin-top:2px; }
.ar-note { font-size:12px; color:var(--warn); margin-top:3px; }
.ar-right { display:flex; align-items:center; gap:8px; flex-shrink:0; flex-wrap:wrap; }
.chk-approve { accent-color:var(--success); width:16px; height:16px; cursor:pointer; }
.chk-reject { accent-color:var(--error); width:16px; height:16px; cursor:pointer; }
.chk-label { font-size:12px; font-weight:600; cursor:pointer; }
.panel-item { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.panel-item:last-child { border-bottom:none; }
.pi-info { flex:1; min-width:0; }
.pi-label { font-weight:600; font-size:13px; color:var(--navy); }
.pi-fname { font-size:12px; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
</style>
<style>html{height:100%;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="window.location.href='/admin-dashboard'" alt="BookKeepPro"/>
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-ghost btn-sm" onclick="window.location.href='/admin-dashboard'">← Users</button>
<button class="btn btn-secondary btn-sm" onclick="window.location.href='/profile'">My Profile</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main-wide page-enter">
<!-- User Info Bar -->
<div class="card" style="margin-bottom:20px;">
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;">
<div style="display:flex;align-items:center;gap:16px;">
<div style="width:52px;height:52px;border-radius:50%;background:linear-gradient(135deg,var(--header-bg),var(--blue-light));display:flex;align-items:center;justify-content:center;font-weight:700;font-size:20px;color:var(--navy);flex-shrink:0;" id="userAvatar">?</div>
<div>
<div style="font-weight:700;font-size:18px;color:var(--navy);" id="detailName">—</div>
<div style="font-size:13px;color:var(--muted);margin-top:2px;" id="detailEmail">—</div>
<div style="display:flex;gap:8px;margin-top:6px;flex-wrap:wrap;">
<span class="badge badge-blue" id="detailRole">user</span>
<span id="detailAck" class="badge badge-yellow"><span class="material-symbols-outlined">pending</span> Engagement not acknowledged</span>
</div>
</div>
</div>
<div style="display:flex;gap:10px;align-items:center;flex-wrap:wrap;">
<div style="display:flex;flex-direction:column;align-items:flex-end;gap:4px;">
<label class="form-label" style="margin:0;font-size:11px;">Tax Year</label>
<select id="adminTaxYearSelect" class="select-input" style="width:auto;padding:6px 12px;font-size:13px;" onchange="onAdminYearChange()"></select>
</div>
<button class="btn btn-danger btn-sm" onclick="deleteUserCompletely()" style="border-radius:var(--radius-sm);">Delete User</button>
</div>
</div>
</div>
<!-- Engagement Box -->
<div id="engagementBox" class="engagement-banner" style="display:none;margin-bottom:20px;">
<div class="banner-icon"><span class="material-symbols-outlined">assignment</span></div>
<div class="banner-text"><strong>General Engagement Form</strong><span>Submitted by the user</span></div>
<button id="engagementViewBtn" class="btn btn-secondary btn-sm" style="border-radius:var(--radius-sm);">View</button>
</div>
<!-- Tabs -->
<div class="tab-bar">
<button class="tab-btn active" onclick="switchTab('personal',this)"><span class="material-symbols-outlined">description</span> Personal Docs</button>
<button class="tab-btn" onclick="switchTab('business',this)"><span class="material-symbols-outlined">business</span> Business Docs</button>
<button class="tab-btn" onclick="switchTab('returns', this)">📤 Returns for Review</button>
<button class="tab-btn" onclick="switchTab('audit', this)"><span class="material-symbols-outlined">history</span> Audit Trail</button>
</div>
<!-- ── TAB: Personal ── -->
<div id="tab-personal" class="tab-panel active">
<div style="display:flex;gap:20px;flex-wrap:wrap;">
<div style="flex:2;min-width:0;">
<div class="card-flat">
<div id="docTable"></div>
</div>
</div>
<div style="flex:1;min-width:240px;">
<div class="card-flat" style="display:flex;flex-direction:column;gap:16px;">
<h3>Filing Timeline</h3>
<div class="timeline-control">
<button class="tl-btn" onclick="decPersonalTimeline()">−</button>
<div>
<div class="tl-value" id="personalTimelineValue">0</div>
<div class="tl-label">days</div>
</div>
<button class="tl-btn" onclick="incPersonalTimeline()">+</button>
</div>
<button class="btn btn-secondary w-full" style="border-radius:var(--radius-sm);" onclick="sendPersonalMail()">
Send Personal Approval Email
</button>
</div>
</div>
</div>
</div>
<!-- ── TAB: Business ── -->
<div id="tab-business" class="tab-panel">
<div style="display:flex;gap:20px;flex-wrap:wrap;">
<div style="flex:2;min-width:0;">
<div class="card-flat">
<div id="businessDocTable"></div>
</div>
</div>
<div style="flex:1;min-width:240px;">
<div class="card-flat" style="display:flex;flex-direction:column;gap:16px;">
<h3>Filing Timeline</h3>
<div class="timeline-control">
<button class="tl-btn" onclick="decBusinessTimeline()">−</button>
<div>
<div class="tl-value" id="businessTimelineValue">0</div>
<div class="tl-label">days</div>
</div>
<button class="tl-btn" onclick="incBusinessTimeline()">+</button>
</div>
<button class="btn btn-secondary w-full" style="border-radius:var(--radius-sm);" onclick="sendBusinessMail()">
Send Business Approval Email
</button>
</div>
</div>
</div>
</div>
<!-- ── TAB: Returns ── -->
<div id="tab-returns" class="tab-panel">
<div class="card-flat">
<div class="flex-between" style="margin-bottom:16px;flex-wrap:wrap;gap:10px;">
<h3>Admin-Uploaded Returns</h3>
<div style="display:flex;gap:10px;">
<label class="btn btn-secondary btn-sm" for="adminDocInput" tabindex="0" id="adminUploadLabel" style="border-radius:var(--radius-sm);cursor:pointer;">
<span id="adminUploadBtnText">+ Upload Document</span>
<input type="file" id="adminDocInput" hidden accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx"/>
</label>
<button class="btn btn-sm" style="background:var(--success-bg);color:var(--success);border:1px solid #a5d6a7;border-radius:var(--radius-sm);" onclick="submitDocumentsForReview()">
Submit for Review
</button>
</div>
</div>
<div id="docPanel"></div>
</div>
</div>
<!-- ── TAB: Audit ── -->
<div id="tab-audit" class="tab-panel">
<div class="card-flat">
<h3 style="margin-bottom:16px;">Audit Trail</h3>
<div id="auditLog">
<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">history</span></div><div class="empty-title">Loading audit log…</div></div>
</div>
</div>
</div>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<small>© 2026 Bookkeeping Business Solutions</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/spinner.js"></script>
<script src="/js/confirm-modal.js"></script>
<script>
/* ── Globals ── */
const params = new URLSearchParams(window.location.search);
const userId = params.get("user_id");
const STATE_KEY = `review_state_${userId}`;
const token = localStorage.getItem("token");
const role = localStorage.getItem("role");
if (!token || (role !== "admin" && role !== "super_admin") || !userId) { localStorage.clear(); window.location.href="/login"; }
initSessionWarning();
/* ── Tab switching ── */
function switchTab(name, btn) {
document.querySelectorAll(".tab-panel").forEach(p => p.classList.remove("active"));
document.querySelectorAll(".tab-btn").forEach(b => b.classList.remove("active"));
document.getElementById(`tab-${name}`).classList.add("active");
btn.classList.add("active");
if (name === "audit" && !auditLoaded) loadAuditLog();
}
/* ── State ── */
const personalReviewState = {}, businessReviewState = {};
let personalTimeline = 0, businessTimeline = 0;
let auditLoaded = false;
function loadSavedState() {
try {
const saved = JSON.parse(localStorage.getItem(STATE_KEY)||"{}");
Object.assign(personalReviewState, saved.personal||{});
Object.assign(businessReviewState, saved.business||{});
} catch(e) {}
}
function _saveLocalState() {
localStorage.setItem(STATE_KEY, JSON.stringify({personal:personalReviewState,business:businessReviewState}));
}
/* ── Year ── */
function getAdminSelectedYear() { return document.getElementById("adminTaxYearSelect")?.value||""; }
function onAdminYearChange() {
localStorage.setItem("admin_selected_tax_year", getAdminSelectedYear());
loadUserDetails();
}
/* ── Load user + docs ── */
async function loadUserDetails() {
showSpinner(document.getElementById("docTable"));
showSpinner(document.getElementById("businessDocTable"));
const year = getAdminSelectedYear();
const url = year ? `/api/upload/admin/users/${userId}/documents?tax_year=${year}` : `/api/upload/admin/users/${userId}/documents`;
const res = await authFetch(url);
if (!res) return;
if (res.status === 403) { showToast("Access denied","error"); window.location.href="/admin-dashboard"; return; }
if (!res.ok) { showToast("Failed to load user documents","error"); return; }
const { user={}, documents=[] } = await res.json();
const viewerRole = localStorage.getItem("role");
if (viewerRole === "admin" && user.role && user.role !== "user") { showToast("Access denied","error"); window.location.href="/admin-dashboard"; return; }
/* User info */
document.getElementById("detailName").textContent = user.name || "—";
document.getElementById("detailEmail").textContent = user.email || "—";
document.getElementById("userAvatar").textContent = (user.name||"U").charAt(0).toUpperCase();
const roleBadge = document.getElementById("detailRole");
roleBadge.textContent = user.role || "user";
roleBadge.className = `badge badge-${user.role==="super_admin"?"red":user.role==="admin"?"orange":"blue"}`;
const ackEl = document.getElementById("detailAck");
if (user.role === "super_admin") {
ackEl.style.display = "none";
const delBtn = document.querySelector("button[onclick='deleteUserCompletely()']");
if (delBtn) delBtn.style.display = "none";
} else {
ackEl.style.display = "";
const delBtn = document.querySelector("button[onclick='deleteUserCompletely()']");
if (delBtn) delBtn.style.display = "";
if (user.engagement_acknowledged_at) {
ackEl.innerHTML = `<span class="material-symbols-outlined">check_circle</span> Acknowledged ${new Date(user.engagement_acknowledged_at).toLocaleDateString()}`;
ackEl.className = "badge badge-green";
} else {
ackEl.innerHTML = `<span class="material-symbols-outlined">warning</span> Not acknowledged`; ackEl.className = "badge badge-yellow";
}
}
/* Docs */
const docTable = document.getElementById("docTable");
const bizTable = document.getElementById("businessDocTable");
docTable.innerHTML=""; bizTable.innerHTML="";
document.getElementById("engagementBox").style.display="none";
const personal=[], business=[];
documents.forEach(d => {
if (d.doc_type?.toLowerCase().includes("engagement")) {
document.getElementById("engagementBox").style.display="flex";
document.getElementById("engagementViewBtn").onclick = () =>
authFetch(`/api/upload/view-url?key=${encodeURIComponent(d.storage_key)}`).then(r=>r&&r.json()).then(x=>x&&window.open(x.url,"_blank")).catch(()=>showToast("Could not generate view link","error"));
return;
}
if (d.table==="personal") personal.push(d);
if (d.table==="business") business.push(d);
});
if (!personal.length) docTable.innerHTML=`<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">inbox</span></div><div class="empty-title">No personal documents</div></div>`;
else personal.forEach((d,i) => renderRow(d,i,docTable,personalReviewState,updatePersonalState));
if (!business.length) bizTable.innerHTML=`<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">inbox</span></div><div class="empty-title">No business documents</div></div>`;
else business.forEach((d,i) => renderRow(d,i,bizTable,businessReviewState,updateBusinessState));
}
/* ── Row Render ── */
function renderRow(doc, index, container, stateStore, updateFn) {
const dbStatus = doc.review_status || "pending";
const state = { status: dbStatus !== "pending" ? dbStatus : (stateStore[doc.storage_key]?.status||"") };
const row = document.createElement("div"); row.className="approval-row";
const left = document.createElement("div"); left.className="ar-left";
const nameEl = document.createElement("div"); nameEl.className="ar-name"; nameEl.textContent=`${index+1}. ${doc.filename}`;
const typeEl = document.createElement("div"); typeEl.className="ar-type"; typeEl.textContent=doc.doc_type||"";
const badgeEl= document.createElement("span");
badgeEl.id = `badge_${doc.id}`;
badgeEl.className = dbStatus==="approved"?"badge badge-green":dbStatus==="rejected"?"badge badge-red":"badge badge-yellow";
badgeEl.innerHTML = dbStatus==="approved"?`<span class="material-symbols-outlined">check</span> Approved`:dbStatus==="rejected"?`<span class="material-symbols-outlined">close</span> Rejected`:`<span class="material-symbols-outlined">pending</span> Pending`;
left.appendChild(nameEl); left.appendChild(typeEl); left.appendChild(badgeEl);
if (doc.review_note) { const n=document.createElement("div"); n.className="ar-note"; n.textContent=`Note: ${doc.review_note}`; left.appendChild(n); }
const right = document.createElement("div"); right.className="ar-right";
const viewBtn = document.createElement("button"); viewBtn.className="btn btn-secondary btn-xs"; viewBtn.style.borderRadius="var(--radius-sm)"; viewBtn.textContent="View";
viewBtn.onclick = () => authFetch(`/api/upload/view-url?key=${encodeURIComponent(doc.storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error"));
const appChk = document.createElement("input"); appChk.type="checkbox"; appChk.className="chk-approve"; appChk.checked=(state.status==="approved"); appChk.id=`app_${doc.id}`;
const appLbl = document.createElement("label"); appLbl.className="chk-label"; appLbl.htmlFor=`app_${doc.id}`; appLbl.style.color="var(--success)"; appLbl.textContent="Approve";
const rejChk = document.createElement("input"); rejChk.type="checkbox"; rejChk.className="chk-reject"; rejChk.checked=(state.status==="rejected"); rejChk.id=`rej_${doc.id}`;
const rejLbl = document.createElement("label"); rejLbl.className="chk-label"; rejLbl.htmlFor=`rej_${doc.id}`; rejLbl.style.color="var(--error)"; rejLbl.textContent="Reject";
appChk.onchange = () => updateFn(doc, appChk, rejChk, "approved");
rejChk.onchange = () => updateFn(doc, rejChk, appChk, "rejected");
right.appendChild(viewBtn); right.appendChild(appChk); right.appendChild(appLbl); right.appendChild(rejChk); right.appendChild(rejLbl);
row.appendChild(left); row.appendChild(right);
container.appendChild(row);
}
async function persistReviewStatus(doc, status, note="") {
const ep = doc.table==="personal" ? `/api/upload/personal-documents/${doc.id}/review-status` : `/api/upload/business-documents/${doc.id}/review-status`;
const res = await authFetch(ep,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status,note})});
if (!res||!res.ok){showToast("Failed to save review status","error");return false;}
const badge=document.getElementById(`badge_${doc.id}`);
if (badge){badge.className=status==="approved"?"badge badge-green":status==="rejected"?"badge badge-red":"badge badge-yellow";badge.innerHTML=status==="approved"?`<span class="material-symbols-outlined">check</span> Approved`:status==="rejected"?`<span class="material-symbols-outlined">close</span> Rejected`:`<span class="material-symbols-outlined">pending</span> Pending`;}
return true;
}
function updatePersonalState(doc,active,other,status){if(active.checked){other.checked=false;personalReviewState[doc.storage_key]={status,name:doc.filename};persistReviewStatus(doc,status);}else{delete personalReviewState[doc.storage_key];persistReviewStatus(doc,"pending");}_saveLocalState();}
function updateBusinessState(doc,active,other,status){if(active.checked){other.checked=false;businessReviewState[doc.storage_key]={status,name:doc.filename};persistReviewStatus(doc,status);}else{delete businessReviewState[doc.storage_key];persistReviewStatus(doc,"pending");}_saveLocalState();}
function extractDocs(state){const a=[],r=[];Object.values(state).forEach(d=>{if(d.status==="approved")a.push(d.name);if(d.status==="rejected")r.push(d.name);});return{approved:a,rejected:r};}
async function sendPersonalMail(){
const {approved,rejected}=extractDocs(personalReviewState);
if(!approved.length&&!rejected.length){showToast("No personal documents selected.","warning");return;}
const res=await authFetch("/api/review/notify-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:userId,type:"personal",approved,rejected,personal_timeline:personalTimeline,business_timeline:0})});
if(!res) return;
if(!res.ok){showToast("Failed to send personal email","error");return;}
showToast("Personal approval email sent","success");
}
async function sendBusinessMail(){
const {approved,rejected}=extractDocs(businessReviewState);
if(!approved.length&&!rejected.length){showToast("No business documents selected.","warning");return;}
const res=await authFetch("/api/review/notify-user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:userId,type:"business",approved,rejected,personal_timeline:0,business_timeline:businessTimeline})});
if(!res) return;
if(!res.ok){showToast("Failed to send business email","error");return;}
showToast("Business approval email sent","success");
}
window.incPersonalTimeline=()=>{personalTimeline++;document.getElementById("personalTimelineValue").textContent=personalTimeline;};
window.decPersonalTimeline=()=>{if(personalTimeline>0)personalTimeline--;document.getElementById("personalTimelineValue").textContent=personalTimeline;};
window.incBusinessTimeline=()=>{businessTimeline++;document.getElementById("businessTimelineValue").textContent=businessTimeline;};
window.decBusinessTimeline=()=>{if(businessTimeline>0)businessTimeline--;document.getElementById("businessTimelineValue").textContent=businessTimeline;};
</script>
<script>
/* ── Admin Docs (Returns tab) ── */
async function loadAdminDocs() {
const panel = document.getElementById("docPanel");
showSpinner(panel);
const res = await authFetch(`/api/upload/admin-documents?user_id=${userId}`);
if (!res||!res.ok){hideSpinner(panel,'<div class="empty-state"><div class="empty-hint">Failed to load documents.</div></div>');return;}
const docs = await res.json(); panel.innerHTML="";
if (!docs.length){panel.innerHTML='<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">inbox</span></div><div class="empty-title">No documents uploaded yet</div></div>';return;}
docs.forEach(doc=>{
const item=document.createElement("div"); item.className="panel-item";
const info=document.createElement("div"); info.className="pi-info";
const lbl=document.createElement("div"); lbl.className="pi-label"; lbl.textContent=doc.doc_label;
const fn =document.createElement("div"); fn.className ="pi-fname"; fn.textContent=doc.filename;
info.appendChild(lbl); info.appendChild(fn);
const acts=document.createElement("div"); acts.className="admin-doc-actions";
const vBtn=document.createElement("button"); vBtn.className="btn btn-secondary btn-xs"; vBtn.style.borderRadius="var(--radius-sm)"; vBtn.textContent="View";
vBtn.addEventListener("click",()=>authFetch(`/api/upload/view-url?key=${encodeURIComponent(doc.storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error")));
const dBtn=document.createElement("button"); dBtn.className="btn btn-danger btn-xs"; dBtn.style.borderRadius="var(--radius-sm)"; dBtn.textContent="Delete";
dBtn.addEventListener("click",async()=>{const ok=await confirmModal("Delete this admin document?","Delete");if(!ok)return;const dr=await authFetch(`/api/upload/admin-documents/${doc.id}`,{method:"DELETE"});if(!dr)return;showToast("Document deleted","success");loadAdminDocs();});
acts.appendChild(vBtn); acts.appendChild(dBtn); item.appendChild(info); item.appendChild(acts); panel.appendChild(item);
});
}
async function _handleAdminDocUpload(file) {
const btnText=document.getElementById("adminUploadBtnText");
if(btnText) btnText.textContent="Uploading…";
const fd=new FormData(); fd.append("file",file); fd.append("doc_key",file.name.toLowerCase().replace(/\s+/g,"_")); fd.append("doc_label",file.name); fd.append("user_id",userId);
const res=await authFetch("/api/upload/admin-documents",{method:"POST",body:fd});
if(btnText) btnText.textContent="+ Upload Document";
if(!res) return;
if(!res.ok){const e=await res.json().catch(()=>{});showToast(e?.detail||"Upload failed","error");return;}
showToast("Document uploaded successfully","success"); loadAdminDocs();
}
async function submitDocumentsForReview(){
const ok=await confirmModal("Submit all documents for review?\nAn email will be sent to the user.","Submit"); if(!ok) return;
try{
const res=await authFetch("/api/review/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:userId})}); if(!res) return;
if(!res.ok){const e=await res.json();showToast(e?.detail||"Failed to submit","error");return;}
const data=await res.json();
if(data.email_sent) showToast("Documents submitted — email sent to user.","success");
else showToast("Documents submitted, but email could not be sent.","warning",6000);
}catch(e){console.error(e);showToast("Unexpected error. Please try again.","error");}
}
async function deleteUserCompletely(){
const ok=await confirmModal(`This will permanently delete the user AND ALL their documents.\n\nThis action CANNOT be undone.`,"Delete User"); if(!ok) return;
const res=await authFetch(`/api/upload/admin/users/${userId}`,{method:"DELETE"}); if(!res) return;
if(!res.ok){showToast("Failed to delete user","error");return;}
showToast("User deleted successfully","success"); window.location.href="/admin-dashboard";
}
/* ── Audit Log ── */
async function loadAuditLog(){
auditLoaded=true;
const log=document.getElementById("auditLog"); showSpinner(log);
const res=await authFetch(`/api/auth/admin/audit-logs?user_id=${userId}&limit=30`);
if(!res||!res.ok){hideSpinner(log,'<div class="empty-state"><div class="empty-hint">Failed to load audit log.</div></div>');return;}
const entries=await res.json();
if(!entries.length){hideSpinner(log,'<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">history</span></div><div class="empty-title">No audit entries found</div></div>');return;}
const table=document.createElement("table"); table.className="admin-docs-table";
table.innerHTML=`<thead><tr style="background:#f5f8fb;"><th style="padding:10px 12px;text-align:left;border-bottom:1px solid var(--border);color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.4px;">Time</th><th style="padding:10px 12px;text-align:left;border-bottom:1px solid var(--border);color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.4px;">Action</th><th style="padding:10px 12px;text-align:left;border-bottom:1px solid var(--border);color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.4px;">Target</th><th style="padding:10px 12px;text-align:left;border-bottom:1px solid var(--border);color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.4px;">Detail</th></tr></thead>`;
const tbody=document.createElement("tbody");
entries.forEach(e=>{
const tr=document.createElement("tr"); tr.style.borderBottom="1px solid var(--border)";
[e.created_at?new Date(e.created_at).toLocaleString():"—",e.action||"—",e.target||"—",e.detail||"—"].forEach(val=>{
const td=document.createElement("td"); td.className="admin-docs-td"; td.textContent=val; tr.appendChild(td);
});
tbody.appendChild(tr);
});
table.appendChild(tbody); hideSpinner(log,""); log.appendChild(table);
}
/* ── Init ── */
document.addEventListener("DOMContentLoaded",()=>{
initSessionWarning();
loadSavedState();
const savedYear=localStorage.getItem("admin_selected_tax_year");
buildYearOptions("adminTaxYearSelect",savedYear?parseInt(savedYear):new Date().getFullYear());
loadUserDetails();
loadAdminDocs();
const input=document.getElementById("adminDocInput");
if(input){
input.addEventListener("change",async e=>{const f=e.target.files[0];if(!f)return;await _handleAdminDocUpload(f);e.target.value="";});
}
const label=document.getElementById("adminUploadLabel");
if(label) label.addEventListener("keydown",e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();label.click();}});
});
</script>
<script src="/js/admin-chatbot.js"></script>
</body>
</html>
+117
View File
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact — BookKeepro</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/base.css?v=4">
<link rel="stylesheet" href="/css/components.css?v=4">
<link rel="stylesheet" href="/css/marketing.css?v=5">
<script src="/js/theme.js?v=2"></script>
</head>
<body>
{% set navbar_class = 'navbar-solid' %}
{% include 'partials/navbar.html' %}
<!-- ================= CONTACT SECTION ================= -->
<section class="contact-section">
<h2 class="contact-title">
CONTACT <span class="blue"> BOOK</span><span class="orange">KEEPRO</span>
</h2>
<div class="contact-container">
<div class="contact-info">
<div class="info-box usa">
<h3>USA</h3>
<p>2520 Indigo Dr<br>McKinney, TX<br>75072, United States</p>
<p class="phone"><img src="/images/call.webp"> +1469-796-6151</p>
</div>
<div class="info-box ind">
<h3>IND</h3>
<p>508, White Square,<br>Hinjewadi Road, Pune<br>411057, India</p>
<p class="phone"><img src="/images/call.webp"> +91 738 793 6020</p>
</div>
</div>
<div>
<form class="contact-form" id="contactForm">
<div class="form-row">
<input type="text" name="first_name" placeholder="First Name" required>
<input type="text" name="last_name" placeholder="Last Name" required>
</div>
<input type="email" name="email" placeholder="Email Address" required>
<div class="phone-row">
<input type="text" name="phone" placeholder="Mobile Number" required>
</div>
<div class="message-row">
<textarea name="message" placeholder="Your Message" required style="width: 100%; padding: 12px; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 14px; outline: none; margin-bottom: 16px; resize: vertical; min-height: 100px;"></textarea>
</div>
<button type="submit">SUBMIT</button>
</form>
</div>
</div>
</section>
{% include 'partials/footer.html' %}
<script src="/js/spinner.js"></script>
<script src="/js/toast.js"></script>
<script>
/* submit contact form */
const form = document.getElementById("contactForm");
const statusBox = document.getElementById("contactStatus");
form.addEventListener("submit", async (e)=>{
e.preventDefault();
const data = {
first_name: form.first_name.value,
last_name: form.last_name.value,
email: form.email.value,
phone: form.phone.value,
message: form.message.value,
};
const btn = form.querySelector("button[type='submit']");
setButtonLoading(btn, true, "Sending...");
try{
const res = await fetch("/api/contact",{
method:"POST",
headers:{ "Content-Type":"application/json" },
body:JSON.stringify(data)
});
if(!res.ok) throw new Error();
showToast("Message sent successfully!", "success");
form.reset();
}catch{
showToast("Failed to send message. Please try again.", "error");
} finally {
setButtonLoading(btn, false, "SUBMIT");
}
});
</script>
</body>
</html>
+91
View File
@@ -0,0 +1,91 @@
/* ============================================================
animations.css — Micro-interactions & transitions
============================================================ */
/* ── Page transition ─────────────────────────────────────── */
.page-enter {
animation: fadeIn 0.3s ease both;
}
/* ── Card hover lift ─────────────────────────────────────── */
.lift {
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lift:hover {
transform: translateY(-3px);
box-shadow: var(--shadow-md);
}
/* ── Button press feedback ───────────────────────────────── */
.btn:active { transform: translateY(1px) scale(0.97); }
/* ── Pulse (for pending badge) ───────────────────────────── */
@keyframes pulse-orange {
0%, 100% { box-shadow: 0 0 0 0 rgba(255,127,17,0.35); }
50% { box-shadow: 0 0 0 5px rgba(255,127,17,0); }
}
.pulse { animation: pulse-orange 2s infinite; }
/* ── Skeleton shimmer ────────────────────────────────────── */
@keyframes shimmer {
from { background-position: -600px 0; }
to { background-position: 600px 0; }
}
.skeleton {
background: linear-gradient(90deg, #e8edf2 25%, #f4f6f9 50%, #e8edf2 75%);
background-size: 600px 100%;
animation: shimmer 1.4s infinite linear;
border-radius: var(--radius-sm);
color: transparent !important;
}
/* ── Slide in from right (toast) ─────────────────────────── */
@keyframes toast-in {
from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); }
}
/* ── Fade up (cards on load) ─────────────────────────────── */
@keyframes fadeUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.3s ease both; }
/* ── Staggered children ──────────────────────────────────── */
.stagger > *:nth-child(1) { animation-delay: 0.00s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.20s; }
.stagger > *:nth-child(6) { animation-delay: 0.25s; }
/* ── Checkbox animate ────────────────────────────────────── */
input[type=checkbox] {
accent-color: var(--blue);
width: 16px;
height: 16px;
cursor: pointer;
}
/* ── Focus ring ──────────────────────────────────────────── */
:focus-visible {
outline: 2px solid var(--blue);
outline-offset: 2px;
}
/* ── Smooth link underline ───────────────────────────────── */
.fancy-link {
position: relative;
text-decoration: none;
color: var(--blue);
}
.fancy-link::after {
content: '';
position: absolute;
bottom: -1px; left: 0;
width: 0; height: 1.5px;
background: var(--blue);
transition: width 0.2s ease;
}
.fancy-link:hover::after { width: 100%; }
+282
View File
@@ -0,0 +1,282 @@
/* ============================================================
base.css — BookKeepPro Design System
Shared by every page. Load first.
============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,1,0');
/* ── Brand Tokens ─────────────────────────────────────────── */
:root {
--blue: #0077C8;
--blue-dark: #005fa3;
--blue-light: #e9f5ff;
--orange: #FF7F11;
--orange-dark: #e56e0d;
--orange-light: #fff3e0;
--header-bg: #BEE2FA;
--footer-bot: #A9D9F8;
--navy: #0B2540;
--accent: #3AB4F2;
--bg: #f1f7fb;
--card: #ffffff;
--muted: #6b7a86;
--border: #e2eaf2;
--success: #2e7d32;
--success-bg: #e6f9ec;
--error: #c62828;
--error-bg: #fdecea;
--warn: #f57f17;
--warn-bg: #fff8e1;
--radius-xs: 6px;
--radius-sm: 10px;
--radius-md: 14px;
--radius-lg: 20px;
--radius-pill: 999px;
--shadow-xs: 0 1px 4px rgba(0,0,0,0.06);
--shadow-sm: 0 2px 10px rgba(0,0,0,0.07);
--shadow-md: 0 6px 24px rgba(0,0,0,0.09);
--shadow-lg: 0 16px 48px rgba(0,0,0,0.12);
--transition: 0.2s ease;
}
/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
font-family: "Poppins", system-ui, sans-serif;
background: var(--bg);
color: #222;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
.material-symbols-outlined { font-size: inherit; vertical-align: middle; line-height: 1; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: clamp(22px,3vw,30px); font-weight: 700; color: var(--navy); line-height: 1.25; }
h2 { font-size: clamp(18px,2.5vw,24px); font-weight: 600; color: var(--navy); line-height: 1.3; }
h3 { font-size: clamp(15px,2vw,18px); font-weight: 600; color: var(--navy); }
p { line-height: 1.7; color: #444; }
small, .text-sm { font-size: 13px; color: var(--muted); }
.text-muted { color: var(--muted); }
/* ── Card ────────────────────────────────────────────────── */
.card {
background: var(--card);
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
border: 1px solid var(--border);
padding: clamp(20px, 4vw, 32px);
transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-flat { background: var(--card); border-radius: var(--radius-md); border: 1px solid var(--border); padding: clamp(16px, 3vw, 24px); }
/* ── Buttons ─────────────────────────────────────────────── */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 11px 22px;
font-family: inherit;
font-size: 14px;
font-weight: 600;
border: none;
border-radius: var(--radius-pill);
cursor: pointer;
transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); box-shadow: 0 4px 12px rgba(255,127,17,0.3); }
.btn-secondary { background: var(--blue); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(0,119,200,0.25); }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 18px; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--navy); border-color: #c0cfe0; }
.btn-danger { background: #ff4d4d; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #e03c3c; box-shadow: 0 4px 12px rgba(255,77,77,0.3); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-xs { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 9px; border-radius: var(--radius-sm); }
/* ── Form Inputs ─────────────────────────────────────────── */
.input, .select-input {
width: 100%;
padding: 12px 16px;
border: 1.5px solid var(--border);
border-radius: var(--radius-sm);
font-family: inherit;
font-size: 14px;
color: #222;
background: #fff;
transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select-input:focus {
outline: none;
border-color: var(--blue);
box-shadow: 0 0 0 3px rgba(0,119,200,0.10);
}
.input::placeholder { color: #a8b5c2; }
.input[readonly] { background: #f8fafc; color: var(--muted); cursor: default; }
label.form-label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 6px; }
.form-group { margin-bottom: 18px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 56px; }
.password-toggle {
position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
background: none; border: none; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer;
}
/* ── Badges ──────────────────────────────────────────────── */
.badge {
display: inline-flex; align-items: center; gap: 4px;
padding: 3px 10px; border-radius: var(--radius-pill);
font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
white-space: nowrap;
}
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-orange { background: var(--orange-light); color: #e65100; border: 1px solid #ffc89a; }
.badge-red { background: #fce4ec; color: var(--error); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warn-bg); color: var(--warn); border: 1px solid #ffe082; }
.badge-muted { background: #f0f4f8; color: var(--muted); }
/* ── Status Pills (doc review) ───────────────────────────── */
.pill-approved { background:var(--success-bg); color:var(--success); border:1px solid #a5d6a7; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.pill-rejected { background:var(--error-bg); color:var(--error); border:1px solid #ef9a9a; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.pill-pending { background:var(--warn-bg); color:var(--warn); border:1px solid #ffe082; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
/* ── App Layout Scaffold ─────────────────────────────────── */
.app-body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.page-main {
flex: 1;
width: min(100%, 1100px);
margin: clamp(24px, 4vw, 40px) auto;
padding: 0 clamp(16px, 3vw, 24px);
}
.page-main-wide {
flex: 1;
width: min(100%, 1300px);
margin: clamp(24px, 4vw, 40px) auto;
padding: 0 clamp(16px, 3vw, 24px);
}
/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn 0.3s ease both; }
.slide-up { animation: slideUp 0.35s ease both; }
/* ── Skeleton loading ────────────────────────────────────── */
@keyframes shimmer {
from { background-position: -600px 0; }
to { background-position: 600px 0; }
}
.skeleton {
background: linear-gradient(90deg, #e8edf2 25%, #f4f6f9 50%, #e8edf2 75%);
background-size: 600px 100%;
animation: shimmer 1.4s infinite linear;
border-radius: var(--radius-sm);
}
/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap-sm { gap: 8px; }
.flex-gap-md { gap: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-600 { font-weight: 600; }
/* --- UI/UX Polish --- */
/* Button Micro-animations */
.btn {
transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn:active {
transform: scale(0.96);
}
/* Focus States for Accessibility */
.input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
outline: none;
border-color: var(--blue) !important;
box-shadow: 0 0 0 3px rgba(0, 119, 200, 0.25) !important;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
/* Document & Admin Card Lift Effects */
.doc-card, .doc-row, .admin-docs-td {
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.doc-row:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
background: #fafafa;
}
/* --- Dark Mode Overrides --- */
.dark-theme {
--bg: #0B1521;
--card: #152538;
--navy: #f1f7fb;
--muted: #a8b5c2;
--border: #2A3F54;
--header-bg: #0F2B44;
--footer-bot: #06182B;
--blue-light: #0d263b;
--orange-light: #2d1a0a;
--success-bg: #0b2e13;
--error-bg: #420f0f;
--warn-bg: #3d2508;
--shadow-xs: 0 1px 4px rgba(0,0,0,0.3);
--shadow-sm: 0 2px 10px rgba(0,0,0,0.4);
--shadow-md: 0 6px 24px rgba(0,0,0,0.5);
--shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
}
/* Ensure text on dark theme maps correctly if using base html/body color */
body.dark-theme {
background-color: var(--bg);
color: var(--navy);
}
+406
View File
@@ -0,0 +1,406 @@
/* ============================================================
chatbot.css — BookKeepPro Chatbot Widget
Floating chat bubble + chat window
============================================================ */
/* ── Chat Bubble (FAB) ──────────────────────────────────── */
.chatbot-fab {
position: fixed;
bottom: 24px;
right: 24px;
width: 58px;
height: 58px;
border-radius: 50%;
background: linear-gradient(135deg, var(--blue) 0%, var(--accent) 100%);
color: #fff;
border: none;
cursor: pointer;
box-shadow: 0 4px 20px rgba(0, 119, 200, 0.35);
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
z-index: 9998;
transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.chatbot-fab:hover {
transform: scale(1.08);
box-shadow: 0 6px 28px rgba(0, 119, 200, 0.45);
}
.chatbot-fab:active {
transform: scale(0.96);
}
.chatbot-fab .fab-icon { transition: transform 0.3s ease; }
.chatbot-fab.open .fab-icon { transform: rotate(90deg); }
/* Pulse ring animation */
.chatbot-fab::before {
content: "";
position: absolute;
inset: -4px;
border-radius: 50%;
border: 2px solid var(--blue);
opacity: 0;
animation: chatPulse 2.5s ease-out infinite;
}
.chatbot-fab.open::before { animation: none; opacity: 0; }
@keyframes chatPulse {
0% { transform: scale(1); opacity: 0.5; }
100% { transform: scale(1.4); opacity: 0; }
}
/* Notification dot */
.chatbot-fab .notif-dot {
position: absolute;
top: 2px;
right: 2px;
width: 14px;
height: 14px;
border-radius: 50%;
background: var(--orange);
border: 2px solid #fff;
animation: dotBounce 1.5s ease infinite;
}
.chatbot-fab.open .notif-dot { display: none; }
@keyframes dotBounce {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.2); }
}
/* ── Chat Window ────────────────────────────────────────── */
.chatbot-window {
position: fixed;
bottom: 96px;
right: 24px;
width: 380px;
max-height: 520px;
border-radius: var(--radius-md);
background: var(--card);
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
display: flex;
flex-direction: column;
z-index: 9999;
overflow: hidden;
opacity: 0;
transform: translateY(20px) scale(0.95);
pointer-events: none;
transition: opacity 0.3s ease, transform 0.3s ease;
}
.chatbot-window.visible {
opacity: 1;
transform: translateY(0) scale(1);
pointer-events: auto;
}
/* ── Header ─────────────────────────────────────────────── */
.chatbot-header {
background: linear-gradient(135deg, var(--blue) 0%, #005fa3 100%);
color: #fff;
padding: 16px 18px;
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
.chatbot-header .bot-avatar {
width: 38px;
height: 38px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
flex-shrink: 0;
}
.chatbot-header .bot-info h4 {
font-size: 14px;
font-weight: 600;
margin: 0;
color: #fff;
}
.chatbot-header .bot-info span {
font-size: 11px;
opacity: 0.8;
}
.chatbot-header .close-chat {
margin-left: auto;
background: rgba(255, 255, 255, 0.15);
border: none;
color: #fff;
width: 30px;
height: 30px;
border-radius: 50%;
cursor: pointer;
font-size: 16px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
}
.chatbot-header .close-chat:hover {
background: rgba(255, 255, 255, 0.3);
}
/* ── Messages Area ──────────────────────────────────────── */
.chatbot-messages {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 10px;
background: #f8fbfe;
min-height: 200px;
max-height: 340px;
}
.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #c5d9ee; border-radius: 10px; }
/* ── Message Bubbles ────────────────────────────────────── */
.chat-msg {
max-width: 85%;
padding: 10px 14px;
border-radius: 14px;
font-size: 13px;
line-height: 1.5;
animation: msgSlideIn 0.3s ease;
word-wrap: break-word;
}
@keyframes msgSlideIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot {
background: #fff;
color: #222;
border: 1px solid var(--border);
border-bottom-left-radius: 4px;
align-self: flex-start;
box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.chat-msg.user {
background: linear-gradient(135deg, var(--blue), var(--accent));
color: #fff;
border-bottom-right-radius: 4px;
align-self: flex-end;
}
/* ── Typing Indicator ───────────────────────────────────── */
.typing-indicator {
display: flex;
gap: 4px;
padding: 12px 16px;
align-self: flex-start;
}
.typing-indicator span {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--blue);
opacity: 0.4;
animation: typingDot 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
30% { transform: translateY(-6px); opacity: 1; }
}
/* ── Quick Reply Buttons ────────────────────────────────── */
.quick-replies {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 6px;
}
.quick-reply-btn {
background: #fff;
border: 1.5px solid var(--blue);
color: var(--blue);
padding: 9px 14px;
border-radius: var(--radius-sm);
font-size: 13px;
font-weight: 500;
cursor: pointer;
text-align: left;
transition: all 0.2s ease;
font-family: inherit;
display: flex;
align-items: center;
gap: 8px;
}
.quick-reply-btn:hover {
background: var(--blue);
color: #fff;
transform: translateX(4px);
box-shadow: 0 2px 8px rgba(0, 119, 200, 0.2);
}
.quick-reply-btn .qr-icon {
font-size: 16px;
flex-shrink: 0;
}
/* ── Doc Status Cards ───────────────────────────────────── */
.doc-status-card {
background: #fff;
border: 1px solid var(--border);
border-radius: var(--radius-xs);
padding: 10px 12px;
margin-top: 6px;
font-size: 12px;
}
.doc-status-card .doc-name {
font-weight: 600;
color: var(--navy);
margin-bottom: 4px;
font-size: 13px;
}
.doc-status-card .doc-year {
color: var(--muted);
font-size: 11px;
}
.doc-status-card .doc-badge {
display: inline-block;
padding: 2px 8px;
border-radius: var(--radius-pill);
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.3px;
}
.doc-badge.pending { background: var(--warn-bg); color: var(--warn); }
.doc-badge.approved { background: var(--success-bg); color: var(--success); }
.doc-badge.rejected { background: var(--error-bg); color: var(--error); }
.doc-status-card .doc-note {
margin-top: 4px;
color: var(--muted);
font-style: italic;
font-size: 11px;
}
/* ── Summary Banner ─────────────────────────────────────── */
.status-summary {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
margin-top: 8px;
}
.summary-item {
text-align: center;
padding: 8px 4px;
border-radius: var(--radius-xs);
background: #f1f7fb;
}
.summary-item .count {
font-size: 20px;
font-weight: 700;
display: block;
}
.summary-item .label {
font-size: 10px;
text-transform: uppercase;
color: var(--muted);
letter-spacing: 0.5px;
}
.summary-item.pending .count { color: var(--warn); }
.summary-item.approved .count { color: var(--success); }
.summary-item.rejected .count { color: var(--error); }
/* ── FAQ List ───────────────────────────────────────────── */
.faq-question {
background: #fff;
border: 1px solid var(--border);
border-radius: var(--radius-xs);
padding: 9px 12px;
font-size: 12.5px;
cursor: pointer;
transition: all 0.2s ease;
text-align: left;
color: var(--navy);
width: 100%;
font-family: inherit;
display: block;
margin-top: 4px;
}
.faq-question:hover {
border-color: var(--blue);
color: var(--blue);
background: var(--blue-light);
}
/* ── Back Button ────────────────────────────────────────── */
.back-btn {
background: none;
border: none;
color: var(--blue);
cursor: pointer;
font-size: 12px;
padding: 4px 0;
font-family: inherit;
font-weight: 500;
margin-top: 6px;
display: inline-flex;
align-items: center;
gap: 4px;
}
.back-btn:hover { text-decoration: underline; }
/* ── Mobile Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
.chatbot-window {
bottom: 0;
right: 0;
left: 0;
width: 100%;
max-height: 75vh;
border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.chatbot-fab {
bottom: 16px;
right: 16px;
width: 52px;
height: 52px;
font-size: 24px;
}
}
/* ── Dark Mode Support ──────────────────────────────────── */
[data-theme="dark"] .chatbot-window { background: #1a2332; }
[data-theme="dark"] .chatbot-messages { background: #0f1923; }
[data-theme="dark"] .chat-msg.bot {
background: #1e2d3d;
border-color: #2a3f54;
color: #d4dde6;
}
[data-theme="dark"] .quick-reply-btn {
background: #1e2d3d;
border-color: var(--blue);
color: var(--accent);
}
[data-theme="dark"] .quick-reply-btn:hover {
background: var(--blue);
color: #fff;
}
[data-theme="dark"] .doc-status-card {
background: #1e2d3d;
border-color: #2a3f54;
}
[data-theme="dark"] .doc-status-card .doc-name { color: #d4dde6; }
[data-theme="dark"] .faq-question {
background: #1e2d3d;
border-color: #2a3f54;
color: #d4dde6;
}
[data-theme="dark"] .faq-question:hover {
background: #253648;
border-color: var(--blue);
}
[data-theme="dark"] .summary-item { background: #1e2d3d; }
+484
View File
@@ -0,0 +1,484 @@
/* ============================================================
components.css — Reusable UI components
Load after base.css
============================================================ */
/* ── App Header ──────────────────────────────────────────── */
.app-header {
background: var(--header-bg);
padding: 0 clamp(16px, 4vw, 32px);
height: 62px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
position: sticky;
top: 0;
z-index: 200;
box-shadow: 0 2px 12px rgba(0,80,140,0.10);
}
.app-header .logo { height: 38px; cursor: pointer; transition: opacity var(--transition); }
.app-header .logo:hover { opacity: 0.85; }
.app-header .header-actions { display: flex; gap: 10px; align-items: center; }
/* ── App Footer ──────────────────────────────────────────── */
.app-footer {
background: var(--header-bg);
border-top: 1px solid rgba(0,80,140,0.10);
padding: 18px clamp(16px, 4vw, 32px);
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
margin-top: auto;
}
.app-footer img { height: 30px; }
.app-footer small { color: var(--muted); font-size: 12px; }
/* ── Auth Layout — Split Card ────────────────────────────── */
.auth-shell {
min-height: 100vh;
display: flex;
align-items: stretch;
background: #fff;
}
.auth-brand {
width: 42%;
min-width: 280px;
background: linear-gradient(145deg, var(--navy) 0%, var(--blue) 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 40px;
color: #fff;
gap: 24px;
}
.auth-brand .brand-logo { height: 56px; }
.auth-brand h2 { color: #fff; font-size: clamp(20px,2.5vw,26px); text-align: center; margin: 0; }
.auth-brand p { color: rgba(255,255,255,0.75); font-size: 14px; text-align: center; line-height: 1.8; margin: 0; }
.auth-brand .brand-divider { width: 40px; height: 3px; background: var(--orange); border-radius: 2px; }
.auth-form-side {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: clamp(32px, 5vw, 64px) clamp(24px, 6vw, 80px);
background: #fff;
overflow-y: auto;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: clamp(20px,2.5vw,26px); margin-bottom: 6px; }
.auth-box .auth-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.auth-links { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; line-height: 2; }
/* Dark Theme Overrides for Auth Pages */
body.dark-theme .auth-shell { background: var(--bg); }
body.dark-theme .auth-form-side { background: var(--bg); }
body.dark-theme .auth-box h1 { color: var(--navy); }
body.dark-theme .auth-box .auth-subtitle { color: var(--muted); }
body.dark-theme .auth-box .form-label { color: var(--muted); }
body.dark-theme .auth-box .input { background: var(--card); color: var(--navy); border-color: var(--border); }
body.dark-theme .auth-links a { color: var(--blue); }
@media (max-width: 768px) {
.auth-shell { flex-direction: column; }
.auth-brand {
width: 100%;
min-width: unset;
min-height: unset;
padding: 24px 20px;
flex-direction: row;
justify-content: center;
gap: 16px;
}
.auth-brand p, .auth-brand .brand-divider { display: none; }
.auth-brand .brand-logo { height: 32px; }
.auth-brand h2 { font-size: 15px; margin: 0; }
.auth-form-side { padding: 28px 20px; }
}
/* ── Page Header Row ─────────────────────────────────────── */
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
flex-wrap: wrap;
gap: 16px;
margin-bottom: 28px;
}
.page-heading h1, .page-heading h2 { margin: 0; }
.page-heading .page-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
/* ── Stat Cards Row ──────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 20px 22px;
display: flex;
flex-direction: column;
gap: 6px;
transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card.accent-blue { border-left: 4px solid var(--blue); }
.stat-card.accent-orange{ border-left: 4px solid var(--orange); }
.stat-card.accent-green { border-left: 4px solid var(--success); }
/* ── Tab Bar ─────────────────────────────────────────────── */
.tab-bar {
display: flex;
gap: 0;
border-bottom: 2px solid var(--border);
margin-bottom: 24px;
overflow-x: auto;
scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
padding: 12px 22px;
font-family: inherit;
font-size: 14px;
font-weight: 500;
color: var(--muted);
background: none;
border: none;
border-bottom: 3px solid transparent;
margin-bottom: -2px;
cursor: pointer;
transition: color var(--transition), border-color var(--transition);
white-space: nowrap;
flex-shrink: 0;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active{ display: block; animation: fadeIn 0.25s ease; }
/* ── User Card (Admin Dashboard) ─────────────────────────── */
.user-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 18px 20px;
display: flex;
flex-direction: column;
gap: 14px;
cursor: pointer;
transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
position: relative;
}
.user-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c5d9ee; }
.click-layer { position: absolute; inset: 0; z-index: 0; }
.user-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-avatar {
width: 46px; height: 46px; border-radius: 50%;
background: linear-gradient(135deg, var(--header-bg), var(--blue-light));
display: flex; align-items: center; justify-content: center;
font-weight: 700; font-size: 17px; color: var(--navy);
flex-shrink: 0; border: 2px solid rgba(0,119,200,0.15);
}
.user-info { min-width: 0; flex: 1; }
.user-info .u-name { font-weight: 600; color: var(--navy); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .u-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.user-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 10; flex-wrap: wrap; }
/* ── Role Controls ───────────────────────────────────────── */
.role-controls { display: flex; align-items: center; gap: 8px; position: relative; z-index: 10; }
.role-select { padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; cursor: pointer; background: #fff; flex: 1; transition: border-color var(--transition); }
.role-select:focus { outline: none; border-color: var(--blue); }
.role-save-btn { padding: 6px 14px; background: var(--blue); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; transition: background var(--transition); white-space: nowrap; }
.role-save-btn:hover { background: var(--blue-dark); }
/* ── Info Card (User Detail) ─────────────────────────────── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }
.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-item .info-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
.info-item .info-value { font-size: 15px; font-weight: 500; color: var(--navy); }
/* ── Document Row ────────────────────────────────────────── */
.doc-row {
display: flex;
align-items: center;
gap: 14px;
padding: 14px 16px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: #fafcff;
transition: border-color var(--transition), background var(--transition);
margin-bottom: 10px;
}
.doc-row:hover { border-color: #c5d9ee; background: var(--blue-light); }
.doc-row-left { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.doc-row-name { font-weight: 600; font-size: 13px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row-type { font-size: 12px; color: var(--muted); }
.doc-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
/* ── Drop Zone ───────────────────────────────────────────── */
.drop-zone {
border: 2px dashed #b8cfdf;
border-radius: var(--radius-md);
padding: 36px 24px;
text-align: center;
color: var(--muted);
transition: border-color var(--transition), background var(--transition);
cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
border-color: var(--blue);
background: var(--blue-light);
color: var(--blue);
}
.drop-zone .drop-icon { font-size: 36px; margin-bottom: 10px; }
.drop-zone .drop-title { font-weight: 600; font-size: 15px; color: var(--navy); }
.drop-zone .drop-hint { font-size: 13px; margin-top: 4px; }
/* ── Search Bar ──────────────────────────────────────────── */
.search-bar {
display: flex;
align-items: center;
gap: 10px;
background: #fff;
border: 1.5px solid var(--border);
border-radius: var(--radius-pill);
padding: 9px 18px;
transition: border-color var(--transition), box-shadow var(--transition);
max-width: 360px;
}
.search-bar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,119,200,0.10); }
.search-bar input { border: none; outline: none; font-family: inherit; font-size: 14px; width: 100%; background: transparent; }
.search-bar .search-icon { color: var(--muted); font-size: 16px; flex-shrink: 0; }
/* ── Timeline Stepper ────────────────────────────────────── */
.timeline-control {
display: flex;
align-items: center;
gap: 12px;
background: var(--bg);
border-radius: var(--radius-sm);
padding: 10px 16px;
width: fit-content;
}
.timeline-control .tl-btn {
width: 32px; height: 32px;
border-radius: 50%;
border: 1.5px solid var(--border);
background: #fff;
font-size: 18px;
font-weight: 600;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
transition: border-color var(--transition), background var(--transition);
}
.timeline-control .tl-btn:hover { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.timeline-control .tl-value { font-size: 20px; font-weight: 700; color: var(--navy); min-width: 32px; text-align: center; }
.timeline-control .tl-label { font-size: 12px; color: var(--muted); }
/* ── Approval Table ──────────────────────────────────────── */
.approval-table { width: 100%; border-collapse: collapse; }
.approval-table th, .approval-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.approval-table th { background: #f5f8fb; font-weight: 600; color: var(--muted); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.approval-table tr:last-child td { border-bottom: none; }
.approval-table tr:hover td { background: #fafcff; }
/* ── Toggle Switch (approve/reject) ─────────────────────── */
.review-toggle {
display: flex;
gap: 6px;
}
.review-toggle label {
display: flex;
align-items: center;
gap: 5px;
padding: 5px 12px;
border-radius: var(--radius-pill);
border: 1.5px solid var(--border);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: all var(--transition);
}
.review-toggle input[type=checkbox] { display: none; }
.review-toggle .approve-lbl { color: var(--success); }
.review-toggle .approve-lbl:has(input:checked),
.review-toggle input.approve:checked + label { background: var(--success-bg); border-color: var(--success); }
.review-toggle .reject-lbl { color: var(--error); }
/* ── Engagement Banner ───────────────────────────────────── */
.engagement-banner {
display: flex;
align-items: center;
gap: 16px;
padding: 16px 20px;
border-radius: var(--radius-md);
background: linear-gradient(90deg, #e3f2fd, #f0f9ff);
border: 1px solid #b3d9f5;
margin-bottom: 24px;
}
.engagement-banner .banner-icon { font-size: 28px; flex-shrink: 0; }
.engagement-banner .banner-text { flex: 1; }
.engagement-banner .banner-text strong { display: block; font-size: 14px; color: var(--navy); }
.engagement-banner .banner-text span { font-size: 13px; color: var(--muted); }
.engagement-banner.acknowledged { background: var(--success-bg); border-color: #a5d6a7; }
/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
padding: 48px 24px;
text-align: center;
color: var(--muted);
}
.empty-state .empty-icon { font-size: 42px; margin-bottom: 12px; opacity: 0.6; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.empty-state .empty-hint { font-size: 13px; }
/* ── Marketing Navbar ────────────────────────────────────── */
.mkt-navbar {
position: absolute;
top: 0; left: 0;
width: 100%;
z-index: 20;
}
.mkt-nav-inner {
width: min(1200px, 96%);
margin: auto;
padding: 18px 12px;
display: flex;
align-items: center;
justify-content: space-between;
}
.mkt-nav-logo { height: clamp(38px,5vw,54px); object-fit: contain; }
.mkt-nav-menu { display: flex; gap: 32px; align-items: center; }
.mkt-nav-menu a { color: #fff; font-size: 15px; font-weight: 500; text-decoration: none; transition: color var(--transition); }
.mkt-nav-menu a:hover { color: #FFD28C; }
.mkt-hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.mkt-hamburger span { width: 26px; height: 2.5px; background: #fff; border-radius: 2px; }
@media (max-width: 900px) {
.mkt-nav-menu {
display: none;
position: absolute;
top: 72px; left: 0;
width: 100%;
background: var(--navy);
flex-direction: column;
gap: 0;
padding: 8px 0 20px;
}
.mkt-nav-menu a { padding: 12px 28px; width: 100%; }
.mkt-nav-menu.open { display: flex; }
.mkt-hamburger { display: flex; }
}
/* ── Marketing Footer ────────────────────────────────────── */
.mkt-footer { background: var(--header-bg); border-top: 4px solid var(--blue); margin-top: auto; }
.mkt-footer-top {
width: min(1200px, 92%);
margin: auto;
padding: 40px 0;
display: flex;
justify-content: space-between;
gap: 40px;
flex-wrap: wrap;
}
.mkt-footer-logo { width: clamp(120px,20vw,160px); }
.mkt-footer-links { display: flex; flex-direction: column; gap: 8px; }
.mkt-footer-links h4 { color: var(--blue); margin-bottom: 4px; font-size: 14px; }
.mkt-footer-links a { color: var(--navy); font-size: 14px; font-weight: 500; transition: color var(--transition); }
.mkt-footer-links a:hover { color: var(--blue); }
.mkt-footer-bottom { background: var(--footer-bot); text-align: center; padding: 12px; font-size: 13px; color: #555; }
/* --- JS Extracted Components --- */
.doc-row-wrapper {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.btn-approve {
background: var(--success-bg);
color: var(--success);
border: 1px solid #a5d6a7;
border-radius: var(--radius-pill);
}
.btn-reject {
background: var(--error-bg);
color: var(--error);
border: 1px solid #ef9a9a;
border-radius: var(--radius-pill);
}
.reject-box {
display: none;
margin-top: 10px;
}
.reject-textarea {
width: 100%;
padding: 10px;
border-radius: var(--radius-sm);
border: 1.5px solid var(--border);
font-family: inherit;
font-size: 13px;
resize: vertical;
}
.admin-doc-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
}
.admin-docs-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.admin-docs-td {
padding: 10px 12px;
color: #444;
}
.admin-docs-th {
padding: 10px 12px;
color: #555;
font-weight: 500;
text-align: left;
border-bottom: 2px solid var(--border);
}
/* -- Pill Buttons for Document Actions ----------------------- */
.btn-download-pill {
background: var(--blue);
color: #fff;
border: none;
border-radius: var(--radius-sm);
font-weight: 500;
}
.btn-download-pill:hover {
opacity: 0.9;
}
.btn-upload-pill {
background: var(--orange);
color: #fff;
border: none;
border-radius: var(--radius-sm);
font-weight: 500;
cursor: pointer;
}
.btn-upload-pill:hover {
opacity: 0.9;
}
File diff suppressed because it is too large Load Diff
+330
View File
@@ -0,0 +1,330 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
rel="stylesheet" />
<link rel="stylesheet" href="/css/base.css" />
<link rel="stylesheet" href="/css/components.css" />
<link rel="stylesheet" href="/css/animations.css" />
<link rel="stylesheet" href="/css/chatbot.css" />
<style>
.action-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-top: 8px;
}
.action-card {
padding: 24px 20px;
border-radius: var(--radius-md);
border: 1px solid var(--border);
background: var(--card);
cursor: pointer;
text-align: center;
transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.action-card:hover {
transform: translateY(-3px);
box-shadow: var(--shadow-md);
border-color: #c5d9ee;
}
.action-card .ac-icon {
font-size: 32px;
margin-bottom: 10px;
}
.action-card .ac-title {
font-weight: 600;
color: var(--navy);
font-size: 15px;
}
.action-card .ac-desc {
font-size: 12px;
color: var(--muted);
margin-top: 4px;
}
.action-card.personal {
border-top: 4px solid var(--blue);
}
.action-card.business {
border-top: 4px solid var(--orange);
}
@media(max-width:480px) {
.action-grid {
grid-template-columns: 1fr;
}
}
</style>
<style>
html {
height: 100%;
}
</style>
<script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="window.location.href='/dashboard'"
alt="BookKeepPro" />
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-secondary btn-sm" onclick="window.location.href='/profile'">My Profile</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main page-enter" style="max-width:860px;">
<!-- Engagement Banner -->
<div class="engagement-banner" id="engagementBanner">
<div class="banner-icon"></div>
<div class="banner-text">
<strong>General Engagement Letter</strong>
<span>Please download and read the engagement letter before uploading documents.</span>
</div>
<div style="display:flex;align-items:center;gap:12px;flex-shrink:0;flex-wrap:wrap;">
<a href="./images/general_engagement_letter_2025-1 - common.pdf" download class="btn btn-secondary btn-sm"
style="border-radius:var(--radius-sm);">
Download
</a>
<label
style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:500;white-space:nowrap;">
<input type="checkbox" id="ackCheckbox" onchange="acknowledgeEngagement(this)"
style="width:16px;height:16px;accent-color:var(--blue);" />
I acknowledge
</label>
</div>
</div>
<p id="ackStatus" style="font-size:12px;color:var(--success);margin:-12px 0 20px;display:none;"></p>
<!-- Welcome + Stats -->
<div class="page-heading">
<div>
<h1>Welcome back! </h1>
<p class="page-meta">Manage your tax documents and review filings below.</p>
</div>
</div>
<!-- Quick Actions -->
<div class="card" style="margin-bottom:24px;">
<h3 style="margin-bottom:16px;">Upload Documents</h3>
<div class="action-grid">
<div class="action-card personal" onclick="window.location.href='/upload-personal'">
<div class="ac-icon"></div>
<div class="ac-title">Personal Documents</div>
<div class="ac-desc">W-2, 1099, tax organizer and more</div>
</div>
<div class="action-card business" onclick="window.location.href='/upload-business'">
<div class="ac-icon"></div>
<div class="ac-title">Business Documents</div>
<div class="ac-desc">S-Corp, LLC, partnership organizers</div>
</div>
</div>
</div>
<!-- Admin Returns -->
<div class="card" id="adminDocsBox">
<div class="flex-between" style="margin-bottom:16px;">
<h3>Returns for Review</h3>
<span class="badge badge-blue" id="returnCount" style="display:none;"></span>
</div>
<div id="adminDocsList">
<div class="empty-state">
<div class="empty-icon"><span class="material-symbols-outlined">inbox</span></div>
<div class="empty-title">No returns yet</div>
<div class="empty-hint">When your accountant uploads your tax returns, they'll appear here.</div>
</div>
</div>
</div>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
<small>© 2026 Bookkeeping Business Solutions. All rights reserved.</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/spinner.js"></script>
<script src="/js/confirm-modal.js"></script>
<script>
guardAuth(["user"]);
initSessionWarning();
/* ── Engagement ── */
async function loadAcknowledgementStatus() {
const res = await authFetch("/api/auth/me");
if (!res || !res.ok) return;
const data = await res.json();
if (data.engagement_acknowledged_at) {
const banner = document.getElementById("engagementBanner");
banner.classList.add("acknowledged");
banner.querySelector(".banner-text strong").textContent = "Engagement Letter Acknowledged";
banner.querySelector(".banner-text span").textContent = `Acknowledged on ${new Date(data.engagement_acknowledged_at).toLocaleDateString()}`;
const ack = banner.querySelector("label");
if (ack) { ack.previousElementSibling?.remove(); ack.remove(); }
}
}
async function acknowledgeEngagement(checkbox) {
if (!checkbox.checked) return;
const res = await authFetch("/api/auth/acknowledge-engagement", { method: "POST" });
if (!res || !res.ok) { showToast("Failed to save acknowledgement", "error"); checkbox.checked = false; return; }
checkbox.disabled = true;
const banner = document.getElementById("engagementBanner");
banner.classList.add("acknowledged");
banner.querySelector(".banner-text span").textContent = `Acknowledged on ${new Date().toLocaleDateString()}`;
showToast("Engagement letter acknowledged", "success");
}
/* ── Admin Docs ── */
async function loadAdminUploadedDocs() {
const list = document.getElementById("adminDocsList");
list.innerHTML = Array(3).fill(`
<div class="doc-row fade-up" style="border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 8px;">
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;">
<div>
<div class="skeleton" style="width:180px;height:20px;margin-bottom:6px;"></div>
<div class="skeleton" style="width:120px;height:14px;"></div>
</div>
<div style="display:flex; gap:8px;">
<div class="skeleton" style="width:60px;height:28px;border-radius:var(--radius-pill);"></div>
<div class="skeleton" style="width:80px;height:28px;border-radius:var(--radius-pill);"></div>
</div>
</div>
</div>
`).join("");
let res;
try { res = await authFetch("/api/upload/admin-documents"); if (!res) return; }
catch { list.innerHTML = `<div class="empty-state"><div class="empty-hint">Failed to load documents.</div></div>`; return; }
let documents;
try { documents = await res.json(); } catch { list.innerHTML = `<div class="empty-state"><div class="empty-hint">Invalid response.</div></div>`; return; }
if (!Array.isArray(documents) || !documents.length) {
hideSpinner(list, `<div class="empty-state"><div class="empty-icon"><span class="material-symbols-outlined">inbox</span></div><div class="empty-title">No returns yet</div><div class="empty-hint">When your accountant uploads your tax returns, they'll appear here.</div></div>`);
return;
}
const countBadge = document.getElementById("returnCount");
countBadge.textContent = `${documents.length} document${documents.length !== 1 ? 's' : ''}`;
countBadge.style.display = "inline-flex";
list.innerHTML = "";
documents.forEach(d => {
const row = document.createElement("div");
row.className = "doc-row fade-up";
const left = document.createElement("div");
left.className = "doc-row-left";
const title = document.createElement("div"); title.className = "doc-row-name"; title.textContent = d.doc_label;
const fname = document.createElement("div"); fname.className = "doc-row-type"; fname.textContent = d.filename;
left.appendChild(title); left.appendChild(fname);
const actions = document.createElement("div");
actions.className = "doc-row-actions";
const viewBtn = document.createElement("button");
viewBtn.className = "btn btn-secondary btn-xs"; viewBtn.textContent = "View";
viewBtn.addEventListener("click", () =>
authFetch(`/api/upload/view-url?key=${encodeURIComponent(d.storage_key)}`)
.then(r => r && r.json()).then(x => x && window.open(x.url, "_blank"))
.catch(() => showToast("Could not generate view link", "error"))
);
const approveBtn = document.createElement("button");
approveBtn.id = `approveBtn_${d.id}`;
approveBtn.className = "btn btn-sm"; approveBtn.classList.add("btn-approve");
approveBtn.innerHTML = `<span class="material-symbols-outlined">check</span> Approve`;
approveBtn.addEventListener("click", () => approveAdminDoc(d.id));
const rejectBtn = document.createElement("button");
rejectBtn.id = `rejectBtn_${d.id}`;
rejectBtn.className = "btn btn-sm"; rejectBtn.classList.add("btn-reject");
rejectBtn.innerHTML = `<span class="material-symbols-outlined">close</span> Reject`;
rejectBtn.addEventListener("click", () => showRejectBox(d.id, rejectBox));
actions.appendChild(viewBtn); actions.appendChild(approveBtn); actions.appendChild(rejectBtn);
const rejectBox = document.createElement("div");
rejectBox.id = `rejectBox_${d.id}`;
rejectBox.className = "reject-box";
const ta = document.createElement("textarea");
ta.id = `rejectReason_${d.id}`; ta.placeholder = "Reason for rejection";
ta.className = "reject-textarea";
const subBtn = document.createElement("button");
subBtn.className = "btn btn-secondary btn-sm"; subBtn.style.marginTop = "8px"; subBtn.textContent = "Submit Rejection";
subBtn.addEventListener("click", () => submitRejection(d.id));
rejectBox.appendChild(ta); rejectBox.appendChild(subBtn);
const wrapper = document.createElement("div");
wrapper.appendChild(left); wrapper.appendChild(actions);
wrapper.className = "doc-row-wrapper";
row.appendChild(wrapper); row.appendChild(rejectBox);
list.appendChild(row);
});
}
function showRejectBox(docId, boxEl) { const box = boxEl || document.getElementById(`rejectBox_${docId}`); if (box) box.style.display = "block"; }
function viewStoredDoc(key) { authFetch(`/api/upload/view-url?key=${encodeURIComponent(key)}`).then(r => r && r.json()).then(d => d && window.open(d.url, "_blank")).catch(() => showToast("Could not generate view link", "error")); }
async function approveAdminDoc(docId) {
const ok = await confirmModal("Approve this document?", "Approve");
if (!ok) return;
const res = await authFetch("/api/review/admin-doc-response", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ doc_id: docId, status: "approved" }) });
if (!res) return;
if (!res.ok) { showToast("Failed to send approval", "error"); return; }
showToast("Approval sent", "success");
const aBtn = document.getElementById(`approveBtn_${docId}`);
const rBtn = document.getElementById(`rejectBtn_${docId}`);
const rBox = document.getElementById(`rejectBox_${docId}`);
if(aBtn) { aBtn.outerHTML = '<span style="color:var(--success); font-weight:600; font-size:14px; margin-left:10px;">✓ Approved</span>'; }
if(rBtn) rBtn.remove();
if(rBox) rBox.remove();
}
async function submitRejection(docId) {
const reason = document.getElementById(`rejectReason_${docId}`)?.value.trim();
if (!reason) { showToast("Please enter a rejection reason", "warning"); return; }
const res = await authFetch("/api/review/admin-doc-response", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ doc_id: docId, status: "rejected", reason }) });
if (!res) return;
if (!res.ok) { showToast("Failed to send rejection", "error"); return; }
showToast("Rejection sent to admin", "success");
const aBtn = document.getElementById(`approveBtn_${docId}`);
const rBtn = document.getElementById(`rejectBtn_${docId}`);
const rBox = document.getElementById(`rejectBox_${docId}`);
if(rBtn) { rBtn.outerHTML = '<span style="color:var(--danger); font-weight:600; font-size:14px; margin-left:10px;">✗ Rejected</span>'; }
if(aBtn) aBtn.remove();
if(rBox) rBox.remove();
}
document.addEventListener("DOMContentLoaded", () => {
loadAcknowledgementStatus();
loadAdminUploadedDocs();
});
</script>
<script src="/js/auth.js"></script>
<script src="/js/chatbot.js"></script>
</body>
</html>
+66
View File
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Forgot Password</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Reset Your Password</h2>
<p>We'll send a secure link to your registered email address.</p>
</div>
<div class="auth-form-side">
<div class="auth-box">
<div style="font-size:40px;margin-bottom:12px;">🔑</div>
<h1>Forgot Password?</h1>
<p class="auth-subtitle">Enter your email and we'll send a reset link</p>
<div class="form-group" style="margin-top:24px;">
<label class="form-label" for="email">Email Address</label>
<input id="email" type="email" class="input" placeholder="you@example.com"/>
</div>
<button class="btn btn-primary w-full" id="resetBtn" onclick="sendReset()" style="border-radius:var(--radius-sm);">
Send Reset Link
</button>
<div class="auth-links"><a href="/login" class="fancy-link">← Back to Sign In</a></div>
</div>
</div>
</div>
<script src="/js/toast.js"></script>
<script>
async function sendReset() {
const email = document.getElementById("email").value.trim();
const btn = document.getElementById("resetBtn");
if (!email) { showToast("Please enter your email address", "warning"); return; }
btn.disabled = true; btn.textContent = "Sending…";
try {
await fetch("/api/auth/forgot-password", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email })
});
showToast("If that email exists, a reset link has been sent.", "info", 7000);
document.getElementById("email").value = "";
} catch { showToast("Network error. Please try again.", "error"); }
finally { btn.disabled = false; btn.textContent = "Send Reset Link"; }
}
</script>
</body>
</html>
+86
View File
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bookkeeping Landing Page</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/base.css?v=4">
<link rel="stylesheet" href="/css/components.css?v=4">
<link rel="stylesheet" href="/css/marketing.css?v=4">
<script src="/js/theme.js?v=2"></script>
</head>
<body>
{% include 'partials/navbar.html' %}
<!-- ================= HERO ================= -->
<div class="hero"></div>
<!-- ================= BOTTOM HEADER BLOCK ================= -->
<div class="bottom-block">
<div class="block-img"></div>
<div class="block-text">
<h1>PRECISION | COMPLIANCE | FINANCIAL GROWTH</h1>
<p>Your Trusted Bookkeeping & Financial Operations Partner for Growing Businesses</p>
</div>
</div>
<!-- ================= ABOUT ================= -->
<section class="about-section">
<div class="text">
<h2>
We are <span style="color:#0077C8;">BOOK</span><span style="color:#FF7F11;">KEEPRO</span>
</h2>
<p>
Our journey began in 1998 as a Chartered Accountant firm in India, built on strong fundamentals of accounting, compliance, integrity, and long-term client relationships. Over the years, we earned the trust of businesses by delivering accurate, compliant, and dependable financial services.
In 2018, responding to growing demand and an expanding client base, we strengthened our presence by establishing operations in Pune and Mumbai, two of India’s major business hubs. This phase marked our evolution from a traditional CA practice into a more structured, process-driven financial services organization.
</p>
<p class="note">-- Our People Are Passionate About What We Do</p>
</div>
<img src="./images/home-about.jpg">
</section>
<!-- ================= SERVICES ================= -->
<section class="services-section">
<h2>OUR SERVICES</h2>
<div class="services-grid">
<div class="service-card">
<img src="./images/Gemini_Generated_Image_5pqvpl5pqvpl5pqv.webp">
<h3>Professional Bookkeeping for Firms & Businesses</h3>
<a href="/contact"><button>Get Consultation</button></a>
</div>
<div class="service-card">
<img src="./images/Gemini_Generated_Image_qacxnoqacxnoqacx.webp">
<h3>Professional & Globally Trusted Payroll Solutions</h3>
<a href="/contact"><button>Get Consultation</button></a>
</div>
<div class="service-card">
<img src="./images/home-card.jpg">
<h3>Professional Tax Planning & <br> Preparation</h3>
<a href="/contact"><button>Get Consultation</button></a>
</div>
</div>
</section>
{% include 'partials/footer.html' %}
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

+324
View File
@@ -0,0 +1,324 @@
/**
* admin-chatbot.js — BookKeepPro Admin Chatbot Widget
*
* Provides:
* - Admin status overview (fetches from /api/chatbot/admin-status)
* - Admin FAQs
*
* Requires: auth.js (for authFetch)
*/
(function () {
"use strict";
/* ─────────────────────────────────────────────
Admin FAQ Knowledge Base
───────────────────────────────────────────── */
const FAQ_DATA = {
"Document Review": [
{
q: "How do I review a document?",
a: "From the <a href='/admin-dashboard'>Admin Dashboard</a>, click on any user. You'll see their uploaded documents. Click <b>Approve</b> or <b>Reject</b> and leave a note if needed."
},
{
q: "What happens when I reject a document?",
a: "The document's status changes to <b>Rejected</b> and the user is notified. They will see your review note and can upload a corrected version to replace it."
},
{
q: "How do I upload admin documents for a user?",
a: "Go to the user's detail page and scroll down to <b>Admin Documents</b>. You can upload tax returns, reports, and other finalized forms there. These will be visible to the user."
}
],
"User Management": [
{
q: "How do I see user details?",
a: "Simply click on any user in the <b>Admin Dashboard</b> table. This will take you to their detailed view where you can see their info and all their documents."
},
{
q: "Can I add another admin?",
a: "Currently, Super Admins can only be created via the backend script `create_super_admin.py` for security reasons."
}
],
"Notifications": [
{
q: "How are users notified?",
a: "Users receive automated emails when they sign up, when their documents are ready for review, and when you approve or reject their documents."
}
]
};
const CATEGORY_ICONS = {
"Document Review": "📑",
"User Management": "👥",
"Notifications": "🔔"
};
/* ─────────────────────────────────────────────
Inject HTML
───────────────────────────────────────────── */
function injectWidget() {
const widget = document.createElement("div");
widget.id = "chatbot-widget";
widget.innerHTML = `
<button class="chatbot-fab" id="chatFab" aria-label="Open admin assistant" style="background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);">
<span class="fab-icon">🤖</span>
<span class="notif-dot"></span>
</button>
<div class="chatbot-window" id="chatWindow">
<div class="chatbot-header" style="background: linear-gradient(135deg, var(--navy) 0%, #005fa3 100%);">
<div class="bot-avatar">🤖</div>
<div class="bot-info">
<h4>Admin Assistant</h4>
<span>System Insights & Help</span>
</div>
<button class="close-chat" id="chatClose" aria-label="Close chat">✕</button>
</div>
<div class="chatbot-messages" id="chatMessages"></div>
</div>
`;
document.body.appendChild(widget);
}
/* ─────────────────────────────────────────────
Core Chat Logic
───────────────────────────────────────────── */
let messagesEl;
function addBotMessage(html) {
const div = document.createElement("div");
div.className = "chat-msg bot";
div.innerHTML = html;
messagesEl.appendChild(div);
scrollToBottom();
}
function addUserMessage(text) {
const div = document.createElement("div");
div.className = "chat-msg user";
div.style.background = "linear-gradient(135deg, var(--navy), var(--blue))";
div.textContent = text;
messagesEl.appendChild(div);
scrollToBottom();
}
function showTyping() {
const div = document.createElement("div");
div.className = "typing-indicator";
div.id = "typingIndicator";
div.innerHTML = "<span></span><span></span><span></span>";
messagesEl.appendChild(div);
scrollToBottom();
}
function hideTyping() {
const el = document.getElementById("typingIndicator");
if (el) el.remove();
}
function scrollToBottom() {
requestAnimationFrame(() => {
messagesEl.scrollTop = messagesEl.scrollHeight;
});
}
function botReply(html, delay) {
delay = delay || 600;
showTyping();
setTimeout(() => {
hideTyping();
addBotMessage(html);
}, delay);
}
/* ─────────────────────────────────────────────
Quick Replies (Menu Buttons)
───────────────────────────────────────────── */
function addQuickReplies(options) {
const wrapper = document.createElement("div");
wrapper.className = "quick-replies";
options.forEach(opt => {
const btn = document.createElement("button");
btn.className = "quick-reply-btn";
btn.innerHTML = `<span class="qr-icon">${opt.icon}</span> ${opt.label}`;
btn.onclick = () => {
addUserMessage(opt.label);
opt.action();
};
wrapper.appendChild(btn);
});
messagesEl.appendChild(wrapper);
scrollToBottom();
}
/* ─────────────────────────────────────────────
Main Menu
───────────────────────────────────────────── */
function showMainMenu() {
botReply("Hello Admin! 🛠️ How can I assist you today?", 400);
setTimeout(() => {
addQuickReplies([
{ icon: "📊", label: "System Overview", action: handleSystemOverview },
{ icon: "❓", label: "Admin FAQs", action: handleFAQCategories }
]);
}, 1050);
}
function addBackButton() {
const btn = document.createElement("button");
btn.className = "back-btn";
btn.innerHTML = "← Back to main menu";
btn.onclick = () => {
addUserMessage("Back to main menu");
showMainMenu();
};
messagesEl.appendChild(btn);
scrollToBottom();
}
/* ─────────────────────────────────────────────
System Overview Flow
───────────────────────────────────────────── */
async function handleSystemOverview() {
const token = localStorage.getItem("token");
if (!token) {
botReply('You need to be logged in to view stats.', 500);
setTimeout(addBackButton, 1200);
return;
}
showTyping();
try {
const res = await window.authFetch("/api/chatbot/admin-status");
if (!res || !res.ok) {
hideTyping();
addBotMessage("Sorry, I couldn't fetch the system status right now.");
addBackButton();
return;
}
const data = await res.json();
hideTyping();
addBotMessage(`Here is the current system overview:`);
const summaryHtml = `
<div class="status-summary" style="grid-template-columns: repeat(2, 1fr);">
<div class="summary-item" style="grid-column: span 2;">
<span class="count">${data.total_users}</span>
<span class="label">Total Users</span>
</div>
<div class="summary-item pending">
<span class="count">${data.pending_personal}</span>
<span class="label">Pending Personal</span>
</div>
<div class="summary-item pending">
<span class="count">${data.pending_business}</span>
<span class="label">Pending Business</span>
</div>
</div>
`;
addBotMessage(summaryHtml);
if (data.total_pending > 0) {
setTimeout(() => {
addBotMessage(`You have a total of <b>${data.total_pending} documents</b> waiting for review!`);
}, 400);
} else {
setTimeout(() => {
addBotMessage("All caught up! 🎉 There are no pending documents to review right now.");
}, 400);
}
setTimeout(addBackButton, 800);
} catch (err) {
hideTyping();
addBotMessage("Oops! Something went wrong while fetching stats.");
addBackButton();
}
}
/* ─────────────────────────────────────────────
FAQ Flow
───────────────────────────────────────────── */
function handleFAQCategories() {
botReply("Choose a category to view admin guides:", 400);
setTimeout(() => {
const options = Object.keys(FAQ_DATA).map(cat => ({
icon: CATEGORY_ICONS[cat] || "📌",
label: cat,
action: () => showFAQList(cat)
}));
options.push({ icon: "←", label: "Back to main menu", action: showMainMenu });
addQuickReplies(options);
}, 1050);
}
function showFAQList(category) {
addBotMessage(`<b>${CATEGORY_ICONS[category] || ""} ${category}</b> — Select a guide:`);
const wrapper = document.createElement("div");
FAQ_DATA[category].forEach(item => {
const btn = document.createElement("button");
btn.className = "faq-question";
btn.textContent = item.q;
btn.onclick = () => {
addUserMessage(item.q);
botReply(item.a, 500);
setTimeout(() => {
addQuickReplies([
{ icon: "📌", label: "More " + category + " questions", action: () => showFAQList(category) },
{ icon: "🏠", label: "Back to main menu", action: showMainMenu }
]);
}, 1200);
};
wrapper.appendChild(btn);
});
messagesEl.appendChild(wrapper);
scrollToBottom();
}
/* ─────────────────────────────────────────────
Initialize Widget
───────────────────────────────────────────── */
function init() {
injectWidget();
const fab = document.getElementById("chatFab");
const window_ = document.getElementById("chatWindow");
const close_ = document.getElementById("chatClose");
messagesEl = document.getElementById("chatMessages");
let isOpen = false;
let hasOpened = false;
function toggle() {
isOpen = !isOpen;
fab.classList.toggle("open", isOpen);
window_.classList.toggle("visible", isOpen);
sessionStorage.setItem("admin_chatbot_open", isOpen ? "1" : "0");
if (isOpen && !hasOpened) {
hasOpened = true;
showMainMenu();
}
}
fab.addEventListener("click", toggle);
close_.addEventListener("click", toggle);
// Restore state from session
if (sessionStorage.getItem("admin_chatbot_open") === "1") {
toggle();
}
}
/* Start when DOM is ready */
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();
+6
View File
@@ -0,0 +1,6 @@
// admin.js — legacy reference file, not imported by any HTML page.
// admin-dashboard.html uses auth.js + inline scripts exclusively.
// Kept here as a reference stub; safe to delete if no longer needed.
// All shared utilities (authFetch, logoutUser, guardAuth, escapeHtml,
// reviewBadge, buildYearOptions) are now in /js/auth.js.
+154
View File
@@ -0,0 +1,154 @@
/**
* auth.js — shared utilities loaded by every protected page.
*
* Provides:
* authFetch(url, options) — fetch with Bearer token + auto-redirect on 401
* logoutUser() — clear storage and redirect to /login
* guardAuth(requiredRoles) — redirect if token missing or role not in list
* escapeHtml(str) — XSS-safe string for innerHTML insertion
* reviewBadge(status) — returns safe HTML badge string
* buildYearOptions(selectId, def) — populate a <select> with current year - 3 years
* initSessionWarning() — toast warning + auto-logout before JWT expiry (#17)
* makeLabelsKeyboardAccessible(root) — make upload labels keyboard-navigable (#18)
*/
(function () {
/* ── escapeHtml ──────────────────────────────────────────────────────── */
window.escapeHtml = function (str) {
return String(str == null ? "" : str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#x27;");
};
/* ── authFetch ───────────────────────────────────────────────────────── */
window.authFetch = async function (url, options = {}) {
const token = localStorage.getItem("token");
options.headers = {
...(options.headers || {}),
Authorization: "Bearer " + token,
};
const res = await fetch(url, options);
if (res.status === 401) {
localStorage.removeItem("token");
localStorage.removeItem("role");
localStorage.removeItem("selected_tax_year");
window.location.href = "/login";
return null;
}
return res;
};
/* ── logoutUser ──────────────────────────────────────────────────────── */
window.logoutUser = function () {
const role = localStorage.getItem("role");
localStorage.removeItem("token");
localStorage.removeItem("role");
localStorage.removeItem("selected_tax_year");
window.location.href = "/login";
};
/* ── guardAuth ───────────────────────────────────────────────────────── */
window.guardAuth = function (requiredRoles = ["user"]) {
const token = localStorage.getItem("token");
const role = localStorage.getItem("role");
if (!token || !requiredRoles.includes(role)) {
localStorage.removeItem("token");
localStorage.removeItem("role");
localStorage.removeItem("selected_tax_year");
window.location.href = "/login";
}
};
/* ── reviewBadge ─────────────────────────────────────────────────────── */
window.reviewBadge = function (reviewStatus) {
const map = {
approved: { bg: "#e6f9ec", color: "#2e7d32", text: `<span class="material-symbols-outlined">check</span> Approved` },
rejected: { bg: "#fdecea", color: "#c62828", text: `<span class="material-symbols-outlined">close</span> Rejected` },
pending: { bg: "#fff8e1", color: "#f57f17", text: `<span class="material-symbols-outlined">pending</span> Pending Review` },
};
const s = map[reviewStatus] || map.pending;
return `<span style="
display:inline-block;padding:2px 8px;border-radius:20px;
font-size:11px;font-weight:600;
background:${s.bg};color:${s.color};vertical-align:middle;margin-left:6px;
">${s.text}</span>`;
};
/* ── buildYearOptions ────────────────────────────────────────────────── */
window.buildYearOptions = function (selectId, defaultYear) {
const sel = document.getElementById(selectId);
if (!sel) return;
sel.innerHTML = "";
const cur = new Date().getFullYear();
const def = defaultYear || cur;
for (let y = cur; y >= cur - 3; y--) {
const o = document.createElement("option");
o.value = y;
o.textContent = y;
if (y === def) o.selected = true;
sel.appendChild(o);
}
};
/* ── initSessionWarning (#17) ────────────────────────────────────────── */
/**
* Call once after guardAuth() on every protected page.
* Shows a persistent warning toast 5 minutes before token expiry,
* then auto-logs out when the token actually expires.
*/
window.initSessionWarning = function () {
const token = localStorage.getItem("token");
if (!token) return;
try {
const payload = JSON.parse(atob(token.split(".")[1]));
const expiresIn = (payload.exp * 1000) - Date.now();
// Already expired — kick out immediately
if (expiresIn <= 0) { window.logoutUser(); return; }
// Warn 5 minutes before expiry
const warnAt = expiresIn - 5 * 60 * 1000;
if (warnAt > 0) {
setTimeout(() => {
if (window.showToast) {
showToast("Your session expires in 5 minutes. Save your work.", "warning", 0);
}
}, warnAt);
}
// Auto-logout at exact expiry
setTimeout(() => {
if (window.showToast) showToast("Session expired. Redirecting to login…", "info");
setTimeout(window.logoutUser, 2000);
}, expiresIn);
} catch (e) {
// Malformed token — let the next API call handle it via 401
}
};
/* ── makeLabelsKeyboardAccessible (#18) ─────────────────────────────── */
/**
* Make styled <label> upload buttons keyboard-accessible.
* Call after rendering any upload labels with tabindex="0".
* @param {Element} [root=document] — scope the search to a container
*/
window.makeLabelsKeyboardAccessible = function (root) {
const scope = root || document;
scope.querySelectorAll("label.upload-label[tabindex='0']").forEach(lbl => {
if (lbl._kbAttached) return;
lbl._kbAttached = true;
lbl.addEventListener("keydown", e => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
lbl.click();
}
});
});
};
})();
+416
View File
@@ -0,0 +1,416 @@
/**
* chatbot.js — BookKeepPro Chatbot Widget
*
* Provides:
* - Document status checking (fetches from /api/chatbot/doc-status)
* - FAQ answers (hardcoded knowledge base)
* - Contact support shortcut
*
* Requires: auth.js (for authFetch)
*/
(function () {
"use strict";
/* ─────────────────────────────────────────────
FAQ Knowledge Base
───────────────────────────────────────────── */
const FAQ_DATA = {
"Account": [
{
q: "How do I reset my password?",
a: 'Go to the <a href="/login">login page</a> and click <b>"Forgot Password"</b>. Enter your email and we\'ll send a reset link to your inbox.'
},
{
q: "How do I verify my email?",
a: 'Check your inbox for a verification email from BookKeepPro. Click the link inside to verify. If you didn\'t receive it, visit the <a href="/resend-verification">Resend Verification</a> page.'
},
{
q: "How do I update my profile?",
a: 'Go to your <a href="/profile">Profile page</a> to update your name, phone number, or change your password.'
},
{
q: "Can I change my email address?",
a: "Currently, email addresses cannot be changed once registered. Please contact support if you need assistance."
}
],
"Documents": [
{
q: "What file types are accepted?",
a: "We accept <b>PDF, JPG, PNG, WEBP, DOC, and DOCX</b> files. The maximum file size is <b>10 MB</b>."
},
{
q: 'What does "Pending" status mean?',
a: 'Your document has been <b>uploaded successfully</b> and is waiting for an admin to review it. You\'ll be notified once it\'s reviewed.'
},
{
q: 'What does "Rejected" mean?',
a: "The admin found an issue with your document. Check the <b>review note</b> for details about what needs to be fixed, then re-upload a corrected version."
},
{
q: "How long does review take?",
a: "Typically <b>1–3 business days</b>. You'll receive an email notification when your documents are reviewed."
},
{
q: "Can I replace an uploaded document?",
a: "Yes! Simply go to the upload page for that document type and upload a new file. It will replace the previous one."
}
],
"Tax Filing": [
{
q: "What tax years are supported?",
a: "We currently support tax years <b>2023, 2024, 2025, and 2026</b>."
},
{
q: "What personal documents do I need?",
a: 'An <b>Individual Taxpayer Organizer</b> for your tax year. Visit the <a href="/upload-personal">Personal Documents</a> page for the full checklist.'
},
{
q: "What business documents do I need?",
a: '<b>S-Corp, LLC, or Partnership Organizer</b> plus Certificate of Formation, EIN, and Annual Financial Statements. Visit the <a href="/upload-business">Business Documents</a> page.'
}
],
"Security": [
{
q: "Is my data secure?",
a: "Absolutely. All files are stored securely on our servers with <b>encrypted access tokens</b>. Only you and authorized admins can view your documents."
},
{
q: "Who can see my documents?",
a: "Only <b>you</b> and <b>authorized BookKeepPro administrators</b>. Your documents are never shared with third parties."
}
]
};
const CATEGORY_ICONS = {
"Account": "👤",
"Documents": "📄",
"Tax Filing": "📋",
"Security": "🔒"
};
/* ─────────────────────────────────────────────
Inject HTML
───────────────────────────────────────────── */
function injectWidget() {
const widget = document.createElement("div");
widget.id = "chatbot-widget";
widget.innerHTML = `
<button class="chatbot-fab" id="chatFab" aria-label="Open chat assistant">
<span class="fab-icon">💬</span>
<span class="notif-dot"></span>
</button>
<div class="chatbot-window" id="chatWindow">
<div class="chatbot-header">
<div class="bot-avatar">🤖</div>
<div class="bot-info">
<h4>BookKeep Assistant</h4>
<span>Always here to help</span>
</div>
<button class="close-chat" id="chatClose" aria-label="Close chat">✕</button>
</div>
<div class="chatbot-messages" id="chatMessages"></div>
</div>
`;
document.body.appendChild(widget);
}
/* ─────────────────────────────────────────────
Core Chat Logic
───────────────────────────────────────────── */
let messagesEl;
function addBotMessage(html) {
const div = document.createElement("div");
div.className = "chat-msg bot";
div.innerHTML = html;
messagesEl.appendChild(div);
scrollToBottom();
}
function addUserMessage(text) {
const div = document.createElement("div");
div.className = "chat-msg user";
div.textContent = text;
messagesEl.appendChild(div);
scrollToBottom();
}
function showTyping() {
const div = document.createElement("div");
div.className = "typing-indicator";
div.id = "typingIndicator";
div.innerHTML = "<span></span><span></span><span></span>";
messagesEl.appendChild(div);
scrollToBottom();
}
function hideTyping() {
const el = document.getElementById("typingIndicator");
if (el) el.remove();
}
function scrollToBottom() {
requestAnimationFrame(() => {
messagesEl.scrollTop = messagesEl.scrollHeight;
});
}
function botReply(html, delay) {
delay = delay || 600;
showTyping();
setTimeout(() => {
hideTyping();
addBotMessage(html);
}, delay);
}
/* ─────────────────────────────────────────────
Quick Replies (Menu Buttons)
───────────────────────────────────────────── */
function addQuickReplies(options) {
const wrapper = document.createElement("div");
wrapper.className = "quick-replies";
options.forEach(opt => {
const btn = document.createElement("button");
btn.className = "quick-reply-btn";
btn.innerHTML = `<span class="qr-icon">${opt.icon}</span> ${opt.label}`;
btn.onclick = () => {
addUserMessage(opt.label);
opt.action();
};
wrapper.appendChild(btn);
});
messagesEl.appendChild(wrapper);
scrollToBottom();
}
/* ─────────────────────────────────────────────
Main Menu
───────────────────────────────────────────── */
function showMainMenu() {
botReply("Hi there! 👋 I'm your BookKeep Assistant. How can I help you today?", 400);
setTimeout(() => {
addQuickReplies([
{ icon: "📄", label: "Check Document Status", action: handleDocStatus },
{ icon: "❓", label: "FAQs", action: handleFAQCategories },
{ icon: "📞", label: "Contact Support", action: handleContact }
]);
}, 1050);
}
function addBackButton() {
const btn = document.createElement("button");
btn.className = "back-btn";
btn.innerHTML = "← Back to main menu";
btn.onclick = () => {
addUserMessage("Back to main menu");
showMainMenu();
};
messagesEl.appendChild(btn);
scrollToBottom();
}
/* ─────────────────────────────────────────────
Document Status Flow
───────────────────────────────────────────── */
async function handleDocStatus() {
const token = localStorage.getItem("token");
if (!token) {
botReply('You need to <a href="/login">log in</a> first to check your document status.', 500);
setTimeout(addBackButton, 1200);
return;
}
showTyping();
try {
const res = await window.authFetch("/api/chatbot/doc-status");
if (!res || !res.ok) {
hideTyping();
addBotMessage("Sorry, I couldn't fetch your document status right now. Please try again later.");
addBackButton();
return;
}
const data = await res.json();
hideTyping();
if (data.summary.total === 0) {
addBotMessage("You haven't uploaded any documents yet! 📭");
addBotMessage('Head over to <a href="/upload-personal">Personal Documents</a> or <a href="/upload-business">Business Documents</a> to get started.');
addBackButton();
return;
}
// Summary banner
addBotMessage(`Here's your document overview — <b>${data.summary.total} documents</b> total:`);
const summaryHtml = `
<div class="status-summary">
<div class="summary-item pending">
<span class="count">${data.summary.pending}</span>
<span class="label">Pending</span>
</div>
<div class="summary-item approved">
<span class="count">${data.summary.approved}</span>
<span class="label">Approved</span>
</div>
<div class="summary-item rejected">
<span class="count">${data.summary.rejected}</span>
<span class="label">Rejected</span>
</div>
</div>
`;
addBotMessage(summaryHtml);
// Personal docs
if (data.personal.length > 0) {
let personalHtml = "<b>📂 Personal Documents:</b>";
data.personal.forEach(doc => {
personalHtml += buildDocCard(doc.doc_type, doc.status, doc.note, doc.tax_year);
});
addBotMessage(personalHtml);
}
// Business docs
if (data.business.length > 0) {
let businessHtml = "<b>💼 Business Documents:</b>";
data.business.forEach(doc => {
businessHtml += buildDocCard(doc.business_type, doc.status, doc.note, doc.tax_year);
});
addBotMessage(businessHtml);
}
// Alert on rejected
if (data.summary.rejected > 0) {
setTimeout(() => {
addBotMessage('⚠️ You have <b>' + data.summary.rejected + ' rejected</b> document(s). Please check the review notes and re-upload corrected versions.');
}, 300);
}
setTimeout(addBackButton, 500);
} catch (err) {
hideTyping();
addBotMessage("Oops! Something went wrong while fetching your status. Please try again.");
addBackButton();
}
}
function buildDocCard(name, status, note, year) {
const statusIcon = status === "approved" ? "🟢" : status === "rejected" ? "🔴" : "🟡";
const noteHtml = note ? `<div class="doc-note">📝 ${escapeText(note)}</div>` : "";
return `
<div class="doc-status-card">
<div class="doc-name">${escapeText(name)}</div>
<div class="doc-year">Tax Year: ${year}</div>
<span class="doc-badge ${status}">${statusIcon} ${status}</span>
${noteHtml}
</div>
`;
}
function escapeText(str) {
if (typeof window.escapeHtml === "function") return window.escapeHtml(str);
const div = document.createElement("div");
div.textContent = str || "";
return div.innerHTML;
}
/* ─────────────────────────────────────────────
FAQ Flow
───────────────────────────────────────────── */
function handleFAQCategories() {
botReply("Choose a category to browse common questions:", 400);
setTimeout(() => {
const options = Object.keys(FAQ_DATA).map(cat => ({
icon: CATEGORY_ICONS[cat] || "📌",
label: cat,
action: () => showFAQList(cat)
}));
options.push({ icon: "←", label: "Back to main menu", action: showMainMenu });
addQuickReplies(options);
}, 1050);
}
function showFAQList(category) {
addBotMessage(`<b>${CATEGORY_ICONS[category] || ""} ${category}</b> — Pick a question:`);
const wrapper = document.createElement("div");
FAQ_DATA[category].forEach(item => {
const btn = document.createElement("button");
btn.className = "faq-question";
btn.textContent = item.q;
btn.onclick = () => {
addUserMessage(item.q);
botReply(item.a, 500);
setTimeout(() => {
addQuickReplies([
{ icon: "📌", label: "More " + category + " questions", action: () => showFAQList(category) },
{ icon: "🏠", label: "Back to main menu", action: showMainMenu }
]);
}, 1200);
};
wrapper.appendChild(btn);
});
messagesEl.appendChild(wrapper);
scrollToBottom();
}
/* ─────────────────────────────────────────────
Contact Support Flow
───────────────────────────────────────────── */
function handleContact() {
botReply(
'You can reach our team anytime! 📧<br><br>' +
'<b>Email:</b> <a href="mailto:atharvg.aiindia@gmail.com">atharvg.aiindia@gmail.com</a><br><br>' +
'Or use our <a href="/contact">Contact Form</a> and we\'ll get back to you within 24 hours.',
500
);
setTimeout(addBackButton, 1200);
}
/* ─────────────────────────────────────────────
Initialize Widget
───────────────────────────────────────────── */
function init() {
injectWidget();
const fab = document.getElementById("chatFab");
const window_ = document.getElementById("chatWindow");
const close_ = document.getElementById("chatClose");
messagesEl = document.getElementById("chatMessages");
let isOpen = false;
let hasOpened = false;
function toggle() {
isOpen = !isOpen;
fab.classList.toggle("open", isOpen);
window_.classList.toggle("visible", isOpen);
sessionStorage.setItem("chatbot_open", isOpen ? "1" : "0");
if (isOpen && !hasOpened) {
hasOpened = true;
showMainMenu();
}
}
fab.addEventListener("click", toggle);
close_.addEventListener("click", toggle);
// Restore state from session
if (sessionStorage.getItem("chatbot_open") === "1") {
toggle();
}
}
/* Start when DOM is ready */
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();
+118
View File
@@ -0,0 +1,118 @@
/**
* confirm-modal.js — non-blocking replacement for window.confirm().
*
* Usage:
* const ok = await confirmModal("Delete this document?");
* if (!ok) return;
*
* Optional second argument for the confirm button label:
* await confirmModal("Remove user?", "Delete")
*/
(function () {
/* Inject styles once */
if (!document.getElementById("confirm-modal-styles")) {
const style = document.createElement("style");
style.id = "confirm-modal-styles";
style.textContent = `
.cm-backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.35);
z-index: 100000;
display: flex;
align-items: center;
justify-content: center;
animation: cm-fade-in 0.15s ease;
}
.cm-box {
background: #fff;
border-radius: 14px;
padding: 28px 32px;
max-width: 380px;
width: 90%;
box-shadow: 0 8px 32px rgba(0,0,0,0.18);
text-align: center;
animation: cm-slide-in 0.15s ease;
}
.cm-icon {
font-size: 36px;
margin-bottom: 12px;
}
.cm-message {
font-family: "Poppins", "Segoe UI", sans-serif;
font-size: 15px;
color: #333;
line-height: 1.5;
margin-bottom: 22px;
white-space: pre-line;
}
.cm-actions {
display: flex;
gap: 12px;
justify-content: center;
}
.cm-btn {
padding: 10px 24px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
border: none;
transition: opacity 0.15s;
}
.cm-btn:hover { opacity: 0.85; }
.cm-btn-cancel { background: #f0f0f0; color: #555; }
.cm-btn-confirm { background: #ff4d4d; color: #fff; }
@keyframes cm-fade-in { from { opacity:0 } to { opacity:1 } }
@keyframes cm-slide-in { from { transform:scale(0.92) } to { transform:scale(1) } }
`;
document.head.appendChild(style);
}
/**
* @param {string} message — text shown in the modal
* @param {string} [confirmLabel="Confirm"] — label for the confirm button
* @returns {Promise<boolean>}
*/
window.confirmModal = function (message, confirmLabel = "Confirm") {
return new Promise((resolve) => {
const backdrop = document.createElement("div");
backdrop.className = "cm-backdrop";
backdrop.innerHTML = `
<div class="cm-box" role="dialog" aria-modal="true">
<div class="cm-icon"><span class="material-symbols-outlined">warning</span></div>
<div class="cm-message">${escapeHtml ? escapeHtml(message) : message}</div>
<div class="cm-actions">
<button class="cm-btn cm-btn-cancel" id="cm-cancel">Cancel</button>
<button class="cm-btn cm-btn-confirm" id="cm-confirm">${confirmLabel}</button>
</div>
</div>
`;
function cleanup(result) {
backdrop.remove();
resolve(result);
}
backdrop.querySelector("#cm-cancel").addEventListener("click", () => cleanup(false));
backdrop.querySelector("#cm-confirm").addEventListener("click", () => cleanup(true));
/* Close on backdrop click */
backdrop.addEventListener("click", (e) => {
if (e.target === backdrop) cleanup(false);
});
/* Close on Escape */
function onKeyDown(e) {
if (e.key === "Escape") { document.removeEventListener("keydown", onKeyDown); cleanup(false); }
}
document.addEventListener("keydown", onKeyDown);
document.body.appendChild(backdrop);
/* Focus the cancel button by default (safer UX) */
backdrop.querySelector("#cm-cancel").focus();
});
};
})();
+88
View File
@@ -0,0 +1,88 @@
/**
* Password strength indicator.
* Call initPasswordStrength("inputId") to attach to a password field.
* A bar + label appear below the field automatically.
*/
(function () {
if (!document.getElementById("pw-strength-styles")) {
const style = document.createElement("style");
style.id = "pw-strength-styles";
style.textContent = `
.pw-strength-bar-wrap {
height: 4px;
background: #e0e0e0;
border-radius: 2px;
margin-top: -8px;
margin-bottom: 10px;
overflow: hidden;
}
.pw-strength-bar {
height: 100%;
border-radius: 2px;
transition: width 0.3s ease, background 0.3s ease;
width: 0;
}
.pw-strength-label {
font-size: 12px;
margin-bottom: 10px;
margin-top: -6px;
font-weight: 500;
}
.pw-weak { background: #c62828; }
.pw-medium { background: #f57f17; }
.pw-strong { background: #2e7d32; }
`;
document.head.appendChild(style);
}
function checkStrength(pw) {
if (!pw || pw.length < 8) return { level: "weak", pct: 25, label: "Too short (min 8 chars)", cls: "pw-weak" };
const hasUpper = /[A-Z]/.test(pw);
const hasNum = /[0-9]/.test(pw);
const hasSymbol = /[^A-Za-z0-9]/.test(pw);
const long = pw.length >= 12;
const score = [hasUpper, hasNum, hasSymbol, long].filter(Boolean).length;
if (score <= 1) return { level: "weak", pct: 33, label: "Weak — add uppercase & numbers", cls: "pw-weak" };
if (score === 2) return { level: "medium", pct: 66, label: "Medium — getting better", cls: "pw-medium" };
return { level: "strong", pct: 100, label: `Strong password <span class="material-symbols-outlined">check</span>`, cls: "pw-strong" };
}
window.initPasswordStrength = function (inputId) {
const input = document.getElementById(inputId);
if (!input) return;
// Create bar + label
const barWrap = document.createElement("div");
barWrap.className = "pw-strength-bar-wrap";
const bar = document.createElement("div");
bar.className = "pw-strength-bar";
barWrap.appendChild(bar);
const label = document.createElement("div");
label.className = "pw-strength-label";
label.style.color = "#888";
// Insert after input's parent wrapper (handles both plain input and wrapped input)
const after = input.closest("div") || input;
after.after(label);
after.after(barWrap);
input.addEventListener("input", () => {
const val = input.value;
if (!val) {
bar.style.width = "0";
bar.className = "pw-strength-bar";
label.textContent = "";
return;
}
const { pct, label: lbl, cls } = checkStrength(val);
bar.style.width = pct + "%";
bar.className = "pw-strength-bar " + cls;
label.innerHTML = lbl;
label.style.color = cls === "pw-weak" ? "#c62828" : cls === "pw-medium" ? "#f57f17" : "#2e7d32";
});
};
})();
+70
View File
@@ -0,0 +1,70 @@
async function signupUser() {
const name = document.getElementById('name')?.value?.trim() || '';
const email = document.getElementById('email')?.value?.trim() || '';
const phone = document.getElementById('phone')?.value?.trim() || '';
const password = document.getElementById('password')?.value || '';
if (!name || !email || !password) {
showToast('Please fill in all required fields', 'warning');
return;
}
try {
const res = await fetch('/api/auth/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, email, phone, password })
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
showToast(`Signup failed: ${data.detail || data.error || 'Unknown error'}`, 'error');
return;
}
// Email verification required — show message, do NOT log in
if (data.email_verification_required) {
const container = document.getElementById('signupForm')?.closest('.auth-box')
|| document.querySelector('.auth-box');
if (container) {
container.innerHTML = `
<div style="text-align:center;padding:10px 0;">
<div style="font-size:52px;margin-bottom:18px;">📧</div>
<h2 style="color:#0077c8;margin-bottom:14px;">Check your email</h2>
<p style="color:#555;font-size:15px;line-height:1.7;margin-bottom:20px;">
We've sent a verification link to<br>
<strong>${escapeHtml ? escapeHtml(email) : email}</strong><br><br>
Click the link in the email to activate your account.
</p>
<p style="font-size:13px;color:#888;margin-bottom:6px;">Didn't receive it?</p>
<a href="/resend-verification"
style="color:#FF7F11;font-weight:600;font-size:14px;text-decoration:none;">
Resend verification email
</a>
<div style="margin-top:20px;">
<a href="/login" style="color:#0077c8;font-size:14px;">Back to Login</a>
</div>
</div>
`;
} else {
showToast('Account created! Check your email to verify before logging in.', 'success', 6000);
window.location.href = '/login';
}
return;
}
// Admin accounts created via backend bypass verification — log them in directly
if (data.access_token) {
localStorage.setItem('token', data.access_token);
localStorage.setItem('role', data.role || 'user');
localStorage.setItem('user_id', data.user_id || '');
window.location.href = '/dashboard';
}
} catch (err) {
console.error('Signup error', err);
showToast('Network error. Please try again.', 'error');
}
}
window.signupUser = signupUser;
+66
View File
@@ -0,0 +1,66 @@
/**
* Spinner helpers — no dependencies.
*
* Usage:
* showSpinner(container) // replace content with spinner
* hideSpinner(container, html) // restore container with new html
* spinnerHtml() // returns raw spinner html string (for innerHTML)
*/
(function () {
if (!document.getElementById("spinner-styles")) {
const style = document.createElement("style");
style.id = "spinner-styles";
style.textContent = `
.spinner-wrap {
display: flex;
justify-content: center;
align-items: center;
padding: 40px 20px;
}
.spinner {
width: 36px;
height: 36px;
border: 3px solid #e0e0e0;
border-top-color: #0077c8;
border-radius: 50%;
animation: _spin 0.7s linear infinite;
flex-shrink: 0;
}
.spinner.spinner-sm {
width: 20px;
height: 20px;
border-width: 2px;
}
@keyframes _spin { to { transform: rotate(360deg); } }
`;
document.head.appendChild(style);
}
window.spinnerHtml = function (small = false) {
return `<div class="spinner-wrap"><div class="spinner${small ? " spinner-sm" : ""}"></div></div>`;
};
window.showSpinner = function (el) {
if (!el) return;
el._savedContent = el.innerHTML;
el.innerHTML = spinnerHtml();
};
window.hideSpinner = function (el, html) {
if (!el) return;
el.innerHTML = html !== undefined ? html : (el._savedContent || "");
};
window.setButtonLoading = function(btn, isLoading, originalText = "") {
if (!btn) return;
if (isLoading) {
btn.disabled = true;
btn._savedText = btn.innerHTML;
btn.innerHTML = `<div class="spinner spinner-sm" style="border-top-color:#fff; border-right-color:rgba(255,255,255,0.3); border-bottom-color:rgba(255,255,255,0.3); border-left-color:rgba(255,255,255,0.3); width:16px; height:16px; display:inline-block; vertical-align:middle; margin-right:8px;"></div> ${originalText || 'Processing...'}`;
} else {
btn.disabled = false;
btn.innerHTML = originalText || btn._savedText || "";
}
};
})();
+40
View File
@@ -0,0 +1,40 @@
(function() {
function setTheme(isDark) {
if (isDark) {
document.documentElement.classList.add('dark-theme');
if (document.body) document.body.classList.add('dark-theme');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.classList.remove('dark-theme');
if (document.body) document.body.classList.remove('dark-theme');
localStorage.setItem('theme', 'light');
}
// Update all toggle icons if they exist
document.querySelectorAll('.theme-toggle-icon').forEach(icon => {
icon.textContent = isDark ? 'light_mode' : 'dark_mode';
});
}
window.toggleTheme = function() {
const isDark = document.documentElement.classList.contains('dark-theme');
setTheme(!isDark);
};
function initTheme() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
setTheme(true);
} else {
setTheme(false);
}
}
// Initialize immediately (for documentElement) to avoid flash
initTheme();
// Also run on DOMContentLoaded to ensure body gets the class if script was in <head>
document.addEventListener('DOMContentLoaded', () => {
initTheme();
});
})();
+108
View File
@@ -0,0 +1,108 @@
/**
* Toast notification system — no dependencies, no libraries.
* Usage:
* showToast("Saved successfully") // green success
* showToast("Something failed", "error") // red error
* showToast("Processing...", "info", 0) // blue, stays until dismissed
* showToast("Check your input", "warning") // orange warning
*/
(function () {
// Inject styles once
if (!document.getElementById("toast-styles")) {
const style = document.createElement("style");
style.id = "toast-styles";
style.textContent = `
#toast-container {
position: fixed;
bottom: 24px;
right: 24px;
z-index: 99999;
display: flex;
flex-direction: column;
gap: 10px;
max-width: 340px;
}
.toast {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 13px 16px;
border-radius: 10px;
font-family: "Poppins", "Segoe UI", sans-serif;
font-size: 14px;
font-weight: 500;
line-height: 1.4;
box-shadow: 0 4px 16px rgba(0,0,0,0.13);
cursor: pointer;
animation: toast-in 0.3s ease;
transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.toast-out {
opacity: 0;
transform: translateX(20px);
}
.toast.success { background:#e6f9ec; color:#1b5e20; border-left:4px solid #2e7d32; }
.toast.error { background:#fdecea; color:#b71c1c; border-left:4px solid #c62828; }
.toast.info { background:#e3f2fd; color:#0d47a1; border-left:4px solid #1565c0; }
.toast.warning { background:#fff8e1; color:#e65100; border-left:4px solid #f57f17; }
.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-msg { flex: 1; }
.toast-close { font-size: 16px; cursor: pointer; opacity: 0.5; flex-shrink: 0; margin-top: 1px; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); }
}
`;
document.head.appendChild(style);
}
function getContainer() {
let c = document.getElementById("toast-container");
if (!c) {
c = document.createElement("div");
c.id = "toast-container";
document.body.appendChild(c);
}
return c;
}
const ICONS = {
success: '<span class="material-symbols-outlined">check_circle</span>',
error: '<span class="material-symbols-outlined">cancel</span>',
info: '<span class="material-symbols-outlined">info</span>',
warning: '<span class="material-symbols-outlined">warning</span>',
};
/**
* @param {string} message — text to show
* @param {string} type — "success" | "error" | "info" | "warning"
* @param {number} duration — ms before auto-dismiss (0 = stay until clicked)
*/
window.showToast = function (message, type = "success", duration = 3500) {
const container = getContainer();
const toast = document.createElement("div");
toast.className = `toast ${type}`;
toast.innerHTML = `
<span class="toast-icon">${ICONS[type] || "💬"}</span>
<span class="toast-msg">${message}</span>
<span class="toast-close" title="Dismiss">✕</span>
`;
function dismiss() {
toast.classList.add("toast-out");
setTimeout(() => toast.remove(), 300);
}
toast.addEventListener("click", dismiss);
if (duration > 0) {
setTimeout(dismiss, duration);
}
container.appendChild(toast);
return toast;
};
})();
+110
View File
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Login</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<!-- Brand Panel -->
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Welcome Back</h2>
<p>Secure access to your bookkeeping portal. Upload documents, track filings, and stay organised.</p>
</div>
<!-- Form Panel -->
<div class="auth-form-side">
<div class="auth-box">
<a href="/" class="fancy-link" style="display:inline-block; margin-bottom: 1.5rem; font-size: 0.95rem; font-weight: 500;">&larr; Back to Home</a>
<h1>Sign In</h1>
<p class="auth-subtitle">Enter your credentials to continue</p>
<div class="form-group">
<label class="form-label" for="email">Email Address</label>
<input id="email" type="email" class="input" placeholder="you@example.com" required/>
</div>
<div class="form-group">
<label class="form-label" for="password">Password</label>
<div class="password-wrap">
<input id="password" type="password" class="input" placeholder="Your password" required/>
<button type="button" class="password-toggle" id="toggleBtn" onclick="togglePassword()">Show</button>
</div>
</div>
<button class="btn btn-primary w-full" onclick="loginUser()" style="border-radius:var(--radius-sm);margin-top:4px;">
Sign In
</button>
<div class="auth-links">
<a href="/forgot-password" class="fancy-link">Forgot password?</a><br/>
Don't have an account? <a href="/signup" class="fancy-link">Sign Up</a>
</div>
</div>
</div>
</div>
<script src="/js/spinner.js"></script>
<script src="/js/toast.js"></script>
<script>
async function loginUser() {
const email = document.getElementById("email").value.trim();
const password = document.getElementById("password").value;
const btn = document.querySelector(".btn-primary");
if (!email || !password) return showToast("Enter email and password", "warning");
setButtonLoading(btn, true, "Signing in...");
const res = await fetch("/api/auth/login", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email, password })
});
const data = await res.json();
setButtonLoading(btn, false, "Sign In");
if (!res.ok) {
if (data.detail === "EMAIL_NOT_VERIFIED") {
document.querySelector(".auth-box").innerHTML = `
<div style="text-align:center;padding:16px 0;">
<div style="font-size:52px;margin-bottom:16px;">📧</div>
<h2 style="margin-bottom:12px;">Email Not Verified</h2>
<p style="margin-bottom:20px;">Please verify your email address before logging in.<br>Check your inbox for the verification link.</p>
<a href="/resend-verification" class="btn btn-primary" style="border-radius:var(--radius-sm);">Resend Verification Email</a>
<div style="margin-top:16px;"><a href="/login" class="fancy-link">Try a different account</a></div>
</div>`;
return;
}
return showToast(data.detail || "Login failed", "error");
}
localStorage.setItem("token", data.access_token);
localStorage.setItem("role", data.role);
localStorage.setItem("user_id", data.user_id);
window.location.href = (data.role === "admin" || data.role === "super_admin")
? "/admin-dashboard" : "/dashboard";
}
function togglePassword() {
const pwd = document.getElementById("password");
const btn = document.getElementById("toggleBtn");
pwd.type = pwd.type === "password" ? "text" : "password";
btn.textContent = pwd.type === "password" ? "Show" : "Hide";
}
</script>
</body>
</html>
+38
View File
@@ -0,0 +1,38 @@
<footer class="footer">
<div class="footer-top">
<div class="footer-left">
<img src="./images/bookkeeppro-logo.webp" class="footer-logo" alt="Bookkeepro">
<p>Your Globally Trusted Bookkeeping Partner.</p>
</div>
<div class="footer-links">
<h4>Quick Links</h4>
<a href="/home">Home</a>
<a href="/about-us">About Us</a>
<a href="/services">Services</a>
<a href="/contact">Contact Us</a>
</div>
<div class="footer-contact">
<h4>Contact</h4>
<p>📍 USA: McKinney, TX</p>
<p>📍 India: Pune, Maharashtra</p>
<p>📧 vedant.aiindia@gmail.com</p>
<p>📞 +918275367267</p>
</div>
</div>
<div class="footer-bottom">
<p>© 2026 Bookkeeping Business Solutions. All rights reserved.</p>
</div>
</footer>
<script>
function toggleMenu(){
document.getElementById("navMenu").classList.toggle("active");
}
</script>
+37
View File
@@ -0,0 +1,37 @@
<div class="navbar {% if navbar_class is defined %}{{ navbar_class }}{% endif %}">
<div class="nav-container">
<a href="/home">
<img id="logos" src="./images/bookkeeppro-logo.webp" alt="Bookkeeping Logo">
</a>
<nav id="navMenu" class="nav-menu">
<a href="/home">Home</a>
<a href="/about-us">About Us</a>
<a href="/services">Services</a>
<a href="/contact">Contact Us</a>
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<!-- DESKTOP LOGIN -->
<button class="login-btn desktop-login"
onclick="window.location.href='/login'">
Sign in
</button>
<!-- MOBILE LOGIN -->
<button class="login-btn mobile-login"
onclick="window.location.href='/login'">
Sign in
</button>
</nav>
<div class="hamburger" onclick="toggleMenu()">
<span></span><span></span><span></span>
</div>
</div>
</div>
+165
View File
@@ -0,0 +1,165 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>BookKeepPro | My Profile</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<link rel="stylesheet" href="/css/chatbot.css"/>
<style>html{height:100%;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="goBack()" alt="BookKeepPro"/>
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-ghost btn-sm" onclick="goBack()">← Dashboard</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main page-enter" style="max-width:680px;">
<div class="page-heading">
<div>
<h1>My Profile</h1>
<p class="page-meta">Update your name, phone number, or password</p>
</div>
</div>
<div class="card" style="margin-bottom:20px;">
<h3 style="margin-bottom:20px;padding-bottom:12px;border-bottom:1px solid var(--border);">Account Info</h3>
<div class="form-group">
<label class="form-label">Email Address <span style="color:var(--muted);font-weight:400">(cannot be changed)</span></label>
<input type="email" id="email" class="input" readonly/>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;">
<div class="form-group">
<label class="form-label" for="name">Full Name</label>
<input type="text" id="name" class="input" placeholder="Your full name"/>
</div>
<div class="form-group">
<label class="form-label" for="phone">Phone Number</label>
<input type="tel" id="phone" class="input" placeholder="+1 (555) 000-0000"/>
</div>
</div>
</div>
<div class="card" style="margin-bottom:24px;">
<div class="flex-between" style="margin-bottom:4px;cursor:pointer;" onclick="togglePwSection()">
<h3>Change Password</h3>
<span id="pwToggleIcon" style="color:var(--muted);font-size:18px;">▶</span>
</div>
<p class="text-sm" style="margin-bottom:0;">Click to expand and update your password</p>
<div class="pw-section" id="pwSection" style="display:none;margin-top:20px;padding-top:20px;border-top:1px solid var(--border);">
<div class="form-group">
<label class="form-label" for="currentPw">Current Password</label>
<input type="password" id="currentPw" class="input" placeholder="Enter current password"/>
</div>
<div class="form-group">
<label class="form-label" for="newPw">New Password</label>
<div class="password-wrap">
<input type="password" id="newPw" class="input" placeholder="At least 8 characters" style="padding-right:56px;"/>
<button type="button" class="password-toggle" onclick="toggleField('newPw',this)">Show</button>
</div>
</div>
<div class="form-group">
<label class="form-label" for="confirmPw">Confirm New Password</label>
<input type="password" id="confirmPw" class="input" placeholder="Repeat new password"/>
</div>
</div>
</div>
<button class="btn btn-primary w-full" id="saveBtn" onclick="saveProfile()" style="border-radius:var(--radius-sm);">
Save Changes
</button>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<small>© 2026 Bookkeeping Business Solutions</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/password-strength.js"></script>
<script>
guardAuth(["user", "admin", "super_admin"]);
initSessionWarning();
function goBack() {
const role = localStorage.getItem("role");
window.location.href = (role === "admin" || role === "super_admin") ? "/admin-dashboard" : "/dashboard";
}
function togglePwSection() {
const sec = document.getElementById("pwSection");
const icon = document.getElementById("pwToggleIcon");
const open = sec.style.display === "none";
sec.style.display = open ? "block" : "none";
icon.textContent = open ? "▼" : "▶";
if (open) initPasswordStrength("newPw");
}
function toggleField(id, btn) {
const input = document.getElementById(id);
input.type = input.type === "password" ? "text" : "password";
btn.textContent = input.type === "password" ? "Show" : "Hide";
}
async function loadProfile() {
const res = await authFetch("/api/auth/me");
if (!res || !res.ok) return;
const data = await res.json();
document.getElementById("email").value = data.email || "";
document.getElementById("name").value = data.name || "";
document.getElementById("phone").value = data.phone || "";
}
async function saveProfile() {
const btn = document.getElementById("saveBtn");
btn.disabled = true; btn.textContent = "Saving…";
const name = document.getElementById("name").value.trim();
const phone = document.getElementById("phone").value.trim();
const curPw = document.getElementById("currentPw").value;
const newPw = document.getElementById("newPw").value;
const confPw = document.getElementById("confirmPw").value;
const pwOpen = document.getElementById("pwSection").style.display !== "none";
if (pwOpen && newPw) {
if (newPw.length < 8) { showToast("New password must be at least 8 characters", "error"); btn.disabled=false; btn.textContent="Save Changes"; return; }
if (newPw !== confPw) { showToast("Passwords do not match", "error"); btn.disabled=false; btn.textContent="Save Changes"; return; }
if (!curPw) { showToast("Enter your current password to change it", "warning"); btn.disabled=false; btn.textContent="Save Changes"; return; }
}
const body = { name, phone };
if (pwOpen && newPw) { body.current_password = curPw; body.new_password = newPw; }
const res = await authFetch("/api/auth/me", { method:"PATCH", headers:{"Content-Type":"application/json"}, body:JSON.stringify(body) });
btn.disabled=false; btn.textContent="Save Changes";
if (!res) return;
const data = await res.json();
if (!res.ok) { showToast(data.detail || "Failed to save profile", "error"); return; }
showToast("Profile updated successfully", "success");
document.getElementById("currentPw").value = "";
document.getElementById("newPw").value = "";
document.getElementById("confirmPw").value = "";
}
loadProfile();
</script>
<script src="/js/chatbot.js"></script>
</body>
</html>
+66
View File
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Resend Verification</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Verify Your Email</h2>
<p>Check your inbox for the verification link. It expires in 24 hours.</p>
</div>
<div class="auth-form-side">
<div class="auth-box">
<div style="font-size:40px;margin-bottom:12px;">📧</div>
<h1>Resend Verification</h1>
<p class="auth-subtitle">We'll send a new link to your registered email</p>
<div class="form-group" style="margin-top:24px;">
<label class="form-label" for="email">Email Address</label>
<input id="email" type="email" class="input" placeholder="you@example.com"/>
</div>
<button class="btn btn-primary w-full" id="resendBtn" onclick="resend()" style="border-radius:var(--radius-sm);">
Send Verification Link
</button>
<div class="auth-links"><a href="/login" class="fancy-link">Back to Sign In</a></div>
</div>
</div>
</div>
<script src="/js/toast.js"></script>
<script>
async function resend() {
const email = document.getElementById("email").value.trim();
const btn = document.getElementById("resendBtn");
if (!email) { showToast("Please enter your email address", "warning"); return; }
btn.disabled = true; btn.textContent = "Sending…";
try {
await fetch("/api/auth/resend-verification", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email })
});
showToast("If that email is registered and unverified, a new link has been sent. Check your inbox.", "info", 7000);
document.getElementById("email").value = "";
} catch { showToast("Network error. Please try again.", "error"); }
finally { btn.disabled = false; btn.textContent = "Send Verification Link"; }
}
</script>
</body>
</html>
+87
View File
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Reset Password</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Choose a New Password</h2>
<p>Pick something strong — at least 8 characters with a mix of letters, numbers, and symbols.</p>
</div>
<div class="auth-form-side">
<div class="auth-box">
<div style="font-size:40px;margin-bottom:12px;">🔒</div>
<h1>Reset Password</h1>
<p class="auth-subtitle">Enter your new password below</p>
<div class="form-group" style="margin-top:24px;">
<label class="form-label" for="password">New Password</label>
<div class="password-wrap">
<input id="password" type="password" class="input" placeholder="At least 8 characters"/>
<button type="button" class="password-toggle" onclick="togglePassword()">Show</button>
</div>
</div>
<button class="btn btn-primary w-full" id="resetBtn" onclick="resetPassword()" style="border-radius:var(--radius-sm);">
Reset Password
</button>
<div class="auth-links"><a href="/login" class="fancy-link">Back to Sign In</a></div>
</div>
</div>
</div>
<script src="/js/toast.js"></script>
<script src="/js/password-strength.js"></script>
<script>
const params = new URLSearchParams(window.location.search);
const token = params.get("token");
document.addEventListener("DOMContentLoaded", () => {
if (!token) showToast("Invalid or missing reset link. Request a new one.", "error", 0);
initPasswordStrength("password");
});
async function resetPassword() {
const new_password = document.getElementById("password").value;
const btn = document.getElementById("resetBtn");
if (!new_password) { showToast("Please enter a new password", "warning"); return; }
btn.disabled = true; btn.textContent = "Resetting…";
try {
const res = await fetch("/api/auth/reset-password", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token, new_password })
});
const data = await res.json();
if (!res.ok) { showToast(data.detail || "Password reset failed", "error"); return; }
showToast("Password reset! Redirecting to sign in…", "success");
setTimeout(() => window.location.href = "/login", 2000);
} catch { showToast("Network error. Please try again.", "error"); }
finally { btn.disabled = false; btn.textContent = "Reset Password"; }
}
function togglePassword() {
const input = document.getElementById("password");
const btn = document.querySelector(".password-toggle");
input.type = input.type === "password" ? "text" : "password";
btn.textContent = input.type === "password" ? "Show" : "Hide";
}
</script>
</body>
</html>
+117
View File
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Services — BookKeepro</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/base.css?v=4">
<link rel="stylesheet" href="/css/components.css?v=4">
<link rel="stylesheet" href="/css/marketing.css?v=4">
<script src="/js/theme.js?v=2"></script>
</head>
<body>
{% include 'partials/navbar.html' %}
<!-- ================= HERO ================= -->
<div class="page-hero">
<h1>Professional Services for Firms & Businesses</h1>
</div>
<!-- ================= SERVICE CONTENT ================= -->
<div class="services-wrapper">
<!-- Block 1 -->
<div class="service-block">
<div class="service-text">
<h2>For Accounting Firms and Businesses</h2>
<p>
Bookkeepro India specialises in its offshore delivery model and consists of a strong team of qualified
accountants, cost accountants, tax consultants and payroll experts to ease the bookkeeping for Accounting
Firms and Businesses, globally.
</p>
<br>
<p>
Bookkeepro’s India based offshore bookkeeping services offer several benefits
to global accounting firms and businesses.
</p>
</div>
<img class="service-img"
src="./images/services-3.jpg"
alt="Accounting Outsourcing">
</div>
<!-- Block 2 -->
<div class="service-block reverse">
<div class="service-text">
<h2>Scale Your Business with Accounting Outsourcing</h2>
<p>
Are you ready to supercharge your business and take it to new heights?
We understand that managing finances and accounting can be a complex and
time-consuming task, often diverting your focus away from what truly matters —
growing your business.
</p>
<br>
<p>
That’s where we come in. Allow us to present the game-changing solution:
Accounting Outsourcing.
</p>
</div>
<img class="service-img-bl-3"
src="./images/services-2.jpg"
alt="Outsourced Accounting Team">
</div>
<!-- Block 3 -->
<div class="service-block">
<div class="service-text">
<h2>Tax Planning And Preparation</h2>
<p>
We help individuals and businesses optimize tax strategy and get returns prepared right and on time.
Whether your business is an LLC, S-Corp, or C-Corp, we’ll help you:
</p>
<ol class="list-items">
<li>Comply with and leverage changing federal tax law</li>
<li>Minimize overall tax liability through strategic planning</li>
<li>Determine taxation of owner-provided benefits</li>
<li>Leverage year-end tax opportunities</li>
<li>Manage multi-state tax exposure based on nexus</li>
</ol>
<br>
<p>
Our proactive approach goes beyond traditional filing to deliver long-term value.
</p>
</div>
<img class="service-img"
src="./images/services-1.jpg"
alt="Tax Strategy Services">
</div>
</div>
{% include 'partials/footer.html' %}
</body>
</html>
+87
View File
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Sign Up</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Join BookKeepPro</h2>
<p>Create your account to securely upload documents, track reviews, and stay on top of your filings.</p>
</div>
<div class="auth-form-side">
<div class="auth-box">
<a href="/" class="fancy-link" style="display:inline-block; margin-bottom: 1.5rem; font-size: 0.95rem; font-weight: 500;">&larr; Back to Home</a>
<h1>Create Account</h1>
<p class="auth-subtitle">It only takes a minute</p>
<form id="signupForm" autocomplete="off">
<div class="form-group">
<label class="form-label" for="name">Full Name</label>
<input id="name" type="text" class="input" placeholder="Jane Smith" required/>
</div>
<div class="form-group">
<label class="form-label" for="email">Email Address</label>
<input id="email" type="email" class="input" placeholder="you@example.com" required/>
</div>
<div class="form-group">
<label class="form-label" for="phone">Phone Number <span style="color:var(--muted);font-weight:400">(optional)</span></label>
<input id="phone" type="tel" class="input" placeholder="+1 (555) 000-0000"/>
</div>
<div class="form-group">
<label class="form-label" for="password">Password</label>
<div class="password-wrap">
<input id="password" type="password" class="input" placeholder="At least 8 characters" required style="padding-right:56px;"/>
<button type="button" class="password-toggle" id="toggleBtn" onclick="togglePassword()">Show</button>
</div>
</div>
<button type="submit" class="btn btn-primary w-full" id="signupBtn" style="border-radius:var(--radius-sm);">
Create Account
</button>
<div class="auth-links">Already have an account? <a href="/login" class="fancy-link">Sign In</a></div>
</form>
</div>
</div>
</div>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/signup.js"></script>
<script src="/js/password-strength.js"></script>
<script src="/js/spinner.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => { initPasswordStrength("password"); });
document.getElementById("signupForm").onsubmit = async function(e) {
e.preventDefault();
const btn = document.getElementById("signupBtn");
setButtonLoading(btn, true, "Creating account...");
try { await signupUser(); }
catch(err) { console.error(err); showToast("Signup failed. Please try again.", "error"); }
finally { setButtonLoading(btn, false, "Create Account"); }
};
function togglePassword() {
const pwd = document.getElementById("password");
const btn = document.getElementById("toggleBtn");
pwd.type = pwd.type === "password" ? "text" : "password";
btn.textContent = pwd.type === "password" ? "Show" : "Hide";
}
</script>
</body>
</html>
+270
View File
@@ -0,0 +1,270 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>BookKeepPro | Business Documents</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<link rel="stylesheet" href="/css/chatbot.css"/>
<style>
.doc-slot { display:flex;align-items:center;gap:14px;padding:14px 18px;border:1.5px solid var(--border);border-radius:var(--radius-md);background:var(--card);margin-bottom:10px;transition:border-color var(--transition),background var(--transition); }
.doc-slot:hover { border-color:#c5d9ee;background:#fafcff; }
.doc-slot-icon { font-size:22px;flex-shrink:0; }
.doc-slot-info { flex:1;min-width:0; }
.doc-slot-name { font-weight:600;font-size:13px;color:var(--navy); }
.doc-slot-status { font-size:12px;color:var(--muted);margin-top:3px; }
.doc-slot-actions{ display:flex;gap:8px;flex-shrink:0;flex-wrap:wrap; }
.drop-area { border:2px dashed #b8cfdf;border-radius:var(--radius-md);padding:28px 20px;text-align:center;cursor:pointer;transition:all var(--transition);background:var(--card); }
.drop-area:hover,.drop-area.drag-over { border-color:var(--blue);background:var(--blue-light); }
.drop-area .da-icon { font-size:32px;margin-bottom:8px; }
.drop-area .da-title { font-weight:600;font-size:14px;color:var(--navy); }
.drop-area .da-hint { font-size:12px;color:var(--muted);margin-top:4px; }
.upload-track { display:flex;flex-direction:column;gap:6px;margin-top:12px; }
.upload-track-item { display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:var(--radius-sm);background:#f5f8fb;font-size:13px; }
.upload-track-item .uti-name { flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--navy);font-weight:500; }
</style>
<style>html{height:100%;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="window.location.href='/dashboard'" alt="BookKeepPro"/>
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-ghost btn-sm" onclick="window.location.href='/dashboard'">← Dashboard</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main page-enter">
<div class="page-heading">
<div>
<h1>Business Documents</h1>
<p class="page-meta">Upload your business tax documents securely</p>
</div>
<div style="display:flex;flex-direction:column;align-items:flex-end;gap:4px;">
<label class="form-label" style="margin:0;">Tax Year</label>
<select id="taxYearSelect" class="select-input" style="width:auto;padding:8px 14px;" onchange="onYearChange()"></select>
</div>
</div>
<div class="card" style="margin-bottom:20px;">
<h3 style="margin-bottom:16px;">Required Documents</h3>
<div id="docWrapper"></div>
</div>
<div class="card">
<div class="flex-between" style="margin-bottom:16px;">
<div>
<h3>Additional Documents</h3>
<p class="text-sm" style="margin-top:2px;">Upload any supplementary business documents</p>
</div>
<label class="btn btn-secondary btn-sm" for="extraFile" tabindex="0"
style="border-radius:var(--radius-sm);cursor:pointer;">
+ Choose Files
<input type="file" id="extraFile" multiple hidden accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx"/>
</label>
</div>
<div class="drop-area" id="dropArea" onclick="document.getElementById('extraFile').click()">
<div class="da-icon"><span class="material-symbols-outlined" style="color: #ffca28;">folder</span></div>
<div class="da-title">Drag & drop files here</div>
<div class="da-hint">or click to browse · PDF, JPG, PNG, WEBP, DOC, DOCX · Max 10MB</div>
</div>
<div id="extraList" class="upload-track"></div>
<p id="extraStatus" class="text-sm mt-8"></p>
</div>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<small>© 2026 Bookkeeping Business Solutions</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/spinner.js"></script>
<script src="/js/confirm-modal.js"></script>
<script>
guardAuth(["user"]);
initSessionWarning();
let currentDocs = [];
function getDocs() { return currentDocs; }
const uploadedFiles={}, wrapper=document.getElementById("docWrapper"),
extraList=document.getElementById("extraList"), extraStatus=document.getElementById("extraStatus");
function getSelectedYear() { return parseInt(document.getElementById("taxYearSelect")?.value||String(new Date().getFullYear())); }
async function loadTemplates() {
const year = getSelectedYear();
try {
const res = await authFetch(`/api/upload/templates?category=business&tax_year=${year}`);
if (res && res.ok) {
currentDocs = await res.json();
} else {
currentDocs = [];
}
} catch (e) {
console.error("Failed to load templates", e);
currentDocs = [];
}
}
async function onYearChange() {
localStorage.setItem("selected_tax_year",getSelectedYear());
Object.keys(uploadedFiles).forEach(k=>delete uploadedFiles[k]);
extraList.innerHTML="";
wrapper.innerHTML = Array(3).fill(`
<div class="doc-card" style="margin-bottom:12px;">
<div class="doc-left">
<div class="skeleton" style="width:24px;height:24px;border-radius:4px;margin-right:12px;"></div>
<div>
<div class="skeleton" style="width:140px;height:18px;margin-bottom:6px;"></div>
<div class="skeleton" style="width:80px;height:12px;"></div>
</div>
</div>
<div class="doc-right">
<div class="skeleton" style="width:100px;height:32px;border-radius:var(--radius-pill);"></div>
</div>
</div>
`).join("");
await loadTemplates();
renderDocs();
loadSavedBusinessDocuments();
}
function renderDocs() {
wrapper.innerHTML="";
getDocs().forEach((doc,i)=>{
const slot=document.createElement("div"); slot.className="doc-slot fade-up"; slot.style.animationDelay=`${i*0.04}s`;
const infoEl=document.createElement("div"); infoEl.className="doc-slot-info";
const nameEl=document.createElement("div"); nameEl.className="doc-slot-name"; nameEl.textContent=`${i+1}. ${doc.name}`;
const stEl=document.createElement("div"); stEl.className="doc-slot-status"; stEl.id=`status${i}`;
infoEl.appendChild(nameEl); infoEl.appendChild(stEl);
const acts=document.createElement("div"); acts.className="doc-slot-actions";
if(doc.download){
const dlA=document.createElement("a"); dlA.href=doc.download; dlA.download="";
dlA.className="btn btn-sm btn-download-pill"; dlA.textContent="Download";
acts.appendChild(dlA);
}
const ulLbl=document.createElement("label"); ulLbl.className="btn btn-sm btn-upload-pill"; ulLbl.tabIndex=0; ulLbl.textContent="Upload";
const fileIn=document.createElement("input"); fileIn.type="file"; fileIn.id=`file${i}`; fileIn.hidden=true;
ulLbl.appendChild(fileIn); acts.appendChild(ulLbl);
ulLbl.addEventListener("keydown",e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();ulLbl.click();}});
const viewBtn=document.createElement("button"); viewBtn.id=`view${i}`; viewBtn.className="btn btn-secondary btn-xs"; viewBtn.style.display="none"; viewBtn.style.borderRadius="var(--radius-sm)"; viewBtn.textContent="View"; acts.appendChild(viewBtn);
const delBtn=document.createElement("button"); delBtn.id=`delete${i}`; delBtn.className="btn btn-danger btn-xs"; delBtn.style.display="none"; delBtn.style.borderRadius="var(--radius-sm)"; delBtn.textContent="Delete"; acts.appendChild(delBtn);
slot.appendChild(infoEl); slot.appendChild(acts); wrapper.appendChild(slot);
fileIn.onchange=()=>upload(i); viewBtn.onclick=()=>viewFile(i); delBtn.onclick=()=>deleteFile(i);
});
}
async function upload(i) {
const docs=getDocs(), f=document.getElementById(`file${i}`).files[0]; if(!f) return;
const st=document.getElementById(`status${i}`); st.textContent="Uploading…"; st.style.color="var(--muted)";
const fd=new FormData(); fd.append("file",f); fd.append("doc_type",docs[i].name); fd.append("tax_year",getSelectedYear());
const res=await authFetch("/api/upload/business-documents",{method:"POST",body:fd}); if(!res) return;
if(!res.ok){const e=await res.json().catch(()=>{});st.textContent=`Upload failed: ${e?.detail||res.status}`;st.style.color="var(--error)";return;}
const d=await res.json(); uploadedFiles[i]={id:d.id,storage_key:d.storage_key};
st.innerHTML=`<span class="pill-pending"><span class="material-symbols-outlined">pending</span> Pending Review</span>`;
document.getElementById(`view${i}`).style.display="inline-flex";
document.getElementById(`delete${i}`).style.display="inline-flex";
}
function viewFile(i) {
if(!uploadedFiles[i]?.storage_key) return;
authFetch(`/api/upload/view-url?key=${encodeURIComponent(uploadedFiles[i].storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error"));
}
async function deleteFile(i) {
const ok=await confirmModal("Delete this document?\nThis action cannot be undone.","Delete"); if(!ok) return;
const doc=uploadedFiles[i]; if(!doc) return;
const res=await authFetch(`/api/upload/business-documents/${doc.id}`,{method:"DELETE"}); if(!res) return;
if(!res.ok){showToast("Failed to delete document","error");return;}
delete uploadedFiles[i];
document.getElementById(`status${i}`).textContent="";
document.getElementById(`view${i}`).style.display="none";
document.getElementById(`delete${i}`).style.display="none";
document.getElementById(`file${i}`).value="";
showToast("Document deleted","success");
}
function addOtherDoc(name,doc){
const item=document.createElement("div"); item.className="upload-track-item";
const icon=document.createElement("span"); icon.innerHTML=`<span class="material-symbols-outlined">description</span>`; icon.style.fontSize="16px";
const nm=document.createElement("span"); nm.className="uti-name"; nm.textContent=name;
const vBtn=document.createElement("button"); vBtn.className="btn btn-secondary btn-xs"; vBtn.style.borderRadius="var(--radius-sm)"; vBtn.textContent="View";
vBtn.addEventListener("click",()=>authFetch(`/api/upload/view-url?key=${encodeURIComponent(doc.storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error")));
const dBtn=document.createElement("button"); dBtn.className="btn btn-danger btn-xs"; dBtn.style.borderRadius="var(--radius-sm)"; dBtn.textContent="Delete";
dBtn.addEventListener("click",async()=>{
const ok=await confirmModal("Delete this document?","Delete"); if(!ok) return; dBtn.disabled=true;
const res=await authFetch(`/api/upload/business-documents/${doc.id}`,{method:"DELETE"});
if(!res){dBtn.disabled=false;return;}
if(!res.ok){showToast("Failed to delete","error");dBtn.disabled=false;return;}
item.remove(); showToast("Document deleted","success");
});
item.appendChild(icon); item.appendChild(nm); item.appendChild(vBtn); item.appendChild(dBtn); extraList.appendChild(item);
}
document.getElementById("extraFile").addEventListener("change", async e=>{
extraStatus.textContent="Uploading…"; extraStatus.style.color="var(--muted)";
let ok=0,fail=0;
for(const f of e.target.files){
const fd=new FormData(); fd.append("file",f); fd.append("doc_type","Other"); fd.append("tax_year",getSelectedYear());
const res=await authFetch("/api/upload/business-documents",{method:"POST",body:fd}); if(!res) return;
if(res.ok){ok++;const d=await res.json();addOtherDoc(f.name,{id:d.id,storage_key:d.storage_key});}else fail++;
}
extraStatus.innerHTML=fail?`${fail} upload(s) failed`:`${ok} file(s) uploaded <span class="material-symbols-outlined">check</span>`;
extraStatus.style.color=fail?"var(--error)":"var(--success)";
e.target.value="";
});
const dropArea=document.getElementById("dropArea");
dropArea.addEventListener("dragover",e=>{e.preventDefault();dropArea.classList.add("drag-over");});
dropArea.addEventListener("dragleave",()=>dropArea.classList.remove("drag-over"));
dropArea.addEventListener("drop",e=>{
e.preventDefault(); dropArea.classList.remove("drag-over");
if(e.dataTransfer.files.length){const inp=document.getElementById("extraFile");inp.files=e.dataTransfer.files;inp.dispatchEvent(new Event("change"));}
});
async function loadSavedBusinessDocuments(){
const year=getSelectedYear();
const res=await authFetch(`/api/upload/business-documents?tax_year=${year}`);
if(!res||!res.ok){hideSpinner(wrapper,'<p style="color:var(--error);padding:12px;">Failed to load saved documents.</p>');return;}
const files=await res.json(); hideSpinner(wrapper,""); renderDocs();
const docs=getDocs();
files.forEach(f=>{
const index=docs.findIndex(d=>d.name.trim().toLowerCase()===f.business_type?.trim().toLowerCase());
if(index!==-1){
uploadedFiles[index]={id:f.id,storage_key:f.storage_key};
const st=document.getElementById(`status${index}`);
const p=f.review_status||"pending";
st.innerHTML=`<span class="pill-${p}">${p==="approved"?`<span class="material-symbols-outlined">check</span> Approved`:p==="rejected"?`<span class="material-symbols-outlined">close</span> Rejected`:`<span class="material-symbols-outlined">pending</span> Pending Review`}</span>`;
document.getElementById(`view${index}`).style.display="inline-flex";
document.getElementById(`delete${index}`).style.display="inline-flex";
} else { addOtherDoc(f.filename,{id:f.id,storage_key:f.storage_key}); }
});
}
(function init(){
const sy=localStorage.getItem("selected_tax_year");
buildYearOptions("taxYearSelect",sy?parseInt(sy):new Date().getFullYear());
onYearChange();
})();
</script>
<script src="/js/chatbot.js"></script>
</body>
</html>
+331
View File
@@ -0,0 +1,331 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>BookKeepPro | Personal Documents</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<link rel="stylesheet" href="/css/chatbot.css"/>
<style>
.doc-slot {
display:flex; align-items:center; gap:14px; padding:14px 18px;
border:1.5px solid var(--border); border-radius:var(--radius-md);
background:var(--card); margin-bottom:10px;
transition:border-color var(--transition), background var(--transition);
}
.doc-slot:hover { border-color:#c5d9ee; background:#fafcff; }
.doc-slot-icon { font-size:22px; flex-shrink:0; }
.doc-slot-info { flex:1; min-width:0; }
.doc-slot-name { font-weight:600; font-size:13px; color:var(--navy); }
.doc-slot-status { font-size:12px; color:var(--muted); margin-top:3px; }
.doc-slot-actions { display:flex; gap:8px; flex-shrink:0; flex-wrap:wrap; }
.drop-area {
border:2px dashed #b8cfdf; border-radius:var(--radius-md); padding:28px 20px;
text-align:center; cursor:pointer; transition:all var(--transition);
background:var(--card);
}
.drop-area:hover, .drop-area.drag-over { border-color:var(--blue); background:var(--blue-light); }
.drop-area .da-icon { font-size:32px; margin-bottom:8px; }
.drop-area .da-title { font-weight:600; font-size:14px; color:var(--navy); }
.drop-area .da-hint { font-size:12px; color:var(--muted); margin-top:4px; }
.upload-track { display:flex; flex-direction:column; gap:6px; margin-top:12px; }
.upload-track-item {
display:flex; align-items:center; gap:10px; padding:8px 12px;
border-radius:var(--radius-sm); background:#f5f8fb; font-size:13px;
}
.upload-track-item .uti-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--navy); font-weight:500; }
</style>
<style>html{height:100%;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body class="app-body">
<header class="app-header">
<img class="logo" src="/images/bookkeeppro-logo.webp" onclick="window.location.href='/dashboard'" alt="BookKeepPro"/>
<div class="header-actions">
<!-- THEME TOGGLE -->
<button class="theme-toggle" onclick="toggleTheme()" style="background:none;border:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;">
<span class="material-symbols-outlined theme-toggle-icon" style="font-size:24px;">dark_mode</span>
</button>
<button class="btn btn-ghost btn-sm" onclick="window.location.href='/dashboard'">← Dashboard</button>
<button class="btn btn-primary btn-sm" onclick="logoutUser()">Logout</button>
</div>
</header>
<main class="page-main page-enter">
<div class="page-heading">
<div>
<h1>Personal Documents</h1>
<p class="page-meta">Upload your personal tax documents securely</p>
</div>
<div style="display:flex;flex-direction:column;align-items:flex-end;gap:4px;">
<label class="form-label" style="margin:0;">Tax Year</label>
<select id="taxYearSelect" class="select-input" style="width:auto;padding:8px 14px;" onchange="onYearChange()"></select>
</div>
</div>
<!-- Named Documents -->
<div class="card" style="margin-bottom:20px;">
<h3 style="margin-bottom:16px;">Required Documents</h3>
<div id="docWrapper"></div>
</div>
<!-- Other Documents Drop Zone -->
<div class="card">
<div class="flex-between" style="margin-bottom:16px;">
<div>
<h3>Additional Documents</h3>
<p class="text-sm" style="margin-top:2px;">Upload any supplementary personal documents</p>
</div>
<label class="btn btn-secondary btn-sm" for="extraFile" tabindex="0" id="extraLabel"
style="border-radius:var(--radius-sm);cursor:pointer;">
+ Choose Files
<input type="file" id="extraFile" multiple hidden accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx"/>
</label>
</div>
<div class="drop-area" id="dropArea" onclick="document.getElementById('extraFile').click()">
<div class="da-icon"><span class="material-symbols-outlined" style="color: #ffca28;">folder</span></div>
<div class="da-title">Drag & drop files here</div>
<div class="da-hint">or click to browse · PDF, JPG, PNG, WEBP, DOC, DOCX · Max 10MB</div>
</div>
<div id="extraList" class="upload-track"></div>
<p id="extraStatus" class="text-sm mt-8"></p>
</div>
</main>
<footer class="app-footer">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<small>© 2026 Bookkeeping Business Solutions</small>
</footer>
<script src="/js/auth.js"></script>
<script src="/js/toast.js"></script>
<script src="/js/spinner.js"></script>
<script src="/js/confirm-modal.js"></script>
<script>
guardAuth(["user"]);
initSessionWarning();
let currentDocs = [];
function getDocs() { return currentDocs; }
const uploadedFiles = {};
const wrapper = document.getElementById("docWrapper");
const extraList = document.getElementById("extraList");
const extraStatus= document.getElementById("extraStatus");
function getSelectedYear() { return parseInt(document.getElementById("taxYearSelect")?.value || String(new Date().getFullYear())); }
async function loadTemplates() {
const year = getSelectedYear();
try {
const res = await authFetch(`/api/upload/templates?category=personal&tax_year=${year}`);
if (res && res.ok) {
currentDocs = await res.json();
} else {
currentDocs = [];
}
} catch (e) {
console.error("Failed to load templates", e);
currentDocs = [];
}
}
async function onYearChange() {
localStorage.setItem("selected_tax_year", getSelectedYear());
Object.keys(uploadedFiles).forEach(k => delete uploadedFiles[k]);
extraList.innerHTML = "";
wrapper.innerHTML = Array(3).fill(`
<div class="doc-card" style="margin-bottom:12px;">
<div class="doc-left">
<div class="skeleton" style="width:24px;height:24px;border-radius:4px;margin-right:12px;"></div>
<div>
<div class="skeleton" style="width:140px;height:18px;margin-bottom:6px;"></div>
<div class="skeleton" style="width:80px;height:12px;"></div>
</div>
</div>
<div class="doc-right">
<div class="skeleton" style="width:100px;height:32px;border-radius:var(--radius-pill);"></div>
</div>
</div>
`).join("");
await loadTemplates();
renderDocs();
loadSavedDocuments();
}
function renderDocs() {
wrapper.innerHTML = "";
getDocs().forEach((doc, i) => {
const slot = document.createElement("div");
slot.className = "doc-slot fade-up";
slot.style.animationDelay = `${i * 0.04}s`;
const infoEl = document.createElement("div"); infoEl.className = "doc-slot-info";
const nameEl = document.createElement("div"); nameEl.className = "doc-slot-name"; nameEl.textContent = `${i+1}. ${doc.name}`;
const stEl = document.createElement("div"); stEl.className = "doc-slot-status"; stEl.id = `status${i}`;
infoEl.appendChild(nameEl); infoEl.appendChild(stEl);
const acts = document.createElement("div"); acts.className = "doc-slot-actions";
if (doc.download) {
const dlBtn = document.createElement("a");
dlBtn.href = doc.download; dlBtn.download = "";
dlBtn.className = "btn btn-sm btn-download-pill";
dlBtn.textContent = "Download"; acts.appendChild(dlBtn);
}
const ulLbl = document.createElement("label");
ulLbl.className = "btn btn-sm btn-upload-pill";
ulLbl.tabIndex = 0;
ulLbl.textContent = "Upload";
const fileIn = document.createElement("input"); fileIn.type="file"; fileIn.id=`file${i}`; fileIn.hidden=true;
ulLbl.appendChild(fileIn); acts.appendChild(ulLbl);
ulLbl.addEventListener("keydown", e => { if(e.key==="Enter"||e.key===" "){e.preventDefault();ulLbl.click();} });
const viewBtn = document.createElement("button");
viewBtn.id = `view${i}`; viewBtn.className="btn btn-secondary btn-xs"; viewBtn.style.display="none"; viewBtn.style.borderRadius="var(--radius-sm)";
viewBtn.textContent="View"; acts.appendChild(viewBtn);
const delBtn = document.createElement("button");
delBtn.id = `delete${i}`; delBtn.className="btn btn-danger btn-xs"; delBtn.style.display="none"; delBtn.style.borderRadius="var(--radius-sm)";
delBtn.textContent="Delete"; acts.appendChild(delBtn);
slot.appendChild(infoEl); slot.appendChild(acts);
wrapper.appendChild(slot);
fileIn.onchange = () => upload(i);
viewBtn.onclick = () => viewFile(i);
delBtn.onclick = () => deleteFile(i);
});
}
async function upload(i) {
const docs = getDocs();
const input = document.getElementById(`file${i}`);
const file = input.files[0];
if (!file) return;
const stEl = document.getElementById(`status${i}`);
stEl.textContent = "Uploading…"; stEl.style.color = "var(--muted)";
const fd = new FormData();
fd.append("file",file); fd.append("doc_type",docs[i].name); fd.append("tax_year",getSelectedYear());
const res = await authFetch("/api/upload/personal-documents",{method:"POST",body:fd});
if (!res) return;
if (!res.ok) { const e=await res.json().catch(()=>{}); stEl.textContent=`Upload failed: ${e?.detail||res.status}`; stEl.style.color="var(--error)"; return; }
const data = await res.json();
uploadedFiles[i] = {id:data.id,storage_key:data.storage_key};
stEl.innerHTML = `<span class="pill-pending"><span class="material-symbols-outlined">pending</span> Pending Review</span>`;
document.getElementById(`view${i}`).style.display="inline-flex";
document.getElementById(`delete${i}`).style.display="inline-flex";
}
function viewFile(i) {
if (!uploadedFiles[i]?.storage_key) return;
authFetch(`/api/upload/view-url?key=${encodeURIComponent(uploadedFiles[i].storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error"));
}
async function deleteFile(i) {
const ok = await confirmModal("Delete this document?\nThis action cannot be undone.","Delete");
if (!ok) return;
const btn = document.getElementById(`delete${i}`); btn.disabled=true;
const res = await authFetch(`/api/upload/personal-documents/${uploadedFiles[i].id}`,{method:"DELETE"});
if (!res){btn.disabled=false;return;}
if (!res.ok){showToast("Failed to delete document","error");btn.disabled=false;return;}
delete uploadedFiles[i];
document.getElementById(`status${i}`).textContent="";
document.getElementById(`view${i}`).style.display="none";
btn.style.display="none";
document.getElementById(`file${i}`).value="";
showToast("Document deleted","success");
}
function addOtherDocItem(name, doc) {
const item = document.createElement("div"); item.className="upload-track-item";
const icon = document.createElement("span"); icon.innerHTML=`<span class="material-symbols-outlined">description</span>`; icon.style.fontSize="16px";
const nm = document.createElement("span"); nm.className="uti-name"; nm.textContent=name;
const vBtn = document.createElement("button"); vBtn.className="btn btn-secondary btn-xs"; vBtn.style.borderRadius="var(--radius-sm)"; vBtn.textContent="View";
vBtn.addEventListener("click",()=>authFetch(`/api/upload/view-url?key=${encodeURIComponent(doc.storage_key)}`).then(r=>r&&r.json()).then(d=>d&&window.open(d.url,"_blank")).catch(()=>showToast("Could not generate view link","error")));
const dBtn = document.createElement("button"); dBtn.className="btn btn-danger btn-xs"; dBtn.style.borderRadius="var(--radius-sm)"; dBtn.textContent="Delete";
dBtn.addEventListener("click",async()=>{
const ok=await confirmModal("Delete this document?","Delete"); if(!ok) return;
dBtn.disabled=true;
const res=await authFetch(`/api/upload/personal-documents/${doc.id}`,{method:"DELETE"});
if(!res){dBtn.disabled=false;return;}
if(!res.ok){showToast("Failed to delete","error");dBtn.disabled=false;return;}
item.remove(); showToast("Document deleted","success");
});
item.appendChild(icon); item.appendChild(nm); item.appendChild(vBtn); item.appendChild(dBtn);
extraList.appendChild(item);
}
document.getElementById("extraFile").addEventListener("change", async e => {
extraStatus.textContent="Uploading…"; extraStatus.style.color="var(--muted)";
let ok=0,fail=0;
for (const file of e.target.files) {
const fd=new FormData(); fd.append("file",file); fd.append("doc_type","Other"); fd.append("tax_year",getSelectedYear());
const res=await authFetch("/api/upload/personal-documents",{method:"POST",body:fd});
if(!res) return;
if(res.ok){ok++;const d=await res.json();addOtherDocItem(file.name,{id:d.id,storage_key:d.storage_key});}
else fail++;
}
extraStatus.innerHTML = fail ? `${fail} upload(s) failed` : `${ok} file(s) uploaded <span class="material-symbols-outlined">check</span>`;
extraStatus.style.color = fail ? "var(--error)" : "var(--success)";
e.target.value="";
});
/* Drag & drop */
const dropArea = document.getElementById("dropArea");
dropArea.addEventListener("dragover", e=>{e.preventDefault();dropArea.classList.add("drag-over");});
dropArea.addEventListener("dragleave", ()=>dropArea.classList.remove("drag-over"));
dropArea.addEventListener("drop", e=>{
e.preventDefault(); dropArea.classList.remove("drag-over");
const dt = e.dataTransfer;
if (dt.files.length) {
const input = document.getElementById("extraFile");
input.files = dt.files;
input.dispatchEvent(new Event("change"));
}
});
async function loadSavedDocuments() {
const year = getSelectedYear();
const res = await authFetch(`/api/upload/personal-documents?tax_year=${year}`);
if (!res||!res.ok){hideSpinner(wrapper,'<p style="color:var(--error);padding:12px;">Failed to load saved documents.</p>');return;}
const files = await res.json();
hideSpinner(wrapper,""); renderDocs();
const docs = getDocs();
files.forEach(f => {
const index = docs.findIndex(d=>d.name.trim().toLowerCase()===f.doc_type?.trim().toLowerCase());
if (index!==-1) {
uploadedFiles[index]={id:f.id,storage_key:f.storage_key};
const st=document.getElementById(`status${index}`);
const p=f.review_status||"pending";
st.innerHTML=`<span class="pill-${p}">${p==="approved"?`<span class="material-symbols-outlined">check</span> Approved`:p==="rejected"?`<span class="material-symbols-outlined">close</span> Rejected`:`<span class="material-symbols-outlined">pending</span> Pending Review`}</span>`;
document.getElementById(`view${index}`).style.display="inline-flex";
document.getElementById(`delete${index}`).style.display="inline-flex";
} else {
addOtherDocItem(f.filename,{id:f.id,storage_key:f.storage_key});
}
});
}
(function init() {
const sy = localStorage.getItem("selected_tax_year");
buildYearOptions("taxYearSelect", sy ? parseInt(sy) : new Date().getFullYear());
onYearChange();
})();
</script>
<script src="/js/chatbot.js"></script>
</body>
</html>
+78
View File
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>BookKeepPro | Verify Email</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/animations.css"/>
<style>html,body{height:100%;}body{margin:0;}</style> <script src="/js/theme.js?v=2"></script>
</head>
<body style="margin:0;padding:0;">
<div class="auth-shell page-enter">
<div class="auth-brand">
<img class="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div class="brand-divider"></div>
<h2>Almost There</h2>
<p>We're verifying your email address right now.</p>
</div>
<div class="auth-form-side">
<div class="auth-box text-center" id="card">
<div style="font-size:48px;margin-bottom:16px;"><span class="material-symbols-outlined">pending</span></div>
<h2>Verifying your email…</h2>
<p class="auth-subtitle">Please wait a moment.</p>
</div>
</div>
</div>
<script>
const params = new URLSearchParams(window.location.search);
const token = params.get("token");
const card = document.getElementById("card");
async function verify() {
if (!token) {
card.innerHTML = `
<div style="font-size:48px;margin-bottom:16px;"><span class="material-symbols-outlined">cancel</span></div>
<h2>Invalid Link</h2>
<p class="auth-subtitle">This verification link is missing a token.<br>Please use the link from your email.</p>
<a href="/login" class="btn btn-primary" style="border-radius:var(--radius-sm);margin-top:24px;display:inline-flex;">Go to Sign In</a>`;
return;
}
try {
const res = await fetch(`/api/auth/verify-email?token=${encodeURIComponent(token)}`);
const data = await res.json();
if (res.ok && (data.message === "verified" || data.message === "already_verified")) {
card.innerHTML = `
<div style="font-size:48px;margin-bottom:16px;"><span class="material-symbols-outlined">check_circle</span></div>
<h2>${data.message === "already_verified" ? "Already Verified" : "Email Verified!"}</h2>
<p class="auth-subtitle">${data.message === "already_verified"
? "Your email is already verified. You can sign in below."
: "Your email has been verified. You can now sign in to your account."}</p>
<a href="/login" class="btn btn-primary" style="border-radius:var(--radius-sm);margin-top:24px;display:inline-flex;">Sign In</a>`;
} else {
card.innerHTML = `
<div style="font-size:48px;margin-bottom:16px;"><span class="material-symbols-outlined">cancel</span></div>
<h2>Verification Failed</h2>
<p class="auth-subtitle">${data.detail || "This link is invalid or has expired."}</p>
<a href="/resend-verification" class="btn btn-primary" style="border-radius:var(--radius-sm);margin-top:24px;display:inline-flex;">Request New Link</a>`;
}
} catch {
card.innerHTML = `
<div style="font-size:48px;margin-bottom:16px;"><span class="material-symbols-outlined">warning</span></div>
<h2>Something went wrong</h2>
<p class="auth-subtitle">Could not connect to the server. Please try again later.</p>`;
}
}
verify();
</script>
</body>
</html>