Explorar el Código

Aqui es donde el usuario entra el periodo donde va hacer la cita

Todavia le faltan mas botones, pero para que lo tengan en lo que lo trabajo. En este file es donde se envia la informacion a firestore.
gilberto.cancel hace 3 años
padre
commit
7aa1418077
Se han modificado 1 ficheros con 54 adiciones y 0 borrados
  1. 54
    0
      screens/main/StateTime.js

+ 54
- 0
screens/main/StateTime.js Ver fichero

@@ -0,0 +1,54 @@
1
+import React from "react";
2
+import firebase from "firebase";
3
+import { Component } from "react";
4
+import { TouchableWithoutFeedback, ImageBackground, Text } from "react-native";
5
+import { styles } from "../../config/styles";
6
+import CustomButton from "../../components/CustomButton";
7
+
8
+export default class Time extends Component{
9
+  constructor(props){
10
+    super(props);
11
+    this.state = {
12
+      Appointment : this.props.route.params.Appointment_Date,
13
+    }
14
+    this.time_assignment = this.time_assignment.bind(this);
15
+  }
16
+
17
+
18
+ time_assignment(desired_time, selectedTime){
19
+   
20
+  if(desired_time == 1){
21
+    selectedTime = "8:00am-9:00am"
22
+  }
23
+
24
+  console.log(this.props.route.params)
25
+  const user = firebase.auth().currentUser
26
+  const uid = user.uid
27
+  const month = this.state.Appointment.month
28
+  const day = this.state.Appointment.day
29
+  const _time_ = selectedTime
30
+  firebase.firestore()
31
+  .collection('APPOINTMENTS')
32
+  .add({ 
33
+    uid1: uid, 
34
+    Month : month,
35
+    Day: day,
36
+    Time: _time_})
37
+
38
+    this.props.navigation.navigate('Home')
39
+ } 
40
+
41
+
42
+render(){
43
+  return(
44
+  <TouchableWithoutFeedback style={styles.stdcontainer}>
45
+    <ImageBackground style={styles.regcontainer} source={require('../../assets/yellow-white.jpg')}>
46
+    <Text style={styles.stdcontainer}> Please select a time frame for the appointment</Text>
47
+    <CustomButton marginTop={25} title="8:00am-9:00am" onPress={() => this.time_assignment(1,)}/>
48
+    
49
+    </ImageBackground>
50
+  </TouchableWithoutFeedback>
51
+    );
52
+  }
53
+}
54
+