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 (
+
-