# Project Roadmap & Implementation Plan **Sistema de Remuneración Variable, Compensación y Comisiones - Hoteles Estelar** --- This plan outlines the step-by-step path to construct, test, and host the platform securely. ## Phase 1: Foundation & Database Configuration * [ ] Initialize Next.js app with TypeScript and `npx` in the repository root. * [ ] Configure Vanilla CSS design tokens (variables, animations, grids/flex layouts, themes). * [ ] Set up Prisma ORM and define the PostgreSQL schemas (`schema.prisma`) matching the ER diagram. * [ ] Verify container network connectivity between the Next.js app and the existing PostgreSQL Docker service. * [ ] Execute initial database migration to seed basic structural tables (Regions, Hotels, Roles). ## Phase 2: Authentication & RBAC Core * [ ] Implement secure JWT session cookieless/cookie-based auth. * [ ] Build a premium login interface with smooth CSS transition effects (no browser default controls). * [ ] Develop route guards and API middleware verifying user roles (RBAC authorization validation). ## Phase 3: Compensation Configuration (Feature 1) * [ ] Implement UI forms and API endpoints for **Plan Creation** (HU-COM-001) with mandatory fields validation. * [ ] Implement **Calculation Rules config** (HU-COM-002) allowing tiers, multipliers, and cap inputs. * [ ] Implement **Goal assignment UI** (HU-COM-003) for monthly/quarterly scopes. * [ ] Write comprehensive unit tests for versioning and duplicating plans. ## Phase 4: Data Import & Integrations (Feature 2) * [ ] Create server-side Excel parser parsing sales sheets (HU-COM-004) with validation log feedbacks. * [ ] Build file drag-and-drop loading screen featuring progress UI. * [ ] Outline mock API connections for external ERP/PMS services (HU-COM-005) with auto-retry and logs. ## Phase 5: Settlement Engine & Approvals (Features 3 & 4) * [ ] Build the Core Settlement calculation engine (HU-COM-006) handling individual/team tiers and caps. * [ ] Implement **Simulation module** UI (HU-COM-007) displaying side-by-side comparative calculations. * [ ] Build **Approvals workflow** panel (HU-COM-008) for Commercial Leaders (Approve/Reject with mandatory reason). * [ ] Set up email/notification hooks dispatching notifications (HU-COM-009). ## Phase 6: History, Auditing & Analytics (Features 5 & 6) * [ ] Build **Colaborador History dashboard** (HU-COM-010) showing individual historical progress and PDFs. * [ ] Wire up **Audit Logs trigger** (HU-COM-011) tracking every modification to rules/settlements. * [ ] Build premium **Financial Dashboard** (HU-COM-012) using chart widgets (ranking, variables, trends). * [ ] Implement **PDF / Excel exporter service** (HU-COM-013) consolidating metrics by hotel/region. ## Phase 7: Deployment & Security Hardening * [ ] Write Dockge-compatible `docker-compose.yml` for the Next.js container. * [ ] Add `git.gaboggamer.online` or a sub-subdomain block in `/home/gabogg/docker/caddy/Caddyfile`. * [ ] Configure DNS resolution inside the WireGuard network. * [ ] Final end-to-end security audits.