This commit is contained in:
Николай 2023-05-19 20:00:42 +04:00
parent 85f38e9539
commit d5438a4090
2 changed files with 26 additions and 20 deletions

View File

@ -21,8 +21,9 @@
<thead> <thead>
<tr> <tr>
<th scope="col">Товар</th> <th scope="col">Товар</th>
<th scope="col">Количество</th>
<th scope="col">Цена</th> <th scope="col">Цена</th>
<th scope="col">Количество</th>
<th scope="col">Сумма</th>
<th scope="col">Действие</th> <th scope="col">Действие</th>
</tr> </tr>
</thead> </thead>
@ -70,6 +71,7 @@
console.log('try to add good') console.log('try to add good')
var count = $('#count').val(); var count = $('#count').val();
var good = $('#good').val(); var good = $('#good').val();
if (count > 0 && good > 0){
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: `/Home/GetGood`, url: `/Home/GetGood`,
@ -89,6 +91,7 @@
countElem.value = '1' countElem.value = '1'
} }
}); });
}
}) })
saveBtn.addEventListener("click", () => { saveBtn.addEventListener("click", () => {
@ -126,7 +129,8 @@
let price = 0; let price = 0;
let count = 0; let count = 0;
list.forEach((elem) => { list.forEach((elem) => {
resultTable.innerHTML += `<tr><td>${elem.good.goodName}</td><td>${elem.count}</td><td>${Math.round(elem.good.price * elem.count * 100) / 100}</td><td> \ console.log(elem);
resultTable.innerHTML += `<tr><td>${elem.good.goodName}</td><td>${elem.good.price}</td><td>${elem.count}</td><td>${Math.round(elem.good.price * elem.count * 100) / 100}</td><td> \
<div> \ <div> \
<button onclick="deleteGood(${count})" type="button" class="btn btn-danger"> \ <button onclick="deleteGood(${count})" type="button" class="btn btn-danger"> \
<i class="fa fa-trash" aria-hidden="true"></i> \ <i class="fa fa-trash" aria-hidden="true"></i> \

View File

@ -72,6 +72,7 @@
console.log('try to add good') console.log('try to add good')
var count = $('#count').val(); var count = $('#count').val();
var good = $('#good').val(); var good = $('#good').val();
if (count > 0 && good > 0) {
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: `/Home/GetGood`, url: `/Home/GetGood`,
@ -91,6 +92,7 @@
countElem.value = '1' countElem.value = '1'
} }
}); });
}
}) })
saveBtn.addEventListener("click", () => { saveBtn.addEventListener("click", () => {