mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 04:35:26 +00:00
Display part image in stock list
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import 'model.dart';
|
||||
|
||||
import 'package:InvenTree/api.dart';
|
||||
|
||||
class InvenTreeStockItem extends InvenTreeModel {
|
||||
@override
|
||||
@ -11,12 +12,28 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
// TODO
|
||||
}
|
||||
|
||||
String get partName => jsondata['part_name'] as String ?? '';
|
||||
String get partName => jsondata['part__name'] as String ?? '';
|
||||
|
||||
String get partDescription => jsondata['part__description'] as String ?? '';
|
||||
|
||||
String get partThumbnail => jsondata['part__thumbnail'] as String ?? InvenTreeAPI.staticThumb;
|
||||
|
||||
int get serialNumber => jsondata['serial'] as int ?? null;
|
||||
|
||||
double get quantity => jsondata['quantity'] as double ?? 0.0;
|
||||
|
||||
int get locationId => jsondata['location'] as int ?? -1;
|
||||
|
||||
String get displayQuantity {
|
||||
// Display either quantity or serial number!
|
||||
|
||||
if (serialNumber != null) {
|
||||
return "SN: $serialNumber";
|
||||
} else {
|
||||
return quantity.toString().trim();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
var item = InvenTreeStockItem.fromJson(json);
|
||||
|
Reference in New Issue
Block a user