mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Request list of supplierparts
This commit is contained in:
parent
21985584c2
commit
013e977031
2 changed files with 25 additions and 4 deletions
|
|
@ -165,7 +165,30 @@ class InvenTreePart extends InvenTreeModel {
|
|||
});
|
||||
}
|
||||
|
||||
int get supplier_count => (jsondata['suppliers'] ?? 0) as int;
|
||||
int get supplierCount => (jsondata['suppliers'] ?? 0) as int;
|
||||
|
||||
// Request supplier parts for this part
|
||||
Future<List<InvenTreeSupplierPart>> getSupplierParts() async {
|
||||
List<InvenTreeSupplierPart> _supplierParts = [];
|
||||
|
||||
final parts = await InvenTreeSupplierPart().list(
|
||||
filters: {
|
||||
"part": "${pk}",
|
||||
"manufacturer_detail": "true",
|
||||
"supplier_detail": "true",
|
||||
"supplier_part_detail": "true"
|
||||
}
|
||||
);
|
||||
|
||||
for (result in parts) {
|
||||
if (result is InvenTreeSupplierPart) {
|
||||
_supplierParts.add(result);
|
||||
}
|
||||
}
|
||||
|
||||
return _supplierParts;
|
||||
}
|
||||
|
||||
|
||||
// Cached list of test templates
|
||||
List<InvenTreePartTestTemplate> testingTemplates = [];
|
||||
|
|
|
|||
|
|
@ -325,13 +325,11 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
// Tiles for "purchaseable" parts
|
||||
if (part.isPurchaseable) {
|
||||
|
||||
// Suppliers (TODO)
|
||||
if (part.supplier_count > 0) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().suppliers),
|
||||
leading: FaIcon(FontAwesomeIcons.industry),
|
||||
trailing: Text("${part.supplier_count}"),
|
||||
trailing: Text("${part.supplierCount}"),
|
||||
onTap: () {
|
||||
// TODO
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue