{/* DADOS PESSOAIS */}
@@ -281,7 +316,7 @@ function PatientForm({ onSave, onCancel,formData, setFormData }) {
-
+
diff --git a/src/pages/DoctorCadastroManager.jsx b/src/pages/DoctorCadastroManager.jsx
index 3a928c4..3976e53 100644
--- a/src/pages/DoctorCadastroManager.jsx
+++ b/src/pages/DoctorCadastroManager.jsx
@@ -12,6 +12,10 @@ function DoctorCadastroManager( ) {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
+ // Estado do modal de sucesso
+ const [showModal, setShowModal] = useState(false);
+ const [modalMsg, setModalMsg] = useState('');
+
// Função que será chamada para "salvar" o paciente
const handleSavePatient = (patientData) => {
console.log('Salvando médico:', patientData);
@@ -23,32 +27,45 @@ function DoctorCadastroManager( ) {
header: myHeaders,
body:raw,
redirect:'follow'
-
}
+ fetch("https://mock.apidog.com/m1/1053378-0-default/pacientes", requestOptions)
+ .then(response => response.text())
+ .then(result => console.log(result))
+ .catch(error => console.log('error', error));
- fetch("https://mock.apidog.com/m1/1053378-0-default/pacientes", requestOptions)
- .then(response => response.text())
- .then(result => console.log(result))
- .catch(error => console.log('error', error));
-
- alert(`Médico "${patientData.nome}" salvo com sucesso!`); //altere isso para integração com backend
- // Após salvar, voltamos para a tela de lista
+ setModalMsg(`Médico "${patientData.nome}" salvo com sucesso!`);
+ setShowModal(true);
setView('list');
};
return (
<>
+ {/* Modal de feedback */}
+ {showModal && (
+
+
+
+
+
Sucesso
+
+
+
+
{modalMsg}
+
+
+
+
+
+
+
+ )}
Cadastro de Médicos
- {/* Aqui está a lógica principal: */}
- {/* Se a view for 'list', mostramos a lista com o botão. */}
- {/* Se for 'form', mostramos o formulário de cadastro. */}
-
{view === 'list' ? (
setView('form')} />
) : (
@@ -56,7 +73,6 @@ function DoctorCadastroManager( ) {
onSave={handleSavePatient}
onCancel={() => setView('list')}
PatientDict={{}}
-
/>
)}
diff --git a/src/pages/PatientCadastroManager.jsx b/src/pages/PatientCadastroManager.jsx
index 7653975..832eb93 100644
--- a/src/pages/PatientCadastroManager.jsx
+++ b/src/pages/PatientCadastroManager.jsx
@@ -30,8 +30,7 @@ function PatientCadastroManager( {setCurrentPage} ) {
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
-
- alert(`Paciente "${patientData.nome}" salvo com sucesso!`); //altere isso para integração com backend
+ ; //altere isso para integração com backend
// Após salvar, voltamos para a tela de lista
};