From 17c4259bbcbc0a36986121a71e7af696af594997 Mon Sep 17 00:00:00 2001 From: jp-lima Date: Wed, 1 Oct 2025 13:16:32 -0300 Subject: [PATCH] =?UTF-8?q?Altera=C3=A7=C3=A3o=20modal=20CPF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.css | 2 +- src/components/patients/PatientForm.jsx | 7 +++---- src/pages/PatientCadastroManager.jsx | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/App.css b/src/App.css index fe8e2a0..9544f59 100644 --- a/src/App.css +++ b/src/App.css @@ -35,4 +35,4 @@ to { transform: rotate(360deg); } -} +} \ No newline at end of file diff --git a/src/components/patients/PatientForm.jsx b/src/components/patients/PatientForm.jsx index 7a437c0..1e76f57 100644 --- a/src/components/patients/PatientForm.jsx +++ b/src/components/patients/PatientForm.jsx @@ -105,18 +105,17 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) { const handleSubmit = async () => { if (!formData.full_name || !formData.cpf || !formData.sex || !formData.birth_date){ + console.log(formData.full_name, formData.cpf, formData.sex, formData.birth_date) setErrorModalMsg('Por favor, preencha Nome, CPF, Gênero e data de nascimento.'); - setShowModal404(true); - + setShowModal404(true); + return } - onSave({ ...formData,bmi:12.0 }); }; - return (

MediConnect

diff --git a/src/pages/PatientCadastroManager.jsx b/src/pages/PatientCadastroManager.jsx index 300e261..e0fe94c 100644 --- a/src/pages/PatientCadastroManager.jsx +++ b/src/pages/PatientCadastroManager.jsx @@ -3,9 +3,12 @@ import PatientForm from '../components/patients/PatientForm'; import API_KEY from '../components/utils/apiKeys'; import { useAuth } from '../components/utils/AuthProvider'; import { useNavigate } from 'react-router-dom'; + function PatientCadastroManager( {setCurrentPage} ) { const navigate = useNavigate() const [showModal, setShowModal] = useState(false); + const [infosModal, setInfosModal] = useState({title:'', message:''}); + const { getAuthorizationHeader, isAuthenticated } = useAuth(); const [formData, setFormData] = useState({}) @@ -43,10 +46,13 @@ function PatientCadastroManager( {setCurrentPage} ) { console.log("Erro ao salvar paciente:", data); if (data.code === "23505") { setShowModal(true); + setInfosModal({ + title: 'Erro ao salvar paciente', + message: 'CPF já cadastrado. Por favor, verifique o CPF informado.' + }); } } else{ - console.log("ATUALIZADO COM SUCESSO"); navigate('/pacientes') } @@ -56,24 +62,19 @@ function PatientCadastroManager( {setCurrentPage} ) { } }; - return ( <>
- {showModal &&(
-
-
Ops! Este CPF já está cadastrado
+
+
{infosModal.title}
-
- -
- +

{infosModal.message}