Commit Graph

6 Commits

Author SHA1 Message Date
root
8641100a18 feat: per-user panel permissions system
Replace hardcoded role-based access with granular per-panel permissions.
Each user can now be assigned any combination of 6 panels (Corporate, BI
Executive, Clientes, Providers, Usuarios, Meu Dashboard) regardless of
their role. Existing users are auto-migrated with defaults based on role.

- Add src/panels.js with panel registry and default permissions
- Add permissions column to SQLite + migration for existing users
- Add requirePermission() middleware, replace requireRole on all routes
- Dynamic nav in buildHeader based on user permissions
- Permissions checkbox UI in admin panel with role presets
- Anti-lockout: users cannot remove 'usuarios' from themselves

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 17:27:36 -05:00
root
cd5773a1be feat: add "Hoje" preset to corporate dashboard
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:16:50 -05:00
root
95958e9a96 feat: dark/light mode + trading console BI + Chart.js local + fix themeScript
- Dark/light mode toggle across all pages (login, dashboard, corporate, admin, BI)
- BI Executive redesigned as permanent dark trading console (Bloomberg-style)
- Floating vertical nav with anchor scroll for mobile navigation
- Chart.js bundled locally (eliminates CDN dependency)
- Chart.js inlined in HTML for guaranteed loading
- Fix: themeScript </script> tag had literal backslash breaking HTML parser
- Fix: each chart wrapped in individual try/catch for graceful degradation
- No-cache headers on BI page to prevent stale HTML
- Robust init that handles DOMContentLoaded already fired

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:21:05 -05:00
root
3514755491 feat: trading terminal corporate - só USD/BRL + responsivo mobile
Remove EUR/BRL do terminal nas páginas corporate (home e dashboard),
mantendo apenas USD/BRL. Melhora layout mobile com breakpoints
otimizados para 768px e 480px (coluna vertical, fontes maiores).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:15:35 -05:00
root
7ee15ad5e5 feat: trading terminal live rates + fix spread negativo + fix USD→BRL
- Adiciona widget de cotações ao vivo (USD/BRL e EUR/BRL) com design
  estilo terminal de trading (dark theme, tipografia mono, glow effects)
- Proxy server-side /api/cotacao com cache 3s e token AwesomeAPI
- Auto-refresh a cada 3 segundos apenas quando a página está aberta
- Corrige cálculo de spread negativo: remove Math.abs() em USD→BRL
  e Math.max(0,...) no spread líquido
- Corrige seção USD→BRL que não aparecia (filtro status !== 'finalizado')
- Corrige valor_reais no fluxo USD→BRL: agora calcula valor * cotação
- Adiciona classe CSS spread-negative para destacar spreads negativos
- Bandeiras de fluxo (BR/US/EU) nos botões de compra e venda

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:30:43 -05:00
root
022993b201 feat: novo dashboard admin com KPIs, tendencias e ranking
- Adiciona src/admin-dashboard.js com lazy loading
- KPIs: hoje vs media 30 dias por fluxo
- Graficos de tendencia 30 dias (consolidado e por fluxo)
- Ranking top 5 agentes com filtro de periodo
- Adiciona sistema de cache (src/cache.js)
- Cache com TTL e auto-refresh periodico (5-10min)
- APIs: /admin/api/kpis, /admin/api/trend, /admin/api/top-agentes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 13:53:55 -05:00