listar comunidades de vivienda
This commit is contained in:
parent
d4be2ae969
commit
17604ace92
|
@ -1,9 +1,13 @@
|
|||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
const cors= require('cors');
|
||||
const cors = require('cors');
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors({
|
||||
origin: 'http://localhost:3000',
|
||||
methods: 'GET, PUT, POST, DELETE',
|
||||
allowedHeaders: 'Content-Type, Authorization',
|
||||
});
|
||||
await app.listen(4000);
|
||||
app.use(cors());
|
||||
}
|
||||
bootstrap();
|
||||
|
|
|
@ -7,10 +7,10 @@ import { Tenant, TenantSchema } from './tenant.schema';
|
|||
@Schema()
|
||||
export class House extends Document {
|
||||
@Prop({ default: " " })
|
||||
number: string;
|
||||
number_house: string;
|
||||
|
||||
@Prop({ default: " " })
|
||||
description: string;
|
||||
@Prop({ default: "desocupada" })
|
||||
state: string;
|
||||
|
||||
@Prop({ type: TenantSchema, default: " " })
|
||||
tenants: Tenant;
|
||||
|
|
|
@ -30,6 +30,7 @@ import BlocksDemo from './templates/BlocksDemo';
|
|||
import IconsDemo from './templates/IconsDemo';
|
||||
import AdministradoresSistema from './components/AdministradoresSistema';
|
||||
import AdministradoresComunidad from './components/AdministradoresComunidad';
|
||||
import Communities from './components/ComunidadViviendas';
|
||||
|
||||
import Crud from './pages/Crud';
|
||||
import EmptyPage from './pages/EmptyPage';
|
||||
|
@ -165,6 +166,7 @@ const App = () => {
|
|||
{label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/'},
|
||||
{label: 'Administradores del sistema', icon: 'pi pi-fw pi-id-card', to: '/administradoresSistema'},
|
||||
{label: 'Administradores de comunidad', icon: 'pi pi-fw pi-id-card', to: '/administradoresComunidad'},
|
||||
{label: 'Comunidadades', icon: 'pi pi-fw pi-id-card', to: '/comunidadesViviendas'},
|
||||
{label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn'}
|
||||
]
|
||||
},
|
||||
|
@ -320,6 +322,7 @@ const App = () => {
|
|||
<Route path="/documentation" component={Documentation} />
|
||||
<Route path="/administradoresSistema" component={AdministradoresSistema} />
|
||||
<Route path="/administradoresComunidad" component={AdministradoresComunidad} />
|
||||
<Route path="/comunidadesViviendas" component={Communities} />
|
||||
<Route path="/logIn" component={LogIn} />
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { Button } from 'primereact/button';
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
import { Column } from 'primereact/column';
|
||||
|
||||
|
||||
const Communities = () => {
|
||||
const [communitiesList, setCommunitiesList] = useState([]);
|
||||
const [housesList, setHousesList] = useState([]);
|
||||
|
||||
|
||||
async function getCommunites() {
|
||||
let response = await fetch('http://localhost:4000/community/allCommunities', { method: 'GET' });
|
||||
let list = await response.json();
|
||||
setCommunitiesList(list.message);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCommunites();
|
||||
}, [])
|
||||
|
||||
|
||||
return (
|
||||
<div className="grid">
|
||||
<div className="col-12">
|
||||
<div className="card">
|
||||
<h5>Administradores de comunidad</h5>
|
||||
<DataTable value={communitiesList} scrollable scrollHeight="400px" scrollDirection="both" className="mt-3">
|
||||
<Column field="name" header="Nombre" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
|
||||
<Column field="last_name" header="Provincia" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
|
||||
<Column field="dni" header="Cantón" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
|
||||
<Column field="email" header="Distrito" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
|
||||
<Column field="phone" header="Telefóno" style={{ flexGrow: 1, flexBasis: '180px' }}></Column>
|
||||
</DataTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
export default React.memo(Communities);
|
Loading…
Reference in New Issue