2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Bom optional (#227)

* Split part settings onto different screen

* show_bom setting controls whether BOM information is displayed

* linting
This commit is contained in:
Oliver
2022-12-04 23:05:35 +11:00
committed by GitHub
parent 971c6bfcdb
commit efb6fc353e
7 changed files with 145 additions and 95 deletions

View File

@ -53,6 +53,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
bool showParameters = false;
bool showBom = false;
int attachmentCount = 0;
int bomCount = 0;
@ -169,6 +171,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
}
});
showBom = await InvenTreeSettingsManager().getValue(INV_PART_SHOW_BOM, true) as bool;
// Request the number of BOM items
InvenTreePart().count(
filters: {
@ -424,7 +428,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
// Tiles for an "assembly" part
if (part.isAssembly) {
if (bomCount > 0) {
if (showBom && bomCount > 0) {
tiles.add(
ListTile(
title: Text(L10().billOfMaterials),
@ -457,7 +461,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
}
if (part.isComponent) {
if (usedInCount > 0) {
if (showBom && usedInCount > 0) {
tiles.add(
ListTile(
title: Text(L10().usedIn),
@ -534,21 +538,6 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
);
}
// Notes field
tiles.add(
ListTile(
title: Text(L10().notes),
leading: FaIcon(FontAwesomeIcons.stickyNote, color: COLOR_CLICK),
trailing: Text(""),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PartNotesWidget(part))
);
},
)
);
if (showParameters) {
tiles.add(
ListTile(
@ -567,6 +556,21 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
);
}
// Notes field
tiles.add(
ListTile(
title: Text(L10().notes),
leading: FaIcon(FontAwesomeIcons.stickyNote, color: COLOR_CLICK),
trailing: Text(""),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PartNotesWidget(part))
);
},
)
);
tiles.add(
ListTile(
title: Text(L10().attachments),