diff --git a/web-ui/web-react/src/components/PerfilAdminComunidad.js b/web-ui/web-react/src/components/PerfilAdminComunidad.js index eee0b252..c0a2a3a2 100644 --- a/web-ui/web-react/src/components/PerfilAdminComunidad.js +++ b/web-ui/web-react/src/components/PerfilAdminComunidad.js @@ -48,8 +48,38 @@ const PerfilAdminComunidad = () => { const [globalFilter, setGlobalFilter] = useState(null); //para el perfil de la comunidad const [tenants, setTenants] = useState([]); + const [commonAreaList, setCommonAreaList] = useState([]); + const [provincesList, setProvincesList] = useState([]); + const [cantonsList, setCantonsList] = useState([]); + const [districtsList, setDistrictsList] = useState([]); + async function getProvinces() { + const response = await fetch('assets/demo/data/provincias.json', { + method: 'GET', + }); + return await response.json(); + } + + + async function getCantons() { + const response = await fetch('assets/demo/data/cantones.json', { + method: 'GET', + }); + return await response.json(); + } + + + async function getDistricts() { + const response = await fetch('assets/demo/data/distritos.json', { + method: 'GET', + }); + return await response.json(); + } + + + + async function getAdmin() { await fetch('http://localhost:4000/user/findUserById/' + cookies.id, { method: 'GET' }) .then((response) => response.json()) @@ -71,11 +101,16 @@ const PerfilAdminComunidad = () => { }, []) async function getCommunity() { - - fetch(`http://localhost:4000/community/findCommunityName/${cookies.community_id}`, { method: 'GET' }) + let pList = await getProvinces(); + let cList = await getCantons(); + let dList = await getDistricts(); + await fetch(`http://localhost:4000/community/findCommunityName/${cookies.community_id}`, { method: 'GET' }) .then((response2) => response2.json()) .then(data => data.message) .then(data => { + data.province = pList.find((p) => p.code === data.province).name; + data.canton = cList.find((p) => p.code === data.canton).name; + data.district = dList.find((p) => p.code === data.district).name; setCommunity(data) }) } @@ -100,6 +135,8 @@ const PerfilAdminComunidad = () => { tenantsList(community._id); }, []) + + function findNameTenant(tenant_id) { let name = ''; if (tenant_id == '') { @@ -147,138 +184,175 @@ const PerfilAdminComunidad = () => { } return ( -
{admin.name}
+ <> +Nombre Completo
+{admin.name + ' ' + admin.last_name}
+Identificación
+{admin.dni}
+Correo Electrónico
+{admin.email}
+Número de teléfono
+{admin.phone}
+Nombre
+{community.name}
+Teléfono Administrativo
+ +{community.phone}
+Ubicación
+{community.province}, {community.canton}, {community.district}
+Cantidad de Viviendas
+{community.num_houses}
+Nombre
-{community.name}
-Teléfono Administrativo
+{community.phone}
-Provincia
-{community.province}
-Cantón
-{community.canton}
-Distrito
-{community.district}
-Cantidad de Viviendas
-{community.num_houses}
+Viviendas
-