Reports
This commit is contained in:
parent
72156b5017
commit
3e7e34f15a
|
|
@ -553,8 +553,13 @@ class ReportResult {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool matchString({String filter, String value}) =>
|
static bool matchString({String filter, String value}) {
|
||||||
matchesString(value, filter);
|
if (filter == null || filter.isEmpty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.toLowerCase().contains(filter.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
static bool matchAmount({String filter, double amount}) {
|
static bool matchAmount({String filter, double amount}) {
|
||||||
final String range = filter.replaceAll(',', '-') + '-';
|
final String range = filter.replaceAll(',', '-') + '-';
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,25 @@ String getLastName(String value) {
|
||||||
return parts.last;
|
return parts.last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool matchesStrings(List<String> haystacks, String needle) {
|
||||||
|
bool isMatch = false;
|
||||||
|
haystacks.forEach((haystack) {
|
||||||
|
if (matchesString(haystack, needle)) {
|
||||||
|
isMatch = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return isMatch;
|
||||||
|
}
|
||||||
|
|
||||||
bool matchesString(String haystack, String needle) {
|
bool matchesString(String haystack, String needle) {
|
||||||
|
if (needle == null || needle.isEmpty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String regExp = '';
|
String regExp = '';
|
||||||
needle.toLowerCase().runes.forEach((int rune) {
|
needle.toLowerCase().runes.forEach((int rune) {
|
||||||
final character = String.fromCharCode(rune);
|
final character = String.fromCharCode(rune);
|
||||||
regExp += character + '.*?';
|
regExp += character + '.*?';
|
||||||
});
|
});
|
||||||
return RegExp(regExp).hasMatch(haystack.toLowerCase());
|
return RegExp(regExp).hasMatch(haystack.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue