mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-30 21:05:42 +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:
		| @@ -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,11 +78,23 @@ class _PaginatedPartCategoryListState extends PaginatedSearchState<PaginatedPart | ||||
|   }; | ||||
|  | ||||
|   @override | ||||
|   Map<String, String> get orderingOptions => { | ||||
|   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 { | ||||
|  | ||||
|   | ||||
| @@ -67,6 +67,7 @@ class _PaginatedStockLocationListState extends PaginatedSearchState<PaginatedSto | ||||
|   @override | ||||
|   Map<String, String> get orderingOptions => { | ||||
|     "name": L10().name, | ||||
|     "items": L10().stockItems, | ||||
|     "level": L10().level, | ||||
|   }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user