From aa4317a2fe403d34f230624f2b107c1aee10bda7 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 3 Jun 2022 19:51:08 +1000 Subject: [PATCH] Add support for "quarantined" stock item status --- assets/release_notes.md | 5 +++++ lib/inventree/stock.dart | 9 +++++++-- lib/l10n/app_en.arb | 3 +++ lib/widget/stock_detail.dart | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/assets/release_notes.md b/assets/release_notes.md index 23c44dcc..a330e6f0 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -1,6 +1,11 @@ ## InvenTree App Release Notes --- +### 0.7.2 - June 2022 +--- + +- Add "quarantined" status flag for stock items + ### 0.7.1 - May 2022 --- diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index 50b5ebe7..b60eb957 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -129,11 +129,12 @@ class InvenTreeStockItem extends InvenTreeModel { static const int DESTROYED = 60; static const int REJECTED = 65; static const int LOST = 70; + static const int QUARANTINED = 75; static const int RETURNED = 85; - String statusLabel(BuildContext context) { + String statusLabel() { - // TODO: Delete me - The translated status values are provided by the API! + // TODO: Delete me - The translated status values should be provided by the API! switch (status) { case OK: @@ -148,6 +149,8 @@ class InvenTreeStockItem extends InvenTreeModel { return L10().rejected; case LOST: return L10().lost; + case QUARANTINED: + return L10().quarantined; case RETURNED: return L10().returned; default: @@ -166,6 +169,8 @@ class InvenTreeStockItem extends InvenTreeModel { case DESTROYED: case REJECTED: return Color(0xFFe35a57); + case QUARANTINED: + return Color(0xFF0DCAF0); case LOST: default: return Color(0xFFAAAAAA); diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f6e60649..64223ddc 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -664,6 +664,9 @@ "quantityPositive": "Quantity must be positive", "@quantityPositive": {}, + "quarantined": "Quarantined", + "@quarantined": {}, + "queryEmpty": "Enter search query", "@queryEmpty": {}, diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 62058f2f..8c1a376d 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -458,7 +458,7 @@ class _StockItemDisplayState extends RefreshableState { subtitle: Text("${item.partDescription}"), leading: InvenTreeAPI().getImage(item.partImage), trailing: Text( - item.statusLabel(context), + item.statusLabel(), style: TextStyle( color: item.statusColor )