From 99ecc65b06eb4aae46b8ae1809841e8d88807976 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 21:14:34 -0600 Subject: [PATCH 1/4] =?UTF-8?q?fix=20error=20de=20texto=20en=20la=20navega?= =?UTF-8?q?ci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-ui/web-react/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-ui/web-react/src/App.js b/web-ui/web-react/src/App.js index 1fef97b4..dada19e8 100644 --- a/web-ui/web-react/src/App.js +++ b/web-ui/web-react/src/App.js @@ -183,7 +183,7 @@ const App = () => { to: '/guardasSeguridad', }, { - label: 'Comunidadades', + label: 'Comunidades', icon: PrimeIcons.BUILDING, to: '/comunidadesViviendas', }, From ea3d35158f3d86448206ec379243aa5b58523c42 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:29:48 -0600 Subject: [PATCH 2/4] ver perfil de la comunidad --- api-gateway/src/app.controller.ts | 5 + api-gateway/src/app.service.ts | 11 + .../src/users/users.controller.ts | 6 + .../public/assets/themes/khaki/theme.css | 9 + .../src/components/ComunidadViviendas.js | 212 +++++++++++++++++- 5 files changed, 240 insertions(+), 3 deletions(-) diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 20a6ee27..2fc7db12 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -112,6 +112,11 @@ export class AppController { return this.appService.findUser(paramUserDNI); } + @Get('user/findUserById/:id') + findUserById(@Param('id') id: string) { + return this.appService.findUserById(id); + } + @Delete('user/deleteAdminSystem/:id') deleteAdminSystem(@Param('id') id: string) { return this.appService.deleteAdminSystem(id); diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 4b71002b..8d59b4e7 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -162,6 +162,17 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + + //GET parameter from API + findUserById(id: string) { + const pattern = { cmd: 'findById' }; + const payload = { id: id }; + return this.clientUserApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + + // ====================== COMMUNITIES =============================== //POST parameter from API diff --git a/servicio-usuarios/src/users/users.controller.ts b/servicio-usuarios/src/users/users.controller.ts index 3f759380..7c06e16e 100644 --- a/servicio-usuarios/src/users/users.controller.ts +++ b/servicio-usuarios/src/users/users.controller.ts @@ -40,6 +40,12 @@ export class UsersController { return this.userService.findOneByDNI(dni); } + @MessagePattern({ cmd: 'findById' }) + findById(@Payload() id: string) { + let _id = id['id']; + return this.userService.findOne(_id); + } + @MessagePattern({ cmd: 'findGuardsCommunity' }) findGuardsCommunity(@Payload() community_id: string) { let pcommunity_id = community_id['community_id']; diff --git a/web-ui/web-react/public/assets/themes/khaki/theme.css b/web-ui/web-react/public/assets/themes/khaki/theme.css index 08d350a6..f051dbd7 100644 --- a/web-ui/web-react/public/assets/themes/khaki/theme.css +++ b/web-ui/web-react/public/assets/themes/khaki/theme.css @@ -7117,4 +7117,13 @@ .p-button.p-button-danger:enabled:focus { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #f7a2a2, 0 1px 2px 0 black; +} + + +.icon-khaki { + color: var(--primary-color); +} + +.row { + display: flex; } \ No newline at end of file diff --git a/web-ui/web-react/src/components/ComunidadViviendas.js b/web-ui/web-react/src/components/ComunidadViviendas.js index 706f9063..6b75e014 100644 --- a/web-ui/web-react/src/components/ComunidadViviendas.js +++ b/web-ui/web-react/src/components/ComunidadViviendas.js @@ -9,10 +9,11 @@ import classNames from 'classnames'; import { Dialog } from 'primereact/dialog'; import { Toolbar } from 'primereact/toolbar'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faHome } from '@fortawesome/free-solid-svg-icons'; +import { faHome, faUserAlt } from '@fortawesome/free-solid-svg-icons'; import { faMapLocationDot } from '@fortawesome/free-solid-svg-icons'; import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; +import { faHashtag } from '@fortawesome/free-solid-svg-icons'; const Communities = () => { let emptyCommunity = { @@ -47,6 +48,13 @@ const Communities = () => { const toast = useRef(null); const dt = useRef(null); + //para el perfil de la comunidad + + const [communityDialog, setCommunityDialog] = useState(false); + const [editcommunityDialog, setEditCommunityDialog] = useState(false); + + + const p = provincesList.map((item) => ({ label: item.name, value: item.code, @@ -120,7 +128,7 @@ const Communities = () => { fillDistricts(); }, [cantonId]); - + const handleProvinces = (event) => { const getprovinciaId = event.target.value; setProvinciaId(getprovinciaId); @@ -233,6 +241,22 @@ const Communities = () => { } }; + + + async function findNameTenant(tenant_id) { + let name = ''; + if (tenant_id == '') { + name = 'Sin inquilino'; + } else { + name = await fetch('http://localhost:4000/user/findUserById/' + tenant_id, { method: "GET" }); + let response = await response.json(); + let res = await response.message; + name = res['name'] + ' ' + res['last_name']; + } + + return name; + } + const onInputChange = (e, name) => { const val = (e.target && e.target.value) || ''; let _community = { ...community }; @@ -241,6 +265,11 @@ const Communities = () => { setCommunity(_community); }; + const hideCommunityDialog = () => { + setSubmitted(false); + setCommunityDialog(false); + }; + const hideDeleteCommunityDialog = () => { setDeleteCommunityDialog(false); }; @@ -258,6 +287,17 @@ const Communities = () => { setDeleteCommunitiesDialog(true); }; + + const infoCommunity = (community) => { + setCommunity({ ...community }); + setCommunityDialog(true); + }; + + const editCommunity = (community) => { + setCommunity({ ...community }); + setEditCommunityDialog(true); + }; + const deleteCommunity = () => { /* fetch('http://localhost:4000/community/deleteCommunity/' + community._id, { cache: 'no-cache', @@ -330,6 +370,11 @@ const Communities = () => { const actionsCommunity = (rowData) => { return (
+
); + const communityDialogFooter = ( + <> +