Finalização Linkagens
This commit is contained in:
parent
0bf19ab6f2
commit
903882d6ff
@ -1,8 +1,16 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link,useNavigate, useLocation } from 'react-router-dom';
|
||||
|
||||
function DoctorForm({ onSave, onCancel, formData, setFormData }) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const Voltar = () => {
|
||||
const prefixo = location.pathname.split("/")[1];
|
||||
navigate(`/${prefixo}/medicos`);
|
||||
}
|
||||
|
||||
// Funções para formatar telefone e CPF
|
||||
const FormatTelefones = (valor) => {
|
||||
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
||||
return digits
|
||||
@ -419,11 +427,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' }}>
|
||||
|
||||
<button className="btn btn-light" onClick={() => Voltar()} style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }}>
|
||||
Cancelar
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@ -2,9 +2,12 @@ import React, { useState, useEffect } from 'react';
|
||||
import {Link} from 'react-router-dom'
|
||||
// formatar número
|
||||
// formatar CPF
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { FormatTelefones,FormatPeso, FormatCPF } from '../utils/Formatar/Format';
|
||||
|
||||
|
||||
function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const [errorModalMsg, setErrorModalMsg] = useState("");
|
||||
// Estado para controlar a exibição do modal e os dados do paciente existente
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
@ -14,6 +17,11 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
||||
|
||||
|
||||
|
||||
|
||||
const Voltar = () => {
|
||||
const prefixo = location.pathname.split("/")[1];
|
||||
navigate(`/${prefixo}/pacientes`);
|
||||
}
|
||||
// Estado para armazenar a URL da foto do avatar
|
||||
const [avatarUrl, setAvatarUrl] = useState(null);
|
||||
|
||||
@ -415,11 +423,11 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
||||
Salvar Paciente
|
||||
</button>
|
||||
|
||||
<Link to='/pacientes'>
|
||||
<button className="btn btn-light" style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }}>
|
||||
|
||||
<button className="btn btn-light" style={{ fontSize: '1.2rem', padding: '0.75rem 1.5rem' }} onClick={() => Voltar()}>
|
||||
Cancelar
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user