mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-30 21:05:42 +00:00 
			
		
		
		
	Include category detail when requesting part information
This commit is contained in:
		| @@ -132,6 +132,13 @@ class InvenTreePart extends InvenTreeModel { | |||||||
|   @override |   @override | ||||||
|   String URL = "part/"; |   String URL = "part/"; | ||||||
|  |  | ||||||
|  |   @override | ||||||
|  |   Map<String, String> defaultGetFilters() { | ||||||
|  |     return { | ||||||
|  |       "category_detail": "1",   // Include category detail information | ||||||
|  |     }; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>(); |   List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>(); | ||||||
|  |  | ||||||
|   int get testTemplateCount => testingTemplates.length; |   int get testTemplateCount => testingTemplates.length; | ||||||
| @@ -195,7 +202,10 @@ class InvenTreePart extends InvenTreeModel { | |||||||
|     int get categoryId => jsondata['category'] as int ?? null; |     int get categoryId => jsondata['category'] as int ?? null; | ||||||
|  |  | ||||||
|     // Get the category name for the Part instance |     // Get the category name for the Part instance | ||||||
|     String get categoryName => jsondata['category_name'] ?? ''; |     String get categoryName => jsondata['category_detail']['name'] as String ?? ''; | ||||||
|  |  | ||||||
|  |     // Get the category description for the Part instance | ||||||
|  |     String get categoryDescription => jsondata['category_detail']['description'] as String ?? ''; | ||||||
|  |  | ||||||
|     // Get the image URL for the Part instance |     // Get the image URL for the Part instance | ||||||
|     String get _image  => jsondata['image'] ?? ''; |     String get _image  => jsondata['image'] ?? ''; | ||||||
|   | |||||||
| @@ -102,6 +102,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> { | |||||||
|             ListTile( |             ListTile( | ||||||
|               title: Text("Parent Category"), |               title: Text("Parent Category"), | ||||||
|               subtitle: Text("${category.parentpathstring}"), |               subtitle: Text("${category.parentpathstring}"), | ||||||
|  |               leading: FaIcon(FontAwesomeIcons.sitemap), | ||||||
|               onTap: () { |               onTap: () { | ||||||
|                 if (category.parentId < 0) { |                 if (category.parentId < 0) { | ||||||
|                   Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null))); |                   Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null))); | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> { | |||||||
|   // Function to construct an appbar (override if needed) |   // Function to construct an appbar (override if needed) | ||||||
|   AppBar getAppBar(BuildContext context) { |   AppBar getAppBar(BuildContext context) { | ||||||
|     return AppBar( |     return AppBar( | ||||||
|       title: Text(getAppBarTitle(context)) |       title: Text(getAppBarTitle(context)), | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user