mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
More display items for Part view:
- BOM count - Used in count - Notes
This commit is contained in:
parent
d1fba27f3a
commit
fbd52e1414
4 changed files with 85 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_advanced_networkimage/provider.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class CategoryDisplayWidget extends StatefulWidget {
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||
if (category == null) {
|
||||
return "Part Categories";
|
||||
} else {
|
||||
return "Part Category '${category.name}'";
|
||||
return "Part Category - ${category.name}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,6 +83,28 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||
});
|
||||
}
|
||||
|
||||
Widget getCategoryDescriptionCard() {
|
||||
if (category == null) {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text("Part Categories"),
|
||||
subtitle: Text("Top level part category"),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text("${category.name}"),
|
||||
subtitle: Text("${category.description}"),
|
||||
trailing: IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.edit),
|
||||
onPressed: null,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
@ -91,8 +114,10 @@ class _CategoryDisplayState extends State<CategoryDisplayWidget> {
|
|||
drawer: new InvenTreeDrawer(context),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
getCategoryDescriptionCard(),
|
||||
Text(
|
||||
"Subcategories - ${_subcategories.length}",
|
||||
textAlign: TextAlign.left,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
image: InvenTreeAPI().getImage(part.image)
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.edit),
|
||||
icon: FaIcon(FontAwesomeIcons.edit),
|
||||
onPressed: null,
|
||||
),
|
||||
)
|
||||
|
|
@ -73,7 +73,8 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
tiles.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text("${part.categoryName}"),
|
||||
title: Text("Part Category"),
|
||||
subtitle: Text("${part.categoryName}"),
|
||||
leading: FaIcon(FontAwesomeIcons.stream),
|
||||
onTap: () {
|
||||
InvenTreePartCategory().get(part.categoryId).then((var cat) {
|
||||
|
|
@ -92,6 +93,8 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
child: ListTile(
|
||||
title: Text("${part.link}"),
|
||||
leading: FaIcon(FontAwesomeIcons.link),
|
||||
trailing: Text(""),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
@ -103,10 +106,9 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
child: ListTile(
|
||||
title: Text("In Stock"),
|
||||
leading: FaIcon(FontAwesomeIcons.boxes),
|
||||
trailing: FlatButton(
|
||||
child: Text("${part.inStock}")
|
||||
),
|
||||
)
|
||||
trailing: Text("${part.inStock}"),
|
||||
onTap: null,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
|
@ -118,6 +120,7 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
title: Text("On Order"),
|
||||
leading: FaIcon(FontAwesomeIcons.shoppingCart),
|
||||
trailing: Text("${part.onOrder}"),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
@ -125,12 +128,52 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
|
||||
// Parts being built
|
||||
if (part.isAssembly) {
|
||||
|
||||
tiles.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text("Bill of Materials"),
|
||||
leading: FaIcon(FontAwesomeIcons.thList),
|
||||
trailing: Text("${part.bomItemCount}"),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text("Building"),
|
||||
leading: FaIcon(FontAwesomeIcons.tools),
|
||||
trailing: Text("${part.building}"),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (part.isComponent) {
|
||||
tiles.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text("Used In"),
|
||||
leading: FaIcon(FontAwesomeIcons.sitemap),
|
||||
trailing: Text("${part.usedInCount}"),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Notes field?
|
||||
if (part.notes.isNotEmpty) {
|
||||
tiles.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text("Notes"),
|
||||
leading: FaIcon(FontAwesomeIcons.stickyNote),
|
||||
trailing: Text(""),
|
||||
onTap: null,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
@ -152,7 +195,7 @@ class _PartDisplayState extends State<PartDisplayWidget> {
|
|||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: partTiles(),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue