mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 05:56:47 +00:00
Display either serial number or quantity depending on stock properties
This commit is contained in:
parent
5382ded50c
commit
04b09b5591
@ -121,6 +121,8 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
|
|
||||||
int get locationId => jsondata['location'] as int ?? -1;
|
int get locationId => jsondata['location'] as int ?? -1;
|
||||||
|
|
||||||
|
bool isSerialized() => serialNumber != null && quantity.toInt() == 1;
|
||||||
|
|
||||||
String get locationName {
|
String get locationName {
|
||||||
String loc = '';
|
String loc = '';
|
||||||
|
|
||||||
|
@ -74,13 +74,25 @@ class _StockItemDisplayState extends State<StockDetailWidget> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Quantity information
|
// Quantity information
|
||||||
tiles.add(
|
if (item.isSerialized()) {
|
||||||
ListTile(
|
tiles.add(
|
||||||
title: Text("Quantity"),
|
ListTile(
|
||||||
leading: FaIcon(FontAwesomeIcons.cubes),
|
title: Text("Serial Number"),
|
||||||
trailing: Text("${item.quantity}"),
|
leading: FaIcon(FontAwesomeIcons.hashtag),
|
||||||
)
|
trailing: Text("${item.serialNumber}"),
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
tiles.add(
|
||||||
|
ListTile(
|
||||||
|
title: Text("Quantity"),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.cubes),
|
||||||
|
trailing: Text("${item.quantity}"),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Location information
|
// Location information
|
||||||
if (item.locationName.isNotEmpty) {
|
if (item.locationName.isNotEmpty) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user