forked from RiseUP/riseup-squad23
Finalização Linkagens
This commit is contained in:
parent
0bf19ab6f2
commit
903882d6ff
@ -1,8 +1,16 @@
|
|||||||
import React, { useState } from 'react';
|
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 }) {
|
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 FormatTelefones = (valor) => {
|
||||||
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
||||||
return digits
|
return digits
|
||||||
@ -419,11 +427,11 @@ function DoctorForm({ onSave, onCancel, formData, setFormData }) {
|
|||||||
>
|
>
|
||||||
Salvar Médico
|
Salvar Médico
|
||||||
</button>
|
</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
|
Cancelar
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -2,9 +2,12 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import {Link} from 'react-router-dom'
|
import {Link} from 'react-router-dom'
|
||||||
// formatar número
|
// formatar número
|
||||||
// formatar CPF
|
// formatar CPF
|
||||||
|
import { useNavigate, useLocation } from 'react-router-dom';
|
||||||
import { FormatTelefones,FormatPeso, FormatCPF } from '../utils/Formatar/Format';
|
import { FormatTelefones,FormatPeso, FormatCPF } from '../utils/Formatar/Format';
|
||||||
|
|
||||||
function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
const [errorModalMsg, setErrorModalMsg] = useState("");
|
const [errorModalMsg, setErrorModalMsg] = useState("");
|
||||||
// Estado para controlar a exibição do modal e os dados do paciente existente
|
// Estado para controlar a exibição do modal e os dados do paciente existente
|
||||||
const [showModal, setShowModal] = useState(false);
|
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
|
// Estado para armazenar a URL da foto do avatar
|
||||||
const [avatarUrl, setAvatarUrl] = useState(null);
|
const [avatarUrl, setAvatarUrl] = useState(null);
|
||||||
|
|
||||||
@ -415,11 +423,11 @@ function PatientForm({ onSave, onCancel, formData, setFormData }) {
|
|||||||
Salvar Paciente
|
Salvar Paciente
|
||||||
</button>
|
</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
|
Cancelar
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user