Browse Source

Cambios para que se envien los usernames

gilberto.cancel 2 years ago
parent
commit
d587249596
1 changed files with 120 additions and 2 deletions
  1. 120
    2
      screens/main/Cita.js

+ 120
- 2
screens/main/Cita.js View File

@@ -19,6 +19,7 @@ export function Cita({route, navigation}) {
19 19
    console.log("ID", route.params);
20 20
    const [appointments, setAppointments] = useState([]); 
21 21
 
22
+   const[interpreter, setState] = useState();
22 23
 
23 24
 
24 25
  useEffect(() => { 
@@ -68,13 +69,36 @@ export function Cita({route, navigation}) {
68 69
     
69 70
 
70 71
   
72
+  function check_user_type_INT(){ 
73
+
74
+    firebase.firestore()
75
+    .collection("Interprete")
76
+    .doc(firebase.auth().currentUser.uid)
77
+    .get()
78
+    .then((snapshot) => {
79
+      if(snapshot.exists){
80
+        setState(true);
81
+      }
82
+      else{
83
+        setState(false);
84
+      }
85
+    })
86
+
87
+    if(loading){
88
+      setLoading(false);
89
+    }
90
+
91
+  }
71 92
   
93
+  check_user_type_INT();
72 94
 
73 95
   const dimensions = Dimensions.get('window');
74 96
   const screenWidth = dimensions.width;
75 97
 
98
+  console.log("Inter: ", interpreter)
99
+
76 100
   const Pin = route.params.Pin;
77
-  
101
+  if(interpreter == true){
78 102
   return (
79 103
       <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
80 104
         <FlatList style={{
@@ -110,7 +134,99 @@ export function Cita({route, navigation}) {
110 134
         onPress={async () => {
111 135
           console.log("cita")
112 136
         }}
113
-        >
137
+        > 
138
+        <List.Item
139
+          title='Usuario:'
140
+          description={item.User}
141
+          titleNumberOfLines={1}
142
+          titleStyle={styles.listTitle}
143
+          descriptionStyle={styles.listDescription}
144
+          descriptionNumberOfLines={1}
145
+          />
146
+          <List.Item
147
+            title='Mes:'
148
+            description={item.Month}
149
+            titleNumberOfLines={1}
150
+            titleStyle={styles.listTitle}
151
+            descriptionStyle={styles.listDescription}
152
+            descriptionNumberOfLines={1}
153
+          />
154
+          <List.Item
155
+            title='Día'
156
+            description={item.Day}
157
+            titleNumberOfLines={1}
158
+            titleStyle={styles.listTitle}
159
+            descriptionStyle={styles.listDescription}
160
+            descriptionNumberOfLines={1}
161
+          />
162
+          <List.Item
163
+            title='Hora:'
164
+            description={item.Time}
165
+            titleNumberOfLines={1}
166
+            titleStyle={styles.listTitle}
167
+            descriptionStyle={styles.listDescription}
168
+            descriptionNumberOfLines={1}
169
+          />
170
+        </TouchableOpacity>
171
+      )}
172
+          />
173
+      <Button
174
+        title ='Ver mapa'
175
+        onPress= {() => navigation.navigate('Map', {View_Only: true, Pin: Pin})}
176
+      />
177
+      <Button
178
+        title ='Logout'
179
+        onPress= {() => firebase.auth().signOut()}
180
+      />
181
+        </ImageBackground>
182
+    );
183
+    }
184
+
185
+    else{
186
+    return (
187
+      <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
188
+        <FlatList style={{
189
+             flex: 1,
190
+             width: screenWidth,
191
+         }}
192
+          data={threads}
193
+          keyExtractor = {item => item._id}
194
+          ItemSeparatorComponent={() => <Divider />}
195
+          renderItem = {({item}) => (
196
+          <TouchableOpacity
197
+            onPress={() => navigation.navigate('Room', {thread: item})}
198
+          >
199
+            <List.Item
200
+              title={item.name}
201
+              titleNumberOfLines={1}
202
+              titleStyle={styles.listTitle}
203
+              descriptionStyle={styles.listDescription}
204
+              descriptionNumberOfLines={1}
205
+            />
206
+          </TouchableOpacity>
207
+        )}
208
+        />
209
+        <FlatList style={{
210
+           flex: 1,
211
+           width: screenWidth,
212
+       }}
213
+        data={appointments}
214
+        keyExtractor = {item => item._id}
215
+        ItemSeparatorComponent={() => <Divider />}
216
+        renderItem = {({item}) => (
217
+        <TouchableOpacity
218
+        onPress={async () => {
219
+          console.log("cita")
220
+        }}
221
+        > 
222
+        <List.Item
223
+          title='Interprete:'
224
+          description={item.Interpreter}
225
+          titleNumberOfLines={1}
226
+          titleStyle={styles.listTitle}
227
+          descriptionStyle={styles.listDescription}
228
+          descriptionNumberOfLines={1}
229
+          />
114 230
           <List.Item
115 231
             title='Mes:'
116 232
             description={item.Month}
@@ -148,6 +264,7 @@ export function Cita({route, navigation}) {
148 264
       />
149 265
         </ImageBackground>
150 266
     );
267
+    }
151 268
   }
152 269
 
153 270
 
@@ -158,3 +275,4 @@ const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch)
158 275
 
159 276
 export default connect(mapStateToProps, mapDispatchProps)(Cita);
160 277
 
278
+