From 52cdf9f8996477dd5718d0a227fb552548e6db9d Mon Sep 17 00:00:00 2001 From: Mariela Date: Thu, 1 Sep 2022 01:55:41 -0600 Subject: [PATCH 1/6] informacion en inquilinos --- .../web-react/src/components/AreasComunes.js | 5 - web-ui/web-react/src/components/Inquilinos.js | 356 ++++++++++-------- 2 files changed, 207 insertions(+), 154 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index b8c2b0f9..ce40ffdc 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -608,7 +608,6 @@ const AreasComunes = () => { ); }; - function compareTimesMinRequired(hour1, hour2) { var timeFormat1 = Number(hour1.replace(/[:]/g, '')); var timeFormat2 = Number(hour2.replace(/[:]/g, '')); @@ -619,10 +618,6 @@ const AreasComunes = () => { } } - - - - return (
diff --git a/web-ui/web-react/src/components/Inquilinos.js b/web-ui/web-react/src/components/Inquilinos.js index 2fc7413d..5bc8801e 100644 --- a/web-ui/web-react/src/components/Inquilinos.js +++ b/web-ui/web-react/src/components/Inquilinos.js @@ -51,6 +51,8 @@ const Inquilinos = () => { const dt = useRef(null) const [cookies] = useCookies() const [changeStatusTenantDialog, setChangeStatusTenantDialog] = useState(false) + const [tenantDialog, setTenantDialog] = useState(false) + async function tenantsList() { await fetch( @@ -74,7 +76,7 @@ const Inquilinos = () => { }) data = data.filter( (val) => val.status != -1, - ); + ); setTenants(data) }) } @@ -175,14 +177,14 @@ const Inquilinos = () => { }).then(() => { fetch('http://localhost:4000/community/saveTenant', - { - cache: 'no-cache', - method: 'POST', - body: JSON.stringify(_tenant), - headers: { - 'Content-Type': 'application/json', - } - }); + { + cache: 'no-cache', + method: 'POST', + body: JSON.stringify(_tenant), + headers: { + 'Content-Type': 'application/json', + } + }); toast.current.show({ severity: 'success', @@ -352,17 +354,34 @@ const Inquilinos = () => { const editTenant = (tenant) => { setTenant(tenant); - console.log(tenant); setSaveButtonTitle('Actualizar'); setHouseNumber(tenant.number_house); + setTenantDialog(true) + } const cancelEdit = () => { setTenant(emptyTenant); setSaveButtonTitle('Registrar'); setHouseNumber(''); + setTenantDialog(false) + } + const openNewTenant = () => { + setTenant(emptyTenant); + setTenantDialog(true) + setSubmitted(false); + }; + + const hideTenantDialog = () => { + setSubmitted(false); + setTenantDialog(false) + setTenant(emptyTenant); + setSaveButtonTitle('Registrar'); + + }; + const actionsTenant = (rowData) => { let icono = '' let text = '' @@ -407,6 +426,12 @@ const Inquilinos = () => { return (
+
-
-
-
-
Registro de un Inquilino
-
-
- -
-
- - - - onInputChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && tenant.name === '' })} /> -
- {submitted && tenant.name === '' && Nombre es requerido.} -
-
-
- -
-
- - - - onInputChange(e, 'last_name')} required autoFocus className={classNames({ 'p-invalid': submitted && tenant.last_name === '' })} /> -
- {submitted && tenant.last_name === '' && Apellidos son requeridos.} -
-
-
- -
-
- - - - onInputChange(e, 'email')} required autoFocus className={classNames({ 'p-invalid': submitted && tenant.email === '' })} /> -
- {submitted && tenant.email === '' && Correo electrónico es requerido.} -
-
-
- -
-
- - - - onInputChange(e, 'dni')} required autoFocus className={classNames({ 'p-invalid': submitted && tenant.dni === '' })} /> -
- {submitted && tenant.dni === '' && Identificación es requerida.} -
-
-
- -
-
- - - - onInputChange(e, 'phone')} type='tel' required autoFocus className={classNames({ 'p-invalid': submitted && tenant.phone === '' })} /> -
- {submitted - && tenant.phone === '' - && Número de teléfono es requerido.} -
-
-
- -
-
- - - - -
- {submitted - && !houseNumber - && Casa es requerida.} -
-
-
-
-
-
-
- + + + ) } From 33d1a328a516e29c0c7906806456e95de4f561cf Mon Sep 17 00:00:00 2001 From: Mariela Date: Thu, 1 Sep 2022 02:09:26 -0600 Subject: [PATCH 2/6] informacion guardas de seguridad --- .../src/components/GuardasSeguridad.js | 126 ++++++++++-------- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/web-ui/web-react/src/components/GuardasSeguridad.js b/web-ui/web-react/src/components/GuardasSeguridad.js index 1654a330..801cb19b 100644 --- a/web-ui/web-react/src/components/GuardasSeguridad.js +++ b/web-ui/web-react/src/components/GuardasSeguridad.js @@ -46,6 +46,7 @@ const GuardasSeguridad = () => { const [changeStatusGuardDialog, setChangeStatusGuardDialog] = useState(false); const [guardDialog, setGuardDialog] = useState(false); const [submitted, setSubmitted] = useState(false); + const [formGuardDialog, setFormGuardDialog] = useState(false); async function listaGuardasF() { @@ -179,7 +180,7 @@ const GuardasSeguridad = () => { console.log(`Ocurrió un error con el servicio: ${response.status}`); else return response.json(); - }).then(function() { + }).then(function () { let _guarda = listaGuardas.filter(val => val._id !== guarda._id); setListaGuardas(_guarda); setDeleteGuardaDialog(false); @@ -251,13 +252,29 @@ const GuardasSeguridad = () => { const editGuard = (guard) => { setGuarda(guard); - console.log(guard); + setFormGuardDialog(true) setSaveButtonTitle("Actualizar"); } const cancelEdit = () => { setGuarda(emptyGuarda); setSaveButtonTitle("Registrar"); + setFormGuardDialog(false) + + } + + + const openNewGuard = () => { + setGuarda(emptyGuarda); + setFormGuardDialog(true) + setSubmitted(false); + }; + + const hideFormGuardDialog = () => { + setSubmitted(false); + setFormGuardDialog(false) + setGuarda(emptyGuarda); + setSaveButtonTitle('Registrar'); } const actionsGuard = (rowData) => { @@ -300,6 +317,12 @@ const GuardasSeguridad = () => { return (
+
- -
-
-
Registro de un Guarda de Seguridad
-
+ +
@@ -641,25 +676,12 @@ const GuardasSeguridad = () => { && Número de teléfono es requerido.}
-
-
+
+
+
); }; From bc8486e1ba6683bf8b6e3d861fb542d8f9552c50 Mon Sep 17 00:00:00 2001 From: Mariela Date: Thu, 1 Sep 2022 02:18:17 -0600 Subject: [PATCH 3/6] informacion comunicados --- .../web-react/src/components/AreasComunes.js | 2 +- .../src/components/GuardasSeguridad.js | 114 +++++++++--------- .../src/components/RegistroComunicado.js | 77 ++++++++---- 3 files changed, 113 insertions(+), 80 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index ce40ffdc..c74e2e3a 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -636,7 +636,7 @@ const AreasComunes = () => { - + { return (
-
- +

Teléfono

@@ -559,7 +559,7 @@ const GuardasSeguridad = () => {
- +

Correo Electrónico

@@ -614,74 +614,74 @@ const GuardasSeguridad = () => { onHide={hideFormGuardDialog} >
-
- -
-
- - - - onInputChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.name === '' })} /> +
+ +
+
+ + + + onInputChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.name === '' })} /> +
+ {submitted && guarda.name === '' && Nombre es requerido.}
- {submitted && guarda.name === '' && Nombre es requerido.}
-
-
- -
-
- - - - onInputChange(e, 'last_name')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.last_name === '' })} /> +
+ +
+
+ + + + onInputChange(e, 'last_name')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.last_name === '' })} /> +
+ {submitted && guarda.last_name === '' && Apellidos son requeridos.}
- {submitted && guarda.last_name === '' && Apellidos son requeridos.}
-
-
- -
-
- - - - onInputChange(e, 'email')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.email === '' })} /> +
+ +
+
+ + + + onInputChange(e, 'email')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.email === '' })} /> +
+ {submitted && guarda.email === '' && Correo electrónico es requerido.}
- {submitted && guarda.email === '' && Correo electrónico es requerido.}
-
-
- -
-
- - - - onInputChange(e, 'dni')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.dni === '' })} /> +
+ +
+
+ + + + onInputChange(e, 'dni')} required autoFocus className={classNames({ 'p-invalid': submitted && guarda.dni === '' })} /> +
+ {submitted && guarda.email === '' && Identificación es requerida.}
- {submitted && guarda.email === '' && Identificación es requerida.}
-
-
- -
-
- - - - onInputChange(e, 'phone')} type='tel' required autoFocus className={classNames({ 'p-invalid': submitted && guarda.phone === '' })} /> +
+ +
+
+ + + + onInputChange(e, 'phone')} type='tel' required autoFocus className={classNames({ 'p-invalid': submitted && guarda.phone === '' })} /> +
+ {submitted + && guarda.phone === '' + && Número de teléfono es requerido.}
- {submitted - && guarda.phone === '' - && Número de teléfono es requerido.}
+
- -
- + ); }; diff --git a/web-ui/web-react/src/components/RegistroComunicado.js b/web-ui/web-react/src/components/RegistroComunicado.js index 945bbc2c..f592e0c1 100644 --- a/web-ui/web-react/src/components/RegistroComunicado.js +++ b/web-ui/web-react/src/components/RegistroComunicado.js @@ -37,6 +37,9 @@ const RegistroComunicado = () => { const dt = useRef(null); const [cookies, setCookie] = useCookies(); const [globalFilter, setGlobalFilter] = useState(null); + const [postDialog, setPostDialog] = useState(false); + + async function listaComunis() { let comunicadosResponse = await fetch('http://localhost:4000/post/allPosts', { method: 'GET' }); @@ -127,6 +130,12 @@ const RegistroComunicado = () => { return (
+
@@ -145,6 +154,8 @@ const RegistroComunicado = () => { setComunicado(rowData); setComunicadoId(rowData._id); setSaveButtonLabel('Actualizar'); + setPostDialog(true) + } const cancelEdit = () => { @@ -177,6 +188,20 @@ const RegistroComunicado = () => { setShowDeleteDialog(true); } + const openNewPost = () => { + setComunicado(emptyComunicado); + setPostDialog(true) + setSubmitted(false); + }; + + const hidePostDialog = () => { + setSubmitted(false); + setPostDialog(false) + setComunicado(emptyComunicado); + setSaveButtonLabel('Registrar'); + } + + const deleteDialogFooter = ( <> - - + diff --git a/web-ui/web-react/src/components/GuardasSeguridad.js b/web-ui/web-react/src/components/GuardasSeguridad.js index 23de0109..4ddd8464 100644 --- a/web-ui/web-react/src/components/GuardasSeguridad.js +++ b/web-ui/web-react/src/components/GuardasSeguridad.js @@ -99,6 +99,8 @@ const GuardasSeguridad = () => { return response.json(); }).then(() => { listaGuardasF(); + setFormGuardDialog(false) + setGuarda(emptyGuarda) }).catch( err => console.log('Ocurrió un error con el fetch', err) ); @@ -123,6 +125,8 @@ const GuardasSeguridad = () => { detail: 'Guarda actualizado correctamente' }); setGuarda(emptyGuarda); + setFormGuardDialog(false) + listaGuardasF(); }) } diff --git a/web-ui/web-react/src/components/Inquilinos.js b/web-ui/web-react/src/components/Inquilinos.js index 5bc8801e..594547b3 100644 --- a/web-ui/web-react/src/components/Inquilinos.js +++ b/web-ui/web-react/src/components/Inquilinos.js @@ -157,6 +157,8 @@ const Inquilinos = () => { setTenants(_tenants) setTenant(emptyTenant) setHouseNumber('') + setTenantDialog(false) + }) .catch((error) => console.log(`Ocurrió un error: ${error}`)) } else setSubmitted(true) @@ -195,6 +197,8 @@ const Inquilinos = () => { tenantsList() setTenant(emptyTenant) setHouseNumber('') + setTenantDialog(false) + }) } } diff --git a/web-ui/web-react/src/components/InvitadosComunidad.js b/web-ui/web-react/src/components/InvitadosComunidad.js index 4e59b24f..0ebb6c92 100644 --- a/web-ui/web-react/src/components/InvitadosComunidad.js +++ b/web-ui/web-react/src/components/InvitadosComunidad.js @@ -171,41 +171,35 @@ const InvitadosComunidad = () => { globalFilter={globalFilter} emptyMessageTemplate="No se encontraron invitados" > - + - +