Kontaktok listázási hibájának javítása, csv export

This commit is contained in:
2026-07-08 22:13:30 +02:00
parent 7cd682fe59
commit 1ab656585b
9 changed files with 262 additions and 19 deletions
@@ -1,4 +1,5 @@
import 'package:get/get.dart';
import 'package:terepi_seged/services/project_service.dart';
import '../../../../services/contact_service.dart';
@@ -27,16 +28,22 @@ class ContactsController extends GetxController {
}).toList();
}
Future<void> load() async {
isLoading.value = true;
Future<void> load({bool silent = false}) async {
final projectId = ProjectService.to.activeProject.value?.uuid;
if (projectId == null) {
error.value = 'Nincs aktív projekt.';
isLoading.value = false;
return;
}
if (!silent) isLoading.value = true;
error.value = '';
try {
items.value = await ContactService.to.listMerged();
pendingCount.value = await ContactService.to.pendingCount();
items.value = await ContactService.to.listMerged(projectId);
pendingCount.value = await ContactService.to.pendingCount(projectId);
} catch (e) {
error.value = _friendly(e);
} finally {
isLoading.value = false;
if (!silent) isLoading.value = false;
}
}
@@ -60,7 +67,10 @@ class ContactsController extends GetxController {
await ContactService.to
.delete(id: it.contact.id, localUuid: it.localUuid);
items.remove(it);
pendingCount.value = await ContactService.to.pendingCount();
final projectId = ProjectService.to.activeProject.value?.uuid;
if (projectId != null) {
pendingCount.value = await ContactService.to.pendingCount(projectId);
}
} catch (e) {
Get.snackbar('Hiba', _friendly(e), snackPosition: SnackPosition.BOTTOM);
}