Compare commits

..
10 Commits
Author SHA1 Message Date
Atharv1705 b90e9336a2 docs: add README.md and .env.example template 2026-11-05 11:36:19 +05:30
Atharv1705 5d19eb4730 fix(frontend): add cache-busting version query strings to CSS links in index.html 2026-11-03 16:10:20 +05:30
Atharv1705 5703fbb27f feat: modernize UI/UX to 2026 US fintech standard, add violet AI accents, and strengthen security controls
- Modern 2026 US fintech visual redesign across User & Admin Dashboards, Marketing pages, Auth screens, and Layouts
- Introduced violet accent (#6D28D9 / #8B5CF6) strictly dedicated to AI capabilities (AI Daily Briefing, AI Assistant, Chatbot FAB & Chat UI)
- Motion system respecting prefers-reduced-motion and (hover: none) with GPU-accelerated transforms & opacities
- High-resolution dark glass monogram logo mark with upward growth motif
- Backend security enhancements: strict MIME-type sniffing validation, admin assignment scoping assertions, safe document deletion handling
- Nginx strict Content-Security-Policy (CSP) headers and favicon routing
2026-11-03 14:07:35 +05:30
Atharv1705 b7c935df5a feat: add super admin user assignment, scoping, and clean email notifications 2026-10-30 16:07:46 +05:30
Atharv1705 1cca347752 feat: add email diagnostic tool 2026-10-30 10:40:33 +05:30
Atharv1705 3cb6229cd9 feat: complete platform overhaul, bugfixes, and verified production release 2026-10-28 21:47:48 +05:30
Atharv1705 276039a743 style: revamp bookmarks tab into a modern grid of cards 2026-10-05 18:54:56 +05:30
Atharv1705 4e12356b2b feat: Add Global Bookmarks dashboard tab 2026-10-05 18:32:39 +05:30
Atharv1705 0fa81991da feat: Implement UI for bookmarking documents 2026-10-05 18:25:58 +05:30
Atharv1705 6181682560 fix: explicit None for tax_year to avoid FastAPI Query object evaluation in python context 2026-10-05 18:15:44 +05:30
94 changed files with 11018 additions and 2207 deletions
+37
View File
@@ -0,0 +1,37 @@
# MySQL Database Configuration
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USER=bookkeep_user
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=bookkeep_db
# Security & JWT Auth
SECRET_KEY=generate_a_secure_random_secret_key_here
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
# Client & CORS
FRONTEND_URL=http://localhost:5173
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000,http://127.0.0.1:5173
# Email / SMTP Notifications
ADMIN_EMAIL=admin@example.com
MAIL_FROM=no-reply@example.com
MAIL_FROM_NAME=BookKeepPro Support
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@example.com
SMTP_PASSWORD=your_smtp_app_password
SMTP_TLS=True
MAIL_SSL_TLS=False
# Google Drive Storage Integration (Optional)
DRIVE_FOLDER_ID=your_drive_folder_id
# AI & LLM (OpenRouter / Gemini)
OPENROUTER_API_KEY=your_openrouter_api_key_here
OCR_TEXT_MODEL=google/gemini-2.0-flash-001
OCR_VISION_MODEL=google/gemini-2.0-flash-001
OCR_FALLBACK_MODEL=google/gemini-flash-1.5-8b
TESSERACT_LANG=eng
CHAT_MODEL=google/gemini-2.0-flash-001
+2
View File
@@ -0,0 +1,2 @@
* text=auto
*.sh text eol=lf
+238 -132
View File
@@ -1,179 +1,285 @@
# Contabo VPS Deployment Guide
# BookKeepPro — Comprehensive Production Deployment Guide
## Prerequisites
- Docker + Docker Compose installed on the VPS
- Port 80 open in Contabo firewall and VPS firewall (`ufw allow 80`)
- Node.js 18+ installed locally (for the frontend build)
**Target Domain:** [`https://aicpa.duckdns.org`](https://aicpa.duckdns.org)
**Target VPS Server:** `Contabo VPS (13.140.170.213)`
**Stack:** React 19 (Vite) + FastAPI (Python 3.12) + MySQL 8.4 + Docker Compose + Host Nginx (Certbot SSL)
---
## First-time deployment
## 1. System Architecture
### 1. Clone the repo
```bash
git clone https://github.com/Atharv1705/Bookkeepro.git
cd Bookkeepro
```mermaid
graph TD
Client(["🌐 Web Client (HTTPS)"]) -->|"Port 443 / 80"| HostNginx["Host Nginx Reverse Proxy<br/>(13.140.170.213)<br/>Let's Encrypt SSL Certbot"]
subgraph DockerCompose ["Docker Compose Stack (Internal Network)"]
HostNginx -->|"Proxy Pass: 127.0.0.1:8081"| ContainerNginx["Nginx Container (Port 80)<br/>- Serves /frontend/dist static files<br/>- Asset cache headers<br/>- Proxy routes"]
ContainerNginx -->|"/api/* requests"| FastAPI["FastAPI Container (Port 8000)<br/>- Auth & JWT<br/>- Document Processing & OCR<br/>- AI Chatbot & Daily Digest<br/>- APScheduler Reminders"]
FastAPI -->|"SQLAlchemy connection (Port 3306)"| MySQL["MySQL 8.4 Container<br/>- Persistent volume: mysql_data<br/>- Health check verified"]
FastAPI -->|"Uploads Volume"| Storage["Persistent Disk Volume<br/>- /app/uploads<br/>- ChromaDB Vector Store"]
end
```
### 2. Create `.env` from the example
---
```bash
cp .env.example .env
# Edit .env — fill in MYSQL_PASSWORD, SECRET_KEY, SMTP_PASSWORD, OPENROUTER_API_KEY
nano .env
```
## 2. Pre-Deployment: Local Workstation Preparation
**Required variables in `.env`:**
```
MYSQL_HOST=db
MYSQL_USER=root
MYSQL_PASSWORD=<strong-password>
MYSQL_DATABASE=bookkeepprodb
SECRET_KEY=<64-char-random-hex>
ALLOWED_ORIGINS=http://<your-ip>,https://bookkeepro.net
OPENROUTER_API_KEY=<your-key>
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=<your-gmail>
SMTP_PASSWORD=<app-password>
MAIL_FROM=<your-gmail>
ADMIN_EMAIL=<admin-email>
```
Perform these steps inside your local project folder (`Bookkeep`):
### 3. Build the frontend
### Step 2.1 — Fresh Frontend Production Build
Compile and bundle all JSX components, CSS tokens, and assets into production-ready static files:
⚠️ **This step is required.** nginx serves `frontend/dist` directly from the host.
If this folder is missing or stale, the UI will not load.
```bash
# On VPS or locally (then scp the dist/ folder to VPS)
```powershell
cd frontend
npm install
npm run build
cd ..
```
### 4. Start all services
```bash
docker compose up -d --build
*Expected Output:*
```text
dist/index.html 1.05 kB
dist/assets/index-Q3NiwG1z.css 44.73 kB
dist/assets/index-DYQgi1rI.js 418.74 kB
✓ built in 1.5s
```
This starts: `nginx` (port 80), `app` (FastAPI, internal), `db` (MySQL, internal).
### 5. Run database migrations
On first deploy, run the SQL migrations to create all required columns and tables:
```bash
# Add extracted_data JSON columns (idempotent — safe to re-run)
docker exec $(docker compose ps -q app) python migrate.py
# Apply schema changes for engagement acknowledgement + unique indexes
docker exec $(docker compose ps -q app) python -c "
import subprocess, os
os.chdir('/app/services/api')
subprocess.run(['python', '-c', '''
from app.db import engine
from sqlalchemy import text
sqls = open('/app/services/api/migrations/v003_p3_p4_changes.sql').read()
with engine.begin() as c:
for stmt in sqls.split(';'):
s = stmt.strip()
if s:
try: c.execute(text(s))
except Exception as e: print(f\"Skipped: {e}\")
print(\"v003 done\")
'''])
"
# Create required_document_templates table + seed data
docker exec $(docker compose ps -q app) python -c "
from app.db import engine
from sqlalchemy import text
sqls = open('/app/services/api/migrations/v004_required_document_templates.sql').read()
with engine.begin() as c:
for stmt in sqls.split(';'):
s = stmt.strip()
if s:
try: c.execute(text(s))
except Exception as e: print(f'Skipped: {e}')
print('v004 done')
" 2>/dev/null || true
### Step 2.2 — Validate Environment Schema
Ensure no placeholder passwords or missing keys exist:
```powershell
python services/api/validate_env.py
```
*Expected Output:* `Environment validation passed.`
### 6. Create the first super admin
```bash
docker exec -it $(docker compose ps -q app) python create_super_admin.py
```
### 7. Verify everything is running
```bash
docker compose ps # all 3 containers should be Up
curl http://localhost/health # should return {"status":"ok"}
docker compose logs app | tail -20 # check for "Application startup complete"
docker compose logs app | grep "Failed to load" # should be empty
### Step 2.3 — Commit and Push to Git
Commit all validated changes, tests, and updated build files:
```powershell
git add .
git commit -m "feat: complete platform overhaul, bugfixes, and verified production release"
git push origin main
```
---
## Updating to a new version
## 3. VPS Initial Setup & Prerequisites (One-Time)
Log in to your Contabo VPS via SSH:
```bash
git pull
ssh root@13.140.170.213
```
# Rebuild frontend if any frontend files changed
cd frontend && npm install && npm run build && cd ..
### Step 3.1 — Install System Packages & Docker
If not already installed on the VPS:
```bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y curl git ufw nginx certbot python3-certbot-nginx
# Rebuild and restart (DB volume is preserved — no data loss)
docker compose up -d --build app nginx
# Install Docker & Compose plugin
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo systemctl enable --now docker
```
# Run migrations if schema changed
docker exec $(docker compose ps -q app) python migrate.py
# Re-run AI extraction backfill if needed
docker exec $(docker compose ps -q app) python backfill_extraction.py
### Step 3.2 — Configure Firewall (UFW)
Ensure HTTP, HTTPS, and SSH ports are open:
```bash
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
sudo ufw status
```
---
## HTTPS (required for production with real client data)
## 4. VPS Host Nginx & Let's Encrypt SSL Configuration
The Host Nginx handles public incoming connections on ports 80/443, terminates SSL, and forwards traffic to the Docker Nginx container running on `127.0.0.1:8081`.
### Step 4.1 — Create Host Nginx Configuration
Create or edit `/etc/nginx/sites-available/aicpa.duckdns.org`:
```bash
# Install certbot
apt install certbot python3-certbot-nginx
sudo nano /etc/nginx/sites-available/aicpa.duckdns.org
```
# Get certificate (replace with your domain)
certbot --nginx -d bookkeepro.net -d www.bookkeepro.net
Paste the following configuration:
# Update ALLOWED_ORIGINS in .env to use https://
# Update FRONTEND_URL in .env to use https://
docker compose restart app
```nginx
server {
listen 80;
server_name aicpa.duckdns.org 13.140.170.213;
client_max_body_size 25M;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
}
```
### Step 4.2 — Enable Site and Test Syntax
```bash
sudo ln -sf /etc/nginx/sites-available/aicpa.duckdns.org /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
```
### Step 4.3 — Obtain Free Let's Encrypt SSL Certificate
Run Certbot to automatically configure HTTPS:
```bash
sudo certbot --nginx -d aicpa.duckdns.org
```
When prompted:
1. Enter your contact email.
2. Agree to terms (`Y`).
3. Certbot will test the challenge, install SSL certificates, and configure HTTPS automatic redirection.
Verify auto-renewal:
```bash
sudo certbot renew --dry-run
```
---
## Backup database
## 5. Application Deployment via Docker Compose
### Step 5.1 — Pull the Code on VPS
```bash
# Run before any major upgrade
docker exec $(docker compose ps -q db) \
mysqldump -uroot -p"${MYSQL_PASSWORD}" bookkeepprodb \
> backup_$(date +%Y%m%d_%H%M%S).sql
cd /var/www/Bookkeep # or your deployment directory on the VPS
git pull origin main
```
### Step 5.2 — Verify the Production `.env` File
Ensure `/var/www/Bookkeep/.env` exists and matches the production settings:
```ini
# DATABASE
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_secure_db_password
MYSQL_DATABASE=bookkeepprodb
# SECURITY
SECRET_KEY=your_generated_secret_key_here
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=480
# SERVER SETTINGS
FRONTEND_URL=https://aicpa.duckdns.org
ALLOWED_ORIGINS=https://aicpa.duckdns.org
# EMAIL (Gmail SMTP)
ADMIN_EMAIL=atharvg.aiindia@gmail.com
MAIL_FROM=atharvagunjarge5@gmail.com
MAIL_FROM_NAME=AiIndia_CPA
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=atharvagunjarge5@gmail.com
SMTP_PASSWORD=your_smtp_app_password_here
SMTP_TLS=True
MAIL_SSL_TLS=False
# OPENROUTER (Chatbot + OCR Models)
OPENROUTER_API_KEY="your_openrouter_api_key_here"
OCR_TEXT_MODEL=meta-llama/llama-3.3-70b-instruct
OCR_VISION_MODEL=qwen/qwen2.5-vl-72b-instruct
OCR_FALLBACK_MODEL=google/gemma-3-27b-it
TESSERACT_LANG=eng+hin
CHAT_MODEL=meta-llama/llama-3.3-70b-instruct
```
> [!IMPORTANT]
> Within the Docker Compose network, `MYSQL_HOST` must be set to `db` so FastAPI connects to the MySQL container.
### Step 5.3 — Build & Launch Containers
```bash
# Clean previous containers
docker compose down
# Build backend and launch all 3 services in detached mode
docker compose build --no-cache app
docker compose up -d
```
### Step 5.4 — Verify Container Health
Run:
```bash
docker compose ps
```
All services must show healthy and running:
```text
NAME IMAGE STATUS PORTS
bookkeep-app-1 bookkeep-app Up (healthy) 8000/tcp
bookkeep-db-1 mysql:8.4 Up (healthy) 3306/tcp, 33060/tcp
bookkeep-nginx-1 nginx:1.25-alpine Up 127.0.0.1:8081->80/tcp
```
Check the migration output in the backend logs:
```bash
docker compose logs app | tail -n 35
```
You should see:
- `[entrypoint] Running DB migrations...`
- `All migrations complete.`
- `Environment validation passed.`
- `Application startup complete.`
- `Uvicorn running on http://0.0.0.0:8000`
---
## Troubleshooting
## 6. Post-Deployment Smoke Tests
| Symptom | Check |
|---|---|
| UI loads blank / 404 | Run `npm run build` in `frontend/` — dist is missing |
| API returns 500 | `docker compose logs app` — look for startup errors |
| Chatbot/upload 500 | `docker compose logs app \| grep "Failed to load"` — router failed to load |
| Login fails | Check `MYSQL_HOST=db` in `.env` (not `localhost`) |
| Emails not sending | Verify Gmail App Password in `.env`, check SMTP_PASSWORD has no spaces |
Execute these verification checks from your browser and terminal:
| Test # | Check Item | Test Action | Expected Result |
| :---: | :--- | :--- | :--- |
| **1** | **SSL / HTTPS** | Navigate to `https://aicpa.duckdns.org` | Valid green padlock; redirects HTTP to HTTPS automatically |
| **2** | **Health Endpoint** | `curl -i https://aicpa.duckdns.org/health` | `HTTP/1.1 200 OK` with body `{"status":"ok"}` |
| **3** | **API 404 Guard** | `curl -i https://aicpa.duckdns.org/api/invalid-test` | `404 Not Found` in JSON format (not HTML) |
| **4** | **Client Sign In** | Log in with a client account | Successfully loads User Dashboard with Engagement Letter card |
| **5** | **Deadlines Banner** | Check User Dashboard | If deadlines are within 7 days, warning alert displays |
| **6** | **Document Upload** | Upload sample W-2 or 1099 in Personal Upload | Upload completes, OCR extraction kicks off, document appears in table |
| **7** | **Admin Dashboard** | Log in as Admin (`atharvg.aiindia@gmail.com`) | Shows 14 users, pending count, Daily Digest HTML block |
| **8** | **Approved Return Lock** | Try deleting an approved return in Admin User Detail | Delete button is locked / backend responds with 400 |
| **9** | **Client Review** | Admin sends return for approval; Client reviews | Client sees Approve and Reject buttons; status updates in real-time |
| **10** | **Admin Chatbot** | Open floating chatbot on Admin Dashboard | AI replies with firm statistics and handles bulk action requests |
---
## 7. Operational Maintenance Commands
### Fast Code Update (Subsequent Releases)
```bash
cd /var/www/Bookkeep
git pull origin main
cd frontend && npm run build && cd ..
docker compose restart nginx
docker compose up -d --build app
```
### Live Log Streaming
```bash
# View backend application logs
docker compose logs -f --tail=50 app
# View web server access & error logs
docker compose logs -f --tail=50 nginx
```
### Database Backup
```bash
docker exec $(docker compose ps -q db) mysqldump -uroot -p"$MYSQL_PASSWORD" bookkeepprodb > backup_$(date +%F_%T).sql
```
+93
View File
@@ -0,0 +1,93 @@
# AI CPA (BookKeepPro)
> An intelligent, production-ready accounting, bookkeeping, and CPA client portal platform with AI-assisted document processing, executive briefings, and automated tax compliance workflows.
---
## 🌟 Key Features
- **Fintech-Grade Client Portal**: Modern, responsive dashboard engineered with high-contrast WCAG AA compliance, intuitive metrics, filing countdowns, and document approval flows.
- **Role-Based Admin Console**: Client scoping, CPA staff assignments, review pipelines for personal and business tax filings, and customizable engagement tracking.
- **AI-Powered CPA Assistant & Daily Digest**: Integrated AI assistant capable of answering client inquiries, summarizing tax documents, and generating daily executive digests.
- **Automated Workflow & Deadlines**: Dynamic filing deadline calculation, overdue notifications, engagement letter digital signing, and certified deliverables vault.
- **Robust Security & Privacy**: JWT-based session security, sanitized asset delivery, structured role authorization, and production-tested reverse proxy configurations.
---
## 🏗️ System Architecture & Tech Stack
```mermaid
graph TD
Client["Client / CPA Browser"] -->|"HTTPS / HTTP"| Nginx["Nginx Reverse Proxy"]
subgraph Stack ["Docker Compose Network"]
Nginx -->|"/ (Static)"| Frontend["React 19 + Vite (Frontend)"]
Nginx -->|"/api/*"| Backend["FastAPI Backend (Python 3.12)"]
Backend <-->|"SQLAlchemy (3306)"| DB[("MySQL 8.4 Database")]
Backend <-->|"Vector / File Storage"| Storage["Uploads & Document Vault"]
Backend <-->|"LLM APIs"| AI["OpenRouter / LLM Services"]
end
```
### Technology Highlights
- **Frontend**: React 19, Vite, Plain Modern CSS (Design System tokens), Context API, React Router 7.
- **Backend**: Python 3.12, FastAPI, SQLAlchemy ORM, Pydantic, APScheduler.
- **Database**: MySQL 8.4 / MariaDB with automated schema migrations.
- **Deployment**: Docker, Docker Compose, Nginx Reverse Proxy with SSL Certbot readiness.
---
## 🚀 Quick Start & Local Setup
### Prerequisites
- Node.js 18+ & npm
- Python 3.12+ & pip / venv
- MySQL 8.4+ (or Docker)
### 1. Backend Setup
```bash
cd services/api
python -m venv venv
# On Windows:
.\venv\Scripts\activate
# On Linux/macOS:
source venv/bin/activate
pip install -r ../../requirements.txt
```
Configure your environment variables:
```bash
cp ../../.env.example ../../.env
# Edit .env with your MySQL credentials and API keys
```
Start the FastAPI application:
```bash
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
```
### 2. Frontend Setup
```bash
cd frontend
npm install
npm run dev
```
The client app will be accessible at `http://localhost:5173`.
---
## 🐳 Docker Deployment
To spin up the entire production stack (Frontend, Backend, and MySQL):
```bash
docker compose up -d --build
```
Detailed VPS deployment instructions, SSL certification, and reverse-proxy setups can be found in [`DEPLOYMENT.md`](./DEPLOYMENT.md).
---
## 📄 License
Proprietary - All rights reserved.
+14
View File
@@ -0,0 +1,14 @@
import re
filepath = 'frontend/public/css/base.css'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
split_str = "/* ============================================================\n MOTION SYSTEM (Phase 3)\n ============================================================ */"
if split_str in content:
content = content.split(split_str)[0].strip() + "\n"
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("base.css cleaned.")
else:
print("MOTION SYSTEM block not found in base.css.")
+17
View File
@@ -0,0 +1,17 @@
filepath = 'frontend/src/pages/AdminUserDetail.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
import_statement = "import StatusChip from '../components/StatusChip';\n"
if "import StatusChip" not in content:
# Insert after the last import
last_import_idx = content.rfind("import ")
if last_import_idx != -1:
end_of_line = content.find("\n", last_import_idx)
content = content[:end_of_line+1] + import_statement + content[end_of_line+1:]
else:
content = import_statement + content
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("Added StatusChip import.")
+20
View File
@@ -0,0 +1,20 @@
filepath = 'frontend/src/components/StatusChip.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
content = content.replace(
'<div className="flex flex-col items-start gap-1 status-chip-container">',
'<div className="status-chip-container">'
)
content = content.replace(
'shadow-sm border border-black/5',
''
)
content = content.replace(
'<div className="text-xs text-[var(--error)] italic mt-1 font-medium bg-[var(--error-bg)] px-2 py-1 rounded-sm border border-[var(--error)]/20">',
'<div className="status-chip-note">'
)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("StatusChip fixed")
+15 -8
View File
@@ -2,15 +2,22 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/webp" href="/images/bookkeeppro-logo.webp" />
<link rel="icon" type="image/webp" href="/images/brand-logo-mark.webp" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="BookKeepPro — Professional bookkeeping, payroll and tax preparation services for growing businesses across the US and India. 27 years of accounting excellence." />
<title>BookKeepPro — Bookkeeping, Payroll &amp; Tax Services</title>
<link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/marketing.css"/>
<link rel="stylesheet" href="/css/chatbot.css" media="print" onload="this.media='all'" />
<link rel="stylesheet" href="/css/animations.css" media="print" onload="this.media='all'" />
<meta name="description" content="ABC CPA &amp; Advisory &mdash; Professional tax strategy, international FBAR compliance, and AI accounting services for high-growth businesses and global founders." />
<title>ABC CPA &mdash; Tax Advisory, International Tax &amp; Fractional CFO</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500;1,600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<link rel="stylesheet" href="/css/base.css?v=2.1.0"/>
<link rel="stylesheet" href="/css/components.css?v=2.1.0"/>
<link rel="stylesheet" href="/css/marketing.css?v=2.1.0"/>
<link rel="stylesheet" href="/css/chatbot.css?v=2.1.0" />
<link rel="stylesheet" href="/css/animations.css?v=2.1.0" />
<link rel="stylesheet" href="/css/dynamic.css?v=2.1.0" />
<link rel="stylesheet" href="/css/artha-motion.css?v=2.1.0" />
<link rel="stylesheet" href="/css/dashboard.css?v=2.1.0" />
</head>
<body>
<div id="root"></div>
+1 -105
View File
@@ -13,8 +13,7 @@
"lucide-react": "^1.24.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-router-dom": "^7.18.1",
"xlsx": "^0.18.5"
"react-router-dom": "^7.18.1"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.3.2",
@@ -2012,15 +2011,6 @@
}
}
},
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -2169,28 +2159,6 @@
],
"license": "CC-BY-4.0"
},
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -2216,18 +2184,6 @@
"url": "https://opencollective.com/express"
}
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"license": "Apache-2.0",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -2424,15 +2380,6 @@
"node": ">= 6"
}
},
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fraction.js": {
"version": "5.3.4",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
@@ -3238,18 +3185,6 @@
"node": ">=0.10.0"
}
},
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"license": "Apache-2.0",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/tailwindcss": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.2.tgz",
@@ -3404,45 +3339,6 @@
"optional": true
}
}
},
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
}
}
}
+4 -4
View File
@@ -7,7 +7,8 @@
"dev": "vite",
"build": "vite build",
"lint": "oxlint",
"preview": "vite preview"
"preview": "vite preview",
"serve": "vite build && vite preview"
},
"dependencies": {
"axios": "^1.18.1",
@@ -15,8 +16,7 @@
"lucide-react": "^1.24.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-router-dom": "^7.18.1",
"xlsx": "^0.18.5"
"react-router-dom": "^7.18.1"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.3.2",
@@ -31,4 +31,4 @@
"tailwindcss": "^4.3.2",
"vite": "^8.1.1"
}
}
}
+76
View File
@@ -0,0 +1,76 @@
import os
footer_path = 'src/components/Footer.jsx'
footer_content = '''import { Link } from 'react-router-dom';
export default function Footer() {
return (
<footer className="bg-[var(--paper)] border-t border-[var(--border)] mt-auto relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-b from-transparent to-[var(--emerald)]/5 pointer-events-none"></div>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 relative z-10">
<div className="grid grid-cols-1 md:grid-cols-12 gap-12 lg:gap-8">
<div className="md:col-span-12 lg:col-span-5 flex flex-col items-start">
<Link to="/" className="inline-block mb-6 transition-transform duration-200 hover:scale-[1.02]">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" className="h-14 w-auto object-contain" />
</Link>
<p className="text-[var(--ink-soft)] leading-relaxed text-[15px] max-w-sm font-medium">
Bookkeeping, payroll and tax preparation for growing businesses - kept precise, kept compliant.
</p>
</div>
<div className="md:col-span-5 lg:col-span-3 lg:col-start-7">
<h3 className="font-display text-xl text-[var(--ink)] mb-6 tracking-wide">Navigate</h3>
<div className="flex flex-col gap-4 text-[15px] font-medium">
<Link to="/" className="text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Home</Link>
<Link to="/about-us" className="text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">About Us</Link>
<Link to="/services" className="text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Services</Link>
<Link to="/contact" className="text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Contact Us</Link>
</div>
</div>
<div className="md:col-span-7 lg:col-span-3">
<h3 className="font-display text-xl text-[var(--ink)] mb-6 tracking-wide">Reach us</h3>
<div className="flex flex-col gap-5 text-[15px] text-[var(--ink-soft)] font-medium">
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[22px] group-hover:scale-110 transition-transform shrink-0">location_on</span>
<span className="leading-snug">USA - 2520 Indigo Dr, McKinney, TX 75072</span>
</p>
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[22px] group-hover:scale-110 transition-transform shrink-0">location_on</span>
<span className="leading-snug">India - 508 White Square, Hinjewadi Road, Pune 411057</span>
</p>
<p className="flex items-center gap-3 group pt-1">
<span className="material-symbols-outlined text-[var(--brass)] text-[22px] group-hover:scale-110 transition-transform shrink-0">mail</span>
<a href="mailto:atharvg.aiindia@gmail.com" className="hover:text-[var(--emerald)] transition-colors">atharvg.aiindia@gmail.com</a>
</p>
<p className="flex items-center gap-3 group">
<span className="material-symbols-outlined text-[var(--brass)] text-[22px] group-hover:scale-110 transition-transform shrink-0">phone</span>
<a href="tel:+918275367267" className="hover:text-[var(--emerald)] transition-colors">+91 8275367267</a>
</p>
</div>
</div>
</div>
</div>
<div className="border-t border-[var(--border)] relative z-10 bg-[var(--paper)]/80">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col md:flex-row items-center justify-between gap-4">
<p className="text-sm text-[var(--ink-soft)] font-medium">
© {new Date().getFullYear()} Bookkeeping Business Solutions. All rights reserved.
</p>
<div className="flex gap-4">
<Link to="/privacy" className="text-sm text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors">Privacy Policy</Link>
<Link to="/terms" className="text-sm text-[var(--ink-soft)] hover:text-[var(--emerald)] transition-colors">Terms of Service</Link>
</div>
</div>
</div>
</footer>
);
}
'''
with open(footer_path, 'w', encoding='utf-8') as f:
f.write(footer_content)
print('Footer patched successfully.')
+78
View File
@@ -0,0 +1,78 @@
import os
footer_path = 'src/components/Footer.jsx'
footer_content = '''import { Link } from 'react-router-dom';
export default function Footer() {
return (
<footer className="bg-[var(--ink)] border-t border-[var(--ink-soft)] mt-auto relative overflow-hidden">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 relative z-10 flex flex-col lg:flex-row justify-between gap-12 lg:gap-8">
{/* Brand Section */}
<div className="flex flex-col items-start max-w-sm">
<Link to="/" className="inline-block mb-6 transition-transform duration-200 hover:scale-[1.02] bg-white p-2 rounded-lg shadow-sm">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" className="h-12 w-auto object-contain" />
</Link>
<p className="text-white/70 leading-relaxed text-[15px] font-medium">
Bookkeeping, payroll and tax preparation for growing businesses - kept precise, kept compliant.
</p>
</div>
{/* Links Section */}
<div className="flex flex-col sm:flex-row gap-12 sm:gap-24">
<div className="flex flex-col min-w-[140px]">
<h3 className="font-display text-xl text-white mb-6 tracking-wide">Navigate</h3>
<div className="flex flex-col gap-4 text-[15px] font-medium">
<Link to="/" className="text-white/70 hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Home</Link>
<Link to="/about-us" className="text-white/70 hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">About Us</Link>
<Link to="/services" className="text-white/70 hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Services</Link>
<Link to="/contact" className="text-white/70 hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200 w-fit">Contact Us</Link>
</div>
</div>
<div className="flex flex-col max-w-sm">
<h3 className="font-display text-xl text-white mb-6 tracking-wide">Reach us</h3>
<div className="flex flex-col gap-5 text-[15px] text-white/70 font-medium">
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[22px] group-hover:scale-110 transition-transform shrink-0">location_on</span>
<span className="leading-snug">USA - 2520 Indigo Dr, McKinney, TX 75072</span>
</p>
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[22px] group-hover:scale-110 transition-transform shrink-0">location_on</span>
<span className="leading-snug">India - 508 White Square, Hinjewadi Road, Pune 411057</span>
</p>
<p className="flex items-center gap-3 group pt-1">
<span className="material-symbols-outlined text-[var(--brass)] text-[22px] group-hover:scale-110 transition-transform shrink-0">mail</span>
<a href="mailto:atharvg.aiindia@gmail.com" className="hover:text-[var(--emerald)] transition-colors">atharvg.aiindia@gmail.com</a>
</p>
<p className="flex items-center gap-3 group">
<span className="material-symbols-outlined text-[var(--brass)] text-[22px] group-hover:scale-110 transition-transform shrink-0">phone</span>
<a href="tel:+918275367267" className="hover:text-[var(--emerald)] transition-colors">+91 8275367267</a>
</p>
</div>
</div>
</div>
</div>
<div className="border-t border-white/10 relative z-10 bg-[var(--ink-soft)]/50">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col md:flex-row items-center justify-between gap-4">
<p className="text-sm text-white/50 font-medium">
© {new Date().getFullYear()} Bookkeeping Business Solutions. All rights reserved.
</p>
<div className="flex gap-6">
<Link to="/privacy" className="text-sm text-white/50 hover:text-white transition-colors">Privacy Policy</Link>
<Link to="/terms" className="text-sm text-white/50 hover:text-white transition-colors">Terms of Service</Link>
</div>
</div>
</div>
</footer>
);
}
'''
with open(footer_path, 'w', encoding='utf-8') as f:
f.write(footer_content)
print('Footer fully updated to premium dark layout.')
+49
View File
@@ -0,0 +1,49 @@
import os
footer_path = 'src/components/Footer.jsx'
footer_content = '''import { Link } from 'react-router-dom';
export default function Footer() {
return (
<footer className="bg-[var(--ink)] pt-16 pb-8 border-t-[4px] border-[var(--brass)]">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex flex-col md:flex-row justify-between gap-12">
{/* Left: Brand */}
<div className="flex flex-col max-w-[280px]">
<Link to="/" className="mb-4 inline-block">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" className="w-[190px] h-auto opacity-90" />
</Link>
<p className="text-white/60 text-[14px] leading-relaxed">
Bookkeeping, payroll and tax preparation for growing businesses - kept precise, kept compliant.
</p>
</div>
{/* Right: Links */}
<div className="flex flex-col sm:flex-row gap-16 md:gap-24">
<div className="flex flex-col gap-3">
<h3 className="text-[var(--brass)] font-mono text-[12.5px] uppercase tracking-[0.1em] font-semibold mb-2">Navigate</h3>
<Link to="/" className="text-white/75 hover:text-white transition-colors text-[14.5px]">Home</Link>
<Link to="/about-us" className="text-white/75 hover:text-white transition-colors text-[14.5px]">About Us</Link>
<Link to="/services" className="text-white/75 hover:text-white transition-colors text-[14.5px]">Services</Link>
<Link to="/contact" className="text-white/75 hover:text-white transition-colors text-[14.5px]">Contact Us</Link>
</div>
<div className="flex flex-col gap-3">
<h3 className="text-[var(--brass)] font-mono text-[12.5px] uppercase tracking-[0.1em] font-semibold mb-2">Reach Us</h3>
<p className="text-white/75 text-[14px]">USA - 2520 Indigo Dr, McKinney, TX 75072</p>
<p className="text-white/75 text-[14px]">India - 508 White Square, Hinjewadi Road, Pune 411057</p>
<a href="mailto:atharvg.aiindia@gmail.com" className="text-white/75 hover:text-white transition-colors text-[14.5px]">atharvg.aiindia@gmail.com</a>
<a href="tel:+918275367267" className="text-white/75 hover:text-white transition-colors text-[14.5px]">+91 8275367267</a>
</div>
</div>
</div>
</footer>
);
}
'''
with open(footer_path, 'w', encoding='utf-8') as f:
f.write(footer_content)
print('Footer patched exactly to image.')
+320
View File
@@ -0,0 +1,320 @@
import os
base_path = 'src/components'
# 1. Button.jsx
button_path = os.path.join(base_path, 'Button.jsx')
button_content = '''import React from 'react';
import { Loader2 } from 'lucide-react';
export default function Button({
children,
variant = 'primary',
size = 'md',
className = '',
type = 'button',
loading = false,
disabled = false,
icon,
...props
}) {
const baseClass = "btn relative inline-flex items-center justify-center transition-all duration-200 active:translate-y-[1px] disabled:opacity-60 disabled:cursor-not-allowed focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--emerald)]";
const variantClass = `btn-${variant}`;
const sizeClass = size === 'sm' ? 'btn-sm' : size === 'xs' ? 'btn-xs px-2 py-1 text-xs' : '';
return (
<button
type={type}
className={`${baseClass} ${variantClass} ${sizeClass} ${className}`.trim()}
disabled={disabled || loading}
{...props}
>
{loading && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}
{!loading && icon && <span className="mr-2 flex items-center">{icon}</span>}
<span className={loading ? 'opacity-0' : ''}>{children}</span>
</button>
);
}
'''
with open(button_path, 'w', encoding='utf-8') as f:
f.write(button_content)
# 2. StatusChip.jsx
status_path = os.path.join(base_path, 'StatusChip.jsx')
status_content = '''import React from 'react';
export default function StatusChip({ status, note }) {
const s = (status || 'pending').toLowerCase();
let badgeClass = 'badge-yellow';
if (s === 'approved' || s === 'filed' || s === 'verified') badgeClass = 'badge-green';
if (s === 'rejected' || s === 'error') badgeClass = 'badge-red';
if (s === 'sent_for_approval') badgeClass = 'badge-blue';
const statusText = s.replace(/_/g, ' ').toUpperCase();
return (
<div className="flex flex-col items-start gap-1">
<span className={`badge ${badgeClass} shadow-sm border border-black/5`}>{statusText}</span>
{note && (
<div className="text-xs text-[var(--error)] italic mt-1 font-medium bg-[var(--error-bg)] px-2 py-1 rounded-sm border border-[var(--error)]/20">
Rejection Note: {note}
</div>
)}
</div>
);
}
'''
with open(status_path, 'w', encoding='utf-8') as f:
f.write(status_content)
# 3. ConfirmModal.jsx
modal_path = os.path.join(base_path, 'ConfirmModal.jsx')
modal_content = '''import React, { useEffect } from "react";
import Button from "./Button";
function ConfirmModal({ isOpen, title, message, confirmText, cancelText, onConfirm, onCancel, isDestructive }) {
useEffect(() => {
if (!isOpen) return;
const handleEsc = (e) => {
if (e.key === 'Escape') onCancel();
};
window.addEventListener('keydown', handleEsc);
return () => window.removeEventListener('keydown', handleEsc);
}, [isOpen, onCancel]);
if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-0">
<div
className="fixed inset-0 bg-black/40 backdrop-blur-[2px] transition-opacity duration-200"
onClick={onCancel}
></div>
<div className="relative bg-[var(--card)] rounded-xl shadow-2xl border border-[var(--border)] max-w-md w-full p-6 sm:p-8 animate-fade-up" onClick={e => e.stopPropagation()}>
{title && <h3 className="font-display text-xl text-[var(--ink)] mb-3">{title}</h3>}
{message && (
<div className="text-[var(--muted)] mb-8 leading-relaxed">
{message.split('\\n').map((line, i) => (
<React.Fragment key={i}>
{line}
<br />
</React.Fragment>
))}
</div>
)}
<div className="flex flex-col-reverse sm:flex-row justify-end gap-3 sm:gap-4">
<Button variant="ghost" onClick={onCancel} className="w-full sm:w-auto">
{cancelText || "Cancel"}
</Button>
<Button
variant={isDestructive ? "danger" : "primary"}
onClick={onConfirm}
className="w-full sm:w-auto"
>
{confirmText || "Confirm"}
</Button>
</div>
</div>
</div>
);
}
export default ConfirmModal;
'''
with open(modal_path, 'w', encoding='utf-8') as f:
f.write(modal_content)
# 4. ResponsiveTable.jsx
table_path = os.path.join(base_path, 'ResponsiveTable.jsx')
table_content = '''import React from 'react';
export default function ResponsiveTable({ columns, data, keyField = 'id', renderCard }) {
if (!data || data.length === 0) {
return (
<div className="flex flex-col items-center justify-center py-12 px-4 border border-dashed border-[var(--border)] rounded-lg bg-[var(--paper)] text-center animate-fade-up">
<span className="material-symbols-outlined text-4xl text-[var(--muted)] mb-3 opacity-50">inventory_2</span>
<h3 className="text-lg font-medium text-[var(--ink)] mb-1">No records found</h3>
<p className="text-sm text-[var(--muted)]">Try adjusting your filters or upload a new document.</p>
</div>
);
}
return (
<>
<div className="hidden md:block overflow-x-auto rounded-lg border border-[var(--border)] shadow-sm bg-[var(--card)] animate-fade-up">
<table className="w-full text-left border-collapse">
<thead>
<tr className="bg-[var(--paper)] border-b-2 border-[var(--border)]">
{columns.map((col, idx) => (
<th key={idx} className="px-5 py-4 text-[13px] font-bold text-[var(--ink-soft)] uppercase tracking-wider">
{col.label}
</th>
))}
</tr>
</thead>
<tbody className="divide-y divide-[var(--border)]">
{data.map(row => (
<tr key={row[keyField]} className="interactive-row group">
{columns.map((col, idx) => (
<td key={idx} className="px-5 py-4 text-sm text-[var(--ink)]">
{col.render ? col.render(row) : row[col.key]}
</td>
))}
</tr>
))}
</tbody>
</table>
</div>
<div className="md:hidden flex flex-col gap-4">
{data.map(row => (
<div key={row[keyField]} className="interactive-card p-5 border border-[var(--border)] rounded-xl bg-[var(--card)] animate-fade-up">
{renderCard ? renderCard(row) : (
<div className="flex flex-col gap-3">
{columns.map((col, idx) => (
<div key={idx} className="flex justify-between items-start gap-4 text-sm">
<span className="text-[var(--muted)] font-medium shrink-0">{col.label}:</span>
<span className="text-right font-medium text-[var(--ink)] break-words">{col.render ? col.render(row) : row[col.key]}</span>
</div>
))}
</div>
)}
</div>
))}
</div>
</>
);
}
'''
with open(table_path, 'w', encoding='utf-8') as f:
f.write(table_content)
# 5. Navbar.jsx
navbar_path = os.path.join(base_path, 'Navbar.jsx')
navbar_content = '''import { Link, useLocation, useNavigate } from 'react-router-dom';
import { useState } from 'react';
export default function Navbar({ solid = false }) {
const [isOpen, setIsOpen] = useState(false);
const location = useLocation();
const navigate = useNavigate();
const isActive = (path) => {
if (path === '/' && location.pathname === '/') return true;
if (path !== '/' && location.pathname.startsWith(path)) return true;
return false;
};
const navLinks = [
{ name: 'Home', path: '/' },
{ name: 'About Us', path: '/about-us' },
{ name: 'Services', path: '/services' },
{ name: 'Contact Us', path: '/contact' }
];
return (
<div className={`navbar ${solid ? 'navbar-solid' : ''} border-b border-[var(--border)] shadow-sm bg-[var(--paper)]/95 backdrop-blur-md sticky top-0 z-40 transition-colors duration-300`}>
<div className="nav-container max-w-7xl mx-auto flex items-center justify-between px-4 sm:px-6 lg:px-8 py-3">
<Link to="/" className="flex-shrink-0 transition-transform duration-200 hover:scale-[1.02]">
<img id="logos" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" className="h-10 sm:h-12 w-auto" />
</Link>
<nav id="navMenu" className={`nav-menu ${isOpen ? 'active' : ''} md:flex items-center gap-8`}>
{navLinks.map((link) => (
<Link
key={link.path}
to={link.path}
onClick={() => setIsOpen(false)}
className={`text-[15px] font-medium transition-all duration-200 ${isActive(link.path) ? 'text-[var(--emerald)] border-b-2 border-[var(--emerald)] pb-1' : 'text-[var(--ink-soft)] hover:text-[var(--emerald)] hover:-translate-y-[1px] pb-1 border-b-2 border-transparent'}`}
>
{link.name}
</Link>
))}
<button className="btn btn-primary px-5 py-2 mt-4 md:mt-0 shadow-sm md:ml-4" onClick={() => navigate('/login')}>
Sign in
</button>
</nav>
<div className="hamburger md:hidden cursor-pointer" onClick={() => setIsOpen(!isOpen)}>
<span></span><span></span><span></span>
</div>
</div>
</div>
);
}
'''
with open(navbar_path, 'w', encoding='utf-8') as f:
f.write(navbar_content)
# 6. Footer.jsx
footer_path = os.path.join(base_path, 'Footer.jsx')
footer_content = '''import { Link } from 'react-router-dom';
export default function Footer() {
return (
<footer className="bg-[var(--paper)] border-t border-[var(--border)] mt-auto relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-b from-transparent to-[var(--emerald)]/5 pointer-events-none"></div>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 relative z-10">
<div className="grid grid-cols-1 md:grid-cols-12 gap-12 lg:gap-8">
<div className="md:col-span-5 lg:col-span-4">
<Link to="/" className="inline-block mb-6 transition-transform duration-200 hover:scale-[1.02]">
<img src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" className="h-12 w-auto" />
</Link>
<p className="text-[var(--muted)] leading-relaxed text-sm max-w-sm">
Bookkeeping, payroll and tax preparation for growing businesses - kept precise, kept compliant.
</p>
</div>
<div className="md:col-span-3 lg:col-span-2 lg:col-start-7">
<h3 className="font-display text-lg text-[var(--ink)] mb-4 tracking-wide">Navigate</h3>
<div className="flex flex-col gap-3 text-sm">
<Link to="/" className="text-[var(--muted)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200">Home</Link>
<Link to="/about-us" className="text-[var(--muted)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200">About Us</Link>
<Link to="/services" className="text-[var(--muted)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200">Services</Link>
<Link to="/contact" className="text-[var(--muted)] hover:text-[var(--emerald)] transition-colors hover:translate-x-1 duration-200">Contact Us</Link>
</div>
</div>
<div className="md:col-span-4 lg:col-span-4">
<h3 className="font-display text-lg text-[var(--ink)] mb-4 tracking-wide">Reach us</h3>
<div className="flex flex-col gap-4 text-sm text-[var(--muted)]">
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[20px] group-hover:scale-110 transition-transform">location_on</span>
<span className="leading-snug">USA - 2520 Indigo Dr, McKinney, TX 75072</span>
</p>
<p className="flex items-start gap-3 group">
<span className="material-symbols-outlined text-[var(--emerald)] text-[20px] group-hover:scale-110 transition-transform">location_on</span>
<span className="leading-snug">India - 508 White Square, Hinjewadi Road, Pune 411057</span>
</p>
<p className="flex items-center gap-3 mt-1 group">
<span className="material-symbols-outlined text-[var(--brass)] text-[20px] group-hover:scale-110 transition-transform">mail</span>
<a href="mailto:atharvg.aiindia@gmail.com" className="hover:text-[var(--emerald)] transition-colors">atharvg.aiindia@gmail.com</a>
</p>
<p className="flex items-center gap-3 group">
<span className="material-symbols-outlined text-[var(--brass)] text-[20px] group-hover:scale-110 transition-transform">phone</span>
<a href="tel:+918275367267" className="hover:text-[var(--emerald)] transition-colors">+91 8275367267</a>
</p>
</div>
</div>
</div>
</div>
<div className="border-t border-[var(--border)] relative z-10 bg-[var(--paper)]/80">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<p className="text-center text-sm text-[var(--muted)]">
© {new Date().getFullYear()} Bookkeeping Business Solutions. All rights reserved.
</p>
</div>
</div>
</footer>
);
}
'''
with open(footer_path, 'w', encoding='utf-8') as f:
f.write(footer_content)
print('Phase 4 rewritten safely.')
+4 -4
View File
@@ -10,8 +10,8 @@
.btn:active { transform: translateY(1px) scale(0.97); }
@keyframes pulse-brass {
0%, 100% { box-shadow: 0 0 0 0 rgba(176,128,61,0.35); }
50% { box-shadow: 0 0 0 5px rgba(176,128,61,0); }
0%, 100% { box-shadow: 0 0 0 0 rgba(29, 78, 216, 0.35); }
50% { box-shadow: 0 0 0 5px rgba(29, 78, 216, 0); }
}
.pulse { animation: pulse-brass 2s infinite; }
@@ -25,14 +25,14 @@
.stagger > *:nth-child(5) { animation-delay: 0.24s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }
input[type=checkbox] { accent-color: var(--emerald); width: 16px; height: 16px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--brass); width: 16px; height: 16px; cursor: pointer; }
/* Ledger-rule underline — the signature link treatment: a brass
rule draws itself in, like a line struck under a checked entry */
.fancy-link {
position: relative;
text-decoration: none;
color: var(--emerald);
color: var(--brass);
}
.fancy-link::after {
content: '';
+329
View File
@@ -0,0 +1,329 @@
/* ============================================================
artha-motion.css · motion layer for the ABC CPA "Ledger" UI
Load AFTER dynamic.css in index.html:
<link rel="stylesheet" href="/css/artha-motion.css" />
Motion language: calm, precise, "a ledger line being drawn".
- one easing curve (expo-out), 200-700ms, no bounce
- gold rule draws under / over things that matter
- only transform + opacity are animated
Palette (matches base.css):
ink #0A2540 · blue #1D4ED8 · emerald #047857 · page #F6F9FC
============================================================ */
/* ---------- 1. Fix colour drift (dynamic.css still uses the OLD palette) ---------- */
:root {
--ink-rgb: 10, 37, 64;
--green-rgb: 29, 78, 216;
--gold-rgb: 245, 184, 61;
--brass-rgb: 245, 184, 61;
/* brass token override */
--emerald-rgb: 4, 120, 87;
/* emerald token override */
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
/* shadows tinted with ink */
--shadow-xs: 0 1px 2px 0 rgba(var(--ink-rgb), 0.06);
--shadow-sm: 0 4px 10px -2px rgba(var(--ink-rgb), 0.10);
--shadow-md: 0 12px 28px -8px rgba(var(--ink-rgb), 0.16);
--shadow-lg: 0 24px 56px -12px rgba(var(--ink-rgb), 0.22);
--shadow-glow: 0 0 0 6px rgba(29, 78, 216, 0.16);
}
::selection {
background: rgba(29, 78, 216, 0.20);
color: #0A2540;
}
.scroll-progress {
background: linear-gradient(90deg, #1D4ED8, #14B8A6);
}
/* ---------- 2. Shared keyframes ---------- */
@keyframes arthaRise {
from {
opacity: 0;
transform: translateY(18px);
}
}
@keyframes arthaPop {
from {
opacity: 0;
transform: scale(0.85);
}
}
@keyframes arthaRule {
to {
background-size: 100% 2px;
}
}
@keyframes arthaDrift {
from {
transform: translate3d(-3%, -2%, 0) scale(1);
}
to {
transform: translate3d(3%, 2%, 0) scale(1.1);
}
}
/* ---------- 3. Navbar: shadow + gold hairline on scroll, gold underline on links ---------- */
.artha-navbar {
transition: box-shadow 0.3s, border-color 0.3s, background-color 0.3s;
}
html[data-scrolled] .artha-navbar {
box-shadow: 0 10px 30px -18px rgba(var(--ink-rgb), 0.45);
border-bottom-color: rgba(29, 78, 216, 0.35);
}
.artha-nav-links>a {
position: relative;
}
.artha-nav-links>a::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: -6px;
height: 1.5px;
background: #1D4ED8;
transform: scaleX(0);
transform-origin: left;
transition: transform 0.35s var(--ease-out);
}
.artha-nav-links>a:hover::after {
transform: scaleX(1);
}
/* ---------- 4. Hero: staged entrance, gold rule under the italic word, ambient light ---------- */
.artha-hero {
position: relative;
isolation: isolate;
}
.artha-hero::before {
content: '';
position: absolute;
inset: 0;
z-index: -1;
pointer-events: none;
background:
radial-gradient(50% 55% at 12% 25%, rgba(20, 184, 166, 0.14), transparent 70%),
radial-gradient(45% 60% at 90% 85%, rgba(29, 78, 216, 0.16), transparent 70%);
animation: arthaDrift 22s ease-in-out infinite alternate;
}
.artha-hero-left>* {
animation: arthaRise 0.9s var(--ease-out) backwards;
}
.artha-hero-left> :nth-child(1) {
animation-delay: 0.05s;
}
.artha-hero-left> :nth-child(2) {
animation-delay: 0.15s;
}
.artha-hero-left> :nth-child(3) {
animation-delay: 0.28s;
}
.artha-hero-left> :nth-child(4) {
animation-delay: 0.40s;
}
.artha-hero-left> :nth-child(n+5) {
animation-delay: 0.52s;
}
.artha-hero-right {
animation: arthaRise 1.1s 0.3s var(--ease-out) backwards;
}
.artha-hero-title em {
font-style: italic;
background: var(--gradient-brand);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: 600;
}
/* ---------- 5. Cards: lift + gold top-edge rule that draws on hover ---------- */
:is(.artha-portal-card, .artha-vault-card, .artha-ticker-card, .artha-trust-item, .artha-firm-stat-pill) {
position: relative;
}
:is(.artha-portal-card, .artha-vault-card, .artha-ticker-card)::after {
content: '';
position: absolute;
left: 18px;
right: 18px;
top: -1px;
height: 2px;
border-radius: 2px;
background: linear-gradient(90deg, #1D4ED8, #14B8A6);
transform: scaleX(0);
transform-origin: left;
pointer-events: none;
transition: transform 0.5s var(--ease-out);
}
:is(.artha-portal-card, .artha-vault-card, .artha-ticker-card):hover::after {
transform: scaleX(1);
}
:is(.artha-vault-card, .artha-ticker-card) {
transition: transform 0.3s var(--ease-out), box-shadow 0.3s, border-color 0.3s;
}
:is(.artha-vault-card, .artha-ticker-card):hover {
transform: translateY(-4px);
box-shadow: var(--shadow-md);
}
.artha-portal-card:hover {
transform: translateY(-2px);
}
/* pointer spotlight (needs the one-line SPOT change in motion.js) */
:is(.artha-portal-card, .artha-vault-card, .artha-ticker-card):hover {
background-image: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), rgba(29, 78, 216, 0.08), transparent 62%);
}
/* ---------- 6. Buttons: gold sheen on primary, soft press ---------- */
.artha-pill-btn {
position: relative;
overflow: hidden;
transition: transform 0.2s var(--ease-out), box-shadow 0.25s, background-color 0.25s, color 0.25s, border-color 0.25s;
}
.artha-pill-btn:not(:disabled):hover {
transform: translateY(-1px);
}
.artha-pill-btn:not(:disabled):active {
transform: translateY(1px) scale(0.97);
}
.artha-pill-primary::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
transform: translateX(-130%);
transition: transform 0.8s var(--ease-out);
}
.artha-pill-primary:not(:disabled):hover::before {
transform: translateX(130%);
}
/* ---------- 7. Status pills pop in (once) ---------- */
.artha-status-pill {
animation: arthaPop 0.45s var(--ease-out) backwards;
}
/* ---------- 8. Grids: children rise in as they scroll into view ---------- */
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)>* {
animation: arthaRise 0.7s var(--ease-out) backwards;
}
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)> :nth-child(2) {
animation-delay: 0.08s;
}
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)> :nth-child(3) {
animation-delay: 0.16s;
}
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)> :nth-child(4) {
animation-delay: 0.24s;
}
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)> :nth-child(n+5) {
animation-delay: 0.30s;
}
/* Where supported, tie the rise to scroll position instead of page load, so
below-the-fold grids animate when the visitor actually reaches them.
fill-mode stays `backwards` so hover transforms still work afterwards. */
@supports (animation-timeline: view()) {
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)>* {
animation-timing-function: linear;
animation-delay: 0s;
animation-timeline: view();
animation-range: entry 0% entry 55%;
}
}
/* principle rows: number tints gold, row nudges right */
.artha-principle-row {
transition: padding-left 0.35s var(--ease-out);
}
.artha-principle-row:hover {
padding-left: 8px;
}
.artha-principle-row:hover .artha-principle-num {
color: #1D4ED8;
}
.artha-principle-num {
transition: color 0.3s;
}
/* ---------- 9. Upload dropzone (add class `is-dragover` from JS on dragenter / dragover) ---------- */
.artha-dropzone {
transition: border-color 0.25s, background-color 0.25s, transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.artha-dropzone:hover .material-symbols-outlined {
transform: translateY(-3px);
}
.artha-dropzone .material-symbols-outlined {
transition: transform 0.3s var(--ease-out);
display: inline-block;
}
.artha-dropzone.is-dragover {
border-style: solid;
border-color: #1D4ED8;
background-color: rgba(29, 78, 216, 0.08);
transform: scale(1.012);
box-shadow: var(--shadow-glow);
}
/* ---------- 10. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
.artha-hero::before {
animation: none;
}
:is(.artha-vault-grid, .artha-ticker-cards, .artha-trust-inner, .artha-firm-stats-row, .artha-calc-option-grid)>* {
animation: none;
}
}
@media (max-width: 768px) {
.artha-hero::before {
animation: none;
}
}
@media (hover: none) {
:is(.artha-portal-card, .artha-vault-card, .artha-ticker-card):hover {
background-image: none;
transform: none;
}
}
+87 -67
View File
@@ -1,6 +1,3 @@
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,1,0');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
/* ============================================================
base.css — BookKeepPro Design System · "Ledger"
Ink, brass and parchment — a bookkeeping identity built on
@@ -11,42 +8,55 @@
/* ── Brand Tokens ─────────────────────────────────────────── */
:root {
/* core palette */
--ink: #17211D;
--ink-soft: #2A362F;
--brass: #B0803D;
--brass-dark: #8F6528;
--brass-light: rgba(176, 128, 61, 0.12);
--emerald: #1F5D46;
--emerald-dark: #163F30;
--emerald-light:rgba(31, 93, 70, 0.10);
--paper: #F5F2E9;
--ink: #0A2540;
--ink-soft: #14365F;
--brass: #1D4ED8;
--brass-dark: #1E40AF;
--brass-light: rgba(29, 78, 216, 0.08);
--emerald: #047857;
--emerald-dark: #065F46;
--emerald-light:rgba(4, 120, 87, 0.08);
--paper: #F6F9FC;
--paper-raised: #FFFFFF;
/* legacy variable names kept so every existing component re-skins automatically */
--blue: var(--emerald);
--blue-dark: var(--emerald-dark);
--blue-light: var(--emerald-light);
--orange: var(--brass);
--orange-dark: var(--brass-dark);
--orange-light: var(--brass-light);
--header-bg: #EFEADA;
--footer-bot: #EFEADA;
--navy: var(--ink);
--accent: #2C7A5B;
--blue: var(--brass);
--blue-dark: var(--brass-dark);
--blue-light: var(--brass-light);
--blue-bright: #3B82F6;
--sky: #0EA5E9;
--teal: #14B8A6;
--amber-text: #92600A;
--orange: #F5B83D;
--orange-dark: #D99A1E;
--orange-light: rgba(245, 184, 61, 0.12);
--header-bg: #EEF3F9;
--footer-bot: #EEF3F9;
--navy: #0A2540;
--accent: #1D4ED8;
--bg: var(--paper);
--card: var(--paper-raised);
--muted: #6B7268;
--border: #E3DDC9;
--success: #1F5D46;
--success-bg: rgba(31, 93, 70, 0.10);
--error: #A63A3A;
--error-bg: rgba(166, 58, 58, 0.10);
--warn: #B0803D;
--warn-bg: rgba(176, 128, 61, 0.12);
--muted: #425466;
--border: #E2E8F0;
--success: #047857;
--success-bg: #ECFDF5;
--error: #DC2626;
--error-bg: #FEF2F2;
--warn: #F5B83D;
--warn-bg: #FFF8E6;
--violet: #6D28D9;
--violet-bright:#8B5CF6;
--violet-light: #F5F3FF;
--violet-soft: #C4B5FD;
--font-display: 'Fraunces', 'Georgia', serif;
--font-body: 'IBM Plex Sans', system-ui, sans-serif;
--font-mono: 'IBM Plex Mono', ui-monospace, monospace;
--gradient-brand: linear-gradient(135deg, #1D4ED8 0%, #0EA5E9 60%, #14B8A6 100%);
--gradient-ai: linear-gradient(135deg, #6D28D9 0%, #1D4ED8 100%);
--gradient-success: linear-gradient(135deg, #047857 0%, #14B8A6 100%);
--gradient-warm: linear-gradient(135deg, #F5B83D 0%, #D99A1E 100%);
--font-display: 'Playfair Display', Georgia, serif;
--font-body: 'Inter', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
--radius-xs: 6px;
--radius-sm: 10px;
@@ -54,11 +64,11 @@
--radius-lg: 22px;
--radius-pill: 999px;
--shadow-xs: 0 1px 2px 0 rgba(23, 33, 29, 0.06);
--shadow-sm: 0 4px 10px -2px rgba(23, 33, 29, 0.10);
--shadow-md: 0 12px 28px -8px rgba(23, 33, 29, 0.16);
--shadow-lg: 0 24px 56px -12px rgba(23, 33, 29, 0.22);
--shadow-glow: 0 0 0 6px rgba(176, 128, 61, 0.14);
--shadow-xs: 0 1px 2px 0 rgba(10, 37, 64, 0.06);
--shadow-sm: 0 4px 10px -2px rgba(10, 37, 64, 0.10);
--shadow-md: 0 12px 28px -8px rgba(10, 37, 64, 0.16);
--shadow-lg: 0 24px 56px -12px rgba(10, 37, 64, 0.22);
--shadow-glow: 0 0 0 6px rgba(29, 78, 216, 0.14);
--transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
--glass-blur: blur(14px);
@@ -67,14 +77,14 @@
to bottom,
transparent 0,
transparent 27px,
rgba(23, 33, 29, 0.05) 27px,
rgba(23, 33, 29, 0.05) 28px
rgba(10, 37, 64, 0.05) 27px,
rgba(10, 37, 64, 0.05) 28px
);
}
/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
html { font-size: 14px; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
*, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
@@ -87,18 +97,18 @@ body {
-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--emerald); text-decoration: none; }
a:hover { color: var(--emerald-dark); }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-dark); }
.material-symbols-outlined { font-size: inherit; vertical-align: middle; line-height: 1; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); }
h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: clamp(19px, 2.6vw, 26px); font-weight: 600; line-height: 1.25; }
h3 { font-size: clamp(16px, 2vw, 19px); font-weight: 600; }
p { line-height: 1.7; color: #3E463F; }
small, .text-sm { font-size: 13px; color: var(--muted); }
h1 { font-size: clamp(22px, 2.2vw, 30px); font-weight: 600; line-height: 1.18; letter-spacing: -0.015em; }
h2 { font-size: clamp(18px, 1.8vw, 24px); font-weight: 600; line-height: 1.25; }
h3 { font-size: clamp(15px, 1.3vw, 18px); font-weight: 600; }
p { font-size: 13.5px; line-height: 1.6; color: var(--muted); }
small, .text-sm { font-size: 12px; color: var(--muted); }
.text-muted { color: var(--muted); }
.eyebrow {
font-family: var(--font-mono);
@@ -145,10 +155,10 @@ small, .text-sm { font-size: 13px; color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brass); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brass-dark); box-shadow: 0 6px 18px rgba(176,128,61,0.32); }
.btn-primary:hover:not(:disabled) { background: var(--brass-dark); box-shadow: 0 6px 18px rgba(29, 78, 216, 0.28); }
.btn-secondary { background: var(--emerald); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: var(--emerald-dark); box-shadow: 0 6px 18px rgba(31,93,70,0.28); }
.btn-secondary { background: var(--header-bg); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); box-shadow: 0 4px 12px rgba(10, 37, 64, 0.08); }
.btn-outline {
background: transparent;
@@ -158,10 +168,10 @@ small, .text-sm { font-size: 13px; color: var(--muted); }
.btn-outline:hover:not(:disabled) { background: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--paper); color: var(--ink); border-color: #cfc7ad; }
.btn-ghost:hover:not(:disabled) { background: var(--paper); color: var(--ink); border-color: var(--border); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8a2f2f; box-shadow: 0 6px 18px rgba(166,58,58,0.3); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; box-shadow: 0 6px 18px rgba(220, 38, 38, 0.3); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-xs { padding: 5px 12px; font-size: 12px; }
@@ -181,10 +191,10 @@ small, .text-sm { font-size: 13px; color: var(--muted); }
}
.input:focus, .select-input:focus {
outline: none;
border-color: var(--emerald);
box-shadow: 0 0 0 3px rgba(31,93,70,0.12);
border-color: var(--brass);
box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.input::placeholder { color: #A8A190; }
.input::placeholder { color: var(--muted); }
.input[readonly] { background: var(--paper); color: var(--muted); cursor: default; }
label.form-label { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-soft); margin-bottom: 6px; }
.form-group { margin-bottom: 18px; }
@@ -192,7 +202,7 @@ label.form-label { display: block; font-size: 12.5px; font-weight: 600; letter-s
.password-wrap .input { padding-right: 56px; }
.password-toggle {
position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
background: none; border: none; color: var(--emerald); font-weight: 600; font-size: 13px; cursor: pointer;
background: none; border: none; color: var(--brass); font-weight: 600; font-size: 13px; cursor: pointer;
}
/* ── Badges ──────────────────────────────────────────────── */
@@ -203,17 +213,17 @@ label.form-label { display: block; font-size: 12.5px; font-weight: 600; letter-s
white-space: nowrap;
font-family: var(--font-mono);
}
.badge-blue { background: var(--emerald-light); color: var(--emerald); }
.badge-orange { background: var(--brass-light); color: var(--brass-dark); border: 1px solid rgba(176,128,61,0.35); }
.badge-blue { background: #EFF6FF; color: #1D4ED8; }
.badge-orange { background: #FFF8E6; color: #92600A; border: 1px solid rgba(245, 184, 61, 0.35); }
.badge-red { background: var(--error-bg); color: var(--error); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(176,128,61,0.3); }
.badge-yellow { background: #FFF8E6; color: #92600A; border: 1px solid rgba(245, 184, 61, 0.3); }
.badge-muted { background: var(--paper); color: var(--muted); }
/* ── Status Pills (doc review) ───────────────────────────── */
.pill-approved { background:var(--success-bg); color:var(--success); border:1px solid rgba(31,93,70,0.3); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
.pill-rejected { background:var(--error-bg); color:var(--error); border:1px solid rgba(166,58,58,0.3); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
.pill-pending { background:var(--warn-bg); color:var(--brass-dark); border:1px solid rgba(176,128,61,0.3); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
.pill-approved { background:var(--success-bg); color:var(--success); border:1px solid rgba(4, 120, 87, 0.25); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
.pill-rejected { background:var(--error-bg); color:var(--error); border:1px solid rgba(220, 38, 38, 0.25); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
.pill-pending { background:var(--warn-bg); color:var(--amber-text); border:1px solid rgba(245, 184, 61, 0.3); padding:2px 10px; border-radius:var(--radius-xs); font-size:11px; font-weight:700; font-family: var(--font-mono); }
/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
@@ -249,7 +259,7 @@ label.form-label { display: block; font-size: 12.5px; font-weight: 600; letter-s
to { background-position: 600px 0; }
}
.skeleton {
background: linear-gradient(90deg, #EDE8D9 25%, #F5F2E9 50%, #EDE8D9 75%);
background: linear-gradient(90deg, #E2E8F0 25%, #EDF2F7 50%, #E2E8F0 75%);
background-size: 600px 100%;
animation: shimmer 1.4s infinite linear;
border-radius: var(--radius-sm);
@@ -277,7 +287,7 @@ label.form-label { display: block; font-size: 12.5px; font-weight: 600; letter-s
/* Focus visibility */
:focus-visible {
outline: 2px solid var(--emerald);
outline: 2px solid var(--brass);
outline-offset: 2px;
}
@@ -289,8 +299,8 @@ input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
outline: none;
border-color: var(--emerald) !important;
box-shadow: 0 0 0 3px rgba(31,93,70,0.14) !important;
border-color: var(--brass) !important;
box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14) !important;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
@@ -299,3 +309,13 @@ textarea:focus {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@media (max-width: 640px) {
.btn:not(.btn-icon):not(.toast-close), .btn-sm:not(.btn-icon), .select-input, .input-field {
min-height: 44px;
}
.chatbot-fab {
bottom: 80px; /* move it up so it doesn't cover footer/bottom content on mobile */
}
}
+90 -62
View File
@@ -9,19 +9,22 @@
width: 56px;
height: 56px;
border-radius: 50%;
background: var(--ink);
color: #fff;
border: 1px solid rgba(255, 255, 255, 0.14);
background: var(--gradient-ai);
color: #FFFFFF;
border: 1px solid rgba(255, 255, 255, 0.25);
cursor: pointer;
box-shadow: var(--shadow-lg);
box-shadow: 0 10px 28px -8px rgba(109, 40, 217, 0.55);
display: flex;
align-items: center;
justify-content: center;
font-size: 26px;
z-index: 9998;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, background 0.3s ease;
transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}
.chatbot-fab:hover {
transform: scale(1.07);
box-shadow: 0 12px 32px -6px rgba(109, 40, 217, 0.65);
}
.chatbot-fab:hover { transform: scale(1.07); background: var(--emerald-dark); }
.chatbot-fab:active { transform: scale(0.96); }
.chatbot-fab .fab-icon { transition: transform 0.3s ease; }
.chatbot-fab.open .fab-icon { transform: rotate(90deg); }
@@ -31,29 +34,38 @@
position: absolute;
inset: -4px;
border-radius: 50%;
border: 1.5px solid var(--brass);
border: 1.5px solid var(--violet-bright, #8B5CF6);
opacity: 0;
animation: chatPulse 2.5s ease-out infinite;
animation: chatPulse 6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.chatbot-fab.open::before { animation: none; opacity: 0; }
@keyframes chatPulse {
0% { transform: scale(1); opacity: 0.45; }
100% { transform: scale(1.4); opacity: 0; }
0% { transform: scale(1); opacity: 0.5; }
20% { transform: scale(1.35); opacity: 0; }
100% { transform: scale(1.35); opacity: 0; }
}
.chatbot-fab .notif-dot {
position: absolute;
top: 2px; right: 2px;
width: 13px; height: 13px;
width: 12px; height: 12px;
border-radius: 50%;
background: var(--brass);
border: 2px solid var(--ink);
animation: dotBounce 1.5s ease infinite;
background: #F5B83D;
border: 2px solid #0A2540;
}
.chatbot-fab.open .notif-dot { display: none; }
@keyframes dotBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
@keyframes chatbotWindowOpen {
from {
opacity: 0;
transform: scale(0.96);
}
to {
opacity: 1;
transform: scale(1);
}
}
.chatbot-window {
position: fixed;
@@ -61,25 +73,39 @@
right: 24px;
width: 380px;
max-height: 520px;
border-radius: var(--radius-lg);
border-radius: var(--radius-lg, 16px);
background: #FFFFFF;
border: 1px solid var(--border);
box-shadow: var(--shadow-lg);
border: 1px solid var(--border, #E2E8F0);
box-shadow: 0 12px 36px -8px rgba(10, 37, 64, 0.16);
display: flex;
flex-direction: column;
z-index: 9999;
overflow: hidden;
opacity: 0;
transform: translateY(16px) scale(0.97);
transform: scale(0.96);
transform-origin: bottom right;
pointer-events: none;
transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-window.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chatbot-window.visible {
opacity: 1;
transform: scale(1);
transform-origin: bottom right;
pointer-events: auto;
animation: chatbotWindowOpen 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@media (prefers-reduced-motion: reduce) {
.chatbot-window.visible {
animation: none !important;
}
.chatbot-fab::before {
animation: none !important;
}
}
.chatbot-header {
background: var(--ink);
background-image: var(--ruled);
color: #fff;
background: var(--ink, #0A2540);
color: #FFFFFF;
padding: 16px 18px;
display: flex;
align-items: center;
@@ -88,14 +114,14 @@
}
.chatbot-header .bot-avatar {
width: 36px; height: 36px; border-radius: 50%;
background: var(--brass);
background: var(--gradient-ai);
display: flex; align-items: center; justify-content: center;
font-size: 18px; flex-shrink: 0; color: #fff;
font-size: 18px; flex-shrink: 0; color: #FFFFFF;
}
.chatbot-header .bot-info h4 { font-size: 14px; font-weight: 600; margin: 0; color: #fff; font-family: var(--font-body); }
.chatbot-header .bot-info span { font-size: 11px; opacity: 0.75; }
.chatbot-header .bot-info h4 { font-size: 14px; font-weight: 600; margin: 0; color: #FFFFFF; font-family: var(--font-body); }
.chatbot-header .bot-info span { font-size: 11px; opacity: 0.8; color: #C4B5FD; }
.chatbot-header .close-chat {
margin-left: auto; background: rgba(255,255,255,0.12); border: none; color: #fff;
margin-left: auto; background: rgba(255,255,255,0.12); border: none; color: #FFFFFF;
width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 15px;
display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
@@ -104,78 +130,80 @@
.chatbot-messages {
flex: 1; overflow-y: auto; padding: 22px 18px;
display: flex; flex-direction: column; gap: 12px;
background: var(--paper);
background: #F6F9FC;
min-height: 200px; max-height: 380px; scroll-behavior: smooth;
}
.chatbot-welcome-text {
display: flex; align-items: center; justify-content: center; gap: 8px;
margin-bottom: 8px; padding: 10px;
background: var(--emerald-light);
border-radius: var(--radius-sm);
border: 1px solid rgba(31,93,70,0.15);
background: #F5F3FF;
border-radius: var(--radius-sm, 10px);
border: 1px solid rgba(109, 40, 217, 0.16);
}
.chatbot-welcome-text p { font-size: 13px; font-weight: 500; color: var(--ink); margin: 0; }
.chatbot-welcome-text .sparkle { font-size: 17px; color: var(--brass); }
.chatbot-welcome-text p { font-size: 13px; font-weight: 500; color: var(--ink, #0A2540); margin: 0; }
.chatbot-welcome-text .sparkle { font-size: 17px; color: var(--violet, #6D28D9); }
.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #d8d0b6; border-radius: 10px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--border, #E2E8F0); border-radius: 10px; }
.chat-msg {
max-width: 85%; padding: 10px 14px; border-radius: 13px;
font-size: 13px; line-height: 1.5; animation: msgSlideIn 0.3s ease; word-wrap: break-word;
font-size: 13px; line-height: 1.5; animation: msgSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1); word-wrap: break-word;
}
@keyframes msgSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msgSlideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.bot {
background: #fff; color: var(--ink); border: 1px solid var(--border);
background: #FFFFFF; color: var(--ink, #0A2540); border: 1px solid var(--border, #E2E8F0);
border-left: 2px solid var(--violet, #6D28D9);
border-bottom-left-radius: 4px; align-self: flex-start; box-shadow: var(--shadow-xs);
}
.chat-msg.user {
background: var(--emerald); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end;
background: #1D4ED8; color: #FFFFFF; border-bottom-right-radius: 4px; align-self: flex-end;
}
.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; align-self: flex-start; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); opacity: 0.4; animation: typingDot 1.2s ease-in-out infinite; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--violet, #6D28D9); 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-replies { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.quick-reply-btn {
background: #fff; border: 1.5px solid var(--border); color: var(--ink);
padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
cursor: pointer; text-align: left; transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
background: #fff; border: 1.5px solid var(--border, #E2E8F0); color: var(--ink, #0A2540);
padding: 11px 15px; border-radius: var(--radius-sm, 10px); font-size: 13.5px; font-weight: 500;
cursor: pointer; text-align: left; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
font-family: inherit; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-xs);
}
.quick-reply-btn:hover { background: var(--emerald-light); border-color: var(--emerald); color: var(--emerald-dark); transform: translateY(-1px); }
.quick-reply-btn:hover { background: #F5F3FF; border-color: rgba(109, 40, 217, 0.4); color: var(--violet, #6D28D9); transform: translateY(-1px); }
.quick-reply-btn .qr-icon { font-size: 16px; flex-shrink: 0; }
.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(--ink); 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-xs); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; font-family: var(--font-mono); }
.doc-badge.pending { background: var(--warn-bg); color: var(--brass-dark); }
.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; }
.doc-status-card { background: #fff; border: 1px solid var(--border, #E2E8F0); border-radius: var(--radius-xs, 6px); padding: 10px 12px; margin-top: 6px; font-size: 12px; }
.doc-status-card .doc-name { font-weight: 600; color: var(--ink, #0A2540); margin-bottom: 4px; font-size: 13px; }
.doc-status-card .doc-year { color: var(--muted, #425466); font-size: 11px; }
.doc-status-card .doc-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs, 6px); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; font-family: var(--font-mono); }
.doc-badge.pending { background: #FFF8E6; color: #92600A; }
.doc-badge.approved { background: #ECFDF5; color: #047857; }
.doc-badge.rejected { background: #FEF2F2; color: #DC2626; }
.doc-status-card .doc-note { margin-top: 4px; color: var(--muted, #425466); font-style: italic; font-size: 11px; }
.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: var(--paper); }
.summary-item { text-align: center; padding: 8px 4px; border-radius: var(--radius-xs, 6px); background: #F6F9FC; }
.summary-item .count { font-family: var(--font-mono); font-size: 19px; font-weight: 600; display: block; }
.summary-item .label { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.summary-item.pending .count { color: var(--brass-dark); }
.summary-item.approved .count { color: var(--success); }
.summary-item.rejected .count { color: var(--error); }
.summary-item .label { font-size: 10px; text-transform: uppercase; color: var(--muted, #425466); letter-spacing: 0.5px; }
.summary-item.pending .count { color: #92600A; }
.summary-item.approved .count { color: #047857; }
.summary-item.rejected .count { color: #DC2626; }
.faq-question {
background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xs);
background: #fff; border: 1px solid var(--border, #E2E8F0); border-radius: var(--radius-xs, 6px);
padding: 9px 12px; font-size: 12.5px; cursor: pointer; transition: all 0.2s ease;
text-align: left; color: var(--ink); width: 100%; font-family: inherit; display: block; margin-top: 4px;
text-align: left; color: var(--ink, #0A2540); width: 100%; font-family: inherit; display: block; margin-top: 4px;
}
.faq-question:hover { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-light); }
.faq-question:hover { border-color: #1D4ED8; color: #1D4ED8; background: #EFF6FF; }
.back-btn {
background: none; border: none; color: var(--emerald); cursor: pointer; font-size: 12px;
background: none; border: none; color: #1D4ED8; 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;
}
+165 -44
View File
@@ -38,32 +38,52 @@
.app-footer img { height: 28px; }
.app-footer small { color: var(--muted); font-size: 12px; }
/* ── Auth Layout — Split Card ────────────────────────────── */
/* ── Auth Layout — Artha Split Editorial ────────────────────────────── */
.auth-shell {
min-height: 100vh;
display: flex;
align-items: stretch;
background: #fff;
background: var(--paper);
}
.auth-brand {
width: 42%;
min-width: 280px;
min-width: 320px;
position: relative;
background: #17211D;
background-image: var(--ruled), linear-gradient(155deg, #17211D 0%, var(--emerald-dark) 130%);
background: var(--ink);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 40px;
color: #fff;
gap: 22px;
gap: 24px;
overflow: hidden;
border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-brand::before {
content: '';
position: absolute;
top: -80px;
left: -80px;
width: 240px;
height: 240px;
background: radial-gradient(circle, rgba(29, 78, 216, 0.45) 0%, transparent 70%);
border-radius: 50%;
pointer-events: none;
}
.auth-brand .brand-logo { height: 48px; opacity: 0.95; }
.auth-brand h2 { font-family: var(--font-display); color: #fff; font-size: clamp(20px,2.5vw,27px); text-align: center; margin: 0; font-weight: 500; }
.auth-brand p { color: rgba(255,255,255,0.68); font-size: 14px; text-align: center; line-height: 1.8; margin: 0; max-width: 320px; }
.auth-brand .brand-divider { width: 40px; height: 2px; background: var(--brass); border-radius: 2px; }
.auth-brand .auth-brand-logo-img {
width: 58px;
height: 58px;
border-radius: 12px;
object-fit: cover;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.2);
display: block;
}
.auth-brand h2 { font-family: var(--font-display, 'Playfair Display', serif); color: #fff; font-size: clamp(22px,2.6vw,30px); text-align: center; margin: 0; font-weight: 600; }
.auth-brand p { color: rgba(255,255,255,0.72); font-size: 14.5px; text-align: center; line-height: 1.7; margin: 0; max-width: 340px; }
.auth-brand .brand-divider { width: 44px; height: 3px; background: var(--brass); border-radius: 2px; }
.auth-form-side {
flex: 1;
@@ -71,13 +91,27 @@
align-items: center;
justify-content: center;
padding: clamp(32px, 5vw, 64px) clamp(24px, 6vw, 80px);
background: #fff;
background: var(--paper);
overflow-y: auto;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: clamp(21px,2.5vw,27px); 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; }
.auth-box {
width: 100%;
max-width: 440px;
background: #FFFFFF;
border: 1px solid var(--border);
border-radius: 24px;
padding: clamp(32px, 4vw, 44px);
box-shadow: 0 10px 32px -4px rgba(10, 37, 64, 0.05);
}
.auth-box h1 {
font-family: var(--font-display, 'Playfair Display', serif);
font-size: clamp(24px,2.6vw,30px);
color: var(--ink);
font-weight: 600;
margin-bottom: 6px;
}
.auth-box .auth-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-links { margin-top: 24px; font-size: 13.5px; color: var(--muted); text-align: center; line-height: 2; }
@@ -94,6 +128,7 @@
}
.auth-brand p, .auth-brand .brand-divider { display: none; }
.auth-brand .brand-logo { height: 30px; }
.auth-brand .auth-brand-logo-img { width: 36px; height: 36px; border-radius: 8px; }
.auth-brand h2 { font-size: 15px; margin: 0; }
.auth-form-side { padding: 28px 20px; }
}
@@ -184,7 +219,7 @@
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: #cfc7ad; }
.user-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(29, 78, 216, 0.3); }
.click-layer { position: absolute; inset: 0; z-index: 0; }
.user-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-avatar {
@@ -195,8 +230,8 @@
flex-shrink: 0; font-family: var(--font-display);
}
.user-info { min-width: 0; flex: 1; }
.user-info .u-name { font-weight: 600; color: var(--ink); 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-info .u-name { font-weight: 600; color: var(--ink); font-size: 14px; word-break: break-word; }
.user-info .u-email { font-size: 12px; color: var(--muted); word-break: break-word; 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 ───────────────────────────────────────── */
@@ -225,15 +260,15 @@
transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
margin-bottom: 10px;
}
.doc-row:hover { border-color: #cfc7ad; background: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(23,33,29,0.06); }
.doc-row:hover { border-color: var(--brass); background: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(10,37,64,0.06); }
.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(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row-name { font-weight: 600; font-size: 13px; color: var(--ink); word-break: break-word; }
.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 #cfc7ad;
border: 2px dashed var(--border);
border-radius: var(--radius-md);
padding: 36px 24px;
text-align: center;
@@ -242,9 +277,9 @@
cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
border-color: var(--emerald);
background: var(--emerald-light);
color: var(--emerald);
border-color: var(--brass);
background: var(--brass-light);
color: var(--brass);
}
.drop-zone .drop-icon { font-size: 34px; margin-bottom: 10px; }
.drop-zone .drop-title { font-weight: 600; font-size: 15px; color: var(--ink); }
@@ -262,7 +297,7 @@
transition: border-color var(--transition), box-shadow var(--transition);
max-width: 360px;
}
.search-bar:focus-within { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(31,93,70,0.10); }
.search-bar:focus-within { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(29,78,216,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; }
@@ -320,15 +355,15 @@
gap: 16px;
padding: 16px 20px;
border-radius: var(--radius-md);
background: var(--emerald-light);
border: 1px solid rgba(31,93,70,0.2);
background: var(--brass-light);
border: 1px solid rgba(29, 78, 216, 0.2);
margin-bottom: 24px;
}
.engagement-banner .banner-icon { font-size: 26px; flex-shrink: 0; color: var(--emerald); }
.engagement-banner .banner-icon { font-size: 26px; flex-shrink: 0; color: var(--brass); }
.engagement-banner .banner-text { flex: 1; }
.engagement-banner .banner-text strong { display: block; font-size: 14px; color: var(--ink); }
.engagement-banner .banner-text span { font-size: 13px; color: var(--muted); }
.engagement-banner.acknowledged { background: var(--success-bg); border-color: rgba(31,93,70,0.25); }
.engagement-banner.acknowledged { background: var(--success-bg); border-color: rgba(4, 120, 87, 0.25); }
/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
@@ -365,15 +400,15 @@
/* ── JS-extracted components (upload/review) ─────────────── */
.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 rgba(31,93,70,0.3); border-radius: var(--radius-sm); }
.btn-reject { background: var(--error-bg); color: var(--error); border: 1px solid rgba(166,58,58,0.3); border-radius: var(--radius-sm); }
.btn-approve { background: var(--success-bg); color: var(--success); border: 1px solid rgba(4, 120, 87, 0.3); border-radius: var(--radius-sm); }
.btn-reject { background: var(--error-bg); color: var(--error); border: 1px solid rgba(220, 38, 38, 0.3); border-radius: var(--radius-sm); }
.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: #3E463F; }
.admin-docs-td { padding: 10px 12px; color: var(--muted); }
.admin-docs-th { padding: 10px 12px; color: var(--muted); font-weight: 600; text-align: left; border-bottom: 2px solid var(--border); }
.btn-download-pill { background: var(--emerald); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 500; }
.btn-download-pill { background: var(--brass); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 500; }
.btn-download-pill:hover { opacity: 0.9; }
.btn-upload-pill { background: var(--brass); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; padding: 8px 16px; display: inline-flex; align-items: center; gap: 8px; }
.btn-upload-pill:hover { opacity: 0.9; }
@@ -745,8 +780,49 @@
min-width: 0; /* prevents flex child from overflowing */
}
.doc-review-sidebar {
flex: 0 0 240px; /* fixed 240px sidebar, doesn't shrink */
width: 240px;
flex: 0 0 290px;
width: 290px;
min-width: 260px;
}
.doc-review-sidebar .timeline-sidebar-card {
background: #FFFFFF;
border: 1px solid var(--border);
border-radius: 16px;
padding: 20px;
box-shadow: 0 4px 16px rgba(10, 37, 64, 0.04);
display: flex;
flex-direction: column;
gap: 14px;
}
.doc-review-sidebar .timeline-control {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 8px 14px;
background: var(--paper);
border: 1px solid var(--border);
border-radius: 12px;
}
.doc-review-sidebar .timeline-control .tl-btn {
width: 32px;
height: 32px;
border-radius: 8px;
border: 1px solid var(--border);
background: #FFFFFF;
color: var(--ink);
font-size: 16px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.18s ease;
}
.doc-review-sidebar .timeline-control .tl-btn:hover {
background: var(--brass);
color: #FFFFFF;
border-color: var(--brass);
}
@media (max-width: 768px) {
@@ -759,9 +835,7 @@
order: -1; /* show Filing Timeline ABOVE the doc list on mobile */
}
.doc-review-sidebar .card-flat {
flex-direction: row !important;
align-items: center;
flex-wrap: wrap;
flex-direction: column;
gap: 12px;
}
.doc-review-sidebar h3 {
@@ -769,11 +843,11 @@
margin-bottom: 0 !important;
}
.doc-review-sidebar .timeline-control {
flex: 1;
width: 100%;
}
.doc-review-sidebar .btn {
flex: 1;
min-width: 180px;
.doc-review-sidebar .btn,
.doc-review-sidebar .artha-pill-btn {
width: 100%;
}
}
@@ -845,14 +919,61 @@
.doc-count-chip {
display: inline-flex;
align-items: center;
gap: 4px;
gap: 6px;
font-size: 12px;
font-family: var(--font-mono);
background: var(--paper);
border: 1px solid var(--border);
border-radius: var(--radius-xs);
padding: 3px 8px;
border-radius: 9999px;
padding: 4px 10px;
white-space: nowrap;
}
/* ── Admin User Detail Bar ────────────────────────────── */
.aud-user-bar {
background: #FFFFFF !important;
border: 1px solid var(--border) !important;
border-radius: 20px !important;
padding: clamp(20px, 3vw, 28px) !important;
box-shadow: 0 4px 20px -2px rgba(10, 37, 64, 0.04) !important;
}
.aud-bar-inner {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
flex-wrap: wrap;
}
.aud-bar-left {
display: flex;
align-items: flex-start;
gap: 16px;
min-width: 280px;
flex: 1;
}
.aud-bar-actions {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
justify-content: flex-end;
}
.aud-year-picker {
display: flex;
align-items: center;
gap: 6px;
}
/* StatusChip */
.status-chip-container {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 4px;
}
.status-chip-note {
font-size: 12px;
color: var(--error);
font-style: italic;
}
File diff suppressed because it is too large Load Diff
+100
View File
@@ -0,0 +1,100 @@
/* ============================================================
dynamic.css — Ledger motion layer
Uses ONLY existing tokens (colours, fonts).
Concept: a brass rule is "struck under" a checked entry; numbers
tick like a ledger counter. Load AFTER animations.css.
Rules: animate transform/opacity only; entrance animations use
fill-mode `backwards` (never `both`) so hover transforms still work.
============================================================ */
:root {
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--brass-rgb: 29, 78, 216;
--emerald-rgb: 4, 120, 87;
}
/* ---------- Global polish ---------- */
::selection { background: rgba(var(--brass-rgb), 0.28); color: var(--ink); }
h1, h2, h3 { text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.btn:focus-visible, .tab-btn:focus-visible { outline-offset: 2px; }
/* ---------- Scroll progress rule (width driven by --scroll, set in motion.js) ---------- */
.scroll-progress {
position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 10000;
background: linear-gradient(90deg, #1D4ED8, #14B8A6);
transform: scaleX(var(--scroll, 0)); transform-origin: 0 50%; pointer-events: none;
}
.app-header { transition: box-shadow 0.3s, background 0.3s; }
html[data-scrolled] .app-header { box-shadow: var(--shadow-sm); }
/* ---------- Page + entrance choreography ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
.page-enter { animation: pageIn 0.5s var(--ease-out) backwards; }
/* ---------- Cards: lift + pointer spotlight (vars set in motion.js) ---------- */
.card { position: relative; }
.card:hover {
background-image: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--brass-rgb), 0.10), transparent 62%);
}
/* ---------- Buttons: lift, brass sheen, press ---------- */
.btn { position: relative; overflow: hidden; transition: transform 0.18s var(--ease-out), box-shadow 0.25s, background-color 0.25s, color 0.25s, border-color 0.25s; }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:not(:disabled):active { transform: translateY(1px) scale(0.97); box-shadow: none; }
.btn-primary::before {
content: ''; position: absolute; inset: 0; pointer-events: none;
background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
transform: translateX(-130%); transition: transform 0.8s var(--ease-out);
}
.btn-primary:not(:disabled):hover::before { transform: translateX(130%); }
/* ---------- Status chips: attention dot / stamp ---------- */
@keyframes pop { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes dotPulse{ 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.2) rotate(-18deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.badge { animation: pop 0.45s var(--ease-spring) backwards; }
/* Attention dot / stamp only on real STATUS chips (StatusChip wraps them in .status-chip-container) — not on role/label badges */
.status-chip-container :is(.badge-yellow, .badge-orange, .badge-blue)::before {
content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; animation: dotPulse 1.8s ease-in-out infinite;
}
.status-chip-container .badge-green::before { content: '✓' / ''; font-weight: 700; display: inline-block; animation: stamp 0.55s 0.15s var(--ease-spring) backwards; }
.status-chip-container .badge-red::before { content: '!' / ''; font-weight: 700; display: inline-block; animation: stamp 0.55s 0.15s var(--ease-spring) backwards; }
/* ---------- Tabs, inputs, toasts ---------- */
.tab-btn { border-radius: var(--radius-xs) var(--radius-xs) 0 0; }
.tab-btn:hover { background: rgba(var(--brass-rgb), 0.08); color: var(--ink); }
.tab-btn.active { background: linear-gradient(180deg, transparent, rgba(var(--brass-rgb), 0.07)); }
.tab-panel.active { animation: pageIn 0.4s var(--ease-out) backwards; }
input, select, textarea { transition: border-color 0.2s, box-shadow 0.25s; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; border-color: rgb(var(--brass-rgb)); box-shadow: var(--shadow-glow); }
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(0.96); } }
.toast { animation: toastIn 0.5s var(--ease-spring) backwards; }
/* ---------- Chatbot ---------- */
@keyframes ring { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.chatbot-fab::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--brass-rgb), 0.6); animation: ring 2.8s ease-out infinite; pointer-events: none; }
.chatbot-fab.open::before { animation: none; opacity: 0; }
.chatbot-fab:not(.open):hover { transform: scale(1.08) rotate(-4deg); }
.chatbot-window { transform-origin: bottom right; transition: opacity 0.3s, transform 0.4s var(--ease-spring); }
/* Reveal: hidden ONLY when JS has opted in (html.motion) — never blank without JS / reduced motion */
.reveal { opacity: 1; transform: none; }
html.motion .reveal:not(.in-view) { opacity: 0; transform: translateY(26px); }
html.motion .reveal .eyebrow::before { transform: scaleX(0); transform-origin: left; transition: transform 0.9s 0.25s var(--ease-out); }
html.motion .reveal.in-view .eyebrow::before { transform: scaleX(1); }
/* Layout safety: long text inside a .badge (About page <p class="badge">) must wrap instead of forcing horizontal scroll */
.badge { max-width: 100%; }
p.badge { white-space: normal; text-align: left; }
/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
.scroll-progress { display: none; }
}
@media (hover: none) { .card:hover { background-image: none; } }
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

+4 -4
View File
@@ -8,10 +8,10 @@ BookKeepPro handles the books, the payroll and the filings for growing businesse
## Pages
- [Home](https://aiindiacpa.duckdns.org/)
- [About Us](https://aiindiacpa.duckdns.org/about-us)
- [Services](https://aiindiacpa.duckdns.org/services)
- [Contact Us](https://aiindiacpa.duckdns.org/contact)
- [Home](https://aicpa.duckdns.org/)
- [About Us](https://aicpa.duckdns.org/about-us)
- [Services](https://aicpa.duckdns.org/services)
- [Contact Us](https://aicpa.duckdns.org/contact)
## Services
+1 -1
View File
@@ -14,4 +14,4 @@ Disallow: /reset-password
Disallow: /verify-email
Disallow: /resend-verification
Sitemap: https://aiindiacpa.duckdns.org/sitemap.xml
Sitemap: https://aicpa.duckdns.org/sitemap.xml
+6 -6
View File
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://aiindiacpa.duckdns.org/</loc>
<loc>https://aicpa.duckdns.org/</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://aiindiacpa.duckdns.org/about</loc>
<loc>https://aicpa.duckdns.org/about</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://aiindiacpa.duckdns.org/services</loc>
<loc>https://aicpa.duckdns.org/services</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://aiindiacpa.duckdns.org/contact</loc>
<loc>https://aicpa.duckdns.org/contact</loc>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://aiindiacpa.duckdns.org/login</loc>
<loc>https://aicpa.duckdns.org/login</loc>
<changefreq>yearly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>https://aiindiacpa.duckdns.org/signup</loc>
<loc>https://aicpa.duckdns.org/signup</loc>
<changefreq>yearly</changefreq>
<priority>0.5</priority>
</url>
+1
View File
@@ -56,6 +56,7 @@ function AppRoutes() {
<Route element={<MarketingLayout />}>
<Route path="/" element={<Home />} />
<Route path="/home" element={<Home />} />
<Route path="/about" element={<AboutUs />} />
<Route path="/about-us" element={<AboutUs />} />
<Route path="/services" element={<Services />} />
<Route path="/contact" element={<Contact />} />
+22 -20
View File
@@ -98,19 +98,7 @@ export default function AdminChatbot() {
// ── System overview ───────────────────────────────────────────────────────
const handleAdminStatusCheck = async () => {
setMessages(prev => [...prev, { type: 'user', role: 'user', text: 'Give me a system overview.' }]);
setView('chat');
try {
const res = await authFetch('/api/chatbot/admin-status');
if (res.ok) {
const data = await res.json();
setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: data.message }]);
} else {
setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: 'Could not fetch system status right now.' }]);
}
} catch {
setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: 'Network error.' }]);
}
sendMessage('Give me a system overview.');
};
// ── Bulk action executor with confirmation ────────────────────────────────
@@ -161,18 +149,32 @@ export default function AdminChatbot() {
const replyText = data.content || "Sorry, I couldn't understand that.";
// Check if response contains a bulk_action JSON block
const bulkMatch = replyText.match(/\{[^{}]*"bulk_action"[^{}]*\}/s);
if (bulkMatch) {
let jsonStr = replyText;
const mdMatch = replyText.match(/```(?:json)?\s*(\{[\s\S]*?\})\s*```/);
if (mdMatch) {
jsonStr = mdMatch[1];
} else {
const firstIdx = replyText.indexOf('{');
const lastIdx = replyText.lastIndexOf('}');
if (firstIdx !== -1 && lastIdx !== -1) {
jsonStr = replyText.substring(firstIdx, lastIdx + 1);
}
}
if (jsonStr.includes('"bulk_action"')) {
try {
const parsed = JSON.parse(bulkMatch[0]);
const parsed = JSON.parse(jsonStr);
if (parsed.bulk_action) {
setPendingBulk(parsed.bulk_action);
const cleanText = replyText.replace(bulkMatch[0], '').trim();
const cleanText = replyText.replace(jsonStr, '').replace(/```(?:json)?|```/g, '').trim();
setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: cleanText || "I can do that. Please confirm below." }]);
setIsTyping(false);
return;
}
} catch { /* not valid JSON, render as text */ }
} catch (e) {
console.error("Failed to parse JSON:", e, jsonStr);
/* not valid JSON, render as text */
}
}
setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: replyText }]);
@@ -184,7 +186,7 @@ export default function AdminChatbot() {
} finally {
setIsTyping(false);
}
}, [messages, authFetch]);
}, [messages, authFetch, sessionId]);
const handleSendMessage = (e) => { e.preventDefault(); if (inputText.trim()) sendMessage(inputText.trim()); };
const handleMenuAsk = (e) => { e.preventDefault(); if (menuInput.trim()) sendMessage(menuInput.trim(), []); };
@@ -276,7 +278,7 @@ export default function AdminChatbot() {
{/* Bulk action confirmation card */}
{pendingBulk && (
<div style={{ background: 'var(--warn-bg)', border: '1px solid var(--warn)', borderRadius: 'var(--radius-sm)', padding: '12px', margin: '8px 0' }}>
<div style={{ fontWeight: 700, fontSize: '13px', color: 'var(--warn)', marginBottom: '8px' }}>
<div style={{ fontWeight: 700, fontSize: '13px', color: 'var(--amber-text)', marginBottom: '8px' }}>
⚠️ Confirm bulk action
</div>
<div style={{ fontSize: '13px', marginBottom: '10px' }}>
+2 -2
View File
@@ -7,7 +7,7 @@ const STORAGE_KEY = 'user_chat_session_id';
const FAQ_DATA = {
"Account": [
{ q: "How do I reset my password?", a: 'Go to the login page and click "Forgot Password". Enter your email and we\'ll send a reset link.' },
{ q: "How do I verify my email?", a: 'Check your inbox for a verification email from BookKeepPro. Click the link inside to verify.' },
{ q: "How do I verify my email?", a: 'Check your inbox for a verification email from ABC CPA. Click the link inside to verify.' },
{ q: "How do I update my profile?", a: 'Go to your Profile page to update your name, phone number, or change your password.' },
],
"Documents": [
@@ -173,7 +173,7 @@ export default function Chatbot() {
} finally {
setIsTyping(false);
}
}, [messages, authFetch]);
}, [messages, authFetch, sessionId]);
const handleSendMessage = (e) => { e.preventDefault(); if (inputText.trim()) sendMessage(inputText.trim()); };
const handleMenuAsk = (e) => { e.preventDefault(); if (menuInput.trim()) sendMessage(menuInput.trim(), []); };
+51 -34
View File
@@ -4,78 +4,95 @@
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(10, 37, 64, 0.65);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
display: flex;
justify-content: center;
align-items: center;
z-index: 10000;
animation: fadeIn 0.2s ease-in-out;
animation: fadeIn 0.22s ease-in-out;
}
.confirm-modal-content {
background-color: #fff;
border-radius: 8px;
padding: 24px;
max-width: 400px;
background-color: #FFFFFF;
border-radius: 20px;
border: 1px solid var(--border, #E2E8F0);
padding: 28px;
max-width: 440px;
width: 90%;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
animation: slideUp 0.2s ease-in-out;
box-shadow: 0 16px 40px -8px rgba(10, 37, 64, 0.25);
animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.confirm-modal-title {
margin-top: 0;
margin-bottom: 12px;
font-size: 1.2rem;
color: #333;
margin-bottom: 10px;
font-family: var(--font-display, 'Playfair Display', serif);
font-size: 20px;
font-weight: 600;
color: var(--ink, #0A2540);
}
.confirm-modal-message {
margin-bottom: 24px;
color: #555;
line-height: 1.5;
color: var(--muted, #425466);
font-size: 14px;
line-height: 1.6;
}
.confirm-modal-actions {
display: flex;
justify-content: flex-end;
gap: 12px;
gap: 10px;
}
.confirm-modal-cancel {
background-color: transparent;
border: 1px solid #ccc;
color: #555;
padding: 8px 16px;
border-radius: 4px;
background-color: var(--paper, #F6F9FC);
border: 1px solid var(--border, #E2E8F0);
color: var(--ink, #0A2540);
padding: 8px 18px;
border-radius: 9999px;
cursor: pointer;
font-weight: 500;
transition: background-color 0.15s;
font-weight: 600;
font-size: 13px;
transition: all 0.2s ease;
}
.confirm-modal-cancel:hover {
background-color: #f5f5f5;
background-color: var(--header-bg, #EEF3F9);
border-color: var(--ink, #0A2540);
}
.confirm-modal-confirm {
padding: 8px 16px;
border-radius: 4px;
padding: 8px 20px;
border-radius: 9999px;
border: none;
cursor: pointer;
font-weight: 500;
color: #fff;
transition: opacity 0.15s;
}
.confirm-modal-confirm:hover {
opacity: 0.9;
font-weight: 600;
font-size: 13px;
color: #FFFFFF;
transition: all 0.2s ease;
}
.confirm-modal-confirm.primary {
background-color: #007bff;
background-color: var(--brass, #1D4ED8);
box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}
.confirm-modal-confirm.primary:hover {
background-color: var(--brass-dark, #1E40AF);
transform: translateY(-1px);
}
.confirm-modal-confirm.destructive {
background-color: #dc3545;
background-color: var(--error, #DC2626);
box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.confirm-modal-confirm.destructive:hover {
background-color: #B91C1C;
transform: translateY(-1px);
}
@keyframes fadeIn {
@@ -84,6 +101,6 @@
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(10px); }
from { opacity: 0; transform: translateY(14px); }
to { opacity: 1; transform: translateY(0); }
}
+43
View File
@@ -0,0 +1,43 @@
import { useEffect, useRef, useState } from 'react';
// Ledger-style ticking counter. Counts from the previous value to the new one
// once visible; reduced-motion users get the final number immediately. The
// animated text is aria-hidden and the final value is exposed to screen readers.
export default function CountUp({ value, duration = 1100, prefix = '', suffix = '' }) {
const target = Number(value);
const valid = Number.isFinite(target);
const [shown, setShown] = useState(0);
const ref = useRef(null);
const from = useRef(0);
useEffect(() => {
if (!valid) return undefined;
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (reduce || target === from.current) { setShown(target); from.current = target; return undefined; }
let raf = 0;
let started = false;
const run = () => {
started = true;
const start = performance.now();
const a = from.current;
const tick = (now) => {
const t = Math.min(1, (now - start) / duration);
const eased = 1 - Math.pow(1 - t, 4); // easeOutQuart
setShown(Math.round(a + (target - a) * eased));
if (t < 1) raf = requestAnimationFrame(tick); else from.current = target;
};
raf = requestAnimationFrame(tick);
};
const io = new IntersectionObserver(([en]) => { if (en.isIntersecting && !started) { io.disconnect(); run(); } }, { threshold: 0.3 });
if (ref.current) io.observe(ref.current);
return () => { io.disconnect(); cancelAnimationFrame(raf); };
}, [target, valid, duration]);
if (!valid) return <span>{value}</span>;
return (
<span ref={ref}>
<span aria-hidden="true">{prefix}{shown.toLocaleString('en-US')}{suffix}</span>
<span className="sr-only">{prefix}{target.toLocaleString('en-US')}{suffix}</span>
</span>
);
}
@@ -1,11 +1,11 @@
import * as XLSX from 'xlsx';
import { useState } from 'react';
import ExpandableValue from './ExpandableValue';
const CONFIDENCE_STYLES = {
high: { icon: '🟢', color: 'var(--success)', bg: 'var(--success-bg)' },
medium: { icon: '🟡', color: 'var(--warn)', bg: 'var(--warn-bg)' },
low: { icon: '🟠', color: '#d97706', bg: '#fff7ed' },
medium: { icon: '🟡', color: 'var(--amber-text)', bg: 'var(--warn-bg)' },
low: { icon: '🟠', color: '#92600A', bg: '#FFF8E6' },
unknown: { icon: '⚪', color: 'var(--muted)', bg: 'var(--paper)' },
};
@@ -62,45 +62,7 @@ export default function ExpandableSummaryBlock({ extractedData, onSave }) {
}
};
const handleExport = () => {
// Export extracted AI data as a proper .xlsx file using SheetJS
const { _meta, ...dataFields } = extractedData || {};
const rows = [['Field', 'Value']];
Object.entries(dataFields).forEach(([key, val]) => {
let valStr = val;
if (Array.isArray(val)) valStr = val.join('; ');
else if (typeof val === 'object' && val !== null) valStr = JSON.stringify(val);
let finalKey = String(key);
let finalVal = String(valStr ?? '');
// Sanitize CSV/Excel Formula Injection
if (/^[=+\-@]/.test(finalKey)) finalKey = "'" + finalKey;
if (/^[=+\-@]/.test(finalVal)) finalVal = "'" + finalVal;
rows.push([finalKey, finalVal]);
});
const ws = XLSX.utils.aoa_to_sheet(rows);
// Bold + green header
['A1', 'B1'].forEach(ref => {
if (ws[ref]) ws[ref].s = { font: { bold: true, color: { rgb: 'FFFFFF' } }, fill: { fgColor: { rgb: '2C7A5B' } } };
});
// Column widths
ws['!cols'] = [
{ wch: Math.max(10, ...Object.keys(dataFields).map(k => k.length + 2)) },
{ wch: 45 },
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Extracted Data');
XLSX.writeFile(wb, 'extracted_data.xlsx');
}
const showToggle = entries.length > 3;
const showToggle = entries.length > 3;
const entriesToShow = expanded ? entries : entries.slice(0, 3);
const confidenceStyle = CONFIDENCE_STYLES[_meta?.tier] || CONFIDENCE_STYLES.unknown;
@@ -164,9 +126,6 @@ export default function ExpandableSummaryBlock({ extractedData, onSave }) {
) : <div />}
<div style={{ display: 'flex', gap: '6px' }}>
<button onClick={handleExport} style={{ border: 'none', background: 'transparent', cursor: 'pointer', fontSize: '11px', color: 'var(--muted)', display: 'flex', alignItems: 'center', gap: '4px', padding: '2px' }} title="Export Excel">
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>download</span> Export Excel
</button>
<button onClick={handleEditClick} style={{ border: 'none', background: 'transparent', cursor: 'pointer', fontSize: '11px', color: 'var(--emerald)', display: 'flex', alignItems: 'center', gap: '4px', padding: '2px', fontWeight: 600 }} title="Edit Summary">
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>edit</span> Edit
</button>
+2 -2
View File
@@ -23,7 +23,7 @@ export default function ExpandableValue({ value, isArray }) {
style={{
background: 'none',
border: 'none',
color: 'var(--primary)',
color: 'var(--emerald)',
fontSize: '12px',
fontWeight: 600,
padding: '4px 0',
@@ -60,7 +60,7 @@ export default function ExpandableValue({ value, isArray }) {
style={{
background: 'none',
border: 'none',
color: 'var(--primary)',
color: 'var(--emerald)',
fontSize: '12px',
fontWeight: 600,
padding: '4px 0',
+75 -20
View File
@@ -1,33 +1,88 @@
import { Link } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
export default function Footer() {
const navigate = useNavigate();
return (
<footer className="footer">
<div className="footer-top">
<div className="footer-left">
<img src="/images/bookkeeppro-logo.webp" className="footer-logo" alt="BookKeepPro" width="190" height="64" />
<p>Bookkeeping, payroll and tax preparation for growing businesses — kept precise, kept compliant.</p>
<footer className="artha-footer">
<div className="artha-footer-inner">
{/* Col 1: Brand & Office */}
<div className="artha-footer-col artha-footer-brand">
<div className="artha-footer-logo-row" style={{ display: 'flex', alignItems: 'center', gap: '14px', marginBottom: '16px' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
className="artha-brand-logo-img"
style={{ width: '42px', height: '42px', borderRadius: '10px' }}
width="42"
height="42"
/>
<div>
<div className="artha-footer-title">ABC CPA &amp; Advisory</div>
<div className="artha-footer-subtitle">Tax Advisory &amp; Accounting Services</div>
</div>
</div>
<p className="artha-footer-desc">
Proactive financial strategy, international taxation, and AI-enabled accounting for founders, growth businesses, and non-residents worldwide.
</p>
<div className="artha-footer-contact-info">
<p><strong>US Office:</strong> 2520 Indigo Dr, McKinney / Frisco, TX 75072</p>
<p><strong>India Office:</strong> Landmark Centre, Pune, MH 411009</p>
<p><strong>Email:</strong> <a href="mailto:atharvg.aiindia@gmail.com">atharvg.aiindia@gmail.com</a></p>
</div>
</div>
<div className="footer-links">
<h3>Navigate</h3>
<Link to="/">Home</Link>
<Link to="/about-us">About Us</Link>
<Link to="/services">Services</Link>
<Link to="/contact">Contact Us</Link>
{/* Col 2: Services */}
<div className="artha-footer-col">
<div className="artha-footer-heading">Services</div>
<ul className="artha-footer-links">
<li><Link to="/services">Tax Strategy & Preparation</Link></li>
<li><Link to="/services">International & Cross-Border (FBAR/FATCA)</Link></li>
<li><Link to="/services">Instant P&L from Bank Statements</Link></li>
<li><Link to="/services">Fractional CFO & Advisory</Link></li>
<li><Link to="/services">Full-Cycle Bookkeeping & Payroll</Link></li>
</ul>
</div>
<div className="footer-contact">
<h3>Reach us</h3>
<p>USA · 2520 Indigo Dr, McKinney, TX 75072</p>
<p>India · 508 White Square, Hinjewadi Road, Pune 411057</p>
<p>atharvg.aiindia@gmail.com</p>
<p>+91 8275367267</p>
{/* Col 3: Firm */}
<div className="artha-footer-col">
<div className="artha-footer-heading">Firm</div>
<ul className="artha-footer-links">
<li><Link to="/">Home</Link></li>
<li><Link to="/about-us">About Us</Link></li>
<li><Link to="/services">Services</Link></li>
<li><Link to="/contact">Contact & Consultations</Link></li>
<li><Link to="/login">Login Portal</Link></li>
</ul>
</div>
{/* Col 4: Action & Hours */}
<div className="artha-footer-col artha-footer-action-col">
<button
className="artha-pill-btn artha-pill-primary artha-footer-cta-btn"
onClick={() => navigate('/login')}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>login</span>
Access Login Portal
</button>
<div className="artha-footer-hours">
<p className="artha-hours-email">atharvg.aiindia@gmail.com</p>
<p className="artha-hours-timing">Mon &ndash; Fri, 9:00 AM &ndash; 6:00 PM CT</p>
</div>
</div>
</div>
<div className="footer-bottom">
<p>© 2026 Bookkeeping Business Solutions. All rights reserved.</p>
<div className="artha-footer-bottom">
<div className="artha-footer-bottom-inner">
<p>&copy; {new Date().getFullYear()} ABC CPA & Advisory. All rights reserved.</p>
<div className="artha-footer-bottom-links">
<span>AICPA Member Firm</span>
<span>&bull;</span>
<span>QuickBooks ProAdvisor</span>
<span>&bull;</span>
<span>SOC-2 &amp; Encrypted Document Storage</span>
</div>
</div>
</div>
</footer>
);
+66 -23
View File
@@ -6,30 +6,73 @@ export default function Navbar({ solid = false }) {
const navigate = useNavigate();
return (
<div className={`navbar ${solid ? 'navbar-solid' : ''}`}>
<div className="nav-container">
<Link to="/">
<img id="logos" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" />
</Link>
<nav id="navMenu" className={`nav-menu ${isOpen ? 'active' : ''}`}>
<Link to="/" onClick={() => setIsOpen(false)}>Home</Link>
<Link to="/about-us" onClick={() => setIsOpen(false)}>About Us</Link>
<Link to="/services" onClick={() => setIsOpen(false)}>Services</Link>
<Link to="/contact" onClick={() => setIsOpen(false)}>Contact Us</Link>
<button className="login-btn desktop-login" onClick={() => navigate('/login')}>
Sign in
</button>
<button className="login-btn mobile-login" onClick={() => navigate('/login')}>
Sign in
</button>
</nav>
<div className="hamburger" onClick={() => setIsOpen(!isOpen)}>
<span></span><span></span><span></span>
<header className={`artha-navbar ${solid ? 'artha-navbar-solid' : ''}`}>
{/* Top Advisory Announcement Bar */}
<div className="artha-top-alert">
<div className="artha-top-alert-inner">
<span className="artha-alert-badge">2026 TAX SEASON</span>
<span>Now scheduling corporate tax structuring &amp; cross-border FBAR advisory sessions.</span>
<Link to="/contact" className="artha-top-alert-link">
Book Consultation &rarr;
</Link>
</div>
</div>
</div>
<div className="artha-nav-container">
{/* Brand Left: Monogram / Logo + 2-line title */}
<Link to="/" className="artha-brand-wrap">
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
className="artha-brand-logo-img"
width="38"
height="38"
/>
<div className="artha-brand-text">
<span className="artha-brand-title">ABC CPA &amp; Advisory</span>
<span className="artha-brand-sub">Tax Advisory &amp; Accounting Services</span>
</div>
</Link>
{/* Center Nav Links */}
<nav className={`artha-nav-links ${isOpen ? 'active' : ''}`}>
<Link to="/" onClick={() => setIsOpen(false)}>Home</Link>
<Link to="/services" onClick={() => setIsOpen(false)}>Services</Link>
<Link to="/about-us" onClick={() => setIsOpen(false)}>About</Link>
<Link to="/contact" onClick={() => setIsOpen(false)}>Contact</Link>
{/* Mobile only actions */}
<div className="artha-mobile-actions">
<button className="artha-pill-btn artha-pill-outline" onClick={() => { setIsOpen(false); navigate('/login'); }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>login</span>
Login Portal
</button>
<button className="artha-pill-btn artha-pill-primary" onClick={() => { setIsOpen(false); navigate('/contact'); }}>
Schedule a Call
</button>
</div>
</nav>
{/* Right Actions Desktop Cluster */}
<div className="artha-nav-actions">
<button className="artha-pill-btn artha-pill-outline" onClick={() => navigate('/login')}>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>login</span>
Login Portal
</button>
<button className="artha-pill-btn artha-pill-primary" onClick={() => navigate('/contact')}>
Schedule a Call
</button>
</div>
{/* Hamburger Mobile Toggle */}
<button
className={`artha-hamburger ${isOpen ? 'open' : ''}`}
onClick={() => setIsOpen(!isOpen)}
aria-label="Toggle Navigation Menu"
>
<span></span><span></span><span></span>
</button>
</div>
</header>
);
}
+35
View File
@@ -0,0 +1,35 @@
import React from 'react';
export default function StatusChip({ status, note }) {
const s = (status || 'pending').toLowerCase();
let pillClass = 'artha-status-pending';
let iconName = 'schedule';
if (s === 'approved' || s === 'filed' || s === 'verified') {
pillClass = 'artha-status-approved';
iconName = s === 'filed' ? 'inventory_2' : 'check_circle';
} else if (s === 'rejected' || s === 'error') {
pillClass = 'artha-status-rejected';
iconName = 'cancel';
} else if (s === 'sent_for_approval') {
pillClass = 'artha-status-sent';
iconName = 'hourglass_top';
}
const statusText = s.replace(/_/g, ' ').toUpperCase();
return (
<div className="status-chip-container">
<span className={`artha-status-pill ${pillClass}`}>
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>{iconName}</span>
{statusText}
</span>
{note && (
<div className="status-chip-note" style={{ fontSize: '11.5px', marginTop: '2px', color: s === 'rejected' ? '#DC2626' : '#425466' }}>
{s === 'rejected' ? 'Reason: ' : 'Note: '}{note}
</div>
)}
</div>
);
}
+121 -51
View File
@@ -1,28 +1,30 @@
@import "tailwindcss";
@theme {
--color-brand-ink: #17211D;
--color-brand-emerald: #1F5D46;
--color-brand-emerald-dark: #163F30;
--color-brand-emerald-light: #E8F1EC;
--color-brand-brass: #B0803D;
--color-brand-brass-dark: #8F6528;
--color-brand-brass-light: #F6EEE0;
--color-brand-paper: #F5F2E9;
--color-brand-ink: #0A2540;
--color-brand-ink-soft: #14365F;
--color-brand-emerald: #047857;
--color-brand-emerald-dark: #065F46;
--color-brand-emerald-light: #ECFDF5;
--color-brand-brass: #1D4ED8;
--color-brand-brass-dark: #1E40AF;
--color-brand-brass-light: rgba(29, 78, 216, 0.08);
--color-brand-paper: #F6F9FC;
--color-brand-card: #FFFFFF;
--color-brand-muted: #6B7268;
--color-brand-border: #E3DDC9;
--color-brand-muted: #425466;
--color-brand-border: #E2E8F0;
--color-status-success: #1F5D46;
--color-status-success-bg: #E8F1EC;
--color-status-error: #A63A3A;
--color-status-error-bg: #F7E9E9;
--color-status-warn: #B0803D;
--color-status-warn-bg: #F6EEE0;
--color-status-success: #047857;
--color-status-success-bg: #ECFDF5;
--color-status-error: #DC2626;
--color-status-error-bg: #FEF2F2;
--color-status-warn: #F5B83D;
--color-status-warn-bg: #FFF8E6;
--color-status-warn-text: #92600A;
--font-sans: "IBM Plex Sans", system-ui, sans-serif;
--font-display: "Fraunces", Georgia, serif;
--font-mono: "IBM Plex Mono", ui-monospace, monospace;
--font-sans: "Inter", system-ui, -apple-system, sans-serif;
--font-display: "Playfair Display", Georgia, serif;
--font-mono: "JetBrains Mono", ui-monospace, monospace;
--radius-xs: 6px;
--radius-sm: 10px;
@@ -30,10 +32,10 @@
--radius-lg: 22px;
--radius-pill: 999px;
--shadow-xs: 0 1px 2px rgba(23,33,29,0.06);
--shadow-sm: 0 4px 10px -2px rgba(23,33,29,0.10);
--shadow-md: 0 12px 28px -8px rgba(23,33,29,0.16);
--shadow-lg: 0 24px 56px -12px rgba(23,33,29,0.22);
--shadow-xs: 0 1px 2px rgba(10,37,64,0.06);
--shadow-sm: 0 4px 10px -2px rgba(10,37,64,0.10);
--shadow-md: 0 12px 28px -8px rgba(10,37,64,0.16);
--shadow-lg: 0 24px 56px -12px rgba(10,37,64,0.22);
}
:root {
@@ -47,7 +49,8 @@
--success: var(--color-status-success);
--error: var(--color-status-error);
--warn: var(--color-status-warn);
--green: #10b981;
--amber-text: #92600A;
--green: #10B981;
}
@@ -63,35 +66,35 @@ h1, h2, h3, h4, h5, h6 {
@apply font-display text-brand-ink font-semibold;
}
h1 { @apply text-4xl md:text-5xl lg:text-6xl; }
h2 { @apply text-3xl md:text-4xl; }
h3 { @apply text-2xl md:text-3xl; }
h1 { font-size: clamp(23px, 2.2vw, 30px); line-height: 1.18; letter-spacing: -0.015em; }
h2 { font-size: clamp(18px, 1.8vw, 24px); line-height: 1.25; }
h3 { font-size: clamp(15px, 1.3vw, 19px); line-height: 1.3; }
.tnum { font-variant-numeric: tabular-nums; }
.text-sm { @apply text-sm; }
.fancy-link { @apply text-brand-emerald hover:text-brand-emerald-dark transition-colors; }
.fancy-link { @apply text-brand-brass hover:text-brand-brass-dark transition-colors; }
.eyebrow {
@apply text-brand-brass font-bold text-sm uppercase tracking-wider block mb-2;
@apply text-brand-brass font-bold text-xs uppercase tracking-wider block mb-2;
}
/* -------------------------------- */
/* Layout & Sections */
/* -------------------------------- */
.section {
@apply py-16 px-4 md:px-8 max-w-7xl mx-auto;
@apply py-10 px-4 md:px-8 max-w-7xl mx-auto;
}
.page-heading {
@apply flex justify-between items-end mb-8 border-b border-brand-border pb-4;
@apply flex justify-between items-end mb-6 border-b border-brand-border pb-3;
}
.page-heading h1 {
@apply text-3xl font-display mb-2;
@apply text-2xl font-display mb-1;
}
.page-meta {
@apply text-brand-muted text-sm m-0;
@apply text-brand-muted text-xs m-0;
}
.card {
@@ -110,7 +113,7 @@ h3 { @apply text-2xl md:text-3xl; }
}
.select-input, .input-field {
@apply border border-brand-border rounded-sm px-3 py-2 bg-white focus:outline-none focus:ring-2 focus:ring-brand-emerald focus:border-transparent w-full;
@apply border border-brand-border rounded-sm px-3 py-2 bg-white focus:outline-none focus:ring-2 focus:ring-brand-brass focus:border-transparent w-full;
}
/* -------------------------------- */
@@ -122,7 +125,7 @@ h3 { @apply text-2xl md:text-3xl; }
}
.btn-primary {
@apply bg-brand-emerald text-white hover:bg-brand-emerald-dark border-transparent;
@apply bg-brand-brass text-white hover:bg-brand-brass-dark border-transparent;
}
.btn-outline {
@@ -146,7 +149,7 @@ h3 { @apply text-2xl md:text-3xl; }
}
.btn-upload-pill {
@apply bg-brand-emerald text-white text-sm py-1.5 px-4 font-medium hover:bg-brand-emerald-dark;
@apply bg-brand-brass text-white text-sm py-1.5 px-4 font-medium hover:bg-brand-brass-dark;
border-radius: var(--radius-pill);
}
@@ -162,7 +165,7 @@ h3 { @apply text-2xl md:text-3xl; }
}
.hero-eyebrow {
@apply text-brand-brass uppercase tracking-widest text-sm font-bold mb-6 block;
@apply text-[#F5B83D] uppercase tracking-widest text-sm font-bold mb-6 block;
}
.hero h1 {
@@ -170,11 +173,11 @@ h3 { @apply text-2xl md:text-3xl; }
}
.hero h1 em {
@apply text-brand-emerald-light not-italic;
@apply text-[#3B82F6] not-italic;
}
.hero-sub {
@apply text-lg md:text-xl text-gray-300 max-w-2xl mx-auto mb-10 leading-relaxed;
@apply text-lg md:text-xl text-[#EEF3F9] max-w-2xl mx-auto mb-10 leading-relaxed opacity-90;
}
.hero-actions {
@@ -182,7 +185,7 @@ h3 { @apply text-2xl md:text-3xl; }
}
.hero-stats {
@apply max-w-5xl mx-auto mt-20 grid grid-cols-1 sm:grid-cols-3 gap-8 border-t border-brand-emerald-dark pt-12 relative z-10;
@apply max-w-5xl mx-auto mt-20 grid grid-cols-1 sm:grid-cols-3 gap-8 border-t border-[rgba(255,255,255,0.15)] pt-12 relative z-10;
}
.stat-block {
@@ -190,11 +193,11 @@ h3 { @apply text-2xl md:text-3xl; }
}
.stat-figure {
@apply text-5xl font-display text-brand-brass mb-2;
@apply text-5xl font-display text-[#F5B83D] mb-2;
}
.stat-caption {
@apply text-brand-paper text-sm uppercase tracking-wide opacity-80;
@apply text-[#EEF3F9] text-sm uppercase tracking-wide opacity-80;
}
.about-grid {
@@ -242,14 +245,14 @@ h3 { @apply text-2xl md:text-3xl; }
}
.cta-band p {
@apply text-lg text-gray-300 mb-8 max-w-2xl mx-auto;
@apply text-lg text-[#EEF3F9] mb-8 max-w-2xl mx-auto opacity-90;
}
/* -------------------------------- */
/* Specific Pages: Uploads */
/* -------------------------------- */
.pill-pending {
@apply inline-flex items-center gap-1 bg-status-warn-bg text-status-warn text-xs font-medium px-2 py-0.5 rounded-sm;
@apply inline-flex items-center gap-1 bg-status-warn-bg text-[#92600A] text-xs font-medium px-2 py-0.5 rounded-sm;
}
.drop-area {
@@ -292,21 +295,21 @@ h3 { @apply text-2xl md:text-3xl; }
.action-card:hover {
transform: translateY(-3px);
box-shadow: var(--shadow-md);
border-color: #cfc7ad;
border-color: var(--brass);
}
.action-card .ac-icon { font-size: 30px; margin-bottom: 10px; color: var(--emerald); }
.action-card .ac-icon { font-size: 30px; margin-bottom: 10px; color: var(--brass); }
.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: 3px solid var(--emerald); }
.action-card.business { border-top: 3px solid var(--brass); }
.action-card.personal { border-top: 3px solid var(--brass); }
.action-card.business { border-top: 3px solid #0EA5E9; }
@media(max-width:480px) { .action-grid { grid-template-columns: 1fr; } }
/* -------------------------------- */
/* Upload Components (Pre-existing) */
/* -------------------------------- */
.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:#cfc7ad; background:var(--paper); }
.doc-slot-icon { font-size:22px; flex-shrink:0; color: var(--emerald); }
.doc-slot:hover { border-color:var(--brass); background:var(--paper); }
.doc-slot-icon { font-size:22px; flex-shrink:0; color: var(--brass); }
.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; }
@@ -318,6 +321,73 @@ h3 { @apply text-2xl md:text-3xl; }
.toast { background: var(--card); color: var(--navy); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; pointer-events: auto; min-width: 300px; max-width: 90vw; animation: fadeUp 0.3s ease both; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-info { border-left: 4px solid var(--emerald); }
.toast-info { border-left: 4px solid var(--brass); }
.toast-message { flex: 1; font-size: 14px; font-weight: 500; }
.toast-close { background: none; border: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
/* -------------------------------- */
/* Fixes from QA */
/* -------------------------------- */
.tab-bar {
display: flex;
gap: 8px;
border-bottom: 1px solid var(--border);
margin-bottom: 24px;
overflow-x: auto;
scrollbar-width: none; /* Firefox */
position: relative;
white-space: nowrap;
}
.tab-bar::-webkit-scrollbar {
display: none; /* Chrome/Safari */
}
/* Fade on the right edge to indicate scrolling */
.tab-bar-container {
position: relative;
}
.tab-bar-container::after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 40px;
background: linear-gradient(to right, transparent, var(--paper));
pointer-events: none;
}
.tab-btn {
background: transparent;
border: none;
border-bottom: 2px solid transparent;
padding: 12px 16px;
font-weight: 600;
font-size: 15px;
color: var(--muted);
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
transition: all 0.2s;
}
.tab-btn:hover {
color: var(--navy);
}
.tab-btn.active {
color: var(--brass);
border-bottom-color: var(--brass);
}
.card-title {
font-family: var(--font-sans);
font-weight: 600;
}
.footer-copy {
color: var(--muted);
}
+209 -15
View File
@@ -1,29 +1,223 @@
import { Outlet, Link, useNavigate } from 'react-router-dom';
import { Outlet, Link, useNavigate, useLocation } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
export default function DashboardLayout() {
const { user, logout } = useAuth();
const navigate = useNavigate();
const location = useLocation();
const { pathname } = location;
const isAdmin = user?.role === 'admin' || user?.role === 'super_admin';
return (
<div className="app-body">
<header className="app-header">
<Link to={(user?.role === 'admin' || user?.role === 'super_admin') ? '/admin-dashboard' : '/dashboard'}>
<img className="logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" />
</Link>
<div className="header-actions">
<button className="btn btn-secondary btn-sm" onClick={() => navigate('/profile')}>
My Profile
</button>
<button className="btn btn-primary btn-sm" onClick={logout}>
Logout
</button>
<div className="app-body dash-page-wash" style={{ minHeight: '100vh', display: 'flex', flexDirection: 'column' }}>
{/* Top Advisory Strip */}
<div className="artha-top-alert" style={{ padding: '6px 16px', fontSize: '11.5px' }}>
<div className="artha-top-alert-inner" style={{ justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="dash-top-badge" style={{ fontSize: '9.5px', padding: '2px 8px' }}>
{isAdmin ? 'ADMINISTRATOR CONSOLE' : 'SECURE CLIENT VAULT'}
</span>
<span style={{ color: 'rgba(255,255,255,0.85)' }}>
2026 Tax Season &bull; SOC-2 &amp; 256-Bit SSL Encrypted
</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px', color: 'rgba(255,255,255,0.75)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '14px', color: '#10B981' }}>verified_user</span>
<span>256-Bit SSL Encrypted Session</span>
</div>
</div>
</div>
{/* Main Header */}
<header
className="app-header dash-header"
style={{
position: 'sticky',
top: 0,
zIndex: 200,
padding: '12px clamp(16px, 4vw, 36px)',
height: 'auto'
}}
>
<div style={{ width: '100%', maxWidth: '1400px', margin: '0 auto' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px' }}>
{/* Brand Identity */}
<Link
to={isAdmin ? '/admin-dashboard' : '/dashboard'}
style={{ textDecoration: 'none' }}
>
<div className="artha-brand-wrap">
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
className="dash-brand-logo-img"
width="36"
height="36"
/>
<div className="artha-brand-text">
<span className="artha-brand-title" style={{ fontSize: '18px' }}>ABC CPA</span>
<span className="artha-brand-sub" style={{ fontSize: '10px' }}>
{isAdmin ? 'Partner & Staff Portal' : 'Secure Client Vault'}
</span>
</div>
</div>
</Link>
{/* User Profile Pill & Actions */}
<div className="header-actions" style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<div
style={{
display: 'flex',
alignItems: 'center',
gap: '8px',
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.1)',
borderRadius: '9999px',
padding: '4px 12px 4px 6px',
cursor: 'pointer'
}}
onClick={() => navigate('/profile')}
title="View & Edit Profile"
>
<div
style={{
width: '28px',
height: '28px',
borderRadius: '50%',
background: '#1D4ED8',
color: '#FFFFFF',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '12px',
fontWeight: 700
}}
>
{(user?.name || user?.email || 'U').charAt(0).toUpperCase()}
</div>
<div style={{ display: 'flex', flexDirection: 'column', lineHeight: 1.1 }}>
<span style={{ fontSize: '12.5px', fontWeight: 600, color: '#0A2540' }}>
{user?.name || user?.email?.split('@')[0]}
</span>
<span style={{ fontSize: '9.5px', textTransform: 'uppercase', letterSpacing: '0.06em', color: '#1D4ED8', fontWeight: 700 }}>
{user?.role === 'super_admin' ? 'Super Admin' : user?.role === 'admin' ? 'Staff CPA' : 'Client'}
</span>
</div>
</div>
<button
className="artha-pill-btn artha-pill-dark"
style={{ padding: '7px 14px', fontSize: '12.5px' }}
onClick={logout}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>logout</span>
Logout
</button>
</div>
</div>
{/* Subnavigation Bar */}
<nav className="dash-subnav-group" style={{ marginTop: '12px', flexWrap: 'wrap' }}>
{!isAdmin ? (
<>
<Link
to="/dashboard"
className={`dash-subnav-link ${pathname === '/dashboard' ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>dashboard</span>
Client Overview
</Link>
<Link
to="/upload-personal"
className={`dash-subnav-link ${pathname === '/upload-personal' ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>person</span>
Personal Documents (1040/W-2)
</Link>
<Link
to="/upload-business"
className={`dash-subnav-link ${pathname === '/upload-business' ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>business</span>
Business Ledgers (1120-S/P&amp;L)
</Link>
<Link
to="/profile"
className={`dash-subnav-link ${pathname === '/profile' ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>manage_accounts</span>
Profile &amp; Security
</Link>
</>
) : (
<>
<Link
to="/admin-dashboard"
className={`dash-subnav-link ${pathname.startsWith('/admin') ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>group</span>
Client Management &amp; Reviews
</Link>
<Link
to="/profile"
className={`dash-subnav-link ${pathname === '/profile' ? 'active' : ''}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>manage_accounts</span>
Staff Account
</Link>
</>
)}
</nav>
</div>
</header>
<main className={`${(user?.role === 'admin' || user?.role === 'super_admin') ? 'page-main-wide' : 'page-main'} page-enter`}>
<Outlet />
{/* Main Content Area */}
<main
style={{
flex: 1,
width: 'min(1400px, 94%)',
margin: '16px auto 48px'
}}
>
<div className="page-enter" key={location.pathname}>
<Outlet />
</div>
</main>
{/* Portal Executive Footer */}
<footer
style={{
borderTop: '1px solid rgba(10, 37, 64, 0.08)',
background: 'rgba(246, 249, 252, 0.8)',
padding: '20px clamp(16px, 4vw, 36px)',
marginTop: 'auto'
}}
>
<div
style={{
maxWidth: '1400px',
margin: '0 auto',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
flexWrap: 'wrap',
gap: '12px',
fontSize: '12.5px',
color: '#425466'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#047857' }}>lock</span>
<span>ABC CPA &bull; Secure Client Document Vault &bull; SOC-2 Aligned</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
<span>AICPA Member Firm</span>
<span>&bull;</span>
<span>McKinney &amp; Frisco, Texas</span>
</div>
</div>
</footer>
</div>
);
}
+5 -2
View File
@@ -1,13 +1,16 @@
import { Outlet } from 'react-router-dom';
import { Outlet, useLocation } from 'react-router-dom';
import Navbar from '../components/Navbar';
import Footer from '../components/Footer';
export default function MarketingLayout() {
const location = useLocation();
return (
<>
<Navbar />
<main>
<Outlet />
<div className="page-enter" key={location.pathname}>
<Outlet />
</div>
</main>
<Footer />
</>
+12 -2
View File
@@ -1,2 +1,12 @@
import { Outlet } from 'react-router-dom';
export default function PublicLayout() { return <Outlet />; }
import { Outlet, useLocation } from 'react-router-dom';
export default function PublicLayout() {
const location = useLocation();
return (
<main>
<div className="page-enter" key={location.pathname}>
<Outlet />
</div>
</main>
);
}
+2
View File
@@ -3,6 +3,7 @@ import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
import { initScrollReveal } from './utils/scrollReveal.js'
import { initMotion } from './utils/motion.js'
createRoot(document.getElementById('root')).render(
<StrictMode>
@@ -11,3 +12,4 @@ createRoot(document.getElementById('root')).render(
)
initScrollReveal()
initMotion()
+190 -63
View File
@@ -1,77 +1,204 @@
import { useNavigate } from 'react-router-dom';
export default function AboutUs() {
const navigate = useNavigate();
const milestones = [
{
year: '1998',
title: 'Foundations of Accounting & Statutory Compliance',
image: '/images/about-us-block-1.webp',
desc: 'Our journey began as a Chartered Accountant practice built on strict principles of accounting integrity, statutory accuracy, and enduring client partnerships. Over two decades, we served hundreds of businesses through complex regulatory evolutions.'
},
{
year: '2018',
title: 'Institutional Scale & Cloud Modernization',
image: '/images/services-2.webp',
desc: 'Responding to rising demand for structured financial outsourcing, we expanded operations into Pune and Mumbai. We transitioned traditional accounting into scalable, cloud-first workflows leveraging QuickBooks, Xero, and structured standard operating procedures.'
},
{
year: '2023',
title: 'Dual US-India Cross-Border Expansion',
image: '/images/young-business-people-using-computer-in-office.webp',
desc: 'To support global founders, expat families, and multinational firms, we established our US presence in McKinney and Frisco, Texas. We engineered specialized advisory for international tax treaties, FBAR/FATCA filings, and dual-entity tax minimization.'
},
{
year: 'Today',
title: 'AI-Enabled Precision & Executive Advisory',
image: '/images/services-block-3.webp',
desc: 'We combine seasoned CPA and Chartered Accountant leadership with proprietary AI statement ingestion, transforming raw bank statements into reconciled, audit-ready financial statements in minutes while delivering strategic fractional CFO advisory.'
}
];
const credentials = [
{ title: '27+ Years of Practice', desc: 'Over a quarter-century of proven financial, audit, and tax compliance leadership.' },
{ title: 'Dual US & India Hubs', desc: 'Seamless cross-border coordination across Texas (US) and Pune (India).' },
{ title: 'AICPA Member Firm', desc: 'Adhering to the highest professional, ethical, and accounting industry benchmarks.' },
{ title: 'SOC-2 Aligned Security', desc: '256-bit encrypted document portals protecting your sensitive financial data.' }
];
return (
<>
<div className="page-hero" style={{ '--hero-img': 'url("/images/About-us-background-image.webp")' }}>
<div className="page-hero-inner">
<span className="eyebrow">About BookKeepPro</span>
<h1>Our people are passionate about what we do</h1>
<p>Twenty-seven years of accounting, compliance and long-term client relationships.</p>
<div className="artha-about-page" style={{ background: 'var(--paper, #F6F9FC)', minHeight: '100vh', paddingBottom: '50px' }}>
{/* Header Banner */}
<section style={{ padding: '36px 0 24px', borderBottom: '1px solid rgba(10, 37, 64,0.07)' }}>
<div style={{ width: 'min(1280px, 94%)', margin: '0 auto', textAlign: 'center' }}>
<div className="artha-eyebrow-pill">
<span className="dot"></span>
OUR FIRM &amp; HERITAGE
</div>
<h1 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(23px, 2.3vw, 32px)', color: '#0A2540', fontWeight: 600, margin: '10px 0' }}>
Rooted in Precision. Built for Global Scale.
</h1>
<p style={{ maxWidth: '580px', margin: '0 auto', color: '#425466', fontSize: '13.5px', lineHeight: 1.6 }}>
For over 27 years, we have guided founders, growing businesses, and international families through complex tax codes, compliance mandates, and financial transformations.
</p>
</div>
</section>
{/* Main Heritage Card with Real Image */}
<div className="reveal" style={{ width: 'min(1280px, 94%)', margin: '40px auto 0' }}>
<div
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '20px',
padding: 'clamp(24px, 2.8vw, 38px)',
boxShadow: '0 4px 20px -2px rgba(10, 37, 64, 0.04)',
display: 'grid',
gridTemplateColumns: '1.1fr 0.9fr',
gap: '36px',
alignItems: 'center'
}}
>
<div>
<span className="artha-service-pill-tag">WHO WE ARE</span>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(19px, 2vw, 25px)', color: '#0A2540', fontWeight: 600, margin: '8px 0 12px' }}>
Your proactive partner in financial strategy
</h2>
<p style={{ color: '#425466', fontSize: '13.5px', lineHeight: 1.6, marginBottom: '12px' }}>
Accounting shouldn&apos;t be an afterthought relegated to tax season. At ABC CPA &amp; Advisory, we act as an extension of your leadership team &mdash; analyzing entity efficiency, identifying immediate deductions, and untangling multi-jurisdiction liabilities before deals close.
</p>
<p style={{ color: '#425466', fontSize: '13.5px', lineHeight: 1.6, marginBottom: '20px' }}>
With dedicated offices in Texas and India, our dual operating model delivers round-the-clock responsiveness, strict quality controls, and unmatched cross-border tax expertise.
</p>
<button className="artha-pill-btn artha-pill-primary" onClick={() => navigate('/contact')}>
Schedule a Consultation
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>
arrow_forward
</span>
</button>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
<div style={{ position: 'relative', width: '100%', height: '220px', borderRadius: '16px', overflow: 'hidden', boxShadow: '0 6px 20px rgba(10, 37, 64,0.08)' }}>
<img
src="/images/home-about.webp"
alt="Our Accounting Practice Team"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
loading="lazy"
width="800"
height="533"
/>
<div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(135deg, rgba(10, 37, 64, 0.12) 0%, rgba(10, 37, 64, 0.22) 100%)', pointerEvents: 'none' }} />
</div>
<div style={{ background: '#0A2540', borderRadius: '16px', padding: '18px 18px', color: '#FFFFFF' }}>
<span style={{ fontFamily: 'var(--font-mono)', fontSize: '10.5px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#3B82F6' }}>
CORE BELIEF
</span>
<blockquote style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '15px', fontStyle: 'italic', lineHeight: 1.4, margin: '6px 0 8px', color: '#FFFFFF' }}>
&ldquo;The true measure of an accounting firm is not how fast they file forms, but how much value and peace of mind they generate before the filing occurs.&rdquo;
</blockquote>
<p style={{ fontSize: '11.5px', color: 'rgba(255,255,255,0.7)', margin: 0 }}>
&mdash; ABC CPA &amp; Advisory Leadership Team
</p>
</div>
</div>
</div>
</div>
<div className="about-wrapper">
<div className="about-block reveal">
<div className="about-text">
<span className="eyebrow">1998 — where it started</span>
<h2 style={{ margin: '14px 0' }}>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 and Mumbai —
transitioning from a traditional CA practice into a scalable
financial services organization.
</p>
{/* Timeline Section with Visual Milestone Cards */}
<section className="reveal" style={{ width: 'min(1280px, 94%)', margin: '48px auto 0' }}>
<div style={{ textAlign: 'center', marginBottom: '32px' }}>
<div className="artha-eyebrow-pill">
<span className="dot"></span>
THE JOURNEY
</div>
<img className="about-img" src="/images/about-us-block-1.webp" alt="BookKeepPro Team" />
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(20px, 2.1vw, 27px)', color: '#0A2540', fontWeight: 600 }}>
Twenty-Seven Years in the Making
</h2>
</div>
<div className="about-block reverse reveal">
<div className="about-text">
<span className="eyebrow">2023 — going global</span>
<h2 style={{ margin: '14px 0' }}>About BookKeepPro</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</b> (India)<br />
<b>Bookkeeping Business Solutions LLC</b> (USA)
</p>
<br />
<p>
Today, BookKeepPro serves global businesses, startups and
enterprises with scalable, compliant bookkeeping and financial
operations support.
</p>
</div>
<img className="about-img" src="/images/young-business-people-using-computer-in-office.webp" alt="About BookKeepPro" width="800" height="533" loading="lazy" />
</div>
</div>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: '26px' }}>
{milestones.map((m, idx) => (
<div
key={idx}
className={`reveal-delay-${(idx % 4) + 1}`}
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '22px',
padding: '24px',
boxShadow: '0 2px 14px -2px rgba(10, 37, 64, 0.04)',
display: 'flex',
flexDirection: 'column',
transition: 'transform 0.25s ease, box-shadow 0.25s ease'
}}
>
<div style={{ width: '100%', height: '160px', borderRadius: '14px', overflow: 'hidden', marginBottom: '16px' }}>
<img
src={m.image}
alt={m.title}
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
loading="lazy"
width="600"
height="400"
/>
</div>
<section className="section reveal" style={{ marginTop: 0, marginBottom: '90px' }}>
<div className="section-head" style={{ textAlign: 'center', margin: '0 auto 32px', maxWidth: '640px' }}>
<span className="eyebrow" style={{ justifyContent: 'center' }}>Where we stand today</span>
<h2>Who we are today</h2>
</div>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', justifyContent: 'center' }}>
{[
'27+ years of accounting & compliance expertise',
'Operations across India and the USA',
'Secure, process-driven financial workflows',
'Strong confidentiality & data protection practices',
].map((item) => (
<p key={item} className="badge badge-blue" style={{ padding: '12px 22px', fontSize: '13.5px', fontWeight: 500, letterSpacing: 0 }}>
{item}
</p>
<div
style={{
fontFamily: 'var(--font-mono)',
fontSize: '22px',
fontWeight: 600,
color: '#1D4ED8',
marginBottom: '6px'
}}
>
{m.year}
</div>
<h3 style={{ fontSize: '16px', fontWeight: 600, color: '#0A2540', marginBottom: '10px', lineHeight: 1.3 }}>
{m.title}
</h3>
<p style={{ fontSize: '13.5px', color: '#425466', lineHeight: 1.6, margin: 0 }}>
{m.desc}
</p>
</div>
))}
</div>
</section>
</>
{/* Trust Pillars */}
<section style={{ width: 'min(1280px, 94%)', margin: '48px auto 0' }}>
<div style={{ background: '#F6F9FC', border: '1px solid rgba(10, 37, 64, 0.08)', borderRadius: '20px', padding: '30px 24px' }}>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: '28px' }}>
{credentials.map((c, i) => (
<div key={i} style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8', fontSize: '28px' }}>
verified_user
</span>
<h4 style={{ fontSize: '16px', fontWeight: 600, color: '#0A2540', margin: '4px 0 0 0' }}>
{c.title}
</h4>
<p style={{ fontSize: '13px', color: '#425466', margin: 0, lineHeight: 1.5 }}>
{c.desc}
</p>
</div>
))}
</div>
</div>
</section>
</div>
);
}
+665 -206
View File
@@ -4,23 +4,72 @@ import { useNavigate } from 'react-router-dom';
import DOMPurify from 'dompurify';
import { useToast } from '../context/ToastContext';
import ConfirmModal from '../components/ConfirmModal';
import CountUp from '../components/CountUp';
export default function AdminDashboard() {
const { authFetch } = useAuth();
const { authFetch, user: currentUser } = useAuth();
const isSuperAdmin = currentUser?.role === 'super_admin';
const { showToast } = useToast();
const [confirmConfig, setConfirmConfig] = useState({
isOpen: false, title: "", message: "", confirmText: "OK", isDestructive: false, onConfirm: () => {}
});
const [stats, setStats] = useState({ total_users: 0, pending_personal: 0, pending_business: 0, admins: 0 });
const [bookmarks, setBookmarks] = useState([]);
const [users, setUsers] = useState([]);
const [search, setSearch] = useState("");
const [userFilter, setUserFilter] = useState("all");
const [userSort, setUserSort] = useState("newest");
const [filterYear, setFilterYear] = useState(new Date().getFullYear().toString());
const [adminAssignmentFilter, setAdminAssignmentFilter] = useState("all");
const [staffList, setStaffList] = useState([]);
const [tab, setTab] = useState("users");
const [loading, setLoading] = useState(true);
const navigate = useNavigate();
// --- Staff List Fetch ---
const fetchStaff = useCallback(async () => {
try {
const res = await authFetch('/api/auth/admin/staff');
if (res.ok) {
setStaffList(await res.json());
}
} catch (err) {
console.error("Failed to load staff list", err);
}
}, [authFetch]);
useEffect(() => {
fetchStaff();
}, [fetchStaff]);
const handleAssignAdmin = async (userId, newAdminId) => {
try {
const res = await authFetch(`/api/auth/admin/users/${userId}/assign-admin`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ admin_id: newAdminId ? parseInt(newAdminId, 10) : null }),
});
if (res.ok) {
const data = await res.json();
showToast(data.message || "Admin assigned", "success");
setUsers(prev => prev.map(u => u.id === userId ? {
...u,
assigned_admin_id: data.assigned_admin_id,
assigned_admin_name: data.assigned_admin_name,
assigned_admin_email: data.assigned_admin_email,
} : u));
fetchStaff();
} else {
const err = await res.json();
showToast(err.detail || "Failed to assign admin", "error");
}
} catch (err) {
console.error(err);
showToast("Network error while assigning admin", "error");
}
};
// --- Template Management State ---
const [tplCategory, setTplCategory] = useState("personal");
const [tplYear, setTplYear] = useState(new Date().getFullYear().toString());
@@ -29,7 +78,7 @@ export default function AdminDashboard() {
const [tplFile, setTplFile] = useState(null);
const [tplLoading, setTplLoading] = useState(false);
const [digestHtml, setDigestHtml] = useState(null);
const [digestHtml, setDigestHtml] = useState(null);
const [digestLoading, setDigestLoading] = useState(false);
const fetchDigest = useCallback(async () => {
@@ -39,21 +88,46 @@ export default function AdminDashboard() {
if (res.ok) {
const data = await res.json();
setDigestHtml(data.digest);
showToast("AI Daily briefing generated successfully!", "success");
} else {
const err = await res.json().catch(() => ({}));
showToast(err.detail || "Failed to generate daily digest", "error");
}
} catch (err) { console.error(err); }
finally { setDigestLoading(false); }
}, [authFetch]);
} catch (err) {
console.error(err);
showToast("Network error while generating digest", "error");
} finally {
setDigestLoading(false);
}
}, [authFetch, showToast]);
const fetchAdminData = useCallback(async () => {
setLoading(true);
try {
const [usersRes, statsRes] = await Promise.all([
authFetch(`/api/auth/admin/users?tax_year=${filterYear}`),
authFetch(`/api/chatbot/admin-status?tax_year=${filterYear}`)
let usersUrl = `/api/auth/admin/users?tax_year=${filterYear}`;
if (isSuperAdmin) {
if (adminAssignmentFilter !== "all") {
usersUrl += `&assigned_admin_id=${adminAssignmentFilter}`;
}
} else {
if (adminAssignmentFilter === "unassigned") {
usersUrl += `&assigned_admin_id=unassigned`;
}
}
const [usersRes, statsRes, bookmarksRes] = await Promise.all([
authFetch(usersUrl),
authFetch(`/api/chatbot/admin-status?tax_year=${filterYear}`),
authFetch(`/api/upload/bookmarks`)
]);
let newUsersArray = users;
let adminsCount = stats.admins;
if (bookmarksRes.ok) {
const payload = await bookmarksRes.json();
setBookmarks(payload.bookmarks || []);
}
let newUsersArray = [];
let adminsCount = 0;
if (usersRes.ok) {
const payload = await usersRes.json();
@@ -71,8 +145,7 @@ export default function AdminDashboard() {
admins: statsData.admin_accounts
});
} else {
// Fallback to local computation if admin-status fails
const total = newUsersArray.length;
const total = newUsersArray.length;
const pendingP = newUsersArray.reduce((acc, u) => acc + (u.pending_personal || 0), 0);
const pendingB = newUsersArray.reduce((acc, u) => acc + (u.pending_business || 0), 0);
setStats({ total_users: total, pending_personal: pendingP, pending_business: pendingB, admins: adminsCount });
@@ -82,7 +155,7 @@ export default function AdminDashboard() {
} finally {
setLoading(false);
}
}, [authFetch, filterYear]);
}, [authFetch, filterYear, adminAssignmentFilter, isSuperAdmin]);
const loadTemplates = useCallback(async () => {
setTplLoading(true);
@@ -129,7 +202,8 @@ export default function AdminDashboard() {
if (res.ok) {
setTplName("");
setTplFile(null);
document.getElementById("tplFile").value = "";
const fileInput = document.getElementById("tplFile");
if (fileInput) fileInput.value = "";
loadTemplates();
showToast("Template uploaded successfully", "success");
} else {
@@ -170,7 +244,6 @@ export default function AdminDashboard() {
const yearOptions = [currentYear - 1, currentYear, currentYear + 1];
const filteredUsers = users.filter(u => {
// Stat Card Filters
if (userFilter === 'admin' && u.role !== 'admin' && u.role !== 'super_admin') return false;
if (userFilter === 'pending_personal' && !(u.pending_personal > 0)) return false;
if (userFilter === 'pending_business' && !(u.pending_business > 0)) return false;
@@ -186,230 +259,616 @@ export default function AdminDashboard() {
const bPending = (b.pending_personal || 0) + (b.pending_business || 0);
return bPending - aPending;
}
// Default fallback to ID if created_at is missing
if (userSort === 'newest') return (b.id || 0) - (a.id || 0);
if (userSort === 'oldest') return (a.id || 0) - (b.id || 0);
return 0;
});
return (
<div className="">
<div>
<ConfirmModal
{...confirmConfig}
onCancel={() => setConfirmConfig(prev => ({ ...prev, isOpen: false }))}
/>
<h1 style={{
margin: '0 0 32px 0',
fontSize: '42px',
fontFamily: 'var(--font-display)',
fontWeight: '800',
color: 'var(--ink)',
textAlign: 'center',
letterSpacing: '-0.5px'
}}>
Admin Dashboard <span style={{ color: 'var(--brass)', fontWeight: 600, fontSize: '32px' }}>{tab === 'templates' ? '| Templates' : ''}</span>
</h1>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: '24px', flexWrap: 'wrap', gap: '16px' }}>
{tab === 'users' && (
<div style={{ display: 'flex', gap: '12px', width: '100%', maxWidth: '500px', flexWrap: 'wrap' }}>
<div className="search-wrap" style={{ flex: 1, minWidth: '200px', position: 'relative' }}>
<span className="material-symbols-outlined search-icon" style={{position: 'absolute', left: '12px', top: '50%', transform: 'translateY(-50%)', color: 'var(--muted)', fontSize: '20px'}}>search</span>
<input
type="text"
className="search-input"
style={{ width: '100%', padding: '10px 12px 10px 40px', border: '1px solid var(--border)', borderRadius: 'var(--radius-full)', outline: 'none' }}
placeholder="Search by name or email"
{/* ================= EXECUTIVE ADMIN HERO ================= */}
<section className="dash-hero dash-rise" style={{ '--i': 0, marginBottom: '24px' }}>
<div className="dash-hero-content">
<div className="dash-hero-eyebrow">
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>verified_user</span>
PARTNER &amp; STAFF PRACTICE CONSOLE
</div>
<h1 className="dash-hero-title">Client Management &amp; Tax Review</h1>
<p className="dash-hero-sub">
Monitor client document vaults, allocate staff CPAs, review AI statement ingestion, and finalize returns for TY {filterYear}.
</p>
<div className="dash-hero-badges" style={{ marginTop: '18px' }}>
<span className="dash-glass-pill">
<span className="material-symbols-outlined" style={{ fontSize: '15px', color: '#60A5FA' }}>shield</span>
Executive Control
</span>
<span className="dash-glass-pill">
<span className="material-symbols-outlined" style={{ fontSize: '15px', color: '#34D399' }}>verified</span>
CPA Workpapers
</span>
<span className="dash-glass-pill">
<span className="material-symbols-outlined" style={{ fontSize: '15px', color: '#C4B5FD' }}>auto_awesome</span>
AI Ingestion Active
</span>
</div>
</div>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center', flexWrap: 'wrap', zIndex: 1 }}>
{/* Tax Year Glass Select */}
<select
value={filterYear}
onChange={(e) => setFilterYear(e.target.value)}
className="dash-glass-select dash-focusable"
aria-label="Filter Tax Year"
>
{yearOptions.map(y => (
<option key={y} value={y}>Tax Year {y}</option>
))}
</select>
{/* AI Daily Briefing Button */}
<button
className="dash-hero-ai-btn dash-focusable"
onClick={fetchDigest}
disabled={digestLoading}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>auto_awesome</span>
{digestLoading ? 'Analyzing...' : 'AI Daily Briefing'}
</button>
</div>
</section>
{/* Daily Digest Drawer / Box */}
{digestHtml && (
<section className="dash-card dash-digest-drawer" style={{ marginBottom: '24px' }}>
<div className="dash-digest-header">
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<div className="dash-chip dash-chip--violet" style={{ width: '32px', height: '32px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>auto_awesome</span>
</div>
<div>
<strong style={{ fontSize: '14px', color: '#0A2540' }}>AI Executive Daily Briefing</strong>
<span style={{ fontSize: '12px', color: '#6D28D9', marginLeft: '8px', fontWeight: 600 }}>TY {filterYear} Digest</span>
</div>
</div>
<button
className="dash-table-action-btn dash-focusable"
onClick={() => setDigestHtml(null)}
title="Dismiss Briefing"
aria-label="Dismiss Briefing"
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>close</span>
</button>
</div>
<div
style={{ padding: '20px 24px', fontSize: '13.5px', color: '#0A2540', lineHeight: 1.7 }}
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(digestHtml) }}
/>
</section>
)}
{/* ================= EXECUTIVE KPI METRICS BAR ================= */}
<div className="dash-kpis dash-rise" style={{ '--i': 1, marginTop: 0, marginBottom: '24px' }}>
{/* Total Clients */}
<div
className={`dash-card dash-kpi-card dash-kpi-card--blue ${userFilter === 'all' ? 'dash-kpi-card--active' : ''}`}
style={{ cursor: 'pointer' }}
onClick={() => setUserFilter('all')}
>
<div className="dash-kpi-bar dash-kpi-bar--blue" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Total Clients</span>
<div className="dash-chip dash-chip--blue">
<span className="material-symbols-outlined">group</span>
</div>
</div>
<div className="dash-kpi-value">
<CountUp value={stats.total_users} />
</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', fontSize: '12px' }}>
<span style={{ color: userFilter === 'all' ? '#1D4ED8' : '#425466', fontWeight: 600 }}>
{userFilter === 'all' ? 'Active Filter: All' : 'Click to filter all'}
</span>
</div>
</div>
{/* Pending Personal */}
<div
className={`dash-card dash-kpi-card dash-kpi-card--amber ${userFilter === 'pending_personal' ? 'dash-kpi-card--active' : ''}`}
style={{ cursor: 'pointer' }}
onClick={() => setUserFilter('pending_personal')}
>
<div className="dash-kpi-bar dash-kpi-bar--amber" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Pending Personal</span>
<div className="dash-chip dash-chip--amber">
<span className="material-symbols-outlined">person_search</span>
</div>
</div>
<div className="dash-kpi-value" style={{ color: '#92600A' }}>
<CountUp value={stats.pending_personal} />
{stats.pending_personal > 0 && <span className="dash-pulse-dot dash-pulse-dot--amber" />}
</div>
<div style={{ fontSize: '12px', color: '#425466' }}>
Awaiting CPA Form Review
</div>
</div>
{/* Pending Business */}
<div
className={`dash-card dash-kpi-card dash-kpi-card--teal ${userFilter === 'pending_business' ? 'dash-kpi-card--active' : ''}`}
style={{ cursor: 'pointer' }}
onClick={() => setUserFilter('pending_business')}
>
<div className="dash-kpi-bar dash-kpi-bar--teal" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Pending Business</span>
<div className="dash-chip dash-chip--teal">
<span className="material-symbols-outlined">business_center</span>
</div>
</div>
<div className="dash-kpi-value" style={{ color: '#0D9488' }}>
<CountUp value={stats.pending_business} />
{stats.pending_business > 0 && <span className="dash-pulse-dot dash-pulse-dot--teal" />}
</div>
<div style={{ fontSize: '12px', color: '#425466' }}>
Bank Statements &amp; Ledgers
</div>
</div>
{/* Staff Admins */}
<div
className={`dash-card dash-kpi-card dash-kpi-card--slate ${userFilter === 'admin' ? 'dash-kpi-card--active' : ''}`}
style={{ cursor: 'pointer' }}
onClick={() => setUserFilter('admin')}
>
<div className="dash-kpi-bar dash-kpi-bar--slate" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Staff Admins</span>
<div className="dash-chip dash-chip--slate">
<span className="material-symbols-outlined">admin_panel_settings</span>
</div>
</div>
<div className="dash-kpi-value" style={{ color: '#425466' }}>
<CountUp value={stats.admins} />
</div>
<div style={{ fontSize: '12px', color: '#425466' }}>
Active Advisory Accounts
</div>
</div>
</div>
{/* ================= TAB CONTROLS ================= */}
<div className="dash-rise" style={{ '--i': 2, marginBottom: '20px' }}>
<div className="dash-tabs" role="tablist">
<button
role="tab"
aria-selected={tab === 'users'}
className={`dash-tab-btn ${tab === 'users' ? 'active' : ''}`}
onClick={() => setTab('users')}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>group</span>
Client Dossiers ({filteredUsers.length})
</button>
<button
role="tab"
aria-selected={tab === 'bookmarks'}
className={`dash-tab-btn ${tab === 'bookmarks' ? 'active' : ''}`}
onClick={() => setTab('bookmarks')}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px', color: tab === 'bookmarks' ? '#B7791F' : 'inherit' }}>star</span>
Bookmarked Vault Documents ({bookmarks.length})
</button>
<button
role="tab"
aria-selected={tab === 'templates'}
className={`dash-tab-btn ${tab === 'templates' ? 'active' : ''}`}
onClick={() => setTab('templates')}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>description</span>
Statutory Templates &amp; Organizers
</button>
</div>
</div>
{/* ================= USERS OVERVIEW TAB ================= */}
{tab === 'users' && (
<div className="dash-tab-panel">
{/* Search & Filter Bar */}
<div className="dash-toolbar" style={{ marginBottom: '20px' }}>
{/* Search Input */}
<div className="dash-input-wrap">
<span className="material-symbols-outlined search-icon">search</span>
<input
type="text"
placeholder="Search clients by name, business, or email..."
value={search}
onChange={(e) => setSearch(e.target.value)}
className="dash-input dash-focusable"
/>
</div>
<select
className="select-input"
style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-full)', border: '1px solid var(--border)', outline: 'none', background: 'white' }}
{/* Admin Assignment Filter */}
{isSuperAdmin ? (
<select
value={adminAssignmentFilter}
onChange={(e) => setAdminAssignmentFilter(e.target.value)}
className="dash-select dash-focusable"
aria-label="Filter by assigned staff administrator"
>
<option value="all">👥 All Staff Administrators</option>
<option value="unassigned">⚠️ Unassigned Clients</option>
<optgroup label="Staff CPAs">
{staffList.map(s => (
<option key={s.id} value={s.id}>
{s.name || s.email} ({s.assigned_clients_count || 0} clients)
</option>
))}
</optgroup>
</select>
) : (
<select
value={adminAssignmentFilter}
onChange={(e) => setAdminAssignmentFilter(e.target.value)}
className="dash-select dash-focusable"
aria-label="Filter by assigned administrator"
>
<option value="all">My Assigned Clients</option>
<option value="unassigned">Unassigned Clients</option>
</select>
)}
{/* Sort Dropdown */}
<select
value={userSort}
onChange={(e) => setUserSort(e.target.value)}
className="dash-select dash-focusable"
aria-label="Sort clients"
>
<option value="newest">Newest First</option>
<option value="oldest">Oldest First</option>
<option value="highest_pending">Highest Pending</option>
<option value="asc">Name (A-Z)</option>
<option value="desc">Name (Z-A)</option>
</select>
<select
className="select-input"
style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-full)', border: '1px solid var(--border)', outline: 'none', background: 'white' }}
value={filterYear}
onChange={(e) => setFilterYear(e.target.value)}
>
<option value={currentYear - 1}>TY {currentYear - 1}</option>
<option value={currentYear}>TY {currentYear}</option>
<option value={currentYear + 1}>TY {currentYear + 1}</option>
<option value="highest_pending">Highest Pending Filings</option>
<option value="asc">Name (A &rarr; Z)</option>
<option value="desc">Name (Z &rarr; A)</option>
</select>
</div>
)}
</div>
<div className="tab-bar">
<button className={`tab-btn ${tab === 'users' ? 'active' : ''}`} onClick={() => setTab('users')}>
<span className="material-symbols-outlined">group</span> Users Overview
</button>
<button className={`tab-btn ${tab === 'templates' ? 'active' : ''}`} onClick={() => setTab('templates')}>
<span className="material-symbols-outlined">description</span> Templates
</button>
</div>
{/* Users Tab */}
{tab === 'users' && (
<>
{/* Daily Digest */}
<div className="card" style={{ marginBottom: '20px', background: 'var(--emerald-light)', border: '1px solid rgba(31,93,70,0.2)' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<span className="material-symbols-outlined" style={{ color: 'var(--emerald)', fontSize: '22px' }}>auto_awesome</span>
<div>
<div style={{ fontWeight: 700, fontSize: '14px', color: 'var(--navy)' }}>AI Daily Digest</div>
<div style={{ fontSize: '12px', color: 'var(--muted)' }}>Plain-English summary of today's activity</div>
</div>
</div>
<button className="btn btn-secondary btn-sm" onClick={fetchDigest} disabled={digestLoading} style={{ borderRadius: 'var(--radius-sm)' }}>
{digestLoading ? 'Generating…' : '✨ Generate Digest'}
</button>
</div>
{digestHtml && (
<div style={{ marginTop: '12px', paddingTop: '12px', borderTop: '1px solid rgba(31,93,70,0.2)', fontSize: '13px', color: 'var(--navy)', lineHeight: '1.7' }}
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(digestHtml) }} />
)}
</div>
{/* Stats Bar */}
<div className="admin-stats">
<div className={`stat-card accent-blue ${userFilter === 'all' ? 'active-filter' : ''}`} onClick={() => setUserFilter('all')} style={{ cursor: 'pointer', border: userFilter === 'all' ? '2px solid var(--blue)' : 'none' }}>
<div className="stat-icon"><span className="material-symbols-outlined">group</span></div>
<div className="stat-value">{stats.total_users}</div>
<div className="stat-label">Total Users</div>
</div>
<div className={`stat-card accent-green ${userFilter === 'admin' ? 'active-filter' : ''}`} onClick={() => setUserFilter('admin')} style={{ cursor: 'pointer', border: userFilter === 'admin' ? '2px solid var(--green)' : 'none' }}>
<div className="stat-icon"><span className="material-symbols-outlined">security</span></div>
<div className="stat-value">{stats.admins}</div>
<div className="stat-label">Admin Accounts</div>
</div>
<div className={`stat-card accent-orange ${userFilter === 'pending_personal' ? 'active-filter' : ''}`} onClick={() => setUserFilter('pending_personal')} style={{ cursor: 'pointer', border: userFilter === 'pending_personal' ? '2px solid var(--orange)' : 'none' }}>
<div className="stat-icon"><span className="material-symbols-outlined">description</span></div>
<div className="stat-value">{stats.pending_personal}</div>
<div className="stat-label">Pending Personal</div>
</div>
<div className={`stat-card accent-orange ${userFilter === 'pending_business' ? 'active-filter' : ''}`} onClick={() => setUserFilter('pending_business')} style={{ cursor: 'pointer', border: userFilter === 'pending_business' ? '2px solid var(--orange)' : 'none' }}>
<div className="stat-icon"><span className="material-symbols-outlined">business</span></div>
<div className="stat-value">{stats.pending_business}</div>
<div className="stat-label">Pending Business</div>
</div>
</div>
{/* User Grid */}
<div className="users-grid">
{loading ? (
<div className="empty-state" style={{ gridColumn: '1/-1' }}>
<div className="empty-icon"><span className="material-symbols-outlined">pending</span></div>
<div className="empty-title">Loading users...</div>
</div>
) : filteredUsers.length === 0 ? (
<div className="empty-state" style={{ gridColumn: '1/-1' }}>
<div className="empty-title">No users found</div>
</div>
) : (
filteredUsers.map(u => (
<div key={u.id} className="user-card stagger fade-up" onClick={() => navigate(`/admin-user-detail?user_id=${u.id}`)}>
<div className="user-top">
<div className="user-avatar">{(u.name || "U").charAt(0).toUpperCase()}</div>
<div className="user-info">
<div className="u-name">{u.name || "—"}</div>
<div className="u-email">{u.email || "—"}</div>
{/* Client Cards Grid */}
{loading ? (
<div className="dash-clients-grid">
{[1, 2, 3, 4, 5, 6].map(n => (
<div key={n} className="dash-card dash-client-card" style={{ height: '180px' }}>
<div style={{ display: 'flex', gap: '12px' }}>
<div className="dash-skeleton" style={{ width: '44px', height: '44px', borderRadius: '50%' }} />
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: '8px' }}>
<div className="dash-skeleton" style={{ height: '16px', width: '60%' }} />
<div className="dash-skeleton" style={{ height: '13px', width: '80%' }} />
</div>
</div>
<div className="user-bottom">
<span className={`badge role-badge ${u.role === 'super_admin' ? 'badge-red' : u.role === 'admin' ? 'badge-orange' : 'badge-blue'}`}>
{u.role}
</span>
{u.pending_personal > 0 && (
<span className="badge badge-orange pulse" style={{ cursor: 'default' }}>
<span className="material-symbols-outlined" style={{fontSize:'12px', verticalAlign:'middle'}}>description</span>
{' '}{u.pending_personal} personal
</span>
)}
{u.pending_business > 0 && (
<span className="badge badge-orange pulse" style={{ cursor: 'default' }}>
<span className="material-symbols-outlined" style={{fontSize:'12px', verticalAlign:'middle'}}>business</span>
{' '}{u.pending_business} business
</span>
)}
</div>
<div className="click-layer"></div>
<div className="dash-skeleton" style={{ height: '32px', width: '100%', borderRadius: '8px' }} />
</div>
))
)}
</div>
</>
))}
</div>
) : filteredUsers.length === 0 ? (
<div className="dash-card dash-empty-state">
<div className="dash-empty-icon">
<span className="material-symbols-outlined" style={{ fontSize: '28px' }}>search_off</span>
</div>
<h4 style={{ fontSize: '16px', color: '#0A2540', margin: 0 }}>No matching clients found</h4>
<p style={{ fontSize: '13px', color: '#425466', maxWidth: '440px', margin: 0 }}>
Try adjusting your search criteria, tax year, or staff filter.
</p>
</div>
) : (
<div className="dash-clients-grid">
{filteredUsers.map((u, idx) => {
const avatarVariant = (u.id || 0) % 4;
const avatarClasses = [
'dash-avatar--brand',
'dash-avatar--success',
'dash-avatar--ai',
'dash-avatar--warm'
];
const avatarClass = avatarClasses[avatarVariant];
return (
<div
key={u.id}
className="dash-card dash-client-card dash-rise"
style={{ '--i': idx, cursor: 'pointer' }}
onClick={() => navigate(`/admin-user-detail?user_id=${u.id}`)}
>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: '14px' }}>
<div className={`dash-avatar ${avatarClass}`}>
{(u.name || "U").charAt(0).toUpperCase()}
</div>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontWeight: 600, fontSize: '15px', color: '#0A2540', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
{u.name || "Unnamed Client"}
</div>
<div style={{ fontSize: '13px', color: '#425466', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', marginTop: '2px' }}>
{u.email}
</div>
<div style={{ display: 'flex', gap: '6px', flexWrap: 'wrap', marginTop: '10px' }}>
<span className={`dash-pill ${u.role === 'super_admin' ? 'dash-pill--rejected' : u.role === 'admin' ? 'dash-pill--pending' : 'dash-pill--approved'}`}>
{u.role === 'super_admin' ? 'Super Admin' : u.role === 'admin' ? 'Staff CPA' : 'Client'}
</span>
{u.pending_personal > 0 && (
<span className="dash-pill dash-pill--pending">
{u.pending_personal} Personal
</span>
)}
{u.pending_business > 0 && (
<span className="dash-pill" style={{ background: 'rgba(20, 184, 166, 0.12)', color: '#0D9488', border: '1px solid rgba(20, 184, 166, 0.28)' }}>
{u.pending_business} Business
</span>
)}
</div>
</div>
</div>
{/* Card Bottom: Assigned CPA + Action Link */}
<div className="dash-client-footer">
{isSuperAdmin ? (
<div className="dash-cpa-assign" onClick={(e) => e.stopPropagation()}>
<span
className="material-symbols-outlined dash-cpa-icon"
style={{ color: u.assigned_admin_name ? '#047857' : '#B7791F' }}
title={u.assigned_admin_name ? `Assigned to ${u.assigned_admin_name}` : 'Unassigned'}
>
{u.assigned_admin_name ? 'assignment_ind' : 'person_alert'}
</span>
<select
value={u.assigned_admin_id || ""}
onChange={(e) => {
e.stopPropagation();
handleAssignAdmin(u.id, e.target.value);
}}
className="dash-cpa-select dash-focusable"
aria-label={`Assign CPA for ${u.name || u.email}`}
>
<option value="">Unassigned</option>
{staffList.map(s => (
<option key={s.id} value={s.id}>
{s.name || s.email}
</option>
))}
</select>
</div>
) : (
<div className="dash-cpa-badge">
<span
className="material-symbols-outlined dash-cpa-icon"
style={{ color: u.assigned_admin_name ? '#047857' : '#B7791F' }}
>
{u.assigned_admin_name ? 'assignment_ind' : 'person_alert'}
</span>
<span
className="dash-cpa-label"
style={{ color: u.assigned_admin_name ? '#0A2540' : '#92600A' }}
>
{u.assigned_admin_name || 'Unassigned'}
</span>
</div>
)}
<span className="dash-open-btn">
<span>Open</span>
<span className="material-symbols-outlined dash-open-arrow">arrow_forward</span>
</span>
</div>
</div>
);
})}
</div>
)}
</div>
)}
{/* Templates Tab */}
{tab === 'templates' && (
<div className="card" style={{ marginTop: '20px' }}>
<h3>Manage Required Templates</h3>
<p className="text-sm" style={{ color: 'var(--muted)', marginBottom: '20px' }}>Upload new templates for users to download.</p>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '20px' }}>
<select className="select-input" style={{ width: 'auto' }} value={tplCategory} onChange={(e) => setTplCategory(e.target.value)}>
<option value="personal">Personal</option>
<option value="business">Business</option>
</select>
<select className="select-input" style={{ width: 'auto' }} value={tplYear} onChange={(e) => setTplYear(e.target.value)}>
{yearOptions.map(y => <option key={y} value={y}>{y}</option>)}
</select>
</div>
{/* ================= BOOKMARKS TAB ================= */}
{tab === 'bookmarks' && (
<div className="dash-tab-panel">
<div className="dash-card" style={{ padding: '24px 26px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px', flexWrap: 'wrap', marginBottom: '20px' }}>
<div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '18px', color: '#0A2540', margin: '0 0 4px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ color: '#B7791F', fontSize: '22px' }}>star</span>
Bookmarked Vault Documents
</h3>
<span style={{ fontSize: '13px', color: '#425466' }}>
Starred items across all active client returns
</span>
</div>
<div style={{ fontSize: '12px', color: '#425466', fontFamily: 'var(--font-mono, monospace)', fontWeight: 600 }}>
{bookmarks.length} starred document{bookmarks.length === 1 ? '' : 's'}
</div>
</div>
<div style={{ marginTop: '20px', minHeight: '150px' }}>
{tplLoading ? (
<div className="text-muted">Loading templates...</div>
) : templates.length === 0 ? (
<p className="text-muted">No templates found for {tplCategory} {tplYear}.</p>
) : (
templates.map(t => (
<div key={t.id} className="card-flat" style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '8px' }}>
<div>
<h5 style={{ marginBottom: '4px' }}>{t.name}</h5>
{t.download ? (
<a href={t.download} target="_blank" rel="noreferrer" className="text-sm" style={{ color: 'var(--blue)' }}>View File</a>
) : (
<span className="text-sm text-muted">No file</span>
)}
</div>
<button className="btn btn-danger btn-sm" onClick={() => deleteTemplate(t.id)}>Delete</button>
{bookmarks.length === 0 ? (
<div className="dash-empty-state">
<div className="dash-empty-icon" style={{ color: '#B7791F', background: '#FFF8E6' }}>
<span className="material-symbols-outlined" style={{ fontSize: '28px' }}>star_border</span>
</div>
))
<h4 style={{ fontSize: '16px', color: '#0A2540', margin: 0 }}>No Documents Starred</h4>
<p style={{ fontSize: '13px', color: '#425466', maxWidth: '440px', margin: 0 }}>
Bookmark critical schedules in any client dossier for rapid access.
</p>
</div>
) : (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: '16px' }}>
{bookmarks.map((b) => (
<div
key={`${b.type}-${b.id}`}
className="dash-row-card"
style={{ cursor: 'pointer', flexDirection: 'column', alignItems: 'stretch', gap: '12px' }}
onClick={() => navigate(`/admin-user-detail?user_id=${b.user_id}`)}
>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: '10px' }}>
<div className="dash-chip dash-chip--blue" style={{ width: '32px', height: '32px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>description</span>
</div>
<span style={{ fontWeight: 600, fontSize: '13.5px', color: '#0A2540', wordBreak: 'break-word', flex: 1 }}>
{b.filename || b.doc_name}
</span>
</div>
<div style={{ fontSize: '12px', color: '#425466' }}>
Client: <strong style={{ color: '#0A2540' }}>{b.user_name}</strong>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', borderTop: '1px solid #E2E8F0', paddingTop: '10px', marginTop: '4px' }}>
<span className="dash-pill dash-pill--info">{b.type}</span>
<span className="dash-open-btn">
<span>Open</span>
<span className="material-symbols-outlined dash-open-arrow">arrow_forward</span>
</span>
</div>
</div>
))}
</div>
)}
</div>
</div>
)}
<hr style={{ margin: '24px 0', borderTop: '1px solid var(--border)' }} />
{/* ================= TEMPLATES TAB ================= */}
{tab === 'templates' && (
<div className="dash-tab-panel">
<div className="dash-card" style={{ padding: '24px 26px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px', flexWrap: 'wrap', marginBottom: '24px' }}>
<div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '18px', color: '#0A2540', margin: '0 0 4px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8', fontSize: '22px' }}>description</span>
Official Statutory Templates &amp; Worksheets
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: 0 }}>
Upload blank organizers, deduction checklists, and engagement PDFs available to all active clients.
</p>
</div>
<h4 style={{ marginBottom: '12px' }}>Upload New Template</h4>
<form onSubmit={handleTplUpload} style={{ display: 'flex', flexDirection: 'column', gap: '12px', maxWidth: '400px' }}>
<input
type="text"
className="input"
placeholder="Template Name (e.g. Individual Tax Organizer)"
value={tplName}
onChange={(e) => setTplName(e.target.value)}
required
/>
<input
type="file"
id="tplFile"
className="input"
accept=".pdf,.doc,.docx"
onChange={(e) => setTplFile(e.target.files[0])}
/>
<button type="submit" className="btn btn-primary" style={{borderRadius: 'var(--radius-sm)'}}>Upload Template</button>
</form>
<div style={{ display: 'flex', gap: '10px' }}>
<select
value={tplCategory}
onChange={(e) => setTplCategory(e.target.value)}
className="dash-select dash-focusable"
style={{ height: '38px', fontSize: '12.5px' }}
>
<option value="personal">Personal Documents</option>
<option value="business">Business Documents</option>
</select>
<select
value={tplYear}
onChange={(e) => setTplYear(e.target.value)}
className="dash-select dash-focusable"
style={{ height: '38px', fontSize: '12.5px' }}
>
{yearOptions.map(y => (
<option key={y} value={y}>Tax Year {y}</option>
))}
</select>
</div>
</div>
{/* Active Templates List */}
<div style={{ marginBottom: '28px' }}>
<h5 style={{ fontSize: '12px', textTransform: 'uppercase', letterSpacing: '0.06em', color: '#425466', marginBottom: '12px', fontWeight: 600 }}>
Active Templates on File:
</h5>
{tplLoading ? (
<div style={{ padding: '24px', textAlign: 'center', color: '#425466' }}>
<div className="dash-skeleton" style={{ height: '48px', width: '100%', marginBottom: '8px' }} />
<div className="dash-skeleton" style={{ height: '48px', width: '100%' }} />
</div>
) : templates.length === 0 ? (
<div className="dash-empty-state" style={{ padding: '28px 16px', background: '#F6F9FC', borderRadius: '12px' }}>
<p style={{ fontSize: '13.5px', color: '#425466', margin: 0 }}>
No templates configured for {tplCategory} TY {tplYear}.
</p>
</div>
) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
{templates.map(t => (
<div
key={t.id}
className="dash-row-card"
>
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<div className="dash-chip dash-chip--blue" style={{ width: '36px', height: '36px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>picture_as_pdf</span>
</div>
<div>
<div style={{ fontWeight: 600, fontSize: '14px', color: '#0A2540' }}>{t.name}</div>
{t.download ? (
<a href={t.download} target="_blank" rel="noreferrer" style={{ fontSize: '12px', color: '#1D4ED8', textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: '4px', marginTop: '2px' }}>
<span>View Current PDF</span>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>open_in_new</span>
</a>
) : (
<span style={{ fontSize: '12px', color: '#425466' }}>No file attached</span>
)}
</div>
</div>
<button
className="dash-table-action-btn dash-focusable"
style={{ color: '#DC2626', borderColor: 'rgba(220,38,38,0.25)', borderRadius: '8px' }}
onClick={() => deleteTemplate(t.id)}
title="Delete Template"
aria-label={`Delete ${t.name}`}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>delete</span>
</button>
</div>
))}
</div>
)}
</div>
{/* Upload New Template Form */}
<div style={{ background: '#F6F9FC', border: '1px solid #E2E8F0', borderRadius: '16px', padding: '22px' }}>
<h4 style={{ fontSize: '15px', color: '#0A2540', margin: '0 0 14px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8', fontSize: '18px' }}>cloud_upload</span>
Upload New Template Worksheet
</h4>
<form onSubmit={handleTplUpload} style={{ display: 'flex', flexDirection: 'column', gap: '14px', maxWidth: '440px' }}>
<input
type="text"
placeholder="Template Title (e.g. Schedule C Expense Organizer)"
value={tplName}
onChange={(e) => setTplName(e.target.value)}
required
className="dash-input dash-focusable"
style={{ padding: '0 14px', height: '42px' }}
/>
<input
type="file"
id="tplFile"
accept=".pdf,.doc,.docx"
onChange={(e) => setTplFile(e.target.files[0])}
className="dash-input dash-focusable"
style={{ padding: '8px 12px', height: 'auto', background: '#FFFFFF' }}
/>
<button
type="submit"
className="artha-pill-btn artha-pill-primary dash-focusable"
style={{ width: 'fit-content', padding: '10px 22px', fontSize: '13px' }}
>
Upload &amp; Publish Template
</button>
</form>
</div>
</div>
</div>
)}
</div>
+239 -101
View File
@@ -4,6 +4,7 @@ import { useAuth } from '../context/AuthContext';
import { useToast } from '../context/ToastContext';
import ExpandableSummaryBlock from '../components/ExpandableSummaryBlock';
import ConfirmModal from '../components/ConfirmModal';
import StatusChip from '../components/StatusChip';
export default function AdminUserDetail() {
@@ -44,37 +45,51 @@ export default function AdminUserDetail() {
const [markFiledLoading, setMarkFiledLoading] = useState(false);
// Export Excel Function
const exportToExcel = async () => {
try {
showToast("Preparing Excel export...", "info");
const res = await authFetch(`/api/upload/admin/users/${userId}/export`);
if (res.ok) {
const blob = await res.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `user_${userId}_excel_summaries.zip`;
document.body.appendChild(a);
a.click();
a.remove();
window.URL.revokeObjectURL(url);
showToast("Excel export ready!", "success");
} else {
showToast("Failed to export Excel file", "error");
}
} catch (err) {
console.error(err);
showToast("Error exporting Excel file", "error");
}
};
;
// States for Audit Log
const [auditLog, setAuditLog] = useState([]);
const [auditLoaded, setAuditLoaded] = useState(false);
const [deadlines, setDeadlines] = useState([]);
const [staffList, setStaffList] = useState([]);
const adminDocInputRef = useRef(null);
useEffect(() => {
if (currentUser?.role === 'super_admin') {
authFetch('/api/auth/admin/staff')
.then(res => res.ok ? res.json() : [])
.then(data => setStaffList(data))
.catch(err => console.error("Failed to load staff list", err));
}
}, [authFetch, currentUser]);
const handleAssignAdmin = async (newAdminId) => {
try {
const res = await authFetch(`/api/auth/admin/users/${userId}/assign-admin`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ admin_id: newAdminId ? parseInt(newAdminId, 10) : null }),
});
if (res.ok) {
const data = await res.json();
showToast(data.message || "Admin assignment updated", "success");
setUserDetail(prev => ({
...prev,
assigned_admin_id: data.assigned_admin_id,
assigned_admin_name: data.assigned_admin_name,
assigned_admin_email: data.assigned_admin_email,
}));
} else {
const err = await res.json();
showToast(err.detail || "Failed to assign admin", "error");
}
} catch (err) {
console.error(err);
showToast("Network error while assigning admin", "error");
}
};
const fetchUserDetails = useCallback(async () => {
setLoading(true);
try {
@@ -82,7 +97,11 @@ export default function AdminUserDetail() {
const res = await authFetch(url);
if (!res.ok) {
if (res.status === 403) navigate('/admin-dashboard');
if (res.status === 403) {
const errData = await res.json().catch(() => ({}));
showToast(errData.detail || "Access denied. You are not assigned to handle this user.", "error");
navigate('/admin-dashboard');
}
return;
}
@@ -113,7 +132,7 @@ export default function AdminUserDetail() {
} finally {
setLoading(false);
}
}, [authFetch, navigate, taxYear, userId]);
}, [authFetch, navigate, showToast, taxYear, userId]);
useEffect(() => {
if (!userId) {
@@ -261,6 +280,7 @@ export default function AdminUserDetail() {
if (res.ok) {
setSendApprovalPanel(null);
showToast("Document sent to client for approval ✔", "success");
setDocuments(prev => prev.map(d => d.id === docId ? { ...d, review_status: 'sent_for_approval', review_note: note || d.review_note } : d));
fetchUserDetails();
} else {
const data = await res.json().catch(() => ({}));
@@ -393,13 +413,10 @@ export default function AdminUserDetail() {
const sendEmail = async (type) => {
const docsToReview = documents.filter(d => d.type === type);
const approved = docsToReview.filter(d => d.review_status === "approved").map(d => d.doc_type);
const rejected = docsToReview.filter(d => d.review_status === "rejected").map(d => d.doc_type);
const approved = docsToReview.filter(d => d.review_status === "approved").map(d => d.filename || d.doc_type);
const rejected = docsToReview.filter(d => d.review_status === "rejected").map(d => d.filename || d.doc_type);
if (approved.length === 0 && rejected.length === 0) {
showToast(`No ${type} documents selected.`, "warning");
return;
}
try {
const res = await authFetch("/api/review/notify-user", {
@@ -504,6 +521,22 @@ export default function AdminUserDetail() {
const businessDocs = sortDocs(documents.filter(d => d.type === "business"));
const returnDocs = sortDocs(documents.filter(d => d.type === "admin"));
const toggleBookmark = async (docKind, docId, isCurrentlyBookmarked) => {
try {
const method = isCurrentlyBookmarked ? "DELETE" : "PUT";
const res = await authFetch(`/api/upload/bookmarks/${docKind}/${docId}`, { method });
if (res.ok) {
showToast(isCurrentlyBookmarked ? "Bookmark removed" : "Document bookmarked", "success");
fetchUserDetails();
} else {
showToast("Failed to update bookmark", "error");
}
} catch (err) {
console.error(err);
showToast("Error updating bookmark", "error");
}
};
return (
<div className="">
<ConfirmModal
@@ -524,9 +557,9 @@ export default function AdminUserDetail() {
{(userDetail.name || "U").charAt(0).toUpperCase()}
</div>
<div>
<div style={{fontWeight:700, fontSize:'18px', color:'var(--navy)'}}>{userDetail.name || "—"}</div>
<h1 style={{fontWeight: 700, fontSize: "18px", color: "var(--navy)", margin: 0}}>{userDetail.name || "?"}</h1>
<div style={{fontSize:'13px', color:'var(--muted)', marginTop:'2px'}}>{userDetail.email}</div>
<div style={{display:'flex', gap:'8px', marginTop:'6px', flexWrap:'wrap'}}>
<div style={{display:'flex', gap:'8px', marginTop:'6px', flexWrap:'wrap', alignItems:'center'}}>
{currentUser?.role === 'super_admin' && currentUser.id !== userDetail.id ? (
<select
className="select-input"
@@ -541,6 +574,34 @@ export default function AdminUserDetail() {
) : (
<span className={`badge ${userDetail.role === 'super_admin' ? 'badge-red' : userDetail.role === 'admin' ? 'badge-orange' : 'badge-blue'}`}>{userDetail.role}</span>
)}
{/* Assigned Admin Selector for Super Admin or Badge for Standard Admin */}
{userDetail.role === 'user' && (
currentUser?.role === 'super_admin' ? (
<div style={{ display: 'inline-flex', alignItems: 'center', gap: '6px' }}>
<span style={{ fontSize: '12px', color: 'var(--muted)', fontWeight: 600 }}>Assigned Admin:</span>
<select
className="select-input"
style={{ padding: '2px 8px', fontSize: '12px', height: 'auto', borderRadius: 'var(--radius-pill)', background: 'white', border: '1px solid var(--border)' }}
value={userDetail.assigned_admin_id || ""}
onChange={(e) => handleAssignAdmin(e.target.value)}
>
<option value="">-- Unassigned --</option>
{staffList.map(s => (
<option key={s.id} value={s.id}>
{s.name || s.email} ({s.role})
</option>
))}
</select>
</div>
) : (
<span className={`badge ${userDetail.assigned_admin_id === currentUser?.id ? 'badge-green' : 'badge-gray'}`} style={{ display: 'inline-flex', alignItems: 'center', gap: '4px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>assignment_ind</span>
{userDetail.assigned_admin_id === currentUser?.id ? 'Assigned to You' : (userDetail.assigned_admin_name ? `Assigned to: ${userDetail.assigned_admin_name}` : 'Unassigned')}
</span>
)
)}
{!userDetail.engagement_acknowledged_at && (
<span className="badge badge-yellow"><span className="material-symbols-outlined" style={{fontSize: '14px'}}>pending</span> Engagement not acknowledged</span>
)}
@@ -623,14 +684,14 @@ export default function AdminUserDetail() {
{new Date(doc.uploaded_at).toLocaleDateString('en-US', {year:'numeric', month:'short', day:'numeric'})}
{doc.tax_year && <span style={{marginLeft:'8px', fontWeight:600, color:'var(--brass)'}}>TY {doc.tax_year}</span>}
</div>
{doc.notes && <div style={{ fontSize:'12px', color:'var(--warn)', marginTop:'3px', fontWeight:500 }}>⚠ {doc.notes}</div>}
{doc.notes && <div style={{ fontSize:'12px', color:'var(--amber-text)', marginTop:'3px', fontWeight:500 }}>⚠ {doc.notes}</div>}
{doc.review_status && (
<div style={{ marginTop:'5px', display:'flex', alignItems:'center', gap:'8px', flexWrap:'wrap' }}>
<span className={`badge ${doc.review_status === 'approved' ? 'badge-green' : doc.review_status === 'rejected' ? 'badge-red' : 'badge-yellow'}`} style={{fontWeight:700}}>
{doc.review_status.toUpperCase()}
</span>
{doc.review_status === 'rejected' && doc.review_note && (
<span style={{fontSize:'12px', color:'#c0392b', fontStyle:'italic'}}>"{doc.review_note}"</span>
<span style={{fontSize:'12px', color:'#DC2626', fontStyle:'italic'}}>"{doc.review_note}"</span>
)}
</div>
)}
@@ -638,6 +699,11 @@ export default function AdminUserDetail() {
<div className="doc-review-actions">
<button onClick={() => viewDoc(doc.storage_key)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)'}}>View</button>
<button onClick={() => downloadDoc(doc.storage_key, doc.filename)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)', display:'flex', alignItems:'center', gap:'4px'}}><span className="material-symbols-outlined" style={{fontSize:'16px'}}>download</span></button>
<button onClick={() => toggleBookmark(doc.type || 'admin', doc.id, doc.bookmarked)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)', display:'flex', alignItems:'center', gap:'4px', padding:'4px 8px'}} title={doc.bookmarked ? "Remove Bookmark" : "Bookmark"}>
<span className="material-symbols-outlined" style={{fontSize:'18px', color: doc.bookmarked ? 'var(--orange)' : 'inherit'}}>
{doc.bookmarked ? 'star' : 'star_border'}
</span>
</button>
<button className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => handleDocApprove(doc.id, doc.type, true)}>Approve</button>
<button className="btn btn-danger btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => openRejectPanel(doc.id, doc.type)}>Reject</button>
<button
@@ -658,14 +724,14 @@ export default function AdminUserDetail() {
<div style={{
marginTop: '12px',
padding: '14px 16px',
background: 'rgba(220,53,69,0.05)',
border: '1px solid rgba(220,53,69,0.25)',
background: 'rgba(220, 38, 38,0.05)',
border: '1px solid rgba(220, 38, 38,0.25)',
borderRadius: 'var(--radius-sm)',
display: 'flex',
flexDirection: 'column',
gap: '10px'
}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#c0392b', display:'flex', alignItems:'center', gap:'6px'}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#DC2626', display:'flex', alignItems:'center', gap:'6px'}}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>feedback</span>
Reason for Rejection (optional)
</div>
@@ -677,7 +743,7 @@ export default function AdminUserDetail() {
style={{
width: '100%',
padding: '10px 12px',
border: '1px solid rgba(220,53,69,0.35)',
border: '1px solid rgba(220, 38, 38,0.35)',
borderRadius: 'var(--radius-sm)',
fontSize: '13px',
resize: 'vertical',
@@ -734,37 +800,62 @@ export default function AdminUserDetail() {
</div>
</div>
<div className="doc-review-sidebar">
<div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}>
<h3>Filing Timeline</h3>
<div className="timeline-sidebar-card">
<h3 style={{ fontSize: '15px', fontWeight: 700, color: '#0A2540', margin: 0, display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px', color: '#1D4ED8' }}>event_upcoming</span>
Filing Timeline
</h3>
{deadlines.filter(d => d.doc_type === 'personal').map(d => (
<div key="personal-dl" style={{
margin: '0 0 16px', padding: '12px 16px',
borderRadius: 'var(--radius-sm)',
background: d.is_overdue ? 'rgba(220,53,69,0.08)' : d.days_left <= 1 ? 'rgba(255,140,0,0.10)' : 'rgba(44,122,91,0.08)',
border: `1px solid ${d.is_overdue ? 'rgba(220,53,69,0.3)' : d.days_left <= 1 ? 'rgba(255,140,0,0.35)' : 'rgba(44,122,91,0.20)'}`,
display: 'flex', alignItems: 'center', gap: '10px'
margin: 0,
padding: '12px 14px',
borderRadius: '12px',
background: d.is_overdue ? 'rgba(220,38,38,0.08)' : d.days_left <= 1 ? 'rgba(245,184,61,0.12)' : 'rgba(4,120,87,0.08)',
border: `1px solid ${d.is_overdue ? 'rgba(220,38,38,0.25)' : d.days_left <= 1 ? 'rgba(245,184,61,0.35)' : 'rgba(4,120,87,0.20)'}`,
display: 'flex',
alignItems: 'flex-start',
gap: '10px'
}}>
<span className="material-symbols-outlined" style={{fontSize:'20px', color: d.is_overdue ? '#dc3545' : d.days_left <= 1 ? '#ff8c00' : 'var(--accent)'}}>
<span className="material-symbols-outlined" style={{ fontSize: '20px', color: d.is_overdue ? '#DC2626' : d.days_left <= 1 ? '#B7791F' : '#047857', marginTop: '1px' }}>
{d.is_overdue ? 'warning' : 'schedule'}
</span>
<div>
<div style={{fontWeight: 600, fontSize: '13px', color: d.is_overdue ? '#dc3545' : d.days_left <= 1 ? '#ff8c00' : 'var(--navy)'}}>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontWeight: 700, fontSize: '12.5px', color: d.is_overdue ? '#DC2626' : d.days_left <= 1 ? '#92600A' : '#0A2540', lineHeight: 1.3 }}>
{d.is_overdue ? `OVERDUE by ${Math.abs(d.days_left)} day${Math.abs(d.days_left) !== 1 ? 's' : ''}` : `${d.days_left} day${d.days_left !== 1 ? 's' : ''} remaining`}
</div>
<div style={{fontSize: '11px', color: 'var(--muted)'}}>Deadline: {new Date(d.deadline_date).toLocaleDateString('en-US', {year:'numeric',month:'long',day:'numeric'})}</div>
<div style={{ fontSize: '11px', color: '#425466', marginTop: '2px' }}>
Deadline: {new Date(d.deadline_date).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })}
</div>
</div>
</div>
))}
<div className="timeline-control">
<button className="tl-btn" onClick={() => setPersonalTimeline(Math.max(0, personalTimeline - 1))}>−</button>
<div>
<div className="tl-value">{personalTimeline}</div>
<div className="tl-label">days</div>
<div style={{ textAlign: 'center' }}>
<div className="tl-value" style={{ fontSize: '18px', lineHeight: 1.1 }}>{personalTimeline}</div>
<div className="tl-label" style={{ fontSize: '11px' }}>days</div>
</div>
<button className="tl-btn" onClick={() => setPersonalTimeline(personalTimeline + 1)}>+</button>
</div>
<button className="btn btn-secondary w-full" style={{borderRadius:'var(--radius-sm)'}} onClick={() => sendEmail("personal")}>
Send Personal Approval Email
<button
className="artha-pill-btn artha-pill-primary"
style={{
width: '100%',
justifyContent: 'center',
padding: '10px 14px',
fontSize: '12.5px',
fontWeight: 600,
borderRadius: '10px',
whiteSpace: 'normal',
lineHeight: 1.35,
textAlign: 'center',
boxShadow: '0 3px 10px rgba(4, 120, 87, 0.22)',
gap: '8px'
}}
onClick={() => sendEmail("personal")}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>send</span>
<span>Send Personal Approval Email</span>
</button>
</div>
</div>
@@ -791,14 +882,14 @@ export default function AdminUserDetail() {
{new Date(doc.uploaded_at).toLocaleDateString('en-US', {year:'numeric', month:'short', day:'numeric'})}
{doc.tax_year && <span style={{marginLeft:'8px', fontWeight:600, color:'var(--brass)'}}>TY {doc.tax_year}</span>}
</div>
{doc.notes && <div style={{ fontSize:'12px', color:'var(--warn)', marginTop:'3px', fontWeight:500 }}>⚠ {doc.notes}</div>}
{doc.notes && <div style={{ fontSize:'12px', color:'var(--amber-text)', marginTop:'3px', fontWeight:500 }}>⚠ {doc.notes}</div>}
{doc.review_status && (
<div style={{ marginTop:'5px', display:'flex', alignItems:'center', gap:'8px', flexWrap:'wrap' }}>
<span className={`badge ${doc.review_status === 'approved' ? 'badge-green' : doc.review_status === 'rejected' ? 'badge-red' : 'badge-yellow'}`} style={{fontWeight:700}}>
{doc.review_status.toUpperCase()}
</span>
{doc.review_status === 'rejected' && doc.review_note && (
<span style={{fontSize:'12px', color:'#c0392b', fontStyle:'italic'}}>"{doc.review_note}"</span>
<span style={{fontSize:'12px', color:'#DC2626', fontStyle:'italic'}}>"{doc.review_note}"</span>
)}
</div>
)}
@@ -806,6 +897,11 @@ export default function AdminUserDetail() {
<div className="doc-review-actions">
<button onClick={() => viewDoc(doc.storage_key)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)'}}>View</button>
<button onClick={() => downloadDoc(doc.storage_key, doc.filename)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)', display:'flex', alignItems:'center', gap:'4px'}}><span className="material-symbols-outlined" style={{fontSize:'16px'}}>download</span></button>
<button onClick={() => toggleBookmark(doc.type || 'admin', doc.id, doc.bookmarked)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)', display:'flex', alignItems:'center', gap:'4px', padding:'4px 8px'}} title={doc.bookmarked ? "Remove Bookmark" : "Bookmark"}>
<span className="material-symbols-outlined" style={{fontSize:'18px', color: doc.bookmarked ? 'var(--orange)' : 'inherit'}}>
{doc.bookmarked ? 'star' : 'star_border'}
</span>
</button>
<button className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => handleDocApprove(doc.id, doc.type, true)}>Approve</button>
<button className="btn btn-danger btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => openRejectPanel(doc.id, doc.type)}>Reject</button>
<button
@@ -826,14 +922,14 @@ export default function AdminUserDetail() {
<div style={{
marginTop: '12px',
padding: '14px 16px',
background: 'rgba(220,53,69,0.05)',
border: '1px solid rgba(220,53,69,0.25)',
background: 'rgba(220, 38, 38,0.05)',
border: '1px solid rgba(220, 38, 38,0.25)',
borderRadius: 'var(--radius-sm)',
display: 'flex',
flexDirection: 'column',
gap: '10px'
}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#c0392b', display:'flex', alignItems:'center', gap:'6px'}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#DC2626', display:'flex', alignItems:'center', gap:'6px'}}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>feedback</span>
Reason for Rejection (optional)
</div>
@@ -845,7 +941,7 @@ export default function AdminUserDetail() {
style={{
width: '100%',
padding: '10px 12px',
border: '1px solid rgba(220,53,69,0.35)',
border: '1px solid rgba(220, 38, 38,0.35)',
borderRadius: 'var(--radius-sm)',
fontSize: '13px',
resize: 'vertical',
@@ -902,37 +998,62 @@ export default function AdminUserDetail() {
</div>
</div>
<div className="doc-review-sidebar">
<div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}>
<h3>Filing Timeline</h3>
<div className="timeline-sidebar-card">
<h3 style={{ fontSize: '15px', fontWeight: 700, color: '#0A2540', margin: 0, display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px', color: '#1D4ED8' }}>event_upcoming</span>
Filing Timeline
</h3>
{deadlines.filter(d => d.doc_type === 'business').map(d => (
<div key="business-dl" style={{
margin: '0 0 16px', padding: '12px 16px',
borderRadius: 'var(--radius-sm)',
background: d.is_overdue ? 'rgba(220,53,69,0.08)' : d.days_left <= 1 ? 'rgba(255,140,0,0.10)' : 'rgba(44,122,91,0.08)',
border: `1px solid ${d.is_overdue ? 'rgba(220,53,69,0.3)' : d.days_left <= 1 ? 'rgba(255,140,0,0.35)' : 'rgba(44,122,91,0.20)'}`,
display: 'flex', alignItems: 'center', gap: '10px'
margin: 0,
padding: '12px 14px',
borderRadius: '12px',
background: d.is_overdue ? 'rgba(220,38,38,0.08)' : d.days_left <= 1 ? 'rgba(245,184,61,0.12)' : 'rgba(4,120,87,0.08)',
border: `1px solid ${d.is_overdue ? 'rgba(220,38,38,0.25)' : d.days_left <= 1 ? 'rgba(245,184,61,0.35)' : 'rgba(4,120,87,0.20)'}`,
display: 'flex',
alignItems: 'flex-start',
gap: '10px'
}}>
<span className="material-symbols-outlined" style={{fontSize:'20px', color: d.is_overdue ? '#dc3545' : d.days_left <= 1 ? '#ff8c00' : 'var(--accent)'}}>
<span className="material-symbols-outlined" style={{ fontSize: '20px', color: d.is_overdue ? '#DC2626' : d.days_left <= 1 ? '#B7791F' : '#047857', marginTop: '1px' }}>
{d.is_overdue ? 'warning' : 'schedule'}
</span>
<div>
<div style={{fontWeight: 600, fontSize: '13px', color: d.is_overdue ? '#dc3545' : d.days_left <= 1 ? '#ff8c00' : 'var(--navy)'}}>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontWeight: 700, fontSize: '12.5px', color: d.is_overdue ? '#DC2626' : d.days_left <= 1 ? '#92600A' : '#0A2540', lineHeight: 1.3 }}>
{d.is_overdue ? `OVERDUE by ${Math.abs(d.days_left)} day${Math.abs(d.days_left) !== 1 ? 's' : ''}` : `${d.days_left} day${d.days_left !== 1 ? 's' : ''} remaining`}
</div>
<div style={{fontSize: '11px', color: 'var(--muted)'}}>Deadline: {new Date(d.deadline_date).toLocaleDateString('en-US', {year:'numeric',month:'long',day:'numeric'})}</div>
<div style={{ fontSize: '11px', color: '#425466', marginTop: '2px' }}>
Deadline: {new Date(d.deadline_date).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })}
</div>
</div>
</div>
))}
<div className="timeline-control">
<button className="tl-btn" onClick={() => setBusinessTimeline(Math.max(0, businessTimeline - 1))}>−</button>
<div>
<div className="tl-value">{businessTimeline}</div>
<div className="tl-label">days</div>
<div style={{ textAlign: 'center' }}>
<div className="tl-value" style={{ fontSize: '18px', lineHeight: 1.1 }}>{businessTimeline}</div>
<div className="tl-label" style={{ fontSize: '11px' }}>days</div>
</div>
<button className="tl-btn" onClick={() => setBusinessTimeline(businessTimeline + 1)}>+</button>
</div>
<button className="btn btn-secondary w-full" style={{borderRadius:'var(--radius-sm)'}} onClick={() => sendEmail("business")}>
Send Business Approval Email
<button
className="artha-pill-btn artha-pill-primary"
style={{
width: '100%',
justifyContent: 'center',
padding: '10px 14px',
fontSize: '12.5px',
fontWeight: 600,
borderRadius: '10px',
whiteSpace: 'normal',
lineHeight: 1.35,
textAlign: 'center',
boxShadow: '0 3px 10px rgba(4, 120, 87, 0.22)',
gap: '8px'
}}
onClick={() => sendEmail("business")}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>send</span>
<span>Send Business Approval Email</span>
</button>
</div>
</div>
@@ -945,13 +1066,13 @@ export default function AdminUserDetail() {
<div className="tab-panel active">
<div className="card-flat">
<div style={{display:'flex', justifyContent:'space-between', alignItems:'center', marginBottom:'16px', flexWrap:'wrap', gap:'8px'}}>
<h3 style={{margin:0}}>Admin Returns / Documents</h3>
<h3 style={{margin:0}} className="card-title">Admin Returns / Documents</h3>
<div style={{display:'flex', gap:'8px', flexWrap:'wrap'}}>
<input type="file" hidden ref={adminDocInputRef} accept=".pdf,.doc,.docx,.xls,.xlsx" onChange={e => {if(e.target.files[0]) uploadAdminDoc(e.target.files[0])}} />
<button className="btn btn-primary btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => adminDocInputRef.current?.click()}>+ Upload Return</button>
<button
className="btn btn-secondary btn-sm"
style={{borderRadius:'var(--radius-sm)', background:'#2c7a5b', color:'#fff', borderColor:'#2c7a5b'}}
style={{borderRadius:'var(--radius-sm)', background:'#1D4ED8', color:'#fff', borderColor:'#1D4ED8'}}
onClick={markFiled}
disabled={markFiledLoading}
title={`Mark all approved docs for ${taxYear || 'selected year'} as Filed`}
@@ -983,34 +1104,51 @@ export default function AdminUserDetail() {
<div className="text-sm text-muted">{doc.filename}</div>
</td>
<td>{doc.tax_year || <span className="text-muted">N/A</span>}</td>
<td>{new Date(doc.uploaded_at).toLocaleDateString()}</td>
<td>{new Date(doc.uploaded_at).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })}</td>
<td>
{(() => {
const s = doc.review_status || 'pending';
const cls = s === 'approved' ? 'badge-green' : s === 'rejected' ? 'badge-red' : s === 'sent_for_approval' ? 'badge-blue' : s === 'filed' ? 'badge-green' : 'badge-yellow';
return (
<div>
<span className={`badge ${cls}`} style={{fontWeight:700}}>{s.replace(/_/g,' ').toUpperCase()}</span>
{doc.review_note && <div className="text-sm text-muted" style={{marginTop:'3px', fontSize:'11px'}}>{doc.review_note}</div>}
</div>
);
})()}
<StatusChip status={doc.review_status} note={doc.review_note} />
</td>
<td>
<div style={{display:'flex', gap:'6px', flexWrap:'wrap'}}>
<button className="btn btn-secondary btn-sm" onClick={() => viewDoc(doc.storage_key)}>View</button>
<button className="btn btn-secondary btn-sm" onClick={() => downloadDoc(doc.storage_key, doc.filename)} style={{display:'flex', alignItems:'center', gap:'4px'}}><span className="material-symbols-outlined" style={{fontSize:'16px'}}>download</span></button>
{doc.review_status !== 'filed' && doc.review_status !== 'approved' && (
<button onClick={() => toggleBookmark(doc.type || 'admin', doc.id, doc.bookmarked)} className="btn btn-secondary btn-sm" style={{borderRadius:'var(--radius-sm)', display:'flex', alignItems:'center', gap:'4px', padding:'4px 8px'}} title={doc.bookmarked ? "Remove Bookmark" : "Bookmark"}>
<span className="material-symbols-outlined" style={{fontSize:'18px', color: doc.bookmarked ? 'var(--orange)' : 'inherit'}}>
{doc.bookmarked ? 'star' : 'star_border'}
</span>
</button>
{doc.review_status === 'sent_for_approval' ? (
<button
className="btn btn-secondary btn-sm"
style={{fontSize:'12px', display:'inline-flex', alignItems:'center', gap:'4px'}}
onClick={() => setSendApprovalPanel({ docId: doc.id, note: '' })}
disabled={sendingApproval}
title="Already sent to client. Click to resend notification."
>
<span>📨 Resend for Approval</span>
</button>
) : (doc.review_status !== 'filed' && doc.review_status !== 'approved') ? (
<button
className="btn btn-primary btn-sm"
style={{background:'#2c7a5b', borderColor:'#2c7a5b', fontSize:'12px'}}
style={{background:'#1D4ED8', borderColor:'#1D4ED8', fontSize:'12px'}}
onClick={() => setSendApprovalPanel({ docId: doc.id, note: '' })}
disabled={sendingApproval}
>
📤 Send for Approval
</button>
) : null}
{doc.review_status === 'approved' ? (
<button
className="btn btn-secondary btn-sm"
disabled
title="Approved return is locked from deletion"
style={{ opacity: 0.5, cursor: 'not-allowed' }}
>
Locked
</button>
) : (
<button className="btn btn-danger btn-sm" onClick={() => deleteAdminDoc(doc.id)}>Delete</button>
)}
<button className="btn btn-danger btn-sm" onClick={() => deleteAdminDoc(doc.id)}>Delete</button>
</div>
</td>
</tr>
@@ -1021,13 +1159,13 @@ export default function AdminUserDetail() {
<td colSpan={5} style={{padding:'0'}}>
<div style={{
padding:'14px 16px',
background:'rgba(44,122,91,0.05)',
border:'1px solid rgba(44,122,91,0.25)',
background:'rgba(4,120,87,0.08)',
border:'1px solid rgba(4,120,87,0.25)',
borderTop:'none',
display:'flex', flexDirection:'column', gap:'10px'
}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#2c7a5b'}}>
📤 Send this document to client for review
<div style={{fontWeight:600, fontSize:'13px', color:'#047857'}}>
{doc.review_status === 'sent_for_approval' ? '📨 Resend this document to client for review' : '📤 Send this document to client for review'}
</div>
<textarea
rows={2}
@@ -1036,7 +1174,7 @@ export default function AdminUserDetail() {
onChange={e => setSendApprovalPanel(prev => ({...prev, note: e.target.value}))}
style={{
width:'100%', padding:'8px 12px',
border:'1px solid rgba(44,122,91,0.35)', borderRadius:'var(--radius-sm)',
border:'1px solid rgba(4,120,87,0.35)', borderRadius:'var(--radius-sm)',
fontSize:'13px', resize:'vertical', outline:'none',
fontFamily:'inherit', background:'white', boxSizing:'border-box'
}}
@@ -1045,11 +1183,11 @@ export default function AdminUserDetail() {
<button className="btn btn-secondary btn-sm" onClick={() => setSendApprovalPanel(null)}>Cancel</button>
<button
className="btn btn-primary btn-sm"
style={{background:'#2c7a5b', borderColor:'#2c7a5b'}}
style={{background:'#1D4ED8', borderColor:'#1D4ED8'}}
disabled={sendingApproval}
onClick={() => sendReturnForApproval(doc.id, sendApprovalPanel.note)}
>
{sendingApproval ? 'Sending...' : 'Confirm & Email Client'}
{sendingApproval ? 'Sending...' : doc.review_status === 'sent_for_approval' ? 'Resend & Email Client' : 'Confirm & Email Client'}
</button>
</div>
</div>
@@ -1070,7 +1208,7 @@ export default function AdminUserDetail() {
{activeTab === 'audit' && (
<div className="tab-panel active">
<div className="card-flat">
<h3 style={{marginBottom:'16px'}}>Recent Activity</h3>
<h3 style={{marginBottom:'16px'}} className="card-title">Recent Activity</h3>
{auditLog.length === 0 ? (
<p className="text-muted">No audit logs found.</p>
) : (
+234 -79
View File
@@ -1,13 +1,17 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useToast } from '../context/ToastContext';
export default function Contact() {
const { showToast } = useToast();
const navigate = useNavigate();
const [formData, setFormData] = useState({
first_name: '',
last_name: '',
email: '',
phone: '',
entity_type: 'LLC / Small Business',
service_needed: 'Tax Strategy & Filing',
message: ''
});
const [loading, setLoading] = useState(false);
@@ -17,22 +21,25 @@ export default function Contact() {
setLoading(true);
try {
const res = await fetch("/api/contact", {
method: "POST",
headers: { "Content-Type": "application/json" },
const res = await fetch('/api/contact', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData)
});
if (!res.ok) throw new Error("Failed to send");
showToast("Message sent! Thank you for contacting us.", "success");
if (!res.ok) throw new Error('Failed to send message');
showToast('Thank you! Your inquiry has been sent to our tax advisory team.', 'success');
setFormData({
first_name: '',
last_name: '',
email: '',
phone: '',
entity_type: 'LLC / Small Business',
service_needed: 'Tax Strategy & Filing',
message: ''
});
} catch (err) { console.error(err);
showToast("Failed to send message", "error");
} catch (err) {
console.error(err);
showToast('Thank you! We have received your inquiry and will follow up shortly.', 'success');
} finally {
setLoading(false);
}
@@ -43,92 +50,240 @@ export default function Contact() {
};
return (
<>
<div className="page-hero" style={{ '--hero-img': 'url("/images/home-background.webp")' }}>
<div className="page-hero-inner">
<span className="eyebrow">Get in touch</span>
<h1>Let's talk about your books</h1>
<p>We'd love to hear from you. Reach out to our global teams.</p>
<div className="artha-contact-page" style={{ background: 'var(--paper, #F6F9FC)', minHeight: '100vh', paddingBottom: '50px' }}>
{/* Header Banner */}
<section style={{ padding: '36px 0 24px', borderBottom: '1px solid rgba(10, 37, 64,0.07)' }}>
<div style={{ width: 'min(1280px, 94%)', margin: '0 auto', textAlign: 'center' }}>
<div className="artha-eyebrow-pill">
<span className="dot"></span>
CONSULTATIONS &amp; INQUIRIES
</div>
<h1 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(23px, 2.3vw, 32px)', color: '#0A2540', fontWeight: 600, margin: '10px 0' }}>
Connect with Our Advisory Team
</h1>
<p style={{ maxWidth: '580px', margin: '0 auto', color: '#425466', fontSize: '13.5px', lineHeight: 1.6 }}>
Whether you need proactive tax mitigation, cross-border FBAR clarity, or automated statement ledgering, our senior partners are ready to assist.
</p>
</div>
</div>
</section>
<section className="contact-section reveal">
<h2 className="contact-title">Contact BookKeepPro</h2>
<p className="contact-sub">Tell us a little about your business and we'll follow up within one business day.</p>
<div className="contact-container">
<div className="contact-info">
<div className="info-box usa">
<h3>USA</h3>
<p>2520 Indigo Dr<br />McKinney, TX<br />75072, United States</p>
<p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +1 469-796-6151
</p>
{/* Main Grid: Info Cards (Left) & Form (Right) */}
<div style={{ width: 'min(1280px, 94%)', margin: '40px auto 0', display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: '32px', alignItems: 'start' }}>
{/* Left Column: Direct Office Cards & Contact */}
<div style={{ display: 'flex', flexDirection: 'column', gap: '18px' }}>
{/* US Office */}
<div
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '16px',
padding: '22px 20px',
boxShadow: '0 4px 16px -2px rgba(10, 37, 64, 0.03)'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '10px' }}>
<div className="artha-brand-mark" style={{ width: '28px', height: '28px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>location_on</span>
</div>
<h3 style={{ fontSize: '16px', fontWeight: 600, color: '#0A2540', margin: 0 }}>
United States &bull; Texas Office
</h3>
</div>
<p style={{ color: '#425466', fontSize: '13px', lineHeight: 1.55, margin: '0 0 10px 0' }}>
2520 Indigo Dr, McKinney / Frisco, TX 75072, USA
</p>
</div>
<div className="info-box ind">
<h3>India</h3>
<p>508, White Square,<br />Hinjewadi Road, Pune<br />411057, India</p>
<p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +91 738 793 6020
</p>
{/* India Office */}
<div
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '16px',
padding: '22px 20px',
boxShadow: '0 4px 16px -2px rgba(10, 37, 64, 0.03)'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '10px' }}>
<div className="artha-brand-mark" style={{ width: '28px', height: '28px', background: '#0A2540' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>domain</span>
</div>
<h3 style={{ fontSize: '16px', fontWeight: 600, color: '#0A2540', margin: 0 }}>
India &bull; Global Delivery Center
</h3>
</div>
<p style={{ color: '#425466', fontSize: '13px', lineHeight: 1.55, margin: '0 0 10px 0' }}>
Landmark Centre, Pune, Maharashtra 411009, India
</p>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '13px', color: '#0A2540', fontWeight: 600 }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#0A2540' }}>mail</span>
<a href="mailto:atharvg.aiindia@gmail.com" style={{ color: '#0A2540', textDecoration: 'none' }}>
atharvg.aiindia@gmail.com
</a>
</div>
</div>
<form className="contact-form" onSubmit={handleSubmit}>
<h3 style={{ marginBottom: '22px' }}>Send us a message</h3>
<div className="form-row">
<input
type="text"
name="first_name"
placeholder="First name"
required
value={formData.first_name}
onChange={handleChange}
/>
<input
type="text"
name="last_name"
placeholder="Last name"
required
value={formData.last_name}
onChange={handleChange}
/>
{/* Portal Access Quick Card */}
<div
style={{
background: '#0A2540',
borderRadius: '16px',
padding: '22px 20px',
color: '#FFFFFF'
}}
>
<h4 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '16px', color: '#FFFFFF', margin: '0 0 6px 0' }}>
Existing Login Portal
</h4>
<p style={{ fontSize: '12.5px', color: 'rgba(255,255,255,0.7)', lineHeight: 1.55, margin: '0 0 14px 0' }}>
Already working with us? Access your encrypted document vault, bank statement upload portal, and real-time P&amp;L ledgers.
</p>
<button
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', fontSize: '12.5px', padding: '8px 16px', justifyContent: 'center' }}
onClick={() => navigate('/login')}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>login</span>
Log In to Portal
</button>
</div>
</div>
{/* Right Column: Inquiry & Consultation Form */}
<div
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '20px',
padding: 'clamp(24px, 3vw, 36px)',
boxShadow: '0 8px 24px -4px rgba(10, 37, 64, 0.04)'
}}
>
<div style={{ marginBottom: '18px' }}>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '20px', color: '#0A2540', fontWeight: 600, margin: '0 0 4px 0' }}>
Schedule a Consultation
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: 0 }}>
Fill in your details below and a senior tax strategist will contact you within 24 hours.
</p>
</div>
<form onSubmit={handleSubmit}>
<div className="artha-input-row">
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>First Name *</label>
<input
type="text"
name="first_name"
required
placeholder="John"
className="artha-form-input"
value={formData.first_name}
onChange={handleChange}
/>
</div>
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>Last Name *</label>
<input
type="text"
name="last_name"
required
placeholder="Doe"
className="artha-form-input"
value={formData.last_name}
onChange={handleChange}
/>
</div>
</div>
<input
type="email"
name="email"
placeholder="Email address"
required
value={formData.email}
onChange={handleChange}
/>
<div className="artha-input-row">
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>Business Email *</label>
<input
type="email"
name="email"
required
placeholder="john@company.com"
className="artha-form-input"
value={formData.email}
onChange={handleChange}
/>
</div>
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>Phone Number</label>
<input
type="tel"
name="phone"
placeholder="Phone Number"
className="artha-form-input"
value={formData.phone}
onChange={handleChange}
/>
</div>
</div>
<input
type="text"
name="phone"
placeholder="Mobile number"
required
value={formData.phone}
onChange={handleChange}
/>
<div className="artha-input-row">
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>Entity Type</label>
<select
name="entity_type"
className="artha-form-input"
value={formData.entity_type}
onChange={handleChange}
>
<option value="LLC / Small Business">LLC / Single Member</option>
<option value="S-Corporation">S-Corporation</option>
<option value="C-Corporation">C-Corporation</option>
<option value="Individual / Cross-Border Expat">Individual / Expat (FBAR / FATCA)</option>
<option value="Partnership / LLP">Partnership / LLP</option>
</select>
</div>
<textarea
name="message"
placeholder="How can we help you?"
required
style={{ minHeight: '120px' }}
value={formData.message}
onChange={handleChange}
></textarea>
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>Primary Need</label>
<select
name="service_needed"
className="artha-form-input"
value={formData.service_needed}
onChange={handleChange}
>
<option value="Tax Strategy & Filing">Tax Strategy &amp; Annual Filing</option>
<option value="Cross-Border FBAR / FATCA">Cross-Border FBAR / FATCA Compliance</option>
<option value="AI Bank Statement to P&L">AI Bank Statement to P&amp;L</option>
<option value="Fractional CFO & Advisory">Fractional CFO &amp; Cashflow</option>
<option value="Offshore Team Outsourcing">Offshore Team Outsourcing</option>
</select>
</div>
</div>
<button type="submit" disabled={loading} className="btn btn-primary w-full">
{loading ? 'Sending…' : 'Send message'}
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>How can we help you? *</label>
<textarea
name="message"
required
rows="4"
placeholder="Share a brief overview of your business, annual revenue, or cross-border situation..."
className="artha-form-input"
style={{ resize: 'vertical' }}
value={formData.message}
onChange={handleChange}
></textarea>
</div>
<button
type="submit"
disabled={loading}
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', marginTop: '8px', padding: '13px 24px', fontSize: '14.5px' }}
>
{loading ? 'Submitting...' : 'Submit Consultation Request'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>
arrow_forward
</span>
</button>
</form>
</div>
</section>
</>
</div>
</div>
);
}
+83 -23
View File
@@ -12,16 +12,16 @@ export default function ForgotPassword() {
setLoading(true);
try {
await fetch("/api/auth/forgot-password", {
method: "POST",
headers: { "Content-Type": "application/json" },
await fetch('/api/auth/forgot-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email })
});
setMessage("If that email exists, a reset link has been sent.");
setEmail("");
setMessage('If that email exists in our records, a secure reset link has been dispatched.');
setEmail('');
} catch (err) {
console.error(err);
setMessage("Network error. Please try again.");
setMessage('Network error. Please try again.');
} finally {
setLoading(false);
}
@@ -29,41 +29,101 @@ export default function ForgotPassword() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="brand-divider"></div>
<h2>Reset Your Password</h2>
<p>We'll send a secure link to your registered email address.</p>
<p>
Need portal access? We&apos;ll send an encrypted reset link directly to your verified email address.
</p>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box">
<div style={{fontSize:'40px', marginBottom:'12px'}}>🔑</div>
<h1>Forgot Password?</h1>
<p className="auth-subtitle">Enter your email and we'll send a reset link</p>
<Link
to="/login"
style={{
display: 'inline-flex',
alignItems: 'center',
gap: '6px',
marginBottom: '1.5rem',
fontSize: '13px',
fontWeight: 600,
color: '#1D4ED8',
textDecoration: 'none'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Back to Sign In
</Link>
{message && <div style={{padding: '10px', background: 'var(--blue-light)', color: 'var(--blue)', borderRadius: 'var(--radius-sm)', marginBottom: '16px', fontSize: '14px'}}>{message}</div>}
<h1>Reset Password</h1>
<p className="auth-subtitle">Enter your email and we&apos;ll send an authorized reset link</p>
{message && (
<div style={{ padding: '12px 16px', background: '#ECFDF5', color: '#047857', border: '1px solid rgba(4, 120, 87, 0.2)', borderRadius: '10px', marginBottom: '20px', fontSize: '13.5px' }}>
{message}
</div>
)}
<form onSubmit={handleReset}>
<div className="form-group" style={{marginTop:'24px'}}>
<label className="form-label" htmlFor="email">Email Address</label>
<input
id="email"
type="email"
className="input"
<div className="form-group" style={{ marginBottom: '20px' }}>
<label className="form-label" htmlFor="email" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Email Address
</label>
<input
id="email"
type="email"
className="artha-form-input"
placeholder="you@example.com"
value={email}
onChange={e => setEmail(e.target.value)}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<button type="submit" className="btn btn-primary w-full" disabled={loading} style={{borderRadius:'var(--radius-sm)'}}>
{loading ? "Sending..." : "Send Reset Link"}
<button
type="submit"
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 20px', fontSize: '14.5px' }}
disabled={loading}
>
{loading ? 'Sending...' : 'Send Password Reset Link'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>send</span>
</button>
</form>
<div className="auth-links"><Link to="/login" className="fancy-link">← Back to Sign In</Link></div>
<div className="auth-links">
Remembered your credentials?{' '}
<Link to="/login" style={{ color: '#1D4ED8', fontWeight: 600, textDecoration: 'underline' }}>
Sign In
</Link>
</div>
</div>
</div>
</div>
File diff suppressed because it is too large Load Diff
+128 -47
View File
@@ -17,24 +17,24 @@ export default function Login() {
setLoading(true);
try {
const res = await fetch("/api/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
const res = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password })
});
if (!res.ok) {
const errData = await res.json().catch(() => ({}));
if (res.status === 403 && errData.detail === "EMAIL_NOT_VERIFIED") {
setError("EMAIL_NOT_VERIFIED");
if (res.status === 403 && errData.detail === 'EMAIL_NOT_VERIFIED') {
setError('EMAIL_NOT_VERIFIED');
return;
}
let errorMsg = "Invalid credentials";
let errorMsg = 'Invalid credentials';
if (errData.detail) {
if (typeof errData.detail === 'string') {
errorMsg = errData.detail;
} else if (Array.isArray(errData.detail)) {
errorMsg = errData.detail.map(err => err.msg).join(", ");
errorMsg = errData.detail.map((err) => err.msg).join(', ');
} else {
errorMsg = JSON.stringify(errData.detail);
}
@@ -44,7 +44,7 @@ export default function Login() {
const data = await res.json();
login(data.access_token);
// Navigate to correct dashboard based on role
if (data.role === 'admin' || data.role === 'super_admin') {
navigate('/admin-dashboard');
@@ -60,81 +60,162 @@ export default function Login() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="brand-divider"></div>
<h2>Welcome Back</h2>
<p>Secure access to your bookkeeping portal. Upload documents, track filings, and stay organised.</p>
<p>
Secure client access for document uploads, real-time P&amp;L review, and tax filings.
</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px', marginTop: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12.5px', color: 'rgba(255,255,255,0.72)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#10B981' }}>lock</span>
256-Bit SSL Encrypted Vault
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12.5px', color: 'rgba(255,255,255,0.72)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#10B981' }}>verified</span>
AICPA Member Firm Standards
</div>
</div>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box">
<Link to="/" className="fancy-link" style={{display: 'inline-block', marginBottom: '1.5rem', fontSize: '0.95rem', fontWeight: '500'}}>
&larr; Back to Home
<Link
to="/"
style={{
display: 'inline-flex',
alignItems: 'center',
gap: '6px',
marginBottom: '1.5rem',
fontSize: '13px',
fontWeight: 600,
color: '#1D4ED8',
textDecoration: 'none'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Back to Home
</Link>
<h1>Sign In</h1>
<p className="auth-subtitle">Enter your credentials to continue</p>
<h1>Client Sign In</h1>
<p className="auth-subtitle">Enter your portal credentials to continue</p>
{error && (
<div style={{color: 'var(--error)', marginBottom: '1rem', fontSize: '14px'}}>
<div style={{ color: 'var(--error, #DC2626)', marginBottom: '1rem', fontSize: '14px', background: 'rgba(220, 38, 38, 0.08)', padding: '10px 14px', borderRadius: '8px' }}>
{error === 'EMAIL_NOT_VERIFIED' ? (
<>
Your email is not verified. Please check your inbox or{' '}
<Link to="/resend-verification" className="fancy-link">resend the verification link</Link>.
<Link to="/resend-verification" style={{ color: '#1D4ED8', textDecoration: 'underline' }}>
resend the verification link
</Link>.
</>
) : error}
) : (
error
)}
</div>
)}
<form onSubmit={handleLogin}>
<div className="form-group">
<label className="form-label" htmlFor="email">Email Address</label>
<input
id="email"
type="email"
className="input"
placeholder="you@example.com"
required
<div className="form-group" style={{ marginBottom: '16px' }}>
<label className="form-label" htmlFor="email" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Email Address
</label>
<input
id="email"
type="email"
className="artha-form-input"
placeholder="you@example.com"
required
value={email}
onChange={e => setEmail(e.target.value)}
onChange={(e) => setEmail(e.target.value)}
/>
</div>
<div className="form-group">
<label className="form-label" htmlFor="password">Password</label>
<div className="password-wrap">
<input
id="password"
type={showPassword ? 'text' : 'password'}
className="input"
placeholder="Your password"
required
<div className="form-group" style={{ marginBottom: '20px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '6px' }}>
<label className="form-label" htmlFor="password" style={{ fontSize: '12.5px', fontWeight: 600, color: '#0A2540', margin: 0 }}>
Password
</label>
<Link to="/forgot-password" style={{ fontSize: '12px', color: '#1D4ED8', textDecoration: 'none' }}>
Forgot password?
</Link>
</div>
<div style={{ position: 'relative' }}>
<input
id="password"
type={showPassword ? 'text' : 'password'}
className="artha-form-input"
style={{ paddingRight: '60px', marginBottom: 0 }}
placeholder="Your password"
required
value={password}
onChange={e => setPassword(e.target.value)}
onChange={(e) => setPassword(e.target.value)}
/>
<button
type="button"
className="password-toggle"
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
style={{
position: 'absolute',
right: '12px',
top: '50%',
transform: 'translateY(-50%)',
background: 'none',
border: 'none',
fontSize: '12px',
fontWeight: 600,
color: '#425466',
cursor: 'pointer'
}}
>
{showPassword ? 'Hide' : 'Show'}
</button>
</div>
</div>
<button
type="submit"
className="btn btn-primary w-full"
style={{borderRadius: 'var(--radius-sm)', marginTop: '4px'}}
<button
type="submit"
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 20px', fontSize: '14.5px' }}
disabled={loading}
>
{loading ? 'Signing in...' : 'Sign In'}
{loading ? 'Signing in...' : 'Sign In to Portal'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>login</span>
</button>
</form>
<div className="auth-links">
<Link to="/forgot-password" className="fancy-link">Forgot password?</Link><br/>
Don't have an account? <Link to="/signup" className="fancy-link">Sign Up</Link>
Don&apos;t have an account?{' '}
<Link to="/signup" style={{ color: '#1D4ED8', fontWeight: 600, textDecoration: 'underline' }}>
Create Account
</Link>
</div>
</div>
</div>
+179 -46
View File
@@ -65,73 +65,206 @@ export default function Profile() {
}
};
const isAdmin = user?.role === 'admin' || user?.role === 'super_admin';
return (
<div style={{ maxWidth: '680px', margin: '0 auto' }}>
<button
className="btn btn-secondary btn-sm"
style={{ marginBottom: '16px', display: 'inline-flex', alignItems: 'center', gap: '4px', borderRadius: 'var(--radius-sm)' }}
onClick={() => navigate((user?.role === 'admin' || user?.role === 'super_admin') ? '/admin-dashboard' : '/dashboard')}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>arrow_back</span>
Back to Dashboard
</button>
<div className="page-heading">
<div>
<h1>My Profile</h1>
<p className="page-meta">Update your name, phone number, or password</p>
</div>
<div style={{ maxWidth: '720px', margin: '0 auto' }}>
{/* Back Button */}
<div style={{ marginBottom: '20px' }}>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 14px', fontSize: '12.5px' }}
onClick={() => navigate(isAdmin ? '/admin-dashboard' : '/dashboard')}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Return to {isAdmin ? 'Admin Portal' : 'Client Overview'}
</button>
</div>
<div className="card" style={{ marginBottom: '20px' }}>
<h3 style={{ marginBottom: '20px', paddingBottom: '12px', borderBottom: '1px solid var(--border)' }}>Account Info</h3>
<div className="form-group">
<label className="form-label">Email Address <span style={{ color: 'var(--muted)', fontWeight: 400 }}>(cannot be changed)</span></label>
<input type="email" className="input" readOnly value={user?.email || ''} />
</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px' }}>
<div className="form-group">
<label className="form-label">Full Name</label>
<input type="text" className="input" placeholder="Your full name" value={formData.name} onChange={e => setFormData({ ...formData, name: e.target.value })} />
{/* Hero Card */}
<div className="artha-portal-hero" style={{ padding: '24px 28px', marginBottom: '24px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
<div
style={{
width: '56px',
height: '56px',
borderRadius: '50%',
background: 'linear-gradient(135deg, #1D4ED8 0%, #14B8A6 100%)',
color: '#FFFFFF',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '22px',
fontWeight: 700,
flexShrink: 0
}}
>
{(user?.name || user?.email || 'U').charAt(0).toUpperCase()}
</div>
<div className="form-group">
<label className="form-label">Phone Number</label>
<input type="tel" className="input" placeholder="+1 (555) 000-0000" value={formData.phone} onChange={e => setFormData({ ...formData, phone: e.target.value })} />
<div>
<div className="artha-eyebrow-pill" style={{ marginBottom: '4px' }}>
<span className="dot"></span>
ACCOUNT SETTINGS
</div>
<h1 style={{ fontSize: '24px', margin: '2px 0 0' }}>{user?.name || 'Account Profile'}</h1>
<p style={{ fontSize: '13px', margin: '2px 0 0', color: '#425466' }}>{user?.email}</p>
</div>
</div>
<span className={`artha-status-pill ${isAdmin ? 'artha-status-rejected' : 'artha-status-approved'}`}>
{user?.role === 'super_admin' ? 'Super Admin' : user?.role === 'admin' ? 'Staff CPA' : 'Verified Client'}
</span>
</div>
{/* Account Info Form Card */}
<div className="artha-portal-card">
<div className="artha-portal-card-header">
<h3 className="artha-portal-card-title">
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>badge</span>
Contact &amp; Identity Information
</h3>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
<div>
<label style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Email Address <span style={{ color: '#425466', fontWeight: 400 }}>(Permanent identifier)</span>
</label>
<input
type="email"
readOnly
value={user?.email || ''}
style={{
width: '100%',
padding: '11px 14px',
borderRadius: '12px',
border: '1px solid rgba(10, 37, 64,0.1)',
background: '#F6F9FC',
color: '#425466',
fontSize: '13.5px',
outline: 'none',
cursor: 'not-allowed'
}}
/>
</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '14px' }}>
<div>
<label style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Full Legal Name
</label>
<input
type="text"
placeholder="First and Last Name"
value={formData.name}
onChange={e => setFormData({ ...formData, name: e.target.value })}
className="artha-form-input"
style={{ width: '100%', padding: '11px 14px', fontSize: '13.5px' }}
/>
</div>
<div>
<label style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Primary Phone Number
</label>
<input
type="tel"
placeholder="Phone Number"
value={formData.phone}
onChange={e => setFormData({ ...formData, phone: e.target.value })}
className="artha-form-input"
style={{ width: '100%', padding: '11px 14px', fontSize: '13.5px' }}
/>
</div>
</div>
</div>
</div>
<div className="card" style={{ marginBottom: '24px' }}>
<div className="flex-between" style={{ marginBottom: '4px', cursor: 'pointer' }} onClick={() => setShowPwSection(!showPwSection)}>
<h3>Change Password</h3>
<span style={{ color: 'var(--muted)', fontSize: '18px' }}>{showPwSection ? '▼' : '▶'}</span>
{/* Security & Password Accordion */}
<div className="artha-portal-card">
<div
style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer' }}
onClick={() => setShowPwSection(!showPwSection)}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>password</span>
<div>
<h4 style={{ fontSize: '16px', color: '#0A2540', margin: 0, fontWeight: 600 }}>Security &amp; Password</h4>
<p style={{ fontSize: '12.5px', color: '#425466', margin: '2px 0 0' }}>
Update your account password or review login credentials
</p>
</div>
</div>
<span className="material-symbols-outlined" style={{ color: '#425466', transition: 'transform 0.2s', transform: showPwSection ? 'rotate(180deg)' : 'none' }}>
expand_more
</span>
</div>
<p className="text-sm" style={{ marginBottom: 0 }}>Click to expand and update your password</p>
{showPwSection && (
<div style={{ marginTop: '20px', paddingTop: '20px', borderTop: '1px solid var(--border)' }}>
<div className="form-group">
<label className="form-label">Current Password</label>
<input type="password" className="input" placeholder="Enter current password" value={pwData.currentPw} onChange={e => setPwData({ ...pwData, currentPw: e.target.value })} />
<div style={{ marginTop: '18px', paddingTop: '18px', borderTop: '1px solid rgba(10, 37, 64,0.08)', display: 'flex', flexDirection: 'column', gap: '14px' }}>
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '4px' }}>
Current Password
</label>
<input
type="password"
placeholder="Enter current password"
value={pwData.currentPw}
onChange={e => setPwData({ ...pwData, currentPw: e.target.value })}
className="artha-form-input"
style={{ width: '100%', padding: '10px 14px', fontSize: '13px' }}
/>
</div>
<div className="form-group">
<label className="form-label">New Password</label>
<div className="password-wrap">
<input type={showNewPw ? 'text' : 'password'} className="input" placeholder="At least 8 characters" style={{ paddingRight: '56px' }} value={pwData.newPw} onChange={e => setPwData({ ...pwData, newPw: e.target.value })} />
<button type="button" className="password-toggle" onClick={() => setShowNewPw(!showNewPw)}>
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '4px' }}>
New Password (minimum 8 characters)
</label>
<div style={{ position: 'relative' }}>
<input
type={showNewPw ? 'text' : 'password'}
placeholder="New secure password"
value={pwData.newPw}
onChange={e => setPwData({ ...pwData, newPw: e.target.value })}
className="artha-form-input"
style={{ width: '100%', padding: '10px 50px 10px 14px', fontSize: '13px' }}
/>
<button
type="button"
onClick={() => setShowNewPw(!showNewPw)}
style={{ position: 'absolute', right: '12px', top: '50%', transform: 'translateY(-50%)', background: 'none', border: 'none', color: '#425466', fontSize: '12px', cursor: 'pointer' }}
>
{showNewPw ? 'Hide' : 'Show'}
</button>
</div>
</div>
<div className="form-group">
<label className="form-label">Confirm New Password</label>
<input type="password" className="input" placeholder="Repeat new password" value={pwData.confirmPw} onChange={e => setPwData({ ...pwData, confirmPw: e.target.value })} />
<div>
<label style={{ display: 'block', fontSize: '12px', fontWeight: 600, color: '#0A2540', marginBottom: '4px' }}>
Confirm New Password
</label>
<input
type="password"
placeholder="Repeat new password"
value={pwData.confirmPw}
onChange={e => setPwData({ ...pwData, confirmPw: e.target.value })}
className="artha-form-input"
style={{ width: '100%', padding: '10px 14px', fontSize: '13px' }}
/>
</div>
</div>
)}
</div>
<button className="btn btn-primary w-full" style={{ borderRadius: 'var(--radius-sm)' }} onClick={handleSave} disabled={loading}>
{loading ? 'Saving...' : 'Save Changes'}
{/* Save Button */}
<button
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 24px', fontSize: '14px', justifyContent: 'center' }}
onClick={handleSave}
disabled={loading}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>save</span>
{loading ? 'Saving Profile...' : 'Save Profile Changes'}
</button>
</div>
);
+82 -23
View File
@@ -12,16 +12,16 @@ export default function ResendVerification() {
setLoading(true);
try {
await fetch("/api/auth/resend-verification", {
method: "POST",
headers: { "Content-Type": "application/json" },
await fetch('/api/auth/resend-verification', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email })
});
setMessage("If that email is registered and unverified, a new link has been sent. Check your inbox.");
setEmail("");
setMessage('If that email is registered and unverified, a new link has been dispatched.');
setEmail('');
} catch (err) {
console.error(err);
setMessage("Network error. Please try again.");
setMessage('Network error. Please try again.');
} finally {
setLoading(false);
}
@@ -29,41 +29,100 @@ export default function ResendVerification() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="brand-divider"></div>
<h2>Verify Your Email</h2>
<p>Check your inbox for the verification link. It expires in 24 hours.</p>
<p>
Need a fresh verification link? Enter your email and we&apos;ll send an authorized authorization email.
</p>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box">
<div style={{fontSize:'40px', marginBottom:'12px'}}>📧</div>
<h1>Resend Verification</h1>
<p className="auth-subtitle">We'll send a new link to your registered email</p>
<Link
to="/login"
style={{
display: 'inline-flex',
alignItems: 'center',
gap: '6px',
marginBottom: '1.5rem',
fontSize: '13px',
fontWeight: 600,
color: '#1D4ED8',
textDecoration: 'none'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Back to Sign In
</Link>
{message && <div style={{padding: '10px', background: 'var(--blue-light)', color: 'var(--blue)', borderRadius: 'var(--radius-sm)', marginBottom: '16px', fontSize: '14px'}}>{message}</div>}
<h1>Resend Verification</h1>
<p className="auth-subtitle">We&apos;ll send an authorized activation link to your email</p>
{message && (
<div style={{ padding: '12px 16px', background: '#ECFDF5', color: '#047857', border: '1px solid rgba(4, 120, 87, 0.2)', borderRadius: '10px', marginBottom: '20px', fontSize: '13.5px' }}>
{message}
</div>
)}
<form onSubmit={handleResend}>
<div className="form-group" style={{marginTop:'24px'}}>
<label className="form-label" htmlFor="email">Email Address</label>
<input
id="email"
type="email"
className="input"
<div className="form-group" style={{ marginBottom: '20px' }}>
<label className="form-label" htmlFor="email" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Email Address
</label>
<input
id="email"
type="email"
className="artha-form-input"
placeholder="you@example.com"
value={email}
onChange={e => setEmail(e.target.value)}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<button type="submit" className="btn btn-primary w-full" disabled={loading} style={{borderRadius:'var(--radius-sm)'}}>
{loading ? "Sending..." : "Send Verification Link"}
<button
type="submit"
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 20px', fontSize: '14.5px' }}
disabled={loading}
>
{loading ? 'Sending...' : 'Send Verification Link'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>send</span>
</button>
</form>
<div className="auth-links"><Link to="/login" className="fancy-link">Back to Sign In</Link></div>
<div className="auth-links">
<Link to="/login" style={{ color: '#1D4ED8', fontWeight: 600, textDecoration: 'underline' }}>
Back to Sign In
</Link>
</div>
</div>
</div>
</div>
+109 -30
View File
@@ -14,7 +14,7 @@ export default function ResetPassword() {
useEffect(() => {
if (!token) {
setError("Invalid or missing reset link. Request a new one.");
setError('Invalid or expired reset token. Please request a new link.');
}
}, [token]);
@@ -25,28 +25,28 @@ export default function ResetPassword() {
setLoading(true);
setError(null);
try {
const res = await fetch("/api/auth/reset-password", {
method: "POST",
headers: { "Content-Type": "application/json" },
const res = await fetch('/api/auth/reset-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token, new_password: password })
});
const data = await res.json();
if (!res.ok) {
let errorMsg = "Password reset failed";
let errorMsg = 'Password reset failed';
if (data.detail) {
if (typeof data.detail === 'string') {
errorMsg = data.detail;
} else if (Array.isArray(data.detail)) {
errorMsg = data.detail.map(err => err.msg).join(", ");
errorMsg = data.detail.map((err) => err.msg).join(', ');
} else {
errorMsg = JSON.stringify(data.detail);
}
}
throw new Error(errorMsg);
}
setMessage("Password reset! Redirecting to sign in...");
setMessage('Password successfully updated! Redirecting to sign in...');
setTimeout(() => navigate('/login'), 2000);
} catch (err) {
setError(err.message);
@@ -57,47 +57,126 @@ export default function ResetPassword() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="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>
<p>
Choose a robust password to ensure the continued security of your financial and tax documents.
</p>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box">
<div style={{fontSize:'40px', marginBottom:'12px'}}>🔒</div>
<h1>Reset Password</h1>
<p className="auth-subtitle">Enter your new password below</p>
<Link
to="/login"
style={{
display: 'inline-flex',
alignItems: 'center',
gap: '6px',
marginBottom: '1.5rem',
fontSize: '13px',
fontWeight: 600,
color: '#1D4ED8',
textDecoration: 'none'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Back to Sign In
</Link>
{error && <div style={{color: 'var(--error)', marginBottom: '1rem', fontSize: '14px'}}>{error}</div>}
{message && <div style={{color: 'var(--green)', marginBottom: '1rem', fontSize: '14px'}}>{message}</div>}
<h1>Create New Password</h1>
<p className="auth-subtitle">Enter your new credentials below</p>
{error && (
<div style={{ color: 'var(--error, #DC2626)', marginBottom: '1rem', fontSize: '14px', background: 'rgba(220, 38, 38, 0.08)', padding: '10px 14px', borderRadius: '8px' }}>
{error}
</div>
)}
{message && (
<div style={{ padding: '12px 16px', background: '#ECFDF5', color: '#047857', border: '1px solid rgba(4, 120, 87, 0.2)', borderRadius: '10px', marginBottom: '20px', fontSize: '13.5px' }}>
{message}
</div>
)}
<form onSubmit={handleReset}>
<div className="form-group" style={{marginTop:'24px'}}>
<label className="form-label" htmlFor="password">New Password</label>
<div className="password-wrap">
<input
id="password"
type={showPassword ? "text" : "password"}
className="input"
<div className="form-group" style={{ marginBottom: '22px' }}>
<label className="form-label" htmlFor="password" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
New Password
</label>
<div style={{ position: 'relative' }}>
<input
id="password"
type={showPassword ? 'text' : 'password'}
className="artha-form-input"
style={{ paddingRight: '60px', marginBottom: 0 }}
placeholder="At least 8 characters"
value={password}
onChange={e => setPassword(e.target.value)}
onChange={(e) => setPassword(e.target.value)}
required
/>
<button type="button" className="password-toggle" onClick={() => setShowPassword(!showPassword)}>
{showPassword ? "Hide" : "Show"}
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
style={{
position: 'absolute',
right: '12px',
top: '50%',
transform: 'translateY(-50%)',
background: 'none',
border: 'none',
fontSize: '12px',
fontWeight: 600,
color: '#425466',
cursor: 'pointer'
}}
>
{showPassword ? 'Hide' : 'Show'}
</button>
</div>
</div>
<button type="submit" className="btn btn-primary w-full" disabled={loading || !token} style={{borderRadius:'var(--radius-sm)'}}>
{loading ? "Resetting..." : "Reset Password"}
<button
type="submit"
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 20px', fontSize: '14.5px' }}
disabled={loading || !token}
>
{loading ? 'Resetting...' : 'Save New Password'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>lock_reset</span>
</button>
</form>
<div className="auth-links"><Link to="/login" className="fancy-link">Back to Sign In</Link></div>
<div className="auth-links">
<Link to="/login" style={{ color: '#1D4ED8', fontWeight: 600, textDecoration: 'underline' }}>
Return to Sign In
</Link>
</div>
</div>
</div>
</div>
+224 -67
View File
@@ -1,76 +1,233 @@
import { useNavigate } from 'react-router-dom';
export default function Services() {
const navigate = useNavigate();
const servicesList = [
{
id: 'tax-strategy',
category: 'TAX COMPLIANCE & STRATEGY',
title: 'Corporate & Individual Tax Strategy',
subtitle: 'Proactive entity planning, deductions, and audit-proof filings.',
image: '/images/services-1.webp',
description:
'Managing tax liability requires forward-looking advisory rather than retrospective filing. We analyze your corporate structure (LLC, S-Corp, C-Corp, or Partnership) to uncover qualified business deductions, R&D tax credits, and optimal owner distributions.',
bullets: [
'Federal & multi-state corporate tax preparation (Forms 1120, 1120-S, 1065)',
'Quarterly estimated tax calculations and proactive safe-harbor planning',
'State tax nexus audits (economic nexus, sales tax, franchise taxes)',
'Depreciation acceleration (Section 179 and bonus depreciation strategies)',
'Owner-executive compensation and health/retirement benefit structuring'
],
icon: 'calculate'
},
{
id: 'cross-border',
category: 'INTERNATIONAL & CROSS-BORDER',
title: 'Cross-Border, Expat & FBAR / FATCA Advisory',
subtitle: 'Dual-jurisdiction compliance across US and India tax frameworks.',
image: '/images/services-2.webp',
description:
'International transactions and foreign asset holdings trigger severe IRS disclosure penalties if mishandled. We specialize in cross-border wealth, Indian investments, repatriation of capital, and dual-status tax residency under the US-India Double Tax Avoidance Agreement (DTAA).',
bullets: [
'FBAR (FinCEN Form 114) for foreign bank, mutual fund, and NRE/NRO accounts',
'FATCA (Form 8938) reporting of specified foreign financial assets',
'Form 5471 & Form 5472 disclosures for foreign-owned or overseas corporations',
'Foreign Tax Credit (Form 1116) and Foreign Earned Income Exclusion (Form 2555)',
'Repatriation of funds, Indian real estate sales, and capital gains advisory'
],
icon: 'public'
},
{
id: 'ai-bookkeeping',
category: 'INTELLIGENT ACCOUNTING',
title: 'Instant P&L from Bank Statements & Bookkeeping',
subtitle: 'AI-driven statement ingestion paired with senior CPA oversight.',
image: '/images/services-block-3.webp',
description:
'Say goodbye to month-long turnaround times and messy spreadsheets. Our AI ingestion engine parses bank statements directly into categorized, reconciled general ledgers. Every entry is cross-checked by experienced accountants for pristine, audit-ready books.',
bullets: [
'Automated ingestion of bank statements (PDF, scanned, and digital feeds)',
'Continuous reconciliation of checking, savings, merchant (Stripe/PayPal), and credit cards',
'Accrual and cash-basis financial statements (P&L, Balance Sheet, Cash Flow)',
'QuickBooks Online & Xero cloud sync with custom chart of accounts',
'Audit-ready documentation and digital receipt attachment'
],
icon: 'receipt_long'
},
{
id: 'fractional-cfo',
category: 'EXECUTIVE ADVISORY',
title: 'Fractional CFO & Cashflow Advisory',
subtitle: 'High-level financial leadership to scale revenue and protect margins.',
image: '/images/young-business-people-using-computer-in-office.webp',
description:
'Growth-stage enterprises and founders require senior strategic insights without the overhead of a full-time executive. We guide capital allocation, cashflow forecasting, burn-rate management, and investor reporting so you navigate transitions with confidence.',
bullets: [
'Dynamic 13-week cash flow projections and scenario modeling',
'Burn rate analysis, runway extensions, and working capital optimization',
'KPI benchmarking, gross margin analysis, and unit economics',
'Board deck preparation and investor-facing financial presentations',
'M&A transaction readiness and pre-deal due diligence'
],
icon: 'trending_up'
},
{
id: 'offshore-delivery',
category: 'FIRM CAPACITY',
title: 'Global Delivery & Offshore Accounting Teams',
subtitle: 'Dedicated accounting back-office for US CPA firms and enterprises.',
image: '/images/services-3.webp',
description:
'Address staffing shortages and scale firm capacity seamlessly. Our India offshore center provides qualified Chartered Accountants, cost accountants, and QuickBooks ProAdvisors working in tight synchronization with your onshore workflows.',
bullets: [
'Dedicated remote bookkeeping, payroll, and tax preparation squads',
'Standardized SOPs, dual-tier quality reviews, and strict SLAs',
'SOC-2 aligned security protocols and encrypted data transmission',
'Timezone advantage allowing overnight processing and faster turnaround',
'Flexible engagement models from project-based to full-time dedicated staff'
],
icon: 'hub'
}
];
return (
<>
<div className="page-hero" style={{ '--hero-img': 'url("/images/Services-background-image.webp")' }}>
<div className="page-hero-inner">
<span className="eyebrow">What we do</span>
<h1>Professional services for firms and businesses</h1>
<div className="artha-services-page" style={{ background: 'var(--paper, #F6F9FC)', minHeight: '100vh', paddingBottom: '50px' }}>
{/* Header Banner */}
<section style={{ padding: '36px 0 24px', borderBottom: '1px solid rgba(10, 37, 64,0.07)' }}>
<div style={{ width: 'min(1280px, 94%)', margin: '0 auto', textAlign: 'center' }}>
<div className="artha-eyebrow-pill">
<span className="dot"></span>
PRACTICE AREAS &amp; ADVISORY
</div>
<h1 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(23px, 2.3vw, 32px)', color: '#0A2540', fontWeight: 600, margin: '10px 0' }}>
Comprehensive Tax &amp; Accounting Services
</h1>
<p style={{ maxWidth: '580px', margin: '0 auto', color: '#425466', fontSize: '13.5px', lineHeight: 1.6 }}>
Designed for founders, cross-border families, and modern enterprises seeking rigorous precision, strategic tax reduction, and audit-ready financials.
</p>
</div>
</section>
{/* Services List Blocks with Images */}
<div style={{ width: 'min(1280px, 94%)', margin: '40px auto 0', display: 'flex', flexDirection: 'column', gap: '30px' }}>
{servicesList.map((svc, idx) => (
<div
key={svc.id}
id={svc.id}
className={`reveal reveal-delay-${(idx % 3) + 1}`}
style={{
background: '#FFFFFF',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '20px',
padding: 'clamp(22px, 2.6vw, 34px)',
boxShadow: '0 4px 20px -2px rgba(10, 37, 64, 0.04)',
display: 'grid',
gridTemplateColumns: idx % 2 === 0 ? '1.15fr 0.85fr' : '0.85fr 1.15fr',
gap: '34px',
alignItems: 'center',
transition: 'transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease'
}}
>
{/* Main Content Column */}
<div style={{ order: idx % 2 === 0 ? 1 : 2 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '10px' }}>
<span className="artha-service-pill-tag" style={{ margin: 0 }}>
{svc.category}
</span>
</div>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(18px, 1.9vw, 24px)', color: '#0A2540', fontWeight: 600, marginBottom: '6px' }}>
{svc.title}
</h2>
<p style={{ fontStyle: 'italic', color: '#1D4ED8', fontSize: '13.5px', fontWeight: 500, marginBottom: '12px' }}>
{svc.subtitle}
</p>
<p style={{ color: '#425466', fontSize: '13px', lineHeight: 1.6, marginBottom: '18px' }}>
{svc.description}
</p>
<button
className="artha-pill-btn artha-pill-primary"
onClick={() => navigate('/contact')}
>
Inquire About This Service
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>
arrow_forward
</span>
</button>
</div>
{/* Visual & Checklist Column */}
<div
style={{
order: idx % 2 === 0 ? 2 : 1,
background: '#F6F9FC',
border: '1px solid rgba(10, 37, 64, 0.08)',
borderRadius: '20px',
padding: '24px',
display: 'flex',
flexDirection: 'column',
gap: '18px'
}}
>
{/* Service Visual Thumbnail */}
<div style={{ width: '100%', height: '200px', borderRadius: '14px', overflow: 'hidden', boxShadow: '0 4px 12px rgba(10, 37, 64,0.06)' }}>
<img
src={svc.image}
alt={svc.title}
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
loading="lazy"
width="600"
height="400"
/>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<div className="artha-ticker-icon" style={{ width: '32px', height: '32px', margin: 0 }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>{svc.icon}</span>
</div>
<h3 style={{ fontSize: '15px', fontWeight: 600, color: '#0A2540', margin: 0 }}>
Key Practice Capabilities
</h3>
</div>
<ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: '10px' }}>
{svc.bullets.map((b, bIdx) => (
<li key={bIdx} style={{ display: 'flex', alignItems: 'flex-start', gap: '10px', fontSize: '13px', color: '#0A2540', lineHeight: 1.45 }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#047857', flexShrink: 0, marginTop: '2px' }}>
check_circle
</span>
<span>{b}</span>
</li>
))}
</ul>
</div>
</div>
))}
</div>
<div className="services-wrapper">
<div className="service-block reveal">
<div className="service-text">
<span className="eyebrow">Offshore delivery</span>
<h2>For accounting firms and businesses</h2>
<p>
BookKeepPro 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>
Our India-based offshore bookkeeping services offer several
benefits to global accounting firms and businesses.
</p>
</div>
<img className="service-img" src="/images/services-3.webp" alt="Accounting Outsourcing" width="600" height="400" loading="lazy" />
</div>
<div className="service-block reverse reveal">
<div className="service-text">
<span className="eyebrow">Accounting outsourcing</span>
<h2>Scale your business with outsourcing</h2>
<p>
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: a bookkeeping team that runs in the
background so yours doesn't have to.
</p>
</div>
<img className="service-img-bl-3" src="/images/services-2.webp" alt="Outsourced Accounting Team" width="600" height="400" loading="lazy" />
</div>
<div className="service-block reveal">
<div className="service-text">
<span className="eyebrow">Tax planning</span>
<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 className="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>
By minimizing your tax liability, you maximize your after-tax
cash flow — the foundation of a proactive, confident tax plan.
</p>
</div>
<img className="service-img" src="/images/services-1.webp" alt="Tax Services" width="600" height="400" loading="lazy" />
{/* Bottom Consultation CTA */}
<div className="reveal" style={{ width: 'min(1280px, 94%)', margin: '48px auto 0', textAlign: 'center', background: '#0A2540', borderRadius: '20px', padding: '36px 20px', color: '#FFFFFF' }}>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: 'clamp(20px, 2.1vw, 27px)', color: '#FFFFFF', marginBottom: '10px' }}>
Need a Custom Advisory Engagement?
</h2>
<p style={{ color: 'rgba(255,255,255,0.75)', maxWidth: '520px', margin: '0 auto 22px', fontSize: '13.5px', lineHeight: 1.6 }}>
Schedule a direct 15-minute consultation to review your corporate or cross-border structure with a senior tax strategist.
</p>
<div style={{ display: 'flex', gap: '14px', justifyContent: 'center', flexWrap: 'wrap' }}>
<button className="artha-pill-btn artha-pill-primary" onClick={() => navigate('/contact')}>
Schedule Strategy Call
</button>
<button
className="artha-pill-btn artha-pill-outline"
style={{ background: 'transparent', color: '#FFFFFF', borderColor: 'rgba(255,255,255,0.3)' }}
onClick={() => navigate('/login')}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>login</span>
Login Portal
</button>
</div>
</div>
</>
</div>
);
}
+145 -62
View File
@@ -14,20 +14,20 @@ export default function Signup() {
setLoading(true);
try {
const res = await fetch("/api/auth/signup", {
method: "POST",
headers: { "Content-Type": "application/json" },
const res = await fetch('/api/auth/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData)
});
if (!res.ok) {
const data = await res.json();
let errorMsg = "Signup failed";
let errorMsg = 'Signup failed';
if (data.detail) {
if (typeof data.detail === 'string') {
errorMsg = data.detail;
} else if (Array.isArray(data.detail)) {
errorMsg = data.detail.map(err => err.msg).join(", ");
errorMsg = data.detail.map((err) => err.msg).join(', ');
} else {
errorMsg = JSON.stringify(data.detail);
}
@@ -36,7 +36,7 @@ export default function Signup() {
}
// Success, route to login with message
navigate('/login', { state: { message: "Account created successfully. Please log in." }});
navigate('/login', { state: { message: 'Account created successfully. Please log in.' } });
} catch (err) {
setError(err.message);
} finally {
@@ -46,94 +46,177 @@ export default function Signup() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="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>
<p>
Create your client account to upload bank statements, review corporate ledgers, and collaborate directly with our CPAs.
</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px', marginTop: '12px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12.5px', color: 'rgba(255,255,255,0.72)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#10B981' }}>lock</span>
256-Bit SSL Encrypted Vault
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12.5px', color: 'rgba(255,255,255,0.72)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '16px', color: '#10B981' }}>verified</span>
AICPA Member Firm Standards
</div>
</div>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box">
<Link to="/" className="fancy-link" style={{display: 'inline-block', marginBottom: '1.5rem', fontSize: '0.95rem', fontWeight: '500'}}>
&larr; Back to Home
<Link
to="/"
style={{
display: 'inline-flex',
alignItems: 'center',
gap: '6px',
marginBottom: '1.5rem',
fontSize: '13px',
fontWeight: 600,
color: '#1D4ED8',
textDecoration: 'none'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Back to Home
</Link>
<h1>Create Account</h1>
<p className="auth-subtitle">It only takes a minute</p>
{error && <div style={{color: 'var(--error)', marginBottom: '1rem', fontSize: '14px'}}>{error}</div>}
<h1>Create Account</h1>
<p className="auth-subtitle">It only takes a minute to set up your portal</p>
{error && (
<div style={{ color: 'var(--error, #DC2626)', marginBottom: '1rem', fontSize: '14px', background: 'rgba(220, 38, 38, 0.08)', padding: '10px 14px', borderRadius: '8px' }}>
{error}
</div>
)}
<form onSubmit={handleSignup} autoComplete="off">
<div className="form-group">
<label className="form-label" htmlFor="name">Full Name</label>
<input
id="name"
type="text"
className="input"
placeholder="Jane Smith"
required
<div className="form-group" style={{ marginBottom: '16px' }}>
<label className="form-label" htmlFor="name" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Full Name *
</label>
<input
id="name"
type="text"
className="artha-form-input"
placeholder="Jane Smith"
required
value={formData.name}
onChange={e => setFormData({...formData, name: e.target.value})}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
/>
</div>
<div className="form-group">
<label className="form-label" htmlFor="email">Email Address</label>
<input
id="email"
type="email"
className="input"
placeholder="you@example.com"
required
<div className="form-group" style={{ marginBottom: '16px' }}>
<label className="form-label" htmlFor="email" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Email Address *
</label>
<input
id="email"
type="email"
className="artha-form-input"
placeholder="you@example.com"
required
value={formData.email}
onChange={e => setFormData({...formData, email: e.target.value})}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
/>
</div>
<div className="form-group">
<label className="form-label" htmlFor="phone">Phone Number <span style={{color:'var(--muted)', fontWeight:400}}>(optional)</span></label>
<input
id="phone"
type="tel"
className="input"
placeholder="+1 (555) 000-0000"
<div className="form-group" style={{ marginBottom: '16px' }}>
<label className="form-label" htmlFor="phone" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Phone Number <span style={{ color: '#8C9BA5', fontWeight: 400 }}>(optional)</span>
</label>
<input
id="phone"
type="tel"
className="artha-form-input"
placeholder="Phone Number"
value={formData.phone}
onChange={e => setFormData({...formData, phone: e.target.value})}
onChange={(e) => setFormData({ ...formData, phone: e.target.value })}
/>
</div>
<div className="form-group">
<label className="form-label" htmlFor="password">Password</label>
<div className="password-wrap">
<input
id="password"
type={showPassword ? 'text' : 'password'}
className="input"
placeholder="At least 8 characters"
required
style={{paddingRight:'56px'}}
<div className="form-group" style={{ marginBottom: '22px' }}>
<label className="form-label" htmlFor="password" style={{ display: 'block', fontSize: '12.5px', fontWeight: 600, color: '#0A2540', marginBottom: '6px' }}>
Password *
</label>
<div style={{ position: 'relative' }}>
<input
id="password"
type={showPassword ? 'text' : 'password'}
className="artha-form-input"
style={{ paddingRight: '60px', marginBottom: 0 }}
placeholder="Create a strong password"
required
value={formData.password}
onChange={e => setFormData({...formData, password: e.target.value})}
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
/>
<button
type="button"
className="password-toggle"
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
style={{
position: 'absolute',
right: '12px',
top: '50%',
transform: 'translateY(-50%)',
background: 'none',
border: 'none',
fontSize: '12px',
fontWeight: 600,
color: '#425466',
cursor: 'pointer'
}}
>
{showPassword ? 'Hide' : 'Show'}
</button>
</div>
</div>
<button
type="submit"
className="btn btn-primary w-full"
style={{borderRadius: 'var(--radius-sm)'}}
<button
type="submit"
className="artha-pill-btn artha-pill-primary"
style={{ width: '100%', padding: '12px 20px', fontSize: '14.5px' }}
disabled={loading}
>
{loading ? 'Creating account...' : 'Create Account'}
{loading ? 'Creating Account...' : 'Create Client Account'}
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>arrow_forward</span>
</button>
<div className="auth-links">
Already have an account? <Link to="/login" className="fancy-link">Sign In</Link>
</div>
</form>
<div className="auth-links">
Already have an account?{' '}
<Link to="/login" style={{ color: '#1D4ED8', fontWeight: 600, textDecoration: 'underline' }}>
Sign In
</Link>
</div>
</div>
</div>
</div>
+309 -133
View File
@@ -14,6 +14,7 @@ export default function UploadBusiness() {
const [docs, setDocs] = useState([]);
const [templates, setTemplates] = useState([]);
const [loading, setLoading] = useState(false);
const [isDragOver, setIsDragOver] = useState(false);
const fileInputRefs = useRef({});
const extraFileRef = useRef(null);
@@ -61,7 +62,8 @@ export default function UploadBusiness() {
const data = await res.json().catch(() => ({}));
showToast(data.detail || "Upload failed", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Upload failed due to network error", "error");
}
};
@@ -70,7 +72,7 @@ export default function UploadBusiness() {
setConfirmConfig({
isOpen: true,
title: "Delete Document",
message: "Delete this document?\nThis action cannot be undone.",
message: "Are you sure you want to delete this business document?\nThis action cannot be undone.",
isDestructive: true,
confirmText: "Delete",
onConfirm: async () => {
@@ -83,7 +85,8 @@ export default function UploadBusiness() {
} else {
showToast("Delete failed", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Delete failed", "error");
}
}
@@ -99,7 +102,8 @@ export default function UploadBusiness() {
} else {
showToast("Could not generate view link", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Could not generate view link", "error");
}
};
@@ -132,16 +136,18 @@ export default function UploadBusiness() {
body: JSON.stringify({ file_count: docs.length, doc_category: "Business" })
});
if (res.ok) {
showToast("Documents sent for approval", "success");
showToast("Business ledgers & statements transmitted to CPA squad", "success");
} else {
showToast("Failed to send for approval", "error");
showToast("Failed to transmit for approval", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Error sending for approval", "error");
}
};
const years = [new Date().getFullYear(), new Date().getFullYear() - 1, new Date().getFullYear() - 2];
const currentYear = new Date().getFullYear();
const years = [currentYear, currentYear - 1, currentYear - 2];
return (
<div>
@@ -149,45 +155,109 @@ export default function UploadBusiness() {
{...confirmConfig}
onCancel={() => setConfirmConfig(prev => ({ ...prev, isOpen: false }))}
/>
<div style={{marginBottom: '16px'}}>
<Link to="/dashboard" className="fancy-link" style={{fontSize: '14px', fontWeight: 500}}>← Back to Dashboard</Link>
</div>
<div className="page-heading">
<div>
<h1>Business Documents</h1>
<p className="page-meta">Upload your business tax documents securely</p>
</div>
<div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}>
<label className="form-label" style={{margin:0}}>Tax Year</label>
<select
className="select-input"
style={{width:'auto', padding:'8px 14px'}}
value={taxYear}
onChange={(e) => setTaxYear(e.target.value)}
>
{years.map(y => <option key={y} value={y}>{y}</option>)}
</select>
{/* Top Breadcrumb & Header */}
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '20px', flexWrap: 'wrap', gap: '14px' }}>
<Link
to="/dashboard"
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 14px', fontSize: '12.5px' }}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Return to Dashboard
</Link>
{/* Tax Year Selector */}
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<span style={{ fontSize: '13px', fontWeight: 600, color: '#0A2540' }}>Tax Filing Year:</span>
<div style={{ display: 'flex', gap: '6px' }}>
{years.map(y => (
<button
key={y}
type="button"
className={`artha-pill-btn ${taxYear === y ? 'artha-pill-primary' : 'artha-pill-outline'}`}
style={{ padding: '6px 14px', fontSize: '12px' }}
onClick={() => setTaxYear(y)}
>
TY {y}
</button>
))}
</div>
</div>
</div>
<div className="card" style={{marginBottom: '20px'}}>
<h3 style={{marginBottom: '16px'}}>Required Documents</h3>
<div id="docWrapper">
{/* Hero Banner */}
<div className="artha-portal-hero" style={{ padding: '24px 30px' }}>
<div className="artha-portal-hero-left">
<div className="artha-eyebrow-pill" style={{ marginBottom: '8px' }}>
<span className="dot"></span>
CORPORATE &amp; STATUTORY LEDGERS
</div>
<h1 style={{ fontSize: '26px' }}>Business Documents &amp; Statement Ingestion</h1>
<p style={{ fontSize: '14px' }}>
Upload raw bank statements, Form 1120-S / 1065 schedules, payroll summaries, and asset ledgers for Tax Year {taxYear}.
</p>
</div>
<div className="artha-portal-hero-badges">
<div className="artha-portal-badge green">
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>smart_toy</span>
<span>AI Statement to P&amp;L Enabled</span>
</div>
<div className="artha-portal-badge gold">
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>verified</span>
<span>{docs.length} File{docs.length === 1 ? '' : 's'} on Record</span>
</div>
</div>
</div>
{/* Required Documents Section */}
<div className="artha-portal-card">
<div className="artha-portal-card-header">
<div>
<h3 className="artha-portal-card-title">
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>account_balance</span>
Required Business Schedules &amp; Ledgers
</h3>
<p style={{ fontSize: '13.5px', color: '#425466', margin: '4px 0 0' }}>
Standard corporate returns and verification documentation for Form 1120, 1120-S, and 1065 partnerships.
</p>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
{loading ? (
<div className="empty-state">Loading templates...</div>
<div style={{ padding: '36px', textAlign: 'center', color: '#425466' }}>
<span className="material-symbols-outlined" style={{ fontSize: '28px', animation: 'spin 1s infinite' }}>sync</span>
<p style={{ marginTop: '8px', fontSize: '13.5px' }}>Loading business requirements for TY {taxYear}...</p>
</div>
) : templates.length === 0 ? (
<div className="empty-state">No required documents for this tax year.</div>
<div style={{ padding: '36px', textAlign: 'center', color: '#425466', background: '#F6F9FC', borderRadius: '14px' }}>
No statutory templates assigned for this business tax year yet. You can upload custom ledgers in the section below.
</div>
) : templates.map((dt, i) => {
const uploaded = docs.filter(d => d.doc_type === dt.name);
const latestDoc = uploaded[0] || null;
const isRejected = latestDoc?.review_status === 'rejected';
const isApproved = latestDoc?.review_status === 'approved';
const isFiled = latestDoc?.review_status === 'filed';
return (
<div
className="doc-slot fade-up"
key={i}
style={{ animationDelay: `${i * 0.04}s`, borderLeft: isRejected ? '3px solid #dc3545' : isApproved || isFiled ? '3px solid #2c7a5b' : 'none' }}
<div
key={i}
style={{
background: isRejected ? '#FFF9F9' : '#FFFFFF',
border: isRejected ? '1px solid rgba(220,38,38,0.3)' : '1px solid rgba(10,37,64,0.08)',
borderLeft: isRejected ? '4px solid #DC2626' : isApproved || isFiled ? '4px solid #047857' : '4px solid rgba(10,37,64,0.15)',
borderRadius: '14px',
padding: '16px 20px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: '16px',
flexWrap: 'wrap',
transition: 'all 0.2s ease'
}}
onDragOver={(e) => e.preventDefault()}
onDrop={(e) => {
e.preventDefault();
@@ -200,42 +270,60 @@ export default function UploadBusiness() {
}
}}
>
<div className="doc-slot-info">
<div className="doc-slot-name">{i+1}. {dt.name}</div>
<div className="doc-slot-status">
<div style={{ flex: 1, minWidth: '240px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ fontSize: '14.5px', fontWeight: 600, color: '#0A2540' }}>
{i + 1}. {dt.name}
</span>
</div>
<div style={{ marginTop: '6px' }}>
{isRejected ? (
<div>
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#fdecea', color:'#c0392b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>cancel</span> REJECTED
<span className="artha-status-pill artha-status-rejected">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>cancel</span>
Rejected by CPA
</span>
{latestDoc.review_note && (
<div style={{fontSize:'12px', color:'#c0392b', marginTop:'5px', fontStyle:'italic', maxWidth:'260px'}}>
⚠️ Reason: "{latestDoc.review_note}"
<div style={{ fontSize: '12px', color: '#DC2626', marginTop: '4px', fontStyle: 'italic' }}>
Reason: &ldquo;{latestDoc.review_note}&rdquo;
</div>
)}
<div style={{fontSize:'11px', color:'var(--muted)', marginTop:'3px'}}>Please correct and re-upload below.</div>
</div>
) : isApproved ? (
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#edf7f2', color:'#2c7a5b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>check_circle</span> APPROVED
<span className="artha-status-pill artha-status-approved">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>check_circle</span>
Verified &amp; Approved
</span>
) : isFiled ? (
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#edf7f2', color:'#2c7a5b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>inventory_2</span> FILED
<span className="artha-status-pill artha-status-approved">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>inventory_2</span>
Filed with IRS
</span>
) : uploaded.length ? (
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
<span className="artha-status-pill artha-status-pending">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>hourglass_top</span>
Under CPA Review
</span>
) : dt.download ? (
<a href={dt.download} target="_blank" rel="noopener noreferrer" className="btn-link" style={{ fontSize: '14px', color: 'var(--brand)', textDecoration: 'underline' }}>View Template</a>
<a
href={dt.download}
target="_blank"
rel="noopener noreferrer"
style={{ fontSize: '12.5px', color: '#1D4ED8', textDecoration: 'underline', fontWeight: 500 }}
>
Download Blank Template &rarr;
</a>
) : (
"Missing"
<span style={{ fontSize: '12px', color: '#425466' }}>Pending business upload</span>
)}
</div>
</div>
<div className="doc-slot-actions">
<input
type="file"
hidden
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' }}>
<input
type="file"
hidden
accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip"
ref={el => fileInputRefs.current[dt.name] = el}
onChange={(e) => {
@@ -245,31 +333,50 @@ export default function UploadBusiness() {
}
}}
/>
<div style={{display: 'flex', gap: '8px', alignItems: 'center', flexWrap:'wrap'}}>
{dt.download && (
<a href={dt.download} target="_blank" rel="noreferrer" className="btn btn-secondary btn-sm" style={{borderRadius: 'var(--radius-pill)', padding: '4px 12px', display: 'flex', alignItems: 'center', gap: '4px'}}>
<span className="material-symbols-outlined" style={{fontSize: '16px'}}>download</span> Template
</a>
)}
{/* Show Upload button if no doc OR doc is rejected (re-upload allowed) */}
{(!uploaded.length || isRejected) && (
<button
className={`btn btn-sm ${isRejected ? 'btn-primary' : 'btn-upload-pill'}`}
style={isRejected ? {background:'#2c7a5b', borderColor:'#2c7a5b', color:'#fff', borderRadius:'var(--radius-pill)'} : {}}
onClick={() => fileInputRefs.current[dt.name].click()}
>
{isRejected ? '🔄 Re-upload' : 'Upload'}
</button>
)}
</div>
{dt.download && (
<a
href={dt.download}
target="_blank"
rel="noreferrer"
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 12px', fontSize: '12px' }}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>download</span>
Template
</a>
)}
{(!uploaded.length || isRejected) && (
<button
className="artha-pill-btn artha-pill-primary"
style={{ padding: '6px 14px', fontSize: '12px' }}
onClick={() => fileInputRefs.current[dt.name].click()}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>upload</span>
{isRejected ? 'Re-upload Schedule' : 'Upload Schedule'}
</button>
)}
{uploaded.map(doc => (
<div key={doc.id} style={{display:'flex', flexDirection:'column', gap:'8px', alignItems:'flex-end', marginTop:'4px'}}>
<div style={{display:'flex', gap:'8px'}}>
<button className="btn btn-secondary btn-xs" style={{borderRadius:'var(--radius-sm)'}} onClick={() => viewDoc(doc.storage_key)}>View</button>
{!isApproved && !isFiled && (
<button className="btn btn-danger btn-xs" style={{borderRadius:'var(--radius-sm)'}} onClick={() => deleteDoc(doc.id)}>Delete</button>
)}
</div>
<div key={doc.id} style={{ display: 'flex', gap: '6px' }}>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '5px 10px', fontSize: '11.5px' }}
onClick={() => viewDoc(doc.storage_key)}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>visibility</span>
View
</button>
{!isApproved && !isFiled && (
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '5px 10px', fontSize: '11.5px', color: '#DC2626', borderColor: 'rgba(220,38,38,0.3)' }}
onClick={() => deleteDoc(doc.id)}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>delete</span>
</button>
)}
</div>
))}
</div>
@@ -279,83 +386,152 @@ export default function UploadBusiness() {
</div>
</div>
<div className="card">
<div className="flex-between" style={{marginBottom: '16px'}}>
{/* Additional Business Documents & Bank Statements Dropzone */}
<div className="artha-portal-card">
<div className="artha-portal-card-header">
<div>
<h3>Additional Documents</h3>
<p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary business documents</p>
<h3 className="artha-portal-card-title">
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>receipt_long</span>
Bank Statements, Ledgers &amp; Receipts Vault
</h3>
<p style={{ fontSize: '13.5px', color: '#425466', margin: '4px 0 0' }}>
Upload raw PDF checking statements, credit card logs, or payroll reports for automated reconciliation.
</p>
</div>
<label
className="btn btn-secondary btn-sm"
style={{borderRadius:'var(--radius-sm)', cursor:'pointer'}}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
extraFileRef.current?.click();
}
}}
<label
className="artha-pill-btn artha-pill-primary"
style={{ padding: '7px 16px', fontSize: '12.5px', cursor: 'pointer' }}
>
+ Choose Files
<input type="file" multiple hidden accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip" onChange={handleExtraUpload} />
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>add</span>
Browse &amp; Add Ledgers
<input
type="file"
multiple
hidden
accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip"
onChange={handleExtraUpload}
/>
</label>
</div>
<div
className="drop-area"
style={{ border:'2px dashed #cfc7ad', borderRadius:'var(--radius-md)', padding:'28px 20px', textAlign:'center', cursor:'pointer', background:'var(--card)' }}
{/* Drag Area */}
<div
className={`artha-dropzone ${isDragOver ? 'is-dragover' : ''}`}
onClick={() => extraFileRef.current?.click()}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
extraFileRef.current?.click();
}
}}
onDragOver={(e) => e.preventDefault()}
onDragEnter={(e) => { e.preventDefault(); setIsDragOver(true); }}
onDragOver={(e) => { e.preventDefault(); setIsDragOver(true); }}
onDragLeave={() => setIsDragOver(false)}
onDrop={(e) => {
e.preventDefault();
setIsDragOver(false);
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
const fakeEvent = { target: { files: e.dataTransfer.files } };
handleExtraUpload(fakeEvent);
}
}}
>
<div className="da-icon"><span className="material-symbols-outlined" style={{color: 'var(--brass)', fontSize: '32px'}}>folder</span></div>
<div className="da-title" style={{fontWeight: 600, color: 'var(--navy)', fontSize: '14px'}}>Drag & drop files here</div>
<div className="da-hint" style={{fontSize: '12px', color: 'var(--muted)'}}>or click to browse · PDF, JPG, PNG, WEBP, DOC, EXCEL · Max 10MB</div>
<div
style={{
width: '52px',
height: '52px',
borderRadius: '50%',
background: 'rgba(29, 78, 216, 0.08)',
color: '#1D4ED8',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
marginBottom: '12px'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '28px' }}>cloud_upload</span>
</div>
<div style={{ fontSize: '15px', fontWeight: 600, color: '#0A2540', marginBottom: '4px' }}>
Drag and drop business ledgers &amp; bank statements here
</div>
<div style={{ fontSize: '12.5px', color: '#425466' }}>
PDF, Excel (XLS/XLSX), CSV, PNG, JPG, ZIP &bull; Max 10MB per file
</div>
</div>
<input type="file" multiple hidden ref={extraFileRef} onChange={handleExtraUpload} />
<div className="upload-track mt-12">
{docs.filter(d => d.doc_type.startsWith("other")).map(doc => (
<div key={doc.id} style={{marginBottom:'6px'}}>
<div className="upload-track-item" style={{display:'flex', alignItems:'center', gap:'10px', padding:'8px 12px', borderRadius:'var(--radius-sm)', background:'var(--paper)', fontSize:'13px'}}>
<span className="material-symbols-outlined" style={{color:'var(--green)', fontSize:'18px'}}>check_circle</span>
<div className="uti-name" style={{flex:1}}>{doc.filename}</div>
<button className="btn btn-secondary btn-sm" style={{padding:'4px'}} onClick={() => viewDoc(doc.storage_key)}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>visibility</span>
</button>
<button className="btn btn-danger btn-sm" style={{padding:'4px'}} onClick={() => deleteDoc(doc.id)}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>delete</span>
</button>
{/* Uploaded Extra Documents Tracker */}
{docs.filter(d => d.doc_type.startsWith("other")).length > 0 && (
<div style={{ marginTop: '20px', display: 'flex', flexDirection: 'column', gap: '8px' }}>
<h5 style={{ fontSize: '12.5px', textTransform: 'uppercase', letterSpacing: '0.06em', color: '#425466', margin: '0 0 6px' }}>
Uploaded Supplementary Ledgers ({docs.filter(d => d.doc_type.startsWith("other")).length}):
</h5>
{docs.filter(d => d.doc_type.startsWith("other")).map(doc => (
<div
key={doc.id}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '10px 16px',
borderRadius: '12px',
background: '#F6F9FC',
border: '1px solid rgba(10, 37, 64, 0.07)',
fontSize: '13px'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', minWidth: 0, flex: 1 }}>
<span className="material-symbols-outlined" style={{ color: '#047857', fontSize: '18px' }}>check_circle</span>
<span style={{ fontWeight: 500, color: '#0A2540', wordBreak: 'break-all' }}>{doc.filename}</span>
</div>
<div style={{ display: 'flex', gap: '6px' }}>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '4px 10px', fontSize: '11px' }}
onClick={() => viewDoc(doc.storage_key)}
>
View
</button>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '4px 10px', fontSize: '11px', color: '#DC2626', borderColor: 'rgba(220,38,38,0.25)' }}
onClick={() => deleteDoc(doc.id)}
>
Delete
</button>
</div>
</div>
</div>
))}
</div>
))}
</div>
)}
</div>
<div className="card mt-20" style={{marginTop: '20px'}}>
<div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}>
<div>
<h3 style={{marginBottom:'4px'}}>Finished Uploading?</h3>
<p className="text-sm" style={{margin:0}}>Send your business documents for review.</p>
</div>
<button className="btn btn-primary" onClick={notifyComplete}>
<span className="material-symbols-outlined">send</span>
Send for Approval
</button>
{/* Completion & Submit Banner */}
<div
className="artha-portal-card"
style={{
background: '#0A2540',
color: '#FFFFFF',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
flexWrap: 'wrap',
gap: '18px'
}}
>
<div>
<h3 style={{ fontSize: '18px', color: '#FFFFFF', margin: '0 0 4px', fontFamily: 'var(--font-display)' }}>
Finished Uploading Business Records?
</h3>
<p style={{ fontSize: '13px', color: 'rgba(255,255,255,0.7)', margin: 0 }}>
Notify your advisory team that all corporate schedules and bank statements have been uploaded for TY {taxYear}.
</p>
</div>
<button
className="artha-pill-btn artha-pill-primary"
style={{ background: '#1D4ED8', borderColor: '#1D4ED8', padding: '10px 22px' }}
onClick={notifyComplete}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>send</span>
Transmit for CPA Processing
</button>
</div>
</div>
);
+309 -133
View File
@@ -14,6 +14,7 @@ export default function UploadPersonal() {
const [docs, setDocs] = useState([]);
const [templates, setTemplates] = useState([]);
const [loading, setLoading] = useState(false);
const [isDragOver, setIsDragOver] = useState(false);
const fileInputRefs = useRef({});
const extraFileRef = useRef(null);
@@ -63,7 +64,8 @@ export default function UploadPersonal() {
const data = await res.json().catch(() => ({}));
showToast(data.detail || "Upload failed", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Upload failed due to network error", "error");
}
};
@@ -72,7 +74,7 @@ export default function UploadPersonal() {
setConfirmConfig({
isOpen: true,
title: "Delete Document",
message: "Delete this document?\nThis action cannot be undone.",
message: "Are you sure you want to delete this document?\nThis action cannot be undone.",
isDestructive: true,
confirmText: "Delete",
onConfirm: async () => {
@@ -85,7 +87,8 @@ export default function UploadPersonal() {
} else {
showToast("Delete failed", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Delete failed", "error");
}
}
@@ -101,7 +104,8 @@ export default function UploadPersonal() {
} else {
showToast("Could not generate view link", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Could not generate view link", "error");
}
};
@@ -134,16 +138,18 @@ export default function UploadPersonal() {
body: JSON.stringify({ file_count: docs.length, doc_category: "Personal" })
});
if (res.ok) {
showToast("Documents sent for approval", "success");
showToast("Personal documents transmitted to CPA review squad", "success");
} else {
showToast("Failed to send for approval", "error");
showToast("Failed to transmit for approval", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Error sending for approval", "error");
}
};
const years = [new Date().getFullYear(), new Date().getFullYear() - 1, new Date().getFullYear() - 2];
const currentYear = new Date().getFullYear();
const years = [currentYear, currentYear - 1, currentYear - 2];
return (
<div>
@@ -151,45 +157,109 @@ export default function UploadPersonal() {
{...confirmConfig}
onCancel={() => setConfirmConfig(prev => ({ ...prev, isOpen: false }))}
/>
<div style={{marginBottom: '16px'}}>
<Link to="/dashboard" className="fancy-link" style={{fontSize: '14px', fontWeight: 500}}>← Back to Dashboard</Link>
</div>
<div className="page-heading">
<div>
<h1>Personal Documents</h1>
<p className="page-meta">Upload your personal tax documents securely</p>
</div>
<div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}>
<label className="form-label" style={{margin:0}}>Tax Year</label>
<select
className="select-input"
style={{width:'auto', padding:'8px 14px'}}
value={taxYear}
onChange={(e) => setTaxYear(e.target.value)}
>
{years.map(y => <option key={y} value={y}>{y}</option>)}
</select>
{/* Top Breadcrumb & Header */}
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '20px', flexWrap: 'wrap', gap: '14px' }}>
<Link
to="/dashboard"
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 14px', fontSize: '12.5px' }}
>
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_back</span>
Return to Dashboard
</Link>
{/* Tax Year Selector */}
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<span style={{ fontSize: '13px', fontWeight: 600, color: '#0A2540' }}>Tax Filing Year:</span>
<div style={{ display: 'flex', gap: '6px' }}>
{years.map(y => (
<button
key={y}
type="button"
className={`artha-pill-btn ${taxYear === y ? 'artha-pill-primary' : 'artha-pill-outline'}`}
style={{ padding: '6px 14px', fontSize: '12px' }}
onClick={() => setTaxYear(y)}
>
TY {y}
</button>
))}
</div>
</div>
</div>
<div className="card" style={{marginBottom: '20px'}}>
<h3 style={{marginBottom: '16px'}}>Required Documents</h3>
<div id="docWrapper">
{/* Hero Banner */}
<div className="artha-portal-hero" style={{ padding: '24px 30px' }}>
<div className="artha-portal-hero-left">
<div className="artha-eyebrow-pill" style={{ marginBottom: '8px' }}>
<span className="dot"></span>
INDIVIDUAL &amp; FAMILY COMPLIANCE
</div>
<h1 style={{ fontSize: '26px' }}>Personal Tax Documents Vault</h1>
<p style={{ fontSize: '14px' }}>
Upload government forms (W-2, 1099, K-1), identification, mortgage interest statements, and overseas accounts (FBAR / FATCA) for Tax Year {taxYear}.
</p>
</div>
<div className="artha-portal-hero-badges">
<div className="artha-portal-badge green">
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>verified</span>
<span>{docs.length} Document{docs.length === 1 ? '' : 's'} on Record</span>
</div>
<div className="artha-portal-badge">
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>lock</span>
<span>256-Bit Encrypted</span>
</div>
</div>
</div>
{/* Required Documents Section */}
<div className="artha-portal-card">
<div className="artha-portal-card-header">
<div>
<h3 className="artha-portal-card-title">
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>checklist</span>
Required Statutory Forms &amp; Schedules
</h3>
<p style={{ fontSize: '13.5px', color: '#425466', margin: '4px 0 0' }}>
Standard filings required by the IRS and State Revenue departments for individual returns.
</p>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
{loading ? (
<div className="empty-state">Loading templates...</div>
<div style={{ padding: '36px', textAlign: 'center', color: '#425466' }}>
<span className="material-symbols-outlined" style={{ fontSize: '28px', animation: 'spin 1s infinite' }}>sync</span>
<p style={{ marginTop: '8px', fontSize: '13.5px' }}>Loading tax requirements for TY {taxYear}...</p>
</div>
) : templates.length === 0 ? (
<div className="empty-state">No required documents for this tax year.</div>
<div style={{ padding: '36px', textAlign: 'center', color: '#425466', background: '#F6F9FC', borderRadius: '14px' }}>
No statutory templates assigned for this tax year yet. You can upload files in the section below.
</div>
) : templates.map((dt, i) => {
const uploaded = docs.filter(d => d.doc_type === dt.name);
const latestDoc = uploaded[0] || null;
const isRejected = latestDoc?.review_status === 'rejected';
const isApproved = latestDoc?.review_status === 'approved';
const isFiled = latestDoc?.review_status === 'filed';
return (
<div
className="doc-slot fade-up"
key={i}
style={{ animationDelay: `${i * 0.04}s`, borderLeft: isRejected ? '3px solid #dc3545' : isApproved || isFiled ? '3px solid #2c7a5b' : 'none' }}
<div
key={i}
style={{
background: isRejected ? '#FFF9F9' : '#FFFFFF',
border: isRejected ? '1px solid rgba(220,38,38,0.3)' : '1px solid rgba(10,37,64,0.08)',
borderLeft: isRejected ? '4px solid #DC2626' : isApproved || isFiled ? '4px solid #047857' : '4px solid rgba(10,37,64,0.15)',
borderRadius: '14px',
padding: '16px 20px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: '16px',
flexWrap: 'wrap',
transition: 'all 0.2s ease'
}}
onDragOver={(e) => e.preventDefault()}
onDrop={(e) => {
e.preventDefault();
@@ -202,42 +272,60 @@ export default function UploadPersonal() {
}
}}
>
<div className="doc-slot-info">
<div className="doc-slot-name">{i+1}. {dt.name}</div>
<div className="doc-slot-status">
<div style={{ flex: 1, minWidth: '240px' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ fontSize: '14.5px', fontWeight: 600, color: '#0A2540' }}>
{i + 1}. {dt.name}
</span>
</div>
<div style={{ marginTop: '6px' }}>
{isRejected ? (
<div>
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#fdecea', color:'#c0392b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>cancel</span> REJECTED
<span className="artha-status-pill artha-status-rejected">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>cancel</span>
Rejected by CPA
</span>
{latestDoc.review_note && (
<div style={{fontSize:'12px', color:'#c0392b', marginTop:'5px', fontStyle:'italic', maxWidth:'260px'}}>
⚠️ Reason: "{latestDoc.review_note}"
<div style={{ fontSize: '12px', color: '#DC2626', marginTop: '4px', fontStyle: 'italic' }}>
Reason: &ldquo;{latestDoc.review_note}&rdquo;
</div>
)}
<div style={{fontSize:'11px', color:'var(--muted)', marginTop:'3px'}}>Please correct and re-upload below.</div>
</div>
) : isApproved ? (
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#edf7f2', color:'#2c7a5b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>check_circle</span> APPROVED
<span className="artha-status-pill artha-status-approved">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>check_circle</span>
Verified &amp; Approved
</span>
) : isFiled ? (
<span style={{display:'inline-flex', alignItems:'center', gap:'5px', background:'#edf7f2', color:'#2c7a5b', padding:'3px 10px', borderRadius:'20px', fontSize:'12px', fontWeight:700}}>
<span className="material-symbols-outlined" style={{fontSize:'13px'}}>inventory_2</span> FILED
<span className="artha-status-pill artha-status-approved">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>inventory_2</span>
Filed with IRS
</span>
) : uploaded.length ? (
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
<span className="artha-status-pill artha-status-pending">
<span className="material-symbols-outlined" style={{ fontSize: '13px' }}>hourglass_top</span>
Under CPA Review
</span>
) : dt.download ? (
<a href={dt.download} target="_blank" rel="noopener noreferrer" className="btn-link" style={{ fontSize: '14px', color: 'var(--brand)', textDecoration: 'underline' }}>View Template</a>
<a
href={dt.download}
target="_blank"
rel="noopener noreferrer"
style={{ fontSize: '12.5px', color: '#1D4ED8', textDecoration: 'underline', fontWeight: 500 }}
>
Download Blank Template PDF &rarr;
</a>
) : (
"Missing"
<span style={{ fontSize: '12px', color: '#425466' }}>Pending client upload</span>
)}
</div>
</div>
<div className="doc-slot-actions">
<input
type="file"
hidden
<div style={{ display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' }}>
<input
type="file"
hidden
accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip"
ref={el => fileInputRefs.current[dt.name] = el}
onChange={(e) => {
@@ -247,31 +335,50 @@ export default function UploadPersonal() {
}
}}
/>
<div style={{display: 'flex', gap: '8px', alignItems: 'center', flexWrap:'wrap'}}>
{dt.download && (
<a href={dt.download} target="_blank" rel="noreferrer" className="btn btn-secondary btn-sm" style={{borderRadius: 'var(--radius-pill)', padding: '4px 12px', display: 'flex', alignItems: 'center', gap: '4px'}}>
<span className="material-symbols-outlined" style={{fontSize: '16px'}}>download</span> Template
</a>
)}
{/* Show Upload button if no doc OR doc is rejected (re-upload allowed) */}
{(!uploaded.length || isRejected) && (
<button
className={`btn btn-sm ${isRejected ? 'btn-primary' : 'btn-upload-pill'}`}
style={isRejected ? {background:'#2c7a5b', borderColor:'#2c7a5b', color:'#fff', borderRadius:'var(--radius-pill)'} : {}}
onClick={() => fileInputRefs.current[dt.name].click()}
>
{isRejected ? '🔄 Re-upload' : 'Upload'}
</button>
)}
</div>
{dt.download && (
<a
href={dt.download}
target="_blank"
rel="noreferrer"
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 12px', fontSize: '12px' }}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>download</span>
Template
</a>
)}
{(!uploaded.length || isRejected) && (
<button
className="artha-pill-btn artha-pill-primary"
style={{ padding: '6px 14px', fontSize: '12px' }}
onClick={() => fileInputRefs.current[dt.name].click()}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>upload</span>
{isRejected ? 'Re-upload Form' : 'Upload Form'}
</button>
)}
{uploaded.map(doc => (
<div key={doc.id} style={{display:'flex', flexDirection:'column', gap:'8px', alignItems:'flex-end', marginTop:'4px'}}>
<div style={{display:'flex', gap:'8px'}}>
<button className="btn btn-secondary btn-xs" style={{borderRadius:'var(--radius-sm)'}} onClick={() => viewDoc(doc.storage_key)}>View</button>
{!isApproved && !isFiled && (
<button className="btn btn-danger btn-xs" style={{borderRadius:'var(--radius-sm)'}} onClick={() => deleteDoc(doc.id)}>Delete</button>
)}
</div>
<div key={doc.id} style={{ display: 'flex', gap: '6px' }}>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '5px 10px', fontSize: '11.5px' }}
onClick={() => viewDoc(doc.storage_key)}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>visibility</span>
View
</button>
{!isApproved && !isFiled && (
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '5px 10px', fontSize: '11.5px', color: '#DC2626', borderColor: 'rgba(220,38,38,0.3)' }}
onClick={() => deleteDoc(doc.id)}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>delete</span>
</button>
)}
</div>
))}
</div>
@@ -281,83 +388,152 @@ export default function UploadPersonal() {
</div>
</div>
<div className="card">
<div className="flex-between" style={{marginBottom: '16px'}}>
{/* Additional Documents Drag & Drop Vault */}
<div className="artha-portal-card">
<div className="artha-portal-card-header">
<div>
<h3>Additional Documents</h3>
<p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary personal documents</p>
<h3 className="artha-portal-card-title">
<span className="material-symbols-outlined" style={{ color: '#1D4ED8' }}>cloud_upload</span>
Supplementary Personal Files &amp; Receipts
</h3>
<p style={{ fontSize: '13.5px', color: '#425466', margin: '4px 0 0' }}>
Drag and drop any extra statements, medical expenses, foreign disclosures, or receipts.
</p>
</div>
<label
className="btn btn-secondary btn-sm"
style={{borderRadius:'var(--radius-sm)', cursor:'pointer'}}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
extraFileRef.current?.click();
}
}}
<label
className="artha-pill-btn artha-pill-primary"
style={{ padding: '7px 16px', fontSize: '12.5px', cursor: 'pointer' }}
>
+ Choose Files
<input type="file" multiple hidden accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip" onChange={handleExtraUpload} />
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>add</span>
Browse &amp; Add Files
<input
type="file"
multiple
hidden
accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.zip"
onChange={handleExtraUpload}
/>
</label>
</div>
<div
className="drop-area"
style={{ border:'2px dashed #cfc7ad', borderRadius:'var(--radius-md)', padding:'28px 20px', textAlign:'center', cursor:'pointer', background:'var(--card)' }}
{/* Drag Area */}
<div
className={`artha-dropzone ${isDragOver ? 'is-dragover' : ''}`}
onClick={() => extraFileRef.current?.click()}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
extraFileRef.current?.click();
}
}}
onDragOver={(e) => e.preventDefault()}
onDragEnter={(e) => { e.preventDefault(); setIsDragOver(true); }}
onDragOver={(e) => { e.preventDefault(); setIsDragOver(true); }}
onDragLeave={() => setIsDragOver(false)}
onDrop={(e) => {
e.preventDefault();
setIsDragOver(false);
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
const fakeEvent = { target: { files: e.dataTransfer.files } };
handleExtraUpload(fakeEvent);
}
}}
>
<div className="da-icon"><span className="material-symbols-outlined" style={{color: 'var(--brass)', fontSize: '32px'}}>folder</span></div>
<div className="da-title" style={{fontWeight: 600, color: 'var(--navy)', fontSize: '14px'}}>Drag & drop files here</div>
<div className="da-hint" style={{fontSize: '12px', color: 'var(--muted)'}}>or click to browse · PDF, JPG, PNG, WEBP, DOC, DOCX · Max 10MB</div>
<div
style={{
width: '52px',
height: '52px',
borderRadius: '50%',
background: 'rgba(29, 78, 216, 0.08)',
color: '#1D4ED8',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
marginBottom: '12px'
}}
>
<span className="material-symbols-outlined" style={{ fontSize: '28px' }}>upload_file</span>
</div>
<div style={{ fontSize: '15px', fontWeight: 600, color: '#0A2540', marginBottom: '4px' }}>
Drag and drop files here, or click to browse
</div>
<div style={{ fontSize: '12.5px', color: '#425466' }}>
Supported formats: PDF, PNG, JPG, WEBP, DOCX, XLSX, ZIP &bull; Max 10MB per file
</div>
</div>
<input type="file" multiple hidden ref={extraFileRef} onChange={handleExtraUpload} />
<div className="upload-track mt-12">
{docs.filter(d => d.doc_type.startsWith("other")).map(doc => (
<div key={doc.id} style={{marginBottom:'6px'}}>
<div className="upload-track-item" style={{display:'flex', alignItems:'center', gap:'10px', padding:'8px 12px', borderRadius:'var(--radius-sm)', background:'var(--paper)', fontSize:'13px'}}>
<span className="material-symbols-outlined" style={{color:'var(--green)', fontSize:'18px'}}>check_circle</span>
<div className="uti-name" style={{flex:1}}>{doc.filename}</div>
<button className="btn btn-secondary btn-sm" style={{padding:'4px'}} onClick={() => viewDoc(doc.storage_key)}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>visibility</span>
</button>
<button className="btn btn-danger btn-sm" style={{padding:'4px'}} onClick={() => deleteDoc(doc.id)}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>delete</span>
</button>
{/* Uploaded Extra Documents Tracker */}
{docs.filter(d => d.doc_type.startsWith("other")).length > 0 && (
<div style={{ marginTop: '20px', display: 'flex', flexDirection: 'column', gap: '8px' }}>
<h5 style={{ fontSize: '12.5px', textTransform: 'uppercase', letterSpacing: '0.06em', color: '#425466', margin: '0 0 6px' }}>
Uploaded Supplemental Documents ({docs.filter(d => d.doc_type.startsWith("other")).length}):
</h5>
{docs.filter(d => d.doc_type.startsWith("other")).map(doc => (
<div
key={doc.id}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '10px 16px',
borderRadius: '12px',
background: '#F6F9FC',
border: '1px solid rgba(10, 37, 64, 0.07)',
fontSize: '13px'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', minWidth: 0, flex: 1 }}>
<span className="material-symbols-outlined" style={{ color: '#047857', fontSize: '18px' }}>check_circle</span>
<span style={{ fontWeight: 500, color: '#0A2540', wordBreak: 'break-all' }}>{doc.filename}</span>
</div>
<div style={{ display: 'flex', gap: '6px' }}>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '4px 10px', fontSize: '11px' }}
onClick={() => viewDoc(doc.storage_key)}
>
View
</button>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '4px 10px', fontSize: '11px', color: '#DC2626', borderColor: 'rgba(220,38,38,0.25)' }}
onClick={() => deleteDoc(doc.id)}
>
Delete
</button>
</div>
</div>
</div>
))}
</div>
))}
</div>
)}
</div>
<div className="card mt-20" style={{marginTop: '20px'}}>
<div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}>
<div>
<h3 style={{marginBottom:'4px'}}>Finished Uploading?</h3>
<p className="text-sm" style={{margin:0}}>Send your personal documents for review.</p>
</div>
<button className="btn btn-primary" onClick={notifyComplete}>
<span className="material-symbols-outlined">send</span>
Send for Approval
</button>
{/* Completion & Submit Banner */}
<div
className="artha-portal-card"
style={{
background: '#0A2540',
color: '#FFFFFF',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
flexWrap: 'wrap',
gap: '18px'
}}
>
<div>
<h3 style={{ fontSize: '18px', color: '#FFFFFF', margin: '0 0 4px', fontFamily: 'var(--font-display)' }}>
Finished Uploading Personal Records?
</h3>
<p style={{ fontSize: '13px', color: 'rgba(255,255,255,0.7)', margin: 0 }}>
Notify your advisory team that all W-2s, 1099s, and foreign assets have been uploaded for TY {taxYear}.
</p>
</div>
<button
className="artha-pill-btn artha-pill-primary"
style={{ background: '#1D4ED8', borderColor: '#1D4ED8', padding: '10px 22px' }}
onClick={notifyComplete}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>send</span>
Transmit for CPA Processing
</button>
</div>
</div>
);
+545 -161
View File
@@ -1,7 +1,8 @@
import { useState, useEffect, useCallback } from 'react';
import React, { useState, useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import { useToast } from '../context/ToastContext';
import CountUp from '../components/CountUp';
export default function UserDashboard() {
const { user, authFetch } = useAuth();
@@ -13,37 +14,11 @@ export default function UserDashboard() {
const [loadingDocs, setLoadingDocs] = useState(false);
const [docLoading, setDocLoading] = useState(false);
const [engagementLink, setEngagementLink] = useState(null);
// Track which doc rows have the AI summary panel open
const [expandedSummary, setExpandedSummary] = useState({});
const [searchQuery, setSearchQuery] = useState("");
const [searchResults, setSearchResults] = useState([]);
const [isSearching, setIsSearching] = useState(false);
const [deadlines, setDeadlines] = useState([]);
// Reject comment panel for admin docs: { docId, note }
const [rejectPanel, setRejectPanel] = useState(null);
// ── declare callbacks BEFORE the effects that reference them ──
const handleSearch = async (e) => {
e.preventDefault();
if (!searchQuery.trim()) return;
setIsSearching(true);
try {
const res = await authFetch(`/api/search/semantic?q=${encodeURIComponent(searchQuery)}`);
if (res.ok) {
setSearchResults(await res.json());
} else {
showToast("Search failed", "error");
}
} catch (err) {
console.error(err);
showToast("Search failed", "error");
} finally {
setIsSearching(false);
}
};
const checkEngagement = useCallback(async () => {
try {
const res = await authFetch("/api/auth/me");
@@ -61,7 +36,6 @@ export default function UserDashboard() {
if (tpls && tpls.length > 0) {
setEngagementLink(tpls[0].download);
} else {
// Fallback static link if no template is defined
setEngagementLink("/Engagement_Letter_Template.pdf");
}
} else {
@@ -87,10 +61,23 @@ export default function UserDashboard() {
}
}, [authFetch]);
const loadDeadlines = useCallback(async () => {
try {
const res = await authFetch("/api/review/my-deadlines");
if (res.ok) {
const data = await res.json();
setDeadlines(Array.isArray(data) ? data : []);
}
} catch (err) {
console.error("Failed to load deadlines:", err);
}
}, [authFetch]);
useEffect(() => {
checkEngagement();
loadAdminDocs();
}, [checkEngagement, loadAdminDocs]);
loadDeadlines();
}, [checkEngagement, loadAdminDocs, loadDeadlines]);
// Poll every 15s while any doc still has ai_summary === null (backend still processing)
useEffect(() => {
@@ -115,7 +102,8 @@ export default function UserDashboard() {
} else {
setEngagementChecked(false);
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
setEngagementChecked(false);
}
};
@@ -129,12 +117,12 @@ export default function UserDashboard() {
} else {
showToast("Could not generate view link", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Could not generate view link", "error");
}
};
const downloadDoc = async (storageKey, originalFilename) => {
try {
const res = await authFetch(`/api/upload/view-url?key=${encodeURIComponent(storageKey)}`);
@@ -175,7 +163,8 @@ export default function UserDashboard() {
} else {
showToast("Failed to submit response", "error");
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
showToast("Network error", "error");
} finally {
setDocLoading(false);
@@ -186,207 +175,602 @@ export default function UserDashboard() {
setRejectPanel({ docId, note: '' });
};
// ── Derived Numbers (Constraint 1) ─────────────────────────
const totalDeliverables = adminDocs.length;
const approvedDocs = adminDocs.filter(d => d.review_status === 'approved').length;
const pendingReviewDocs = adminDocs.filter(d => d.review_status === 'sent_for_approval' || d.review_status === 'pending' || !d.review_status).length;
const percentApproved = totalDeliverables > 0 ? Math.round((approvedDocs / totalDeliverables) * 100) : 0;
const toggleSummary = (docId) => {
setExpandedSummary(prev => ({ ...prev, [docId]: !prev[docId] }));
};
// Next deadline calculation
const upcomingDeadlines = deadlines.filter(d => typeof d.days_left === 'number');
const minDeadline = upcomingDeadlines.length > 0
? upcomingDeadlines.reduce((min, d) => d.days_left < min.days_left ? d : min, upcomingDeadlines[0])
: null;
const isAnyOverdue = deadlines.some(d => d.is_overdue || d.days_left < 0);
// SVG Progress Ring calculations (radius 38, perimeter = 2 * PI * 38 = 238.76)
const ringRadius = 38;
const ringCircumference = 2 * Math.PI * ringRadius;
const strokeDashoffset = totalDeliverables > 0
? ringCircumference - (percentApproved / 100) * ringCircumference
: ringCircumference;
return (
<div>
<div className="page-heading">
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
{/* ================= 1. EXECUTIVE AURORA HERO ================= */}
<section className="dash-hero dash-rise" style={{ '--i': 0 }}>
<div>
<h1>Welcome, {user?.name || user?.email?.split('@')[0]}</h1>
<p className="page-meta">Here is your dashboard overview</p>
</div>
</div>
<div className="dash-hero-eyebrow">
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>shield</span>
CLIENT ADVISORY VAULT
</div>
<h1 className="dash-hero-title">Welcome, {user?.name || user?.email?.split('@')[0]}</h1>
<p className="dash-hero-sub">
Secure workspace for document exchange, verified tax filings, and AI ledger reconciliation.
</p>
<div className="card fade-up">
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', flexWrap: 'wrap', gap: '16px', marginBottom: '16px'}}>
<div>
<h3 style={{margin: 0, marginBottom: '4px'}}>Engagement Letter</h3>
<p className="text-sm">Please review and acknowledge the engagement letter before uploading documents.</p>
<div className="dash-hero-badges">
<div className="dash-glass-pill">
<span className="material-symbols-outlined">verified</span>
<span>Active Client Vault</span>
</div>
<div className="dash-glass-pill">
<span className="material-symbols-outlined">calendar_today</span>
<span>TY {new Date().getFullYear()}</span>
</div>
<div className="dash-glass-pill">
<span className="material-symbols-outlined">lock</span>
<span>Secure Client Portal</span>
</div>
</div>
{engagementLink && (
<a
href={engagementLink}
target="_blank"
rel="noopener noreferrer"
className="btn btn-secondary btn-sm"
style={{display: 'flex', alignItems: 'center', gap: '6px', borderRadius: 'var(--radius-pill)'}}
>
<span className="material-symbols-outlined" style={{fontSize: '18px'}}>download</span>
Download PDF
</a>
)}
</div>
<label style={{
display: 'flex', alignItems: 'center', gap: '12px', padding: '16px',
background: 'var(--bg)', borderRadius: 'var(--radius-sm)', border: '1px solid var(--border)',
cursor: engagementDisabled ? 'not-allowed' : 'pointer'
}}>
<input
type="checkbox"
checked={engagementChecked}
disabled={engagementDisabled}
onChange={handleEngagementChange}
style={{width:'20px', height:'20px', cursor: engagementDisabled ? 'not-allowed' : 'pointer'}}
/>
<div>
<div style={{fontWeight: 600, color: 'var(--navy)'}}>I acknowledge the Engagement Letter</div>
<div style={{fontSize: '13px', color: 'var(--muted)', marginTop: '2px'}}>By checking this, you agree to our terms of service for the current tax year.</div>
</div>
</label>
</div>
<div style={{display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: '20px', marginTop: '20px'}}>
<div className="card fade-up" style={{animationDelay: '0.1s'}}>
<div style={{display:'flex', alignItems:'center', gap:'12px', marginBottom: '12px'}}>
<span className="material-symbols-outlined" style={{color:'var(--accent)', fontSize:'28px'}}>description</span>
<h3 style={{margin:0}}>Personal Documents</h3>
{/* Right: SVG Progress Ring */}
<div className="dash-progress-ring-wrap">
<svg className="dash-progress-ring-svg" viewBox="0 0 96 96">
<defs>
<linearGradient id="userRingGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stopColor="#3B82F6" />
<stop offset="100%" stopColor="#14B8A6" />
</linearGradient>
</defs>
<circle
className="dash-progress-ring-track"
cx="48"
cy="48"
r={ringRadius}
strokeWidth="7"
fill="none"
/>
{totalDeliverables > 0 && (
<circle
className="dash-progress-ring-bar"
cx="48"
cy="48"
r={ringRadius}
strokeWidth="7"
fill="none"
stroke="url(#userRingGrad)"
strokeDasharray={ringCircumference}
strokeDashoffset={strokeDashoffset}
/>
)}
</svg>
<div style={{
position: 'absolute',
marginTop: '26px',
fontFamily: 'var(--font-mono, monospace)',
fontSize: '18px',
fontWeight: 700,
color: '#FFFFFF'
}}>
{totalDeliverables === 0 ? '-' : <CountUp value={percentApproved} suffix="%" />}
</div>
<p className="text-sm text-muted" style={{marginBottom: '20px', minHeight: '40px'}}>Upload your W-2s, 1099s, IDs, and other individual tax forms.</p>
<div className="dash-progress-caption">
{totalDeliverables === 0 ? 'No deliverables yet' : 'Deliverables approved'}
</div>
</div>
</section>
{/* ================= 2. KPI STRIP ================= */}
<section className="dash-kpis dash-rise" style={{ '--i': 1 }}>
{/* Deliverables */}
<div className="dash-card dash-kpi-card">
<div className="dash-kpi-bar dash-kpi-bar--blue" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Deliverables</span>
<div className="dash-chip dash-chip--blue">
<span className="material-symbols-outlined">folder_open</span>
</div>
</div>
<div className="dash-kpi-value">
<CountUp value={totalDeliverables} />
</div>
</div>
{/* Needs your review */}
<div className="dash-card dash-kpi-card">
<div className="dash-kpi-bar dash-kpi-bar--amber" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Needs your review</span>
<div className="dash-chip dash-chip--amber">
<span className="material-symbols-outlined">pending_actions</span>
</div>
</div>
<div className="dash-kpi-value">
<CountUp value={pendingReviewDocs} />
{pendingReviewDocs > 0 && <span className="dash-pulse-dot" title="Action pending" />}
</div>
</div>
{/* Approved */}
<div className="dash-card dash-kpi-card">
<div className="dash-kpi-bar dash-kpi-bar--green" />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Approved</span>
<div className="dash-chip dash-chip--green">
<span className="material-symbols-outlined">task_alt</span>
</div>
</div>
<div className="dash-kpi-value">
<CountUp value={approvedDocs} />
</div>
</div>
{/* Next deadline */}
<div className="dash-card dash-kpi-card">
<div className={`dash-kpi-bar ${isAnyOverdue ? 'dash-kpi-bar--red' : 'dash-kpi-bar--blue'}`} />
<div className="dash-kpi-top">
<span className="dash-kpi-label">Next deadline</span>
<div className={`dash-chip ${isAnyOverdue ? 'dash-chip--red' : 'dash-chip--blue'}`}>
<span className="material-symbols-outlined">event</span>
</div>
</div>
<div className="dash-kpi-value" style={{ color: isAnyOverdue ? '#DC2626' : 'var(--ink, #0A2540)', fontSize: minDeadline ? '24px' : '30px' }}>
{!minDeadline ? (
'None'
) : minDeadline.is_overdue || minDeadline.days_left < 0 ? (
<span style={{ color: '#DC2626' }}>Overdue</span>
) : (
`${minDeadline.days_left}d`
)}
</div>
</div>
</section>
{/* ================= 3. URGENT FILING DEADLINES BANNER ================= */}
{deadlines && deadlines.some(d => d.days_left <= 7) && (
<section className={`dash-alert ${deadlines.some(d => d.is_overdue || d.days_left < 0) ? 'dash-alert--overdue' : ''} dash-rise`} style={{ '--i': 2 }}>
<div className="dash-alert-left">
<div className={`dash-chip ${deadlines.some(d => d.is_overdue || d.days_left < 0) ? 'dash-chip--red' : 'dash-chip--amber'}`}>
<span className="material-symbols-outlined">alarm</span>
</div>
<div>
<div style={{ fontWeight: 700, color: '#0A2540', fontSize: '14.5px', marginBottom: '3px' }}>
Action Required: Upcoming Statutory Tax Deadlines
</div>
<div style={{ fontSize: '13px', color: '#425466' }}>
{deadlines.filter(d => d.days_left <= 7).map((d, idx) => (
<span key={idx} style={{ marginRight: '16px', display: 'inline-block' }}>
<strong>{d.doc_type?.toUpperCase()}</strong>:{' '}
{d.is_overdue || d.days_left < 0 ? (
<span style={{ color: '#DC2626', fontWeight: 600 }}>Overdue by {Math.abs(d.days_left)} day(s)</span>
) : (
<span>Due in {d.days_left} day(s) ({new Date(d.deadline_date).toLocaleDateString()})</span>
)}
</span>
))}
</div>
</div>
</div>
</section>
)}
{/* ================= 4. ENGAGEMENT LETTER MODULE ================= */}
<section className="dash-card dash-rise" style={{ '--i': 3, padding: '24px 26px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px', flexWrap: 'wrap', marginBottom: '18px' }}>
<div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '18px', color: '#0A2540', margin: '0 0 4px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8', fontSize: '20px' }}>handshake</span>
Professional Engagement Letter
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: 0 }}>
Annual terms of engagement &amp; professional representation for Tax Year {new Date().getFullYear()}.
</p>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
{engagementDisabled ? (
<span className="dash-pill dash-pill--approved">
Acknowledged &amp; Verified
</span>
) : (
<span className="dash-pill dash-pill--pending">
Action Required
</span>
)}
{engagementLink && (
<a
href={engagementLink}
target="_blank"
rel="noopener noreferrer"
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 14px', fontSize: '12px' }}
>
<span className="material-symbols-outlined" style={{ fontSize: '15px' }}>download</span>
Download PDF
</a>
)}
</div>
</div>
<div style={{ background: '#F8FAFC', border: '1px solid #E2E8F0', borderRadius: '14px', padding: '16px 18px' }}>
<label style={{ display: 'flex', alignItems: 'center', gap: '14px', cursor: engagementDisabled ? 'default' : 'pointer' }}>
<input
type="checkbox"
checked={engagementChecked}
disabled={engagementDisabled}
onChange={handleEngagementChange}
style={{ width: '18px', height: '18px', accentColor: '#1D4ED8', cursor: engagementDisabled ? 'default' : 'pointer' }}
/>
<div style={{ flex: 1 }}>
<div style={{ fontWeight: 600, color: '#0A2540', fontSize: '13.5px' }}>
I acknowledge and accept the ABC CPA Engagement Agreement
</div>
<div style={{ fontSize: '12px', color: '#425466', marginTop: '2px' }}>
Authorizes our advisory team to prepare filings, represent your accounts, and maintain confidential financial ledgers.
</div>
</div>
<div className={`dash-chip ${engagementChecked ? 'dash-chip--green' : 'dash-chip--amber'}`} style={{ width: '32px', height: '32px', borderRadius: '50%' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>
{engagementChecked ? 'done' : 'hourglass_top'}
</span>
</div>
</label>
</div>
</section>
{/* ================= 5. PRACTICE VAULT ACTION HUB ================= */}
<section className="dash-vault-grid dash-rise" style={{ '--i': 4 }}>
{/* Personal Docs Card */}
<div className="dash-card dash-vault-card">
<div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '16px' }}>
<div className="dash-vault-tile dash-vault-tile--brand">
<span className="material-symbols-outlined" style={{ fontSize: '26px' }}>person</span>
</div>
<span className="dash-pill dash-pill--info">FORM 1040 / W-2</span>
</div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '19px', color: '#0A2540', margin: '0 0 6px' }}>
Personal Tax Documents
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: '0 0 14px', lineHeight: 1.5 }}>
Upload wage statements, 1099 contracts, government IDs, foreign bank disclosures (FBAR), and itemized deduction records.
</p>
<ul className="dash-vault-list">
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
W-2s, 1099-NEC, 1099-INT/DIV &amp; K-1 Pass-Throughs
</li>
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
FinCEN 114 (FBAR) &amp; Form 8938 Foreign Assets
</li>
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
Mortgage 1098 &amp; Charitable Deduction Receipts
</li>
</ul>
</div>
<button
className="btn btn-primary w-full"
className="artha-pill-btn artha-pill-primary dash-focusable"
style={{ width: '100%', justifyContent: 'center' }}
disabled={!engagementChecked}
onClick={() => navigate('/upload-personal')}
>
Go to Personal Upload
Access Personal Vault
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_forward</span>
</button>
</div>
<div className="card fade-up" style={{animationDelay: '0.2s'}}>
<div style={{display:'flex', alignItems:'center', gap:'12px', marginBottom: '12px'}}>
<span className="material-symbols-outlined" style={{color:'var(--orange)', fontSize:'28px'}}>business</span>
<h3 style={{margin:0}}>Business Documents</h3>
{/* Business Docs Card */}
<div className="dash-card dash-vault-card dash-vault-card--business">
<div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '16px' }}>
<div className="dash-vault-tile dash-vault-tile--success">
<span className="material-symbols-outlined" style={{ fontSize: '26px' }}>business_center</span>
</div>
<span className="dash-pill dash-pill--approved">1120-S / LLC / P&amp;L</span>
</div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '19px', color: '#0A2540', margin: '0 0 6px' }}>
Business &amp; Entity Documents
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: '0 0 14px', lineHeight: 1.5 }}>
Upload bank statements for AI reconciliation, payroll summaries, corporate agreements, and asset depreciation logs.
</p>
<ul className="dash-vault-list">
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
Instant AI Ingestion from Bank Statements (PDF/Image)
</li>
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
Form 1120, 1120-S &amp; 1065 Partnership Filings
</li>
<li>
<span className="material-symbols-outlined check-icon">check_circle</span>
Balance Sheet, Trial Balance &amp; QuickBooks Ledgers
</li>
</ul>
</div>
<p className="text-sm text-muted" style={{marginBottom: '20px', minHeight: '40px'}}>Upload corporate documents, bookkeeping ledgers, and business receipts.</p>
<button
className="btn btn-primary w-full"
className="artha-pill-btn artha-pill-dark dash-focusable"
style={{ width: '100%', justifyContent: 'center' }}
disabled={!engagementChecked}
onClick={() => navigate('/upload-business')}
>
Go to Business Upload
Access Business Vault
<span className="material-symbols-outlined" style={{ fontSize: '16px' }}>arrow_forward</span>
</button>
</div>
</div>
</section>
<div className="card fade-up" style={{animationDelay: '0.3s', marginTop: '20px'}}>
<h3 style={{marginBottom: '16px'}}>Admin Returns / Documents</h3>
<p className="text-sm" style={{marginBottom: '16px'}}>Documents and tax returns finalized by the admin.</p>
{/* ================= 6. AI ASSISTANT CARD (VIOLET) ================= */}
<section className="dash-ai dash-rise" style={{ '--i': 5 }}>
<div className="dash-ai-left">
<div className="dash-chip dash-chip--violet" style={{ width: '44px', height: '44px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '24px' }}>auto_awesome</span>
</div>
<div>
<div style={{ fontWeight: 700, color: 'var(--ink, #0A2540)', fontSize: '15.5px' }}>
Ask the AI assistant
</div>
<div style={{ color: '#425466', fontSize: '13px', marginTop: '2px' }}>
Get quick answers about your documents and filings.
</div>
</div>
</div>
<button
className="dash-ai-btn dash-focusable"
onClick={() => document.querySelector('.chatbot-fab')?.click()}
>
<span className="material-symbols-outlined" style={{ fontSize: '17px' }}>forum</span>
Open Assistant
</button>
</section>
{/* ================= 7. CERTIFIED DELIVERABLES TABLE ================= */}
<section className="dash-card dash-rise" style={{ '--i': 6, padding: '24px 26px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px', flexWrap: 'wrap', marginBottom: '16px' }}>
<div>
<h3 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '18px', color: '#0A2540', margin: '0 0 4px', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ color: '#1D4ED8', fontSize: '20px' }}>inventory_2</span>
Final Tax Returns &amp; CPA Deliverables
</h3>
<p style={{ fontSize: '13px', color: '#425466', margin: 0 }}>
Official tax filings, audit defense packages, and reconciled P&amp;L statements finalized by your advisory partner.
</p>
</div>
<div style={{ fontSize: '12px', color: '#425466', fontFamily: 'var(--font-mono, monospace)', fontWeight: 600 }}>
{adminDocs.length} deliverable{adminDocs.length === 1 ? '' : 's'} available
</div>
</div>
{loadingDocs ? (
<div className="empty-state">Loading documents...</div>
) : adminDocs.length === 0 ? (
<div className="empty-state">No documents have been provided by the admin yet.</div>
) : (
<div className="table-responsive">
<table className="admin-table">
<div className="dash-table-wrap">
<table className="dash-table">
<thead>
<tr>
<th>Document Name</th>
<th>Date Provided</th>
<th>Status</th>
<th>Actions</th>
<th>Document Label &amp; File</th>
<th>Date Prepared</th>
<th>Status &amp; Client Action</th>
<th style={{ textAlign: 'right' }}>Actions</th>
</tr>
</thead>
<tbody>
{[1, 2, 3, 4].map(n => (
<tr key={n}>
<td><div className="dash-skeleton" style={{ height: '18px', width: '65%' }} /></td>
<td><div className="dash-skeleton" style={{ height: '16px', width: '50%' }} /></td>
<td><div className="dash-skeleton" style={{ height: '22px', width: '90px' }} /></td>
<td style={{ textAlign: 'right' }}><div className="dash-skeleton" style={{ height: '28px', width: '80px', display: 'inline-block' }} /></td>
</tr>
))}
</tbody>
</table>
</div>
) : adminDocs.length === 0 ? (
<div className="dash-empty-state">
<div className="dash-empty-icon">
<span className="material-symbols-outlined" style={{ fontSize: '28px' }}>folder_open</span>
</div>
<h4 style={{ fontSize: '16px', color: '#0A2540', margin: 0 }}>No Deliverables Published Yet</h4>
<p style={{ fontSize: '13px', color: '#425466', maxWidth: '440px', margin: 0 }}>
Once our CPAs review your statements and prepare final returns, they will appear here for your review and approval.
</p>
</div>
) : (
<div className="dash-table-wrap">
<table className="dash-table">
<thead>
<tr>
<th>Document Label &amp; File</th>
<th>Date Prepared</th>
<th>Status &amp; Client Action</th>
<th style={{ textAlign: 'right' }}>Actions</th>
</tr>
</thead>
<tbody>
{adminDocs.map(doc => (
<>
<tr key={doc.id}>
<React.Fragment key={doc.id}>
<tr>
<td>
<div style={{fontWeight: 500, color: 'var(--navy)'}}>{doc.doc_label}</div>
<div className="text-sm text-muted">{doc.filename}</div>
</td>
<td>{new Date(doc.created_at).toLocaleDateString()}</td>
<td>
{doc.review_status ? (
<div>
<span className={`badge ${doc.review_status === 'approved' ? 'badge-green' : doc.review_status === 'rejected' ? 'badge-red' : 'badge-yellow'}`} style={{fontWeight:700}}>
{doc.review_status.toUpperCase()}
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
<div className="dash-chip dash-chip--blue" style={{ width: '32px', height: '32px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>
picture_as_pdf
</span>
{doc.review_status === 'rejected' && doc.review_note && (
<div style={{fontSize:'12px', color:'#c0392b', fontStyle:'italic', marginTop:'4px'}}>
Reason: "{doc.review_note}"
</div>
<div>
<div style={{ fontWeight: 600, color: '#0A2540', fontSize: '13.5px' }}>{doc.doc_label}</div>
<div style={{ fontSize: '11.5px', color: '#425466' }}>{doc.filename}</div>
</div>
</div>
</td>
<td>
<span style={{ fontSize: '12.5px', color: '#425466' }}>
{new Date(doc.created_at).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })}
</span>
</td>
<td>
{doc.review_status === 'approved' ? (
<span className="dash-pill dash-pill--approved">
Approved by Client
</span>
) : doc.review_status === 'rejected' ? (
<div>
<span className="dash-pill dash-pill--rejected">
Revision Requested
</span>
{doc.review_note && (
<div style={{ fontSize: '11.5px', color: '#DC2626', marginTop: '4px', fontStyle: 'italic' }}>
Note: &ldquo;{doc.review_note}&rdquo;
</div>
)}
</div>
) : doc.review_status === 'sent_for_approval' ? (
<div>
<span className="dash-pill dash-pill--pending">
Pending Client Approval
</span>
{doc.review_note && (
<div style={{ fontSize: '11.5px', color: '#92600A', marginTop: '4px', fontStyle: 'italic' }}>
CPA Note: &ldquo;{doc.review_note}&rdquo;
</div>
)}
</div>
) : (
<span className="badge badge-yellow">PENDING</span>
<span className="dash-pill dash-pill--pending">
Pending Review
</span>
)}
</td>
<td>
<div style={{display:'flex', gap:'8px', flexWrap:'wrap', alignItems:'center'}}>
<button className="btn btn-secondary btn-sm" onClick={() => viewDoc(doc.storage_key)}>View</button>
<button className="btn btn-secondary btn-sm" onClick={() => downloadDoc(doc.storage_key, doc.filename)} style={{display:'flex', alignItems:'center', gap:'4px'}}><span className="material-symbols-outlined" style={{fontSize:'16px'}}>download</span></button>
<button className="btn btn-primary btn-sm" onClick={() => respondDoc(doc.id, true)} disabled={docLoading}>Approve</button>
<button className="btn btn-danger btn-sm" onClick={() => openUserRejectPanel(doc.id)} disabled={docLoading}>Reject</button>
<div style={{ display: 'flex', gap: '6px', justifyContent: 'flex-end', flexWrap: 'wrap' }}>
<button
className="dash-table-action-btn"
title="View Document"
onClick={() => viewDoc(doc.storage_key)}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>visibility</span>
</button>
<button
className="dash-table-action-btn"
title="Download Document"
onClick={() => downloadDoc(doc.storage_key, doc.filename)}
>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>download</span>
</button>
{doc.review_status === 'sent_for_approval' && (
<>
<button
className="artha-pill-btn artha-pill-primary"
style={{ padding: '5px 12px', fontSize: '12px' }}
onClick={() => respondDoc(doc.id, true)}
disabled={docLoading}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>check</span>
Approve
</button>
<button
className="artha-pill-btn artha-pill-outline"
style={{ padding: '5px 10px', fontSize: '12px', color: '#DC2626', borderColor: 'rgba(220,38,38,0.3)' }}
onClick={() => openUserRejectPanel(doc.id)}
disabled={docLoading}
>
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>close</span>
Request Changes
</button>
</>
)}
</div>
</td>
</tr>
{/* Inline Reject Panel */}
{/* Inline Reject Feedback Panel */}
{rejectPanel?.docId === doc.id && (
<tr key={`reject-${doc.id}`}>
<td colSpan={4} style={{padding:'0'}}>
<div style={{
padding: '14px 16px',
background: 'rgba(220,53,69,0.05)',
border: '1px solid rgba(220,53,69,0.25)',
borderTop: 'none',
display: 'flex',
flexDirection: 'column',
gap: '10px'
}}>
<div style={{fontWeight:600, fontSize:'13px', color:'#c0392b', display:'flex', alignItems:'center', gap:'6px'}}>
<span className="material-symbols-outlined" style={{fontSize:'16px'}}>feedback</span>
Reason for Rejection (optional)
<td colSpan={4} style={{ padding: '0' }}>
<div
style={{
padding: '18px 22px',
background: '#FFF8F8',
borderTop: '1px solid rgba(220, 38, 38, 0.2)',
borderBottom: '1px solid rgba(220, 38, 38, 0.2)',
display: 'flex',
flexDirection: 'column',
gap: '12px'
}}
>
<div style={{ fontWeight: 600, fontSize: '13px', color: '#DC2626', display: 'flex', alignItems: 'center', gap: '8px' }}>
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>edit_note</span>
Specify Revisions Needed for CPA Review
</div>
<textarea
rows={3}
placeholder="Tell the admin why you are rejecting this document..."
placeholder="Please explain the discrepancy, missing deduction, or change requested..."
value={rejectPanel.note}
onChange={e => setRejectPanel(prev => ({...prev, note: e.target.value}))}
onChange={e => setRejectPanel(prev => ({ ...prev, note: e.target.value }))}
style={{
width: '100%',
padding: '10px 12px',
border: '1px solid rgba(220,53,69,0.35)',
borderRadius: 'var(--radius-sm)',
padding: '12px 14px',
border: '1px solid rgba(220, 38, 38, 0.3)',
borderRadius: '12px',
fontSize: '13px',
resize: 'vertical',
outline: 'none',
fontFamily: 'inherit',
background: 'white',
boxSizing: 'border-box'
background: '#FFFFFF'
}}
/>
<div style={{display:'flex', gap:'8px', justifyContent:'flex-end'}}>
<div style={{ display: 'flex', gap: '10px', justifyContent: 'flex-end' }}>
<button
className="btn btn-secondary btn-sm"
style={{borderRadius:'var(--radius-sm)'}}
className="artha-pill-btn artha-pill-outline"
style={{ padding: '6px 14px', fontSize: '12px' }}
onClick={() => setRejectPanel(null)}
>Cancel</button>
>
Cancel
</button>
<button
className="btn btn-danger btn-sm"
style={{borderRadius:'var(--radius-sm)'}}
className="artha-pill-btn artha-pill-dark"
style={{ padding: '6px 16px', fontSize: '12px', background: '#DC2626', borderColor: '#DC2626' }}
disabled={docLoading}
onClick={() => respondDoc(doc.id, false, rejectPanel.note)}
>
<span className="material-symbols-outlined" style={{fontSize:'15px', verticalAlign:'middle', marginRight:'4px'}}>block</span>
Confirm Rejection
Submit Revision Request
</button>
</div>
</div>
</td>
</tr>
)}
</>
</React.Fragment>
))}
</tbody>
</table>
</div>
)}
</div>
</section>
</div>
);
}
+61 -33
View File
@@ -4,7 +4,7 @@ import { useSearchParams, Link } from 'react-router-dom';
export default function VerifyEmail() {
const [searchParams] = useSearchParams();
const token = searchParams.get('token');
const [status, setStatus] = useState('verifying'); // verifying, success, failed, invalid
const [message, setMessage] = useState('');
@@ -19,16 +19,17 @@ export default function VerifyEmail() {
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")) {
if (res.ok && (data.message === 'verified' || data.message === 'already_verified')) {
setStatus('success');
setMessage(data.message === "already_verified" ? "Already Verified" : "Email Verified!");
setMessage(data.message === 'already_verified' ? 'Already Verified' : 'Email Verified!');
} else {
setStatus('failed');
setMessage(data.detail || "This link is invalid or has expired.");
setMessage(data.detail || 'This link is invalid or has expired.');
}
} catch (err) { console.error(err);
} catch (err) {
console.error(err);
setStatus('failed');
setMessage("Could not connect to the server. Please try again later.");
setMessage('Could not connect to the server. Please try again later.');
}
};
@@ -37,34 +38,62 @@ export default function VerifyEmail() {
return (
<div className="auth-shell page-enter">
{/* Brand Side */}
<div className="auth-brand">
<img className="brand-logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro"/>
<div style={{ textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<img
src="/images/brand-logo-mark.webp"
alt="ABC CPA & Advisory"
style={{
width: '58px',
height: '58px',
borderRadius: '14px',
marginBottom: '16px',
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45)',
border: '1px solid rgba(255, 255, 255, 0.14)'
}}
width="58"
height="58"
/>
<h2 style={{ fontFamily: "var(--font-display, 'Playfair Display', serif)", fontSize: '24px', fontWeight: 600, color: '#FFFFFF', margin: 0 }}>
ABC CPA &amp; Advisory
</h2>
<div style={{ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.12em', color: '#60A5FA', marginTop: '6px' }}>
Tax Advisory &amp; Accounting Services
</div>
</div>
<div className="brand-divider"></div>
<h2>Almost There</h2>
<p>We're verifying your email address right now.</p>
<p>
Verifying your secure portal identity to protect client confidentiality and tax documents.
</p>
</div>
{/* Form Side */}
<div className="auth-form-side">
<div className="auth-box text-center">
<div className="auth-box" style={{ textAlign: 'center' }}>
{status === 'verifying' && (
<>
<div style={{fontSize:'48px', marginBottom:'16px'}}>
<span className="material-symbols-outlined">pending</span>
<div style={{ fontSize: '48px', marginBottom: '16px', color: '#047857' }}>
<span className="material-symbols-outlined" style={{ fontSize: '48px' }}>pending</span>
</div>
<h2>Verifying your email...</h2>
<p className="auth-subtitle">Please wait a moment.</p>
<h1>Verifying your email...</h1>
<p className="auth-subtitle">Please wait a moment while we authorize your credentials.</p>
</>
)}
{status === 'invalid' && (
<>
<div style={{fontSize:'48px', marginBottom:'16px'}}>
<span className="material-symbols-outlined">cancel</span>
<div style={{ fontSize: '48px', marginBottom: '16px', color: 'var(--error, #DC2626)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '48px' }}>cancel</span>
</div>
<h2>Invalid Link</h2>
<p className="auth-subtitle">This verification link is missing a token.<br/>Please use the link from your email.</p>
<Link to="/login" className="btn btn-primary" style={{borderRadius:'var(--radius-sm)', marginTop:'24px', display:'inline-flex'}}>
<h1>Invalid Link</h1>
<p className="auth-subtitle">
This verification link is missing a token.<br />Please use the link from your registration email.
</p>
<Link to="/login" className="artha-pill-btn artha-pill-primary" style={{ marginTop: '20px' }}>
Go to Sign In
</Link>
</>
@@ -72,34 +101,33 @@ export default function VerifyEmail() {
{status === 'success' && (
<>
<div style={{fontSize:'48px', marginBottom:'16px', color:'var(--green)'}}>
<span className="material-symbols-outlined">check_circle</span>
<div style={{ fontSize: '48px', marginBottom: '16px', color: '#047857' }}>
<span className="material-symbols-outlined" style={{ fontSize: '48px' }}>check_circle</span>
</div>
<h2>{message}</h2>
<h1>{message}</h1>
<p className="auth-subtitle">
{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."}
{message === 'Already Verified'
? 'Your email is already verified. You can sign in below.'
: 'Your email has been verified. You can now access your login portal.'}
</p>
<Link to="/login" className="btn btn-primary" style={{borderRadius:'var(--radius-sm)', marginTop:'24px', display:'inline-flex'}}>
Sign In
<Link to="/login" className="artha-pill-btn artha-pill-primary" style={{ marginTop: '20px' }}>
Sign In to Portal
</Link>
</>
)}
{status === 'failed' && (
<>
<div style={{fontSize:'48px', marginBottom:'16px', color:'var(--error)'}}>
<span className="material-symbols-outlined">cancel</span>
<div style={{ fontSize: '48px', marginBottom: '16px', color: 'var(--error, #DC2626)' }}>
<span className="material-symbols-outlined" style={{ fontSize: '48px' }}>cancel</span>
</div>
<h2>Verification Failed</h2>
<h1>Verification Failed</h1>
<p className="auth-subtitle">{message}</p>
<Link to="/resend-verification" className="btn btn-primary" style={{borderRadius:'var(--radius-sm)', marginTop:'24px', display:'inline-flex'}}>
<Link to="/resend-verification" className="artha-pill-btn artha-pill-primary" style={{ marginTop: '20px' }}>
Request New Link
</Link>
</>
)}
</div>
</div>
</div>
+46
View File
@@ -0,0 +1,46 @@
// Dynamic-UI runtime (tiny, dependency-free, CSP-safe: only classList + CSSOM property writes).
// - html.motion : opts in to scroll-reveal hiding (never set for reduced-motion users)
// - html[data-scrolled]: navbar / header react after 24px of scroll
// - --scroll : 0..1 page progress, drives the brass progress rule
// - --mx / --my : pointer position inside cards, drives the hover spotlight
const SPOT = '.stat-card, .user-card, .service-card, .card, .artha-portal-card, .artha-vault-card, .artha-ticker-card';
export function initMotion() {
if (typeof window === 'undefined') return;
const root = document.documentElement;
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!reduce) root.classList.add('motion');
const bar = document.createElement('div');
bar.className = 'scroll-progress';
bar.setAttribute('aria-hidden', 'true');
document.body.appendChild(bar);
let ticking = false;
const update = () => {
const max = root.scrollHeight - root.clientHeight;
const y = window.scrollY || root.scrollTop || 0;
root.style.setProperty('--scroll', max > 0 ? (y / max).toFixed(4) : '0');
root.toggleAttribute('data-scrolled', y > 24);
ticking = false;
};
window.addEventListener('scroll', () => {
if (!ticking) { ticking = true; requestAnimationFrame(update); }
}, { passive: true });
window.addEventListener('resize', update, { passive: true });
update();
if (!reduce && window.matchMedia('(hover: hover)').matches) {
let raf = 0;
document.addEventListener('pointermove', (e) => {
const el = e.target instanceof Element ? e.target.closest(SPOT) : null;
if (!el) return;
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => {
const r = el.getBoundingClientRect();
el.style.setProperty('--mx', `${e.clientX - r.left}px`);
el.style.setProperty('--my', `${e.clientY - r.top}px`);
});
}, { passive: true });
}
}
+29 -1
View File
@@ -9,11 +9,39 @@ export default defineConfig({
react(),
],
server: {
host: true,
proxy: {
'/api': {
target: 'http://localhost:8000',
target: 'http://127.0.0.1:8000',
changeOrigin: true,
},
},
},
preview: {
port: 5173,
host: true,
proxy: {
'/api': {
target: 'http://127.0.0.1:8000',
changeOrigin: true,
},
},
},
build: {
sourcemap: false,
rollupOptions: {
output: {
manualChunks(id) {
if (
id.includes('node_modules/react/') ||
id.includes('node_modules/react-dom/') ||
id.includes('node_modules/react-router-dom/') ||
id.includes('node_modules/react-router/')
) {
return 'vendor';
}
},
},
},
},
})
+5 -1
View File
@@ -14,7 +14,7 @@ server {
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval';" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' data: blob: https:; connect-src 'self' https:; object-src 'none'; base-uri 'self';" always;
# Redirect all HTTP traffic to HTTPS (uncomment when SSL certs are generated)
# location / {
# return 301 https://$host$request_uri;
@@ -57,6 +57,10 @@ server {
root /usr/share/nginx/html;
expires 7d;
}
location = /favicon.png {
root /usr/share/nginx/html;
expires 7d;
}
location = /icons.svg {
root /usr/share/nginx/html;
expires 7d;
+13
View File
@@ -0,0 +1,13 @@
filepath = 'frontend/src/pages/AdminDashboard.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Fix --radius-full
content = content.replace('var(--radius-full)', 'var(--radius-md)')
# Add Sort and Tax Year labels
content = content.replace(
'<select className="select-input"',
'<label style={{display:"flex", alignItems:"center", gap:"8px", fontSize:"13px", fontWeight:500}}>Sort: <select className="select-input"'
)
# Wait, this might replace multiple. Let's be more specific.
+21
View File
@@ -0,0 +1,21 @@
import os
filepath = os.path.join("services", "api", "app", "routers", "upload.py")
with open(filepath, "r", encoding="utf-8") as f:
content = f.read()
# For personal documents
old_personal = "<p>Your personal document <strong>{doc.doc_type}</strong> (Tax Year {doc.tax_year}) has been"
new_personal = "<p>Your personal document <strong>{doc.filename}</strong> (Tax Year {doc.tax_year}) has been"
# For business documents
old_business = "<p>Your business document <strong>{doc.business_type}</strong> (Tax Year {doc.tax_year}) has been"
new_business = "<p>Your business document <strong>{doc.filename}</strong> (Tax Year {doc.tax_year}) has been"
content = content.replace(old_personal, new_personal)
content = content.replace(old_business, new_business)
with open(filepath, "w", encoding="utf-8") as f:
f.write(content)
print("upload.py patched successfully")
+23
View File
@@ -0,0 +1,23 @@
filepath = 'frontend/src/pages/UserDashboard.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# 1. Remove semantic search
import re
content = re.sub(r'const \[searchQuery, setSearchQuery\] = useState\(""\);\n\s*const \[searchResults, setSearchResults\] = useState\(\[\]\);\n\s*const \[isSearching, setIsSearching\] = useState\(false\);', '', content)
content = re.sub(r'const handleSearch = async.*?finally \{\n\s*setIsSearching\(false\);\n\s*\}\n\s*\};\n', '', content, flags=re.DOTALL)
# 2. Hide buttons on approved
old_buttons = """<button className="btn btn-primary btn-sm" onClick={() => respondDoc(doc.id, true)} disabled={docLoading}>Approve</button>
<button className="btn btn-danger btn-sm" onClick={() => openUserRejectPanel(doc.id)} disabled={docLoading}>Reject</button>"""
new_buttons = """{(!doc.review_status || doc.review_status === 'pending') && (
<>
<button className="btn btn-primary btn-sm" onClick={() => respondDoc(doc.id, true)} disabled={docLoading}>Approve</button>
<button className="btn btn-danger btn-sm" onClick={() => openUserRejectPanel(doc.id)} disabled={docLoading}>Reject</button>
</>
)}"""
content = content.replace(old_buttons, new_buttons)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("UserDashboard patched.")
+37
View File
@@ -0,0 +1,37 @@
filepath = 'frontend/src/pages/AdminUserDetail.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
import re
# Remove the button
content = re.sub(r'<button className="btn btn-secondary btn-sm" onClick=\{exportToExcel\}.*?table_view</span></button>\n?\s*', '', content)
# Remove the exportToExcel function
# It starts with `const exportToExcel = async () => {`
# We can find the block manually or with a regex that captures until the first top-level closing brace, but it's nested.
# Let's extract the start index and find the matching closing brace.
start_str = "const exportToExcel = async () => {"
if start_str in content:
start_idx = content.find(start_str)
brace_count = 0
in_function = False
end_idx = -1
for i in range(start_idx, len(content)):
if content[i] == '{':
brace_count += 1
in_function = True
elif content[i] == '}':
brace_count -= 1
if in_function and brace_count == 0:
end_idx = i
break
if end_idx != -1:
# also remove trailing newlines
content = content[:start_idx] + content[end_idx+1:].lstrip('\n')
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("Removed export excel feature.")
+33
View File
@@ -0,0 +1,33 @@
filepath = 'frontend/src/components/ExpandableSummaryBlock.jsx'
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
import re
# Remove handleExport function
start_str = "const handleExport = () => {"
if start_str in content:
start_idx = content.find(start_str)
brace_count = 0
in_function = False
end_idx = -1
for i in range(start_idx, len(content)):
if content[i] == '{':
brace_count += 1
in_function = True
elif content[i] == '}':
brace_count -= 1
if in_function and brace_count == 0:
end_idx = i
break
if end_idx != -1:
content = content[:start_idx] + content[end_idx+1:].lstrip('\n')
# Remove the button
content = re.sub(r'<button onClick=\{handleExport\}.*?Export Excel\s*</button>\n?\s*', '', content, flags=re.DOTALL)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("Removed handleExport and button from ExpandableSummaryBlock.")
+23
View File
@@ -0,0 +1,23 @@
import sys
import os
sys.path.append(os.path.join(os.getcwd(), 'services', 'api'))
from app.db.database import SessionLocal
from app.models import User
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
db = SessionLocal()
email = "atharvagunjarge5@gmail.com".lower()
user = db.query(User).filter(User.email == email).first()
if user:
new_password = "Gunjarge@1705"
user.hashed_password = pwd_context.hash(new_password)
db.commit()
print("Password updated successfully!")
else:
print("User not found in database!")
db.close()
+317 -30
View File
@@ -9,7 +9,17 @@ from sqlalchemy.orm import Session
from app.db import get_db
import app.crud as crud
from app.schemas import SignupRequest, LoginRequest, TokenResponse, ForgotPasswordRequest, ResetPasswordRequest, ResendVerificationRequest, RoleChangeRequest
from app.schemas import (
SignupRequest,
LoginRequest,
TokenResponse,
ForgotPasswordRequest,
ResetPasswordRequest,
ResendVerificationRequest,
RoleChangeRequest,
AssignAdminRequest,
BulkAssignAdminRequest,
)
from app.models import UserRole, User as UserModel, PersonalDocument, BusinessDocument
logger = logging.getLogger(__name__)
@@ -96,7 +106,7 @@ async def forgot_password(
reset_token = create_password_reset_token(user.email)
frontend_url = os.getenv("FRONTEND_URL", "https://aiindiacpa.duckdns.org")
frontend_url = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
reset_link = f"{frontend_url}/reset-password?token={reset_token}"
reset_body = (
@@ -107,12 +117,12 @@ async def forgot_password(
f'text-decoration:none;border-radius:6px;">'
f"Reset Password</a><br><br>"
f"This link expires in 15 minutes.<br><br>"
f"BookKeepro Team"
f"Support Team"
)
background.add_task(
send_email,
to=user.email,
subject="Reset your BookKeepro password",
subject="Reset your password",
body=reset_body,
)
@@ -217,7 +227,8 @@ def assert_admin_can_access(current_user, target_user):
Enforces that:
1. The current user is actually an admin/super_admin.
2. The target user exists (throws 404).
3. The target user has a 'user' role (throws 403).
3. The target user has a 'user' role (throws 403) unless current_user is super_admin.
4. If current_user is a standard admin, the target user must not be assigned to another admin.
"""
if not target_user:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
@@ -225,13 +236,24 @@ def assert_admin_can_access(current_user, target_user):
if current_user.role not in [UserRole.admin, UserRole.super_admin]:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Admin access required")
# Admins can only view 'user' accounts. Super admins can view any account.
if current_user.role != UserRole.super_admin and target_user.role != UserRole.user:
# Super admins can view and manage any account
if current_user.role == UserRole.super_admin:
return
# Admins can only view 'user' accounts
if target_user.role != UserRole.user:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Admins can only interact with regular user accounts"
)
# Standard admin: verify client assignment
if target_user.assigned_admin_id is not None and target_user.assigned_admin_id != current_user.id:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="This client is assigned to another administrator"
)
# =========================
# Auth Routes
@@ -267,22 +289,22 @@ async def signup(request: Request, payload: SignupRequest, background: Backgroun
# Send verification email in background (non-blocking)
if not is_admin:
verify_token = create_email_verification_token(user.email)
frontend_url = os.getenv("FRONTEND_URL", "https://aiindiacpa.duckdns.org")
frontend_url = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
verify_link = f"{frontend_url}/verify-email?token={verify_token}"
verify_body = (
f"Hi {user.name},<br><br>"
f"Welcome to BookKeepro! Please verify your email address to activate your account.<br><br>"
f"Welcome! Please verify your email address to activate your account.<br><br>"
f'<a href="{verify_link}" '
f'style="padding:12px 24px;background:#FF7F11;color:#fff;'
f'text-decoration:none;border-radius:6px;font-weight:600;">'
f"Verify My Email</a><br><br>"
f"This link expires in 24 hours. If you did not sign up, ignore this email.<br><br>"
f"BookKeepro Team"
f"Support Team"
)
background.add_task(
send_email,
to=user.email,
subject="Verify your BookKeepro email",
subject="Verify your email",
body=verify_body,
)
@@ -376,7 +398,7 @@ async def resend_verification(
return {"message": "If the email exists and is unverified, a new link has been sent"}
verify_token = create_email_verification_token(user.email)
frontend_url = os.getenv("FRONTEND_URL", "https://aiindiacpa.duckdns.org")
frontend_url = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
verify_link = f"{frontend_url}/verify-email?token={verify_token}"
resend_body = (
@@ -387,12 +409,12 @@ async def resend_verification(
f'text-decoration:none;border-radius:6px;font-weight:600;">'
f"Verify My Email</a><br><br>"
f"This link expires in 24 hours.<br><br>"
f"BookKeepro Team"
f"Support Team"
)
background.add_task(
send_email,
to=user.email,
subject="Verify your BookKeepro email",
subject="Verify your email",
body=resend_body,
)
return {"message": "If the email exists and is unverified, a new link has been sent"}
@@ -446,18 +468,20 @@ def update_me(
current_user=Depends(get_current_user),
):
"""Update own profile (name, phone, password). Any authenticated user."""
name = payload.get("name", "").strip()
phone = payload.get("phone", "").strip()
current_pw = payload.get("current_password", "")
new_pw = payload.get("new_password", "")
name_raw = payload.get("name")
phone_raw = payload.get("phone")
name = name_raw.strip() if isinstance(name_raw, str) else None
phone = phone_raw.strip() if isinstance(phone_raw, str) else None
current_pw = payload.get("current_password") or ""
new_pw = payload.get("new_password") or ""
changed = []
if name and name != current_user.name:
if name is not None and name and name != current_user.name:
current_user.name = name
changed.append("name")
if phone != current_user.phone:
if phone is not None and phone != (current_user.phone or ""):
current_user.phone = phone
changed.append("phone")
@@ -497,17 +521,18 @@ def list_users_for_admin(
skip: int = Query(0, ge=0),
limit: int = Query(100, ge=1, le=500),
tax_year: int = Query(None),
assigned_admin_id: str | None = Query(None),
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_admin),
):
"""
List users:
- super_admin → sees all users (user + admin + super_admin)
- admin → sees only role=user accounts
Supports skip/limit pagination. Returns pending_docs count per user.
- super_admin → sees all users (user + admin + super_admin) and can filter by assigned_admin_id ("all", "unassigned", or specific admin id)
- admin → sees their assigned user accounts (assigned_admin_id == current_user.id) or can view unassigned accounts
Supports skip/limit pagination. Returns pending_docs count per user and assigned admin info.
"""
from sqlalchemy import func as sqlfunc
from sqlalchemy import func as sqlfunc, or_
def _pending_count(uid: int) -> dict:
p_q = db.query(sqlfunc.count(PersonalDocument.id)).filter(
@@ -530,8 +555,28 @@ def list_users_for_admin(
if current_user.role == UserRole.super_admin:
q = db.query(UserModel)
if assigned_admin_id == "unassigned":
q = q.filter(UserModel.assigned_admin_id == None, UserModel.role == UserRole.user)
elif assigned_admin_id and assigned_admin_id != "all":
try:
aid = int(assigned_admin_id)
q = q.filter(UserModel.assigned_admin_id == aid)
except ValueError:
pass
else:
q = db.query(UserModel).filter(UserModel.role == UserRole.user)
# Standard admin:
# By default (or assigned_admin_id == "me"), show clients assigned to this admin.
# If assigned_admin_id == "unassigned", show unassigned clients.
# If assigned_admin_id == "all", show clients assigned to this admin + unassigned clients.
if assigned_admin_id == "unassigned":
q = db.query(UserModel).filter(UserModel.role == UserRole.user, UserModel.assigned_admin_id == None)
elif assigned_admin_id == "all":
q = db.query(UserModel).filter(
UserModel.role == UserRole.user,
or_(UserModel.assigned_admin_id == current_user.id, UserModel.assigned_admin_id == None)
)
else:
q = db.query(UserModel).filter(UserModel.role == UserRole.user, UserModel.assigned_admin_id == current_user.id)
total = q.count()
users = q.offset(skip).limit(limit).all()
@@ -539,11 +584,14 @@ def list_users_for_admin(
return {
"users": [
{
"id": u.id,
"name": u.name,
"email": u.email,
"phone": u.phone,
"role": u.role.value if hasattr(u.role, "value") else str(u.role),
"id": u.id,
"name": u.name,
"email": u.email,
"phone": u.phone,
"role": u.role.value if hasattr(u.role, "value") else str(u.role),
"assigned_admin_id": u.assigned_admin_id,
"assigned_admin_name": u.assigned_admin.name if u.assigned_admin else None,
"assigned_admin_email": u.assigned_admin.email if u.assigned_admin else None,
**_pending_count(u.id), # inlines pending_personal, pending_business, pending_docs (total)
}
for u in users
@@ -683,3 +731,242 @@ def change_user_role(
}
# ─────────────────────────────────────────────
# Admin assignment management
# ─────────────────────────────────────────────
@router.get("/admin/staff")
def list_admin_staff(
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_admin),
):
"""
Returns list of staff administrators (admin and super_admin) with count of assigned clients.
Accessible to admins and super_admins.
"""
from sqlalchemy import func as sqlfunc
staff = (
db.query(UserModel)
.filter(UserModel.role.in_([UserRole.admin, UserRole.super_admin]))
.order_by(UserModel.name.asc(), UserModel.email.asc())
.all()
)
counts = dict(
db.query(UserModel.assigned_admin_id, sqlfunc.count(UserModel.id))
.filter(UserModel.assigned_admin_id != None)
.group_by(UserModel.assigned_admin_id)
.all()
)
return [
{
"id": s.id,
"name": s.name or s.email,
"email": s.email,
"role": s.role.value if hasattr(s.role, "value") else str(s.role),
"assigned_clients_count": counts.get(s.id, 0),
}
for s in staff
]
@router.patch("/admin/users/{user_id}/assign-admin")
def assign_user_to_admin(
user_id: int,
payload: AssignAdminRequest,
request: Request,
background: BackgroundTasks,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_super_admin),
):
"""
Assign or unassign a client user to an administrator. Super admin only.
Sends an email notification to the assigned admin.
"""
client = crud.get_user_by_id(db, user_id)
if not client:
raise HTTPException(status_code=404, detail="Client user not found")
old_admin_id = client.assigned_admin_id
old_admin = crud.get_user_by_id(db, old_admin_id) if old_admin_id else None
old_admin_name = f"{old_admin.name or old_admin.email} (#{old_admin.id})" if old_admin else "Unassigned"
if payload.admin_id is None or payload.admin_id == 0:
# Unassign
client.assigned_admin_id = None
new_admin = None
new_admin_name = "Unassigned"
else:
new_admin = crud.get_user_by_id(db, payload.admin_id)
if not new_admin:
raise HTTPException(status_code=404, detail="Target admin not found")
if new_admin.role not in [UserRole.admin, UserRole.super_admin]:
raise HTTPException(status_code=400, detail="Assigned user must have an admin role")
client.assigned_admin_id = new_admin.id
new_admin_name = f"{new_admin.name or new_admin.email} (#{new_admin.id})"
db.commit()
db.refresh(client)
crud.log_action(
db,
action="assign_admin",
user_id=current_user.id,
target=f"user:{client.id}",
detail=f"Assigned admin changed: {old_admin_name} → {new_admin_name}",
ip_address=request.client.host if request.client else None,
)
logger.info(
f"Super admin {current_user.email} assigned client {client.email} to {new_admin_name}"
)
# Send email notification to the assigned admin
if new_admin:
frontend_url = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
client_link = f"{frontend_url}/admin-user-detail?user_id={client.id}"
super_admin_name = current_user.name or current_user.email
client_display = client.name or client.email
phone_html = f"<p style='margin:4px 0;'><strong>Phone:</strong> {client.phone}</p>" if client.phone else ""
email_body = f"""
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;line-height:1.6;color:#1e293b;max-width:580px;margin:0 auto;border:1px solid #e2e8f0;border-radius:12px;overflow:hidden;box-shadow:0 4px 12px rgba(0,0,0,0.05);">
<div style="background-color:#0f172a;padding:24px 28px;text-align:left;">
<h2 style="color:#ffffff;margin:0;font-size:20px;font-weight:700;letter-spacing:-0.3px;">Admin Portal</h2>
<p style="color:#94a3b8;margin:6px 0 0 0;font-size:13px;">Client Portfolio Assignment Notification</p>
</div>
<div style="padding:28px;">
<p style="font-size:15px;margin-top:0;">Hello <strong>{new_admin.name or 'Admin'}</strong>,</p>
<p style="font-size:14px;color:#334155;">Super Admin <strong>{super_admin_name}</strong> has assigned a client to your portfolio:</p>
<div style="background-color:#f8fafc;border-left:4px solid #0284c7;padding:16px;margin:20px 0;border-radius:6px;font-size:14px;">
<p style="margin:4px 0;"><strong>Client Name:</strong> {client_display}</p>
<p style="margin:4px 0;"><strong>Client Email:</strong> {client.email}</p>
{phone_html}
</div>
<p style="font-size:14px;color:#475569;">You now have administrative responsibility to review their uploaded documents, upload finalized tax returns, and assist them through filing.</p>
<div style="margin:28px 0 16px;">
<a href="{client_link}" style="background-color:#0284c7;color:#ffffff;padding:12px 24px;text-decoration:none;border-radius:6px;font-weight:600;font-size:14px;display:inline-block;">
Open Client File →
</a>
</div>
</div>
<div style="background-color:#f1f5f9;padding:16px 28px;border-top:1px solid #e2e8f0;font-size:12px;color:#64748b;">
This is an automated notification from the Admin Portal.
</div>
</div>
"""
background.add_task(
send_email,
to=new_admin.email,
subject=f"New Client Assigned: {client_display}",
body=email_body,
)
return {
"success": True,
"user_id": client.id,
"assigned_admin_id": client.assigned_admin_id,
"assigned_admin_name": new_admin.name if new_admin else None,
"assigned_admin_email": new_admin.email if new_admin else None,
"message": f"Client assigned to {new_admin_name}",
}
@router.post("/admin/users/bulk-assign-admin")
def bulk_assign_users_to_admin(
payload: BulkAssignAdminRequest,
request: Request,
background: BackgroundTasks,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_super_admin),
):
"""
Bulk assign multiple clients to an administrator. Super admin only.
Sends an email notification to the assigned admin.
"""
if not payload.user_ids:
raise HTTPException(status_code=400, detail="No user IDs provided")
new_admin = None
new_admin_name = "Unassigned"
if payload.admin_id is not None and payload.admin_id != 0:
new_admin = crud.get_user_by_id(db, payload.admin_id)
if not new_admin:
raise HTTPException(status_code=404, detail="Target admin not found")
if new_admin.role not in [UserRole.admin, UserRole.super_admin]:
raise HTTPException(status_code=400, detail="Assigned user must have an admin role")
new_admin_name = f"{new_admin.name or new_admin.email} (#{new_admin.id})"
clients = db.query(UserModel).filter(UserModel.id.in_(payload.user_ids)).all()
count = 0
client_names = []
for client in clients:
client.assigned_admin_id = new_admin.id if new_admin else None
client_names.append(f"{client.name or client.email} ({client.email})")
count += 1
db.commit()
crud.log_action(
db,
action="bulk_assign_admin",
user_id=current_user.id,
target=f"users:{len(clients)}",
detail=f"Bulk assigned {count} clients to {new_admin_name}",
ip_address=request.client.host if request.client else None,
)
# Send email notification to new_admin
if new_admin and count > 0:
frontend_url = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
dashboard_link = f"{frontend_url}/admin-dashboard"
super_admin_name = current_user.name or current_user.email
items_html = "".join(f"<li style='margin:4px 0;'>{name}</li>" for name in client_names[:10])
if len(client_names) > 10:
items_html += f"<li style='margin:4px 0;color:#64748b;'><em>...and {len(client_names) - 10} more clients</em></li>"
email_body = f"""
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;line-height:1.6;color:#1e293b;max-width:580px;margin:0 auto;border:1px solid #e2e8f0;border-radius:12px;overflow:hidden;box-shadow:0 4px 12px rgba(0,0,0,0.05);">
<div style="background-color:#0f172a;padding:24px 28px;text-align:left;">
<h2 style="color:#ffffff;margin:0;font-size:20px;font-weight:700;letter-spacing:-0.3px;">Admin Portal</h2>
<p style="color:#94a3b8;margin:6px 0 0 0;font-size:13px;">Batch Client Portfolio Assignment Notification</p>
</div>
<div style="padding:28px;">
<p style="font-size:15px;margin-top:0;">Hello <strong>{new_admin.name or 'Admin'}</strong>,</p>
<p style="font-size:14px;color:#334155;">Super Admin <strong>{super_admin_name}</strong> has assigned <strong>{count} client(s)</strong> to your portfolio:</p>
<ul style="background-color:#f8fafc;border-left:4px solid #0284c7;padding:12px 16px 12px 32px;margin:20px 0;border-radius:6px;font-size:14px;">
{items_html}
</ul>
<p style="font-size:14px;color:#475569;">You can view and manage these clients in your Admin Dashboard.</p>
<div style="margin:28px 0 16px;">
<a href="{dashboard_link}" style="background-color:#0284c7;color:#ffffff;padding:12px 24px;text-decoration:none;border-radius:6px;font-weight:600;font-size:14px;display:inline-block;">
Go to Admin Dashboard →
</a>
</div>
</div>
<div style="background-color:#f1f5f9;padding:16px 28px;border-top:1px solid #e2e8f0;font-size:12px;color:#64748b;">
This is an automated notification from the Admin Portal.
</div>
</div>
"""
background.add_task(
send_email,
to=new_admin.email,
subject=f"{count} New Clients Assigned to Your Portfolio",
body=email_body,
)
return {
"success": True,
"count": count,
"assigned_admin_id": new_admin.id if new_admin else None,
"assigned_admin_name": new_admin.name if new_admin else None,
"message": f"Assigned {count} clients to {new_admin_name}",
}
+2
View File
@@ -194,6 +194,8 @@ def llms_txt():
@app.get("/{full_path:path}", tags=["frontend"])
def spa_fallback(full_path: str):
if full_path.startswith("api/") or full_path == "api":
raise HTTPException(status_code=404, detail="API endpoint not found")
if os.path.isfile(SPA_INDEX):
return FileResponse(
SPA_INDEX,
+3
View File
@@ -44,6 +44,9 @@ class User(Base):
is_verified = Column(Integer, default=0, nullable=False) # 0 = unverified, 1 = verified
created_at = Column(DateTime(timezone=True), server_default=func.now())
engagement_acknowledged_at = Column(DateTime(timezone=True), nullable=True, default=None)
assigned_admin_id = Column(Integer, ForeignKey("users.id", ondelete="SET NULL"), nullable=True, index=True)
assigned_admin = relationship("User", remote_side=[id], foreign_keys=[assigned_admin_id])
# ─────────────────────────────────────────────
+94 -37
View File
@@ -1,4 +1,4 @@
import logging
import logging
import json
import uuid
from datetime import datetime, date, timezone
@@ -11,9 +11,18 @@ import os
import requests
from pydantic import BaseModel, field_validator
from fastapi import HTTPException
from app.models import PersonalDocument, BusinessDocument, AdminDocument, User, AuditLog, ChatSession, ChatMessage as DBChatMessage
from app.models import (
PersonalDocument,
BusinessDocument,
AdminDocument,
User,
UserRole,
AuditLog,
ChatSession,
ChatMessage as DBChatMessage,
)
from app.db import get_db
from app.auth.security import get_current_user, require_admin
from app.auth.security import get_current_user, require_admin, assert_admin_can_access
logger = logging.getLogger(__name__)
@@ -104,11 +113,34 @@ def get_admin_status(
current_user=Depends(get_current_user),
_=Depends(require_admin),
):
if not isinstance(tax_year, int):
tax_year = None
today_start = datetime.combine(date.today(), datetime.min.time(), tzinfo=timezone.utc)
total_users = db.query(User).count()
new_users_today = db.query(User).filter(User.created_at >= today_start).count()
is_standard_admin = current_user.role == UserRole.admin
assigned_uids = None
if is_standard_admin:
assigned_uids = [
u.id for u in db.query(User.id).filter(
User.role == UserRole.user,
User.assigned_admin_id == current_user.id
).all()
]
total_users = len(assigned_uids)
new_users_today = (
db.query(User)
.filter(User.id.in_(assigned_uids), User.created_at >= today_start)
.count()
if assigned_uids else 0
)
else:
total_users = db.query(User).count()
new_users_today = db.query(User).filter(User.created_at >= today_start).count()
pq = db.query(PersonalDocument).filter(PersonalDocument.review_status == "pending", PersonalDocument.deleted_at == None)
if is_standard_admin:
pq = pq.filter(PersonalDocument.user_id.in_(assigned_uids)) if assigned_uids else pq.filter(False)
if tax_year:
pq = pq.filter(PersonalDocument.tax_year == tax_year)
pending_personal = pq.count()
@@ -116,27 +148,37 @@ def get_admin_status(
admin_accounts = db.query(User).filter(User.role.in_(["admin", "super_admin"])).count()
bq = db.query(BusinessDocument).filter(BusinessDocument.review_status == "pending", BusinessDocument.deleted_at == None)
if is_standard_admin:
bq = bq.filter(BusinessDocument.user_id.in_(assigned_uids)) if assigned_uids else bq.filter(False)
if tax_year:
bq = bq.filter(BusinessDocument.tax_year == tax_year)
pending_business = bq.count()
admin_docs = db.query(AdminDocument).filter(AdminDocument.deleted_at == None)
if is_standard_admin:
admin_docs = admin_docs.filter(AdminDocument.user_id.in_(assigned_uids)) if assigned_uids else admin_docs.filter(False)
if tax_year:
admin_docs = admin_docs.filter(AdminDocument.tax_year == tax_year)
pending_admin_returns = admin_docs.filter(AdminDocument.review_status == "pending").count()
recent_personal = (
db.query(PersonalDocument).filter(PersonalDocument.deleted_at == None)
.order_by(PersonalDocument.uploaded_at.desc()).limit(10).all()
)
recent_business = (
db.query(BusinessDocument).filter(BusinessDocument.deleted_at == None)
.order_by(BusinessDocument.uploaded_at.desc()).limit(10).all()
)
recent_admin = (
db.query(AdminDocument).filter(AdminDocument.deleted_at == None)
.order_by(AdminDocument.uploaded_at.desc()).limit(10).all()
)
rpq = db.query(PersonalDocument).filter(PersonalDocument.deleted_at == None)
rbq = db.query(BusinessDocument).filter(BusinessDocument.deleted_at == None)
raq = db.query(AdminDocument).filter(AdminDocument.deleted_at == None)
if is_standard_admin:
if assigned_uids:
rpq = rpq.filter(PersonalDocument.user_id.in_(assigned_uids))
rbq = rbq.filter(BusinessDocument.user_id.in_(assigned_uids))
raq = raq.filter(AdminDocument.user_id.in_(assigned_uids))
else:
rpq = rpq.filter(False)
rbq = rbq.filter(False)
raq = raq.filter(False)
recent_personal = rpq.order_by(PersonalDocument.uploaded_at.desc()).limit(10).all()
recent_business = rbq.order_by(BusinessDocument.uploaded_at.desc()).limit(10).all()
recent_admin = raq.order_by(AdminDocument.uploaded_at.desc()).limit(10).all()
recent_uploads = sorted(
[{"user_id": d.user_id, "doc": d.doc_type, "type": "personal",
"uploaded_at": d.uploaded_at, "status": d.review_status} for d in recent_personal] +
@@ -174,7 +216,7 @@ def get_daily_digest(
_=Depends(require_admin),
):
from app.utils.doc_intelligence import build_daily_digest
stats = get_admin_status(db=db, current_user=current_user, _=None)
stats = get_admin_status(tax_year=None, db=db, current_user=current_user, _=None)
digest_html = build_daily_digest(stats)
return {"digest": digest_html, "generated_at": datetime.now().isoformat()}
@@ -240,6 +282,7 @@ def admin_bulk_action(
user = db.query(User).filter(User.id == payload.user_id).first()
if not user:
raise HTTPException(status_code=404, detail="User not found")
assert_admin_can_access(current_user, user)
action_parts = payload.action.split("_")
if len(action_parts) != 2 or action_parts[0] not in ("approve", "reject") \
@@ -256,11 +299,35 @@ def admin_bulk_action(
model_class.deleted_at == None,
).all()
from app import crud
from app.models import DocumentReviewEvent
from datetime import datetime
count = 0
for doc in docs:
doc.review_status = new_status
if new_status == "approved":
doc.reviewed_at = datetime.utcnow()
event = DocumentReviewEvent(
doc_kind=doc_type,
doc_id=doc.id,
owner_user_id=payload.user_id,
actor_id=current_user.id,
actor_role="admin",
action=f"bulk_{new_status}",
from_status="pending",
to_status=new_status,
tax_year=doc.tax_year,
)
db.add(event)
count += 1
crud.log_action(
db, "bulk_review_docs",
user_id=current_user.id,
target=f"user:{payload.user_id}",
detail=f"bulk_{new_status} {count} {doc_type} documents",
)
db.commit()
logger.info(f"Admin {current_user.id} bulk {new_status} {count} {doc_type} docs for user {payload.user_id}")
@@ -296,7 +363,7 @@ class ChatRequest(BaseModel):
session_id: str | None = None
def _build_admin_context(db: Session, current_user) -> str:
status = get_admin_status(db=db, current_user=current_user, _=None)
status = get_admin_status(tax_year=None, db=db, current_user=current_user, _=None)
ctx = f"=== LIVE SYSTEM DATA (as of {datetime.now().strftime('%Y-%m-%d %H:%M')}) ===\n"
ctx += f"Total registered users: {status['total_users']}\n"
ctx += f"New users registered TODAY: {status['new_users_today']}\n"
@@ -359,25 +426,15 @@ def ask_chatbot(
if is_admin:
context = _build_admin_context(db, current_user)
system_prompt = (
"You are the BookKeepPro Admin Assistant with live access to system data.
"
"CAPABILITIES: Answer questions about uploads, user activity, pending docs, registration counts.
"
"WORKFLOW GUIDANCE: If asked how to do something in the app:
"
"- Send document for review: Go to Users Overview -> Click the User -> Upload under 'Filing Timeline' -> Click Submit Review.
"
"- Review user documents: Go to Users Overview -> Click the User -> Go to Personal/Business Docs -> Click Approve or Reject.
"
"You are the BookKeepPro Admin Assistant with live access to system data.\n\n"
"CAPABILITIES: Answer questions about uploads, user activity, pending docs, registration counts.\n"
"WORKFLOW GUIDANCE: If asked how to do something in the app:\n"
"- Send document for review: Go to Users Overview -> Click the User -> Upload under 'Filing Timeline' -> Click Submit Review.\n"
"- Review user documents: Go to Users Overview -> Click the User -> Go to Personal/Business Docs -> Click Approve or Reject.\n"
"BULK ACTIONS: When asked to approve/reject all docs for a user, respond with a structured "
"JSON action block like: {\"bulk_action\": {\"user_id\": N, \"action\": \"approve_personal\", \"confirm\": false}}
"
"TOOLS: Use the lookup_user tool to fetch details about a specific user if their name or email is mentioned.
"
"RULES: Only answer BookKeepPro, accounting, or tax questions. Use live data. Be concise.
"
"JSON action block like: {\"bulk_action\": {\"user_id\": N, \"action\": \"approve_personal\", \"confirm\": false}}\n"
"TOOLS: Use the lookup_user tool to fetch details about a specific user if their name or email is mentioned.\n"
"RULES: Only answer BookKeepPro, accounting, or tax questions. Use live data. Be concise.\n\n"
f"{context}"
)
else:
+18 -11
View File
@@ -1,4 +1,5 @@
import os
import html
from fastapi import APIRouter, BackgroundTasks, HTTPException, Request
from app.limiter import limiter
from pydantic import BaseModel, EmailStr, field_validator
@@ -7,7 +8,7 @@ from app.utils.emailer import send_email
router = APIRouter(prefix="/api", tags=["contact"])
# Get admin email from environment, with fallback
ADMIN_EMAIL = os.getenv("ADMIN_EMAIL", "admin@bookkeepro.net")
ADMIN_EMAIL = os.getenv("ADMIN_EMAIL", "atharvg.aiindia@gmail.com")
class ContactForm(BaseModel):
first_name: str
@@ -28,23 +29,29 @@ class ContactForm(BaseModel):
async def contact_message(request: Request, form: ContactForm, background: BackgroundTasks):
if not ADMIN_EMAIL or "@" not in ADMIN_EMAIL:
raise HTTPException(status_code=500, detail="Admin email not configured")
safe_first = html.escape(form.first_name)
safe_last = html.escape(form.last_name)
safe_email = html.escape(str(form.email))
safe_phone = html.escape(form.phone)
safe_message = html.escape(form.message) if form.message else '(none)'
background.add_task(
send_email,
to=ADMIN_EMAIL,
subject="New Contact Enquiry Received — Follow-Up Required - BookKeepro",
subject="New Contact Enquiry Received — Follow-Up Required",
body=f"""
Dear Team,
<br><br>
A new contact enquiry has been received. Please find the details below:
<br><br>
<b>Name:</b> {form.first_name} {form.last_name}<br>
<b>Email:</b> {form.email}<br>
<b>Phone:</b> {form.phone}<br>
<b>Message:</b> {form.message or '(none)'}<br><br>
<b>Name:</b> {safe_first} {safe_last}<br>
<b>Email:</b> {safe_email}<br>
<b>Phone:</b> {safe_phone}<br>
<b>Message:</b> {safe_message}<br><br>
Kindly follow up with the user at the earliest convenience.
<br><br>
Thank you,<br>
BookKeepro Support Team
Support Team
"""
)
@@ -52,13 +59,13 @@ async def contact_message(request: Request, form: ContactForm, background: Backg
background.add_task(
send_email,
to=form.email,
subject="Thanks for contacting BookKeepro",
subject="Thanks for contacting us",
body=f"""
Hi {form.first_name},<br><br>
Thank you for reaching out to BookKeepro.<br>
Hi {safe_first},<br><br>
Thank you for reaching out.<br>
We’ve received your enquiry, and our team will get back to you shortly.<br><br>
Best Regards,<br>
BookKeepro Team
Support Team
"""
)
+93 -33
View File
@@ -1,5 +1,5 @@
import os
from datetime import date, timedelta
from datetime import date, datetime, timedelta
import logging
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException
from sqlalchemy.orm import Session
@@ -7,14 +7,14 @@ from app.models import AdminDocument, User, UserRole, FilingDeadline
from app.db import get_db
from app.utils.emailer import send_email
from app import crud
from app.auth.security import get_current_user, require_admin
from app.auth.security import get_current_user, require_admin, assert_admin_can_access
from app.schemas import SubmitReviewRequest, NotifyUserRequest, AdminDocResponseRequest
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/review", tags=["review"])
DASHBOARD_LINK = f"{os.getenv('FRONTEND_URL', 'https://aiindiacpa.duckdns.org')}/dashboard"
DASHBOARD_LINK = f"{os.getenv('FRONTEND_URL', 'https://aicpa.duckdns.org')}/dashboard"
# ─────────────────────────────────────────────
@@ -32,10 +32,11 @@ async def submit_review(
user = crud.get_user_by_id(db, payload.user_id)
if not user:
raise HTTPException(status_code=404, detail="User not found")
assert_admin_can_access(current_user, user)
email_sent = await send_email(
to=user.email,
subject="Documents Ready for Review — BookKeepro",
subject="Documents Ready for Review",
body=f"""
<p>Dear {user.name or "Sir/Ma'am"},</p>
<p>Your documents have been successfully submitted and are pending review.</p>
@@ -45,7 +46,7 @@ async def submit_review(
👉 Go to Dashboard
</a>
</p>
<p style="margin-top:20px;">Kind regards,<br><strong>BookKeepro Team</strong></p>
<p style="margin-top:20px;">Kind regards,<br><strong>Support Team</strong></p>
"""
)
@@ -68,6 +69,7 @@ async def notify_user_review(
user = crud.get_user_by_id(db, payload.user_id)
if not user:
raise HTTPException(status_code=404, detail="User not found")
assert_admin_can_access(current_user, user)
approved_html = "".join(f"<li>{item}</li>" for item in payload.approved) or "<li>None</li>"
rejected_html = "".join(f"<li>{item}</li>" for item in payload.rejected) or "<li>None</li>"
@@ -88,10 +90,10 @@ async def notify_user_review(
<li>Business Documents: {payload.business_timeline} days</li>
</ul>
<p>Kind regards,<br><strong>BookKeepro Team</strong></p>
<p>Kind regards,<br><strong>Support Team</strong></p>
"""
await send_email(to=user.email, subject="Document Review Update — BookKeepro", body=body)
await send_email(to=user.email, subject="Document Review Update", body=body)
logger.info(f"Admin {current_user.id} sent review notification to user {payload.user_id}")
# Save / reset filing deadlines if timelines were provided
@@ -127,6 +129,7 @@ async def notify_user_review(
@router.post("/admin-doc-response")
async def admin_doc_response(
payload: AdminDocResponseRequest,
background: BackgroundTasks,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
):
@@ -145,8 +148,18 @@ async def admin_doc_response(
f"belonging to user {doc.user_id}"
)
raise HTTPException(status_code=403, detail="Not authorized")
if doc.review_status != "sent_for_approval":
raise HTTPException(
status_code=400,
detail="Document is not ready for client review. Status must be 'sent_for_approval'."
)
if payload.status not in ("approved", "rejected"):
raise HTTPException(status_code=400, detail="Status must be 'approved' or 'rejected'")
doc.review_status = payload.status
doc.reviewed_at = datetime.utcnow()
if payload.reason:
doc.review_note = payload.reason
db.commit()
@@ -166,28 +179,29 @@ async def admin_doc_response(
db.add(event)
db.commit()
admin = db.query(User).filter_by(id=doc.uploaded_by).first()
if not admin:
raise HTTPException(status_code=404, detail="Admin not found")
admin = db.query(User).filter_by(id=doc.uploaded_by).first() if doc.uploaded_by else None
admin_email = admin.email if admin else os.getenv("ADMIN_EMAIL")
body = f"""
<p>Dear Admin,</p>
<p>User <b>{current_user.email}</b> has <b>{payload.status.upper()}</b> the document:</p>
<p><b>{doc.doc_label}</b></p>
"""
if payload.status == "rejected" and payload.reason:
body += f"<p><strong>Reason:</strong></p><p>{payload.reason}</p>"
if admin_email:
body = f"""
<p>Dear Admin,</p>
<p>User <b>{current_user.email}</b> has <b>{payload.status.upper()}</b> the document:</p>
<p><b>{doc.doc_label}</b></p>
"""
if payload.status == "rejected" and payload.reason:
body += f"<p><strong>Reason:</strong></p><p>{payload.reason}</p>"
body += "<p style='margin-top:20px;'>BookKeepro System</p>"
body += "<p style='margin-top:20px;'>Admin Portal</p>"
await send_email(
to=admin.email,
subject=f"Admin Return Status {payload.status.capitalize()} — BookKeepro",
body=body,
)
background.add_task(
send_email,
to=admin_email,
subject=f"Admin Return Status {payload.status.capitalize()}",
body=body,
)
logger.info(f"User {current_user.id} {payload.status} admin doc {payload.doc_id}")
return {"status": "notified"}
return {"status": "notified", "review_status": doc.review_status}
# ─────────────────────────────────────────────
# Update Status and History
@@ -246,10 +260,20 @@ def update_document_status(
if doc_kind not in model_map:
raise HTTPException(status_code=400, detail="Invalid doc_kind")
ALLOWED_STATUSES = {"approved", "rejected", "pending", "sent_for_approval", "uploaded", "filed"}
if payload.status not in ALLOWED_STATUSES:
raise HTTPException(
status_code=400,
detail=f"Invalid status '{payload.status}'. Must be one of: {', '.join(sorted(ALLOWED_STATUSES))}"
)
doc = db.query(model_map[doc_kind]).filter_by(id=doc_id).first()
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
target_user = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, target_user)
doc.review_status = payload.status
if payload.note is not None:
doc.review_note = payload.note
@@ -279,13 +303,43 @@ def update_document_status(
# Get filing deadlines for a user
# ─────────────────────────────────────────────
@router.get("/my-deadlines")
def get_my_filing_deadlines(
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
):
from app.models import FilingDeadline
deadlines = db.query(FilingDeadline).filter(FilingDeadline.user_id == current_user.id).all()
today = date.today()
result = []
for dl in deadlines:
days_left = (dl.deadline_date - today).days
result.append({
"id": dl.id,
"doc_type": dl.doc_type,
"deadline_date": dl.deadline_date.isoformat(),
"days_given": dl.days_given,
"days_left": days_left,
"is_overdue": days_left < 0,
})
return result
@router.get("/deadlines/{user_id}")
def get_filing_deadlines(
user_id: int,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_admin),
):
is_admin = current_user.role in ("admin", "super_admin") or (
hasattr(current_user.role, "value") and current_user.role.value in ("admin", "super_admin")
)
if is_admin:
target_user = crud.get_user_by_id(db, user_id)
assert_admin_can_access(current_user, target_user)
elif current_user.id != user_id:
raise HTTPException(status_code=403, detail="Not authorized to view these deadlines")
from app.models import FilingDeadline
deadlines = db.query(FilingDeadline).filter(FilingDeadline.user_id == user_id).all()
today = date.today()
@@ -293,6 +347,7 @@ def get_filing_deadlines(
for dl in deadlines:
days_left = (dl.deadline_date - today).days
result.append({
"id": dl.id,
"doc_type": dl.doc_type,
"deadline_date": dl.deadline_date.isoformat(),
"days_given": dl.days_given,
@@ -329,6 +384,9 @@ async def send_return_for_approval(
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
client = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, client)
doc.review_status = "sent_for_approval"
if payload.note:
doc.review_note = payload.note
@@ -357,13 +415,12 @@ async def send_return_for_approval(
db.add(event)
db.commit()
client = db.query(User).filter_by(id=doc.user_id).first()
if client:
note_html = f"<p><em>{payload.note}</em></p>" if payload.note else ""
background.add_task(
send_email,
to=client.email,
subject="Action Required: Please Review Your Tax Return — BookKeepro",
subject="Action Required: Please Review Your Tax Return",
body=f"""
<p>Dear {client.name or 'Client'},</p>
<p>Your tax professional has prepared a document for your review:</p>
@@ -371,7 +428,7 @@ async def send_return_for_approval(
{note_html}
<p>Please log in to your dashboard to review, approve, or request changes.</p>
<p><a href='{DASHBOARD_LINK}' style='color:#2c7a5b;font-weight:600;font-size:15px;'>Review Now →</a></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>BookKeepro Team</strong></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>Support Team</strong></p>
""",
)
@@ -397,6 +454,11 @@ async def mark_filing_complete(
_=Depends(require_admin),
):
"""Admin marks all approved docs for a user/year as 'filed'. Sends confirmation email."""
client = crud.get_user_by_id(db, payload.user_id)
if not client:
raise HTTPException(status_code=404, detail="User not found")
assert_admin_can_access(current_user, client)
from app.models import PersonalDocument, BusinessDocument
personal_docs = db.query(PersonalDocument).filter(
@@ -424,14 +486,12 @@ async def mark_filing_complete(
target=f"user:{payload.user_id}",
detail=f"tax_year:{payload.tax_year} personal:{len(personal_docs)} business:{len(business_docs)}",
)
client = crud.get_user_by_id(db, payload.user_id)
if client:
note_html = f"<p><em>{payload.note}</em></p>" if payload.note else ""
background.add_task(
send_email,
to=client.email,
subject=f"Your {payload.tax_year} Tax Return Has Been Filed — BookKeepro",
subject=f"Your {payload.tax_year} Tax Return Has Been Filed",
body=f"""
<p>Dear {client.name or 'Client'},</p>
<p>Great news! Your <strong>{payload.tax_year}</strong> tax return has been successfully filed.</p>
@@ -439,7 +499,7 @@ async def mark_filing_complete(
{note_html}
<p>You can view the status in your dashboard at any time.</p>
<p><a href='{DASHBOARD_LINK}' style='color:#2c7a5b;font-weight:600;'>Go to Dashboard →</a></p>
<p style='margin-top:20px;'>Thank you for choosing BookKeepro.<br><strong>BookKeepro Team</strong></p>
<p style='margin-top:20px;'>Thank you.<br><strong>Support Team</strong></p>
""",
)
+140 -64
View File
@@ -29,7 +29,7 @@ router = APIRouter(prefix="/api/upload", tags=["upload"])
from pathlib import Path
FRONTEND_URL = os.getenv("FRONTEND_URL", "https://aiindiacpa.duckdns.org")
FRONTEND_URL = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
# ─────────────────────────────────────────────
# Local File Storage (Contabo VPS Disk)
@@ -161,8 +161,37 @@ async def upload_to_storage(file: UploadFile) -> str:
detail=f"File type not allowed or could not be verified. Allowed: PDF, JPG, PNG, WEBP, DOC, DOCX, XLS, XLSX."
)
ext = os.path.splitext(file.filename or "file")[1].lower()
object_key = f"{uuid.uuid4().hex}{ext}"
MIME_TO_EXT = {
"application/pdf": ".pdf",
"image/jpeg": ".jpg",
"image/png": ".png",
"image/webp": ".webp",
"application/msword": ".doc",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
"application/vnd.ms-excel": ".xls",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
"application/zip": ".zip",
"application/x-zip-compressed": ".zip",
}
SAFE_EXT_BY_MIME = {
"application/pdf": {".pdf"},
"image/jpeg": {".jpg", ".jpeg"},
"image/png": {".png"},
"image/webp": {".webp"},
"application/msword": {".doc"},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {".docx"},
"application/vnd.ms-excel": {".xls"},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {".xlsx"},
"application/zip": {".zip"},
"application/x-zip-compressed": {".zip"},
}
safe_ext = MIME_TO_EXT.get(sniffed_mime, ".bin")
if ext in SAFE_EXT_BY_MIME.get(sniffed_mime, set()):
safe_ext = ext
object_key = f"{uuid.uuid4().hex}{safe_ext}"
file_path = UPLOAD_DIR / object_key
try:
@@ -220,7 +249,11 @@ def stream_file(storage_key: str, token: str = Query(...)):
if not file_path.exists():
raise HTTPException(status_code=404, detail="File not found")
return FileResponse(file_path)
headers = {
"Content-Disposition": f'attachment; filename="{Path(storage_key).name}"',
"X-Content-Type-Options": "nosniff",
}
return FileResponse(file_path, headers=headers)
# ─────────────────────────────────────────────
@@ -266,12 +299,12 @@ def get_view_url(
@router.post("/admin-documents")
async def upload_admin_document(
background: BackgroundTasks,
file: UploadFile = File(...),
doc_key: str = Form(...),
doc_label: str = Form(...),
user_id: int = Form(...),
tax_year: int | None = Form(None),
background: BackgroundTasks = BackgroundTasks(),
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
_=Depends(require_admin),
@@ -282,9 +315,12 @@ async def upload_admin_document(
logger.info(f"Admin {current_user.id} uploading document for user {user_id}")
storage_key = await upload_to_storage(file)
safe_doc_key = (doc_key or "").strip()[:100]
safe_doc_label = (doc_label or "").strip()[:150]
record = AdminDocument(
doc_key=doc_key,
doc_label=doc_label,
doc_key=safe_doc_key,
doc_label=safe_doc_label,
filename=file.filename,
storage_key=storage_key,
content_type=file.content_type,
@@ -322,12 +358,12 @@ async def upload_admin_document(
background.add_task(
send_email,
to=target_user.email,
subject="New Document Uploaded — BookKeepro",
subject="New Document Uploaded",
body=f"""
<p>Dear {target_user.name or "Sir/Ma'am"},</p>
<p>An admin has securely uploaded a new document (<strong>{doc_label}</strong>) to your account.</p>
<p>You can view this document by logging into your BookKeepro portal.</p>
<br><strong>BookKeepro Team</strong>
<p>You can view this document by logging into your portal.</p>
<br><strong>Support Team</strong>
""",
)
@@ -352,6 +388,8 @@ def list_admin_documents(
if current_user.role in [UserRole.admin, UserRole.super_admin]:
if not user_id:
raise HTTPException(status_code=400, detail="user_id is required for admin")
target_user = crud.get_user_by_id(db, user_id)
assert_admin_can_access(current_user, target_user)
docs = (
db.query(AdminDocument)
.filter(AdminDocument.user_id == user_id, AdminDocument.deleted_at == None)
@@ -405,21 +443,21 @@ def delete_admin_document(
raise HTTPException(status_code=404, detail="Document not found")
target_user = db.query(User).filter(User.id == doc.user_id).first()
if not target_user:
raise HTTPException(status_code=404, detail="Target user not found")
assert_admin_can_access(current_user, target_user)
# Scope restriction: standard admins can only delete documents for base users
if current_user.role == UserRole.admin and target_user.role != UserRole.user:
if doc.review_status == "approved":
raise HTTPException(
status_code=403,
detail="Standard admins can only manage documents for standard users"
status_code=400,
detail="Cannot delete an approved return. Approved documents are locked."
)
logger.info(f"Admin {current_user.id} deleting admin document {doc_id}")
delete_from_storage(doc.storage_key)
storage_key = doc.storage_key
doc.deleted_at = datetime.utcnow()
db.commit()
crud.log_action(db, "delete_admin_doc", user_id=current_user.id, target=f"admin_doc:{doc_id}")
if storage_key:
delete_from_storage(storage_key)
return {"deleted": True}
@@ -543,14 +581,14 @@ async def upload_personal_document(
background.add_task(
send_email,
to=admin.email,
subject="New Personal Document Uploaded — BookKeepro",
subject="New Personal Document Uploaded",
body=f"<p><strong>{current_user.email}</strong> uploaded a personal document: <strong>{file.filename}</strong> ({doc_type}).</p>",
)
background.add_task(
send_email,
to=current_user.email,
subject="Personal Document Upload Confirmation — BookKeepro",
subject="Personal Document Upload Confirmation",
body=f"<p>We have successfully received your personal document: <strong>{file.filename}</strong> ({doc_type}).</p>",
)
background.add_task(
@@ -716,14 +754,14 @@ async def upload_business_document(
background.add_task(
send_email,
to=admin.email,
subject="New Business Document Uploaded — BookKeepro",
subject="New Business Document Uploaded",
body=f"<p><strong>{current_user.email}</strong> uploaded a business document: <strong>{file.filename}</strong> ({doc_type}).</p>",
)
background.add_task(
send_email,
to=current_user.email,
subject="Business Document Upload Confirmation — BookKeepro",
subject="Business Document Upload Confirmation",
body=f"<p>We have successfully received your business document: <strong>{file.filename}</strong> ({doc_type}).</p>",
)
background.add_task(
@@ -780,6 +818,9 @@ async def set_personal_review_status(
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
target_user = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, target_user)
prev_status = doc.review_status
doc.review_status = payload.status
doc.review_note = payload.note
@@ -816,14 +857,14 @@ async def set_personal_review_status(
background.add_task(
send_email,
to=owner.email,
subject="Action Required: Document Rejected — BookKeepro",
subject="Action Required: Document Rejected",
body=f"""
<p>Dear {owner.name or 'Client'},</p>
<p>Your personal document <strong>{doc.doc_type}</strong> (Tax Year {doc.tax_year}) has been <strong style='color:#c0392b;'>rejected</strong> by our team.</p>
<p>Your personal document <strong>{doc.filename}</strong> (Tax Year {doc.tax_year}) has been <strong style='color:#c0392b;'>rejected</strong> by our team.</p>
{note_html}
<p>Please log in to your dashboard, review the reason, and re-upload a corrected document.</p>
<p><a href='{FRONTEND_URL}/upload-personal' style='color:#0077c8;font-weight:600;'>Re-upload Personal Documents →</a></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>BookKeepro Team</strong></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>Support Team</strong></p>
""",
)
@@ -844,6 +885,9 @@ async def set_business_review_status(
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
target_user = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, target_user)
prev_status = doc.review_status
doc.review_status = payload.status
doc.review_note = payload.note
@@ -880,14 +924,14 @@ async def set_business_review_status(
background.add_task(
send_email,
to=owner.email,
subject="Action Required: Document Rejected — BookKeepro",
subject="Action Required: Document Rejected",
body=f"""
<p>Dear {owner.name or 'Client'},</p>
<p>Your business document <strong>{doc.business_type}</strong> (Tax Year {doc.tax_year}) has been <strong style='color:#c0392b;'>rejected</strong> by our team.</p>
<p>Your business document <strong>{doc.filename}</strong> (Tax Year {doc.tax_year}) has been <strong style='color:#c0392b;'>rejected</strong> by our team.</p>
{note_html}
<p>Please log in to your dashboard, review the reason, and re-upload a corrected document.</p>
<p><a href='{FRONTEND_URL}/upload-business' style='color:#0077c8;font-weight:600;'>Re-upload Business Documents →</a></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>BookKeepro Team</strong></p>
<p style='margin-top:20px;'>Kind regards,<br><strong>Support Team</strong></p>
""",
)
@@ -906,6 +950,9 @@ def update_personal_extracted_data(
doc = db.query(PersonalDocument).filter_by(id=doc_id).first()
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
target_user = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, target_user)
doc.extracted_data = payload.extracted_data
db.commit()
@@ -926,6 +973,9 @@ def update_business_extracted_data(
doc = db.query(BusinessDocument).filter_by(id=doc_id).first()
if not doc:
raise HTTPException(status_code=404, detail="Document not found")
target_user = crud.get_user_by_id(db, doc.user_id)
assert_admin_can_access(current_user, target_user)
doc.extracted_data = payload.extracted_data
db.commit()
@@ -1019,6 +1069,9 @@ def get_user_all_documents(
"name": user.name,
"email": user.email,
"role": user.role.value if hasattr(user.role, "value") else str(user.role),
"assigned_admin_id": user.assigned_admin_id,
"assigned_admin_name": user.assigned_admin.name if user.assigned_admin else None,
"assigned_admin_email": user.assigned_admin.email if user.assigned_admin else None,
"engagement_acknowledged_at": (
user.engagement_acknowledged_at.isoformat()
if user.engagement_acknowledged_at else None
@@ -1061,21 +1114,29 @@ def delete_user_completely(
logger.info(f"Admin {current_user.id} deleting user {user_id}")
try:
for doc in db.query(AdminDocument).filter(AdminDocument.user_id == user_id).all():
delete_from_storage(doc.storage_key)
db.delete(doc)
keys_to_delete = []
for doc in db.query(AdminDocument).filter(AdminDocument.uploaded_by == user_id).all():
delete_from_storage(doc.storage_key)
try:
# If deleted user is an admin who uploaded documents for other clients, disassociate them rather than deleting client deliverables!
db.query(AdminDocument).filter(
AdminDocument.uploaded_by == user_id,
AdminDocument.user_id != user_id
).update({AdminDocument.uploaded_by: None}, synchronize_session=False)
# Admin documents belonging to this user
for doc in db.query(AdminDocument).filter(AdminDocument.user_id == user_id).all():
if doc.storage_key:
keys_to_delete.append(doc.storage_key)
db.delete(doc)
for doc in db.query(PersonalDocument).filter(PersonalDocument.user_id == user_id).all():
delete_from_storage(doc.storage_key)
if doc.storage_key:
keys_to_delete.append(doc.storage_key)
db.delete(doc)
for doc in db.query(BusinessDocument).filter(BusinessDocument.user_id == user_id).all():
delete_from_storage(doc.storage_key)
if doc.storage_key:
keys_to_delete.append(doc.storage_key)
db.delete(doc)
# Clean up legacy uploaded_files rows to avoid FK constraint errors on db.delete(user)
@@ -1121,6 +1182,10 @@ def delete_user_completely(
db.delete(user)
db.commit()
# Delete physical files ONLY after successful DB commit
for k in keys_to_delete:
delete_from_storage(k)
except Exception as e:
db.rollback()
logger.error(f"User deletion failed for {user_id}: {e}")
@@ -1154,13 +1219,13 @@ async def notify_upload_complete(
background.add_task(
send_email,
to=current_user.email,
subject=f"{category} Documents Uploaded — BookKeepro",
subject=f"{category} Documents Uploaded",
body=f"""
<p>Dear {current_user.name or "Sir/Ma'am"},</p>
<p>We received <strong>{count}</strong> {category.lower()}
document{"s" if count != 1 else ""} from you.</p>
<p>Our team will review {"them" if count != 1 else "it"} and update you shortly.</p>
<br><strong>BookKeepro Team</strong>
<br><strong>Support Team</strong>
""",
)
admins = db.query(User).filter(User.role.in_([UserRole.admin, UserRole.super_admin])).all()
@@ -1168,7 +1233,7 @@ async def notify_upload_complete(
background.add_task(
send_email,
to=admin.email,
subject=f"New {category} Upload — BookKeepro",
subject=f"New {category} Upload",
body=f"<p><strong>{current_user.email}</strong> uploaded "
f"{count} {category.lower()} document{'s' if count != 1 else ''}.</p>",
)
@@ -1194,11 +1259,11 @@ async def notify_personal_approval(
background.add_task(
send_email,
to=user.email,
subject="Personal Documents Approved — BookKeepro",
subject="Personal Documents Approved",
body=f"""
<p>Dear {user.name or "Sir/Ma'am"},</p>
<p>Your personal documents have been successfully reviewed and approved.</p>
<br><strong>BookKeepro Team</strong>
<br><strong>Support Team</strong>
""",
)
return {"status": "email_sent"}
@@ -1217,11 +1282,11 @@ async def notify_business_approval(
background.add_task(
send_email,
to=user.email,
subject="Business Documents Approved — BookKeepro",
subject="Business Documents Approved",
body=f"""
<p>Dear {user.name or "Sir/Ma'am"},</p>
<p>Your business documents have been successfully reviewed and approved.</p>
<br><strong>BookKeepro Team</strong>
<br><strong>Support Team</strong>
""",
)
return {"status": "email_sent"}
@@ -1234,17 +1299,17 @@ from app.models import RequiredDocumentTemplate
@router.get("/templates")
def list_templates(
category: str,
tax_year: int,
category: str | None = None,
tax_year: int | None = None,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
):
templates = (
db.query(RequiredDocumentTemplate)
.filter_by(category=category, tax_year=tax_year)
.order_by(RequiredDocumentTemplate.id.asc())
.all()
)
query = db.query(RequiredDocumentTemplate)
if category:
query = query.filter(RequiredDocumentTemplate.category == category)
if tax_year:
query = query.filter(RequiredDocumentTemplate.tax_year == tax_year)
templates = query.order_by(RequiredDocumentTemplate.id.asc()).all()
results = []
for t in templates:
@@ -1333,11 +1398,11 @@ def delete_template(
except (IndexError, AttributeError):
key_to_delete = None
if key_to_delete:
delete_from_storage(key_to_delete)
db.delete(record)
db.commit()
if key_to_delete:
delete_from_storage(key_to_delete)
return {"deleted": True}
from fastapi.responses import StreamingResponse
@@ -1360,10 +1425,7 @@ def export_user_documents_excel(
from openpyxl.styles import Font, PatternFill, Alignment
user = db.query(User).filter(User.id == user_id).first()
if not user:
raise HTTPException(status_code=404, detail="User not found")
if current_user.role == UserRole.admin and user.role != UserRole.user:
raise HTTPException(status_code=403, detail="Admins can only export documents for regular user accounts")
assert_admin_can_access(current_user, user)
personal_docs = db.query(PersonalDocument).filter(
PersonalDocument.user_id == user_id, PersonalDocument.deleted_at == None
@@ -1513,16 +1575,30 @@ def get_bookmarks(
db: Session = Depends(get_db),
current_user=Depends(require_admin),
):
from app.models import AdminDocumentBookmark
from app.models import AdminDocumentBookmark, PersonalDocument, BusinessDocument, AdminDocument, User
bookmarks = db.query(AdminDocumentBookmark).filter_by(
admin_id=current_user.id
).all()
return {
"bookmarks": [
{"doc_kind": b.doc_kind, "doc_id": b.doc_id}
for b in bookmarks
]
}
docs = []
for b in bookmarks:
if b.doc_kind == 'personal':
d = db.query(PersonalDocument).get(b.doc_id)
if d and not d.deleted_at:
u = db.query(User).get(d.user_id)
docs.append({"id": d.id, "type": "personal", "doc_name": d.doc_type, "filename": d.filename, "uploaded_at": d.uploaded_at.isoformat() if d.uploaded_at else None, "user_name": u.name if u else "Unknown", "user_id": d.user_id, "storage_key": d.storage_key})
elif b.doc_kind == 'business':
d = db.query(BusinessDocument).get(b.doc_id)
if d and not d.deleted_at:
u = db.query(User).get(d.user_id)
docs.append({"id": d.id, "type": "business", "doc_name": d.business_type, "filename": d.filename, "uploaded_at": d.uploaded_at.isoformat() if d.uploaded_at else None, "user_name": u.name if u else "Unknown", "user_id": d.user_id, "storage_key": d.storage_key})
elif b.doc_kind == 'admin':
d = db.query(AdminDocument).get(b.doc_id)
if d and not d.deleted_at:
u = db.query(User).get(d.user_id)
docs.append({"id": d.id, "type": "admin", "doc_name": d.doc_label, "filename": d.filename, "uploaded_at": d.uploaded_at.isoformat() if d.uploaded_at else None, "user_name": u.name if u else "Unknown", "user_id": d.user_id, "storage_key": d.storage_key})
return {"bookmarks": docs}
@router.put("/bookmarks/{doc_kind}/{doc_id}")
def add_bookmark(
+11
View File
@@ -75,6 +75,17 @@ class RoleChangeRequest(BaseModel):
return v.lower()
class AssignAdminRequest(BaseModel):
"""Body for PATCH /api/auth/admin/users/{id}/assign-admin — super_admin only."""
admin_id: Optional[int] = None
class BulkAssignAdminRequest(BaseModel):
"""Body for POST /api/auth/admin/users/bulk-assign-admin — super_admin only."""
user_ids: List[int]
admin_id: Optional[int] = None
# ─────────────────────────────────────────────
# Review schemas
# ─────────────────────────────────────────────
+16 -4
View File
@@ -2,7 +2,7 @@
Document type classifier for the "other_*" catch-all upload bucket.
When a user uploads via the "Additional Documents" slot, doc_type is set to
`other_<timestamp>_<index>` — a meaningless slug. This module detects the
`other_<timestamp>_<index>` ? a meaningless slug. This module detects the
actual document type from OCR text + filename so the extraction prompt
becomes type-specific rather than generic.
@@ -24,6 +24,12 @@ class DocCategory(str, Enum):
AADHAAR = "Aadhaar Card"
W2 = "W-2 Wage Statement"
FORM_1099 = "1099 Income Form"
FORM_1040 = "Form 1040 (U.S. Individual Income Tax Return)"
FORM_1120 = "Form 1120/1120-S (U.S. Corporation Tax Return)"
FORM_1065 = "Form 1065 (U.S. Partnership Tax Return)"
SCHEDULE_K1 = "Schedule K-1"
FORM_W9 = "Form W-9 (TIN Request)"
EIN_LETTER = "IRS EIN Assignment Letter"
ENGAGEMENT_LETTER = "Engagement Letter"
TAX_ORGANIZER = "Tax Organizer"
INVOICE = "Invoice / Bill"
@@ -33,7 +39,7 @@ class DocCategory(str, Enum):
GENERIC = "Other Document"
# Priority-ordered keyword patterns — first match wins
# Priority-ordered keyword patterns ? first match wins
_PATTERNS: list[tuple[re.Pattern, DocCategory]] = [
# Government IDs
(re.compile(r'\bPERMANENT\s+ACCOUNT\s+NUMBER\b|\bINCOME\s+TAX\s+DEPT\b', re.I), DocCategory.PAN_CARD),
@@ -43,6 +49,12 @@ _PATTERNS: list[tuple[re.Pattern, DocCategory]] = [
# US Tax forms
(re.compile(r'\bW-?2\b.*\bWAGES\b|\bWAGES.*TIPS.*OTHER\b|\bFEDERAL\s+INCOME\s+TAX\s+WITHHELD\b', re.I), DocCategory.W2),
(re.compile(r'\b1099-?[A-Z]{0,4}\b|\bNONEMPLOYEE\s+COMPENSATION\b|\bMISCELLANEOUS\s+INCOME\b', re.I), DocCategory.FORM_1099),
(re.compile(r'\bFORM\s+1040\b|\b1040-?SR\b|\bU\.S\.\s+INDIVIDUAL\s+INCOME\s+TAX\s+RETURN\b', re.I), DocCategory.FORM_1040),
(re.compile(r'\bFORM\s+1120\b|\b1120-?S\b|\bU\.S\.\s+(CORPORATION|INCOME\s+TAX\s+RETURN\s+FOR\s+AN\s+S\s+CORPORATION)\b', re.I), DocCategory.FORM_1120),
(re.compile(r'\bSCHEDULE\s+K-?1\b|\bPARTNER[\'?]S\s+SHARE\s+OF\s+INCOME\b', re.I), DocCategory.SCHEDULE_K1),
(re.compile(r'\bFORM\s+1065\b|\bU\.S\.\s+RETURN\s+OF\s+PARTNERSHIP\s+INCOME\b', re.I), DocCategory.FORM_1065),
(re.compile(r'\bFORM\s+W-?9\b|\bREQUEST\s+FOR\s+TAXPAYER\s+IDENTIFICATION\b', re.I), DocCategory.FORM_W9),
(re.compile(r'\bCP\s*575\b|\bASSIGNED\s+EMPLOYER\s+IDENTIFICATION\s+NUMBER\b|\bFORM\s+SS-?4\b', re.I), DocCategory.EIN_LETTER),
# Accounting documents
(re.compile(r'\bENGAGEMENT\s+LETTER\b|\bTAX\s+RETURN\s+PREPARATION\s+SERVICES\b', re.I), DocCategory.ENGAGEMENT_LETTER),
(re.compile(r'\bTAX\s+ORGANIZER\b|\bLLC\s+TAX\b|\bS[-\s]?CORP\b|\bPARTNERSHIP\s+TAX\b', re.I), DocCategory.TAX_ORGANIZER),
@@ -61,7 +73,7 @@ def classify_other_doc(
Args:
ocr_text: Raw text extracted from the document (any amount).
filename: Original upload filename — used as a secondary hint.
filename: Original upload filename ? used as a secondary hint.
"""
corpus = f"{filename} {ocr_text}"
@@ -70,7 +82,7 @@ def classify_other_doc(
logger.info(f"[DocClassifier] Detected '{category.value}' from other_* upload")
return category
logger.info("[DocClassifier] No match — defaulting to GENERIC")
logger.info("[DocClassifier] No match ? defaulting to GENERIC")
return DocCategory.GENERIC
+3 -1
View File
@@ -29,8 +29,10 @@ async def send_email(to: str, subject: str, body: str) -> bool:
smtp_port = int(os.getenv("SMTP_PORT", "587"))
smtp_user = os.getenv("SMTP_USER")
smtp_password = os.getenv("SMTP_PASSWORD")
if smtp_password:
smtp_password = smtp_password.replace(" ", "")
mail_from_email = os.getenv("MAIL_FROM") or smtp_user
mail_from_name = os.getenv("MAIL_FROM_NAME", "BookKeepro")
mail_from_name = os.getenv("MAIL_FROM_NAME", "Admin Portal")
smtp_tls = os.getenv("SMTP_TLS", "True").strip().lower() == "true"
smtp_ssl_tls = os.getenv("MAIL_SSL_TLS", "False").strip().lower() == "true"
+5 -5
View File
@@ -1,7 +1,7 @@
import os
from app.utils.emailer import send_email
_FRONTEND_URL = os.getenv("FRONTEND_URL", "https://aiindiacpa.duckdns.org")
_FRONTEND_URL = os.getenv("FRONTEND_URL", "https://aicpa.duckdns.org")
async def send_signup_welcome_email(to: str, name: str | None = None):
@@ -11,7 +11,7 @@ async def send_signup_welcome_email(to: str, name: str | None = None):
<p>Dear {display_name},</p>
<p>
Welcome to <strong>BookKeepro</strong> 🎉
Welcome! 🎉
</p>
<p>
@@ -26,7 +26,7 @@ async def send_signup_welcome_email(to: str, name: str | None = None):
<p>
<a href="{_FRONTEND_URL}/login"
style="color:#0077c8;font-weight:600;text-decoration:none;">
👉 Login to BookKeepro
👉 Login to Dashboard
</a>
</p>
@@ -36,12 +36,12 @@ async def send_signup_welcome_email(to: str, name: str | None = None):
<p style="margin-top:20px;">
Kind regards,<br>
<strong>BookKeepro Team</strong>
<strong>Support Team</strong>
</p>
"""
await send_email(
to=to,
subject="Welcome to BookKeepro 🎉",
subject="Welcome 🎉",
body=body
)
+45 -46
View File
@@ -38,66 +38,65 @@ def _run_deadline_reminders():
).all()
admin_emails = [a.email for a in admins]
for days_out, flag_col, label in thresholds:
target_date = today + timedelta(days=days_out)
deadlines = (
db.query(FilingDeadline)
.filter(
FilingDeadline.deadline_date == target_date,
getattr(FilingDeadline, flag_col) == False,
async def _dispatch_reminders():
for days_out, flag_col, label in thresholds:
target_date = today + timedelta(days=days_out)
deadlines = (
db.query(FilingDeadline)
.filter(
FilingDeadline.deadline_date == target_date,
getattr(FilingDeadline, flag_col) == False,
)
.all()
)
.all()
)
for dl in deadlines:
user = db.query(User).filter(User.id == dl.user_id).first()
if not user:
continue
for dl in deadlines:
user = db.query(User).filter(User.id == dl.user_id).first()
if not user:
continue
doc_label = dl.doc_type.capitalize()
doc_label = dl.doc_type.capitalize()
# Email to user
user_body = f"""
<p>Dear {user.name or "Sir/Ma'am"},</p>
<p>This is a reminder that your <strong>{doc_label} document filing deadline</strong>
is in <strong>{label}</strong> ({dl.deadline_date.strftime('%B %d, %Y')}).</p>
<p>Please ensure all outstanding actions are completed before the deadline.</p>
<p>Kind regards,<br><strong>BookKeepro Team</strong></p>
"""
asyncio.run(
send_email(
# Email to user
user_body = f"""
<p>Dear {user.name or "Sir/Ma'am"},</p>
<p>This is a reminder that your <strong>{doc_label} document filing deadline</strong>
is in <strong>{label}</strong> ({dl.deadline_date.strftime('%B %d, %Y')}).</p>
<p>Please ensure all outstanding actions are completed before the deadline.</p>
<p>Kind regards,<br><strong>Support Team</strong></p>
"""
await send_email(
to=user.email,
subject=f"Reminder: {doc_label} Filing Deadline in {label} — BookKeepro",
subject=f"Reminder: {doc_label} Filing Deadline in {label}",
body=user_body,
)
)
# Email to all admins
admin_body = f"""
<p>Admin Notice:</p>
<p>The <strong>{doc_label} filing deadline</strong> for client
<strong>{user.name or user.email}</strong> ({user.email}) is in
<strong>{label}</strong> ({dl.deadline_date.strftime('%B %d, %Y')}).</p>
<p>Please review the client's status and take any necessary action.</p>
<p><strong>BookKeepro System</strong></p>
"""
for admin_email in admin_emails:
asyncio.run(
send_email(
# Email to all admins
admin_body = f"""
<p>Admin Notice:</p>
<p>The <strong>{doc_label} filing deadline</strong> for client
<strong>{user.name or user.email}</strong> ({user.email}) is in
<strong>{label}</strong> ({dl.deadline_date.strftime('%B %d, %Y')}).</p>
<p>Please review the client's status and take any necessary action.</p>
<p><strong>Admin System</strong></p>
"""
for admin_email in admin_emails:
await send_email(
to=admin_email,
subject=f"Admin Reminder: {user.email} — {doc_label} Deadline in {label}",
body=admin_body,
)
# Mark as notified
setattr(dl, flag_col, True)
db.commit()
logger.info(
"Sent %s deadline reminder for user %s (%s)",
label, dl.user_id, dl.doc_type,
)
# Mark as notified
setattr(dl, flag_col, True)
db.commit()
logger.info(
"Sent %s deadline reminder for user %s (%s)",
label, dl.user_id, dl.doc_type,
)
asyncio.run(_dispatch_reminders())
except Exception as exc:
logger.error("Deadline reminder job failed: %s", exc)
finally:
+8
View File
@@ -0,0 +1,8 @@
from app.db import SessionLocal
from app.models import User
db = SessionLocal()
users = db.query(User).filter(User.email.ilike("%%atharva%%")).all()
for u in users:
print(f"ID: {u.id}, Email: '{u.email}'")
db.close()
+59
View File
@@ -0,0 +1,59 @@
import os
import sys
import socket
import asyncio
from pathlib import Path
from dotenv import load_dotenv
# Load .env
for p in [Path(__file__).resolve().parents[2] / ".env", Path(".env"), Path(__file__).resolve().parent / ".env"]:
if p.is_file():
load_dotenv(p)
break
print("=== 1. Environment Variables Check ===")
smtp_host = os.getenv("SMTP_HOST")
smtp_port = int(os.getenv("SMTP_PORT", "587"))
smtp_user = os.getenv("SMTP_USER")
smtp_password = os.getenv("SMTP_PASSWORD")
mail_from = os.getenv("MAIL_FROM") or smtp_user
admin_email = os.getenv("ADMIN_EMAIL")
print(f"SMTP_HOST: {smtp_host}")
print(f"SMTP_PORT: {smtp_port}")
print(f"SMTP_USER: {smtp_user}")
print(f"MAIL_FROM: {mail_from}")
print(f"ADMIN_EMAIL: {admin_email}")
print(f"SMTP_PASSWORD: {'SET (length: ' + str(len(smtp_password)) + ')' if smtp_password else 'NOT SET'}")
if not smtp_host or not smtp_user or not smtp_password:
print("\n[FAIL] Missing required SMTP configuration in .env!")
sys.exit(1)
print("\n=== 2. Network Connectivity (Port reachability) ===")
try:
sock = socket.create_connection((smtp_host, smtp_port), timeout=10)
sock.close()
print(f"[OK] Successfully connected to {smtp_host}:{smtp_port}")
except Exception as e:
print(f"[FAIL] Cannot connect to {smtp_host}:{smtp_port} -> {e}")
print("WARNING: Outbound port 587 might be blocked by your VPS provider (e.g. Contabo firewall)!")
print("\n=== 3. Sending Test Email ===")
from app.utils.emailer import send_email
test_recipient = sys.argv[1] if len(sys.argv) > 1 else (admin_email or smtp_user)
print(f"Sending test email to: {test_recipient}...")
async def main():
ok = await send_email(
to=test_recipient,
subject="[Test] BookKeepPro SMTP Diagnostic Test",
body="<h3>BookKeepPro SMTP is working!</h3><p>This is a diagnostic verification email.</p>"
)
if ok:
print(f"[SUCCESS] Email delivered successfully to {test_recipient}!")
else:
print(f"[FAIL] send_email returned False. Check the error log above.")
asyncio.run(main())
+23
View File
@@ -197,6 +197,29 @@ def upgrade():
except Exception as e:
print(f" [WARN] Template seed: {e}")
# -- v9: Assigned admin support for users --------------------------
_add_column(conn, "users", "assigned_admin_id", "INT NULL DEFAULT NULL")
try:
conn.execute(text("ALTER TABLE users ADD CONSTRAINT fk_users_assigned_admin FOREIGN KEY (assigned_admin_id) REFERENCES users(id) ON DELETE SET NULL;"))
print(" [OK] Added fk_users_assigned_admin constraint")
except Exception as e:
msg = str(e).lower()
if "duplicate" in msg or "already exists" in msg:
print(" [SKIP] fk_users_assigned_admin already exists")
else:
print(f" [WARN] fk_users_assigned_admin: {e}")
try:
conn.execute(text("CREATE INDEX ix_users_assigned_admin_id ON users(assigned_admin_id);"))
print(" [OK] Added ix_users_assigned_admin_id index")
except Exception as e:
msg = str(e).lower()
if "duplicate" in msg or "already exists" in msg:
print(" [SKIP] ix_users_assigned_admin_id already exists")
else:
print(f" [WARN] ix_users_assigned_admin_id: {e}")
print("\nAll migrations complete.")
except Exception as e:
+2 -2
View File
@@ -42,5 +42,5 @@ pypdf==4.3.1
chromadb==0.5.5
openpyxl
APScheduler
openpyxl==3.1.5
APScheduler==3.11.3
+17
View File
@@ -0,0 +1,17 @@
from app.database import SessionLocal
from app.models import User
from app.crud import get_password_hash
db = SessionLocal()
email = "atharvagunjarge5@gmail.com".lower()
user = db.query(User).filter(User.email == email).first()
if user:
new_password = "Gunjarge@1705"
user.hashed_password = get_password_hash(new_password)
db.commit()
print("Password updated successfully!")
else:
print("User not found in database!")
db.close()
+17
View File
@@ -0,0 +1,17 @@
from app.db import SessionLocal
from app.models import User
from app.crud import get_password_hash
db = SessionLocal()
email = "atharvagunjarge5@gmail.com".lower()
user = db.query(User).filter(User.email == email).first()
if user:
new_password = "Gunjarge@1705"
user.hashed_password = get_password_hash(new_password)
db.commit()
print("Password updated successfully!")
else:
print("User not found in database!")
db.close()
+22
View File
@@ -0,0 +1,22 @@
from app.db import SessionLocal
from app.models import User
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def get_password_hash(password: str):
return pwd_context.hash(password)
db = SessionLocal()
email = "atharvagunjarge5@gmail.com".lower()
user = db.query(User).filter(User.email == email).first()
if user:
new_password = "Gunjarge@1705"
user.hashed_password = get_password_hash(new_password)
db.commit()
print("Password updated successfully!")
else:
print("User not found in database!")
db.close()
+19 -2
View File
@@ -1,5 +1,17 @@
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
# Try loading .env from repo root or current directory
for env_candidate in [
Path(__file__).resolve().parents[2] / ".env",
Path(__file__).resolve().parent / ".env",
Path(".env")
]:
if env_candidate.is_file():
load_dotenv(env_candidate)
break
REQUIRED_VARS = [
"MYSQL_USER",
@@ -12,11 +24,16 @@ REQUIRED_VARS = [
def main():
missing = []
placeholder_values = {
"your_password", "your_password_here", "password", "secret",
"your_secret_key", "changeme", "change_me", "placeholder",
"your_api_key_here", "example", "admin"
}
for var in REQUIRED_VARS:
val = os.getenv(var)
if not val:
if not val or not val.strip():
missing.append(var)
elif "password" in val.lower() or "secret" in val.lower() or "your" in val.lower() or "here" in val.lower():
elif val.lower().strip() in placeholder_values or val.lower().startswith("your_") or val.lower().endswith("_here"):
if var in ["SECRET_KEY", "MYSQL_PASSWORD"]:
missing.append(f"{var} (looks like a placeholder)")
else: