mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Include category detail when requesting part information
This commit is contained in:
parent
b4710b56e3
commit
153bb1c077
@ -132,6 +132,13 @@ class InvenTreePart extends InvenTreeModel {
|
||||
@override
|
||||
String URL = "part/";
|
||||
|
||||
@override
|
||||
Map<String, String> defaultGetFilters() {
|
||||
return {
|
||||
"category_detail": "1", // Include category detail information
|
||||
};
|
||||
}
|
||||
|
||||
List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>();
|
||||
|
||||
int get testTemplateCount => testingTemplates.length;
|
||||
@ -195,7 +202,10 @@ class InvenTreePart extends InvenTreeModel {
|
||||
int get categoryId => jsondata['category'] as int ?? null;
|
||||
|
||||
// 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
|
||||
String get _image => jsondata['image'] ?? '';
|
||||
|
@ -102,6 +102,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
ListTile(
|
||||
title: Text("Parent Category"),
|
||||
subtitle: Text("${category.parentpathstring}"),
|
||||
leading: FaIcon(FontAwesomeIcons.sitemap),
|
||||
onTap: () {
|
||||
if (category.parentId < 0) {
|
||||
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)
|
||||
AppBar getAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
title: Text(getAppBarTitle(context))
|
||||
title: Text(getAppBarTitle(context)),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user