mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-15 03:35:28 +00:00
Stock expiry (#590)
* Add stock expiry getters * refactor date getters * Display expiry information * Update release notes * Remove unused import
This commit is contained in:
@ -53,6 +53,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
|
||||
bool stockShowHistory = false;
|
||||
bool stockShowTests = true;
|
||||
bool expiryEnabled = false;
|
||||
|
||||
// Linked data fields
|
||||
InvenTreePart? part;
|
||||
@ -231,6 +232,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
expiryEnabled = await api.getGlobalBooleanSetting("STOCK_ENABLE_EXPIRY");
|
||||
|
||||
// Request part information
|
||||
part = await InvenTreePart().get(widget.item.partId) as InvenTreePart?;
|
||||
|
||||
@ -731,6 +734,26 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
if (expiryEnabled && widget.item.expiryDate != null) {
|
||||
|
||||
Widget? _expiryIcon;
|
||||
|
||||
if (widget.item.stale) {
|
||||
_expiryIcon = Text(L10().expiryStale, style: TextStyle(color: COLOR_WARNING));
|
||||
} else if (widget.item.expired) {
|
||||
_expiryIcon = Text(L10().expiryExpired, style: TextStyle(color: COLOR_DANGER));
|
||||
}
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().expiryDate),
|
||||
subtitle: Text(widget.item.expiryDateString),
|
||||
leading: Icon(TablerIcons.calendar_x),
|
||||
trailing: _expiryIcon,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Last update?
|
||||
if (widget.item.updatedDateString.isNotEmpty) {
|
||||
|
||||
|
Reference in New Issue
Block a user