ErnestoOrtiz2 2 years ago
parent
commit
33a7953cf4
4 changed files with 13 additions and 97 deletions
  1. 1
    0
      screens/main/Cita.js
  2. 1
    1
      screens/main/Map.js
  3. 9
    93
      screens/main/Search.js
  4. 2
    3
      screens/main/StateTime.js

+ 1
- 0
screens/main/Cita.js View File

@@ -276,3 +276,4 @@ const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch)
276 276
 export default connect(mapStateToProps, mapDispatchProps)(Cita);
277 277
 
278 278
 
279
+

+ 1
- 1
screens/main/Map.js View File

@@ -111,7 +111,7 @@ export default function Map({route, navigation} ) {
111 111
           <Marker coordinate={pin1} />
112 112
         </MapView>
113 113
           <View style = {{position: 'absolute', bottom: '5%'}}>
114
-              <Button title= 'Confirm Location' onPress = {() => navigation.navigate('StateTime' , {Pin : pin1 , Appointment : Appointment, int_id : int_id, 
114
+              <Button title= 'Confirm Location' color = "#000000" onPress = {() => navigation.navigate('StateTime' , {Pin : pin1 , Appointment : Appointment, int_id : int_id, 
115 115
                 mapflag : mapflag, I_Token: i_token, U_Token: u_token
116 116
                 ,Username: username, I_Username: I_username})}/>
117 117
           </View>

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

@@ -44,40 +44,6 @@ const Tags = [
44 44
 ]
45 45
 
46 46
 
47
-const Days = [
48
-  {
49
-    item: 'Lunes',
50
-    id: 'L',
51
-  },
52
-  {
53
-    item: 'Martes',
54
-    id: 'M',
55
-  },
56
-  {
57
-    item: 'Miercoles',
58
-    id: 'W',
59
-  },
60
-  {
61
-    item: 'Jueves',
62
-    id: 'J',
63
-  },
64
-  {
65
-    item: 'Viernes',
66
-    id: 'V',
67
-  },
68
-  {
69
-    item: 'Sabado',
70
-    id: 'S',
71
-  },
72
-  {
73
-    item: 'Domingo',
74
-    id: 'D',
75
-  },
76
-  {
77
-    item: 'Feriados',
78
-    id: 'F',
79
-  }
80
-]
81 47
 
82 48
 
83 49
 
@@ -89,15 +55,14 @@ function Search({route, navigation }) {
89 55
   
90 56
   const [users, setUsers] = useState([])
91 57
   const [selectedTags, setSelectedTags] = useState([])
92
-  const [selectedDays, setSelectedDays] = useState([])
93 58
 
94 59
   
95
-  const fetchUsers = (tags, days) => {
60
+  const fetchUsers = (tags) => {
96 61
     
97 62
     //if the array that have the interpreter tags
98 63
     //and the day tags are empty we dont send the query seeing as the user
99 64
     //is not searching for anything yet 
100
-    if (tags.length === 0 && days.length === 0) {
65
+    if (tags.length === 0) {
101 66
       return
102 67
     }
103 68
 
@@ -135,32 +100,7 @@ function Search({route, navigation }) {
135 100
         query = query.where('english', '==', true)
136 101
       }
137 102
   }
138
-  for(let i = 0; i < days.length; i++) {
139
-    if (days[i].id === 'L') {
140
-      query = query.where('dias.Lunes', '==', true)
141
-    }
142
-    if (days[i].id === 'M') {
143
-      query = query.where('dias.Martes', '==', true)
144
-    }
145
-    if (days[i].id === 'W') {
146
-      query = query.where('dias.Miercoles', '==', true)
147
-    }
148
-    if (days[i].id === 'J') {
149
-      query = query.where('dias.Jueves', '==', true)
150
-    }
151
-    if (days[i].id === 'V') {
152
-      query = query.where('dias.Viernes', '==', true)
153
-    }
154
-    if (days[i].id === 'S') {
155
-      query = query.where('dias.Sabado', '==', true)
156
-    }
157
-    if (days[i].id === 'D') {
158
-      query = query.where('dias.Domingo', '==', true)
159
-    }
160
-    if (days[i].id === 'F') {
161
-      query = query.where('dias.Feriados', '==', true)
162
-    }
163
-  }
103
+  
164 104
     query.get().then(querySnapshot => {
165 105
       console.log('Total users: ', querySnapshot.size);
166 106
       //traverse the query snapshot
@@ -212,34 +152,9 @@ function Search({route, navigation }) {
212 152
         onTapClose={onMultiChange()}
213 153
         isMulti
214 154
       />
215
-      <Text style={{ fontSize: 20, paddingBottom: 10 }}>Dias Disponibles</Text>
216
-      <SelectBox
217
-      arrowIconColor='#E4CD05'
218
-      toggleIconColor='#E4CD05'
219
-      searchIconColor='#E4CD05'
220
-      multiOptionContainerStyle = {{
221
-        backgroundColor: '#E4CD05',
222
-        borderColor: '#E4CD05',
223
-        borderWidth: 1,
224
-        borderRadius: 5,
225
-        marginBottom: 10,
226
-        marginTop: 10,
227
-        padding: 10,
228
-      }}
229
-      multiOptionsLabelStyle = {{
230
-        color: '#000000',
231
-        fontSize: 20,
232
-      }}
233
-        label="Select multiple"
234
-        options={Days}
235
-        selectedValues={selectedDays}
236
-        onMultiSelect={(item) => setSelectedDays(xorBy(selectedDays, [item], 'id'))}
237
-        onTapClose={(item) => setSelectedDays(xorBy(selectedDays, [item], 'id'))}
238
-        isMulti
239
-      />
240 155
 
241 156
       {/* button that will fetch the users */}
242
-      <Button title='Buscar' onPress={() => fetchUsers(selectedTags, selectedDays)}/>
157
+      <Button title='Buscar' onPress={() => fetchUsers(selectedTags)}/>
243 158
 
244 159
 
245 160
       <FlatList
@@ -253,7 +168,7 @@ function Search({route, navigation }) {
253 168
             <View style={{ flexDirection: "row", paddingBottom: 20, paddingTop: 20,  justifyContent: "space-between" }}>
254 169
               <Text>{item.data.username}</Text>
255 170
               <Text>{item.data.precio}</Text>
256
-              <Button title='Buscar' onPress={() => { dothing(item.id, item.data.push_token, u_token, item.data.username) }}/>
171
+              <Button title='Buscar' onPress={() => { dothing(item.id, item.data.markedDates, item.data.push_token, u_token, item.data.username) }}/>
257 172
             </View>
258 173
             <View style={{ borderBottomColor: 'black', borderBottomWidth: 1 }} />
259 174
           </View>
@@ -269,9 +184,10 @@ function Search({route, navigation }) {
269 184
     return (item) => setSelectedTags(xorBy(selectedTags, [item], 'id'))
270 185
   }
271 186
   
272
-  function dothing(item, i_token, u_token, I_username) {
273
-    console.log('This is the item id: ', item, "With i_token: ", i_token, " u_token : ", u_token)
274
-    navigation.navigate('Calendar', {Intereprete_id: item, Flag: mapflag, I_Token: i_token, U_Token: u_token, Username: username, I_Username: I_username})
187
+  function dothing(item_id, item_dates, i_token, u_token, I_username) {
188
+    console.log('This is the item id: ', item_id, "With i_token: ", i_token, " u_token : ", u_token)
189
+    console.log('These are the marked dates', item_dates)
190
+    navigation.navigate('Calendar', {Intereprete_id: item_id, markedDates: item_dates, Flag: mapflag, I_Token: i_token, U_Token: u_token, Username: username, I_Username: I_username})
275 191
   } 
276 192
 
277 193
 }

+ 2
- 3
screens/main/StateTime.js View File

@@ -149,7 +149,7 @@ export default class Time extends Component{
149 149
       i_id,
150 150
       uid, 
151 151
       ],
152
-      new: true,
152
+      new: 'true',
153 153
       Month : month,
154 154
       Day: day,
155 155
       Time: _time_,
@@ -182,7 +182,7 @@ export default class Time extends Component{
182 182
       i_id,
183 183
       uid, 
184 184
       ],
185
-      new: true,
185
+      new: 'true',
186 186
       Month : month,
187 187
       Day: day,
188 188
       Time: _time_,
@@ -214,4 +214,3 @@ export default class Time extends Component{
214 214
     );
215 215
   }
216 216
 }
217
-