mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Update javascript rendering in build table
This commit is contained in:
		| @@ -1425,19 +1425,36 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { | ||||
|                 title: '{% trans "Available" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value, row) { | ||||
|                     var total = row.available_stock + row.available_substitute_stock; | ||||
|  | ||||
|                     var text = `${total}`; | ||||
|                     var url = `/part/${row.sub_part_detail.pk}/?display=part-stock`; | ||||
|  | ||||
|                     if (total <= 0) { | ||||
|                     // Calculate total "available" (unallocated) quantity | ||||
|                     var base_stock = row.available_stock; | ||||
|                     var substitute_stock = row.available_substitute_stock || 0; | ||||
|                     var variant_stock = row.allow_variants ? (row.available_variant_stock || 0) : 0; | ||||
|  | ||||
|                     var available_stock = base_stock + substitute_stock + variant_stock; | ||||
|              | ||||
|                     var text = `${available_stock}`; | ||||
|  | ||||
|                     if (available_stock <= 0) { | ||||
|                         text = `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`; | ||||
|                     } else { | ||||
|                         if (row.available_substitute_stock > 0) { | ||||
|                             text += `<span title='{% trans "Includes substitute stock" %}' class='fas fa-info-circle float-right icon-blue'></span>`; | ||||
|                         var extra = ''; | ||||
|                         if ((substitute_stock > 0) && (variant_stock > 0)) { | ||||
|                             extra = '{% trans "Includes variant and substitute stock" %}'; | ||||
|                         } else if (variant_stock > 0) { | ||||
|                             extra = '{% trans "Includes variant stock" %}'; | ||||
|                         } else if (substitute_stock > 0) { | ||||
|                             extra = '{% trans "Includes substitute stock" %}'; | ||||
|                         } | ||||
|          | ||||
|                         if (extra) { | ||||
|                             text += `<span title='${extra}' class='fas fa-info-circle float-right icon-blue'></span>`; | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
|                     return text; | ||||
|          | ||||
|                     return renderLink(text, url); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user