This commit is contained in:
Николай 2023-05-19 18:58:40 +04:00
parent b48124b0b9
commit 85f38e9539
2 changed files with 0 additions and 18 deletions

View File

@ -82,22 +82,16 @@
@section Scripts @section Scripts
{ {
<script> <script>
// get selected row
// display selected row data in text input
var table = document.getElementById("table"); var table = document.getElementById("table");
var remove = document.getElementById("delete"); var remove = document.getElementById("delete");
var done = document.getElementById("done"); var done = document.getElementById("done");
var purchase = 0; var purchase = 0;
for (var i = 1; i < table.rows.length; i++) { for (var i = 1; i < table.rows.length; i++) {
table.rows[i].onclick = function () { table.rows[i].onclick = function () {
// remove the background from the previous selected row
if (typeof index !== "undefined") { if (typeof index !== "undefined") {
table.rows[index].classList.toggle("selected"); table.rows[index].classList.toggle("selected");
} }
// get the selected row index
index = this.rowIndex; index = this.rowIndex;
// add class selected to the row
this.classList.toggle("selected"); this.classList.toggle("selected");
purchase = parseInt(this.cells[0].innerText); purchase = parseInt(this.cells[0].innerText);
remove.addEventListener("click", () => { remove.addEventListener("click", () => {

View File

@ -48,8 +48,6 @@
const errorP = document.getElementById("error-p"); const errorP = document.getElementById("error-p");
const errorDivShell = document.getElementById("error-div-shell"); const errorDivShell = document.getElementById("error-div-shell");
// [Event listeners]
generateButton.addEventListener("click", () => { generateButton.addEventListener("click", () => {
const dateFrom = new Date(dateFromInput.value); const dateFrom = new Date(dateFromInput.value);
const dateTo = new Date(dateToInput.value); const dateTo = new Date(dateToInput.value);
@ -85,10 +83,6 @@
}); });
}); });
// ![Event listeners]
// [HTML gen]
const renderTable = function (reportData) { const renderTable = function (reportData) {
tbody.innerHTML = ""; tbody.innerHTML = "";
reportData.forEach((record) => { reportData.forEach((record) => {
@ -134,10 +128,6 @@
return td; return td;
} }
// ![HTML gen]
// [Other]
const getDate = function (iso) { const getDate = function (iso) {
const year = iso.substring(0, 4); const year = iso.substring(0, 4);
const month = iso.substring(5, 7); const month = iso.substring(5, 7);
@ -146,7 +136,5 @@
return date; return date;
} }
// ![Other]
</script> </script>
} }