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:
2026-05-28 00:29:31 +00:00
parent 356c8e3c2c
commit 6028bf1ba9
12 changed files with 432 additions and 105 deletions

View File

@@ -0,0 +1,14 @@
import { useQuery } from '@tanstack/react-query';
import { RepDashboardSchema, type RepDashboard } from '@sar/api-interface';
import { apiFetch } from '../api-client';
export function useRepDashboard() {
return useQuery<RepDashboard>({
queryKey: ['dashboard', 'rep'],
queryFn: async () => {
const raw = await apiFetch('/dashboard/rep');
return RepDashboardSchema.parse(raw);
},
staleTime: 5 * 60 * 1000, // 5 min
});
}