From 981c4bac6e345a8b637b091c4c94957d787b80b3 Mon Sep 17 00:00:00 2001 From: joao_pedro Date: Thu, 13 Nov 2025 08:33:29 -0300 Subject: [PATCH 1/3] =?UTF-8?q?bug:=20solu=C3=A7=C3=A3o=20do=20edit=20para?= =?UTF-8?q?=20o=20paciente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/DoctorDetails.jsx | 24 ++------- src/pages/DoctorEditPage.jsx | 40 +++------------ src/pages/DoctorTable.jsx | 12 ++--- src/pages/EditPage.jsx | 50 +++---------------- src/perfis/Perfil_adm/Perfiladm.jsx | 21 ++++---- .../perfil_secretaria/PerfilSecretaria.jsx | 6 +-- 6 files changed, 41 insertions(+), 112 deletions(-) diff --git a/src/pages/DoctorDetails.jsx b/src/pages/DoctorDetails.jsx index 9a6a179..e426f75 100644 --- a/src/pages/DoctorDetails.jsx +++ b/src/pages/DoctorDetails.jsx @@ -4,36 +4,22 @@ import { useParams,Link, useNavigate, useLocation } from "react-router-dom"; import { GetDoctorByID } from "../components/utils/Functions-Endpoints/Doctor"; import { useAuth } from "../components/utils/AuthProvider"; -const Details = () => { +const DoctorDetails = ({doctor}) => { const {getAuthorizationHeader} = useAuth(); - const [doctor, setDoctor] = useState({}); const Parametros = useParams() const navigate = useNavigate(); const location = useLocation(); + - const Voltar = () => { +const Voltar = () => { const prefixo = location.pathname.split("/")[1]; navigate(`/${prefixo}/medicos`); } - const doctorID = Parametros.id - useEffect(() => { - if (!doctorID) return; - - const authHeader = getAuthorizationHeader() - - GetDoctorByID(doctorID, authHeader) - .then((data) => { - console.log(data, "médico vindo da API"); - setDoctor(data[0]) - ; // supabase retorna array - }) - .catch((err) => console.error("Erro ao buscar paciente:", err)); - }, [doctorID]); - //if (!doctor) return

Carregando...

; + return ( <> @@ -156,4 +142,4 @@ const Details = () => { ); }; -export default Details; \ No newline at end of file +export default DoctorDetails; diff --git a/src/pages/DoctorEditPage.jsx b/src/pages/DoctorEditPage.jsx index 4115823..1b75ffa 100644 --- a/src/pages/DoctorEditPage.jsx +++ b/src/pages/DoctorEditPage.jsx @@ -8,49 +8,23 @@ import API_KEY from "../components/utils/apiKeys"; const ENDPOINT_AVAILABILITY = "https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctor_availability"; -const DoctorEditPage = () => { +const DoctorEditPage = ({DictInfo}) => { const { getAuthorizationHeader } = useAuth(); const [DoctorToPUT, setDoctorPUT] = useState({}); const Parametros = useParams(); const [searchParams] = useSearchParams(); - const DoctorID = Parametros.id; + + const DoctorID = "b24c88b2-1d51-4c04-8fe8-e75c3f2817d1"; const availabilityId = searchParams.get("availabilityId"); const [availabilityToPATCH, setAvailabilityToPATCH] = useState(null); const [mode, setMode] = useState("doctor"); + console.log("teste", DictInfo) - useEffect(() => { - const authHeader = getAuthorizationHeader(); - - if (availabilityId) { - setMode("availability"); - - fetch(`${ENDPOINT_AVAILABILITY}?id=eq.${availabilityId}&select=*`, { - method: "GET", - headers: { - apikey: API_KEY, - Authorization: authHeader, - }, - }) - .then((res) => res.json()) - .then((data) => { - if (data && data.length > 0) { - setAvailabilityToPATCH(data[0]); - console.log("Disponibilidade vinda da API:", data[0]); - } - }) - .catch((err) => console.error("Erro ao buscar disponibilidade:", err)); - } else { - setMode("doctor"); - GetDoctorByID(DoctorID, authHeader) - .then((data) => { - console.log(data, "médico vindo da API"); - setDoctorPUT(data[0]); - }) - .catch((err) => console.error("Erro ao buscar paciente:", err)); - } - }, [DoctorID, availabilityId, getAuthorizationHeader]); + useEffect(() => { + setDoctorPUT(DictInfo) + }, [DictInfo]); const HandlePutDoctor = async () => { const authHeader = getAuthorizationHeader(); diff --git a/src/pages/DoctorTable.jsx b/src/pages/DoctorTable.jsx index e5c2d76..cdcce24 100644 --- a/src/pages/DoctorTable.jsx +++ b/src/pages/DoctorTable.jsx @@ -4,7 +4,7 @@ import { useAuth } from "../components/utils/AuthProvider"; import { Link } from "react-router-dom"; import "./style/TableDoctor.css"; -function TableDoctor() { +function TableDoctor({setDictInfo}) { const { getAuthorizationHeader, isAuthenticated } = useAuth(); const [medicos, setMedicos] = useState([]); @@ -437,14 +437,14 @@ function TableDoctor() { {medico.email || 'Não informado'}
- - - - @@ -596,4 +596,4 @@ function TableDoctor() { ); } -export default TableDoctor; \ No newline at end of file +export default TableDoctor; diff --git a/src/pages/EditPage.jsx b/src/pages/EditPage.jsx index 35a33fa..82f1008 100644 --- a/src/pages/EditPage.jsx +++ b/src/pages/EditPage.jsx @@ -1,40 +1,21 @@ import React from 'react' - import PatientForm from '../components/patients/PatientForm' - import {useEffect, useState} from 'react' import { GetPatientByID } from '../components/utils/Functions-Endpoints/Patient' import API_KEY from '../components/utils/apiKeys' import {useNavigate, useParams } from 'react-router-dom' import { useAuth } from '../components/utils/AuthProvider' -const EditPage = (DictInfo) => { +const EditPage = ({DictInfo}) => { const navigate = useNavigate() - const Parametros = useParams() const [PatientToPUT, setPatientPUT] = useState({}) const { getAuthorizationHeader, isAuthenticated } = useAuth(); -console.log(DictInfo, "usuario vindo do set") -const PatientID = Parametros.id - - useEffect(() => { - const authHeader = getAuthorizationHeader() - console.log(DictInfo.DictInfo.id, "id do cabra") - - GetPatientByID(DictInfo.DictInfo.id, authHeader) - .then((data) => { - console.log(data[0], "paciente vindo da API"); - setPatientPUT(data[0]); // supabase retorna array - }) - .catch((err) => console.error("Erro ao buscar paciente:", err)); - - - + setPatientPUT(DictInfo) }, [DictInfo]) - const HandlePutPatient = async () => { const authHeader = getAuthorizationHeader() @@ -44,9 +25,9 @@ const HandlePutPatient = async () => { myHeaders.append("Authorization", authHeader); myHeaders.append("Content-Type", "application/json"); - var raw = JSON.stringify(PatientToPUT); + var raw = JSON.stringify({...PatientToPUT, bmi:Number(PatientToPUT) || null}); - console.log("Enviando paciente para atualização:", PatientToPUT); + console.log("Enviando atualização:", PatientToPUT); var requestOptions = { method: 'PATCH', @@ -55,26 +36,11 @@ const HandlePutPatient = async () => { redirect: 'follow' }; - try { - const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientID}`,requestOptions); - console.log(response) - + fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientToPUT.id}`,requestOptions) + .then(response => response.json) + .then(result => console.log(result)) + .catch(console.log("erro")) - if(response.ok === false){ - console.error("Erro ao atualizar paciente:"); - } - else{ - console.log("ATUALIZADO COM SUCESSO"); - navigate('/secretaria/pacientes') - } - - return response; - } catch (error) { - console.error("Erro ao atualizar paciente:", error); - throw error; - } - - }; return ( diff --git a/src/perfis/Perfil_adm/Perfiladm.jsx b/src/perfis/Perfil_adm/Perfiladm.jsx index 2632fbe..73496df 100644 --- a/src/perfis/Perfil_adm/Perfiladm.jsx +++ b/src/perfis/Perfil_adm/Perfiladm.jsx @@ -14,11 +14,14 @@ import DoctorEditPage from "../../pages/DoctorEditPage"; import UserDashboard from '../../PagesAdm/gestao.jsx'; import PainelAdministrativo from '../../PagesAdm/painel.jsx'; import admItems from "../../data/sidebar-items-adm.json"; - +import {useState} from "react" // ...restante do código... function Perfiladm() { - return ( + + const [DictInfo, setDictInfo] = useState({}) + + return (
@@ -27,12 +30,12 @@ function Perfiladm() { } /> } /> } /> - } /> - } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> + } /> + } /> } /> } /> @@ -46,4 +49,4 @@ function Perfiladm() { ); } -export default Perfiladm; \ No newline at end of file +export default Perfiladm; diff --git a/src/perfis/perfil_secretaria/PerfilSecretaria.jsx b/src/perfis/perfil_secretaria/PerfilSecretaria.jsx index 514c29e..f76b9bc 100644 --- a/src/perfis/perfil_secretaria/PerfilSecretaria.jsx +++ b/src/perfis/perfil_secretaria/PerfilSecretaria.jsx @@ -31,11 +31,11 @@ function PerfilSecretaria({ onLogout }) { } /> } /> } /> - } /> + } /> } /> } /> - } /> - } /> + } /> + } /> } /> } /> } /> From bff5c42a4e379c916844be1b6198c2131bdb45d0 Mon Sep 17 00:00:00 2001 From: Caio Miguel Lima Nunes Date: Thu, 13 Nov 2025 09:30:03 -0300 Subject: [PATCH 2/3] Paciente-inicio --- src/data/sidebar-items-paciente.json | 10 +- src/pages/Inicio.jsx | 185 ++++++- src/pages/inicioPaciente.jsx | 273 +++++++++++ src/pages/style/Inicio.css | 188 ++++++++ src/pages/style/inicioPaciente.css | 454 ++++++++++++++++++ src/perfis/Perfil_paciente/Perfilpaciente.jsx | 3 +- 6 files changed, 1099 insertions(+), 14 deletions(-) create mode 100644 src/pages/inicioPaciente.jsx create mode 100644 src/pages/style/inicioPaciente.css diff --git a/src/data/sidebar-items-paciente.json b/src/data/sidebar-items-paciente.json index bb15caf..d0442e4 100644 --- a/src/data/sidebar-items-paciente.json +++ b/src/data/sidebar-items-paciente.json @@ -1,13 +1,17 @@ [ -{ + { + "name": "Início", + "icon": "house-fill", + "url": "/paciente" + }, + { "name": "Minhas consulta", "icon": "calendar-plus-fill", "url": "/paciente/agendamento" }, - { "name": "Meus laudos", "icon": "table", "url": "/paciente/laudo" } -] +] \ No newline at end of file diff --git a/src/pages/Inicio.jsx b/src/pages/Inicio.jsx index 7bdbe78..1db9708 100644 --- a/src/pages/Inicio.jsx +++ b/src/pages/Inicio.jsx @@ -1,6 +1,8 @@ import React, { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { FaUser, FaUserPlus, FaCalendarAlt, FaCalendarCheck } from 'react-icons/fa'; +import { useAuth } from '../components/utils/AuthProvider'; +import API_KEY from '../components/utils/apiKeys'; import './style/Inicio.css'; import { Link } from 'react-router-dom'; @@ -8,18 +10,141 @@ import { Link } from 'react-router-dom'; function Inicio() { const navigate = useNavigate(); + const { getAuthorizationHeader, isAuthenticated } = useAuth(); const [pacientes, setPacientes] = useState([]); + const [medicos, setMedicos] = useState([]); const [agendamentos, setAgendamentos] = useState([]); + const [agendamentosComPacientes, setAgendamentosComPacientes] = useState([]); + const [loading, setLoading] = useState(true); + useEffect(() => { + const fetchPacientes = async () => { + try { + const authHeader = getAuthorizationHeader(); + + const myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + const requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients", requestOptions); + + if (response.ok) { + const data = await response.json(); + setPacientes(data); + console.log('Pacientes carregados:', data.length); + } else { + console.error(' Erro ao buscar pacientes:', response.status); + } + } catch (error) { + console.error(' Erro ao buscar pacientes:', error); + } + }; + + const fetchMedicos = async () => { + try { + const authHeader = getAuthorizationHeader(); + + const myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + const requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions); + + if (response.ok) { + const data = await response.json(); + setMedicos(data); + console.log(' Médicos carregados:', data.length); + } else { + console.error('Erro ao buscar médicos:', response.status); + } + } catch (error) { + console.error(' Erro ao buscar médicos:', error); + } + }; + + const fetchAgendamentos = async () => { + try { + const authHeader = getAuthorizationHeader(); + + const myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + const requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions); + + if (response.ok) { + const data = await response.json(); + setAgendamentos(data); + console.log(' Agendamentos carregados:', data.length); + } else { + console.error(' Erro ao buscar agendamentos:', response.status); + } + } catch (error) { + console.error(' Erro ao buscar agendamentos:', error); + } finally { + setLoading(false); + } + }; + + if (isAuthenticated) { + fetchPacientes(); + fetchMedicos(); + fetchAgendamentos(); + } + }, [isAuthenticated, getAuthorizationHeader]); + + + useEffect(() => { + if (agendamentos.length > 0 && pacientes.length > 0 && medicos.length > 0) { + const agendamentosComNomes = agendamentos.map(agendamento => { + const paciente = pacientes.find(p => p.id === agendamento.patient_id); + const medico = medicos.find(m => m.id === agendamento.doctor_id); + return { + ...agendamento, + nomePaciente: paciente?.full_name || 'Paciente não encontrado', + nomeMedico: medico?.full_name || 'Médico não encontrado', + especialidadeMedico: medico?.specialty || '' + }; + }); + setAgendamentosComPacientes(agendamentosComNomes); + } + }, [agendamentos, pacientes, medicos]); const totalPacientes = pacientes.length; - const novosEsseMes = pacientes.filter(p => p.createdAt && new Date(p.createdAt).getMonth() === new Date().getMonth()).length; + const novosEsseMes = pacientes.filter(p => p.created_at && new Date(p.created_at).getMonth() === new Date().getMonth()).length; const hoje = new Date(); - const agendamentosDoDia = agendamentos.filter( - a => a.data && new Date(a.data).getDate() === hoje.getDate() - ); + hoje.setHours(0, 0, 0, 0); + + const agendamentosDoDia = agendamentosComPacientes.filter(a => { + if (!a.scheduled_at) return false; + const dataAgendamento = new Date(a.scheduled_at); + dataAgendamento.setHours(0, 0, 0, 0); + return dataAgendamento.getTime() === hoje.getTime(); + }); + const agendamentosHoje = agendamentosDoDia.length; + + + const pendencias = agendamentos.filter(a => a.status === 'pending' || a.status === 'scheduled').length; return (
@@ -57,7 +182,7 @@ function Inicio() {
PENDÊNCIAS - 0 + {loading ? '...' : pendencias}
@@ -92,14 +217,54 @@ function Inicio() {

Próximos Agendamentos

- {agendamentosHoje > 0 ? ( -
- {agendamentosDoDia.map(agendamento => ( + {loading ? ( +
+

Carregando agendamentos...

+
+ ) : agendamentosHoje > 0 ? ( +
+ {agendamentosDoDia.slice(0, 5).map(agendamento => (
-

{agendamento.nomePaciente}

-

{new Date(agendamento.data).toLocaleTimeString()}

+
+
+

+ {new Date(agendamento.scheduled_at).toLocaleTimeString('pt-BR', { + hour: '2-digit', + minute: '2-digit' + })} +

+

+ {new Date(agendamento.scheduled_at).toLocaleDateString('pt-BR', { + day: '2-digit', + month: '2-digit', + year: 'numeric' + })} +

+
+
+

+ Paciente: {agendamento.nomePaciente} +

+

+ Dr(a): {agendamento.nomeMedico} + {agendamento.especialidadeMedico && ` - ${agendamento.especialidadeMedico}`} +

+
+ + {agendamento.status === 'scheduled' ? 'Agendado' : + agendamento.status === 'completed' ? 'Concluído' : + agendamento.status === 'pending' ? 'Pendente' : + agendamento.status === 'cancelled' ? 'Cancelado' : + agendamento.status === 'requested' ? '' : agendamento.status} + +
))} + {agendamentosHoje > 5 && ( + + )}
) : (
diff --git a/src/pages/inicioPaciente.jsx b/src/pages/inicioPaciente.jsx new file mode 100644 index 0000000..9e95061 --- /dev/null +++ b/src/pages/inicioPaciente.jsx @@ -0,0 +1,273 @@ +import React, { useState, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { FaCalendarAlt, FaCalendarCheck, FaFileAlt, FaUserMd, FaClock } from 'react-icons/fa'; +import { useAuth } from '../components/utils/AuthProvider'; +import API_KEY from '../components/utils/apiKeys'; +import './style/inicioPaciente.css'; + +function InicioPaciente() { + const navigate = useNavigate(); + const { getAuthorizationHeader, isAuthenticated } = useAuth(); + const [agendamentos, setAgendamentos] = useState([]); + const [medicos, setMedicos] = useState([]); + const [agendamentosComMedicos, setAgendamentosComMedicos] = useState([]); + const [loading, setLoading] = useState(true); + const [pacienteId, setPacienteId] = useState(null); + + useEffect(() => { + const userId = localStorage.getItem('user_id') || localStorage.getItem('patient_id'); + setPacienteId(userId); + }, []); + + useEffect(() => { + const fetchMedicos = async () => { + try { + const authHeader = getAuthorizationHeader(); + + const myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + const requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions); + + if (response.ok) { + const data = await response.json(); + setMedicos(data); + console.log(' Médicos carregados:', data.length); + } else { + console.error(' Erro ao buscar médicos:', response.status); + } + } catch (error) { + console.error(' Erro ao buscar médicos:', error); + } + }; + + const fetchAgendamentos = async () => { + try { + const authHeader = getAuthorizationHeader(); + + const myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + const requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + // Buscar todos os agendamentos (depois filtraremos pelo paciente) + const response = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions); + + if (response.ok) { + const data = await response.json(); + setAgendamentos(data); + console.log(' Agendamentos carregados:', data.length); + } else { + console.error(' Erro ao buscar agendamentos:', response.status); + } + } catch (error) { + console.error(' Erro ao buscar agendamentos:', error); + } finally { + setLoading(false); + } + }; + + if (isAuthenticated) { + fetchMedicos(); + fetchAgendamentos(); + } + }, [isAuthenticated, getAuthorizationHeader]); + + useEffect(() => { + if (agendamentos.length > 0 && medicos.length > 0) { + const agendamentosComNomes = agendamentos.map(agendamento => { + const medico = medicos.find(m => m.id === agendamento.doctor_id); + return { + ...agendamento, + nomeMedico: medico?.full_name || 'Médico não encontrado', + especialidadeMedico: medico?.specialty || '' + }; + }); + setAgendamentosComMedicos(agendamentosComNomes); + } + }, [agendamentos, medicos]); + + const meusAgendamentos = agendamentosComMedicos.filter(a => + pacienteId ? a.patient_id === pacienteId : true + ); + + const hoje = new Date(); + hoje.setHours(0, 0, 0, 0); + + const agendamentosFuturos = meusAgendamentos.filter(a => { + if (!a.scheduled_at) return false; + const dataAgendamento = new Date(a.scheduled_at); + return dataAgendamento >= hoje && a.status !== 'cancelled' && a.status !== 'completed'; + }).sort((a, b) => new Date(a.scheduled_at) - new Date(b.scheduled_at)); + + const proximasConsultas = agendamentosFuturos.length; + const consultasHoje = agendamentosFuturos.filter(a => { + const dataAgendamento = new Date(a.scheduled_at); + dataAgendamento.setHours(0, 0, 0, 0); + return dataAgendamento.getTime() === hoje.getTime(); + }).length; + + const consultasPendentes = meusAgendamentos.filter(a => + a.status === 'pending' || a.status === 'requested' + ).length; + + const historicoConsultas = meusAgendamentos.filter(a => + a.status === 'completed' + ).length; + + return ( +
+
+

Bem-vindo ao MediConnect

+

Gerencie suas consultas e acompanhe seu histórico médico

+
+ +
+
+
+ Próximas Consultas + {proximasConsultas} +
+
+ +
+
+ +
+
+ Consultas Hoje + {consultasHoje} +
+
+ +
+
+ +
+
+ Aguardando + {loading ? '...' : consultasPendentes} +
+
+ +
+
+ +
+
+ Realizadas + {historicoConsultas} +
+
+ +
+
+
+ +
+

Acesso Rápido

+
+
navigate('/paciente/agendamento')}> + +
+ Minhas Consultas + Ver todos os agendamentos +
+
+ +
navigate('/paciente/laudo')}> + +
+ Meus Laudos + Acessar documentos médicos +
+
+ +
navigate('/paciente/agendamento')}> + +
+ Meus Médicos + Ver histórico de atendimentos +
+
+
+
+ +
+

Próximas Consultas

+ {loading ? ( +
+

Carregando suas consultas...

+
+ ) : agendamentosFuturos.length > 0 ? ( +
+ {agendamentosFuturos.slice(0, 3).map(agendamento => ( +
+
+
+

+ {new Date(agendamento.scheduled_at).toLocaleTimeString('pt-BR', { + hour: '2-digit', + minute: '2-digit' + })} +

+

+ {new Date(agendamento.scheduled_at).toLocaleDateString('pt-BR', { + day: '2-digit', + month: 'short', + year: 'numeric' + })} +

+
+
+

+ + Dr(a): {agendamento.nomeMedico} +

+ {agendamento.especialidadeMedico && ( +

+ {agendamento.especialidadeMedico} +

+ )} +
+ + {agendamento.status === 'scheduled' ? 'Confirmado' : + agendamento.status === 'pending' ? 'Aguardando' : + agendamento.status === 'requested' ? 'Solicitado' : agendamento.status} + +
+
+ ))} + {agendamentosFuturos.length > 3 && ( + + )} +
+ ) : ( +
+ +

Você não tem consultas agendadas

+ +
+ )} +
+
+ ); +} + +export default InicioPaciente; \ No newline at end of file diff --git a/src/pages/style/Inicio.css b/src/pages/style/Inicio.css index 889e7bf..21e4058 100644 --- a/src/pages/style/Inicio.css +++ b/src/pages/style/Inicio.css @@ -228,4 +228,192 @@ html[data-bs-theme="dark"] .manage-button { html[data-bs-theme="dark"] .manage-button:hover { background-color: #2323b0; +} + +/* Lista de Agendamentos */ +.agendamentos-list { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.agendamento-item { + background-color: #f9fafb; + border-left: 4px solid #5d5dff; + border-radius: 8px; + padding: 1rem 1.25rem; + transition: all 0.2s ease; +} + +.agendamento-item:hover { + background-color: #f0f2f5; + transform: translateX(5px); +} + +.agendamento-info { + display: flex; + align-items: center; + gap: 1.5rem; + flex-wrap: wrap; +} + +.agendamento-time-date { + display: flex; + flex-direction: column; + align-items: center; + min-width: 90px; +} + +.agendamento-hora { + font-size: 1.3rem; + font-weight: 700; + color: #5d5dff; + margin: 0; + line-height: 1.2; +} + +.agendamento-data { + font-size: 0.75rem; + font-weight: 500; + color: #888; + margin: 0; + margin-top: 0.25rem; +} + +.agendamento-detalhes { + display: flex; + flex-direction: column; + gap: 0.5rem; + flex: 1; + min-width: 300px; +} + +.agendamento-paciente, +.agendamento-medico { + font-size: 0.95rem; + color: #444; + margin: 0; + line-height: 1.4; +} + +.agendamento-paciente strong, +.agendamento-medico strong { + font-weight: 600; + color: #333; +} + +.agendamento-status { + font-size: 0.75rem; + font-weight: 600; + padding: 0.4rem 0.8rem; + border-radius: 20px; + text-transform: uppercase; +} + +.agendamento-status.status-scheduled { + background-color: #e3f2fd; + color: #1976d2; +} + +.agendamento-status.status-completed { + background-color: #e8f5e9; + color: #388e3c; +} + +.agendamento-status.status-pending { + background-color: #fff3e0; + color: #f57c00; +} + +.agendamento-status.status-cancelled { + background-color: #ffebee; + color: #d32f2f; +} + +.agendamento-status.status-requested { + background-color: #f3e5f5; + color: #7b1fa2; +} + +.view-all-button { + width: 100%; + margin-top: 1rem; + background-color: #f0f2f5; + color: #5d5dff; + border: 2px solid #5d5dff; + border-radius: 8px; + padding: 0.75rem 1.5rem; + font-size: 0.9rem; + font-weight: 600; + cursor: pointer; + transition: all 0.2s ease; +} + +.view-all-button:hover { + background-color: #5d5dff; + color: #fff; +} + +/* Dark Mode - Agendamentos */ +html[data-bs-theme="dark"] .agendamento-item { + background-color: #2a2a2a; + border-left-color: #6c6cff; +} + +html[data-bs-theme="dark"] .agendamento-item:hover { + background-color: #333; +} + +html[data-bs-theme="dark"] .agendamento-hora { + color: #8888ff; +} + +html[data-bs-theme="dark"] .agendamento-data { + color: #999; +} + +html[data-bs-theme="dark"] .agendamento-paciente, +html[data-bs-theme="dark"] .agendamento-medico { + color: #d0d0d0; +} + +html[data-bs-theme="dark"] .agendamento-paciente strong, +html[data-bs-theme="dark"] .agendamento-medico strong { + color: #e0e0e0; +} + +html[data-bs-theme="dark"] .agendamento-status.status-scheduled { + background-color: #1a3a52; + color: #64b5f6; +} + +html[data-bs-theme="dark"] .agendamento-status.status-completed { + background-color: #1b3a1f; + color: #81c784; +} + +html[data-bs-theme="dark"] .agendamento-status.status-pending { + background-color: #3d2817; + color: #ffb74d; +} + +html[data-bs-theme="dark"] .agendamento-status.status-cancelled { + background-color: #3d1f1f; + color: #e57373; +} + +html[data-bs-theme="dark"] .agendamento-status.status-requested { + background-color: #2d1f3d; + color: #ba68c8; +} + +html[data-bs-theme="dark"] .view-all-button { + background-color: #2a2a2a; + color: #8888ff; + border-color: #6c6cff; +} + +html[data-bs-theme="dark"] .view-all-button:hover { + background-color: #6c6cff; + color: #fff; } \ No newline at end of file diff --git a/src/pages/style/inicioPaciente.css b/src/pages/style/inicioPaciente.css new file mode 100644 index 0000000..3990267 --- /dev/null +++ b/src/pages/style/inicioPaciente.css @@ -0,0 +1,454 @@ +.dashboard-paciente-container { + padding: 2rem; + background-color: #f7f9fc; + flex-grow: 1; + min-height: 100vh; +} + +/* Header - Paciente */ +.dashboard-paciente-header { + margin-bottom: 2rem; +} + +.dashboard-paciente-header h1 { + font-size: 2rem; + font-weight: 600; + color: #333; + margin-bottom: 0.5rem; +} + +.dashboard-paciente-header p { + font-size: 1rem; + color: #666; +} + +/* Estatísticas - Paciente */ +.stats-paciente-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); + gap: 1.5rem; + margin-bottom: 2.5rem; +} + +.stat-paciente-card { + background-color: #fff; + border-radius: 12px; + padding: 1.5rem; + display: flex; + justify-content: space-between; + align-items: center; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); + transition: transform 0.2s ease, box-shadow 0.2s ease; +} + +.stat-paciente-card:hover { + transform: translateY(-3px); + box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1); +} + +.stat-paciente-info { + display: flex; + flex-direction: column; +} + +.stat-paciente-label { + font-size: 0.75rem; + font-weight: 600; + color: #888; + margin-bottom: 0.5rem; + text-transform: uppercase; + letter-spacing: 0.5px; +} + +.stat-paciente-value { + font-size: 2.2rem; + font-weight: 700; + color: #444; +} + +.stat-paciente-icon-wrapper { + width: 55px; + height: 55px; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; +} + +.stat-paciente-icon { + font-size: 1.4rem; + color: #fff; +} + +/* Cores dos ícones - Paciente */ +.stat-paciente-icon-wrapper.blue { background-color: #5d5dff; } +.stat-paciente-icon-wrapper.green { background-color: #30d158; } +.stat-paciente-icon-wrapper.purple { background-color: #a272ff; } +.stat-paciente-icon-wrapper.orange { background-color: #f1952e; } + +/* Ações Rápidas - Paciente */ +.quick-actions-paciente h2 { + font-size: 1.3rem; + font-weight: 600; + color: #333; + margin-bottom: 1.5rem; +} + +.actions-paciente-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); + gap: 1.5rem; + margin-bottom: 2.5rem; +} + +.action-paciente-button { + background-color: #fff; + border-radius: 12px; + padding: 1.5rem; + display: flex; + align-items: center; + cursor: pointer; + transition: all 0.2s ease-in-out; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); +} + +.action-paciente-button:hover { + transform: translateY(-5px); + box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12); +} + +.action-paciente-icon { + font-size: 2.5rem; + margin-right: 1.2rem; + color: #5d5dff; +} + +.action-paciente-info { + display: flex; + flex-direction: column; +} + +.action-paciente-title { + font-size: 1.05rem; + font-weight: 600; + color: #444; + margin-bottom: 0.25rem; +} + +.action-paciente-desc { + font-size: 0.85rem; + color: #888; +} + +/* Próximas Consultas - Paciente */ +.proximas-consultas-section { + background-color: #fff; + border-radius: 12px; + padding: 2rem; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); +} + +.proximas-consultas-section h2 { + font-size: 1.3rem; + font-weight: 600; + color: #333; + margin-bottom: 1.5rem; +} + +/* Lista de Consultas - Paciente */ +.consultas-paciente-list { + display: flex; + flex-direction: column; + gap: 1.2rem; +} + +.consulta-paciente-item { + background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%); + border-left: 5px solid #5d5dff; + border-radius: 10px; + padding: 1.25rem 1.5rem; + transition: all 0.3s ease; +} + +.consulta-paciente-item:hover { + background: linear-gradient(135deg, #f0f2f5 0%, #fafbfc 100%); + transform: translateX(8px); + box-shadow: 0 4px 12px rgba(93, 93, 255, 0.15); +} + +.consulta-paciente-info { + display: flex; + align-items: center; + gap: 2rem; + flex-wrap: wrap; +} + +.consulta-paciente-time-date { + display: flex; + flex-direction: column; + align-items: center; + min-width: 90px; + padding: 0.5rem; + background-color: #f0f2ff; + border-radius: 8px; +} + +.consulta-paciente-hora { + font-size: 1.5rem; + font-weight: 700; + color: #5d5dff; + margin: 0; + line-height: 1.2; +} + +.consulta-paciente-data { + font-size: 0.8rem; + font-weight: 500; + color: #7777aa; + margin: 0; + margin-top: 0.25rem; + text-transform: capitalize; +} + +.consulta-paciente-detalhes { + display: flex; + flex-direction: column; + gap: 0.5rem; + flex: 1; + min-width: 250px; +} + +.consulta-paciente-medico { + font-size: 1rem; + color: #444; + margin: 0; + display: flex; + align-items: center; + gap: 0.5rem; +} + +.consulta-icon { + color: #5d5dff; + font-size: 1.1rem; +} + +.consulta-paciente-medico strong { + font-weight: 600; + color: #333; +} + +.consulta-paciente-especialidade { + font-size: 0.85rem; + color: #666; + margin: 0; + margin-left: 1.6rem; + font-style: italic; +} + +.consulta-paciente-status { + font-size: 0.75rem; + font-weight: 600; + padding: 0.5rem 1rem; + border-radius: 20px; + text-transform: uppercase; + white-space: nowrap; +} + +.consulta-paciente-status.status-scheduled { + background-color: #e3f2fd; + color: #1976d2; +} + +.consulta-paciente-status.status-pending { + background-color: #fff3e0; + color: #f57c00; +} + +.consulta-paciente-status.status-requested { + background-color: #f3e5f5; + color: #7b1fa2; +} + +/* Sem Consultas */ +.no-consultas-content { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + padding: 3rem 1rem; +} + +.no-consultas-icon { + font-size: 4rem; + color: #bbb; + margin-bottom: 1.5rem; +} + +.no-consultas-content p { + font-size: 1.1rem; + color: #666; + margin-bottom: 2rem; +} + +.agendar-paciente-button, +.view-all-paciente-button { + background-color: #5d5dff; + color: #fff; + border: none; + border-radius: 8px; + padding: 0.875rem 2rem; + font-size: 1rem; + font-weight: 600; + cursor: pointer; + transition: all 0.2s ease; +} + +.agendar-paciente-button:hover, +.view-all-paciente-button:hover { + background-color: #4444ff; + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(93, 93, 255, 0.3); +} + +.view-all-paciente-button { + width: 100%; + margin-top: 1rem; + background-color: #f0f2f5; + color: #5d5dff; + border: 2px solid #5d5dff; +} + +.view-all-paciente-button:hover { + background-color: #5d5dff; + color: #fff; +} + +/* Dark Mode - Paciente */ +html[data-bs-theme="dark"] .dashboard-paciente-container { + background-color: #121212; + color: #e0e0e0; +} + +html[data-bs-theme="dark"] .dashboard-paciente-header h1, +html[data-bs-theme="dark"] .dashboard-paciente-header p, +html[data-bs-theme="dark"] .quick-actions-paciente h2, +html[data-bs-theme="dark"] .proximas-consultas-section h2, +html[data-bs-theme="dark"] .action-paciente-title, +html[data-bs-theme="dark"] .stat-paciente-value { + color: #e0e0e0; +} + +html[data-bs-theme="dark"] .stat-paciente-card, +html[data-bs-theme="dark"] .action-paciente-button, +html[data-bs-theme="dark"] .proximas-consultas-section { + background-color: #1e1e1e; + box-shadow: 0 4px 10px rgba(0,0,0,0.3); +} + +html[data-bs-theme="dark"] .stat-paciente-label, +html[data-bs-theme="dark"] .action-paciente-desc, +html[data-bs-theme="dark"] .no-consultas-content p { + color: #b0b0b0; +} + +html[data-bs-theme="dark"] .consulta-paciente-item { + background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%); + border-left-color: #6c6cff; +} + +html[data-bs-theme="dark"] .consulta-paciente-item:hover { + background: linear-gradient(135deg, #333 0%, #252525 100%); + box-shadow: 0 4px 12px rgba(108, 108, 255, 0.2); +} + +html[data-bs-theme="dark"] .consulta-paciente-time-date { + background-color: #2a2a3a; +} + +html[data-bs-theme="dark"] .consulta-paciente-hora { + color: #8888ff; +} + +html[data-bs-theme="dark"] .consulta-paciente-data { + color: #9999cc; +} + +html[data-bs-theme="dark"] .consulta-paciente-medico, +html[data-bs-theme="dark"] .consulta-paciente-especialidade { + color: #d0d0d0; +} + +html[data-bs-theme="dark"] .consulta-paciente-medico strong { + color: #e0e0e0; +} + +html[data-bs-theme="dark"] .consulta-icon, +html[data-bs-theme="dark"] .action-paciente-icon { + color: #8888ff; +} + +html[data-bs-theme="dark"] .consulta-paciente-status.status-scheduled { + background-color: #1a3a52; + color: #64b5f6; +} + +html[data-bs-theme="dark"] .consulta-paciente-status.status-pending { + background-color: #3d2817; + color: #ffb74d; +} + +html[data-bs-theme="dark"] .consulta-paciente-status.status-requested { + background-color: #2d1f3d; + color: #ba68c8; +} + +html[data-bs-theme="dark"] .no-consultas-icon { + color: #666; +} + +html[data-bs-theme="dark"] .agendar-paciente-button { + background-color: #6c6cff; +} + +html[data-bs-theme="dark"] .agendar-paciente-button:hover { + background-color: #5555dd; +} + +html[data-bs-theme="dark"] .view-all-paciente-button { + background-color: #2a2a2a; + color: #8888ff; + border-color: #6c6cff; +} + +html[data-bs-theme="dark"] .view-all-paciente-button:hover { + background-color: #6c6cff; + color: #fff; +} + +/* Responsivo */ +@media (max-width: 768px) { + .dashboard-paciente-container { + padding: 1rem; + } + + .stats-paciente-grid { + grid-template-columns: 1fr; + } + + .actions-paciente-grid { + grid-template-columns: 1fr; + } + + .consulta-paciente-info { + flex-direction: column; + align-items: flex-start; + gap: 1rem; + } + + .consulta-paciente-time-date { + width: 100%; + flex-direction: row; + justify-content: space-around; + } +} \ No newline at end of file diff --git a/src/perfis/Perfil_paciente/Perfilpaciente.jsx b/src/perfis/Perfil_paciente/Perfilpaciente.jsx index 9155987..86ef589 100644 --- a/src/perfis/Perfil_paciente/Perfilpaciente.jsx +++ b/src/perfis/Perfil_paciente/Perfilpaciente.jsx @@ -2,6 +2,7 @@ import { Routes, Route } from "react-router-dom"; import Sidebar from "../../components/Sidebar"; import PacienteItems from "../../data/sidebar-items-paciente.json"; import { useState } from "react"; +import InicioPaciente from "../../pages/inicioPaciente"; import LaudoManager from "../../pages/LaudoManager"; import ConsultaCadastroManager from "../../PagesPaciente/ConsultaCadastroManager"; import ConsultasPaciente from "../../PagesPaciente/ConsultasPaciente"; @@ -16,7 +17,7 @@ const [dadosConsulta, setConsulta] = useState({})
- } /> + } /> } /> } /> } /> From b64b664621626393863bd367709ca331df3ec00c Mon Sep 17 00:00:00 2001 From: joao_pedro Date: Thu, 13 Nov 2025 10:17:29 -0300 Subject: [PATCH 3/3] =?UTF-8?q?design:=20mudan=C3=A7a=20no=20bot=C3=A3o=20?= =?UTF-8?q?de=20alternar=20no=20agendamento=20=20e=20mudan=C3=A7a=20na=20s?= =?UTF-8?q?idebar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Sidebar.jsx | 35 +++++++++++++------------------- src/components/ToggleSidebar.jsx | 2 +- src/pages/Agendamento.jsx | 17 ++++++++++++---- src/pages/Login.jsx | 5 +++-- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index 6f21395..006a396 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -18,15 +18,23 @@ function Sidebar({ menuItems }) { const [isMobile, setIsMobile] = useState(false); const [showLogoutModal, setShowLogoutModal] = useState(false); const navigate = useNavigate(); - + const [roleUser, setRoleUser] = useState([]) const {getAuthorizationHeader} = useAuth(); const authHeader = getAuthorizationHeader(); + let pathname = window.location.pathname.split("/")[1] +// useEffect para definir quais toggle da sidebar devem aparecer + useEffect(() => { + let teste = localStorage.getItem("roleUser") + setRoleUser(teste) + + }, [authHeader]) + // Detecta se é mobile/tablet @@ -37,14 +45,6 @@ function Sidebar({ menuItems }) { setIsActive(!mobile); }; - const fetchInfoUser = async () => { - const InfoUser = await UserInfos(authHeader); - console.log(InfoUser.roles, "dados") - - setRoleUser(InfoUser.roles) - } - - fetchInfoUser() checkScreenSize(); window.addEventListener("resize", checkScreenSize); @@ -117,13 +117,6 @@ function Sidebar({ menuItems }) { } }; - useEffect(() => { - if(roleUser.includes("admin")){ - console.log("tem") - } - console.log(roleUser) - }, [roleUser]) - const handleLogoutCancel = () => setShowLogoutModal(false); @@ -251,26 +244,26 @@ function Sidebar({ menuItems }) {
    {roleUser.includes("admin") && - + } {roleUser.includes("admin") || roleUser.includes("secretaria") ? - + : null } {roleUser.includes("admin") || roleUser.includes("medico") ? - + :null } {roleUser.includes("admin") || roleUser.includes("financeiro") ? - + :null } {roleUser.includes("admin") || roleUser.includes("paciente") ? - + : null } diff --git a/src/components/ToggleSidebar.jsx b/src/components/ToggleSidebar.jsx index 2065de1..01eca61 100644 --- a/src/components/ToggleSidebar.jsx +++ b/src/components/ToggleSidebar.jsx @@ -136,4 +136,4 @@ const ToggleSidebar = ({ perfil, items, defaultOpen = false }) => { ) } -export default ToggleSidebar \ No newline at end of file +export default ToggleSidebar diff --git a/src/pages/Agendamento.jsx b/src/pages/Agendamento.jsx index dd01ddd..dd874f1 100644 --- a/src/pages/Agendamento.jsx +++ b/src/pages/Agendamento.jsx @@ -260,15 +260,24 @@ const Agendamento = ({ setDictInfo }) => { return (
    -

    Agendar nova consulta

    +

    Gerenciar consultas

    {/* LIMPA O OBJETO DE EDIÇÃO AO CLICAR EM "ADICIONAR" */} - - + : + + + } +
    {!PageNovaConsulta ? ( @@ -443,4 +452,4 @@ const Agendamento = ({ setDictInfo }) => { ) } -export default Agendamento; \ No newline at end of file +export default Agendamento; diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 831b94a..76a46e9 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -118,7 +118,8 @@ function Login({ onEnterSystem }) { if (data.access_token) { const UserData = await UserInfos(`bearer ${data.access_token}`); console.log(UserData, "Dados do usuário"); - + localStorage.setItem("roleUser", UserData.roles) + if (UserData?.roles?.includes("admin")) { navigate(`/admin/`); } else if (UserData?.roles?.includes("secretaria")) { @@ -131,7 +132,7 @@ function Login({ onEnterSystem }) { navigate(`/paciente/`); } }else{ - console.log("ERROROROROROOR") + console.log("Erro na tentativa de login") setShowCabecalho(true) } } else {