diff --git a/src/components/patients/PatientForm.jsx b/src/components/patients/PatientForm.jsx index 0c53e46..74bb27f 100644 --- a/src/components/patients/PatientForm.jsx +++ b/src/components/patients/PatientForm.jsx @@ -52,15 +52,9 @@ function PatientForm({ onSave, onCancel, PatientDict }) { } else if(ExisteNoBancoDeDados === true){ aviso = 'O CPF informado já está presente no sistema' - Erro = true - - + Erro = true } - return [Erro,aviso] - - - } const FormatCPF = (valor) => { diff --git a/src/pages/Details.jsx b/src/pages/Details.jsx index a3f4393..19f5c97 100644 --- a/src/pages/Details.jsx +++ b/src/pages/Details.jsx @@ -2,28 +2,40 @@ import React, { useEffect, useState } from "react"; import avatarPlaceholder from '../assets/images/avatar_placeholder.png'; const Details = ({ patientID, setCurrentPage }) => { - const [paciente, setPaciente] = useState(null); + const [paciente, setPaciente] = useState({}); useEffect(() => { if (!patientID) return; fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${patientID}`) .then(res => res.json()) - .then(data => setPaciente(data)) + + .then(result => {setPaciente(result.data); console.log(result.data)}) .catch(err => console.error("Erro ao buscar paciente:", err)); }, [patientID]); - if (!paciente) return

Carregando...

; + return ( <> + +
+ + + +
+ +
+ {/* ------------------ HEADER ------------------ */}

MediConnect


- +
@@ -33,9 +45,7 @@ const Details = ({ patientID, setCurrentPage }) => {

{paciente.cpf || "CPF"}

- +
@@ -50,11 +60,11 @@ const Details = ({ patientID, setCurrentPage }) => {
-

{paciente.nomeSocial || "-"}

+

{paciente.nome_social || "-"}

-

{paciente.dataNascimento || "-"}

+

{paciente.data_nascimento || "-"}

@@ -62,11 +72,11 @@ const Details = ({ patientID, setCurrentPage }) => {
-

{paciente.documento || "-"}

+

{paciente.outros_documentos?.tipo || "-"}

-

{paciente.numeroDocumento || "-"}

+

{paciente.outros_documentos?.numero || "-"}

@@ -78,31 +88,31 @@ const Details = ({ patientID, setCurrentPage }) => {
-

{paciente.nomeMae || "-"}

+

{paciente.nome_mae || "-"}

-

{paciente.profissaoMae || "-"}

+

{paciente.profissao_mae || "-"}

-

{paciente.nomePai || "-"}

+

{paciente.nome_pai || "-"}

-

{paciente.profissaoPai || "-"}

+

{paciente.profissao_pai || "-"}

-

{paciente.nomeResponsavel || "-"}

+

{paciente.nome_responsavel || "-"}

-

{paciente.cpfResponsavel || "-"}

+

{paciente.cpf_responsavel || "-"}

-

{paciente.nomeConjuge || "-"}

+

{paciente.nome_conjuge || "-"}

@@ -118,31 +128,31 @@ const Details = ({ patientID, setCurrentPage }) => {
-

{paciente.cep || "-"}

+

{paciente.endereco?.cep || "-"}

-

{paciente.rua || "-"}

+

{paciente.endereco?.logradouro || "-"}

-

{paciente.bairro || "-"}

+

{paciente.endereco?.bairro || "-"}

-

{paciente.cidade || "-"}

+

{paciente.endereco?.cidade || "-"}

-

{paciente.estado || "-"}

+

{paciente.endereco?.estado || "-"}

-

{paciente.numero || "-"}

+

{paciente.endereco?.numero || "-"}

-

{paciente.complemento || "-"}

+

{paciente.endereco?.complemento || "-"}

@@ -154,19 +164,19 @@ const Details = ({ patientID, setCurrentPage }) => {
-

{paciente.email || "-"}

+

{paciente.contato?.email || "-"}

-

{paciente.telefone1 || "-"}

+

{paciente.contato?.telefone1 || "-"}

-

{paciente.telefone2 || "-"}

+

{paciente.contato?.telefone2 || "-"}

- -

{paciente.telefone3 || "-"}

+ +

{paciente.contato?.telefone3 || "-"}