summaryrefslogtreecommitdiff
path: root/rannak/mangud/arimees/pood/script.js
diff options
context:
space:
mode:
authorRasmus <rasmus.luha@gmail.com>2023-05-14 16:12:01 +0300
committerRasmus <rasmus.luha@gmail.com>2023-05-14 16:12:01 +0300
commit62caa37da257987c9585ac57ab64bb12ea481d0b (patch)
treec3d6ec3389258db0b807286ac008f7dcd8653636 /rannak/mangud/arimees/pood/script.js
parent3c64a840a69b2685722765feadf0fec6e571b157 (diff)
fixes
Former-commit-id: 09885e5cd344caaee9cdc2005b7e88dcc5206213
Diffstat (limited to 'rannak/mangud/arimees/pood/script.js')
-rw-r--r--rannak/mangud/arimees/pood/script.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/rannak/mangud/arimees/pood/script.js b/rannak/mangud/arimees/pood/script.js
index 20efbe8..985255e 100644
--- a/rannak/mangud/arimees/pood/script.js
+++ b/rannak/mangud/arimees/pood/script.js
@@ -35,6 +35,9 @@ for (let i=0;i < cells.length; i++){
let origText = input.parentElement.getAttribute('data-text');
let curText = this.value;
+ sums = document.querySelectorAll(".summa");
+ console.log(sums);
+
if (origText != curText){
td.removeAttribute('data-clicked');
td.removeAttribute('data-text');
@@ -42,26 +45,32 @@ for (let i=0;i < cells.length; i++){
td.style.cssText = 'padding: .5rem .5rem';
+ totalSumma = 0;
+ sums.forEach(el => {
+ totalSumma += Number(el.innerHTML);
+ });
// Can move on?
for (cell of cells){
- if (cell.textContent == '')
- return;
+ if (totalSumma >= 12000)
+ moveOnEnable();
+ else if (cell.textContent == '')
+ return;
}
moveOnEnable();
}
+
else {
td.removeAttribute('data-clicked');
td.removeAttribute('data-text');
td.innerHTML = origText;
td.style.cssText = 'padding: .5rem .5rem';
- }
-
- // Here Check if Done
- //TODO
+ sums.forEach(el => {
+ console.log(el);
+ });
+ }
-
} // onblur func end