2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 11:45:31 +00:00

Stock display (#379)

* Display stock quantity more prominently

* Cleanup search widget

* Update for stock_detail widget

* More tweaks

* Change bottom bar icon

* Display boolean parameters appropriately

* Adds ability to edit part parameters

* Bump icon size a bit

* Improvements to filter options

- Allow filtering by "option" type
- To start with, filter stock by status code

* Remove debug message

* Remove getTriState method

- No longer needed
- Remove associated unit tests

* Adjust filters based on server API version

* Muted colors
This commit is contained in:
Oliver
2023-06-24 11:34:42 +10:00
committed by GitHub
parent 8076887e39
commit e9eb84eace
20 changed files with 278 additions and 167 deletions

View File

@ -577,8 +577,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
subtitle: Text("${widget.item.partDescription}"),
leading: InvenTreeAPI().getThumbnail(widget.item.partImage),
trailing: Text(
api.StockStatus.label(widget.item.status),
widget.item.quantityString(),
style: TextStyle(
fontSize: 20,
color: api.StockStatus.color(widget.item.status),
)
),
@ -615,6 +616,41 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
return tiles;
}
// Location information
if ((widget.item.locationId > 0) && (widget.item.locationName.isNotEmpty)) {
tiles.add(
ListTile(
title: Text(L10().stockLocation),
subtitle: Text("${widget.item.locationPathString}"),
leading: FaIcon(
FontAwesomeIcons.locationDot,
color: COLOR_ACTION,
),
onTap: () async {
if (widget.item.locationId > 0) {
showLoadingOverlay(context);
var loc = await InvenTreeStockLocation().get(widget.item.locationId);
hideLoadingOverlay();
if (loc is InvenTreeStockLocation) {
Navigator.push(context, MaterialPageRoute(
builder: (context) => LocationDisplayWidget(loc)));
}
}
},
),
);
} else {
tiles.add(
ListTile(
title: Text(L10().stockLocation),
leading: FaIcon(FontAwesomeIcons.locationDot),
subtitle: Text(L10().locationNotSet),
)
);
}
// Quantity information
if (widget.item.isSerialized()) {
tiles.add(
@ -634,40 +670,19 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
);
}
// Location information
if ((widget.item.locationId > 0) && (widget.item.locationName.isNotEmpty)) {
tiles.add(
ListTile(
title: Text(L10().stockLocation),
subtitle: Text("${widget.item.locationPathString}"),
leading: FaIcon(
FontAwesomeIcons.locationDot,
color: COLOR_ACTION,
),
onTap: () async {
if (widget.item.locationId > 0) {
showLoadingOverlay(context);
var loc = await InvenTreeStockLocation().get(widget.item.locationId);
hideLoadingOverlay();
if (loc is InvenTreeStockLocation) {
Navigator.push(context, MaterialPageRoute(
builder: (context) => LocationDisplayWidget(loc)));
}
}
},
),
);
} else {
tiles.add(
ListTile(
title: Text(L10().stockLocation),
leading: FaIcon(FontAwesomeIcons.locationDot),
subtitle: Text(L10().locationNotSet),
// Stock item status information
tiles.add(
ListTile(
title: Text(L10().status),
leading: FaIcon(FontAwesomeIcons.circleInfo),
trailing: Text(
api.StockStatus.label(widget.item.status),
style: TextStyle(
color: api.StockStatus.color(widget.item.status),
)
);
}
)
)
);
// Supplier part information (if available)
if (widget.item.supplierPartId > 0) {
@ -676,7 +691,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
title: Text(L10().supplierPart),
subtitle: Text(widget.item.supplierSKU),
leading: FaIcon(FontAwesomeIcons.building, color: COLOR_ACTION),
trailing: InvenTreeAPI().getThumbnail(widget.item.supplierImage),
trailing: InvenTreeAPI().getThumbnail(widget.item.supplierImage, hideIfNull: true),
onTap: () async {
showLoadingOverlay(context);
var sp = await InvenTreeSupplierPart().get(