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