From 62caa37da257987c9585ac57ab64bb12ea481d0b Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus.luha@gmail.com>
Date: Sun, 14 May 2023 16:12:01 +0300
Subject: fixes

Former-commit-id: 09885e5cd344caaee9cdc2005b7e88dcc5206213
---
 rannak/mangud/arimees/pood/index.html | 20 ++++++++++----------
 rannak/mangud/arimees/pood/script.js  | 23 ++++++++++++++++-------
 2 files changed, 26 insertions(+), 17 deletions(-)

(limited to 'rannak/mangud/arimees/pood')

diff --git a/rannak/mangud/arimees/pood/index.html b/rannak/mangud/arimees/pood/index.html
index 16233d2..2e72724 100644
--- a/rannak/mangud/arimees/pood/index.html
+++ b/rannak/mangud/arimees/pood/index.html
@@ -256,70 +256,70 @@
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
           <tr>
             <td></td>
             <td></td>
             <td></td>
             <td></td>
-            <td></td>
+            <td class="summa"></td>
           </tr>
         </table> 
 
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
 
 
-- 
cgit v1.2.3