fix(Purchase): set price based on product in all lines.

This commit is contained in:
Mono Mono 2024-08-31 12:38:17 -05:00
parent 1b1a504bf5
commit 99ae098c1d
3 changed files with 2 additions and 4 deletions

View File

@ -25,5 +25,6 @@ document.addEventListener('DOMContentLoaded', function(){
formContainer.appendChild(newForm);
totalForms.value = formCount + 1;
setPriceListeners();
});
});

View File

@ -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;

View File

@ -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">