fix listar nombre de los inquilinos de cada vivienda

This commit is contained in:
Mariela 2022-08-01 23:09:43 -06:00
parent 6200ebf42c
commit 162b838e75
1 changed files with 22 additions and 8 deletions

View File

@ -176,14 +176,18 @@ const Communities = () => {
getCommunites(); getCommunites();
}, []); }, []);
/*async function tenantsList(id) { async function tenantsList(id) {
await fetch(`http://localhost:4000/user/findTenants/${id}`, { method: 'GET' }) await fetch(`http://localhost:4000/user/findTenants/${id}`, { method: 'GET' })
.then((response) => response.json()) .then((response) => response.json())
.then(data => data.message) .then(data => data.message)
.then(data => { .then(data => {
setTenants(data) setTenants(data)
}); });
}*/ }
useEffect(() => {
tenantsList(community._id);
}, [])
const saveCommunity = () => { const saveCommunity = () => {
@ -300,7 +304,7 @@ const Communities = () => {
const infoCommunity = async (community) => { const infoCommunity = async (community) => {
//await tenantsList(community._id); await tenantsList(community._id);
setCommunity({ ...community }); setCommunity({ ...community });
setCommunityDialog(true); setCommunityDialog(true);
@ -569,16 +573,22 @@ const Communities = () => {
<p> <p>
{' '} {' '}
<FontAwesomeIcon icon={faUserAlt} style={{ color: '#C08135' }} />{' '} <FontAwesomeIcon icon={faUserAlt} style={{ color: '#C08135' }} />{' '}
</p>
Inquilinos Inquilinos
</p>
</> </>
); );
const tenantsBodyTemplate = (rowData) => { const tenantsBodyTemplate = (rowData) => {
/*let tenants = rowData.tenants; let tenants = rowData.tenants;
let name = findNameTenant(tenants.tenant_id); let name = findNameTenant(tenants.tenant_id);
console.log(name)*/ console.log(name);
return (
<>
{name}
</>
)
}; };
return ( return (
@ -652,9 +662,13 @@ const Communities = () => {
<Column <Column
field="name_admin" field="name_admin"
sortable sortable
header={headerAdministrator}
style={{ flexGrow: 1, flexBasis: '180px' }} style={{ flexGrow: 1, flexBasis: '180px' }}
></Column> ></Column>
<Column body={actionsCommunity}></Column> <Column
body={actionsCommunity}
style={{ flexGrow: 1, flexBasis: '180px' }}
></Column>
</DataTable> </DataTable>
@ -761,7 +775,7 @@ const Communities = () => {
rowsPerPageOptions={[5, 10, 25]} rowsPerPageOptions={[5, 10, 25]}
className="datatable-responsive mt-3" className="datatable-responsive mt-3"
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown" paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
currentPageReportTemplate="Mostrando {first} a {last} de {totalRecords} comunidades de viviendas" currentPageReportTemplate="Mostrando {first} a {last} de {totalRecords} viviendas"
globalFilter={globalFilter} globalFilter={globalFilter}
> >
<Column <Column