mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-16 12:15: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:
@ -133,12 +133,29 @@ class InvenTreePartParameter extends InvenTreeModel {
|
||||
@override
|
||||
String get URL => "part/parameter/";
|
||||
|
||||
@override
|
||||
List<String> get rolesRequired => ["part"];
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) => InvenTreePartParameter.fromJson(json);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> formFields() {
|
||||
return {};
|
||||
|
||||
Map<String, dynamic> fields = {
|
||||
"header": {
|
||||
"type": "string",
|
||||
"read_only": true,
|
||||
"label": name,
|
||||
"help_text": description,
|
||||
"value": "",
|
||||
},
|
||||
"data": {
|
||||
"type": "string",
|
||||
}
|
||||
};
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -160,7 +177,11 @@ class InvenTreePartParameter extends InvenTreeModel {
|
||||
return v;
|
||||
}
|
||||
|
||||
bool get as_bool => value.toLowerCase() == "true";
|
||||
|
||||
String get units => getString("units", subKey: "template_detail");
|
||||
|
||||
bool get is_checkbox => getBool("checkbox", subKey: "template_detail", backup: false);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -23,6 +23,26 @@ class InvenTreeStatusCode {
|
||||
// Internal status code data loaded from server
|
||||
Map<String, dynamic> data = {};
|
||||
|
||||
/*
|
||||
* Construct a list of "choices" suitable for a form
|
||||
*/
|
||||
List<dynamic> get choices {
|
||||
List<dynamic> _choices = [];
|
||||
|
||||
for (String key in data.keys) {
|
||||
dynamic _entry = data[key];
|
||||
|
||||
if (_entry is Map<String, dynamic>) {
|
||||
_choices.add({
|
||||
"value": _entry["key"],
|
||||
"display_name": _entry["label"]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return _choices;
|
||||
}
|
||||
|
||||
// Load status code information from the server
|
||||
Future<void> load({bool forceReload = false}) async {
|
||||
|
||||
|
@ -399,7 +399,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
double get quantity => getDouble("quantity");
|
||||
|
||||
String quantityString({bool includeUnits = false}){
|
||||
String quantityString({bool includeUnits = true}){
|
||||
|
||||
String q = "";
|
||||
|
||||
@ -467,7 +467,13 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
if (serialNumber.isNotEmpty) {
|
||||
return "SN: $serialNumber";
|
||||
} else {
|
||||
return simpleNumberString(quantity);
|
||||
String q = simpleNumberString(quantity);
|
||||
|
||||
if (units.isNotEmpty) {
|
||||
q += " ${units}";
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user