import { Button } from 'primereact/button'; import { InputText } from 'primereact/inputtext' import React, { useState, useRef } from 'react' import { Dropdown } from 'primereact/dropdown'; import { useCookies } from "react-cookie"; const Inquilinos = () => { let emptyTenant = { _id: null, dni: '', name: '', last_name: '', email: '', phone: '', password: '', community_id: '', community_name: '', number_house: 'Sin número de vivienda', user_type: '4', date_entry: new Date(), status: '1', status_text: '', }; const [tenant, setTenant] = useState(emptyTenant); const [selectedTentants, setSelectedTenants] = useState(null); const [globalFilter, setGlobalFilter] = useState(null); const [deleteTenantDialog, setDeleteTenantDialog] = useState(false); const [deleteTenantsDialog, setDeleteTenantsDialog,] = useState(false); const [communitiesList, setCommunitiesList] = useState([]); const [communityId, setCommunityId] = useState(null); const [submitted, setSubmitted] = useState(false); const toast = useRef(null); const dt = useRef(null); const [cookies, setCookie] = useCookies(); const [changeStatusTenantDialog, setChangeStatusTenantDialog] = useState(false); function finalizarRegistro() { let data = { dni: document.getElementById('identificacion').value, name: document.getElementById('nombre').value, last_name: document.getElementById('apellidos').value, phone: document.getElementById('telefono').value, email: document.getElementById('correo_electronico').value, community_id: document.getElementById('numero_vivienda').value, password: document.getElementById('password').value, user_type: '3', status: '1', }; fetch('http://localhost:3000/api/createUser', { method: 'POST', cache: 'no-cache', body: JSON.stringify(data), headers: { 'Content-Type': 'application/json', }, }).then((response) => { if (response.ok) { alert('Inquilino registrado correctamente'); } else { alert('Error al registrar inquilino'); } }); } return (
Registrar Inquilino
); }; export default React.memo(Inquilinos);