From 48d5c2e5606f48efabce61fc92e5d6db0cf93b19 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 2 Aug 2021 20:07:29 +1000 Subject: [PATCH] Display number of items on order --- lib/inventree/part.dart | 9 +++++++++ lib/widget/part_detail.dart | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/inventree/part.dart b/lib/inventree/part.dart index b85f5e79..60f12996 100644 --- a/lib/inventree/part.dart +++ b/lib/inventree/part.dart @@ -215,6 +215,15 @@ class InvenTreePart extends InvenTreeModel { // Get the number of stock on order for this Part double get onOrder => double.tryParse(jsondata['ordering'].toString()) ?? 0; + String get onOrderString { + + if (onOrder == onOrder.toInt()) { + return onOrder.toInt().toString(); + } else { + return onOrder.toString(); + } + } + // Get the stock count for this Part double get inStock => double.tryParse(jsondata['in_stock'].toString()) ?? 0; diff --git a/lib/widget/part_detail.dart b/lib/widget/part_detail.dart index 952c8495..95ea3f78 100644 --- a/lib/widget/part_detail.dart +++ b/lib/widget/part_detail.dart @@ -346,7 +346,7 @@ class _PartDisplayState extends RefreshableState { title: Text(L10().onOrder), subtitle: Text(L10().onOrderDetails), leading: FaIcon(FontAwesomeIcons.shoppingCart), - trailing: Text("${part.onOrder}"), + trailing: Text("${part.onOrderString}"), onTap: () { // TODO - Order views },