time picker change and name of common area

This commit is contained in:
Maria Sanchez 2022-08-23 11:58:35 -06:00
parent 98ef5dab17
commit 06ceecbfbf
3 changed files with 27 additions and 27 deletions

View File

@ -12,6 +12,7 @@ import { UserContext } from "../context/UserContext";
import { API } from "../environment/api"; import { API } from "../environment/api";
import {TimePicker} from 'react-native-simple-time-picker'; import {TimePicker} from 'react-native-simple-time-picker';
import { View, StyleSheet } from "react-native"; import { View, StyleSheet } from "react-native";
import { number } from "prop-types";
export default function AreaComun({navigation}){ export default function AreaComun({navigation}){
const { user } = useContext(UserContext) const { user } = useContext(UserContext)
@ -24,6 +25,7 @@ export default function AreaComun({navigation}){
const [endSelectedHours, setEndSelectedHours] = useState(0); const [endSelectedHours, setEndSelectedHours] = useState(0);
const [endSelectedMinutes, setEndSelectedMinutes] = useState(0); const [endSelectedMinutes, setEndSelectedMinutes] = useState(0);
const date = new Date();
useEffect(() => { useEffect(() => {
@ -62,11 +64,13 @@ export default function AreaComun({navigation}){
const postReserva = async() => { const postReserva = async() => {
//console.log(date);
const data = { const data = {
"start_time": selectedHours + ":" +selectedMinutes, "start_time": Number.parseInt(selectedHours) + ":" +selectedMinutes,
"finish_time": endSelectedHours + ":" +endSelectedMinutes, "finish_time": endSelectedHours + ":" +endSelectedMinutes,
"date_entry": "", "date_entry": date,
"user_id" : user._id, "user_id" : user._id,
"common_area_id": service "common_area_id": service

View File

@ -4,7 +4,7 @@ import { UserContext } from "../context/UserContext";
import { API } from "../environment/api"; import { API } from "../environment/api";
import { import {
Box, Button, Box, Button,
Center, FormControl, Heading, ScrollView, VStack,FlatList, HStack,Avatar,Spacer,Text Center, FormControl, Heading, ScrollView, VStack,FlatList, HStack,Avatar,Spacer,Text, Icon
} from "native-base"; } from "native-base";
export default function Invitados({navigation}) { export default function Invitados({navigation}) {
@ -48,6 +48,9 @@ export default function Invitados({navigation}) {
<Heading fontSize="xl" p="4" pb="3"> <Heading fontSize="xl" p="4" pb="3">
Lista de invitados Lista de invitados
</Heading> </Heading>
<Button width='200' mb="4" mt="4" ml='85' backgroundColor='tertiary.600' onPress={() => navigation.navigate('invitado')} icon={<Icon mb="0.5" as={<MaterialCommunityIcons name={'plus'} />} color="white" size="sm" />}>
Agregar invitado
</Button>
<FlatList data={invitados} renderItem={({ <FlatList data={invitados} renderItem={({
item item
}) => <Box key={item._id} borderBottomWidth="1" _dark={{ }) => <Box key={item._id} borderBottomWidth="1" _dark={{
@ -69,7 +72,7 @@ export default function Invitados({navigation}) {
<Text color="coolGray.600" _dark={{ <Text color="coolGray.600" _dark={{
color: "warmGray.200" color: "warmGray.200"
}}> }}>
{item.phone} (506) {item.phone}
</Text> </Text>
</VStack> </VStack>
<Spacer /> <Spacer />
@ -82,9 +85,7 @@ export default function Invitados({navigation}) {
</Box>} keyExtractor={item => item.id} /> </Box>} keyExtractor={item => item.id} />
<Button width='200' mt="4" ml='85' backgroundColor='tertiary.600' onPress={() => navigation.navigate('invitado')}>
Agregar invitado
</Button>
</Box> </Box>

View File

@ -3,7 +3,9 @@ import {
Box, Box,
ScrollView, ScrollView,
Fab, Fab,
Icon Icon,
Button,
Heading
} from "native-base"; } from "native-base";
import { API } from "../environment/api"; import { API } from "../environment/api";
import { MaterialCommunityIcons } from '@expo/vector-icons'; import { MaterialCommunityIcons } from '@expo/vector-icons';
@ -17,6 +19,7 @@ export default function Reservas({navigation}) {
const [isRequesting, setIsRequesting] = useState(false); const [isRequesting, setIsRequesting] = useState(false);
const [reservas, setReservas] = useState([]); const [reservas, setReservas] = useState([]);
useEffect(() => { useEffect(() => {
const onRequestReservasData = async () => { const onRequestReservasData = async () => {
@ -35,12 +38,6 @@ export default function Reservas({navigation}) {
setReservas(response.message); setReservas(response.message);
try {
} catch (error) {
console.log("ERROR:" + error);
}
} catch (error) { } catch (error) {
console.log("ERROR:" + error); console.log("ERROR:" + error);
@ -56,7 +53,14 @@ export default function Reservas({navigation}) {
return ( return (
<Box>
<Heading fontSize="xl" p="4" pb="3">
Lista de reservas
</Heading>
<ScrollView showsVerticalScrollIndicator={false}> <ScrollView showsVerticalScrollIndicator={false}>
<Button width='200' mb="4" mt="4" ml='85' backgroundColor='tertiary.600' onPress={() => navigation.navigate('area')} icon={<Icon mb="0.5" as={<MaterialCommunityIcons name={'plus'} />} color="white" size="sm" />}>
Reservar
</Button>
{ {
reservas.map(item => ( reservas.map(item => (
@ -70,17 +74,8 @@ export default function Reservas({navigation}) {
)) ))
} }
<Box height="200" w="300" shadow="2" rounded="lg" m='5' ml='9' _dark={{
bg: "coolGray.200:alpha.20"
}} _light={{
bg: "coolGray.200:alpha.20"
}}>
<Fab renderInPortal={false} shadow={2} size="sm" icon={<Icon mb="0.5" as={<MaterialCommunityIcons name={'plus'} />} color="white" size="sm" />} onPress={() => navigation.navigate('area')}/>
</Box>
</ScrollView> </ScrollView>
</Box>
); );
} }