From cad12bd638fdeec761707ae1b48515f5ebb70c09 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Mon, 22 Aug 2022 04:00:25 -0600 Subject: [PATCH] iniciar proceso de editar guarda --- .../src/components/GuardasSeguridad.js | 59 +++++++++++++++---- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/web-ui/web-react/src/components/GuardasSeguridad.js b/web-ui/web-react/src/components/GuardasSeguridad.js index 45b75e92..85fd4cc2 100644 --- a/web-ui/web-react/src/components/GuardasSeguridad.js +++ b/web-ui/web-react/src/components/GuardasSeguridad.js @@ -27,6 +27,7 @@ const GuardasSeguridad = () => { user_type: '1', status: '1', status_text: '', + community_id: '', }; @@ -37,6 +38,7 @@ const GuardasSeguridad = () => { const [globalFilter, setGlobalFilter] = useState(null); const [deleteGuardaDialog, setDeleteGuardaDialog] = useState(false); const [deleteGuardasDialog, setDeleteGuardasDialog] = useState(false); + const [saveButtonTitle, setSaveButtonTitle] = useState("Registrar"); const toast = useRef(null); const dt = useRef(null); @@ -90,7 +92,7 @@ const GuardasSeguridad = () => { } }) .then( - function (response) { + function(response) { if (response.status != 201) console.log('Ocurrió un error con el servicio: ' + response.status); else @@ -98,7 +100,7 @@ const GuardasSeguridad = () => { } ) .then( - function (response) { + function(response) { listaGuardasF(); } ) @@ -129,7 +131,7 @@ const GuardasSeguridad = () => { } }) .then( - function (response) { + function(response) { if (response.status != 201) console.log('Ocurrió un error con el servicio: ' + response.status); else @@ -137,7 +139,7 @@ const GuardasSeguridad = () => { } ) .then( - function (response) { + function(response) { setChangeStatusGuardDialog(false); toast.current.show({ severity: 'success', @@ -163,7 +165,7 @@ const GuardasSeguridad = () => { } }) .then( - function (response) { + function(response) { if (response.status != 201) console.log('Ocurrió un error con el servicio: ' + response.status); else @@ -171,7 +173,7 @@ const GuardasSeguridad = () => { } ) .then( - function (response) { + function(response) { let _guarda = listaGuardas.filter(val => val._id !== guarda._id); setListaGuardas(_guarda); setDeleteGuardaDialog(false); @@ -240,6 +242,16 @@ const GuardasSeguridad = () => { setGuardDialog(true); }; + const editGuard = (guard) => { + setGuarda(guard); + console.log(guard); + setSaveButtonTitle("Actualizar"); + } + + const cancelEdit = () => { + setGuarda(emptyGuarda); + setSaveButtonTitle("Registrar"); + } const actionsGuard = (rowData) => { let icono = ''; @@ -254,6 +266,12 @@ const GuardasSeguridad = () => { } return (
+
- +
@@ -554,25 +572,40 @@ const GuardasSeguridad = () => {
- +
- +
- +
- +
- + +
+
+
-