# LAKHSMAN WELLNESS PVT. LTD. Enterprise Admin Panel

## Complete Development Specification (Implementation Baseline)

This document captures the enterprise-grade admin specification for the MLM/Direct Selling platform and maps it into an implementation-friendly blueprint for this repository.

## 1. Product Scope
- Product: `LAKHSMAN WELLNESS PVT. LTD. Enterprise Admin Panel`
- Domain: MLM + Direct Selling + E-commerce + Franchise + Finance + Compliance
- Users: Super Admin, Functional Admins, Finance Team, Operations Team, Support Team

## 2. Technology Targets
- Frontend options: React/Next.js + Tailwind (future), current repo uses Laravel Blade + Tailwind
- Backend options: Laravel 10+ / Node.js Express
- Database: MySQL 8+ / PostgreSQL
- Cache/Queue: Redis/BullMQ or Laravel Queue (database mode supported for cPanel-safe installs)
- Realtime: Socket.io / Pusher (optional for live feed)
- Charts: Chart.js / ApexCharts / Recharts
- Document export: DomPDF/Puppeteer, Excel export

## 3. Theme System
### Core Colors
- Primary: `#6366F1`
- Secondary: `#8B5CF6`
- Success: `#10B981`
- Warning: `#F59E0B`
- Danger: `#EF4444`
- Info: `#3B82F6`

### Dark Mode
- Background: `#0F172A`
- Surface: `#1E293B`
- Border: `#334155`
- Text Primary: `#F8FAFC`
- Text Secondary: `#94A3B8`

### Light Mode
- Background: `#F8FAFC`
- Surface: `#FFFFFF`
- Border: `#E2E8F0`
- Text Primary: `#1E293B`
- Text Secondary: `#64748B`

### Gradients
- Card: `linear-gradient(135deg, #667eea 0%, #764ba2 100%)`
- Success: `linear-gradient(135deg, #11998e 0%, #38ef7d 100%)`
- Warning: `linear-gradient(135deg, #F2994A 0%, #F2C94C 100%)`
- Danger: `linear-gradient(135deg, #eb3349 0%, #f45c43 100%)`
- Premium: `linear-gradient(135deg, #FFD700 0%, #FFA500 100%)`

## 4. Global Admin Layout
- Header:
  - mobile sidebar toggle
  - logo + company name + branch selector
  - universal search (ID/mobile/email/PAN/Aadhaar/order/UTR/etc.)
  - live server time (`DD MMM YYYY | HH:mm:ss`, IST)
  - currency/language selectors
  - theme toggle (light/dark/system/custom)
  - notification center with category tags
  - quick action launcher
  - profile menu + security shortcuts
- Sidebar:
  - collapsible
  - profile block with role + quick stats
  - grouped navigation by business domain
  - module-level badge counters
  - status footer (health/load/backup/version)

## 5. Main Dashboard (Enterprise)
- Welcome strip with greeting and date-range presets
- 4 KPI rows:
  - User metrics
  - Financial metrics
  - E-commerce metrics
  - Network/performance metrics
- Interactive charts:
  - growth trend, income split, order type mix, geo-performance, rank distribution, hourly activity
- Live activity stream:
  - joins, orders, income, withdrawals, rank events, fraud alerts
- Quick action panels:
  - pending approvals, system health, recent alerts, quick links
- Data tables:
  - recent joinings, recent orders, top performers, pending withdrawals

## 6. Member Management (Enterprise)
- Advanced multi-row filters
- Bulk actions with audit logging
- Rich data table (select/sort/freeze/export/column toggle)
- Full profile with 10 tabs:
  - overview, personal, network, wallet/income, orders, KYC, bank, security, logs, settings
- Tree and level-wise downline analytics
- Wallet operations and complete income history
- KYC verification workflow with rejection reasons and timeline

## 7. Module Catalog (Complete)
1. Network Management
2. Income Engine
3. Wallet Management
4. Withdrawals & Payouts
5. E-commerce
6. Franchise Management
7. Payment Gateway
8. UPI Payments
9. KYC & Verification
10. Communication Hub
11. Support Desk
12. CRM & Leads
13. Report Center
14. Analytics & BI
15. Marketing & Promotions
16. Training & Resources
17. Security Center
18. Automation Engine
19. System Tools
20. Admin Management
21. Settings & Configuration
22. Mobile Admin Features

## 8. UI Component Library Requirements
- Cards (stat, summary, profile, wallet)
- Data tables (sortable/filterable/selectable/exportable)
- Forms (validation + multi-step)
- Modals (confirm/form/preview/full-screen)
- Charts (line/bar/pie/area/geo/funnel)
- Tree components (binary/org/hierarchy)
- Timeline, notifications, tabs, breadcrumb
- Buttons, badges, avatars, uploader, editor, calendar
- Drag-and-drop blocks
- Skeleton/empty/error states

## 9. Mobile Admin Requirements
- responsive breakpoints
- touch gestures + swipe actions
- bottom navigation
- pull-to-refresh
- sticky headers
- collapsible tables
- floating quick actions
- offline support
- biometric unlock (mobile app)

## 10. Security Baseline
- Authentication: session/JWT/OAuth
- Authorization: RBAC + permission matrix
- CSRF, XSS, SQLi, file upload protections
- Rate limiting on auth/payment/webhooks
- encryption for sensitive data
- audit trail for all critical actions
- fraud detection hooks for UTR/withdrawal anomalies
- GDPR/data-retention readiness

## 11. Performance Baseline
- query optimization + indexing
- caching strategy
- lazy loading and code splitting
- image optimization + CDN readiness
- queue for heavy jobs
- compressed API responses

## 12. API Blueprint
- REST APIs for all CRUD modules
- auth lifecycle APIs
- webhook endpoints with signature verification
- mobile-specific endpoints
- integration APIs + callback logs

## 13. Database Blueprint
- comprehensive schema across user/network/income/wallet/order/payment/support/security
- relationship mapping with foreign keys
- unique constraints (UTR/order refs)
- critical indexes for reconciliation and reports
- migration-safe, rollback-safe design

## 14. Non-Negotiable Financial Controls
- no ledger delete
- no ledger amount update
- wallet mutations only through ledger-backed transactions
- every wallet change in DB transaction + row lock
- no negative balances
- duplicate payout/webhook protection
- retry-safe idempotent income posting

## 15. Implementation Rule (Strict)
Because this codebase is production-sensitive, implementation must be phased and validated module-by-module.

Execution order:
1. Core layout structure
2. Routes structure
3. Admin module core
4. User panel core
5. Franchise panel core
6. Homepage CMS
7. Chart system
8. Settings system
9. Financial safety rules

## 16. Testing & Go-Live Gate
- installer lock validation
- identity limit checks (mobile/email/PAN/bank)
- matching and carry-forward integrity
- wallet vs ledger reconciliation
- UPI fraud and duplicate callback controls
- cron stability checks
- mobile usability checks
- stress tests and rollback safety

## 17. Delivery Strategy for Codex/AI
- Generate by module, not entire platform in one pass
- First deliver working vertical slices with real data
- Add tests with each module
- Keep financial operations transaction-safe by default
- Preserve auditability in every admin action

## 18. Immediate Deliverables in This Repository
- enterprise branding and theme tokens configured
- admin header/branding baseline upgraded
- enterprise specification documented for iterative development

---
This is the reference spec for ongoing enterprise admin development in this repository.
