mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 01:28:56 +03:30
Set search test result by api
This commit is contained in:
@@ -99,7 +99,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
|
||||
void setLoading() {
|
||||
isloading = true;
|
||||
// notifyListeners();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// bool isChangeVerify = false;
|
||||
@@ -140,30 +140,33 @@ class TestResultsProvider with ChangeNotifier {
|
||||
return _filters;
|
||||
}
|
||||
|
||||
void search(String value) {
|
||||
Future<void> search(String value) async {
|
||||
print(value);
|
||||
items = [];
|
||||
searchBoxValue = value;
|
||||
originalItems!.forEach((result) {
|
||||
if (result.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toLowerCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(searchBoxValue.toUpperCase()) ||
|
||||
result.name
|
||||
.toString()
|
||||
.toUpperCase()
|
||||
.contains(searchBoxValue.toLowerCase())) {
|
||||
items!.add(result);
|
||||
}
|
||||
});
|
||||
var response = await http.get(
|
||||
Uri.parse(Url.searchTestResults(value)),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
);
|
||||
print(response.body);
|
||||
var testResultData = json.decode(response.body);
|
||||
for (var item in testResultData['data']) {
|
||||
items!.add(
|
||||
TestResultObject(
|
||||
id: item['id'].toString(),
|
||||
name: item['test_type'] != null ? item['test_type']['name'] : '',
|
||||
deviceId:
|
||||
item['device_id'] != null ? item['device_id'].toString() : '',
|
||||
result: item['result'] == 'Accept' ? 'Accepted' : 'Not Accepted',
|
||||
date: item['created_at'].toString().substring(0, 10),
|
||||
hospital: item['user']['medical_center']['name'],
|
||||
verified: item['verified'].toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
resetLoading();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -270,8 +273,9 @@ class TestResultsProvider with ChangeNotifier {
|
||||
),
|
||||
);
|
||||
}
|
||||
items = originalItems;
|
||||
pageNumber += 1;
|
||||
search('');
|
||||
// search('');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user