fix(Purchase): set price based on product in all lines.
This commit is contained in:
		| @@ -25,5 +25,6 @@ document.addEventListener('DOMContentLoaded', function(){ | ||||
|  | ||||
|     formContainer.appendChild(newForm); | ||||
|     totalForms.value = formCount + 1; | ||||
|     setPriceListeners(); | ||||
|   }); | ||||
| }); | ||||
|   | ||||
| @@ -2,14 +2,11 @@ setPriceListeners(); | ||||
|  | ||||
| function setPriceListeners() { | ||||
|     document.querySelectorAll('select[id^="id_saleline_set-"][id$="-product"]').forEach((input) => { | ||||
|         console.log('setPriceListenersForeach'); | ||||
|         console.log(input.id); | ||||
|         input.addEventListener('change', (e) => setLinePrice(e)); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function setLinePrice(e) { | ||||
|     console.log('setLinePrice'); | ||||
|     let input = e.target; | ||||
|     const idLine = input.id.split('-')[1]; | ||||
|     const productId = input.value; | ||||
|   | ||||
| @@ -19,7 +19,7 @@ | ||||
|         {% endfor %} | ||||
|       </div> | ||||
|     <div class="h-2/12 flex justify-center"> | ||||
|       <button id="add_line" type="button" class="bg-yellow-400 shadow hover:shadow-lg py-2 px-5 rounded-full font-bold hover:bg-violet-200 ease-in duration-150" onclick="add_line">Añadir Linea</button> | ||||
|       <button id="add_line" type="button" class="bg-yellow-400 shadow hover:shadow-lg py-2 px-5 rounded-full font-bold hover:bg-violet-200 ease-in duration-150">Añadir Linea</button> | ||||
|     </div> | ||||
|   </div> | ||||
|   <div class="h-full w-3/12 bg-green-400 p-5 shadow hover:shadow-lg flex flex-col gap-y-3 font-semibold justify-around"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user