|
@@ -17,6 +17,7 @@ export function Cita({route, navigation}) {
|
17
|
17
|
const [threads, setThreads] = useState([]);
|
18
|
18
|
const [loading, setLoading] = useState(true);
|
19
|
19
|
console.log("ID", route.params);
|
|
20
|
+ const [appointments, setAppointments] = useState([]);
|
20
|
21
|
|
21
|
22
|
|
22
|
23
|
|
|
@@ -41,8 +42,27 @@ export function Cita({route, navigation}) {
|
41
|
42
|
}
|
42
|
43
|
});
|
43
|
44
|
|
|
45
|
+ const cita = firebase.firestore().collection('APPOINTMENTS').where("citaID", "==", route.params.tag._id).onSnapshot(snapShot => {
|
|
46
|
+ const appointments = snapShot.docs.map(docSnap => {
|
|
47
|
+ return{
|
|
48
|
+ _id:docSnap.id,
|
|
49
|
+ new:'',
|
|
50
|
+ Day:'',
|
|
51
|
+ Month:'',
|
|
52
|
+ Time:'',
|
|
53
|
+ i_token:'',
|
|
54
|
+ u_token:'',
|
|
55
|
+ Pin: {},
|
|
56
|
+ ...docSnap.data()
|
|
57
|
+ };
|
|
58
|
+ });
|
|
59
|
+ setAppointments(appointments);
|
|
60
|
+ console.log("appointment", appointments);
|
|
61
|
+ });
|
|
62
|
+
|
44
|
63
|
return () => {
|
45
|
64
|
fire();
|
|
65
|
+ cita();
|
46
|
66
|
}
|
47
|
67
|
}, []);
|
48
|
68
|
|
|
@@ -78,6 +98,43 @@ export function Cita({route, navigation}) {
|
78
|
98
|
</TouchableOpacity>
|
79
|
99
|
)}
|
80
|
100
|
/>
|
|
101
|
+ <FlatList style={{
|
|
102
|
+ flex: 1,
|
|
103
|
+ width: screenWidth,
|
|
104
|
+ }}
|
|
105
|
+ data={appointments}
|
|
106
|
+ keyExtractor = {item => item._id}
|
|
107
|
+ ItemSeparatorComponent={() => <Divider />}
|
|
108
|
+ renderItem = {({item}) => (
|
|
109
|
+ <TouchableOpacity
|
|
110
|
+ onPress={async () => {
|
|
111
|
+ console.log("cita")
|
|
112
|
+ }}
|
|
113
|
+ >
|
|
114
|
+ <List.Item
|
|
115
|
+ title={item.Month}
|
|
116
|
+ titleNumberOfLines={1}
|
|
117
|
+ titleStyle={styles.listTitle}
|
|
118
|
+ descriptionStyle={styles.listDescription}
|
|
119
|
+ descriptionNumberOfLines={1}
|
|
120
|
+ />
|
|
121
|
+ <List.Item
|
|
122
|
+ title={item.Day}
|
|
123
|
+ titleNumberOfLines={1}
|
|
124
|
+ titleStyle={styles.listTitle}
|
|
125
|
+ descriptionStyle={styles.listDescription}
|
|
126
|
+ descriptionNumberOfLines={1}
|
|
127
|
+ />
|
|
128
|
+ <List.Item
|
|
129
|
+ title={item.Time}
|
|
130
|
+ titleNumberOfLines={1}
|
|
131
|
+ titleStyle={styles.listTitle}
|
|
132
|
+ descriptionStyle={styles.listDescription}
|
|
133
|
+ descriptionNumberOfLines={1}
|
|
134
|
+ />
|
|
135
|
+ </TouchableOpacity>
|
|
136
|
+ )}
|
|
137
|
+ />
|
81
|
138
|
<Button
|
82
|
139
|
title ='Ver mapa'
|
83
|
140
|
onPress= {() => navigation.navigate('Map', {View_Only: true, Pin: Pin})}
|