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 5074ed35..142b527a 100644 --- a/servicio-areas-comunes/src/common_areas/common_areas.service.ts +++ b/servicio-areas-comunes/src/common_areas/common_areas.service.ts @@ -32,7 +32,9 @@ export class CommonAreasService { } async remove(id: string) { - return this.commonAreaModel.findByIdAndRemove({ _id: id }).exec(); + return this.commonAreaModel.findOneAndUpdate({ _id: id }, {status: '-1'}, { + new: true, + }); } async findByCommunity(community_id: string): Promise { 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) { 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, + }); } } 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, + }); } } 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, + }); + } } 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, + }); } } 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) { 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 = () => { - - - + + +
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 = () => { > { }} > diff --git a/web-ui/web-react/src/components/ComunidadViviendas.js b/web-ui/web-react/src/components/ComunidadViviendas.js index 706f9063..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

); @@ -493,15 +493,6 @@ const Communities = () => { ); - const headerOptions = ( - <> -

- Opciones{' '} - -

- - ); - return (
@@ -537,21 +528,25 @@ const Communities = () => { > @@ -562,15 +557,16 @@ const Communities = () => { > - + { - 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);