diff --git a/servicio-notificaciones/src/email.controller.ts b/servicio-notificaciones/src/email.controller.ts
index b8b5b521..66ffbdb5 100644
--- a/servicio-notificaciones/src/email.controller.ts
+++ b/servicio-notificaciones/src/email.controller.ts
@@ -19,15 +19,6 @@ export class EmailController {
return response;
}
- var response = this.mailService.sendMail({
- to: toEmail["email"],
- from: "mbonilla.guti@gmail.com",
- subject: 'Plain Text Email ✔',
- text: 'Welcome NestJS Email Sending Tutorial',
- });
- return response;
- }
-
@MessagePattern({ cmd: 'html' })
async postHTMLEmail(@Payload() user: any) {
const url = "http://localhost:3000/";
diff --git a/web-ui/web-react/src/components/AdministradoresComunidad.js b/web-ui/web-react/src/components/AdministradoresComunidad.js
index d4f81eae..37c4dae6 100644
--- a/web-ui/web-react/src/components/AdministradoresComunidad.js
+++ b/web-ui/web-react/src/components/AdministradoresComunidad.js
@@ -57,7 +57,7 @@ const AdministradoresComunidad = () => {
return fetch(`http://localhost:4000/community/findCommunityName/${item.community_id}`, { method: 'GET' })
.then((response2) => response2.json())
.then(data => data.message)
- .then( data => {
+ .then(data => {
item.community_name = data['name']
return item
})
@@ -66,17 +66,9 @@ const AdministradoresComunidad = () => {
.then(data => setListaAdmins(data));
}
- useEffect(() => {
- listaAdmin();
- useEffect(() => {
- listaAdmin();
-
- }, [])
- const deleteAdminCommunity = () => {
- /* fetch('http://localhost:4000/community/deleteCommunity/' + community._id, {
- }, [])
+
async function getCommunites() {
@@ -89,9 +81,13 @@ const AdministradoresComunidad = () => {
}
useEffect(() => {
- getCommunites();
+ listaAdmin();
}, [])
+ useEffect(() => {
+ getCommunites();
+ },[])
+
const cList = communitiesList.map((item) => ({
label: item.name,
value: item._id,
@@ -131,51 +127,47 @@ const AdministradoresComunidad = () => {
}
);
*/
- let _administrators = listaAdmins.filter(
- (val) => val._id !== adminCommunity._id,
- );
- setListaAdmins(_administrators);
- setDeleteAdminCommunityDialog(false);
- setAdminCommunity(emptyAdminCommunity);
- toast.current.show({
- severity: 'success',
- summary: 'Administrador de Comunidad Eliminada',
- life: 3000,
- });
- };
+ let _administrators = listaAdmins.filter(
+ (val) => val._id !== adminCommunity._id,
+ );
+ setListaAdmins(_administrators);
+ setDeleteAdminCommunityDialog(false);
+ setAdminCommunity(emptyAdminCommunity);
+ toast.current.show({
+ severity: 'success',
+ summary: 'Administrador de Comunidad Eliminada',
+ life: 3000,
+ });
+ };
- const deleteSelectedAdminsCommunity = () => {
- let _admins = listaAdmins.filter(
- (val) => !selectedAdminsCommunities.includes(val),
- );
- /* selectedCommunities.map((item) => {
- fetch('http://localhost:4000/user/deleteCommunity/' + item._id, {
- cache: 'no-cache',
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json'
- }
- })
- })*/
- setListaAdmins(_admins);
- setDeleteAdminsCommunitiesDialog(false);
- setSelectedAdminsCommunities(null);
- toast.current.show({
- severity: 'success',
- summary: 'Éxito',
- detail: 'Administradores de Comunidad de Viviendas Eliminado',
- life: 3000,
- });
- };
-
- const hideDeleteAdminCommunityDialog = () => {
- setDeleteAdminCommunityDialog(false);
- };
+ const deleteSelectedAdminsCommunity = () => {
+ let _admins = listaAdmins.filter(
+ (val) => !selectedAdminsCommunities.includes(val),
+ );
+ /* selectedCommunities.map((item) => {
+ fetch('http://localhost:4000/user/deleteCommunity/' + item._id, {
+ cache: 'no-cache',
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ })
+ })*/
+ setListaAdmins(_admins);
+ setDeleteAdminsCommunitiesDialog(false);
+ setSelectedAdminsCommunities(null);
+ toast.current.show({
+ severity: 'success',
+ summary: 'Éxito',
+ detail: 'Administradores de Comunidad de Viviendas Eliminados',
+ life: 3000,
+ });
+ };
const saveAdminCommunity = () => {
if (adminCommunity.name && adminCommunity.dni && adminCommunity.last_name && adminCommunity.email && adminCommunity.phone) {
- let _administrators= [...listaAdmins];
+ let _administrators = [...listaAdmins];
let _adminCommunity = { ...adminCommunity };
_adminCommunity.community_id = communityId;
console.log(_adminCommunity)
@@ -199,7 +191,7 @@ const AdministradoresComunidad = () => {
)
.then(() => {
- // _adminCommunity.community_id = communitiesList.find(c => c._id === _adminCommunity.community_id).name
+ // _adminCommunity.community_id = communitiesList.find(c => c._id === _adminCommunity.community_id).name
_administrators.push(_adminCommunity);
toast.current.show({ severity: 'success', summary: 'Registro exitoso', detail: 'Administrador de Comunidad de vivienda Creada', life: 3000 });
@@ -224,34 +216,33 @@ const AdministradoresComunidad = () => {
setDeleteAdminCommunityDialog(false);
}
- const confirmDeleteSelected = () => {
- setDeleteAdminsCommunitiesDialog(true);
- };
+ const hideDeleteAdminsCommunitysDialog = () => {
+ setDeleteAdminsCommunitiesDialog(false);
+ }
- const actionsAdminCommunity = (rowData) => {
- return (
-
-
- );
- };
+ const confirmDeleteAdminCommunity = (adminCommunity) => {
+ setAdminCommunity(adminCommunity);
+ setDeleteAdminCommunityDialog(true);
+ }
const confirmDeleteSelected = () => {
setDeleteAdminsCommunitiesDialog(true);
- }
+ };
+
const actionsAdminCommunity = (rowData) => {
return (
-
);
- }
+ };
+
const deleteAdminCommunityDialogFooter = (
<>
@@ -288,89 +279,81 @@ const AdministradoresComunidad = () => {
const header = (
-
-
Administradores de Comunidades
-
-
- setGlobalFilter(e.target.value)} placeholder="Buscar..." />
-
-
-
+
+
+
+
Administradores de Comunidades
+
+
+ setGlobalFilter(e.target.value)} placeholder="Buscar..." />
+
+
+
);
- };
const headerName = (
<>
- Nombre
+ {' '}
+ {' '}
+ Nombre
+
>
)
- const deleteAdminsCommunityDialogFooter = (
- <>
-
-
- >
- );
+ const headerLastName = (
+ <>
+
+ {' '}
+ {' '}
+ Apellidos
+
+ >
+ )
- const headerName = (
- <>
-
- {' '}
- Nombre
-
- >
- );
+ const headerDNI = (
+ <>
+ {' '}
+ {' '}
+ Identificación
+
+ >
+ )
- const headerLastName = (
- <>
-
- {' '}
- {' '}
- Apellidos
-
- >
- );
+ const headerEmail = (
+ <>
+ {' '}
+ {' '}
+ Correo Electrónic
+
+ >
+ )
- const headerDNI = (
- <>
-
- {' '}
- {' '}
- Identificación
-
- >
- );
+ const headerPhone = (
+ <>
+ {' '}
+ Teléfono
+
+ >
+ )
- const headerEmail = (
- <>
-
- {' '}
- Correo
- Electrónico
-
- >
- );
+ const headerCommuntiy = (
+ <>
+
+ {' '}
+ {' '}
+ Comunidad
+ >
+ )
- const headerPhone = (
- <>
-
- {' '}
- {' '}
- Teléfono
-
- >
- );
+ const headerOptions = (
+ <>
+
+ {' '}
+ {' '}
+
+ >
+ )
const onInputChange = (e, name) => {
const val = (e.target && e.target.value) || '';
@@ -380,118 +363,15 @@ const AdministradoresComunidad = () => {
setAdminCommunity(_adminCommunity);
}
- const confirmDeleteSelected = () => {
- setDeleteAdminsSystemDialog(true);
- }
-
- const deleteSysAdmin = () => {
-
- fetch('http://localhost:4000/user/deleteAdminSystem/' + sysadmin._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 _sysadmin = listaAdmins.filter(val => val._id !== sysadmin._id);
- setListaAdmins(_sysadmin);
-
- setDeleteAdminSystemDialog(false);
- setSysAdmin(emptySysAdmin);
-
- toast.current.show({ severity: 'success', summary: 'Exito', detail: 'Administrador del Sistema Eliminado', life: 3000 });
- }
- )
- .catch(
- err => {
- console.log('Ocurrió un error con el fetch', err)
- toast.current.show({ severity: 'danger', summary: 'Error', detail: 'Administrador del Sistema no se pudo eliminar', life: 3000 });
- }
- );
- }
-
-
-
-
-
-
- const header = (
-
-
Administradores del sistema
-
-
- setGlobalFilter(e.target.value)} placeholder="Buscar..." />
-
-
- );
-
- const deleteAdminSystemDialogFooter = (
- <>
-
-
- >
- );
-
- const deleteAdminsSystemDialogFooter = (
- <>
-
-
- >
- );
-
-
-
- return (
-
-
-
-
-
-
setSelectedAdminsCommunities(e.value)}
- scrollable scrollHeight="400px" scrollDirection="both" 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} administradores de comunidades de viviendas"
- globalFilter={globalFilter} emptyMessage="No hay administradores de comunidades registrados.">
-
-
-
-
-
-
-
-
-
-
-
-
-
const handleCommunities = (event) => {
const getCommunityValue = event.target.value;
setCommunityId(getCommunityValue);
console.log(getCommunityValue)
}
+
return (
+
+
@@ -610,9 +490,7 @@ const AdministradoresComunidad = () => {
-
-
- );
+ );
};
export default React.memo(AdministradoresComunidad);
diff --git a/web-ui/web-react/src/components/AdministradoresSistema.js b/web-ui/web-react/src/components/AdministradoresSistema.js
index c70ed3c5..5d007e38 100644
--- a/web-ui/web-react/src/components/AdministradoresSistema.js
+++ b/web-ui/web-react/src/components/AdministradoresSistema.js
@@ -36,53 +36,63 @@ const AdministradoresSistema = () => {
phone: '',
password: '',
user_type: '1',
- status: '',
+ status: '1',
};
-
- function registrarAdmin() {
- var data = {
- dni: document.getElementById('identificacion').value,
- name: document.getElementById('nombre').value,
- last_name: document.getElementById('apellidos').value,
- email: document.getElementById('correo_electronico').value,
- phone: document.getElementById('telefono').value,
- password: document.getElementById('correo_electronico').value,
- user_type: "1", //1 es admin
- status: "1"
- };
- setSysAdmin(data)
- // console.log(data);
+ async function fetchP() {
+ let nombres = await fetch(urlFetch, { method: 'GET' });
+ let adminRes = await nombres.json();
+ setAdministrators(adminRes.message);
+ console.log(administrators);
+ }
+ useEffect(() => {
+ fetchP();
+ }, [])
- fetch('http://localhost:4000/user/createAdminSystem/', {
- cache: 'no-cache',
- method: 'POST',
- body: JSON.stringify(data),
- 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 _administrators = [...administrators];
- let _admin = { ...sysadmin };
- _administrators.push(_admin);
- setAdministrators(_administrators)
- }
- )
- .catch(
- err => console.log('Ocurrió un error con el fetch', err)
- );
- }
+
+ function registrarAdmin() {
+ var data = {
+ dni: document.getElementById('identificacion').value,
+ name: document.getElementById('nombre').value,
+ last_name: document.getElementById('apellidos').value,
+ email: document.getElementById('correo_electronico').value,
+ phone: document.getElementById('telefono').value,
+ password: document.getElementById('correo_electronico').value,
+ user_type: "1", //1 es admin
+ status: "1"
+ };
+ setSysAdmin(data)
+ // console.log(data);
+
+ fetch('http://localhost:4000/user/createAdminSystem/', {
+ cache: 'no-cache',
+ method: 'POST',
+ body: JSON.stringify(data),
+ 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 _administrators = [...administrators];
+ let _admin = { ...sysadmin };
+ _administrators.push(_admin);
+ setAdministrators(_administrators)
+ }
+ )
+ .catch(
+ err => console.log('Ocurrió un error con el fetch', err)
+ );
+ }
const confirmDeleteAdminSystem = (sysAdmin) => {
setSysAdmin(sysAdmin);
@@ -93,6 +103,15 @@ const AdministradoresSistema = () => {
setDeleteAdminsSystemDialog(true);
};
+ const hideDeleteAdminSystemDialog = () => {
+ setDeleteAdminSystemDialog(false);
+ };
+
+ const hideDeleteAdminsSystemDialog = () => {
+ setDeleteAdminsSystemDialog(false);
+ };
+
+
const deleteSysAdmin = () => {
fetch('http://localhost:4000/user/deleteAdminSystem/' + sysadmin._id, {
cache: 'no-cache',
@@ -198,7 +217,7 @@ const AdministradoresSistema = () => {
const header = (
- Administradores del sistema
+ Administradores del sistema
@@ -234,7 +253,7 @@ const AdministradoresSistema = () => {
label="No"
icon="pi pi-times"
className="p-button-text"
- onClick={hideDeleteAdminsSystemsDialog}
+ onClick={hideDeleteAdminsSystemDialog}
/>
{
header="Confirmar"
modal
footer={deleteAdminsSystemDialogFooter}
- onHide={hideDeleteAdminsSystemsDialog}
+ onHide={hideDeleteAdminsSystemDialog}
>
{
district: districtId,
phone: '',
num_houses: 0,
- status: 'activo',
+ status: '1',
date_entry: new Date(),
houses: [],
};
@@ -64,17 +64,6 @@ const Communities = () => {
parent: item.parentCode,
}));
- useEffect(() => {
- fillProvinces();
- }, []);
-
- useEffect(() => {
- fillCantons();
- }, [provinciaId]);
-
- useEffect(() => {
- fillDistricts();
- }, [cantonId]);
async function getProvinces() {
const response = await fetch('assets/demo/data/provincias.json', {
@@ -118,6 +107,20 @@ const Communities = () => {
setDistrictsList(await districts);
}
+
+ useEffect(() => {
+ fillProvinces();
+ }, []);
+
+ useEffect(() => {
+ fillCantons();
+ }, [provinciaId]);
+
+ useEffect(() => {
+ fillDistricts();
+ }, [cantonId]);
+
+
const handleProvinces = (event) => {
const getprovinciaId = event.target.value;
setProvinciaId(getprovinciaId);