format inquilinoscompletar

This commit is contained in:
Eduardo Quiros 2022-08-03 22:34:16 -06:00
parent 1bab1ba10f
commit 67f9f372e5
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 58 additions and 57 deletions

View File

@ -1,13 +1,11 @@
import { Button } from 'primereact/button'; import { Button } from 'primereact/button'
import { InputText } from 'primereact/inputtext' import { InputText } from 'primereact/inputtext'
import React, { useState, useRef } from 'react' import React, { useState, useRef } from 'react'
import { Dropdown } from 'primereact/dropdown'; import { Dropdown } from 'primereact/dropdown'
import { useCookies } from "react-cookie";
import { useCookies } from 'react-cookie'
const Inquilinos = () => { const Inquilinos = () => {
let emptyTenant = { let emptyTenant = {
_id: null, _id: null,
dni: '', dni: '',
@ -23,21 +21,20 @@ const Inquilinos = () => {
date_entry: new Date(), date_entry: new Date(),
status: '1', status: '1',
status_text: '', status_text: '',
}; }
const [tenant, setTenant] = useState(emptyTenant); const [tenant, setTenant] = useState(emptyTenant)
const [selectedTentants, setSelectedTenants] = useState(null); const [selectedTentants, setSelectedTenants] = useState(null)
const [globalFilter, setGlobalFilter] = useState(null); const [globalFilter, setGlobalFilter] = useState(null)
const [deleteTenantDialog, setDeleteTenantDialog] = useState(false); const [deleteTenantDialog, setDeleteTenantDialog] = useState(false)
const [deleteTenantsDialog, setDeleteTenantsDialog,] = useState(false); const [deleteTenantsDialog, setDeleteTenantsDialog] = useState(false)
const [communitiesList, setCommunitiesList] = useState([]); const [communitiesList, setCommunitiesList] = useState([])
const [communityId, setCommunityId] = useState(null); const [communityId, setCommunityId] = useState(null)
const [submitted, setSubmitted] = useState(false); const [submitted, setSubmitted] = useState(false)
const toast = useRef(null);
const dt = useRef(null);
const [cookies, setCookie] = useCookies(); const [cookies, setCookie] = useCookies()
const [changeStatusTenantDialog, setChangeStatusTenantDialog] = useState(false); const [changeStatusTenantDialog, setChangeStatusTenantDialog] =
useState(false)
function finalizarRegistro() { function finalizarRegistro() {
let data = { let data = {
@ -50,7 +47,7 @@ const Inquilinos = () => {
password: document.getElementById('password').value, password: document.getElementById('password').value,
user_type: '3', user_type: '3',
status: '1', status: '1',
}; }
fetch('http://localhost:3000/api/createUser', { fetch('http://localhost:3000/api/createUser', {
method: 'POST', method: 'POST',
@ -61,61 +58,65 @@ const Inquilinos = () => {
}, },
}).then((response) => { }).then((response) => {
if (response.ok) { if (response.ok) {
alert('Inquilino registrado correctamente'); alert('Inquilino registrado correctamente')
} else { } else {
alert('Error al registrar inquilino'); alert('Error al registrar inquilino')
} }
}); })
} }
return ( return (
<div className="grid"> <div className='grid'>
<div className="col-12"> <div className='col-12'>
<div className="card"> <div className='card'>
<h5 className="card-header">Registrar Inquilino</h5> <h5 className='card-header'>Registrar Inquilino</h5>
<div className="p-fluid formgrid grid"> <div className='p-fluid formgrid grid'>
<div className="field col-12 md:col-6"> <div className='field col-12 md:col-6'>
<label htmlFor="nombre">Nombre</label> <label htmlFor='nombre'>Nombre</label>
<InputText type="text" className="form-control" id="nombre" /> <InputText type='text' className='form-control' id='nombre' />
</div> </div>
<div className="field col-12 md:col-6"> <div className='field col-12 md:col-6'>
<label htmlFor="apellidos">Apellido(s)</label> <label htmlFor='apellidos'>Apellido(s)</label>
<InputText type="text" className="form-control" id="apellidos" /> <InputText type='text' className='form-control' id='apellidos' />
</div> </div>
<div className="field col-12 md:col-6"> <div className='field col-12 md:col-6'>
<label htmlFor="identificacion">Identificación</label> <label htmlFor='identificacion'>Identificación</label>
<InputText <InputText
type="text" type='text'
className="form-control" className='form-control'
id="identificacion" id='identificacion'
/> />
</div> </div>
<div className="field col-12 md:col-6"> <div className='field col-12 md:col-6'>
<label htmlFor="correo_electronico">Correo electrónico</label> <label htmlFor='correo_electronico'>Correo electrónico</label>
<InputText <InputText
type="email" type='email'
className="form-control" className='form-control'
id="correo_electronico" id='correo_electronico'
/> />
</div> </div>
<div className="field col-12 md:col-6"> <div className='field col-12 md:col-6'>
<label htmlFor="numero_vivienda">Número de Vivienda</label> <label htmlFor='numero_vivienda'>Número de Vivienda</label>
<Dropdown id="numero_vivienda" value={communityId} options={cList} /> <Dropdown
</div> id='numero_vivienda'
<div className="field col-12 md:col-6"> value={communityId}
<label htmlFor="identificacion">Identificación</label> options={cList}
<InputText
type="password"
className="form-control"
id="identificacion"
/> />
</div> </div>
<Button label="Registrar" onClick={finalizarRegistro} /> <div className='field col-12 md:col-6'>
<label htmlFor='identificacion'>Identificación</label>
<InputText
type='password'
className='form-control'
id='identificacion'
/>
</div>
<Button label='Registrar' onClick={finalizarRegistro} />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
); )
}; }
export default React.memo(Inquilinos); export default React.memo(Inquilinos)