Browse Source

Update a Search para incluir el flag que indica si el usuario quiere una cita presencial

- Y se pasa a la proxima pantalla
gilberto.cancel 3 years ago
parent
commit
e04974064b
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      screens/main/Search.js

+ 9
- 2
screens/main/Search.js View File

5
 import firebase from 'firebase'
5
 import firebase from 'firebase'
6
 import { firebaseConfig } from '../../config/firebaseConfig'
6
 import { firebaseConfig } from '../../config/firebaseConfig'
7
   
7
   
8
+//Flag to indicate an IRL appointment.
9
+var mapflag = false
8
 
10
 
9
 if (firebase.apps.length === 0) {
11
 if (firebase.apps.length === 0) {
10
   firebase.initializeApp(firebaseConfig)
12
   firebase.initializeApp(firebaseConfig)
99
     //reset the users usestate to empty
101
     //reset the users usestate to empty
100
     const users = []
102
     const users = []
101
     
103
     
102
-    
103
 
104
 
104
     const db = firebase.firestore()
105
     const db = firebase.firestore()
105
     var query = db.collection('Interprete')
106
     var query = db.collection('Interprete')
106
     
107
     
107
     for (let i = 0; i < tags.length; i++) {
108
     for (let i = 0; i < tags.length; i++) {
109
+
110
+      //Reset Flag.
111
+      mapflag = false
112
+
108
       //check which tags where called in the search 
113
       //check which tags where called in the search 
109
       if (tags[i].id === 'PL') {
114
       if (tags[i].id === 'PL') {
110
         console.log('Presencial')
115
         console.log('Presencial')
111
         query = query.where('Modalidad.Presencial', '==', true)
116
         query = query.where('Modalidad.Presencial', '==', true)
117
+        mapflag = true
112
       }
118
       }
113
       if (tags[i].id == 'ON') {
119
       if (tags[i].id == 'ON') {
114
         query = query.where('Modalidad.Online', '==', true)
120
         query = query.where('Modalidad.Online', '==', true)
164
         }
170
         }
165
         users.push(user)
171
         users.push(user)
166
         setUsers(users)
172
         setUsers(users)
173
+        
167
       });
174
       });
168
     });
175
     });
169
     console.log('These are the users after the query is executed: ',  users)
176
     console.log('These are the users after the query is executed: ',  users)
261
   
268
   
262
   function dothing(item) {
269
   function dothing(item) {
263
     console.log('This is the item id: ', item)
270
     console.log('This is the item id: ', item)
264
-    navigation.navigate('Calendar', {Intereprete_id: item})
271
+    navigation.navigate('Calendar', {Intereprete_id: item, Flag: mapflag})
265
   } 
272
   } 
266
 
273
 
267
 }
274
 }