mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Merge pull request #2635 from SchrodingersGat/test-result-quick
Adds a button to quickly "pass" a test
This commit is contained in:
		| @@ -311,6 +311,27 @@ | |||||||
|         }); |         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     $('#test-result-table').on('click', '.button-test-tick', function() { | ||||||
|  |         var button = $(this); | ||||||
|  |  | ||||||
|  |         var test_name = button.attr('pk'); | ||||||
|  |  | ||||||
|  |         inventreePut( | ||||||
|  |             '{% url "api-stock-test-result-list" %}', | ||||||
|  |             { | ||||||
|  |                 test: test_name, | ||||||
|  |                 result: true, | ||||||
|  |                 stock_item: {{ item.pk }}, | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 method: 'POST', | ||||||
|  |                 success: function(response) { | ||||||
|  |                     reloadTable(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         ); | ||||||
|  |     }) | ||||||
|  |  | ||||||
|     $("#test-result-table").on('click', '.button-test-add', function() { |     $("#test-result-table").on('click', '.button-test-add', function() { | ||||||
|         var button = $(this); |         var button = $(this); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1235,6 +1235,11 @@ function loadStockTestResultsTable(table, options) { | |||||||
|     function makeButtons(row, grouped) { |     function makeButtons(row, grouped) { | ||||||
|         var html = `<div class='btn-group float-right' role='group'>`; |         var html = `<div class='btn-group float-right' role='group'>`; | ||||||
|  |  | ||||||
|  |         if (row.requires_attachment == false && row.requires_value == false && !row.result) { | ||||||
|  |             // Enable a "quick tick" option for this test result | ||||||
|  |             html += makeIconButton('fa-check-circle icon-green', 'button-test-tick', row.test_name, '{% trans "Pass test" %}'); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         html += makeIconButton('fa-plus icon-green', 'button-test-add', row.test_name, '{% trans "Add test result" %}'); |         html += makeIconButton('fa-plus icon-green', 'button-test-add', row.test_name, '{% trans "Add test result" %}'); | ||||||
|  |  | ||||||
|         if (!grouped && row.result != null) { |         if (!grouped && row.result != null) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user