Merge branch 'movil' of github.com:DeimosPr4/katoikia-app into movil
This commit is contained in:
		
						commit
						3b01bbea90
					
				| 
						 | 
					@ -11,49 +11,40 @@ import { UserContext } from "../context/UserContext";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function AgregarInvitados({ navigation }) {
 | 
					export default function AgregarInvitados({ navigation }) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const baseURL = `${API.BASE_URL}/user/updateUser/`
 | 
					  const baseURL = `${API.BASE_URL}/guest/createGuest/`;
 | 
				
			||||||
  //const userData = JSON.parse(JSON.stringify(route.params));
 | 
					 | 
				
			||||||
  const [name, setName] = useState(); 
 | 
					  const [name, setName] = useState(); 
 | 
				
			||||||
  const [apellido, setApellido] =useState(); 
 | 
					  const [apellido, setApellido] =useState(); 
 | 
				
			||||||
  const [email, setEmail] = useState(); 
 | 
					  const [dni, setDNI] = useState(); 
 | 
				
			||||||
  const [password, setPassword] = useState();
 | 
					  const [phone, setPhone] = useState();
 | 
				
			||||||
 | 
					  const [number_plate, setNumber_plate] = useState();
 | 
				
			||||||
 | 
					  const [tenant_id, setTenant_id] = useState();
 | 
				
			||||||
 | 
					  const [community_id, setCommunity_id] = useState();
 | 
				
			||||||
 | 
					  const { user } = useContext(UserContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const userData = useContext(UserContext)
 | 
					  const saveInvitado = async() => {
 | 
				
			||||||
  const id = userData.user._id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const updateInfo = async() => {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const data = {
 | 
					    const data = {
 | 
				
			||||||
      "_id": "6301df20dac7dcf76dcecade",
 | 
					 | 
				
			||||||
      "dni": "1234567890",
 | 
					 | 
				
			||||||
      "name": name,
 | 
					      "name": name,
 | 
				
			||||||
      "last_name": apellido,
 | 
					      "last_name": apellido,
 | 
				
			||||||
      "email": email,
 | 
					      "dni": dni,
 | 
				
			||||||
      "phone": 12121212,
 | 
					      "phone": phone,
 | 
				
			||||||
      "password": "827ccb0eea8a706c4c34a16891f84e7b",
 | 
					      "number_plate": number_plate,
 | 
				
			||||||
      "user_type": "3",
 | 
					      "tenant_id": user.id,
 | 
				
			||||||
      "status": "1",
 | 
					      "community_id": user.community_id
 | 
				
			||||||
      "date_entry": "2022-08-21T07:30:09.929Z",
 | 
					 | 
				
			||||||
      "community_id": null,
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      await fetch(baseURL+`${id}`, {
 | 
					      await fetch(baseURL, {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cache: 'no-cache', 
 | 
					        cache: 'no-cache', 
 | 
				
			||||||
        method: 'PUT', 
 | 
					        method: 'POST', 
 | 
				
			||||||
        body: JSON.stringify(data), 
 | 
					        body: JSON.stringify(data), 
 | 
				
			||||||
        headers: {
 | 
					        headers: {
 | 
				
			||||||
          'Content-Type': 'application/json'
 | 
					          'Content-Type': 'application/json'
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .then(response => {
 | 
					      .then(response => {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        console.log(baseURL+`${id}`);
 | 
					 | 
				
			||||||
        if (response.status != 201){
 | 
					        if (response.status != 201){
 | 
				
			||||||
          console.log('ocurrio un error ');
 | 
					          console.log('ocurrio un error ');
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
| 
						 | 
					@ -85,37 +76,25 @@ export default function AgregarInvitados({ navigation }) {
 | 
				
			||||||
         Registre el invitado que desee
 | 
					         Registre el invitado que desee
 | 
				
			||||||
        </Heading>
 | 
					        </Heading>
 | 
				
			||||||
        <VStack space={3} mt="5">
 | 
					        <VStack space={3} mt="5">
 | 
				
			||||||
        <FormControl>
 | 
					 | 
				
			||||||
            <FormControl.Label>DNI</FormControl.Label>
 | 
					 | 
				
			||||||
            <TextInput style={styles.input} type="text" onChangeText={(value) => setName(value) }/>
 | 
					 | 
				
			||||||
          </FormControl>
 | 
					 | 
				
			||||||
          <FormControl>
 | 
					 | 
				
			||||||
            <FormControl.Label>Teléfono</FormControl.Label>
 | 
					 | 
				
			||||||
            <TextInput style={styles.input} type="text" onChangeText={(value) => setName(value) }/>
 | 
					 | 
				
			||||||
          </FormControl>
 | 
					 | 
				
			||||||
          <FormControl>
 | 
					          <FormControl>
 | 
				
			||||||
            <FormControl.Label>Nombre</FormControl.Label>
 | 
					            <FormControl.Label>Nombre</FormControl.Label>
 | 
				
			||||||
            <TextInput style={styles.input} type="text" onChangeText={(value) => setName(value) }/>
 | 
					            <TextInput style={styles.input} type="text" onChangeText={(value) => setName(value)}/>
 | 
				
			||||||
          </FormControl>
 | 
					          </FormControl>
 | 
				
			||||||
          <FormControl>
 | 
					          <FormControl>
 | 
				
			||||||
            <FormControl.Label>Apellido</FormControl.Label>
 | 
					            <FormControl.Label>Apellido</FormControl.Label>
 | 
				
			||||||
            <TextInput style={styles.input} type="text" onChangeText={(value) => setApellido(value) } />
 | 
					            <TextInput style={styles.input} type="text" onChangeText={(value) => setApellido(value)}/>
 | 
				
			||||||
          </FormControl>
 | 
					          </FormControl>
 | 
				
			||||||
          <FormControl>
 | 
					          <FormControl>
 | 
				
			||||||
            <FormControl.Label>Correo electrónico</FormControl.Label>
 | 
					            <FormControl.Label>Identificación</FormControl.Label>
 | 
				
			||||||
            <TextInput style={styles.input} type="text"  onChangeText={(value) => setEmail(value) }/>
 | 
					            <TextInput style={styles.input} type="text" onChangeText={(value) => setDNI(value)}/>
 | 
				
			||||||
          </FormControl>
 | 
					          </FormControl>
 | 
				
			||||||
          <FormControl>
 | 
					          <FormControl>
 | 
				
			||||||
            <FormControl.Label>Contraseña actual</FormControl.Label>
 | 
					            <FormControl.Label>Teléfono</FormControl.Label>
 | 
				
			||||||
            <TextInput style={styles.input} type="password"  onChangeText={(value) => setPassword(value) }/>
 | 
					            <TextInput style={styles.input} type="text" onChangeText={(value) => setPhone(value)} />
 | 
				
			||||||
          </FormControl>
 | 
					          </FormControl>
 | 
				
			||||||
          
 | 
					          <Button mt="2" onPress={() => saveInvitado()}>
 | 
				
			||||||
          <Button mt="2" backgroundColor="orange.300" onPress={() => updateInfo()}>
 | 
					 | 
				
			||||||
           Guardar
 | 
					           Guardar
 | 
				
			||||||
          </Button>
 | 
					          </Button>
 | 
				
			||||||
          {/* <Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Inicio')}>
 | 
					 | 
				
			||||||
            Cerrar sesión
 | 
					 | 
				
			||||||
          </Button> */}
 | 
					 | 
				
			||||||
        </VStack>
 | 
					        </VStack>
 | 
				
			||||||
      </Box>
 | 
					      </Box>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,6 @@
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "packages": {
 | 
					  "packages": {
 | 
				
			||||||
    "": {
 | 
					    "": {
 | 
				
			||||||
      "name": "servicio-invitados",
 | 
					 | 
				
			||||||
      "version": "0.0.1",
 | 
					      "version": "0.0.1",
 | 
				
			||||||
      "license": "UNLICENSED",
 | 
					      "license": "UNLICENSED",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue