Creación del componente

Creación del componente de lista para listar los admins de comunidad
This commit is contained in:
Traym17 2022-07-14 19:08:04 -06:00
parent bf91f1e4b8
commit d6e468ca03
3 changed files with 44 additions and 6 deletions

View File

@ -29,6 +29,7 @@ import InvalidStateDemo from './templates/InvalidStateDemo';
import BlocksDemo from './templates/BlocksDemo';
import IconsDemo from './templates/IconsDemo';
import AdministradoresSistema from './components/AdministradoresSistema';
import AdministradoresComunidad from './components/AdministradoresComunidad';
import Crud from './pages/Crud';
import EmptyPage from './pages/EmptyPage';
@ -163,7 +164,7 @@ const App = () => {
items: [
{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: '/administradoresSistema'},
{label: 'Administradores de comunidad', icon: 'pi pi-fw pi-id-card', to: '/administradoresComunidad'},
{label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn'}
]
},
@ -318,6 +319,7 @@ const App = () => {
<Route path="/empty" component={EmptyPage} />
<Route path="/documentation" component={Documentation} />
<Route path="/administradoresSistema" component={AdministradoresSistema} />
<Route path="/administradoresComunidad" component={AdministradoresComunidad} />
<Route path="/logIn" component={LogIn} />
</div>

View File

@ -0,0 +1,41 @@
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 AdministradoresComunidad = () => {
const [pokemones,setPokemones]=useState([]);
const [urlFetch,setUrlFetch]=useState('http://localhost:4000/user/findAdminSistema/');
async function fetchP(){
let nombres=await fetch(urlFetch, {method:'GET'});
let pokemonesRes= await nombres.json();
setPokemones(pokemonesRes.message);
console.log(pokemones);
}
useEffect(()=>{
fetchP();
},[])
return (
<div className="grid">
<div className="col-12">
<div className="card">
<h5>Administradores de comunidad</h5>
<DataTable value={pokemones} scrollable scrollHeight="400px" scrollDirection="both" className="mt-3">
<Column field="name" header="Nombre" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
<Column field="last_name" header="Apellidos" style={{ flexGrow: 1, flexBasis: '160px' }} alignFrozen="left"></Column>
<Column field="dni" header="Identificación" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
<Column field="email" header="Correo electrónico" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
<Column field="phone" header="Telefóno" style={{ flexGrow: 1, flexBasis: '160px' }}></Column>
</DataTable>
</div>
</div>
</div>
)
}
export default React.memo(AdministradoresComunidad);

View File

@ -18,11 +18,6 @@ const AdministradoresSistema = () => {
fetchP();
},[])
function registrarAdmin() {
var data = {
dni: document.getElementById('identificacion').value,