feat: compelete bal pending screen

This commit is contained in:
alzalia1 2025-08-14 01:02:39 +02:00
parent b12809ba93
commit 618764f513
4 changed files with 72 additions and 3 deletions

View file

@ -15,6 +15,22 @@ class BalViewModel extends ChangeNotifier {
Bal? _bal;
int? id;
Bal? get bal => _bal;
bool isABalOngoing = false;
Future<Result<void>> startBal(int id) async {
if (isABalOngoing) {
return Result.error(Exception("Cannot have multiple BALs ongoing !"));
}
final result = await _balRepository.startBal(id);
switch (result) {
case Ok():
_bal = result.value;
notifyListeners();
break;
default:
}
return result;
}
Future<Result<void>> editBal(
int id,
@ -46,6 +62,7 @@ class BalViewModel extends ChangeNotifier {
bool isLoaded = false;
Future<Result<void>> _load() async {
isABalOngoing = _balRepository.isABalOngoing();
final result1 = await _loadBal();
switch (result1) {
case Ok():