fix css and reservas

This commit is contained in:
Maria Sanchez 2022-08-22 22:20:07 -06:00
parent 3b01bbea90
commit d1976e988b
4 changed files with 98 additions and 22 deletions

View File

@ -76,23 +76,23 @@ 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 isRequired>
<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 isRequired>
<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 isRequired>
<FormControl.Label>Identificación</FormControl.Label> <FormControl.Label>Identificación</FormControl.Label>
<TextInput style={styles.input} type="text" onChangeText={(value) => setDNI(value)}/> <TextInput style={styles.input} type="text" onChangeText={(value) => setDNI(value)}/>
</FormControl> </FormControl>
<FormControl> <FormControl isRequired>
<FormControl.Label>Teléfono</FormControl.Label> <FormControl.Label>Teléfono</FormControl.Label>
<TextInput style={styles.input} type="text" onChangeText={(value) => setPhone(value)} /> <TextInput style={styles.input} type="text" onChangeText={(value) => setPhone(value)} />
</FormControl> </FormControl>
<Button mt="2" onPress={() => saveInvitado()}> <Button mt="2" backgroundColor='tertiary.600' onPress={() => saveInvitado()}>
Guardar Guardar
</Button> </Button>
</VStack> </VStack>

View File

@ -1,4 +1,4 @@
import React from "react"; import React, {useContext, useEffect, useState} from "react";
import { import {
Box, Box,
@ -7,11 +7,54 @@ import {
FormControl, FormControl,
Input, Input,
Button, Button,
Center Center,
Select, CheckIcon
} from "native-base"; } from "native-base";
import { UserContext } from "../context/UserContext";
import { API } from "../environment/api";
export default function AreaComun({navigation}){ export default function AreaComun({navigation}){
const { user } = useContext(UserContext)
const [service, setService] = useState("");
const [areas, setAreas] = useState([])
const [isRequesting, setIsRequesting] = useState(false);
useEffect(() => {
const onRequestReservasData = async () => {
setIsRequesting(true);
try {
const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/allCommonAreas`, {
method: "GET",
headers: {
'Content-Type': 'application/json'
}
})
const response = await jsonResponse.json();
console.log(response.message);
setAreas(response.message);
} catch (error) {
console.log("ERROR:" + error);
}
setIsRequesting(false)
}
onRequestReservasData()
}, [user])
return ( return (
<Center> <Center>
<Box safeArea p="2" w="90%" maxW="290" py="8"> <Box safeArea p="2" w="90%" maxW="290" py="8">
@ -26,20 +69,46 @@ export default function AreaComun({navigation}){
Reserve su área común Reserve su área común
</Heading> </Heading>
<VStack space={3} mt="5"> <VStack space={3} mt="5">
<FormControl> <FormControl isRequired>
<FormControl.Label>Área común</FormControl.Label>
<Select selectedValue={service} minWidth="200" accessibilityLabel="Choose Service" placeholder="Elija su área común" _selectedItem={{
bg: "teal.600",
endIcon: <CheckIcon size="5" />
}} mt={1} onValueChange={itemValue => setService(itemValue)}>
{areas.map(item => (
<Select.Item label={item.name} value={item.name} />
))}
</Select>
</FormControl>
<FormControl isRequired>
<FormControl.Label>Hora de inicio</FormControl.Label> <FormControl.Label>Hora de inicio</FormControl.Label>
<Input type="text"/> <Select selectedValue={service} minWidth="200" accessibilityLabel="Choose Service" placeholder="Hora de inicio" _selectedItem={{
bg: "teal.600",
endIcon: <CheckIcon size="5" />
}} mt={1} onValueChange={itemValue => setService(itemValue)}>
<Select.Item label="UX Research" value="ux" />
<Select.Item label="Web Development" value="web" />
</Select>
</FormControl> </FormControl>
<FormControl> <FormControl isRequired>
<FormControl.Label>Hora de finalización</FormControl.Label> <FormControl.Label>Hora de finalización</FormControl.Label>
<Input type="text" /> <Select selectedValue={service} minWidth="200" accessibilityLabel="Choose Service" placeholder="Hora de finalización" _selectedItem={{
</FormControl> bg: "teal.600",
<FormControl> endIcon: <CheckIcon size="5" />
<FormControl.Label>Lugar</FormControl.Label> }} mt={1} onValueChange={itemValue => setService(itemValue)}>
<Input type="text" /> <Select.Item label="UX Research" value="ux" />
<Select.Item label="Web Development" value="web" />
</Select>
</FormControl> </FormControl>
<Button mt="2" backgroundColor="orange.300">
<Button mt="2" backgroundColor="tertiary.600">
Reservar Reservar
</Button> </Button>
<Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Comunicados')}> <Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Comunicados')}>

View File

@ -52,7 +52,7 @@ export default function LogIn({ navigation }) {
}) })
.then( response => { .then( response => {
// inqulino 4 y guarda 63 // inqulino 4 y guarda 3
const user = response.message const user = response.message
if(user.user_type == '4'){ if(user.user_type == '4'){
addUser(user); addUser(user);

View File

@ -4,7 +4,8 @@ import {
ScrollView, ScrollView,
Text, Text,
Stack, Stack,
Heading Heading,
Badge
} from "native-base"; } from "native-base";
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -36,6 +37,12 @@ export const ReservasCard = ({ date, startTime, endTime, status}) => {
}}> }}>
<Stack p="4" space={3}> <Stack p="4" space={3}>
<Stack space={2}> <Stack space={2}>
<Badge backgroundColor={status === 1 ? 'tertiary.500' : 'danger.600'} _text={{
color: "white"
}} variant="solid" rounded="4">
<Text bold={true} color='danger.50'> {status === 1 ? 'LIBRE' : 'RESERVADO'}</Text>
</Badge>
<Heading size="md" ml="-1"> <Heading size="md" ml="-1">
Reserva #1 Reserva #1
</Heading> </Heading>