ErnestoOrtiz2 3 лет назад
Родитель
Сommit
c482f99609
3 измененных файлов: 778 добавлений и 336 удалений
  1. 1
    319
      config/availability.js
  2. 97
    5
      screens/main/AvailabilityScreen.js
  3. 680
    12
      screens/main/Search.js

+ 1
- 319
config/availability.js Просмотреть файл

@@ -1,323 +1,5 @@
1 1
 export const availability = [
2
-    {
3
-        name: 'Cities',
4
-        id: 0,
5
-        children: [
6
-            {
7
-                name: 'Adjuntas',
8
-                id: 0,
9
-            },
10
-            {
11
-                name: 'Aguada',
12
-                id: 1,
13
-            },
14
-            {
15
-                name: 'Aguadilla',
16
-                id: 2,
17
-            },
18
-            {
19
-                name: 'Aguas Buenas',
20
-                id: 3,
21
-            },
22
-            {
23
-                name: 'Aibonito',
24
-                id: 4,
25
-            },
26
-            {
27
-                name: 'Arecibo',
28
-                id: 5,
29
-            },
30
-            {
31
-                name: 'Arroyo',
32
-                id: 6,
33
-            },
34
-            {
35
-                name: 'Añasco',
36
-                id: 7,
37
-            },
38
-            {
39
-                name: 'Barceloneta',
40
-                id: 8,
41
-            },
42
-            {
43
-                name: 'Barranquitas',
44
-                id: 9,
45
-            },
46
-            {
47
-                name: 'Bayamón',
48
-                id: 10,
49
-            },
50
-            {
51
-                name: 'Cabo Rojo',
52
-                id: 11,
53
-            },
54
-            {
55
-                name: 'Caguas',
56
-                id: 12,
57
-            },
58
-            {
59
-                name: 'Camuy',
60
-                id: 13,
61
-            },
62
-            {
63
-                name: 'Canóvanas',
64
-                id: 14,
65
-            },
66
-            {
67
-                name: 'Carolina',
68
-                id: 15,
69
-            },
70
-            {
71
-                name: 'Cataño',
72
-                id: 16,
73
-            },
74
-            {
75
-                name: 'Cayey',
76
-                id: 17,
77
-            },
78
-            {
79
-                name: 'Ceiba',
80
-                id: 18,
81
-            },
82
-            {
83
-                name: 'Ciales',
84
-                id: 19,
85
-            },
86
-            {
87
-                name: 'Cidra',
88
-                id: 20,
89
-            },
90
-            {
91
-                name: 'Coamo',
92
-                id: 21,
93
-            },
94
-            {
95
-                name: 'Comerío',
96
-                id: 22,
97
-            },
98
-            {
99
-                name: 'Corozal',
100
-                id: 23,
101
-            },
102
-            {
103
-                name: 'Culebra',
104
-                id: 24,
105
-            },
106
-            {
107
-                name: 'Dorado',
108
-                id: 25,
109
-            },
110
-            {
111
-                name: 'Fajardo',
112
-                id: 26,
113
-            },
114
-            {
115
-                name: 'Florida',
116
-                id: 27,
117
-            },
118
-            {
119
-                name: 'Guayama',
120
-                id: 28,
121
-            },
122
-            {
123
-                name: 'Guayanilla',
124
-                id: 29,
125
-            },
126
-            {
127
-                name: 'Guaynabo',
128
-                id: 30,
129
-            },
130
-            {
131
-                name: 'Gurabo',
132
-                id: 31,
133
-            },
134
-            {
135
-                name: 'Guánica',
136
-                id: 32,
137
-            },
138
-            {
139
-                name: 'Hatillo',
140
-                id: 33,
141
-            },
142
-            {
143
-                name: 'Hormigueros',
144
-                id: 34,
145
-            },
146
-            {
147
-                name: 'Humacao',
148
-                id: 35,
149
-            },
150
-            {
151
-                name: 'Isabela',
152
-                id: 36,
153
-            },
154
-            {
155
-                name: 'Jayuya',
156
-                id: 37,
157
-            },
158
-            {
159
-                name: 'Juana Díaz',
160
-                id: 38,
161
-            },
162
-            {
163
-                name: 'Juncos',
164
-                id: 39,
165
-            },
166
-            {
167
-                name: 'Lajas',
168
-                id: 40,
169
-            },
170
-            {
171
-                name: 'Lares',
172
-                id: 41,
173
-            },
174
-            {
175
-                name: 'Las Marías',
176
-                id: 42,
177
-            },
178
-            {
179
-                name: 'Las Piedras',
180
-                id: 43,
181
-            },
182
-            {
183
-                name: 'Loíza',
184
-                id: 44,
185
-            },
186
-            {
187
-                name: 'Luquillo',
188
-                id: 45,
189
-            },
190
-            {
191
-                name: 'Manatí',
192
-                id: 46,
193
-            },
194
-            {
195
-                name: 'Maricao',
196
-                id: 47,
197
-            },
198
-            {
199
-                name: 'Maunabo',
200
-                id: 48,
201
-            },
202
-            {
203
-                name: 'Mayagüez',
204
-                id: 49,
205
-            },
206
-            {
207
-                name: 'Moca',
208
-                id: 50,
209
-            },
210
-            {
211
-                name: 'Morovis',
212
-                id: 51,
213
-            },
214
-            {
215
-                name: 'Naguabo',
216
-                id: 52,
217
-            },
218
-            {
219
-                name: 'Naranjito',
220
-                id: 53,
221
-            },
222
-            {
223
-                name: 'Orocovis',
224
-                id: 54,
225
-            },
226
-            {
227
-                name: 'Patillas',
228
-                id: 55,
229
-            },
230
-            {
231
-                name: 'Peñuelas',
232
-                id: 56,
233
-            },
234
-            {
235
-                name: 'Ponce',
236
-                id: 57,
237
-            },
238
-            {
239
-                name: 'Quebradillas',
240
-                id: 58,
241
-            },
242
-            {
243
-                name: 'Rincón',
244
-                id: 59,
245
-            },
246
-            {
247
-                name: 'Rio Grande',
248
-                id: 60,
249
-            },
250
-            {
251
-                name: 'Sabana Grande',
252
-                id: 61,
253
-            },
254
-            {
255
-                name: 'Salinas',
256
-                id: 62,
257
-            },
258
-            {
259
-                name: 'San Germán',
260
-                id: 63,
261
-            },
262
-            {
263
-                name: 'San Juan',
264
-                id: 64,
265
-            },
266
-            {
267
-                name: 'San Lorenzo',
268
-                id: 65,
269
-            },
270
-            {
271
-                name: 'San Sebastián',
272
-                id: 66,
273
-            },
274
-            {
275
-                name: 'Santa Isabel',
276
-                id: 67,
277
-            },
278
-            {
279
-                name: 'Toa Alta',
280
-                id: 68,
281
-            },
282
-            {
283
-                name: 'Toa Baja',
284
-                id: 69,
285
-            },
286
-            {
287
-                name: 'Trujillo Alto',
288
-                id: 70,
289
-            },
290
-            {
291
-                name: 'Utuado',
292
-                id: 71,
293
-            },
294
-            {
295
-                name: 'Vega Alta',
296
-                id: 72,
297
-            },
298
-            {
299
-                name: 'Vega Baja',
300
-                id: 73,
301
-            },
302
-            {
303
-                name: 'Vieques',
304
-                id: 74,
305
-            },
306
-            {
307
-                name: 'Villalba',
308
-                id: 75,
309
-            },
310
-            {
311
-                name: 'Yabucoa',
312
-                id: 76,
313
-            },
314
-            {
315
-                name: 'Yauco',
316
-                id: 77,
317
-            },
318
-        ],
319
-    },
320
-
2
+   
321 3
     {
322 4
         name: 'Languages',
323 5
         id: 1,

+ 97
- 5
screens/main/AvailabilityScreen.js Просмотреть файл

@@ -7,6 +7,7 @@ import SectionedMultiSelect from 'react-native-sectioned-multi-select';
7 7
 import Icon from 'react-native-vector-icons/MaterialIcons';
8 8
 import { connect } from 'react-redux';
9 9
 import { bindActionCreators } from 'redux';
10
+import { Picker } from "@react-native-picker/picker";
10 11
 
11 12
 import { fetchUser } from "../../redux/actions";
12 13
 import { styles } from "../../config/styles";
@@ -16,13 +17,16 @@ export class AvailabilityScreen extends Component {
16 17
     constructor(props) {
17 18
         super(props);
18 19
         this.state = {
20
+            //x : this.route.params.availabilityData.selectedItems,
21
+            //y : this.route.params.availabilityData.markedDates,
19 22
             english: false,
20 23
             spanish: false,
21 24
             virtual: false,
22 25
             face_to_face: false,
23 26
             personal: false,
24 27
             group: false,
25
-            cities: [],
28
+            city: 'San Juan',
29
+            //cities: [],
26 30
             selectedItems: [],
27 31
             markedDates: {}
28 32
         };
@@ -33,6 +37,12 @@ export class AvailabilityScreen extends Component {
33 37
     };
34 38
 
35 39
     componentDidMount(){
40
+        /*if (x != undefined){
41
+            this.setState({selectedItems : x});
42
+        };
43
+        if (y != undefined){
44
+            this.setState({markedDates : y});
45
+        }*/
36 46
         this.props.fetchUser();
37 47
         this.forceUpdate(() => {this.handleUpdate()})
38 48
     };
@@ -40,10 +50,11 @@ export class AvailabilityScreen extends Component {
40 50
     handleUpdate(){
41 51
         const { currentUser } = this.props;
42 52
         if (currentUser != undefined){
43
-            if (currentUser.hasOwnProperty('selectedItems') && currentUser.hasOwnProperty('markedDates'))
53
+            if (currentUser.hasOwnProperty('selectedItems') && currentUser.hasOwnProperty('markedDates') && currentUser.hasOwnProperty('city'))
44 54
             this.setState( {selectedItems: currentUser.selectedItems});
45 55
             this.setState( {markedDates: currentUser.markedDates});
46
-        }    
56
+            this.setState({city: currentUser.city})
57
+        }
47 58
     };
48 59
 
49 60
     onSave(){
@@ -79,9 +90,9 @@ export class AvailabilityScreen extends Component {
79 90
                     }
80 91
                 }
81 92
             }
82
-            else{
93
+            /*else{
83 94
                 this.state.cities.push(value);
84
-            }
95
+            }*/
85 96
         })
86 97
         firebase.firestore().collection('Interpreters')
87 98
             .doc(firebase.auth().currentUser.uid)
@@ -123,6 +134,87 @@ export class AvailabilityScreen extends Component {
123 134
                     onSelectedItemsChange={this.onSelectedItemsChange}
124 135
                     selectedItems={this.state.selectedItems}
125 136
                 />
137
+                <Picker selectedValue={this.state.city} onValueChange={(itemValue, itemIndex) => this.setState({city : itemValue})}>
138
+                    <Picker.Item label='Adjuntas' value={'Adjuntas'}/>
139
+                    <Picker.Item label='Aguada' value={'Aguada'}/>
140
+                    <Picker.Item label='Adjuntas' value={'Adjuntas'}/>
141
+                    <Picker.Item label='Aguadilla' value={'Aguadilla'}/>
142
+                    <Picker.Item label='Aguas Buenas' value={'Aguas Buenas'}/>
143
+                    <Picker.Item label='Aibonito' value={'Aibonito'}/>
144
+                    <Picker.Item label='Arecibo' value={'Arecibo'}/>
145
+                    <Picker.Item label='Arroyo' value={'Arroyo'}/>
146
+                    <Picker.Item label='Añasco' value={'Añasco'}/>
147
+                    <Picker.Item label='Barceloneta' value={'Barceloneta'}/>
148
+                    <Picker.Item label='Barranquitas' value={'Barranquitas'}/>
149
+                    <Picker.Item label='Bayamón' value={'Bayamón'}/>
150
+                    <Picker.Item label='Cabo Rojo' value={'Cabo Rojo'}/>
151
+                    <Picker.Item label='Caguas' value={'Caguas'}/>
152
+                    <Picker.Item label='Camuy' value={'Camuy'}/>
153
+                    <Picker.Item label='Canóvanas' value={'Canóvanas'}/>
154
+                    <Picker.Item label='Carolina' value={'Carolina'}/>
155
+                    <Picker.Item label='Cataño' value={'Cataño'}/>
156
+                    <Picker.Item label='Cayey' value={'Cayey'}/>
157
+                    <Picker.Item label='Ceiba' value={'Ceiba'}/>
158
+                    <Picker.Item label='Ciales' value={'Ciales'}/>
159
+                    <Picker.Item label='Cidra' value={'Cidra'}/>
160
+                    <Picker.Item label='Coamo' value={'Coamo'}/>
161
+                    <Picker.Item label='Comerío' value={'Comerío'}/>
162
+                    <Picker.Item label='Corozal' value={'Corozal'}/>
163
+                    <Picker.Item label='Culebra' value={'Culebra'}/>
164
+                    <Picker.Item label='Dorado' value={'Dorado'}/>
165
+                    <Picker.Item label='Fajardo' value={'Fajardo'}/>
166
+                    <Picker.Item label='Florida' value={'Florida'}/>
167
+                    <Picker.Item label='Guayama' value={'Guayama'}/>
168
+                    <Picker.Item label='Guayanilla' value={'Guayanilla'}/>
169
+                    <Picker.Item label='Guaynabo' value={'Guaynabo'}/>
170
+                    <Picker.Item label='Gurabo' value={'Gurabo'}/>
171
+                    <Picker.Item label='Guánica' value={'Guánica'}/>
172
+                    <Picker.Item label='Hatillo' value={'Hatillo'}/>
173
+                    <Picker.Item label='Hormigueros' value={'Hormigueros'}/>
174
+                    <Picker.Item label='Humacao' value={'Humacao'}/>
175
+                    <Picker.Item label='Isabela' value={'Isabela'}/>
176
+                    <Picker.Item label='Jayuya' value={'Jayuya'}/>
177
+                    <Picker.Item label='Juana Díaz' value={'Juana Díaz'}/>
178
+                    <Picker.Item label='Juncos' value={'Juncos'}/>
179
+                    <Picker.Item label='Lajas' value={'Lajas'}/>
180
+                    <Picker.Item label='Lares' value={'Lares'}/>
181
+                    <Picker.Item label='Las Marías' value={'Las Marías'}/>
182
+                    <Picker.Item label='Las Piedras' value={'Las Piedras'}/>
183
+                    <Picker.Item label='Loíza' value={'Loíza'}/>
184
+                    <Picker.Item label='Luquillo' value={'Luquillo'}/>
185
+                    <Picker.Item label='Manatí' value={'Manatí'}/>
186
+                    <Picker.Item label='Maricao' value={'Maricao'}/>
187
+                    <Picker.Item label='Maunabo' value={'Maunabo'}/>
188
+                    <Picker.Item label='Mayagüez' value={'Mayagüez'}/>
189
+                    <Picker.Item label='Moca' value={'Moca'}/>
190
+                    <Picker.Item label='Morovis' value={'Morovis'}/>
191
+                    <Picker.Item label='Naguabo' value={'Naguabo'}/>
192
+                    <Picker.Item label='Naranjito' value={'Naranjito'}/>
193
+                    <Picker.Item label='Orocovis' value={'Orocovis'}/>
194
+                    <Picker.Item label='Patillas' value={'Patillas'}/>
195
+                    <Picker.Item label='Peñuelas' value={'Peñuelas'}/>
196
+                    <Picker.Item label='Ponce' value={'Ponce'}/>
197
+                    <Picker.Item label='Quebradillas' value={'Quebradillas'}/>
198
+                    <Picker.Item label='Rincón' value={'Rincón'}/>
199
+                    <Picker.Item label='Rio Grande' value={'Rio Grande'}/>
200
+                    <Picker.Item label='Sabana Grande' value={'Sabana Grande'}/>
201
+                    <Picker.Item label='Salinas' value={'Salinas'}/>
202
+                    <Picker.Item label='San Germán' value={'San Germán'}/>
203
+                    <Picker.Item label='San Juan' value={'San Juan'}/>
204
+                    <Picker.Item label='San Lorenzo' value={'San Lorenzo'}/>
205
+                    <Picker.Item label='San Sebastián' value={'San Sebastián'}/>
206
+                    <Picker.Item label='Santa Isabel' value={'Santa Isabel'}/>
207
+                    <Picker.Item label='Toa Alta' value={'Toa Alta'}/>
208
+                    <Picker.Item label='Toa Baja' value={'Toa Baja'}/>
209
+                    <Picker.Item label='Trujillo Alto' value={'Trujillo Alto'}/>
210
+                    <Picker.Item label='Utuado' value={'Utuado'}/>
211
+                    <Picker.Item label='Vega Alta' value={'Vega Alta'}/>
212
+                    <Picker.Item label='Vega Baja' value={'Vega Baja'}/>
213
+                    <Picker.Item label='Vieques' value={'Vieques'}/>
214
+                    <Picker.Item label='Villalba' value={'Villalba'}/>
215
+                    <Picker.Item label='Yabucoa' value={'Yabucoa'}/>
216
+                    <Picker.Item label='Yauco' value={'Yauco'}/>
217
+                </Picker>
126 218
                 <Button title='Save' onPress={() => {this.onSave()}}/>
127 219
             </ScrollView>
128 220
         );

+ 680
- 12
screens/main/Search.js Просмотреть файл

@@ -44,7 +44,326 @@ const Tags = [
44 44
 ]
45 45
 
46 46
 
47
+const City = [
48
+  {
49
+    item: 'None',
50
+    id: -1,
51
+  },
52
+  {
53
+      item: 'Adjuntas',
54
+      id: 0,
55
+  },
56
+  {
57
+      item: 'Aguada',
58
+      id: 1,
59
+  },
60
+  {
61
+      item: 'Aguadilla',
62
+      id: 2,
63
+  },
64
+  {
65
+      item: 'Aguas Buenas',
66
+      id: 3,
67
+  },
68
+  {
69
+      item: 'Aibonito',
70
+      id: 4,
71
+  },
72
+  {
73
+      item: 'Arecibo',
74
+      id: 5,
75
+  },
76
+  {
77
+      item: 'Arroyo',
78
+      id: 6,
79
+  },
80
+  {
81
+      item: 'Añasco',
82
+      id: 7,
83
+  },
84
+  {
85
+      item: 'Barceloneta',
86
+      id: 8,
87
+  },
88
+  {
89
+      item: 'Barranquitas',
90
+      id: 9,
91
+  },
92
+  {
93
+      item: 'Bayamón',
94
+      id: 10,
95
+  },
96
+  {
97
+      item: 'Cabo Rojo',
98
+      id: 11,
99
+  },
100
+  {
101
+      item: 'Caguas',
102
+      id: 12,
103
+  },
104
+  {
105
+      item: 'Camuy',
106
+      id: 13,
107
+  },
108
+  {
109
+      item: 'Canóvanas',
110
+      id: 14,
111
+  },
112
+  {
113
+      item: 'Carolina',
114
+      id: 15,
115
+  },
116
+  {
117
+      item: 'Cataño',
118
+      id: 16,
119
+  },
120
+  {
121
+      item: 'Cayey',
122
+      id: 17,
123
+  },
124
+  {
125
+      item: 'Ceiba',
126
+      id: 18,
127
+  },
128
+  {
129
+      item: 'Ciales',
130
+      id: 19,
131
+  },
132
+  {
133
+      item: 'Cidra',
134
+      id: 20,
135
+  },
136
+  {
137
+      item: 'Coamo',
138
+      id: 21,
139
+  },
140
+  {
141
+      item: 'Comerío',
142
+      id: 22,
143
+  },
144
+  {
145
+      item: 'Corozal',
146
+      id: 23,
147
+  },
148
+  {
149
+      item: 'Culebra',
150
+      id: 24,
151
+  },
152
+  {
153
+      item: 'Dorado',
154
+      id: 25,
155
+  },
156
+  {
157
+      item: 'Fajardo',
158
+      id: 26,
159
+  },
160
+  {
161
+      item: 'Florida',
162
+      id: 27,
163
+  },
164
+  {
165
+      item: 'Guayama',
166
+      id: 28,
167
+  },
168
+  {
169
+      item: 'Guayanilla',
170
+      id: 29,
171
+  },
172
+  {
173
+      item: 'Guaynabo',
174
+      id: 30,
175
+  },
176
+  {
177
+      item: 'Gurabo',
178
+      id: 31,
179
+  },
180
+  {
181
+      item: 'Guánica',
182
+      id: 32,
183
+  },
184
+  {
185
+      item: 'Hatillo',
186
+      id: 33,
187
+  },
188
+  {
189
+      item: 'Hormigueros',
190
+      id: 34,
191
+  },
192
+  {
193
+      item: 'Humacao',
194
+      id: 35,
195
+  },
196
+  {
197
+      item: 'Isabela',
198
+      id: 36,
199
+  },
200
+  {
201
+      item: 'Jayuya',
202
+      id: 37,
203
+  },
204
+  {
205
+      item: 'Juana Díaz',
206
+      id: 38,
207
+  },
208
+  {
209
+      item: 'Juncos',
210
+      id: 39,
211
+  },
212
+  {
213
+      item: 'Lajas',
214
+      id: 40,
215
+  },
216
+  {
217
+      item: 'Lares',
218
+      id: 41,
219
+  },
220
+  {
221
+      item: 'Las Marías',
222
+      id: 42,
223
+  },
224
+  {
225
+      item: 'Las Piedras',
226
+      id: 43,
227
+  },
228
+  {
229
+      item: 'Loíza',
230
+      id: 44,
231
+  },
232
+  {
233
+      item: 'Luquillo',
234
+      id: 45,
235
+  },
236
+  {
237
+      item: 'Manatí',
238
+      id: 46,
239
+  },
240
+  {
241
+      item: 'Maricao',
242
+      id: 47,
243
+  },
244
+  {
245
+      item: 'Maunabo',
246
+      id: 48,
247
+  },
248
+  {
249
+      item: 'Mayagüez',
250
+      id: 49,
251
+  },
252
+  {
253
+      item: 'Moca',
254
+      id: 50,
255
+  },
256
+  {
257
+      item: 'Morovis',
258
+      id: 51,
259
+  },
260
+  {
261
+      item: 'Naguabo',
262
+      id: 52,
263
+  },
264
+  {
265
+      item: 'Naranjito',
266
+      id: 53,
267
+  },
268
+  {
269
+      item: 'Orocovis',
270
+      id: 54,
271
+  },
272
+  {
273
+      item: 'Patillas',
274
+      id: 55,
275
+  },
276
+  {
277
+      item: 'Peñuelas',
278
+      id: 56,
279
+  },
280
+  {
281
+      item: 'Ponce',
282
+      id: 57,
283
+  },
284
+  {
285
+      item: 'Quebradillas',
286
+      id: 58,
287
+  },
288
+  {
289
+      item: 'Rincón',
290
+      id: 59,
291
+  },
292
+  {
293
+      item: 'Rio Grande',
294
+      id: 60,
295
+  },
296
+  {
297
+      item: 'Sabana Grande',
298
+      id: 61,
299
+  },
300
+  {
301
+      item: 'Salinas',
302
+      id: 62,
303
+  },
304
+  {
305
+      item: 'San Germán',
306
+      id: 63,
307
+  },
308
+  {
309
+      item: 'San Juan',
310
+      id: 64,
311
+  },
312
+  {
313
+      item: 'San Lorenzo',
314
+      id: 65,
315
+  },
316
+  {
317
+      item: 'San Sebastián',
318
+      id: 66,
319
+  },
320
+  {
321
+      item: 'Santa Isabel',
322
+      id: 67,
323
+  },
324
+  {
325
+      item: 'Toa Alta',
326
+      id: 68,
327
+  },
328
+  {
329
+      item: 'Toa Baja',
330
+      id: 69,
331
+  },
332
+  {
333
+      item: 'Trujillo Alto',
334
+      id: 70,
335
+  },
336
+  {
337
+      item: 'Utuado',
338
+      id: 71,
339
+  },
340
+  {
341
+      item: 'Vega Alta',
342
+      id: 72,
343
+  },
344
+  {
345
+      item: 'Vega Baja',
346
+      id: 73,
347
+  },
348
+  {
349
+      item: 'Vieques',
350
+      id: 74,
351
+  },
352
+  {
353
+      item: 'Villalba',
354
+      id: 75,
355
+  },
356
+  {
357
+      item: 'Yabucoa',
358
+      id: 76,
359
+  },
360
+  {
361
+      item: 'Yauco',
362
+      id: 77,
363
+  },
364
+  
47 365
 
366
+]
48 367
 
49 368
 
50 369
 function Search({route, navigation }) {
@@ -55,14 +374,18 @@ function Search({route, navigation }) {
55 374
   
56 375
   const [users, setUsers] = useState([])
57 376
   const [selectedTags, setSelectedTags] = useState([])
377
+  const [selectedCity, setSelectedCity] = useState([])
378
+
58 379
 
59 380
   
60
-  const fetchUsers = (tags) => {
381
+  const fetchUsers = (tags, city) => {
61 382
     
62 383
     //if the array that have the interpreter tags
63 384
     //and the day tags are empty we dont send the query seeing as the user
64 385
     //is not searching for anything yet 
65
-    if (tags.length === 0) {
386
+    // console.log(tags.length)
387
+    // console.log(city.id)
388
+    if (tags.length === 0 && (typeof city.id ==="undefined" || city.id === -1)) {
66 389
       return
67 390
     }
68 391
 
@@ -101,6 +424,328 @@ function Search({route, navigation }) {
101 424
       }
102 425
   }
103 426
   
427
+
428
+    
429
+    switch(city.id){
430
+      case 0:
431
+        query = query.where('city', '==', 'Adjuntas')
432
+        break;
433
+
434
+
435
+      case 1:
436
+        query = query.where('city', '==', 'Aguada')
437
+        break;
438
+
439
+      case 2:
440
+        query = query.where('city', '==', 'Aguadilla')
441
+        break;
442
+
443
+      case 3:
444
+        query = query.where('city', '==', 'Aguas Buenas')
445
+        break;
446
+      
447
+      case 4:
448
+        query = query.where('city', '==', 'Aibonito')
449
+        break;
450
+      
451
+      case 5:
452
+        query = query.where('city', '==', 'Arecibo')
453
+        break;
454
+      
455
+      case 6:
456
+        query = query.where('city', '==', 'Arroyo')
457
+        break;
458
+      
459
+      case 7:
460
+        query = query.where('city', '==', 'Añasco')
461
+        break;
462
+      
463
+      case 8:
464
+        query = query.where('city', '==', 'Barceloneta')
465
+        break;
466
+      
467
+      case 9:
468
+        query = query.where('city', '==', 'Barranquitas')
469
+        break;
470
+      
471
+      case 10:
472
+        query = query.where('city', '==', 'Bayamón')
473
+        break;
474
+      
475
+      case 11:
476
+        query = query.where('city', '==', 'Cabo Rojo')
477
+        break;
478
+      
479
+      case 12:
480
+        query = query.where('city', '==', 'Caguas')
481
+        break;
482
+      
483
+      case 13:
484
+        query = query.where('city', '==', 'Camuy')
485
+        break;
486
+      
487
+      case 14:
488
+        query = query.where('city', '==', 'Canóvanas')
489
+        break;
490
+      
491
+      case 15:
492
+        query = query.where('city', '==', 'Carolina')
493
+        break;
494
+
495
+      case 16:
496
+        query = query.where('city', '==', 'Cataño')
497
+        break;
498
+
499
+      case 17:
500
+        query = query.where('city', '==', 'Cayey')
501
+        break;
502
+
503
+      case 18:
504
+        query = query.where('city', '==', 'Ceiba')
505
+        break;
506
+
507
+      case 19:
508
+        query = query.where('city', '==', 'Ciales')
509
+        break;
510
+      
511
+      case 20:
512
+        query = query.where('city', '==', 'Cidra')
513
+        break;
514
+
515
+      case 21:
516
+        query = query.where('city', '==', 'Coamo')
517
+        break;
518
+
519
+      case 22:
520
+        query = query.where('city', '==', 'Comerío')
521
+        break;
522
+
523
+      case 23:
524
+        query = query.where('city', '==', 'Corozal')
525
+        break;
526
+
527
+      case 24:
528
+        query = query.where('city', '==', 'Culebra')
529
+        break;
530
+      
531
+      case 25:
532
+        query = query.where('city', '==', 'Dorado')
533
+        break;
534
+
535
+      case 26:
536
+        query = query.where('city', '==', 'Fajardo')
537
+        break;
538
+
539
+      case 27:
540
+        query = query.where('city', '==', 'Florida')
541
+        break;
542
+
543
+      case 28:
544
+        query = query.where('city', '==', 'Guánica')
545
+        break;
546
+      
547
+      case 29:
548
+        query = query.where('city', '==', 'Guayama')
549
+        break;
550
+
551
+      case 30:
552
+        query = query.where('city', '==', 'Guayanilla')
553
+        break;
554
+      
555
+      case 31:
556
+        query = query.where('city', '==', 'Guaynabo')
557
+        break;
558
+
559
+      case 32:
560
+        query = query.where('city', '==', 'Gurabo')
561
+        break;
562
+
563
+      case 33:
564
+        query = query.where('city', '==', 'Hatillo')
565
+        break;
566
+
567
+      case 34:
568
+        query = query.where('city', '==', 'Hormigueros')
569
+        break;
570
+
571
+      case 35:
572
+        query = query.where('city', '==', 'Humacao')
573
+        break;
574
+
575
+      case 36:
576
+        query = query.where('city', '==', 'Isabela')
577
+        break;
578
+
579
+      case 37:
580
+        query = query.where('city', '==', 'Jayuya')
581
+        break;
582
+
583
+      case 38:
584
+        query = query.where('city', '==', 'Juana Díaz')
585
+        break;
586
+      
587
+      case 39:
588
+        query = query.where('city', '==', 'Juncos')
589
+        break;
590
+
591
+      case 40:
592
+        query = query.where('city', '==', 'Lajas')
593
+        break;
594
+
595
+      case 41:
596
+        query = query.where('city', '==', 'Lares')
597
+        break;
598
+
599
+      case 42:
600
+        query = query.where('city', '==', 'Las Marías')
601
+        break;
602
+
603
+      case 43:
604
+        query = query.where('city', '==', 'Las Piedras')
605
+        break;
606
+
607
+      case 44:
608
+        query = query.where('city', '==', 'Loíza')
609
+        break;
610
+
611
+      case 45:
612
+        query = query.where('city', '==', 'Luquillo')
613
+        break;
614
+
615
+      case 46:
616
+        query = query.where('city', '==', 'Manatí')
617
+        break;
618
+
619
+      case 47:
620
+        query = query.where('city', '==', 'Maricao')
621
+        break;
622
+
623
+      case 48:
624
+        query = query.where('city', '==', 'Maunabo')
625
+        break;
626
+
627
+      case 49:
628
+        query = query.where('city', '==', 'Mayagüez')
629
+        break;
630
+
631
+      case 50:
632
+        query = query.where('city', '==', 'Moca')
633
+        break;
634
+
635
+      case 51:
636
+        query = query.where('city', '==', 'Morovis')
637
+        break;
638
+
639
+      case 52:
640
+        query = query.where('city', '==', 'Naguabo')
641
+        break;
642
+
643
+      case 53:
644
+        query = query.where('city', '==', 'Naranjito')
645
+        break;
646
+
647
+      case 54:
648
+        query = query.where('city', '==', 'Orocovis')
649
+        break;
650
+
651
+      case 55:
652
+        query = query.where('city', '==', 'Patillas')
653
+        break;
654
+
655
+      case 56:
656
+        query = query.where('city', '==', 'Peñuelas')
657
+        break;
658
+
659
+      case 57:
660
+        query = query.where('city', '==', 'Ponce')
661
+        break;
662
+
663
+      case 58:
664
+        query = query.where('city', '==', 'Quebradillas')
665
+        break;
666
+
667
+      case 59:
668
+        query = query.where('city', '==', 'Rincón')
669
+        break;
670
+
671
+      case 60:
672
+        query = query.where('city', '==', 'Río Grande')
673
+        break;
674
+
675
+      case 61:
676
+        query = query.where('city', '==', 'Sabana Grande')
677
+        break;
678
+
679
+      case 62:
680
+        query = query.where('city', '==', 'Salinas')
681
+        break;
682
+
683
+      case 63:
684
+        query = query.where('city', '==', 'San Germán')
685
+        break;
686
+
687
+      case 64:
688
+        query = query.where('city', '==', 'San Juan')
689
+        break;
690
+        
691
+
692
+      case 65:
693
+        query = query.where('city', '==', 'San Lorenzo')
694
+        break;
695
+
696
+      case 66:
697
+        query = query.where('city', '==', 'San Sebastián')
698
+        break;
699
+
700
+      case 67:
701
+        query = query.where('city', '==', 'Santa Isabel')
702
+        break;
703
+
704
+      case 68:
705
+        query = query.where('city', '==', 'Toa Alta')
706
+        break;
707
+
708
+      case 69:
709
+        query = query.where('city', '==', 'Toa Baja')
710
+        break;
711
+
712
+      case 70:
713
+        query = query.where('city', '==', 'Trujillo Alto')
714
+        break;
715
+
716
+      case 71:
717
+        query = query.where('city', '==', 'Utuado')
718
+        break;
719
+
720
+      case 72:
721
+        query = query.where('city', '==', 'Vega Alta')
722
+        break;
723
+
724
+      case 73:
725
+        query = query.where('city', '==', 'Vega Baja')
726
+        break;
727
+
728
+      case 74:
729
+        query = query.where('city', '==', 'Vieques')
730
+        break;
731
+
732
+      case 75:
733
+        query = query.where('city', '==', 'Villalba')
734
+        break;
735
+
736
+      case 76:
737
+        query = query.where('city', '==', 'Yabucoa')
738
+        break;
739
+
740
+      case 77:
741
+        query = query.where('city', '==', 'Yauco')
742
+        break;
743
+
744
+      default:
745
+
746
+    }
747
+
748
+  
104 749
     query.get().then(querySnapshot => {
105 750
       console.log('Total users: ', querySnapshot.size);
106 751
       //traverse the query snapshot
@@ -125,10 +770,33 @@ function Search({route, navigation }) {
125 770
     <ScrollView>
126 771
     <View style={{ margin: 30 }}>
127 772
       <View style={{ width: '100%', alignItems: 'center' }}>
128
-        <Text style={{ fontSize: 30, paddingBottom: 20 }}>Busqueda</Text>
773
+        <Text style={{ fontSize: 30, paddingBottom: 20 }}>Search</Text>
129 774
       </View>
130
-      <Text style={{ fontSize: 20, paddingBottom: 10 }}>Filtro de Interpretes</Text>
775
+
776
+      <Text style={{ fontSize: 20, paddingBottom: 10 }}>Interpreter city</Text>
777
+      <SelectBox
778
+        label="Select single"
779
+        options={City}
780
+        value={selectedCity}
781
+        onChange={onChange()}
782
+        hideInputFilter={false}
783
+        arrowIconColor="#E4CD05"
784
+        toggleIconColor='#E4CD05'
785
+        searchIconColor='#E4CD05'
786
+
787
+
788
+      />
789
+      <Text style={{ fontSize: 20, paddingBottom: 10 }}>Interpreter Tags</Text>
790
+
791
+      
792
+
131 793
       <SelectBox
794
+        label="Select multiple"
795
+        options={Tags}
796
+        selectedValues={selectedTags}
797
+        onMultiSelect={onMultiChange()}
798
+        onTapClose={onMultiChange()}
799
+        isMulti
132 800
         arrowIconColor='#E4CD05'
133 801
         toggleIconColor='#E4CD05'
134 802
         searchIconColor='#E4CD05'
@@ -145,16 +813,12 @@ function Search({route, navigation }) {
145 813
           color: '#000000',
146 814
           fontSize: 20,
147 815
         }}
148
-        label="Select multiple"
149
-        options={Tags}
150
-        selectedValues={selectedTags}
151
-        onMultiSelect={onMultiChange()}
152
-        onTapClose={onMultiChange()}
153
-        isMulti
154
-      />
816
+
817
+          />
818
+
155 819
 
156 820
       {/* button that will fetch the users */}
157
-      <Button title='Buscar' onPress={() => fetchUsers(selectedTags)}/>
821
+      <Button title='Buscar' onPress={() => fetchUsers(selectedTags, selectedCity)}/>
158 822
 
159 823
 
160 824
       <FlatList
@@ -183,6 +847,10 @@ function Search({route, navigation }) {
183 847
   function onMultiChange() {
184 848
     return (item) => setSelectedTags(xorBy(selectedTags, [item], 'id'))
185 849
   }
850
+
851
+  function onChange(){
852
+    return (item) => setSelectedCity(item)
853
+  }
186 854
   
187 855
   function dothing(item_id, item_dates, i_token, u_token, I_username) {
188 856
     console.log('This is the item id: ', item_id, "With i_token: ", i_token, " u_token : ", u_token)