2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

StockLocation display now improved

- Expandable list of sublocations
- Expandable list of stockitems
- Traverse upward (to higher locations)
- Fix rendering of unknown part thumbnails
This commit is contained in:
Oliver Walters
2020-04-05 23:10:36 +10:00
parent 04ad279c58
commit 4c8bbd46e7
5 changed files with 154 additions and 46 deletions

View File

@ -15,6 +15,7 @@ class InvenTreePartCategory extends InvenTreeModel {
String get pathstring => jsondata['pathstring'] ?? '';
String get parentpathstring {
// TODO - Drive the refactor tractor through this
List<String> psplit = pathstring.split("/");
if (psplit.length > 0) {
@ -24,7 +25,7 @@ class InvenTreePartCategory extends InvenTreeModel {
String p = psplit.join("/");
if (p.isEmpty) {
p = "Top level parts category";
p = "Top level part category";
}
return p;

View File

@ -16,7 +16,13 @@ class InvenTreeStockItem extends InvenTreeModel {
String get partDescription => jsondata['part__description'] as String ?? '';
String get partThumbnail => jsondata['part__thumbnail'] as String ?? InvenTreeAPI.staticThumb;
String get partThumbnail {
String thumb = jsondata['part__thumbnail'] as String ?? '';
if (thumb.isEmpty) thumb = InvenTreeAPI.staticThumb;
return thumb;
}
int get serialNumber => jsondata['serial'] as int ?? null;
@ -49,10 +55,31 @@ class InvenTreeStockLocation extends InvenTreeModel {
@override
String URL = "stock/location/";
String get pathstring => jsondata['pathstring'] ?? '';
String get parentpathstring {
// TODO - Drive the refactor tractor through this
List<String> psplit = pathstring.split('/');
if (psplit.length > 0) {
psplit.removeLast();
}
String p = psplit.join('/');
if (p.isEmpty) {
p = "Top level stock location";
}
return p;
}
int get itemcount => jsondata['items'] ?? 0;
InvenTreeStockLocation() : super();
InvenTreeStockLocation.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
// TODO
}
@override