Implementert admin-funksjoner: Dashboard, Ansattliste, Avvikshåndtering og Profil-oppdatering

This commit is contained in:
steinhelge
2025-11-24 21:17:29 +01:00
parent feda00ac83
commit 237d56066b
7 changed files with 578 additions and 45 deletions
+14
View File
@@ -140,6 +140,20 @@ class AuthService {
return 'default_aml';
}
// Hent alle brukere i en organisasjon
Future<List<UserModel>> getUsersInOrganization(String organizationId) async {
try {
final snapshot = await _firestore
.collection('users')
.where('organizationId', isEqualTo: organizationId)
.get();
return snapshot.docs.map((doc) => UserModel.fromFirestore(doc)).toList();
} catch (e) {
throw Exception('Kunne ikke hente brukere: $e');
}
}
// Håndter Firebase Auth exceptions
String _handleAuthException(FirebaseAuthException e) {
switch (e.code) {