From a39dc26216146868c4e512611ef2f1da1cdbd67f Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:10:15 -0600 Subject: [PATCH 01/33] =?UTF-8?q?elimaci=C3=B3n=20l=C3=B3gica=20en=20usuar?= =?UTF-8?q?ios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- servicio-usuarios/src/users/users.service.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/servicio-usuarios/src/users/users.service.ts b/servicio-usuarios/src/users/users.service.ts index 0fd5a813..725127ab 100644 --- a/servicio-usuarios/src/users/users.service.ts +++ b/servicio-usuarios/src/users/users.service.ts @@ -76,8 +76,14 @@ export class UsersService { }); } - async remove(id: string) { + /* async remove(id: string) { return this.userModel.findByIdAndRemove({ _id: id }).exec(); + }*/ + + async remove(id: string) { + return this.userModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } //inicio de sesion @@ -142,7 +148,9 @@ export class UsersService { } async deleteAdminSystem(id: string) { - return this.userModel.deleteOne({ _id: id }).exec(); + return this.userModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } async validateEmail(email: string) { From 86cfcc64cd3bb10ba091bf48e514b3431563e14c Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:11:23 -0600 Subject: [PATCH 02/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20res?= =?UTF-8?q?ervaciones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/reservations/reservations.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servicio-reservaciones/src/reservations/reservations.service.ts b/servicio-reservaciones/src/reservations/reservations.service.ts index 8a681cd3..45382f50 100644 --- a/servicio-reservaciones/src/reservations/reservations.service.ts +++ b/servicio-reservaciones/src/reservations/reservations.service.ts @@ -41,6 +41,8 @@ export class ReservationsService { } async remove(id: string) { - return this.reservationModel.findByIdAndRemove({ _id: id }).exec(); + return this.reservationModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } } From 95d5a5dd0fa99b4449809c6fe051d17e150664fc Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:16:40 -0600 Subject: [PATCH 03/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20rep?= =?UTF-8?q?ortes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- servicio-reportes/src/reports/reports.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/servicio-reportes/src/reports/reports.service.ts b/servicio-reportes/src/reports/reports.service.ts index 37a68957..73bc7330 100644 --- a/servicio-reportes/src/reports/reports.service.ts +++ b/servicio-reportes/src/reports/reports.service.ts @@ -31,6 +31,9 @@ export class ReportsService { } async remove(id: string) { - return this.reportModel.findByIdAndRemove({ _id: id }).exec(); + return this.reportModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); + } } From 91ac92719a867ea425b62c6f08fb1c0525bd9405 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:17:25 -0600 Subject: [PATCH 04/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20inv?= =?UTF-8?q?itados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- servicio-invitados/src/guests/guests.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servicio-invitados/src/guests/guests.service.ts b/servicio-invitados/src/guests/guests.service.ts index 97e1c4bd..02379936 100644 --- a/servicio-invitados/src/guests/guests.service.ts +++ b/servicio-invitados/src/guests/guests.service.ts @@ -32,6 +32,8 @@ export class GuestsService { } async remove(id: string) { - return this.guestModel.findByIdAndRemove({ _id: id }).exec(); + return this.guestModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } } From 14df451c0a0be79e6678e499f946c37f6d91b584 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:18:13 -0600 Subject: [PATCH 05/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20for?= =?UTF-8?q?o=20comunicados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/post-comments/post-comments.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servicio-foro-comunicaciones/src/post-comments/post-comments.service.ts b/servicio-foro-comunicaciones/src/post-comments/post-comments.service.ts index 4b8a0c0a..f82b71fa 100644 --- a/servicio-foro-comunicaciones/src/post-comments/post-comments.service.ts +++ b/servicio-foro-comunicaciones/src/post-comments/post-comments.service.ts @@ -33,6 +33,8 @@ export class PostCommentsService { } async remove(id: string) { - return this.commentModel.findByIdAndRemove({ _id: id }).exec(); + return this.commentModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } } From 2519136654143fcebb711be6cfc23deab39a7013 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:18:56 -0600 Subject: [PATCH 06/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20com?= =?UTF-8?q?unidades?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/communities/communities.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servicio-comunidad-viviendas/src/communities/communities.service.ts b/servicio-comunidad-viviendas/src/communities/communities.service.ts index 06792ef5..69cd9f24 100644 --- a/servicio-comunidad-viviendas/src/communities/communities.service.ts +++ b/servicio-comunidad-viviendas/src/communities/communities.service.ts @@ -56,7 +56,9 @@ export class CommunitiesService { } async remove(id: string) { - return this.communityModel.findByIdAndRemove({ _id: id }).exec(); + return this.communityModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } async findCommunityAdmin(community: string, user_type: string) { From 17941893cbb5e3e01e8c523c6c1ba38981287776 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 17:19:23 -0600 Subject: [PATCH 07/33] =?UTF-8?q?eliminaci=C3=B3n=20l=C3=B3gica=20en=20?= =?UTF-8?q?=C3=A1reas=20comunes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/common_areas/common_areas.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servicio-areas-comunes/src/common_areas/common_areas.service.ts b/servicio-areas-comunes/src/common_areas/common_areas.service.ts index a632a829..325a9821 100644 --- a/servicio-areas-comunes/src/common_areas/common_areas.service.ts +++ b/servicio-areas-comunes/src/common_areas/common_areas.service.ts @@ -32,6 +32,8 @@ export class CommonAreasService { } async remove(id: string) { - return this.commonAreaModel.findByIdAndRemove({ _id: id }).exec(); + return this.commonAreaModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } } From b89bcd68bb7ccee5ff7af407fba62bd4420fea2b Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 21:05:19 -0600 Subject: [PATCH 08/33] arreglar columnas del listar admin comunidad --- .../src/components/AdministradoresComunidad.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/web-ui/web-react/src/components/AdministradoresComunidad.js b/web-ui/web-react/src/components/AdministradoresComunidad.js index 37c4dae6..09c1fcf6 100644 --- a/web-ui/web-react/src/components/AdministradoresComunidad.js +++ b/web-ui/web-react/src/components/AdministradoresComunidad.js @@ -345,15 +345,7 @@ const AdministradoresComunidad = () => { ) - const headerOptions = ( - <> -

- {' '} - {' '} - -

- - ) + const onInputChange = (e, name) => { const val = (e.target && e.target.value) || ''; @@ -389,9 +381,9 @@ const AdministradoresComunidad = () => { - - - + + +
From 7fc01af71e9e8efa87f6562bd2116e76286f9e51 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 21:06:50 -0600 Subject: [PATCH 09/33] arreglar columnas comunidad de viviendas --- .../src/components/ComunidadViviendas.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/web-ui/web-react/src/components/ComunidadViviendas.js b/web-ui/web-react/src/components/ComunidadViviendas.js index 706f9063..21b846e9 100644 --- a/web-ui/web-react/src/components/ComunidadViviendas.js +++ b/web-ui/web-react/src/components/ComunidadViviendas.js @@ -493,15 +493,6 @@ const Communities = () => { ); - const headerOptions = ( - <> -

- Opciones{' '} - -

- - ); - return (
@@ -537,21 +528,25 @@ const Communities = () => { > @@ -562,15 +557,16 @@ const Communities = () => { > - + Date: Sun, 31 Jul 2022 21:07:39 -0600 Subject: [PATCH 10/33] arreglar columnas del administrador del sistema --- .../src/components/AdministradoresSistema.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/web-ui/web-react/src/components/AdministradoresSistema.js b/web-ui/web-react/src/components/AdministradoresSistema.js index 5d007e38..6b609bcf 100644 --- a/web-ui/web-react/src/components/AdministradoresSistema.js +++ b/web-ui/web-react/src/components/AdministradoresSistema.js @@ -313,15 +313,6 @@ const AdministradoresSistema = () => { ); - const headerOptions = ( - <> -

- Opciones{' '} - -

- - ); - return (
@@ -402,7 +393,6 @@ const AdministradoresSistema = () => { > { }} > From 440c13018a2129464c9998785dbb1024e1ecf5f4 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 21:09:57 -0600 Subject: [PATCH 11/33] arreglar columnas guardas de seguridad --- .../src/components/GuardasSeguridad.js | 110 ++++++++++-------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/web-ui/web-react/src/components/GuardasSeguridad.js b/web-ui/web-react/src/components/GuardasSeguridad.js index e7ff5192..a092910f 100644 --- a/web-ui/web-react/src/components/GuardasSeguridad.js +++ b/web-ui/web-react/src/components/GuardasSeguridad.js @@ -14,8 +14,8 @@ import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; const GuardasSeguridad = () => { - const [listaGuardas,setListaGuardas]=useState([]); - const [urlFetch,setUrlFetch]=useState('http://localhost:4000/user/findGuards/62be68215692582bbfd77134'); + const [listaGuardas, setListaGuardas] = useState([]); + const [urlFetch, setUrlFetch] = useState('http://localhost:4000/user/findGuards/62be68215692582bbfd77134'); const [guarda, setGuarda] = useState(emptyGuarda); const [selectedGuardas, setSelectedGuardas] = useState(null); const [globalFilter, setGlobalFilter] = useState(null); @@ -37,14 +37,14 @@ const GuardasSeguridad = () => { - async function listaGuardasF(){ - let nombres=await fetch(urlFetch, {method:'GET'}); - let listaGuardasRes= await nombres.json(); - setListaGuardas(listaGuardasRes.message); - } - useEffect(()=>{ + async function listaGuardasF() { + let nombres = await fetch(urlFetch, { method: 'GET' }); + let listaGuardasRes = await nombres.json(); + setListaGuardas(listaGuardasRes.message); + } + useEffect(() => { listaGuardasF(); - },[]) + }, []) function registrarGuarda() { var data = { @@ -56,9 +56,9 @@ const GuardasSeguridad = () => { password: document.getElementById('correo_electronico').value, user_type: "4", //4 es guarda status: "1", - community_id:"62be68215692582bbfd77134" + community_id: "62be68215692582bbfd77134" }; - var data2={ + var data2 = { dni: "11979037", name: "Jorge", last_name: "Soto", @@ -67,35 +67,35 @@ const GuardasSeguridad = () => { password: "1203", user_type: "2", status: "4", - community_id:"62be68215692582bbfd77134" + community_id: "62be68215692582bbfd77134" } -console.log('ssss'); - fetch('http://localhost:4000/user/createGuard', { + console.log('ssss'); + fetch('http://localhost:4000/user/createGuard', { cache: 'no-cache', method: 'POST', - mode:'cors', + mode: 'cors', body: JSON.stringify(data2), headers: { 'Content-Type': 'application/json' } }) - .then( - function (response) { - if (response.status != 201) - console.log('Ocurrió un error con el servicio: ' + response.status); - else - return response.json(); - } - ) - .then( - function (response) { - console.log('fff'); - listaGuardasF(); - } - ) - .catch( - err => console.log('Ocurrió un error con el fetch', err) - ); + .then( + function (response) { + if (response.status != 201) + console.log('Ocurrió un error con el servicio: ' + response.status); + else + return response.json(); + } + ) + .then( + function (response) { + console.log('fff'); + listaGuardasF(); + } + ) + .catch( + err => console.log('Ocurrió un error con el fetch', err) + ); } const hideDeleteGuardaDialog = () => { @@ -218,48 +218,58 @@ console.log('ssss'); const headerName = ( <> -

Nombre

+

{' '} + {' '} + Nombre +

) const headerLastName = ( <> -

Apellidos

+

+ {' '} + {' '} + Apellido(s) +

) const headerDNI = ( - <> -

Identificación

- +

{' '} + {' '} + Identificación +

) const headerEmail = ( <> -

Correo Electrónico

+

{' '} + {' '} + Correo Electrónico +

) const headerPhone = ( <> -

Teléfono

+

+ {' '} + {' '} + Teléfono +

) - const headerOptions = ( - <> -

Opciones

- - ) return (
-
+
- + setSelectedGuardas(e.value)} - responsiveLayout="scroll" header={header} + responsiveLayout="scroll" header={header} rowsPerPageOptions={[5, 10, 25]} className="datatable-responsive mt-3" paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown" currentPageReportTemplate="Mostrando {first} a {last} de {totalRecords}" @@ -270,8 +280,8 @@ console.log('ssss'); - - + +
@@ -316,7 +326,7 @@ console.log('ssss');
- ); + ); }; export default React.memo(GuardasSeguridad); From 61ec6018eca6e766ac92e5c4960cf1919d27a808 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 21:10:08 -0600 Subject: [PATCH 12/33] fix texto comunidad de vivienda --- web-ui/web-react/src/components/ComunidadViviendas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-ui/web-react/src/components/ComunidadViviendas.js b/web-ui/web-react/src/components/ComunidadViviendas.js index 21b846e9..c0d9a92c 100644 --- a/web-ui/web-react/src/components/ComunidadViviendas.js +++ b/web-ui/web-react/src/components/ComunidadViviendas.js @@ -432,7 +432,7 @@ const Communities = () => { icon={faMapLocationDot} style={{ color: '#D7A86E' }} />{' '} - Pronvincia + Provincia

); From 0456b3735baae95f7f4ec2691aba84b0043f5055 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:46:30 -0600 Subject: [PATCH 13/33] add Areas Comunes document .js --- web-ui/web-react/src/components/Areas Comunes.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 web-ui/web-react/src/components/Areas Comunes.js diff --git a/web-ui/web-react/src/components/Areas Comunes.js b/web-ui/web-react/src/components/Areas Comunes.js new file mode 100644 index 00000000..e69de29b From 9dce98fc76d581d3b6b347bf5df1abb65137e317 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:49:05 -0600 Subject: [PATCH 14/33] add areas comunes in app.js --- web-ui/web-react/src/App.js | 13 ++++++++++++- web-ui/web-react/src/components/Areas Comunes.js | 0 web-ui/web-react/src/components/AreasComunes.js | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) delete mode 100644 web-ui/web-react/src/components/Areas Comunes.js create mode 100644 web-ui/web-react/src/components/AreasComunes.js diff --git a/web-ui/web-react/src/App.js b/web-ui/web-react/src/App.js index 1fef97b4..a70c89ec 100644 --- a/web-ui/web-react/src/App.js +++ b/web-ui/web-react/src/App.js @@ -51,6 +51,7 @@ import './assets/layout/layout.scss'; import './App.scss'; import LogIn from './components/LogIn'; import { PrimeIcons } from 'primereact/api'; +import AreasComunes from './components/AreasComunes'; const App = () => { const [layoutMode, setLayoutMode] = useState('static'); @@ -187,7 +188,16 @@ const App = () => { icon: PrimeIcons.BUILDING, to: '/comunidadesViviendas', }, - { label: 'Inquilinos', icon: PrimeIcons.USER, to: '/inquilinos' }, + { + label: 'Inquilinos', + icon: PrimeIcons.USER, + to: '/inquilinos' + }, + { + label: 'Áreas Comunes de Comunidad', + icon: PrimeIcons.BUILDING, + to: '/areasComunes', + }, { label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn' }, ], }, @@ -411,6 +421,7 @@ const App = () => { +
diff --git a/web-ui/web-react/src/components/Areas Comunes.js b/web-ui/web-react/src/components/Areas Comunes.js deleted file mode 100644 index e69de29b..00000000 diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js new file mode 100644 index 00000000..7174a689 --- /dev/null +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -0,0 +1,12 @@ +import { Button } from 'primereact/button'; +import { Dropdown } from 'primereact/dropdown'; +import { InputText } from 'primereact/inputtext'; +import React, { useEffect, useState } from 'react'; + + +const AreasComunes = () => { + +}; + + +export default React.memo(AreasComunes); From 4a8effac6d7c2960f05dfa1f4a4b2e98a8505a12 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:52:01 -0600 Subject: [PATCH 15/33] create consts e imports --- .../web-react/src/components/AreasComunes.js | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 7174a689..304cba77 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -1,11 +1,49 @@ +import React, { useEffect, useState, useRef } from 'react'; +import { InputText } from 'primereact/inputtext'; import { Button } from 'primereact/button'; import { Dropdown } from 'primereact/dropdown'; -import { InputText } from 'primereact/inputtext'; -import React, { useEffect, useState } from 'react'; +import { DataTable } from 'primereact/datatable'; +import { Column } from 'primereact/column'; +import { Toast } from 'primereact/toast'; +import { Dialog } from 'primereact/dialog'; +import { Toolbar } from 'primereact/toolbar'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faHome, faUserAlt } from '@fortawesome/free-solid-svg-icons'; +import { faPhoneAlt } from '@fortawesome/free-solid-svg-icons'; +import { faAt } from '@fortawesome/free-solid-svg-icons'; +import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; +import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; +import { faHomeAlt } from '@fortawesome/free-solid-svg-icons'; +import classNames from 'classnames'; const AreasComunes = () => { + let emptyCommonArea = { + _id: null, + dni: '', + name: '', + last_name: '', + email: '', + phone: '', + password: '', + confirmPassword: '', + community_id: '', + community_name: '', + user_type: '2', + date_entry: new Date(), + status: '1' + }; + + const [listaCommonAreas, setListaCommonAreas] = useState([]); + const [commonArea, setCommonArea] = useState(emptyCommonArea); + const [selectedAdminsCommunities, setSelectedAdminsCommunities] = useState(null); + const [deleteAdminCommunityDialog, setDeleteAdminCommunityDialog] = useState(false); + const [deleteAdminsCommunitiesDialog, setDeleteAdminsCommunitiesDialog] = useState(false); + const [submitted, setSubmitted] = useState(false); + const toast = useRef(null); + const dt = useRef(null); + }; From 7ba62d9db1a60b9e643dd47f216314cefe309bea Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:53:21 -0600 Subject: [PATCH 16/33] fix textos en constantes --- web-ui/web-react/src/components/AreasComunes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 304cba77..211867a0 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -35,11 +35,11 @@ const AreasComunes = () => { status: '1' }; - const [listaCommonAreas, setListaCommonAreas] = useState([]); + const [commonAreasList, setCommonAreasList] = useState([]); const [commonArea, setCommonArea] = useState(emptyCommonArea); - const [selectedAdminsCommunities, setSelectedAdminsCommunities] = useState(null); - const [deleteAdminCommunityDialog, setDeleteAdminCommunityDialog] = useState(false); - const [deleteAdminsCommunitiesDialog, setDeleteAdminsCommunitiesDialog] = useState(false); + const [selectedCommonAreas, setSelectedCommonAreas] = useState(null); + const [deleteCommonAreaDialog, setDeleteCommonAreaDialog] = useState(false); + const [deleteCommonAreasDialog, setDeleteCommonAreasDialog] = useState(false); const [submitted, setSubmitted] = useState(false); const toast = useRef(null); const dt = useRef(null); From 236bdcd05288f55b2edadd96d1362339d198da68 Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:56:28 -0600 Subject: [PATCH 17/33] install module react cookie --- web-ui/web-react/package-lock.json | 125 +++++++++++++++++++++++++++++ web-ui/web-react/package.json | 1 + 2 files changed, 126 insertions(+) diff --git a/web-ui/web-react/package-lock.json b/web-ui/web-react/package-lock.json index 5ddda7d4..e9ff9cd3 100644 --- a/web-ui/web-react/package-lock.json +++ b/web-ui/web-react/package-lock.json @@ -27,6 +27,7 @@ "prismjs": "1.9.0", "react": "^17.0.1", "react-app-polyfill": "^1.0.6", + "react-cookie": "^4.1.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.1", @@ -2475,6 +2476,11 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/cookie": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", + "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" + }, "node_modules/@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -2489,6 +2495,15 @@ "@types/node": "*" } }, + "node_modules/@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dependencies": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -2531,11 +2546,31 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "node_modules/@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" + }, "node_modules/@types/q": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.5.tgz", "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==" }, + "node_modules/@types/react": { + "version": "18.0.15", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.15.tgz", + "integrity": "sha512-iz3BtLuIYH1uWdsv6wXYdhozhqj20oD4/Hk2DNXIn1kFsmp9x8d9QB6FnPhfkbhd2PgEONt9Q1x/ebkwjfFLow==", + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" + }, "node_modules/@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -13402,6 +13437,19 @@ "node": ">=6" } }, + "node_modules/react-cookie": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.1.1.tgz", + "integrity": "sha512-ffn7Y7G4bXiFbnE+dKhHhbP+b8I34mH9jqnm8Llhj89zF4nPxPutxHT1suUqMeCEhLDBI7InYwf1tpaSoK5w8A==", + "dependencies": { + "@types/hoist-non-react-statics": "^3.0.1", + "hoist-non-react-statics": "^3.0.0", + "universal-cookie": "^4.0.0" + }, + "peerDependencies": { + "react": ">= 16.3.0" + } + }, "node_modules/react-dev-utils": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-10.2.1.tgz", @@ -16599,6 +16647,23 @@ "imurmurhash": "^0.1.4" } }, + "node_modules/universal-cookie": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", + "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", + "dependencies": { + "@types/cookie": "^0.3.3", + "cookie": "^0.4.0" + } + }, + "node_modules/universal-cookie/node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -19769,6 +19834,11 @@ "@babel/types": "^7.3.0" } }, + "@types/cookie": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", + "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" + }, "@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -19783,6 +19853,15 @@ "@types/node": "*" } }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -19825,11 +19904,31 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "@types/prop-types": { + "version": "15.7.5", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", + "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" + }, "@types/q": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.5.tgz", "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==" }, + "@types/react": { + "version": "18.0.15", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.15.tgz", + "integrity": "sha512-iz3BtLuIYH1uWdsv6wXYdhozhqj20oD4/Hk2DNXIn1kFsmp9x8d9QB6FnPhfkbhd2PgEONt9Q1x/ebkwjfFLow==", + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "@types/scheduler": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", + "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" + }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -28396,6 +28495,16 @@ "whatwg-fetch": "^3.0.0" } }, + "react-cookie": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.1.1.tgz", + "integrity": "sha512-ffn7Y7G4bXiFbnE+dKhHhbP+b8I34mH9jqnm8Llhj89zF4nPxPutxHT1suUqMeCEhLDBI7InYwf1tpaSoK5w8A==", + "requires": { + "@types/hoist-non-react-statics": "^3.0.1", + "hoist-non-react-statics": "^3.0.0", + "universal-cookie": "^4.0.0" + } + }, "react-dev-utils": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-10.2.1.tgz", @@ -30926,6 +31035,22 @@ "imurmurhash": "^0.1.4" } }, + "universal-cookie": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", + "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", + "requires": { + "@types/cookie": "^0.3.3", + "cookie": "^0.4.0" + }, + "dependencies": { + "cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + } + } + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/web-ui/web-react/package.json b/web-ui/web-react/package.json index 876ccccc..12dd1f1d 100644 --- a/web-ui/web-react/package.json +++ b/web-ui/web-react/package.json @@ -27,6 +27,7 @@ "prismjs": "1.9.0", "react": "^17.0.1", "react-app-polyfill": "^1.0.6", + "react-cookie": "^4.1.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.1", From 6cf9874cd5f389828cfc587ae9d1a1ce18e326ca Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 31 Jul 2022 23:58:12 -0600 Subject: [PATCH 18/33] set import and const cookies --- web-ui/web-react/src/components/AreasComunes.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 211867a0..421c7cc1 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -15,6 +15,7 @@ import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; import { faHomeAlt } from '@fortawesome/free-solid-svg-icons'; import classNames from 'classnames'; +import { useCookies } from "react-cookie"; const AreasComunes = () => { @@ -44,6 +45,12 @@ const AreasComunes = () => { const toast = useRef(null); const dt = useRef(null); + const [cookies, setCookie] = useCookies(); + + async function getCommonAreas() { + + } + }; From c5dfdb480d0a980e559f75e0a0b505b14b0f4a26 Mon Sep 17 00:00:00 2001 From: Mariela Date: Mon, 1 Aug 2022 00:31:52 -0600 Subject: [PATCH 19/33] listar areas comunes en parte web --- .../web-react/src/components/AreasComunes.js | 250 +++++++++++++++++- 1 file changed, 248 insertions(+), 2 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 421c7cc1..51a3746c 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -36,9 +36,10 @@ const AreasComunes = () => { status: '1' }; - const [commonAreasList, setCommonAreasList] = useState([]); + const [commonAreaList, setCommonAreaList] = useState([]); const [commonArea, setCommonArea] = useState(emptyCommonArea); const [selectedCommonAreas, setSelectedCommonAreas] = useState(null); + const [globalFilter, setGlobalFilter] = useState(null); const [deleteCommonAreaDialog, setDeleteCommonAreaDialog] = useState(false); const [deleteCommonAreasDialog, setDeleteCommonAreasDialog] = useState(false); const [submitted, setSubmitted] = useState(false); @@ -48,9 +49,254 @@ const AreasComunes = () => { const [cookies, setCookie] = useCookies(); async function getCommonAreas() { - + await fetch(`http://localhost:4000/commonArea/findByCommunity/${cookies.community_id}`, { method: 'GET' }) + .then((response) => response.json()) + .then(data => data.message) + .then(data => { + setCommonAreaList(data) + }); } + useEffect(() => { + getCommonAreas(); + }, []); + + + const deleteCommonArea = () => { + /* fetch('http://localhost:4000/community/deleteCommunity/' + community._id, { + cache: 'no-cache', + method: 'DELETE', + headers: { + 'Content-Type': 'application/json' + } + }) + .then( + function (response) { + if (response.status != 201) + console.log('Ocurrió un error con el servicio: ' + response.status); + else + return response.json(); + } + ) + .then( + function (response) { + + let _community = communities.filter(val => val._id !== community._id); + setCommunities(_community); + setDeleteCommunityDialog(false); + setCommunity(emptyCommunity); + toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Comunidad de Viviendas Eliminada', life: 3000 }); + } + ) + .catch( + err => { + console.log('Ocurrió un error con el fetch', err) + toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Comunidad de Viviendas no se pudo eliminar', life: 3000 }); + } + ); + */ + let _common_areas = commonAreaList.filter( + (val) => val._id !== commonArea._id, + ); + setCommonAreaList(_common_areas); + setDeleteCommonAreaDialog(false); + setCommonArea(emptyCommonArea); + toast.current.show({ + severity: 'success', + summary: 'Área Común Eliminada', + life: 3000, + }); + }; + + const deleteSelectedCommonAreas = () => { + let _commonareas = commonAreaList.filter( + (val) => !selectedCommonAreas.includes(val), + ); + /* selectedCommunities.map((item) => { + fetch('http://localhost:4000/user/deleteCommunity/' + item._id, { + cache: 'no-cache', + method: 'DELETE', + headers: { + 'Content-Type': 'application/json' + } + }) + })*/ + setCommonAreaList(_commonareas); + setDeleteCommonAreasDialog(false); + setSelectedCommonAreas(null); + toast.current.show({ + severity: 'success', + summary: 'Éxito', + detail: 'Áreas Comúnes Eliminadas', + life: 3000, + }); + }; + + const hideDeleteCommonAreaDialog = () => { + setDeleteCommonAreaDialog(false); + } + + const hideDeleteCommonAreasDialog = () => { + setDeleteCommonAreasDialog(false); + } + + const confirmDeleteCommonArea = (commonArea) => { + setCommonArea(commonArea); + setDeleteCommonAreaDialog(true); + } + + const confirmDeleteSelected = () => { + setDeleteCommonAreasDialog(true); + }; + + + + const actionsCommonArea = (rowData) => { + return ( +
+
+ ); + }; + + + const deleteCommonAreaDialogFooter = ( + <> +
+ + ) + } + + const rightToolbarTemplate = () => { + return ( + +