mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-02 23:38:54 +00:00
Show / hide test results tile based on part
This commit is contained in:
parent
ddafed1fe6
commit
b9b261c060
@ -53,14 +53,31 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
final _editStockKey = GlobalKey<FormState>();
|
final _editStockKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
_StockItemDisplayState(this.item) {
|
_StockItemDisplayState(this.item) {
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StockItem object
|
||||||
final InvenTreeStockItem item;
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
|
// Part object
|
||||||
|
InvenTreePart part;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onBuild(BuildContext context) async {
|
||||||
|
|
||||||
|
// Load part data if not already loaded
|
||||||
|
if (part == null) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> request(BuildContext context) async {
|
Future<void> request(BuildContext context) async {
|
||||||
await item.reload(context);
|
await item.reload(context);
|
||||||
|
|
||||||
|
// Request part information
|
||||||
|
part = await InvenTreePart().get(context, item.partId);
|
||||||
|
|
||||||
|
// Request test results...
|
||||||
await item.getTestResults(context);
|
await item.getTestResults(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,23 +434,27 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles.add(
|
if ((item.testResultCount > 0) || (part != null && part.isTrackable)) {
|
||||||
ListTile(
|
tiles.add(
|
||||||
title: Text(I18N.of(context).testResults),
|
ListTile(
|
||||||
leading: FaIcon(FontAwesomeIcons.tasks),
|
title: Text(I18N.of(context).testResults),
|
||||||
trailing: Text("${item.testResultCount}"),
|
leading: FaIcon(FontAwesomeIcons.tasks),
|
||||||
onTap: () {
|
trailing: Text("${item.testResultCount}"),
|
||||||
Navigator.push(
|
onTap: () {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) => StockItemTestResultsWidget(item))
|
context,
|
||||||
).then((context) {
|
MaterialPageRoute(
|
||||||
refresh();
|
builder: (context) => StockItemTestResultsWidget(item))
|
||||||
});
|
).then((context) {
|
||||||
}
|
refresh();
|
||||||
)
|
});
|
||||||
);
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (item.trackingItemCount > 0) {
|
// TODO - Re-enable stock item history display
|
||||||
|
if (false && item.trackingItemCount > 0) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(I18N.of(context).history),
|
title: Text(I18N.of(context).history),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user