Compare commits

..

No commits in common. "fe455a256acfa02f2a1ac9fcf043160887e6c2f9" and "5f2e58c1c4d53c8c028103ba669b43658b6f9712" have entirely different histories.

7 changed files with 26 additions and 13 deletions

View File

@ -502,7 +502,11 @@ function DoctorForm({ onSave, onCancel, formData, setFormData }) {
>
Salvar Médico
</button>
<Link to={'/medicos'}>
<button className="btn btn-light" onClick={onCancel} style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }}>
Cancelar
</button>
</Link>
</div>
</div>
</>

View File

@ -1,10 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Link,useNavigate, useLocation } from 'react-router-dom';
import { Link } from 'react-router-dom';
import { FormatTelefones, FormatPeso, FormatCPF } from '../utils/Formatar/Format';
function PatientForm({ onSave, formData, setFormData }) {
function PatientForm({ onSave, onCancel, formData, setFormData }) {
const [errorModalMsg, setErrorModalMsg] = useState("");
const [showModal, setShowModal] = useState(false);
const [pacienteExistente, setPacienteExistente] = useState(null);
@ -443,7 +441,11 @@ function PatientForm({ onSave, formData, setFormData }) {
<button className="btn btn-success me-3" onClick={handleSubmit} style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }}>
Salvar Paciente
</button>
<Link to='/pacientes'>
<button className="btn btn-light" style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }}>
Cancelar
</button>
</Link>
</div>
{/* Modal de erro - EXATAMENTE COMO NA IMAGEM */}

View File

@ -95,7 +95,10 @@ function DoctorCadastroManager() {
<div className="col-12">
<DoctorForm
onSave={handleSaveDoctor}
onCancel={() => {
const prefixo = location.pathname.split("/")[1];
navigate(`/${prefixo}/medicos`);
}}
formData={DoctorDict}
setFormData={setDoctorDict}
/>

View File

@ -63,7 +63,7 @@ const authHeader = getAuthorizationHeader()
<DoctorForm
onSave={HandlePutDoctor}
onCancel={console.log('Não atualizar')}
formData={DoctorToPUT}
setFormData={setDoctorPUT}

View File

@ -3,7 +3,7 @@ import API_KEY from "../components/utils/apiKeys";
import { useAuth } from "../components/utils/AuthProvider";
import { Link } from "react-router-dom";
function TableDoctor() {
function TableDoctor({ setPatientID }) {
const { getAuthorizationHeader, isAuthenticated } = useAuth();
const [medicos, setMedicos] = useState([]);
@ -163,7 +163,7 @@ function TableDoctor() {
<td>
<div className="d-flex gap-2">
{/* Ver Detalhes */}
<Link to={`${medico.id}`}>
<Link to={`/medicos/${medico.id}`}>
<button
className="btn btn-sm"
style={{
@ -181,7 +181,7 @@ function TableDoctor() {
</Link>
{/* Editar */}
<Link to={`${medico.id}/edit`}>
<Link to={`/medicos/${medico.id}/edit`}>
<button
className="btn btn-sm"
style={{

View File

@ -56,6 +56,7 @@ const HandlePutPatient = async () => {
if(response.ok === false){
console.error("Erro ao atualizar paciente:");
}
else{
@ -78,7 +79,7 @@ const HandlePutPatient = async () => {
<PatientForm
onSave={HandlePutPatient}
onCancel={() => {navigate('/secretaria/pacientes')}}
formData={PatientToPUT}
setFormData={setPatientPUT}
/>

View File

@ -127,7 +127,10 @@ function PatientCadastroManager( {setCurrentPage} ) {
<div className="col-12">
<PatientForm
onSave={handleSavePatient}
onCancel={() => {
const prefixo = location.pathname.split("/")[1];
navigate(`/${prefixo}/pacientes`);
}}
formData={formData}
setFormData={setFormData}
/>