dashboard: reimaginacao
Signed-off-by: Rodrigo B. de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
7e868dbc46
commit
6b89a61dd7
3 files changed
+27
-6
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
|
||||
interface Atendimento {
|
||||
id: string;
|
||||
@@ -8,6 +9,7 @@ interface Atendimento {
|
||||
}
|
||||
|
||||
export const AtendimentosDia: React.FC = () => {
|
||||
const { token } = useAuth();
|
||||
const [atendimentos, setAtendimentos] = useState<Atendimento[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -17,7 +19,12 @@ export const AtendimentosDia: React.FC = () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const res = await fetch('/api/atendimentos-dia');
|
||||
const res = await fetch('/api/atendimentos-dia', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
if (!res.ok) throw new Error('Erro ao buscar atendimentos do dia');
|
||||
const data = await res.json();
|
||||
setAtendimentos(data);
|
||||
@@ -28,7 +35,7 @@ export const AtendimentosDia: React.FC = () => {
|
||||
}
|
||||
}
|
||||
fetchAtendimentos();
|
||||
}, []);
|
||||
}, [token]);
|
||||
|
||||
if (loading) return <div>Carregando atendimentos...</div>;
|
||||
if (error) return <div className="text-red-600">{error}</div>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
|
||||
interface Benchmarking {
|
||||
ajuizados15dias: number;
|
||||
@@ -6,6 +7,7 @@ interface Benchmarking {
|
||||
}
|
||||
|
||||
export const BenchmarkingEscritorio: React.FC = () => {
|
||||
const { token } = useAuth();
|
||||
const [benchmarking, setBenchmarking] = useState<Benchmarking | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -15,7 +17,12 @@ export const BenchmarkingEscritorio: React.FC = () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const res = await fetch('/api/benchmarking');
|
||||
const res = await fetch('/api/benchmarking', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
if (!res.ok) throw new Error('Erro ao buscar benchmarking');
|
||||
const data = await res.json();
|
||||
setBenchmarking(data);
|
||||
@@ -26,7 +33,7 @@ export const BenchmarkingEscritorio: React.FC = () => {
|
||||
}
|
||||
}
|
||||
fetchBenchmarking();
|
||||
}, []);
|
||||
}, [token]);
|
||||
|
||||
if (loading) return <div>Carregando benchmarking...</div>;
|
||||
if (error) return <div className="text-red-600">{error}</div>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
|
||||
interface Evento {
|
||||
id: string;
|
||||
@@ -8,6 +9,7 @@ interface Evento {
|
||||
}
|
||||
|
||||
export const CalendarioAtendimentos: React.FC = () => {
|
||||
const { token } = useAuth();
|
||||
const [eventos, setEventos] = useState<Evento[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -17,7 +19,12 @@ export const CalendarioAtendimentos: React.FC = () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const res = await fetch('/api/eventos');
|
||||
const res = await fetch('/api/eventos', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
if (!res.ok) throw new Error('Erro ao buscar eventos');
|
||||
const data = await res.json();
|
||||
setEventos(data);
|
||||
@@ -28,7 +35,7 @@ export const CalendarioAtendimentos: React.FC = () => {
|
||||
}
|
||||
}
|
||||
fetchEventos();
|
||||
}, []);
|
||||
}, [token]);
|
||||
|
||||
// Simulação de calendário mensal
|
||||
const diasMes = Array.from({ length: 30 }, (_, i) => i + 1);
|
||||
|
||||
Reference in new issue
Block a user