mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 04:35:26 +00:00
Display a list of companies, with filtering
This commit is contained in:
@ -10,6 +10,8 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
|
||||
InvenTreeCompany() : super();
|
||||
|
||||
String get image => jsondata['image'] ?? '';
|
||||
|
||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -172,7 +172,16 @@ class InvenTreeModel {
|
||||
// TODO - Define a 'save' / 'update' function
|
||||
|
||||
// Override this function for each sub-class
|
||||
bool matchAgainstString(String filter) => false;
|
||||
bool matchAgainstString(String filter) {
|
||||
// Default implementation matches name and description
|
||||
// Override this behaviour in sub-class if required
|
||||
|
||||
if (name.toLowerCase().contains(filter)) return true;
|
||||
if (description.toLowerCase().contains(filter)) return true;
|
||||
|
||||
// No matches!
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter this item against a list of provided filters
|
||||
// Each filter must be matched
|
||||
|
@ -195,13 +195,4 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
return loc;
|
||||
}
|
||||
|
||||
@override
|
||||
bool matchAgainstString(String filter) {
|
||||
|
||||
if (name.toLowerCase().contains(filter)) return true;
|
||||
|
||||
if (description.toLowerCase().contains(filter)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user