your tenders apprvals filter
This commit is contained in:
@@ -27,6 +27,16 @@ class YourTendersViewModel with ChangeNotifier {
|
||||
? _fmt.format(selectedDateRange!.end)
|
||||
: 'YYYY/MM/DD';
|
||||
|
||||
int get startDateUnix =>
|
||||
selectedDateRange?.start != null
|
||||
? selectedDateRange!.start.millisecondsSinceEpoch ~/ 1000
|
||||
: 0;
|
||||
|
||||
int get endDateUnix =>
|
||||
selectedDateRange?.end != null
|
||||
? selectedDateRange!.end.millisecondsSinceEpoch ~/ 1000
|
||||
: 0;
|
||||
|
||||
Future<void> getApprovedTenders() async {
|
||||
isLoading = true;
|
||||
notifyListeners();
|
||||
@@ -86,4 +96,23 @@ class YourTendersViewModel with ChangeNotifier {
|
||||
selectedStatus = status;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void clearFilter() {
|
||||
selectedDateRange = null;
|
||||
selectedStatus = 'All';
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> callWithFilter() async {
|
||||
if (selectedStatus == 'All') {
|
||||
await getTenders(
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
createdFrom: startDateUnix.toString(),
|
||||
createdTo: endDateUnix.toString(),
|
||||
);
|
||||
} else if (selectedStatus == 'Tenders submitted') {
|
||||
await getApprovedTenders();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user