Update main.js to compute total from the unitprice's defined in the window context
This commit is contained in:
		
					parent
					
						
							
								82a2014fa5
							
						
					
				
			
			
				commit
				
					
						aa55c1e868
					
				
			
		
					 1 changed files with 12 additions and 1 deletions
				
			
		|  | @ -171,7 +171,18 @@ | |||
|     } | ||||
| 
 | ||||
|     function _calcPricing() { | ||||
|         var total = (cardPricing['cpu'].value * 5) + (2 * cardPricing['ram'].value) + (0.6 * cardPricing['storage'].value); | ||||
|         if(typeof window.coresUnitPrice === 'undefined'){ | ||||
|             window.coresUnitPrice = 5; | ||||
|         } | ||||
|         if(typeof window.ramUnitPrice === 'undefined'){ | ||||
|             window.coresUnitPrice = 2; | ||||
|         } | ||||
|         if(typeof window.ssdUnitPrice === 'undefined'){ | ||||
|             window.ssdUnitPrice = 0.6; | ||||
|         } | ||||
|         var total = (cardPricing['cpu'].value * window.coresUnitPrice) + | ||||
|                     (cardPricing['ram'].value * window.ramUnitPrice) + | ||||
|                     (cardPricing['storage'].value * window.ssdUnitPrice); | ||||
|         total = parseFloat(total.toFixed(2)); | ||||
|         $("#total").text(total); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue