forked from RiseUP/riseup-squad23
começo do concerto do editar
This commit is contained in:
parent
82469bccf9
commit
b9a35be8ee
@ -3,6 +3,7 @@ import React, { useState, useEffect } from 'react';
|
||||
|
||||
function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
|
||||
PatientDict = PatientDict || {}
|
||||
|
||||
const FormatTelefones = (valor) => {
|
||||
const digits = String(valor).replace(/\D/g, '').slice(0, 11);
|
||||
@ -65,9 +66,10 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
.replace(/(\d{3})(\d{1,2})$/, '$1-$2');
|
||||
}
|
||||
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
foto: null,
|
||||
nome: PatientDict.nome,
|
||||
nome:PatientDict.nome,
|
||||
nomeSocial: PatientDict.nome_social,
|
||||
dataNascimento: PatientDict.data_nascimento,
|
||||
genero: PatientDict.sexo,
|
||||
@ -80,20 +82,20 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
cpfResponsavel: '',
|
||||
nomeConjuge: '',
|
||||
outroId: '',
|
||||
cep: '',
|
||||
cidade: PatientDict.cidade,
|
||||
estado: PatientDict.estado,
|
||||
bairro: PatientDict.bairro,
|
||||
rua: PatientDict.logradouro,
|
||||
numero: '',
|
||||
complemento: '',
|
||||
email: PatientDict.email,
|
||||
telefone1: PatientDict.celular,
|
||||
telefone2: '',
|
||||
telefone3: '',
|
||||
observacoes: '',
|
||||
rg: '',
|
||||
documentoTipo: '',
|
||||
cep:PatientDict.endereco?.cep,
|
||||
cidade: PatientDict.endereco?.cidade,
|
||||
estado: PatientDict.endereco?.estado,
|
||||
bairro: PatientDict.endereco?.bairro,
|
||||
rua: PatientDict.endereco?.logradouro,
|
||||
numero: PatientDict.endereco?.numero,
|
||||
complemento: PatientDict.endereco?.complemento,
|
||||
email: PatientDict.contato?.email,
|
||||
telefone1: PatientDict.contato?.telefone1,
|
||||
telefone2: PatientDict.contato?.telefone2,
|
||||
telefone3: PatientDict.contato?.telefone3,
|
||||
observacoes: PatientDict.observacoes,
|
||||
rg: PatientDict.rg,
|
||||
documentoTipo: PatientDict.outros_documentos?.tipo,
|
||||
numeroDocumento: '',
|
||||
etniaRaca: '',
|
||||
naturalidade: '',
|
||||
@ -314,7 +316,7 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
{/* CADASTRO */}
|
||||
<div className="col-md-6 mb-3">
|
||||
<label style={{ fontSize: '1.1rem' }}>Nome: *</label>
|
||||
<input type="text" className="form-control" name="nome" value={formData.nome} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
||||
<input type="text" className="form-control" name="nome" value={PatientDict.nome} onChange={handleChange} style={{ fontSize: '1.1rem' }} />
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
<label style={{ fontSize: '1.1rem' }}>Nome social:</label>
|
||||
@ -347,6 +349,7 @@ function PatientForm({ onSave, onCancel, PatientDict }) {
|
||||
<option value="">Selecione</option>
|
||||
<option value="CNH">CNH</option>
|
||||
<option value="Passaporte">Passaporte</option>
|
||||
<option value="carteira de trabalho">Carteira de Trabalho</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="col-md-6 mb-3">
|
||||
|
||||
@ -19,7 +19,7 @@ useEffect(() => {
|
||||
fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${id}`, requestOptions)
|
||||
.then(response => response.json())
|
||||
.then(result => result.data)
|
||||
.then(data => console.log(data))
|
||||
.then(data => setPatientPUT(data))
|
||||
.catch(error => console.log('error', error));
|
||||
|
||||
}, [])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user