feat: major platform upgrade — AI extraction pipeline, responsive UI, admin chatbot enhancements

CRITICAL FIXES
- Fix blank pages: useCallback declared after useEffect in all 5 pages
- Fix showToast undefined everywhere (ToastContext exported addToast not showToast)
- Fix admin doc upload always 422 (missing doc_key + doc_label form fields)
- Fix audit log wrong field names (log.details -> log.detail, remove user_agent)
- Fix SPA catch-all missing in main.py (direct URL access was 404)
- Fix chatbot using broken nvidia free model -> llama-3.3-70b

AI EXTRACTION PIPELINE
- 3-stage pipeline: Stage1 native text (free) -> Stage2 Tesseract OCR (free CPU) -> Stage3 Qwen vision (paid)
- Tesseract installed with eng+hin bilingual support, psm6, 2.5x DPI
- Scanned PDF fallback via PyMuPDF page render
- Blank template fallback: returns form_type/purpose/tax_year instead of empty
- Improved prompt: extracts actual document field names, no predefined terms
- Auto-poll UI: shows Processing spinner when extraction is running
- backfill_extraction.py: re-process all docs, fixed empty-dict-as-None bug

ADMIN DASHBOARD
- Pending docs split into Pending Personal + Pending Business stat cards
- User cards show typed badges: N personal / N business instead of generic N pending
- Backend returns pending_personal, pending_business, pending_docs per user

ADMIN USER DETAIL
- Doc count chips in user info bar: personal / business / returns / total
- Doc name bold 15px, date with calendar icon + TY chip, status as colored badges
- Responsive layout: doc-review-layout CSS classes replace inline flex styles
- Filing Timeline sidebar stacks above doc list on mobile
- AI Summary: bold labels and values, blank template shows metadata

CHATBOT ENHANCEMENTS
- Ask anything free-text input on menu screen (both admin and user chatbots)
- Admin: live context with latest uploads by date, new users today
- Admin: per-user activity lookup by name/email (docs + audit log)
- New endpoint: /api/chatbot/admin-user-context
- ExpandableSummaryBlock + ExpandableValue: bold navy field labels and values

RESPONSIVENESS
- components.css: 480px/640px/768px breakpoints for all pages
- Admin table, stat cards, tabs, toasts, FAB all properly responsive
- Auth shell stacks on mobile correctly
This commit is contained in:
Atharv1705
2026-08-05 11:41:06 +05:30
parent c2e22902c8
commit 9c7f25e06f
36 changed files with 3357 additions and 5279 deletions
+67 -88
View File
@@ -21,7 +21,7 @@ export default function Contact() {
body: JSON.stringify(formData)
});
if (!res.ok) throw new Error("Failed to send");
alert("Message Sent! Thank you for contacting us.");
alert("Message sent! Thank you for contacting us.");
setFormData({
first_name: '',
last_name: '',
@@ -42,110 +42,89 @@ export default function Contact() {
return (
<>
{/* HERO */}
<div className="page-hero" style={{
backgroundImage: 'linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("/images/home-background.jpg")',
backgroundSize: 'cover',
backgroundPosition: 'center',
minHeight: '350px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
textAlign: 'center',
color: '#fff'
}}>
<div>
<h1>Get In Touch</h1>
<div className="page-hero" style={{ '--hero-img': 'url("/images/home-background.jpg")' }}>
<div className="page-hero-inner">
<span className="eyebrow">Get in touch</span>
<h1>Let's talk about your books</h1>
<p>We'd love to hear from you. Reach out to our global teams.</p>
</div>
</div>
<section className="contact-section" style={{ border: 'none', marginTop: '60px', marginBottom: '80px' }}>
<h2 className="contact-title" style={{ color: 'var(--navy)', marginBottom: '50px' }}>
CONTACT <span style={{ color: 'var(--blue)' }}>BOOK</span><span style={{ color: 'var(--orange)' }}>KEEPRO</span>
</h2>
<section className="contact-section reveal">
<h2 className="contact-title">Contact BookKeepPro</h2>
<p className="contact-sub">Tell us a little about your business and we'll follow up within one business day.</p>
<div className="contact-container" style={{ width: '100%', maxWidth: '1000px', display: 'flex', flexWrap: 'wrap', gap: '40px', justifyContent: 'center' }}>
<div className="contact-info" style={{ flex: '1 1 300px', display: 'flex', flexDirection: 'column', gap: '30px' }}>
<div className="info-box usa" style={{ padding: '30px', borderRadius: '20px', boxShadow: 'var(--shadow-md)' }}>
<h3 style={{ fontSize: '24px', marginBottom: '12px' }}>USA</h3>
<p style={{ lineHeight: '1.6', marginBottom: '16px', opacity: 0.9 }}>2520 Indigo Dr<br />McKinney, TX<br />75072, United States</p>
<p className="phone" style={{ display: 'flex', alignItems: 'center', gap: '10px', fontWeight: '500' }}>
<span className="material-symbols-outlined" style={{ fontSize: '20px' }}>call</span> +1469-796-6151
<div className="contact-container">
<div className="contact-info">
<div className="info-box usa">
<h3>USA</h3>
<p>2520 Indigo Dr<br />McKinney, TX<br />75072, United States</p>
<p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +1 469-796-6151
</p>
</div>
<div className="info-box ind" style={{ padding: '30px', borderRadius: '20px', boxShadow: 'var(--shadow-md)' }}>
<h3 style={{ fontSize: '24px', marginBottom: '12px' }}>IND</h3>
<p style={{ lineHeight: '1.6', marginBottom: '16px', opacity: 0.9 }}>508, White Square,<br />Hinjewadi Road, Pune<br />411057, India</p>
<p className="phone" style={{ display: 'flex', alignItems: 'center', gap: '10px', fontWeight: '500' }}>
<span className="material-symbols-outlined" style={{ fontSize: '20px' }}>call</span> +91 738 793 6020
<div className="info-box ind">
<h3>India</h3>
<p>508, White Square,<br />Hinjewadi Road, Pune<br />411057, India</p>
<p className="phone">
<span className="material-symbols-outlined" style={{ fontSize: '18px' }}>call</span> +91 738 793 6020
</p>
</div>
</div>
<div style={{ flex: '1.5 1 400px' }}>
<form className="contact-form" onSubmit={handleSubmit} style={{ padding: '40px', borderRadius: '20px', boxShadow: 'var(--shadow-lg)' }}>
<h3 style={{ fontSize: '22px', marginBottom: '24px', color: 'var(--navy)' }}>Send us a message</h3>
<div className="form-row" style={{ display: 'flex', gap: '20px', marginBottom: '20px' }}>
<input
type="text"
name="first_name"
placeholder="First Name"
required
value={formData.first_name}
onChange={handleChange}
style={{ flex: 1, padding: '14px', borderRadius: '8px', border: '1px solid var(--border)', outline: 'none' }}
/>
<input
type="text"
name="last_name"
placeholder="Last Name"
required
value={formData.last_name}
onChange={handleChange}
style={{ flex: 1, padding: '14px', borderRadius: '8px', border: '1px solid var(--border)', outline: 'none' }}
/>
</div>
<input
type="email"
name="email"
placeholder="Email Address"
required
value={formData.email}
<form className="contact-form" onSubmit={handleSubmit}>
<h3 style={{ marginBottom: '22px' }}>Send us a message</h3>
<div className="form-row">
<input
type="text"
name="first_name"
placeholder="First name"
required
value={formData.first_name}
onChange={handleChange}
style={{ width: '100%', padding: '14px', borderRadius: '8px', border: '1px solid var(--border)', outline: 'none', marginBottom: '20px' }}
/>
<input
type="text"
name="last_name"
placeholder="Last name"
required
value={formData.last_name}
onChange={handleChange}
/>
</div>
<div className="phone-row" style={{ marginBottom: '20px', border: 'none', padding: 0 }}>
<input
type="text"
name="phone"
placeholder="Mobile Number"
required
value={formData.phone}
onChange={handleChange}
style={{ width: '100%', padding: '14px', borderRadius: '8px', border: '1px solid var(--border)', outline: 'none' }}
/>
</div>
<input
type="email"
name="email"
placeholder="Email address"
required
value={formData.email}
onChange={handleChange}
/>
<div className="message-row">
<textarea
name="message"
placeholder="How can we help you?"
required
style={{ width: '100%', padding: '14px', border: '1px solid var(--border)', borderRadius: '8px', fontFamily: 'inherit', fontSize: '15px', outline: 'none', marginBottom: '24px', resize: 'vertical', minHeight: '120px' }}
value={formData.message}
onChange={handleChange}
></textarea>
</div>
<input
type="text"
name="phone"
placeholder="Mobile number"
required
value={formData.phone}
onChange={handleChange}
/>
<button type="submit" disabled={loading} className="btn btn-primary" style={{ width: '100%', padding: '14px', fontSize: '16px', borderRadius: '30px' }}>
{loading ? 'SENDING...' : 'SEND MESSAGE'}
</button>
</form>
</div>
<textarea
name="message"
placeholder="How can we help you?"
required
style={{ minHeight: '120px' }}
value={formData.message}
onChange={handleChange}
></textarea>
<button type="submit" disabled={loading} className="btn btn-primary w-full">
{loading ? 'Sending…' : 'Send message'}
</button>
</form>
</div>
</section>
</>