mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-30 21:05:42 +00:00 
			
		
		
		
	Show / hide test results tile based on part
This commit is contained in:
		| @@ -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,6 +434,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> { | |||||||
|       ); |       ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if ((item.testResultCount > 0) || (part != null && part.isTrackable)) { | ||||||
|       tiles.add( |       tiles.add( | ||||||
|           ListTile( |           ListTile( | ||||||
|               title: Text(I18N.of(context).testResults), |               title: Text(I18N.of(context).testResults), | ||||||
| @@ -425,15 +443,18 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> { | |||||||
|               onTap: () { |               onTap: () { | ||||||
|                 Navigator.push( |                 Navigator.push( | ||||||
|                     context, |                     context, | ||||||
|                 MaterialPageRoute(builder: (context) => StockItemTestResultsWidget(item)) |                     MaterialPageRoute( | ||||||
|  |                         builder: (context) => StockItemTestResultsWidget(item)) | ||||||
|                 ).then((context) { |                 ).then((context) { | ||||||
|                   refresh(); |                   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), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user