2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Api filtering (#197)

* Add extra filtering options for the PartCategory list

(cherry picked from commit c7b594fd0bfafdde1298f8d3cf503871762b49eb)

* Extra filtering options for stock location list

(cherry picked from commit 5e9bfcfbc336831bfd2bb4414fc1794420c89e0d)
This commit is contained in:
Oliver 2022-08-01 12:25:13 +10:00 committed by GitHub
parent b5d26580b4
commit 2cbcf275ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -6,6 +6,8 @@ import "package:inventree/inventree/part.dart";
import "package:inventree/widget/category_display.dart";
import "package:inventree/widget/paginator.dart";
import "package:inventree/widget/refreshable_state.dart";
import "package:inventree/api.dart";
import "package:inventree/l10.dart";
class PartCategoryList extends StatefulWidget {
@ -76,10 +78,22 @@ class _PaginatedPartCategoryListState extends PaginatedSearchState<PaginatedPart
};
@override
Map<String, String> get orderingOptions => {
"name": L10().name,
"level": L10().level,
};
Map<String, String> get orderingOptions {
Map<String, String> options = {
"name": L10().name,
"level": L10().level,
};
// Note: API v69 changed 'parts' to 'part_count'
if (InvenTreeAPI().apiVersion >= 69) {
options["part_count"] = L10().parts;
} else {
options["parts"] = L10().parts;
}
return options;
}
@override
Future<InvenTreePageResponse?> requestPage(int limit, int offset, Map<String, String> params) async {

View File

@ -67,6 +67,7 @@ class _PaginatedStockLocationListState extends PaginatedSearchState<PaginatedSto
@override
Map<String, String> get orderingOptions => {
"name": L10().name,
"items": L10().stockItems,
"level": L10().level,
};