diff --git a/assets/release_notes.md b/assets/release_notes.md index 60448e9b..6b7bc7d2 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -1,6 +1,13 @@ ## InvenTree App Release Notes --- +### 0.2.10 - July 2021 +--- + +- Add "last updated" date to StockDetail view +- Add "stocktake" date to StockDetail view +- Display location of stock items in list view + ### 0.2.9 - July 2021 --- diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index cc5e66dc..559a5a7f 100644 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -6,8 +6,8 @@ export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build\ios" -export "FLUTTER_BUILD_NAME=0.2.9" -export "FLUTTER_BUILD_NUMBER=17" +export "FLUTTER_BUILD_NAME=0.2.10" +export "FLUTTER_BUILD_NUMBER=18" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=false" export "TREE_SHAKE_ICONS=false" diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index 865aa88b..889ed4d4 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -1,3 +1,4 @@ +import 'package:intl/intl.dart'; import 'package:inventree/inventree/part.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; @@ -222,20 +223,46 @@ class InvenTreeStockItem extends InvenTreeModel { int get trackingItemCount => (jsondata['tracking_items'] ?? 0) as int; // Date of last update - String get updated => jsondata["updated"] ?? ""; - - DateTime? get stocktakeDate { - if (jsondata.containsKey("stocktake_date")) { - if (jsondata["stocktake_date"] == null) { - return null; - } - - return DateTime.tryParse(jsondata["stocktake_date"]) ?? null; + DateTime? get updatedDate { + if (jsondata.containsKey("updated")) { + return DateTime.tryParse(jsondata["updated"] ?? ''); } else { return null; } } + String? get updatedDateString { + var _updated = updatedDate; + + if (_updated == null) { + return null; + } + + final DateFormat _format = DateFormat("yyyy-MM-dd"); + + return _format.format(_updated); + } + + DateTime? get stocktakeDate { + if (jsondata.containsKey("stocktake_date")) { + return DateTime.tryParse(jsondata["stocktake_date"] ?? ''); + } else { + return null; + } + } + + String? get stocktakeDateString { + var _stocktake = stocktakeDate; + + if (_stocktake == null) { + return null; + } + + final DateFormat _format = DateFormat("yyyy-MM-dd"); + + return _format.format(_stocktake); + } + String get partName { String nm = ''; @@ -388,7 +415,13 @@ class InvenTreeStockItem extends InvenTreeModel { if (locationId == -1 || !jsondata.containsKey('location_detail')) return L10().locationNotSet; - return jsondata['location_detail']['pathstring'] ?? ''; + String _loc = jsondata['location_detail']['pathstring'] ?? ''; + + if (_loc.isNotEmpty) { + return _loc; + } else { + return locationName; + } } String get displayQuantity { diff --git a/lib/l10n b/lib/l10n index 0870256f..af4cd902 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit 0870256fb97a27ccf0ab73b4665b886ca0abb4aa +Subproject commit af4cd9026a96d44d60f9187119f5ce19c74738d3 diff --git a/lib/widget/location_display.dart b/lib/widget/location_display.dart index ae8d1692..a6313382 100644 --- a/lib/widget/location_display.dart +++ b/lib/widget/location_display.dart @@ -517,7 +517,7 @@ class _PaginatedStockListState extends State { Widget _buildItem(BuildContext context, InvenTreeStockItem item) { return ListTile( title: Text("${item.partName}"), - subtitle: Text("${item.partDescription}"), + subtitle: Text("${item.locationPathString}"), leading: InvenTreeAPI().getImage( item.partThumbnail, width: 40, diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index fd50798c..1029b021 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -418,7 +418,32 @@ class _StockItemDisplayState extends RefreshableState { ); } + // Last update? + var update_date = item.updatedDateString; + + if (update_date != null) { + + tiles.add( + ListTile( + title: Text(L10().lastUpdated), + subtitle: Text(update_date), + leading: FaIcon(FontAwesomeIcons.calendarAlt) + ) + ); + } + // Stocktake? + var stocktake_date = item.stocktakeDateString; + + if (stocktake_date != null) { + tiles.add( + ListTile( + title: Text(L10().lastStocktake), + subtitle: Text(stocktake_date), + leading: FaIcon(FontAwesomeIcons.calendarAlt) + ) + ); + } // Supplier part? // TODO: Display supplier part info page? diff --git a/pubspec.yaml b/pubspec.yaml index 4b76b81b..6bea3c99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ description: InvenTree stock management # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.2.9+17 +version: 0.2.10+18 environment: sdk: ">=2.12.0 <3.0.0"