atualizacoes API Integracao
This commit is contained in:
@@ -12,9 +12,9 @@ import {
|
||||
Plus,
|
||||
Repeat,
|
||||
RotateCcw,
|
||||
Sigma,
|
||||
Target,
|
||||
Trash2,
|
||||
TrendingUp,
|
||||
User,
|
||||
Wallet,
|
||||
} from "lucide-react";
|
||||
@@ -307,10 +307,13 @@ export default function FechamentoDetalhes() {
|
||||
|
||||
const totais = useMemo(() => {
|
||||
const aprovadas = tarefas.filter((t) => t.estaRevisada);
|
||||
const pontos = aprovadas.reduce((acc, t) => acc + Number(t.pontuacao || 0), 0);
|
||||
const pontosAprovados = aprovadas.reduce((acc, t) => acc + Number(t.pontuacao || 0), 0);
|
||||
const pontosTotalMes = tarefas.reduce((acc, t) => acc + Number(t.pontuacao || 0), 0);
|
||||
return {
|
||||
pontos,
|
||||
aprovadas: aprovadas.length,
|
||||
/** Soma das pontuações em tarefas marcadas como revisadas (equivale ao que entra no fechamento). */
|
||||
pontos: pontosAprovados,
|
||||
/** Soma de todas as pontuações das tarefas listadas no fechamento (mês). */
|
||||
pontosTotalMes,
|
||||
};
|
||||
}, [tarefas]);
|
||||
const pontuacaoPagaNumero = parsePontuacaoInput(pontuacaoPagaInput || "0");
|
||||
@@ -371,11 +374,7 @@ export default function FechamentoDetalhes() {
|
||||
return timeA - timeB;
|
||||
});
|
||||
const estadoInicialBanco = Object.fromEntries(tarefasOrdenadas.map((tarefa) => [tarefa.id, Boolean(tarefa.estaRevisada)]));
|
||||
const tarefasDefaultRevisadas = tarefasOrdenadas.map((tarefa) => ({
|
||||
...tarefa,
|
||||
estaRevisada: true,
|
||||
}));
|
||||
setTarefas(tarefasDefaultRevisadas);
|
||||
setTarefas(tarefasOrdenadas);
|
||||
setEstadoRevisaoInicial(estadoInicialBanco);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : "Erro ao carregar detalhes do fechamento.";
|
||||
@@ -1109,17 +1108,21 @@ export default function FechamentoDetalhes() {
|
||||
<Card className="border-border/70 bg-card shadow-sm transition hover:shadow-md">
|
||||
<CardHeader className="space-y-2 p-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<CardDescription className="text-[11px] uppercase tracking-wide">Tarefas aprovadas</CardDescription>
|
||||
<Target className="h-4 w-4 text-muted-foreground" />
|
||||
<CardDescription className="text-[11px] uppercase tracking-wide">
|
||||
Pontuação total do mês
|
||||
</CardDescription>
|
||||
<Sigma className="h-4 w-4 text-muted-foreground" />
|
||||
</div>
|
||||
<CardTitle className="text-3xl">{totais.aprovadas}</CardTitle>
|
||||
<CardTitle className="text-3xl">{formatPontos(totais.pontosTotalMes)}</CardTitle>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
<Card className="border-border/70 bg-card shadow-sm transition hover:shadow-md">
|
||||
<CardHeader className="space-y-2 p-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<CardDescription className="text-[11px] uppercase tracking-wide">Pontuação aprovada</CardDescription>
|
||||
<TrendingUp className="h-4 w-4 text-muted-foreground" />
|
||||
<CardDescription className="text-[11px] uppercase tracking-wide">
|
||||
Pontuação aprovada
|
||||
</CardDescription>
|
||||
<Target className="h-4 w-4 text-muted-foreground" />
|
||||
</div>
|
||||
<CardTitle className="text-3xl">{formatPontos(totais.pontos)}</CardTitle>
|
||||
</CardHeader>
|
||||
|
||||
Reference in New Issue
Block a user