get hour picker on reservation
This commit is contained in:
parent
f9e2626e53
commit
98ef5dab17
|
@ -30,6 +30,8 @@ export default function AreaComun({navigation}){
|
||||||
const onRequestReservasData = async () => {
|
const onRequestReservasData = async () => {
|
||||||
setIsRequesting(true);
|
setIsRequesting(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/allCommonAreas`, {
|
const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/allCommonAreas`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -58,6 +60,39 @@ export default function AreaComun({navigation}){
|
||||||
}, [user])
|
}, [user])
|
||||||
|
|
||||||
|
|
||||||
|
const postReserva = async() => {
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
|
||||||
|
"start_time": selectedHours + ":" +selectedMinutes,
|
||||||
|
"finish_time": endSelectedHours + ":" +endSelectedMinutes,
|
||||||
|
"date_entry": "",
|
||||||
|
"user_id" : user._id,
|
||||||
|
"common_area_id": service
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
// try {
|
||||||
|
|
||||||
|
// const jsonDataResponse = await fetch(`${API.BASE_URL}/reservation/createReservation`, {
|
||||||
|
// cache: 'no-cache',
|
||||||
|
// method: 'POST',
|
||||||
|
// body: JSON.stringify(data),
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'application/json'
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const response = await jsonResponse.json();
|
||||||
|
// console.log(response.message);
|
||||||
|
|
||||||
|
// } catch (error) {
|
||||||
|
// console.log("ERROR:" + error);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -83,14 +118,14 @@ export default function AreaComun({navigation}){
|
||||||
}} mt={1} onValueChange={itemValue => setService(itemValue)}>
|
}} mt={1} onValueChange={itemValue => setService(itemValue)}>
|
||||||
|
|
||||||
{areas.map(item => (
|
{areas.map(item => (
|
||||||
<Select.Item label={item.name} value={item.name} />
|
<Select.Item label={item.name} value={item.community_id} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl isRequired>
|
<FormControl isRequired>
|
||||||
<FormControl.Label>Hora de inicio</FormControl.Label>
|
<FormControl.Label>Hora de inicio</FormControl.Label>
|
||||||
<View height="80" >
|
<View >
|
||||||
<TimePicker
|
<TimePicker
|
||||||
selectedHours={selectedHours}
|
selectedHours={selectedHours}
|
||||||
selectedMinutes={selectedMinutes}
|
selectedMinutes={selectedMinutes}
|
||||||
|
@ -102,7 +137,7 @@ export default function AreaComun({navigation}){
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl isRequired>
|
<FormControl isRequired>
|
||||||
<FormControl.Label>Hora de finalización</FormControl.Label>
|
<FormControl.Label>Hora de finalización</FormControl.Label>
|
||||||
<View height="80" >
|
<View >
|
||||||
<TimePicker
|
<TimePicker
|
||||||
selectedHours={selectedHours}
|
selectedHours={selectedHours}
|
||||||
//initial Hourse value
|
//initial Hourse value
|
||||||
|
@ -117,7 +152,7 @@ export default function AreaComun({navigation}){
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
|
||||||
<Button mt="2" backgroundColor="tertiary.600">
|
<Button mt="2" backgroundColor="tertiary.600" onPress={()=> postReserva()}>
|
||||||
Reservar
|
Reservar
|
||||||
</Button>
|
</Button>
|
||||||
<Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Comunicados')}>
|
<Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Comunicados')}>
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default function Invitados({navigation}) {
|
||||||
})
|
})
|
||||||
|
|
||||||
const response = await jsonResponse.json();
|
const response = await jsonResponse.json();
|
||||||
console.log(response);
|
//console.log(response);
|
||||||
setInvitados(response.message);
|
setInvitados(response.message);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue