mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Updates!
- Add "last update date" to StockDetail view - Add 'stocktake date" to StockDetail view
This commit is contained in:
parent
f425391301
commit
c99be189bb
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:inventree/inventree/part.dart';
|
import 'package:inventree/inventree/part.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
@ -222,20 +223,46 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
int get trackingItemCount => (jsondata['tracking_items'] ?? 0) as int;
|
int get trackingItemCount => (jsondata['tracking_items'] ?? 0) as int;
|
||||||
|
|
||||||
// Date of last update
|
// Date of last update
|
||||||
String get updated => jsondata["updated"] ?? "";
|
DateTime? get updatedDate {
|
||||||
|
if (jsondata.containsKey("updated")) {
|
||||||
DateTime? get stocktakeDate {
|
return DateTime.tryParse(jsondata["updated"] ?? '');
|
||||||
if (jsondata.containsKey("stocktake_date")) {
|
|
||||||
if (jsondata["stocktake_date"] == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DateTime.tryParse(jsondata["stocktake_date"]) ?? null;
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
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 get partName {
|
||||||
|
|
||||||
String nm = '';
|
String nm = '';
|
||||||
|
2
lib/l10n
2
lib/l10n
@ -1 +1 @@
|
|||||||
Subproject commit 84f6ed3faf63cbf371016e134196400e5f822759
|
Subproject commit af4cd9026a96d44d60f9187119f5ce19c74738d3
|
@ -418,7 +418,32 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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?
|
// 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?
|
// Supplier part?
|
||||||
// TODO: Display supplier part info page?
|
// TODO: Display supplier part info page?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user