From fd8fc9051a736406b561ba9c9e2b07dbe19320d6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 26 Mar 2022 18:58:59 +1100 Subject: [PATCH] Show if stock item is "in production" --- lib/inventree/stock.dart | 2 ++ lib/l10n | 2 +- lib/widget/stock_detail.dart | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index 38c018e4..2e85a201 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -230,6 +230,8 @@ class InvenTreeStockItem extends InvenTreeModel { int get trackingItemCount => (jsondata["tracking_items"] ?? 0) as int; + bool get isBuilding => (jsondata["is_building"] ?? false) as bool; + // Date of last update DateTime? get updatedDate { if (jsondata.containsKey("updated")) { diff --git a/lib/l10n b/lib/l10n index 42662619..77fe28ff 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit 42662619b3d094e9bd41d3f715cac2beff7cf6f6 +Subproject commit 77fe28ffc72f4be027751027016c1cf7a722af05 diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 36f67dcb..9a1ac7ae 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -706,7 +706,7 @@ class _StockItemDisplayState extends RefreshableState { }); } }, - ) + ), ); } else { tiles.add( @@ -718,6 +718,19 @@ class _StockItemDisplayState extends RefreshableState { ); } + if (item.isBuilding) { + tiles.add( + ListTile( + title: Text(L10().inProduction), + leading: FaIcon(FontAwesomeIcons.tools), + subtitle: Text(L10().inProductionDetail), + onTap: () { + // TODO: Click through to the "build order" + }, + ) + ); + } + if (item.batch.isNotEmpty) { tiles.add( ListTile(