diff --git a/src/components/dashboard/BenchmarkingEscritorio.tsx b/src/components/dashboard/BenchmarkingEscritorio.tsx index aef426d..29db6db 100644 --- a/src/components/dashboard/BenchmarkingEscritorio.tsx +++ b/src/components/dashboard/BenchmarkingEscritorio.tsx @@ -1,50 +1,31 @@ -import React, { useEffect, useState } from 'react'; - -interface Benchmarking { - ajuizados15dias: number; - emTramitacao: number; -} +import React from 'react'; +import { useBenchmarking } from '../../hooks/useBenchmarking'; export const BenchmarkingEscritorio: React.FC = () => { - const [benchmarking, setBenchmarking] = useState(null); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); + // Hook para buscar e calcular benchmarking + const { data: benchmarking, isLoading, error } = useBenchmarking(); - useEffect(() => { - async function fetchBenchmarking() { - try { - setLoading(true); - setError(null); - const res = await fetch('/api/benchmarking', { - headers: { - 'Content-Type': 'application/json', - }, - }); - if (!res.ok) throw new Error('Erro ao buscar benchmarking'); - const data = await res.json(); - setBenchmarking(data); - } catch (err: any) { - setError(err.message); - } finally { - setLoading(false); - } - } - fetchBenchmarking(); - }, []); - - if (loading) return
Carregando benchmarking...
; - if (error) return
{error}
; + if (isLoading) return
Carregando benchmarking...
; + if (error) return
Erro ao buscar benchmarking
; if (!benchmarking) return null; return (
- Processos ajuizados (últimos 15 dias): - {benchmarking.ajuizados15dias} + Total de processos: + {benchmarking.totalProcessos}
- Processos em tramitação: - {benchmarking.emTramitacao} + Processos ativos: + {benchmarking.ativos} +
+
+ Julgados procedentes: + {benchmarking.procedentes} +
+
+ Improcedentes/Sem análise de mérito: + {benchmarking.improcedentesOuSemMerito}
); diff --git a/src/components/dashboard/WorkflowTarefas.tsx b/src/components/dashboard/WorkflowTarefas.tsx index 2f368a4..b70da77 100644 --- a/src/components/dashboard/WorkflowTarefas.tsx +++ b/src/components/dashboard/WorkflowTarefas.tsx @@ -47,15 +47,30 @@ export const WorkflowTarefas: React.FC = () => { return (
{tarefasAtivas.map((tarefa: Tarefa) => ( -
-
- {tarefa.titulo} - - {tarefa.status.replace('_', ' ')} - -
+
+
+
+ {tarefa.titulo} + {/* Exibe o grau de prioridade com cor */} + + {tarefa.prioridade === 'URGENTE' ? 'Urgente' : tarefa.prioridade === 'ALTA' ? 'Alta' : tarefa.prioridade === 'MEDIA' ? 'Média' : 'Baixa'} + +
+
+ {/* Status da tarefa */} + + {tarefa.status.replace('_', ' ')} +