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 = () => {
- +
- +
- +
- +
- + +
+
+
-