This commit is contained in:
Felipe
2024-01-13 11:10:24 -05:00
parent 240791fb93
commit 6dc5fe6f88
2 changed files with 20 additions and 1 deletions
+18
View File
@@ -219,6 +219,24 @@ class Event {
}
}
static Future<List<Event>> getEventsAllByIdAndStatus(String uid) async {
try {
var snapshot = await FirebaseFirestore.instance
.collection('services')
.where('professional_id', isEqualTo: uid)
.where('status', whereIn: ['aprobado', 'pendiente']).get();
List<Event> eventos = [];
for (var element in snapshot.docs) {
eventos.add(Event.fromJson(element.data()));
}
return eventos;
} catch (e) {
print('Error getByProId $e');
return [];
}
}
static Future<List<Event>> getEventsAllByIdStatus(
String uid, String state) async {
try {
@@ -49,7 +49,8 @@ class _CalendarProScreenState extends State<CalendarProScreen> {
}
if (_events == null) {
Event.getEventsAllById(widget.professional.id.toString()).then((value) {
Event.getEventsAllByIdAndStatus(widget.professional.id.toString())
.then((value) {
setState(() {
_events = value;
});