fix(Purchase): set price based on product in all lines.
This commit is contained in:
parent
1b1a504bf5
commit
99ae098c1d
@ -25,5 +25,6 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||||||
|
|
||||||
formContainer.appendChild(newForm);
|
formContainer.appendChild(newForm);
|
||||||
totalForms.value = formCount + 1;
|
totalForms.value = formCount + 1;
|
||||||
|
setPriceListeners();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,14 +2,11 @@ setPriceListeners();
|
|||||||
|
|
||||||
function setPriceListeners() {
|
function setPriceListeners() {
|
||||||
document.querySelectorAll('select[id^="id_saleline_set-"][id$="-product"]').forEach((input) => {
|
document.querySelectorAll('select[id^="id_saleline_set-"][id$="-product"]').forEach((input) => {
|
||||||
console.log('setPriceListenersForeach');
|
|
||||||
console.log(input.id);
|
|
||||||
input.addEventListener('change', (e) => setLinePrice(e));
|
input.addEventListener('change', (e) => setLinePrice(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLinePrice(e) {
|
function setLinePrice(e) {
|
||||||
console.log('setLinePrice');
|
|
||||||
let input = e.target;
|
let input = e.target;
|
||||||
const idLine = input.id.split('-')[1];
|
const idLine = input.id.split('-')[1];
|
||||||
const productId = input.value;
|
const productId = input.value;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="h-2/12 flex justify-center">
|
<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>
|
</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">
|
<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">
|
||||||
|
Loading…
Reference in New Issue
Block a user