feat(dashboard): painel Rafael — meta, comissão, inativos, pedidos recentes (C7)
GET /dashboard/rep retorna meta mensal, comissão (fixa + FLEX), clientes inativos >30 dias e pedidos dos últimos 7 dias. RepTarget model com migration. RafaelPainel conectado à API real via useRepDashboard(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -171,6 +171,26 @@ model Product {
|
||||
@@index([deletedAt])
|
||||
}
|
||||
|
||||
// ─── RepTarget (C7) ──────────────────────────────────────────────────────────
|
||||
//
|
||||
// Meta mensal e taxas de comissão por rep. Uma linha por rep/mês.
|
||||
// commissionRate: % aplicada sobre o total aprovado+faturado do mês.
|
||||
// flexRate: % bônus adicional quando atingido >= targetAmount.
|
||||
|
||||
model RepTarget {
|
||||
repId String
|
||||
year Int
|
||||
month Int // 1–12
|
||||
targetAmount Decimal @db.Decimal(15, 2)
|
||||
commissionRate Decimal @default(3) @db.Decimal(5, 2)
|
||||
flexRate Decimal @default(1) @db.Decimal(5, 2)
|
||||
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@id([repId, year, month])
|
||||
@@index([repId])
|
||||
}
|
||||
|
||||
// ─── RepDiscountLimit (C4) ───────────────────────────────────────────────────
|
||||
//
|
||||
// Alçada de desconto por rep e por linha de produto (OQ-2 resolvida 2026-05-27).
|
||||
|
||||
Reference in New Issue
Block a user