feat: complete platform overhaul, bugfixes, and verified production release

This commit is contained in:
Atharv1705
2026-10-28 21:47:48 +05:30
parent 276039a743
commit 3cb6229cd9
62 changed files with 1820 additions and 548 deletions
+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 **Target Domain:** [`https://aicpa.duckdns.org`](https://aicpa.duckdns.org)
**Target VPS Server:** `Contabo VPS (13.140.170.213)`
- Docker + Docker Compose installed on the VPS **Stack:** React 19 (Vite) + FastAPI (Python 3.12) + MySQL 8.4 + Docker Compose + Host Nginx (Certbot SSL)
- Port 80 open in Contabo firewall and VPS firewall (`ufw allow 80`)
- Node.js 18+ installed locally (for the frontend build)
--- ---
## First-time deployment ## 1. System Architecture
### 1. Clone the repo ```mermaid
graph TD
```bash Client(["🌐 Web Client (HTTPS)"]) -->|"Port 443 / 80"| HostNginx["Host Nginx Reverse Proxy<br/>(13.140.170.213)<br/>Let's Encrypt SSL Certbot"]
git clone https://github.com/Atharv1705/Bookkeepro.git
cd Bookkeepro 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 ## 2. Pre-Deployment: Local Workstation Preparation
cp .env.example .env
# Edit .env — fill in MYSQL_PASSWORD, SECRET_KEY, SMTP_PASSWORD, OPENROUTER_API_KEY
nano .env
```
**Required variables in `.env`:** Perform these steps inside your local project folder (`Bookkeep`):
```
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>
```
### 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. ```powershell
If this folder is missing or stale, the UI will not load.
```bash
# On VPS or locally (then scp the dist/ folder to VPS)
cd frontend cd frontend
npm install
npm run build npm run build
cd .. cd ..
``` ```
*Expected Output:*
### 4. Start all services ```text
dist/index.html 1.05 kB
```bash dist/assets/index-Q3NiwG1z.css 44.73 kB
docker compose up -d --build dist/assets/index-DYQgi1rI.js 418.74 kB
✓ built in 1.5s
``` ```
This starts: `nginx` (port 80), `app` (FastAPI, internal), `db` (MySQL, internal). ### Step 2.2 — Validate Environment Schema
Ensure no placeholder passwords or missing keys exist:
### 5. Run database migrations ```powershell
python services/api/validate_env.py
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
``` ```
*Expected Output:* `Environment validation passed.`
### 6. Create the first super admin ### Step 2.3 — Commit and Push to Git
Commit all validated changes, tests, and updated build files:
```bash ```powershell
docker exec -it $(docker compose ps -q app) python create_super_admin.py git add .
``` git commit -m "feat: complete platform overhaul, bugfixes, and verified production release"
git push origin main
### 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
``` ```
--- ---
## Updating to a new version ## 3. VPS Initial Setup & Prerequisites (One-Time)
Log in to your Contabo VPS via SSH:
```bash ```bash
git pull ssh root@13.140.170.213
```
# Rebuild frontend if any frontend files changed ### Step 3.1 — Install System Packages & Docker
cd frontend && npm install && npm run build && cd .. 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) # Install Docker & Compose plugin
docker compose up -d --build app nginx curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo systemctl enable --now docker
```
# Run migrations if schema changed ### Step 3.2 — Configure Firewall (UFW)
docker exec $(docker compose ps -q app) python migrate.py Ensure HTTP, HTTPS, and SSH ports are open:
```bash
# Re-run AI extraction backfill if needed sudo ufw allow 22/tcp
docker exec $(docker compose ps -q app) python backfill_extraction.py 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 ```bash
# Install certbot sudo nano /etc/nginx/sites-available/aicpa.duckdns.org
apt install certbot python3-certbot-nginx ```
# Get certificate (replace with your domain) Paste the following configuration:
certbot --nginx -d bookkeepro.net -d www.bookkeepro.net
# Update ALLOWED_ORIGINS in .env to use https:// ```nginx
# Update FRONTEND_URL in .env to use https:// server {
docker compose restart app 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 ```bash
# Run before any major upgrade cd /var/www/Bookkeep # or your deployment directory on the VPS
docker exec $(docker compose ps -q db) \ git pull origin main
mysqldump -uroot -p"${MYSQL_PASSWORD}" bookkeepprodb \
> backup_$(date +%Y%m%d_%H%M%S).sql
``` ```
### 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 | Execute these verification checks from your browser and terminal:
|---|---|
| UI loads blank / 404 | Run `npm run build` in `frontend/` — dist is missing | | Test # | Check Item | Test Action | Expected Result |
| 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 | | **1** | **SSL / HTTPS** | Navigate to `https://aicpa.duckdns.org` | Valid green padlock; redirects HTTP to HTTPS automatically |
| Login fails | Check `MYSQL_HOST=db` in `.env` (not `localhost`) | | **2** | **Health Endpoint** | `curl -i https://aicpa.duckdns.org/health` | `HTTP/1.1 200 OK` with body `{"status":"ok"}` |
| Emails not sending | Verify Gmail App Password in `.env`, check SMTP_PASSWORD has no spaces | | **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
```
+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")
+5 -4
View File
@@ -4,13 +4,14 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/webp" href="/images/bookkeeppro-logo.webp" /> <link rel="icon" type="image/webp" href="/images/bookkeeppro-logo.webp" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <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." /> <meta name="description" content="BookKeepPro &mdash; 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> <title>BookKeepPro &mdash; Bookkeeping, Payroll &amp; Tax Services</title>
<link rel="stylesheet" href="/css/base.css"/> <link rel="stylesheet" href="/css/base.css"/>
<link rel="stylesheet" href="/css/components.css"/> <link rel="stylesheet" href="/css/components.css"/>
<link rel="stylesheet" href="/css/marketing.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/chatbot.css" />
<link rel="stylesheet" href="/css/animations.css" media="print" onload="this.media='all'" /> <link rel="stylesheet" href="/css/animations.css" />
<link rel="stylesheet" href="/css/dynamic.css" />
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
+1 -105
View File
@@ -13,8 +13,7 @@
"lucide-react": "^1.24.0", "lucide-react": "^1.24.0",
"react": "^19.2.7", "react": "^19.2.7",
"react-dom": "^19.2.7", "react-dom": "^19.2.7",
"react-router-dom": "^7.18.1", "react-router-dom": "^7.18.1"
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4.3.2", "@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": { "node_modules/agent-base": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -2169,28 +2159,6 @@
], ],
"license": "CC-BY-4.0" "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": { "node_modules/combined-stream": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -2216,18 +2184,6 @@
"url": "https://opencollective.com/express" "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": { "node_modules/csstype": {
"version": "3.2.3", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -2424,15 +2380,6 @@
"node": ">= 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": { "node_modules/fraction.js": {
"version": "5.3.4", "version": "5.3.4",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
@@ -3238,18 +3185,6 @@
"node": ">=0.10.0" "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": { "node_modules/tailwindcss": {
"version": "4.3.2", "version": "4.3.2",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.2.tgz", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.2.tgz",
@@ -3404,45 +3339,6 @@
"optional": true "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"
}
} }
} }
} }
+2 -3
View File
@@ -15,8 +15,7 @@
"lucide-react": "^1.24.0", "lucide-react": "^1.24.0",
"react": "^19.2.7", "react": "^19.2.7",
"react-dom": "^19.2.7", "react-dom": "^19.2.7",
"react-router-dom": "^7.18.1", "react-router-dom": "^7.18.1"
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4.3.2", "@tailwindcss/postcss": "^4.3.2",
@@ -31,4 +30,4 @@
"tailwindcss": "^4.3.2", "tailwindcss": "^4.3.2",
"vite": "^8.1.1" "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.')
+12 -2
View File
@@ -13,7 +13,7 @@
/* core palette */ /* core palette */
--ink: #17211D; --ink: #17211D;
--ink-soft: #2A362F; --ink-soft: #2A362F;
--brass: #B0803D; --brass: #8F6528;
--brass-dark: #8F6528; --brass-dark: #8F6528;
--brass-light: rgba(176, 128, 61, 0.12); --brass-light: rgba(176, 128, 61, 0.12);
--emerald: #1F5D46; --emerald: #1F5D46;
@@ -41,7 +41,7 @@
--success-bg: rgba(31, 93, 70, 0.10); --success-bg: rgba(31, 93, 70, 0.10);
--error: #A63A3A; --error: #A63A3A;
--error-bg: rgba(166, 58, 58, 0.10); --error-bg: rgba(166, 58, 58, 0.10);
--warn: #B0803D; --warn: #8F6528;
--warn-bg: rgba(176, 128, 61, 0.12); --warn-bg: rgba(176, 128, 61, 0.12);
--font-display: 'Fraunces', 'Georgia', serif; --font-display: 'Fraunces', 'Georgia', serif;
@@ -299,3 +299,13 @@ textarea:focus {
from { transform: rotate(0deg); } from { transform: rotate(0deg); }
to { transform: rotate(360deg); } 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 */
}
}
+16 -3
View File
@@ -195,8 +195,8 @@
flex-shrink: 0; font-family: var(--font-display); flex-shrink: 0; font-family: var(--font-display);
} }
.user-info { min-width: 0; flex: 1; } .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-name { font-weight: 600; color: var(--ink); font-size: 14px; word-break: break-word; }
.user-info .u-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; } .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; } .user-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 10; flex-wrap: wrap; }
/* ── Role Controls ───────────────────────────────────────── */ /* ── Role Controls ───────────────────────────────────────── */
@@ -227,7 +227,7 @@
} }
.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: #cfc7ad; background: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(23,33,29,0.06); }
.doc-row-left { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; } .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-type { font-size: 12px; color: var(--muted); }
.doc-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; } .doc-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
@@ -856,3 +856,16 @@
} }
/* 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;
}
+171
View File
@@ -0,0 +1,171 @@
/* ============================================================
dynamic.css — Ledger motion layer
Uses ONLY existing tokens (colours, Fraunces / IBM Plex 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: 176, 128, 61; /* = original brass, for rgba() */
--emerald-rgb: 31, 93, 70;
}
/* ---------- 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(--emerald); 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, var(--emerald), rgb(var(--brass-rgb)));
transform: scaleX(var(--scroll, 0)); transform-origin: 0 50%; pointer-events: none;
}
/* ---------- Header / navbar respond to scroll ---------- */
.navbar:not(.navbar-solid) { position: fixed; transition: background 0.35s, box-shadow 0.35s, border-color 0.35s; }
html[data-scrolled] .navbar:not(.navbar-solid) {
background: rgba(23, 33, 29, 0.92);
box-shadow: 0 10px 28px -14px rgba(23, 33, 29, 0.6);
border-bottom-color: rgba(var(--brass-rgb), 0.35);
}
.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; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > * {
animation: rise 0.65s var(--ease-out) backwards;
animation-delay: var(--d, 0ms);
}
/* beat the older `fade-up` (fill-mode both) which froze the hover-lift transform */
.fade-up, .service-card.fade-up, .user-card.fade-up { animation-name: rise; animation-duration: 0.65s; animation-timing-function: var(--ease-out); animation-fill-mode: backwards; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(1) { --d: 40ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(2) { --d: 110ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(3) { --d: 180ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(4) { --d: 250ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(5) { --d: 320ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(6) { --d: 380ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(7) { --d: 430ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(8) { --d: 480ms; }
:is(.admin-stats, .users-grid, .services-grid, .return-cards, .stat-row) > :nth-child(n+9) { --d: 520ms; }
/* ---------- Cards: lift + pointer spotlight (vars set in motion.js) ---------- */
:is(.stat-card, .user-card, .service-card, .card) { position: relative; }
:is(.stat-card, .user-card, .service-card, .card):hover {
background-image: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--brass-rgb), 0.10), transparent 62%);
}
.stat-icon { display: inline-flex; transition: transform 0.5s var(--ease-spring); }
.stat-card:hover .stat-icon { transform: translateY(-3px) rotate(-6deg) scale(1.08); }
.stat-card.active-filter { animation: rise 0.65s var(--ease-out) backwards, ringPulse 2.6s 1s ease-out infinite; animation-delay: var(--d, 0ms), 1s; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(var(--emerald-rgb), 0.28); } 70%, 100% { box-shadow: 0 0 0 10px rgba(var(--emerald-rgb), 0); } }
.user-avatar { transition: transform 0.4s var(--ease-spring), box-shadow 0.3s; }
.user-card:hover .user-avatar { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(var(--brass-rgb), 0.22); }
.service-card img { transition: transform 0.9s var(--ease-out); }
.service-card:hover img { transform: scale(1.06); }
/* ---------- 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, .login-btn::before {
content: ''; position: absolute; inset: 0; pointer-events: none;
background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.26) 50%, transparent 70%);
transform: translateX(-130%); transition: transform 0.8s var(--ease-out);
}
.btn-primary:not(:disabled):hover::before, .login-btn:hover::before { transform: translateX(130%); }
.login-btn { position: relative; overflow: hidden; }
/* ---------- 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, skeletons ---------- */
.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; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton { position: relative; overflow: hidden; background: var(--border); border-radius: var(--radius-md); }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent); animation: shimmer 1.4s infinite; }
.skeleton-card { height: 128px; }
/* ---------- Upload drop zone ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.drop-zone { transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease-spring), box-shadow 0.3s; }
.drop-zone:hover .material-symbols-outlined { animation: bob 1.3s ease-in-out infinite; }
.drop-zone.drag-over { border-style: solid; border-color: rgb(var(--brass-rgb)); background: rgba(var(--brass-rgb), 0.10); transform: scale(1.015); box-shadow: var(--shadow-glow); }
.drop-zone.drag-over .material-symbols-outlined { animation: bob 0.7s ease-in-out infinite; }
/* ---------- Chatbot + banners ---------- */
@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); }
@keyframes glowNudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--brass-rgb), 0); } 50% { box-shadow: 0 0 0 6px rgba(var(--brass-rgb), 0.18); } }
.engagement-banner:not(.acknowledged) { animation: glowNudge 3.2s 1s ease-in-out 3; }
/* ---------- Marketing: hero + reveals ---------- */
/* Ambient light: soft brass + emerald glows drift over the (static) photo. Gradients only — no image scaling, so it stays cheap. */
.hero { isolation: isolate; }
.hero::after {
content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
background:
radial-gradient(55% 50% at 18% 28%, rgba(var(--brass-rgb), 0.20), transparent 70%),
radial-gradient(50% 60% at 86% 82%, rgba(var(--emerald-rgb), 0.30), transparent 70%);
animation: drift 20s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate3d(-4%, -3%, 0) scale(1); } to { transform: translate3d(4%, 3%, 0) scale(1.12); } }
@media (max-width: 768px) { .hero::after { animation: none; } }
.hero-eyebrow, .hero h1, .hero-sub, .hero-actions { animation: rise 1s var(--ease-out) backwards; }
.hero-eyebrow { animation-delay: 0.1s; } .hero h1 { animation-delay: 0.22s; } .hero-sub { animation-delay: 0.4s; } .hero-actions { animation-delay: 0.55s; }
.hero h1 em { background: linear-gradient(rgb(var(--brass-rgb)), rgb(var(--brass-rgb))) no-repeat 0 100% / 0 2px; padding-bottom: 0.08em; animation: drawRule 1.2s 1.1s var(--ease-out) forwards; }
@keyframes drawRule { to { background-size: 100% 2px; } }
.hero-stats { animation: rise 1.1s 0.7s var(--ease-out) backwards; }
.stat-block { transition: background 0.3s; }
.stat-block:hover { background: rgba(var(--brass-rgb), 0.08); }
.stat-figure { transition: color 0.3s, transform 0.4s var(--ease-spring); }
.stat-block:hover .stat-figure { color: var(--emerald); transform: scale(1.06); }
/* 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); }
@supports (animation-timeline: view()) {
@keyframes parallaxY { from { transform: translateY(-18px) scale(1.04); } to { transform: translateY(18px) scale(1.04); } }
.about-media img { animation: parallaxY linear both; animation-timeline: view(); animation-range: cover 0% 100%; }
}
/* 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) { :is(.stat-card, .user-card, .service-card, .card):hover { background-image: none; } }
+4 -4
View File
@@ -8,10 +8,10 @@ BookKeepPro handles the books, the payroll and the filings for growing businesse
## Pages ## Pages
- [Home](https://aiindiacpa.duckdns.org/) - [Home](https://aicpa.duckdns.org/)
- [About Us](https://aiindiacpa.duckdns.org/about-us) - [About Us](https://aicpa.duckdns.org/about-us)
- [Services](https://aiindiacpa.duckdns.org/services) - [Services](https://aicpa.duckdns.org/services)
- [Contact Us](https://aiindiacpa.duckdns.org/contact) - [Contact Us](https://aicpa.duckdns.org/contact)
## Services ## Services
+1 -1
View File
@@ -14,4 +14,4 @@ Disallow: /reset-password
Disallow: /verify-email Disallow: /verify-email
Disallow: /resend-verification 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"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>https://aiindiacpa.duckdns.org/</loc> <loc>https://aicpa.duckdns.org/</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<priority>1.0</priority> <priority>1.0</priority>
</url> </url>
<url> <url>
<loc>https://aiindiacpa.duckdns.org/about</loc> <loc>https://aicpa.duckdns.org/about</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url> <url>
<loc>https://aiindiacpa.duckdns.org/services</loc> <loc>https://aicpa.duckdns.org/services</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url> <url>
<loc>https://aiindiacpa.duckdns.org/contact</loc> <loc>https://aicpa.duckdns.org/contact</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
</url> </url>
<url> <url>
<loc>https://aiindiacpa.duckdns.org/login</loc> <loc>https://aicpa.duckdns.org/login</loc>
<changefreq>yearly</changefreq> <changefreq>yearly</changefreq>
<priority>0.5</priority> <priority>0.5</priority>
</url> </url>
<url> <url>
<loc>https://aiindiacpa.duckdns.org/signup</loc> <loc>https://aicpa.duckdns.org/signup</loc>
<changefreq>yearly</changefreq> <changefreq>yearly</changefreq>
<priority>0.5</priority> <priority>0.5</priority>
</url> </url>
+20 -18
View File
@@ -98,19 +98,7 @@ export default function AdminChatbot() {
// ── System overview ─────────────────────────────────────────────────────── // ── System overview ───────────────────────────────────────────────────────
const handleAdminStatusCheck = async () => { const handleAdminStatusCheck = async () => {
setMessages(prev => [...prev, { type: 'user', role: 'user', text: 'Give me a system overview.' }]); sendMessage('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.' }]);
}
}; };
// ── Bulk action executor with confirmation ──────────────────────────────── // ── Bulk action executor with confirmation ────────────────────────────────
@@ -161,18 +149,32 @@ export default function AdminChatbot() {
const replyText = data.content || "Sorry, I couldn't understand that."; const replyText = data.content || "Sorry, I couldn't understand that.";
// Check if response contains a bulk_action JSON block // Check if response contains a bulk_action JSON block
const bulkMatch = replyText.match(/\{[^{}]*"bulk_action"[^{}]*\}/s); let jsonStr = replyText;
if (bulkMatch) { 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 { try {
const parsed = JSON.parse(bulkMatch[0]); const parsed = JSON.parse(jsonStr);
if (parsed.bulk_action) { if (parsed.bulk_action) {
setPendingBulk(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." }]); setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: cleanText || "I can do that. Please confirm below." }]);
setIsTyping(false); setIsTyping(false);
return; 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 }]); setMessages(prev => [...prev, { type: 'bot', role: 'assistant', text: replyText }]);
+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,4 +1,4 @@
import * as XLSX from 'xlsx';
import { useState } from 'react'; import { useState } from 'react';
import ExpandableValue from './ExpandableValue'; import ExpandableValue from './ExpandableValue';
@@ -62,45 +62,7 @@ export default function ExpandableSummaryBlock({ extractedData, onSave }) {
} }
}; };
const handleExport = () => { const showToggle = entries.length > 3;
// 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 entriesToShow = expanded ? entries : entries.slice(0, 3); const entriesToShow = expanded ? entries : entries.slice(0, 3);
const confidenceStyle = CONFIDENCE_STYLES[_meta?.tier] || CONFIDENCE_STYLES.unknown; const confidenceStyle = CONFIDENCE_STYLES[_meta?.tier] || CONFIDENCE_STYLES.unknown;
@@ -164,9 +126,6 @@ export default function ExpandableSummaryBlock({ extractedData, onSave }) {
) : <div />} ) : <div />}
<div style={{ display: 'flex', gap: '6px' }}> <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"> <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 <span className="material-symbols-outlined" style={{ fontSize: '14px' }}>edit</span> Edit
</button> </button>
+2 -2
View File
@@ -23,7 +23,7 @@ export default function ExpandableValue({ value, isArray }) {
style={{ style={{
background: 'none', background: 'none',
border: 'none', border: 'none',
color: 'var(--primary)', color: 'var(--emerald)',
fontSize: '12px', fontSize: '12px',
fontWeight: 600, fontWeight: 600,
padding: '4px 0', padding: '4px 0',
@@ -60,7 +60,7 @@ export default function ExpandableValue({ value, isArray }) {
style={{ style={{
background: 'none', background: 'none',
border: 'none', border: 'none',
color: 'var(--primary)', color: 'var(--emerald)',
fontSize: '12px', fontSize: '12px',
fontWeight: 600, fontWeight: 600,
padding: '4px 0', padding: '4px 0',
+2 -1
View File
@@ -20,7 +20,8 @@ export default function Footer() {
<div className="footer-contact"> <div className="footer-contact">
<h3>Reach us</h3> <h3>Reach us</h3>
<p>USA · 2520 Indigo Dr, McKinney, TX 75072</p> <p>USA · 2520 Indigo Dr, McKinney, TX 75072</p>
<p>India · 508 White Square, Hinjewadi Road, Pune 411057</p> <p>India · Office no.405, Fourth floor, Above Just In Time,<br />
Landmark Centre, Survey No 46/1B, Plot No 2, Satara Rd,<br /> Opposite City Pride Theater, Pune, Maharashtra-411009</p>
<p>atharvg.aiindia@gmail.com</p> <p>atharvg.aiindia@gmail.com</p>
<p>+91 8275367267</p> <p>+91 8275367267</p>
</div> </div>
+23
View File
@@ -0,0 +1,23 @@
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="status-chip-container">
<span className={`badge ${badgeClass} `}>{statusText}</span>
{note && (
<div className="status-chip-note">
{s === 'rejected' ? 'Reason: ' : 'Note: '}{note}
</div>
)}
</div>
);
}
+70 -3
View File
@@ -5,19 +5,19 @@
--color-brand-emerald: #1F5D46; --color-brand-emerald: #1F5D46;
--color-brand-emerald-dark: #163F30; --color-brand-emerald-dark: #163F30;
--color-brand-emerald-light: #E8F1EC; --color-brand-emerald-light: #E8F1EC;
--color-brand-brass: #B0803D; --color-brand-brass: #8F6528;
--color-brand-brass-dark: #8F6528; --color-brand-brass-dark: #8F6528;
--color-brand-brass-light: #F6EEE0; --color-brand-brass-light: #F6EEE0;
--color-brand-paper: #F5F2E9; --color-brand-paper: #F5F2E9;
--color-brand-card: #FFFFFF; --color-brand-card: #FFFFFF;
--color-brand-muted: #6B7268; --color-brand-muted: #656C62;
--color-brand-border: #E3DDC9; --color-brand-border: #E3DDC9;
--color-status-success: #1F5D46; --color-status-success: #1F5D46;
--color-status-success-bg: #E8F1EC; --color-status-success-bg: #E8F1EC;
--color-status-error: #A63A3A; --color-status-error: #A63A3A;
--color-status-error-bg: #F7E9E9; --color-status-error-bg: #F7E9E9;
--color-status-warn: #B0803D; --color-status-warn: #8F6528;
--color-status-warn-bg: #F6EEE0; --color-status-warn-bg: #F6EEE0;
--font-sans: "IBM Plex Sans", system-ui, sans-serif; --font-sans: "IBM Plex Sans", system-ui, sans-serif;
@@ -321,3 +321,70 @@ h3 { @apply text-2xl md:text-3xl; }
.toast-info { border-left: 4px solid var(--emerald); } .toast-info { border-left: 4px solid var(--emerald); }
.toast-message { flex: 1; font-size: 14px; font-weight: 500; } .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; } .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(--emerald);
border-bottom-color: var(--emerald);
}
.card-title {
font-family: var(--font-sans);
font-weight: 600;
}
.footer-copy {
color: #8c9289; /* Increased contrast for footer copyright */
}
+3 -2
View File
@@ -1,9 +1,10 @@
import { Outlet, Link, useNavigate } from 'react-router-dom'; import { Outlet, Link, useNavigate, useLocation } from 'react-router-dom';
import { useAuth } from '../context/AuthContext'; import { useAuth } from '../context/AuthContext';
export default function DashboardLayout() { export default function DashboardLayout() {
const { user, logout } = useAuth(); const { user, logout } = useAuth();
const navigate = useNavigate(); const navigate = useNavigate();
const { pathname } = useLocation();
return ( return (
<div className="app-body"> <div className="app-body">
@@ -21,7 +22,7 @@ export default function DashboardLayout() {
</div> </div>
</header> </header>
<main className={`${(user?.role === 'admin' || user?.role === 'super_admin') ? 'page-main-wide' : 'page-main'} page-enter`}> <main key={pathname} className={`${(user?.role === 'admin' || user?.role === 'super_admin') ? 'page-main-wide' : 'page-main'} page-enter`}>
<Outlet /> <Outlet />
</main> </main>
</div> </div>
+3 -2
View File
@@ -1,12 +1,13 @@
import { Outlet } from 'react-router-dom'; import { Outlet, useLocation } from 'react-router-dom';
import Navbar from '../components/Navbar'; import Navbar from '../components/Navbar';
import Footer from '../components/Footer'; import Footer from '../components/Footer';
export default function MarketingLayout() { export default function MarketingLayout() {
const { pathname } = useLocation();
return ( return (
<> <>
<Navbar /> <Navbar />
<main> <main key={pathname} className="page-enter">
<Outlet /> <Outlet />
</main> </main>
<Footer /> <Footer />
+3 -1
View File
@@ -1,2 +1,4 @@
import { Outlet } from 'react-router-dom'; import { Outlet } from 'react-router-dom';
export default function PublicLayout() { return <Outlet />; } export default function PublicLayout() { return <main>
<Outlet />
</main>; }
+2
View File
@@ -3,6 +3,7 @@ import { createRoot } from 'react-dom/client'
import './index.css' import './index.css'
import App from './App.jsx' import App from './App.jsx'
import { initScrollReveal } from './utils/scrollReveal.js' import { initScrollReveal } from './utils/scrollReveal.js'
import { initMotion } from './utils/motion.js'
createRoot(document.getElementById('root')).render( createRoot(document.getElementById('root')).render(
<StrictMode> <StrictMode>
@@ -11,3 +12,4 @@ createRoot(document.getElementById('root')).render(
) )
initScrollReveal() initScrollReveal()
initMotion()
+5 -5
View File
@@ -11,7 +11,7 @@ export default function AdminDashboard() {
const [confirmConfig, setConfirmConfig] = useState({ const [confirmConfig, setConfirmConfig] = useState({
isOpen: false, title: "", message: "", confirmText: "OK", isDestructive: false, onConfirm: () => {} isOpen: false, title: "", message: "", confirmText: "OK", isDestructive: false, onConfirm: () => {}
}); });
const [activeTab, setActiveTab] = useState("users"); // activeTab state removed (unused)
const [stats, setStats] = useState({ total_users: 0, pending_personal: 0, pending_business: 0, admins: 0 }); const [stats, setStats] = useState({ total_users: 0, pending_personal: 0, pending_business: 0, admins: 0 });
const [bookmarks, setBookmarks] = useState([]); const [bookmarks, setBookmarks] = useState([]);
const [users, setUsers] = useState([]); const [users, setUsers] = useState([]);
@@ -225,7 +225,7 @@ export default function AdminDashboard() {
<input <input
type="text" type="text"
className="search-input" className="search-input"
style={{ width: '100%', padding: '10px 12px 10px 40px', border: '1px solid var(--border)', borderRadius: 'var(--radius-full)', outline: 'none' }} style={{ width: '100%', padding: '10px 12px 10px 40px', border: '1px solid var(--border)', borderRadius: 'var(--radius-pill)', outline: 'none' }}
placeholder="Search by name or email" placeholder="Search by name or email"
value={search} value={search}
onChange={(e) => setSearch(e.target.value)} onChange={(e) => setSearch(e.target.value)}
@@ -233,7 +233,7 @@ export default function AdminDashboard() {
</div> </div>
<select <select
className="select-input" className="select-input"
style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-full)', border: '1px solid var(--border)', outline: 'none', background: 'white' }} style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-pill)', border: '1px solid var(--border)', outline: 'none', background: 'white' }}
value={userSort} value={userSort}
onChange={(e) => setUserSort(e.target.value)} onChange={(e) => setUserSort(e.target.value)}
> >
@@ -245,7 +245,7 @@ export default function AdminDashboard() {
</select> </select>
<select <select
className="select-input" className="select-input"
style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-full)', border: '1px solid var(--border)', outline: 'none', background: 'white' }} style={{ width: 'auto', padding: '10px 16px', borderRadius: 'var(--radius-pill)', border: '1px solid var(--border)', outline: 'none', background: 'white' }}
value={filterYear} value={filterYear}
onChange={(e) => setFilterYear(e.target.value)} onChange={(e) => setFilterYear(e.target.value)}
> >
@@ -300,7 +300,7 @@ export default function AdminDashboard() {
</div> </div>
</div> </div>
</div> </div>
<div className="user-bottom" style={{marginTop: 'auto', paddingTop: '16px', borderTop: '1px solid var(--border)', display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px', paddingTop: '16px', marginTop: '20px'}}> <div className="user-bottom" style={{marginTop: 'auto', paddingTop: '16px', borderTop: '1px solid var(--border)', display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px'}}>
<span className={`badge ${b.type === 'personal' ? 'badge-blue' : b.type === 'business' ? 'badge-green' : 'badge-gray'}`} style={{textTransform:'uppercase', fontSize: '12px'}}> <span className={`badge ${b.type === 'personal' ? 'badge-blue' : b.type === 'business' ? 'badge-green' : 'badge-gray'}`} style={{textTransform:'uppercase', fontSize: '12px'}}>
{b.type} {b.type}
</span> </span>
+38 -49
View File
@@ -4,6 +4,7 @@ import { useAuth } from '../context/AuthContext';
import { useToast } from '../context/ToastContext'; import { useToast } from '../context/ToastContext';
import ExpandableSummaryBlock from '../components/ExpandableSummaryBlock'; import ExpandableSummaryBlock from '../components/ExpandableSummaryBlock';
import ConfirmModal from '../components/ConfirmModal'; import ConfirmModal from '../components/ConfirmModal';
import StatusChip from '../components/StatusChip';
export default function AdminUserDetail() { export default function AdminUserDetail() {
@@ -44,29 +45,7 @@ export default function AdminUserDetail() {
const [markFiledLoading, setMarkFiledLoading] = useState(false); const [markFiledLoading, setMarkFiledLoading] = useState(false);
// Export Excel Function // 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 // States for Audit Log
const [auditLog, setAuditLog] = useState([]); const [auditLog, setAuditLog] = useState([]);
@@ -261,6 +240,7 @@ export default function AdminUserDetail() {
if (res.ok) { if (res.ok) {
setSendApprovalPanel(null); setSendApprovalPanel(null);
showToast("Document sent to client for approval ✔", "success"); 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(); fetchUserDetails();
} else { } else {
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
@@ -393,13 +373,10 @@ export default function AdminUserDetail() {
const sendEmail = async (type) => { const sendEmail = async (type) => {
const docsToReview = documents.filter(d => d.type === type); const docsToReview = documents.filter(d => d.type === type);
const approved = docsToReview.filter(d => d.review_status === "approved").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.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 { try {
const res = await authFetch("/api/review/notify-user", { const res = await authFetch("/api/review/notify-user", {
@@ -540,7 +517,7 @@ export default function AdminUserDetail() {
{(userDetail.name || "U").charAt(0).toUpperCase()} {(userDetail.name || "U").charAt(0).toUpperCase()}
</div> </div>
<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={{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'}}>
{currentUser?.role === 'super_admin' && currentUser.id !== userDetail.id ? ( {currentUser?.role === 'super_admin' && currentUser.id !== userDetail.id ? (
@@ -756,7 +733,7 @@ export default function AdminUserDetail() {
</div> </div>
<div className="doc-review-sidebar"> <div className="doc-review-sidebar">
<div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}> <div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}>
<h3>Filing Timeline</h3> <h3 className="card-title">Filing Timeline</h3>
{deadlines.filter(d => d.doc_type === 'personal').map(d => ( {deadlines.filter(d => d.doc_type === 'personal').map(d => (
<div key="personal-dl" style={{ <div key="personal-dl" style={{
margin: '0 0 16px', padding: '12px 16px', margin: '0 0 16px', padding: '12px 16px',
@@ -929,7 +906,7 @@ export default function AdminUserDetail() {
</div> </div>
<div className="doc-review-sidebar"> <div className="doc-review-sidebar">
<div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}> <div className="card-flat" style={{display:'flex', flexDirection:'column', gap:'16px'}}>
<h3>Filing Timeline</h3> <h3 className="card-title">Filing Timeline</h3>
{deadlines.filter(d => d.doc_type === 'business').map(d => ( {deadlines.filter(d => d.doc_type === 'business').map(d => (
<div key="business-dl" style={{ <div key="business-dl" style={{
margin: '0 0 16px', padding: '12px 16px', margin: '0 0 16px', padding: '12px 16px',
@@ -971,7 +948,7 @@ export default function AdminUserDetail() {
<div className="tab-panel active"> <div className="tab-panel active">
<div className="card-flat"> <div className="card-flat">
<div style={{display:'flex', justifyContent:'space-between', alignItems:'center', marginBottom:'16px', flexWrap:'wrap', gap:'8px'}}> <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'}}> <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])}} /> <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-primary btn-sm" style={{borderRadius:'var(--radius-sm)'}} onClick={() => adminDocInputRef.current?.click()}>+ Upload Return</button>
@@ -1009,18 +986,9 @@ export default function AdminUserDetail() {
<div className="text-sm text-muted">{doc.filename}</div> <div className="text-sm text-muted">{doc.filename}</div>
</td> </td>
<td>{doc.tax_year || <span className="text-muted">N/A</span>}</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> <td>
{(() => { <StatusChip status={doc.review_status} note={doc.review_note} />
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>
);
})()}
</td> </td>
<td> <td>
<div style={{display:'flex', gap:'6px', flexWrap:'wrap'}}> <div style={{display:'flex', gap:'6px', flexWrap:'wrap'}}>
@@ -1031,7 +999,17 @@ export default function AdminUserDetail() {
{doc.bookmarked ? 'star' : 'star_border'} {doc.bookmarked ? 'star' : 'star_border'}
</span> </span>
</button> </button>
{doc.review_status !== 'filed' && doc.review_status !== 'approved' && ( {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 <button
className="btn btn-primary btn-sm" className="btn btn-primary btn-sm"
style={{background:'#2c7a5b', borderColor:'#2c7a5b', fontSize:'12px'}} style={{background:'#2c7a5b', borderColor:'#2c7a5b', fontSize:'12px'}}
@@ -1040,8 +1018,19 @@ export default function AdminUserDetail() {
> >
📤 Send for Approval 📤 Send for Approval
</button> </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> </div>
</td> </td>
</tr> </tr>
@@ -1058,7 +1047,7 @@ export default function AdminUserDetail() {
display:'flex', flexDirection:'column', gap:'10px' display:'flex', flexDirection:'column', gap:'10px'
}}> }}>
<div style={{fontWeight:600, fontSize:'13px', color:'#2c7a5b'}}> <div style={{fontWeight:600, fontSize:'13px', color:'#2c7a5b'}}>
📤 Send this document to client for review {doc.review_status === 'sent_for_approval' ? '📨 Resend this document to client for review' : '📤 Send this document to client for review'}
</div> </div>
<textarea <textarea
rows={2} rows={2}
@@ -1080,7 +1069,7 @@ export default function AdminUserDetail() {
disabled={sendingApproval} disabled={sendingApproval}
onClick={() => sendReturnForApproval(doc.id, sendApprovalPanel.note)} 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> </button>
</div> </div>
</div> </div>
@@ -1101,7 +1090,7 @@ export default function AdminUserDetail() {
{activeTab === 'audit' && ( {activeTab === 'audit' && (
<div className="tab-panel active"> <div className="tab-panel active">
<div className="card-flat"> <div className="card-flat">
<h3 style={{marginBottom:'16px'}}>Recent Activity</h3> <h3 style={{marginBottom:'16px'}} className="card-title">Recent Activity</h3>
{auditLog.length === 0 ? ( {auditLog.length === 0 ? (
<p className="text-muted">No audit logs found.</p> <p className="text-muted">No audit logs found.</p>
) : ( ) : (
+3 -3
View File
@@ -59,7 +59,7 @@ export default function Contact() {
<div className="contact-container"> <div className="contact-container">
<div className="contact-info"> <div className="contact-info">
<div className="info-box usa"> <div className="info-box usa">
<h3>USA</h3> <h3 className="card-title">USA</h3>
<p>2520 Indigo Dr<br />McKinney, TX<br />75072, United States</p> <p>2520 Indigo Dr<br />McKinney, TX<br />75072, United States</p>
<p className="phone"> <p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +1 469-796-6151 <span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +1 469-796-6151
@@ -67,7 +67,7 @@ export default function Contact() {
</div> </div>
<div className="info-box ind"> <div className="info-box ind">
<h3>India</h3> <h3 className="card-title">India</h3>
<p>508, White Square,<br />Hinjewadi Road, Pune<br />411057, India</p> <p>508, White Square,<br />Hinjewadi Road, Pune<br />411057, India</p>
<p className="phone"> <p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +91 738 793 6020 <span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +91 738 793 6020
@@ -76,7 +76,7 @@ export default function Contact() {
</div> </div>
<form className="contact-form" onSubmit={handleSubmit}> <form className="contact-form" onSubmit={handleSubmit}>
<h3 style={{ marginBottom: '22px' }}>Send us a message</h3> <h3 style={{ marginBottom: '22px' }} className="card-title">Send us a message</h3>
<div className="form-row"> <div className="form-row">
<input <input
type="text" type="text"
+5 -4
View File
@@ -1,4 +1,5 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import CountUp from '../components/CountUp';
const SERVICES = [ const SERVICES = [
{ {
@@ -39,15 +40,15 @@ export default function Home() {
<div className="hero-stats"> <div className="hero-stats">
<div className="stat-block"> <div className="stat-block">
<div className="stat-figure tnum">27</div> <div className="stat-figure tnum"><CountUp value={27} /></div>
<div className="stat-caption">Years in accounting</div> <div className="stat-caption">Years in accounting</div>
</div> </div>
<div className="stat-block"> <div className="stat-block">
<div className="stat-figure tnum">2</div> <div className="stat-figure tnum"><CountUp value={2} /></div>
<div className="stat-caption">Countries operating</div> <div className="stat-caption">Countries operating</div>
</div> </div>
<div className="stat-block"> <div className="stat-block">
<div className="stat-figure tnum">100%</div> <div className="stat-figure tnum"><CountUp value={100} suffix="%" /></div>
<div className="stat-caption">Filings on schedule</div> <div className="stat-caption">Filings on schedule</div>
</div> </div>
</div> </div>
@@ -89,7 +90,7 @@ export default function Home() {
</div> </div>
<div className="service-body"> <div className="service-body">
<span className="service-label">{s.label}</span> <span className="service-label">{s.label}</span>
<h3>{s.title}</h3> <h3 className="card-title">{s.title}</h3>
<Link to="/contact"><button className="btn btn-outline btn-sm w-full">Get consultation</button></Link> <Link to="/contact"><button className="btn btn-outline btn-sm w-full">Get consultation</button></Link>
</div> </div>
</div> </div>
+2 -2
View File
@@ -83,7 +83,7 @@ export default function Profile() {
</div> </div>
<div className="card" style={{ marginBottom: '20px' }}> <div className="card" style={{ marginBottom: '20px' }}>
<h3 style={{ marginBottom: '20px', paddingBottom: '12px', borderBottom: '1px solid var(--border)' }}>Account Info</h3> <h3 style={{ marginBottom: '20px', paddingBottom: '12px', borderBottom: '1px solid var(--border)' }} className="card-title">Account Info</h3>
<div className="form-group"> <div className="form-group">
<label className="form-label">Email Address <span style={{ color: 'var(--muted)', fontWeight: 400 }}>(cannot be changed)</span></label> <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 || ''} /> <input type="email" className="input" readOnly value={user?.email || ''} />
@@ -102,7 +102,7 @@ export default function Profile() {
<div className="card" style={{ marginBottom: '24px' }}> <div className="card" style={{ marginBottom: '24px' }}>
<div className="flex-between" style={{ marginBottom: '4px', cursor: 'pointer' }} onClick={() => setShowPwSection(!showPwSection)}> <div className="flex-between" style={{ marginBottom: '4px', cursor: 'pointer' }} onClick={() => setShowPwSection(!showPwSection)}>
<h3>Change Password</h3> <h3 className="card-title">Change Password</h3>
<span style={{ color: 'var(--muted)', fontSize: '18px' }}>{showPwSection ? '▼' : '▶'}</span> <span style={{ color: 'var(--muted)', fontSize: '18px' }}>{showPwSection ? '▼' : '▶'}</span>
</div> </div>
<p className="text-sm" style={{ marginBottom: 0 }}>Click to expand and update your password</p> <p className="text-sm" style={{ marginBottom: 0 }}>Click to expand and update your password</p>
+6 -6
View File
@@ -158,8 +158,8 @@ export default function UploadBusiness() {
<p className="page-meta">Upload your business tax documents securely</p> <p className="page-meta">Upload your business tax documents securely</p>
</div> </div>
<div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}> <div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}>
<label className="form-label" style={{margin:0}}>Tax Year</label> <label htmlFor="taxYearSelect" className="form-label" style={{margin:0}}>Tax Year</label>
<select <select id="taxYearSelect"
className="select-input" className="select-input"
style={{width:'auto', padding:'8px 14px'}} style={{width:'auto', padding:'8px 14px'}}
value={taxYear} value={taxYear}
@@ -171,7 +171,7 @@ export default function UploadBusiness() {
</div> </div>
<div className="card" style={{marginBottom: '20px'}}> <div className="card" style={{marginBottom: '20px'}}>
<h3 style={{marginBottom: '16px'}}>Required Documents</h3> <h3 style={{marginBottom: '16px'}} className="card-title">Required Documents</h3>
<div id="docWrapper"> <div id="docWrapper">
{loading ? ( {loading ? (
<div className="empty-state">Loading templates...</div> <div className="empty-state">Loading templates...</div>
@@ -226,7 +226,7 @@ export default function UploadBusiness() {
) : uploaded.length ? ( ) : uploaded.length ? (
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span> <span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
) : dt.download ? ( ) : 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" className="btn-link" style={{ fontSize: '14px', color: 'var(--emerald)', textDecoration: 'underline' }}>View Template</a>
) : ( ) : (
"Missing" "Missing"
)} )}
@@ -282,7 +282,7 @@ export default function UploadBusiness() {
<div className="card"> <div className="card">
<div className="flex-between" style={{marginBottom: '16px'}}> <div className="flex-between" style={{marginBottom: '16px'}}>
<div> <div>
<h3>Additional Documents</h3> <h3 className="card-title">Additional Documents</h3>
<p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary business documents</p> <p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary business documents</p>
</div> </div>
<label <label
@@ -348,7 +348,7 @@ export default function UploadBusiness() {
<div className="card mt-20" style={{marginTop: '20px'}}> <div className="card mt-20" style={{marginTop: '20px'}}>
<div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}> <div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}>
<div> <div>
<h3 style={{marginBottom:'4px'}}>Finished Uploading?</h3> <h3 style={{marginBottom:'4px'}} className="card-title">Finished Uploading?</h3>
<p className="text-sm" style={{margin:0}}>Send your business documents for review.</p> <p className="text-sm" style={{margin:0}}>Send your business documents for review.</p>
</div> </div>
<button className="btn btn-primary" onClick={notifyComplete}> <button className="btn btn-primary" onClick={notifyComplete}>
+6 -6
View File
@@ -160,8 +160,8 @@ export default function UploadPersonal() {
<p className="page-meta">Upload your personal tax documents securely</p> <p className="page-meta">Upload your personal tax documents securely</p>
</div> </div>
<div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}> <div style={{display:'flex', flexDirection:'column', alignItems:'flex-end', gap:'4px'}}>
<label className="form-label" style={{margin:0}}>Tax Year</label> <label htmlFor="taxYearSelect" className="form-label" style={{margin:0}}>Tax Year</label>
<select <select id="taxYearSelect"
className="select-input" className="select-input"
style={{width:'auto', padding:'8px 14px'}} style={{width:'auto', padding:'8px 14px'}}
value={taxYear} value={taxYear}
@@ -173,7 +173,7 @@ export default function UploadPersonal() {
</div> </div>
<div className="card" style={{marginBottom: '20px'}}> <div className="card" style={{marginBottom: '20px'}}>
<h3 style={{marginBottom: '16px'}}>Required Documents</h3> <h3 style={{marginBottom: '16px'}} className="card-title">Required Documents</h3>
<div id="docWrapper"> <div id="docWrapper">
{loading ? ( {loading ? (
<div className="empty-state">Loading templates...</div> <div className="empty-state">Loading templates...</div>
@@ -228,7 +228,7 @@ export default function UploadPersonal() {
) : uploaded.length ? ( ) : uploaded.length ? (
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span> <span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
) : dt.download ? ( ) : 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" className="btn-link" style={{ fontSize: '14px', color: 'var(--emerald)', textDecoration: 'underline' }}>View Template</a>
) : ( ) : (
"Missing" "Missing"
)} )}
@@ -284,7 +284,7 @@ export default function UploadPersonal() {
<div className="card"> <div className="card">
<div className="flex-between" style={{marginBottom: '16px'}}> <div className="flex-between" style={{marginBottom: '16px'}}>
<div> <div>
<h3>Additional Documents</h3> <h3 className="card-title">Additional Documents</h3>
<p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary personal documents</p> <p className="text-sm" style={{marginTop:'2px'}}>Upload any supplementary personal documents</p>
</div> </div>
<label <label
@@ -350,7 +350,7 @@ export default function UploadPersonal() {
<div className="card mt-20" style={{marginTop: '20px'}}> <div className="card mt-20" style={{marginTop: '20px'}}>
<div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}> <div style={{display:'flex', alignItems:'center', justifyContent:'space-between', flexWrap:'wrap', gap:'16px'}}>
<div> <div>
<h3 style={{marginBottom:'4px'}}>Finished Uploading?</h3> <h3 style={{marginBottom:'4px'}} className="card-title">Finished Uploading?</h3>
<p className="text-sm" style={{margin:0}}>Send your personal documents for review.</p> <p className="text-sm" style={{margin:0}}>Send your personal documents for review.</p>
</div> </div>
<button className="btn btn-primary" onClick={notifyComplete}> <button className="btn btn-primary" onClick={notifyComplete}>
+80 -37
View File
@@ -1,4 +1,4 @@
import { useState, useEffect, useCallback } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext'; import { useAuth } from '../context/AuthContext';
import { useToast } from '../context/ToastContext'; import { useToast } from '../context/ToastContext';
@@ -13,37 +13,15 @@ export default function UserDashboard() {
const [loadingDocs, setLoadingDocs] = useState(false); const [loadingDocs, setLoadingDocs] = useState(false);
const [docLoading, setDocLoading] = useState(false); const [docLoading, setDocLoading] = useState(false);
const [engagementLink, setEngagementLink] = useState(null); const [engagementLink, setEngagementLink] = useState(null);
// Track which doc rows have the AI summary panel open const [deadlines, setDeadlines] = useState([]);
const [expandedSummary, setExpandedSummary] = useState({});
const [searchQuery, setSearchQuery] = useState("");
const [searchResults, setSearchResults] = useState([]);
const [isSearching, setIsSearching] = useState(false);
// Reject comment panel for admin docs: { docId, note } // Reject comment panel for admin docs: { docId, note }
const [rejectPanel, setRejectPanel] = useState(null); const [rejectPanel, setRejectPanel] = useState(null);
// ── declare callbacks BEFORE the effects that reference them ── // ── 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 () => { const checkEngagement = useCallback(async () => {
try { try {
const res = await authFetch("/api/auth/me"); const res = await authFetch("/api/auth/me");
@@ -87,10 +65,23 @@ export default function UserDashboard() {
} }
}, [authFetch]); }, [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(() => { useEffect(() => {
checkEngagement(); checkEngagement();
loadAdminDocs(); loadAdminDocs();
}, [checkEngagement, loadAdminDocs]); loadDeadlines();
}, [checkEngagement, loadAdminDocs, loadDeadlines]);
// Poll every 15s while any doc still has ai_summary === null (backend still processing) // Poll every 15s while any doc still has ai_summary === null (backend still processing)
useEffect(() => { useEffect(() => {
@@ -187,9 +178,6 @@ export default function UserDashboard() {
}; };
const toggleSummary = (docId) => {
setExpandedSummary(prev => ({ ...prev, [docId]: !prev[docId] }));
};
return ( return (
<div> <div>
@@ -200,6 +188,36 @@ export default function UserDashboard() {
</div> </div>
</div> </div>
{/* Action Required: Deadline Warning Banner */}
{deadlines && deadlines.length > 0 && deadlines.some(d => d.days_left <= 7) && (
<div className="card fade-up" style={{
background: 'rgba(230, 81, 0, 0.08)',
border: '1px solid rgba(230, 81, 0, 0.35)',
borderRadius: 'var(--radius-sm)',
padding: '16px 20px',
marginBottom: '20px',
display: 'flex',
alignItems: 'center',
gap: '16px'
}}>
<span className="material-symbols-outlined" style={{fontSize: '32px', color: '#e65100'}}>warning</span>
<div style={{flex: 1}}>
<div style={{fontWeight: 700, color: '#e65100', fontSize: '15px'}}>Action Required: Upcoming Filing Deadlines</div>
<div style={{fontSize: '13px', color: 'var(--navy)', marginTop: '4px'}}>
{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 ? (
<span style={{color: '#c0392b', 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>
)}
<div className="card fade-up"> <div className="card fade-up">
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', flexWrap: 'wrap', gap: '16px', marginBottom: '16px'}}> <div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', flexWrap: 'wrap', gap: '16px', marginBottom: '16px'}}>
<div> <div>
@@ -292,7 +310,7 @@ export default function UserDashboard() {
</thead> </thead>
<tbody> <tbody>
{adminDocs.map(doc => ( {adminDocs.map(doc => (
<> <React.Fragment key={doc.id}>
<tr key={doc.id}> <tr key={doc.id}>
<td> <td>
<div style={{fontWeight: 500, color: 'var(--navy)'}}>{doc.doc_label}</div> <div style={{fontWeight: 500, color: 'var(--navy)'}}>{doc.doc_label}</div>
@@ -302,14 +320,19 @@ export default function UserDashboard() {
<td> <td>
{doc.review_status ? ( {doc.review_status ? (
<div> <div>
<span className={`badge ${doc.review_status === 'approved' ? 'badge-green' : doc.review_status === 'rejected' ? 'badge-red' : 'badge-yellow'}`} style={{fontWeight:700}}> <span className={`badge ${doc.review_status === 'approved' ? 'badge-green' : doc.review_status === 'rejected' ? 'badge-red' : doc.review_status === 'sent_for_approval' ? 'badge-blue' : 'badge-yellow'}`} style={{fontWeight:700}}>
{doc.review_status.toUpperCase()} {doc.review_status.replace(/_/g, ' ').toUpperCase()}
</span> </span>
{doc.review_status === 'rejected' && doc.review_note && ( {doc.review_status === 'rejected' && doc.review_note && (
<div style={{fontSize:'12px', color:'#c0392b', fontStyle:'italic', marginTop:'4px'}}> <div style={{fontSize:'12px', color:'#c0392b', fontStyle:'italic', marginTop:'4px'}}>
Reason: "{doc.review_note}" Reason: "{doc.review_note}"
</div> </div>
)} )}
{doc.review_status === 'sent_for_approval' && doc.review_note && (
<div style={{fontSize:'12px', color:'var(--blue)', fontStyle:'italic', marginTop:'4px'}}>
Note from Admin: "{doc.review_note}"
</div>
)}
</div> </div>
) : ( ) : (
<span className="badge badge-yellow">PENDING</span> <span className="badge badge-yellow">PENDING</span>
@@ -318,9 +341,29 @@ export default function UserDashboard() {
<td> <td>
<div style={{display:'flex', gap:'8px', flexWrap:'wrap', alignItems:'center'}}> <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={() => 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-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> {(doc.review_status === 'sent_for_approval' || doc.review_status === 'pending' || !doc.review_status) && (
<button className="btn btn-danger btn-sm" onClick={() => openUserRejectPanel(doc.id)} disabled={docLoading}>Reject</button> <>
<button
className="btn btn-primary btn-sm"
style={{background:'#2c7a5b', borderColor:'#2c7a5b', display:'inline-flex', alignItems:'center', gap:'4px'}}
onClick={() => respondDoc(doc.id, true)}
disabled={docLoading}
>
<span className="material-symbols-outlined" style={{fontSize:'15px'}}>check_circle</span>
Approve
</button>
<button
className="btn btn-danger btn-sm"
style={{display:'inline-flex', alignItems:'center', gap:'4px'}}
onClick={() => openUserRejectPanel(doc.id)}
disabled={docLoading}
>
<span className="material-symbols-outlined" style={{fontSize:'15px'}}>cancel</span>
Reject
</button>
</>
)}
</div> </div>
</td> </td>
</tr> </tr>
@@ -380,7 +423,7 @@ export default function UserDashboard() {
</td> </td>
</tr> </tr>
)} )}
</> </React.Fragment>
))} ))}
</tbody> </tbody>
</table> </table>
+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';
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 });
}
}
+2 -1
View File
@@ -9,9 +9,10 @@ export default defineConfig({
react(), react(),
], ],
server: { server: {
host: true,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://localhost:8000', target: 'http://127.0.0.1:8000',
changeOrigin: true, changeOrigin: true,
}, },
}, },
+1 -1
View File
@@ -14,7 +14,7 @@ server {
add_header X-XSS-Protection "1; mode=block" always; add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always; add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" 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' http: https: data: blob: 'unsafe-inline' 'unsafe-eval'" always;
# Redirect all HTTP traffic to HTTPS (uncomment when SSL certs are generated) # Redirect all HTTP traffic to HTTPS (uncomment when SSL certs are generated)
# location / { # location / {
# return 301 https://$host$request_uri; # return 301 https://$host$request_uri;
+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()
+11 -9
View File
@@ -96,7 +96,7 @@ async def forgot_password(
reset_token = create_password_reset_token(user.email) 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_link = f"{frontend_url}/reset-password?token={reset_token}"
reset_body = ( reset_body = (
@@ -267,7 +267,7 @@ async def signup(request: Request, payload: SignupRequest, background: Backgroun
# Send verification email in background (non-blocking) # Send verification email in background (non-blocking)
if not is_admin: if not is_admin:
verify_token = create_email_verification_token(user.email) 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_link = f"{frontend_url}/verify-email?token={verify_token}"
verify_body = ( verify_body = (
f"Hi {user.name},<br><br>" f"Hi {user.name},<br><br>"
@@ -376,7 +376,7 @@ async def resend_verification(
return {"message": "If the email exists and is unverified, a new link has been sent"} return {"message": "If the email exists and is unverified, a new link has been sent"}
verify_token = create_email_verification_token(user.email) 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_link = f"{frontend_url}/verify-email?token={verify_token}"
resend_body = ( resend_body = (
@@ -446,18 +446,20 @@ def update_me(
current_user=Depends(get_current_user), current_user=Depends(get_current_user),
): ):
"""Update own profile (name, phone, password). Any authenticated user.""" """Update own profile (name, phone, password). Any authenticated user."""
name = payload.get("name", "").strip() name_raw = payload.get("name")
phone = payload.get("phone", "").strip() phone_raw = payload.get("phone")
current_pw = payload.get("current_password", "") name = name_raw.strip() if isinstance(name_raw, str) else None
new_pw = payload.get("new_password", "") 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 = [] changed = []
if name and name != current_user.name: if name is not None and name and name != current_user.name:
current_user.name = name current_user.name = name
changed.append("name") changed.append("name")
if phone != current_user.phone: if phone is not None and phone != (current_user.phone or ""):
current_user.phone = phone current_user.phone = phone
changed.append("phone") changed.append("phone")
+2
View File
@@ -194,6 +194,8 @@ def llms_txt():
@app.get("/{full_path:path}", tags=["frontend"]) @app.get("/{full_path:path}", tags=["frontend"])
def spa_fallback(full_path: str): 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): if os.path.isfile(SPA_INDEX):
return FileResponse( return FileResponse(
SPA_INDEX, SPA_INDEX,
+24
View File
@@ -256,11 +256,35 @@ def admin_bulk_action(
model_class.deleted_at == None, model_class.deleted_at == None,
).all() ).all()
from app import crud
from app.models import DocumentReviewEvent
from datetime import datetime
count = 0 count = 0
for doc in docs: for doc in docs:
doc.review_status = new_status 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 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() db.commit()
logger.info(f"Admin {current_user.id} bulk {new_status} {count} {doc_type} docs for user {payload.user_id}") logger.info(f"Admin {current_user.id} bulk {new_status} {count} {doc_type} docs for user {payload.user_id}")
+13 -6
View File
@@ -1,4 +1,5 @@
import os import os
import html
from fastapi import APIRouter, BackgroundTasks, HTTPException, Request from fastapi import APIRouter, BackgroundTasks, HTTPException, Request
from app.limiter import limiter from app.limiter import limiter
from pydantic import BaseModel, EmailStr, field_validator from pydantic import BaseModel, EmailStr, field_validator
@@ -7,7 +8,7 @@ from app.utils.emailer import send_email
router = APIRouter(prefix="/api", tags=["contact"]) router = APIRouter(prefix="/api", tags=["contact"])
# Get admin email from environment, with fallback # 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): class ContactForm(BaseModel):
first_name: str first_name: str
@@ -28,6 +29,12 @@ class ContactForm(BaseModel):
async def contact_message(request: Request, form: ContactForm, background: BackgroundTasks): async def contact_message(request: Request, form: ContactForm, background: BackgroundTasks):
if not ADMIN_EMAIL or "@" not in ADMIN_EMAIL: if not ADMIN_EMAIL or "@" not in ADMIN_EMAIL:
raise HTTPException(status_code=500, detail="Admin email not configured") 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( background.add_task(
send_email, send_email,
to=ADMIN_EMAIL, to=ADMIN_EMAIL,
@@ -37,10 +44,10 @@ async def contact_message(request: Request, form: ContactForm, background: Backg
<br><br> <br><br>
A new contact enquiry has been received. Please find the details below: A new contact enquiry has been received. Please find the details below:
<br><br> <br><br>
<b>Name:</b> {form.first_name} {form.last_name}<br> <b>Name:</b> {safe_first} {safe_last}<br>
<b>Email:</b> {form.email}<br> <b>Email:</b> {safe_email}<br>
<b>Phone:</b> {form.phone}<br> <b>Phone:</b> {safe_phone}<br>
<b>Message:</b> {form.message or '(none)'}<br><br> <b>Message:</b> {safe_message}<br><br>
Kindly follow up with the user at the earliest convenience. Kindly follow up with the user at the earliest convenience.
<br><br> <br><br>
Thank you,<br> Thank you,<br>
@@ -54,7 +61,7 @@ async def contact_message(request: Request, form: ContactForm, background: Backg
to=form.email, to=form.email,
subject="Thanks for contacting BookKeepro", subject="Thanks for contacting BookKeepro",
body=f""" body=f"""
Hi {form.first_name},<br><br> Hi {safe_first},<br><br>
Thank you for reaching out to BookKeepro.<br> Thank you for reaching out to BookKeepro.<br>
We’ve received your enquiry, and our team will get back to you shortly.<br><br> We’ve received your enquiry, and our team will get back to you shortly.<br><br>
Best Regards,<br> Best Regards,<br>
+51 -20
View File
@@ -1,5 +1,5 @@
import os import os
from datetime import date, timedelta from datetime import date, datetime, timedelta
import logging import logging
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
@@ -14,7 +14,7 @@ logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/review", tags=["review"]) 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"
# ───────────────────────────────────────────── # ─────────────────────────────────────────────
@@ -127,6 +127,7 @@ async def notify_user_review(
@router.post("/admin-doc-response") @router.post("/admin-doc-response")
async def admin_doc_response( async def admin_doc_response(
payload: AdminDocResponseRequest, payload: AdminDocResponseRequest,
background: BackgroundTasks,
db: Session = Depends(get_db), db: Session = Depends(get_db),
current_user=Depends(get_current_user), current_user=Depends(get_current_user),
): ):
@@ -147,6 +148,7 @@ async def admin_doc_response(
raise HTTPException(status_code=403, detail="Not authorized") raise HTTPException(status_code=403, detail="Not authorized")
doc.review_status = payload.status doc.review_status = payload.status
doc.reviewed_at = datetime.utcnow()
if payload.reason: if payload.reason:
doc.review_note = payload.reason doc.review_note = payload.reason
db.commit() db.commit()
@@ -166,28 +168,29 @@ async def admin_doc_response(
db.add(event) db.add(event)
db.commit() db.commit()
admin = db.query(User).filter_by(id=doc.uploaded_by).first() admin = db.query(User).filter_by(id=doc.uploaded_by).first() if doc.uploaded_by else None
if not admin: admin_email = admin.email if admin else os.getenv("ADMIN_EMAIL")
raise HTTPException(status_code=404, detail="Admin not found")
body = f""" if admin_email:
<p>Dear Admin,</p> body = f"""
<p>User <b>{current_user.email}</b> has <b>{payload.status.upper()}</b> the document:</p> <p>Dear Admin,</p>
<p><b>{doc.doc_label}</b></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 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;'>BookKeepro System</p>"
await send_email( background.add_task(
to=admin.email, send_email,
subject=f"Admin Return Status {payload.status.capitalize()} — BookKeepro", to=admin_email,
body=body, subject=f"Admin Return Status {payload.status.capitalize()} — BookKeepro",
) body=body,
)
logger.info(f"User {current_user.id} {payload.status} admin doc {payload.doc_id}") 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 # Update Status and History
@@ -279,13 +282,40 @@ def update_document_status(
# Get filing deadlines for a user # 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}") @router.get("/deadlines/{user_id}")
def get_filing_deadlines( def get_filing_deadlines(
user_id: int, user_id: int,
db: Session = Depends(get_db), db: Session = Depends(get_db),
current_user=Depends(get_current_user), 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 not is_admin and current_user.id != user_id:
raise HTTPException(status_code=403, detail="Not authorized to view these deadlines")
from app.models import FilingDeadline from app.models import FilingDeadline
deadlines = db.query(FilingDeadline).filter(FilingDeadline.user_id == user_id).all() deadlines = db.query(FilingDeadline).filter(FilingDeadline.user_id == user_id).all()
today = date.today() today = date.today()
@@ -293,6 +323,7 @@ def get_filing_deadlines(
for dl in deadlines: for dl in deadlines:
days_left = (dl.deadline_date - today).days days_left = (dl.deadline_date - today).days
result.append({ result.append({
"id": dl.id,
"doc_type": dl.doc_type, "doc_type": dl.doc_type,
"deadline_date": dl.deadline_date.isoformat(), "deadline_date": dl.deadline_date.isoformat(),
"days_given": dl.days_given, "days_given": dl.days_given,
+22 -13
View File
@@ -29,7 +29,7 @@ router = APIRouter(prefix="/api/upload", tags=["upload"])
from pathlib import Path 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) # Local File Storage (Contabo VPS Disk)
@@ -282,9 +282,12 @@ async def upload_admin_document(
logger.info(f"Admin {current_user.id} uploading document for user {user_id}") logger.info(f"Admin {current_user.id} uploading document for user {user_id}")
storage_key = await upload_to_storage(file) 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( record = AdminDocument(
doc_key=doc_key, doc_key=safe_doc_key,
doc_label=doc_label, doc_label=safe_doc_label,
filename=file.filename, filename=file.filename,
storage_key=storage_key, storage_key=storage_key,
content_type=file.content_type, content_type=file.content_type,
@@ -415,6 +418,12 @@ def delete_admin_document(
detail="Standard admins can only manage documents for standard users" detail="Standard admins can only manage documents for standard users"
) )
if doc.review_status == "approved":
raise HTTPException(
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}") logger.info(f"Admin {current_user.id} deleting admin document {doc_id}")
delete_from_storage(doc.storage_key) delete_from_storage(doc.storage_key)
doc.deleted_at = datetime.utcnow() doc.deleted_at = datetime.utcnow()
@@ -819,7 +828,7 @@ async def set_personal_review_status(
subject="Action Required: Document Rejected — BookKeepro", subject="Action Required: Document Rejected — BookKeepro",
body=f""" body=f"""
<p>Dear {owner.name or 'Client'},</p> <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} {note_html}
<p>Please log in to your dashboard, review the reason, and re-upload a corrected document.</p> <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><a href='{FRONTEND_URL}/upload-personal' style='color:#0077c8;font-weight:600;'>Re-upload Personal Documents →</a></p>
@@ -883,7 +892,7 @@ async def set_business_review_status(
subject="Action Required: Document Rejected — BookKeepro", subject="Action Required: Document Rejected — BookKeepro",
body=f""" body=f"""
<p>Dear {owner.name or 'Client'},</p> <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} {note_html}
<p>Please log in to your dashboard, review the reason, and re-upload a corrected document.</p> <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><a href='{FRONTEND_URL}/upload-business' style='color:#0077c8;font-weight:600;'>Re-upload Business Documents →</a></p>
@@ -1234,17 +1243,17 @@ from app.models import RequiredDocumentTemplate
@router.get("/templates") @router.get("/templates")
def list_templates( def list_templates(
category: str, category: str | None = None,
tax_year: int, tax_year: int | None = None,
db: Session = Depends(get_db), db: Session = Depends(get_db),
current_user=Depends(get_current_user), current_user=Depends(get_current_user),
): ):
templates = ( query = db.query(RequiredDocumentTemplate)
db.query(RequiredDocumentTemplate) if category:
.filter_by(category=category, tax_year=tax_year) query = query.filter(RequiredDocumentTemplate.category == category)
.order_by(RequiredDocumentTemplate.id.asc()) if tax_year:
.all() query = query.filter(RequiredDocumentTemplate.tax_year == tax_year)
) templates = query.order_by(RequiredDocumentTemplate.id.asc()).all()
results = [] results = []
for t in templates: for t in templates:
+16 -4
View File
@@ -2,7 +2,7 @@
Document type classifier for the "other_*" catch-all upload bucket. Document type classifier for the "other_*" catch-all upload bucket.
When a user uploads via the "Additional Documents" slot, doc_type is set to 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 actual document type from OCR text + filename so the extraction prompt
becomes type-specific rather than generic. becomes type-specific rather than generic.
@@ -24,6 +24,12 @@ class DocCategory(str, Enum):
AADHAAR = "Aadhaar Card" AADHAAR = "Aadhaar Card"
W2 = "W-2 Wage Statement" W2 = "W-2 Wage Statement"
FORM_1099 = "1099 Income Form" 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" ENGAGEMENT_LETTER = "Engagement Letter"
TAX_ORGANIZER = "Tax Organizer" TAX_ORGANIZER = "Tax Organizer"
INVOICE = "Invoice / Bill" INVOICE = "Invoice / Bill"
@@ -33,7 +39,7 @@ class DocCategory(str, Enum):
GENERIC = "Other Document" GENERIC = "Other Document"
# Priority-ordered keyword patterns — first match wins # Priority-ordered keyword patterns ? first match wins
_PATTERNS: list[tuple[re.Pattern, DocCategory]] = [ _PATTERNS: list[tuple[re.Pattern, DocCategory]] = [
# Government IDs # Government IDs
(re.compile(r'\bPERMANENT\s+ACCOUNT\s+NUMBER\b|\bINCOME\s+TAX\s+DEPT\b', re.I), DocCategory.PAN_CARD), (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 # 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'\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'\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 # 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'\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), (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: Args:
ocr_text: Raw text extracted from the document (any amount). 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}" corpus = f"{filename} {ocr_text}"
@@ -70,7 +82,7 @@ def classify_other_doc(
logger.info(f"[DocClassifier] Detected '{category.value}' from other_* upload") logger.info(f"[DocClassifier] Detected '{category.value}' from other_* upload")
return category return category
logger.info("[DocClassifier] No match — defaulting to GENERIC") logger.info("[DocClassifier] No match ? defaulting to GENERIC")
return DocCategory.GENERIC return DocCategory.GENERIC
+2
View File
@@ -29,6 +29,8 @@ async def send_email(to: str, subject: str, body: str) -> bool:
smtp_port = int(os.getenv("SMTP_PORT", "587")) smtp_port = int(os.getenv("SMTP_PORT", "587"))
smtp_user = os.getenv("SMTP_USER") smtp_user = os.getenv("SMTP_USER")
smtp_password = os.getenv("SMTP_PASSWORD") 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_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", "BookKeepro")
smtp_tls = os.getenv("SMTP_TLS", "True").strip().lower() == "true" smtp_tls = os.getenv("SMTP_TLS", "True").strip().lower() == "true"
+1 -1
View File
@@ -1,7 +1,7 @@
import os import os
from app.utils.emailer import send_email 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): async def send_signup_welcome_email(to: str, name: str | None = None):
+44 -45
View File
@@ -38,66 +38,65 @@ def _run_deadline_reminders():
).all() ).all()
admin_emails = [a.email for a in admins] admin_emails = [a.email for a in admins]
for days_out, flag_col, label in thresholds: async def _dispatch_reminders():
target_date = today + timedelta(days=days_out) for days_out, flag_col, label in thresholds:
deadlines = ( target_date = today + timedelta(days=days_out)
db.query(FilingDeadline) deadlines = (
.filter( db.query(FilingDeadline)
FilingDeadline.deadline_date == target_date, .filter(
getattr(FilingDeadline, flag_col) == False, FilingDeadline.deadline_date == target_date,
getattr(FilingDeadline, flag_col) == False,
)
.all()
) )
.all()
)
for dl in deadlines: for dl in deadlines:
user = db.query(User).filter(User.id == dl.user_id).first() user = db.query(User).filter(User.id == dl.user_id).first()
if not user: if not user:
continue continue
doc_label = dl.doc_type.capitalize() doc_label = dl.doc_type.capitalize()
# Email to user # Email to user
user_body = f""" user_body = f"""
<p>Dear {user.name or "Sir/Ma'am"},</p> <p>Dear {user.name or "Sir/Ma'am"},</p>
<p>This is a reminder that your <strong>{doc_label} document filing deadline</strong> <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> 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>Please ensure all outstanding actions are completed before the deadline.</p>
<p>Kind regards,<br><strong>BookKeepro Team</strong></p> <p>Kind regards,<br><strong>BookKeepro Team</strong></p>
""" """
asyncio.run( await send_email(
send_email(
to=user.email, to=user.email,
subject=f"Reminder: {doc_label} Filing Deadline in {label} — BookKeepro", subject=f"Reminder: {doc_label} Filing Deadline in {label} — BookKeepro",
body=user_body, body=user_body,
) )
)
# Email to all admins # Email to all admins
admin_body = f""" admin_body = f"""
<p>Admin Notice:</p> <p>Admin Notice:</p>
<p>The <strong>{doc_label} filing deadline</strong> for client <p>The <strong>{doc_label} filing deadline</strong> for client
<strong>{user.name or user.email}</strong> ({user.email}) is in <strong>{user.name or user.email}</strong> ({user.email}) is in
<strong>{label}</strong> ({dl.deadline_date.strftime('%B %d, %Y')}).</p> <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>Please review the client's status and take any necessary action.</p>
<p><strong>BookKeepro System</strong></p> <p><strong>BookKeepro System</strong></p>
""" """
for admin_email in admin_emails: for admin_email in admin_emails:
asyncio.run( await send_email(
send_email(
to=admin_email, to=admin_email,
subject=f"Admin Reminder: {user.email} — {doc_label} Deadline in {label}", subject=f"Admin Reminder: {user.email} — {doc_label} Deadline in {label}",
body=admin_body, 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 asyncio.run(_dispatch_reminders())
setattr(dl, flag_col, True)
db.commit()
logger.info(
"Sent %s deadline reminder for user %s (%s)",
label, dl.user_id, dl.doc_type,
)
except Exception as exc: except Exception as exc:
logger.error("Deadline reminder job failed: %s", exc) logger.error("Deadline reminder job failed: %s", exc)
finally: 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()
+2 -2
View File
@@ -42,5 +42,5 @@ pypdf==4.3.1
chromadb==0.5.5 chromadb==0.5.5
openpyxl openpyxl==3.1.5
APScheduler 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 os
import sys 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 = [ REQUIRED_VARS = [
"MYSQL_USER", "MYSQL_USER",
@@ -12,11 +24,16 @@ REQUIRED_VARS = [
def main(): def main():
missing = [] 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: for var in REQUIRED_VARS:
val = os.getenv(var) val = os.getenv(var)
if not val: if not val or not val.strip():
missing.append(var) 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"]: if var in ["SECRET_KEY", "MYSQL_PASSWORD"]:
missing.append(f"{var} (looks like a placeholder)") missing.append(f"{var} (looks like a placeholder)")
else: else: