commit 6c152ae05044bcf8b30f1d57343999548068b1ee
Author: Ondrej Drtina <drtinao@students.zcu.cz>
Date:   Mon Apr 12 12:03:48 2021 +0200

    funkční remove, ještě opravím drobnosti (err v console.log) - nicméně funguje

diff --git a/application/model/DB.php b/application/model/DB.php
index c0484a6..4e8a0ed 100644
--- a/application/model/DB.php
+++ b/application/model/DB.php
@@ -648,44 +648,33 @@ function insert(){
 }
 
 function remove(){
-    // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_wordform |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-        if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
-            $query = "DELETE FROM dd_wordform WHERE";
-            $query .= " id = :id ;";
-            $this->stmt = $this->pdo->prepare($query);
-            $this->stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
-            $this->stmt->execute();
-        }
+    // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_manuscript |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+    if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
+        $query = "DELETE FROM dd_manuscript WHERE";
+        $query .= " wordform_id = :wordform_id ;";
+        $this->stmt = $this->pdo->prepare($query);
+        $this->stmt->bindParam(':wordform_id', $_POST['id'], PDO::PARAM_INT);
+        $this->stmt->execute();
+    }
+
     // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_lemma |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
-        if (array_key_exists("lemma", $_POST) && $_POST['lemma'] != "") {
+        /*if (array_key_exists("lemma", $_POST) && $_POST['lemma'] != "") {
             $query = "DELETE FROM dd_lemma WHERE";
             $query .= " id = :lemma_id ;";
             $this->stmt = $this->pdo->prepare($query);
             $this->stmt->bindParam(':lemma_id', $lemma["id"], PDO::PARAM_INT);
             $this->stmt->execute();
-        }
+        } TODO: fix lemma*/ 
     // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_tag |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
-        if (array_key_exists("tag", $_POST) && $_POST['tag'] != "") {
+        /*if (array_key_exists("tag", $_POST) && $_POST['tag'] != "") {
             $query = "DELETE FROM dd_tag WHERE";
             $query .= " id = :tag_id ;";
             $this->stmt = $this->pdo->prepare($query);
             $this->stmt->bindParam(':tag_id', $tag["id"], PDO::PARAM_INT);
             $this->stmt->execute();
-        }
-
-
-    // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_manuscript |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
-    if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
-        $query = "DELETE FROM dd_manuscript WHERE";
-        $query .= " wordform_id = :wordform_id ;";
-        $this->stmt = $this->pdo->prepare($query);
-        $this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
-        $this->stmt->execute();
-    }
-
+        } TODO: fix tag */
 
     // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_wordform |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
         if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
diff --git a/application/view/Index.php b/application/view/Index.php
index 60321b4..ca04ea3 100644
--- a/application/view/Index.php
+++ b/application/view/Index.php
@@ -8,7 +8,7 @@ include "../controller/UpdateController.php";
         // (A1) GET SEARCH TERM
         var data = new FormData();
         //data.append("manuscript", "0,3"); //příklad pro filtraci manuscriptů, asi se ještě uprav
-        data.append("page", "0");
+       /* data.append("page", "0");
         data.append("items_per_page", "50");
         data.append("lemma", "megaultranováLemma");
         data.append("word", "novéWord2");
@@ -24,13 +24,16 @@ include "../controller/UpdateController.php";
         data.append("positiondetail", "posdet");
         data.append("prefix", "prefix");
         data.append("suffix", "suffix");
-        data.append("id", 9);
+        data.append("id", 9);*/
+
+        data.append("id", 4);
+        data.append("wordform_id", 4);
         //data.append("lemma_id", 3686);
         //data.append("tag_id", 1219);
-        data.append("pos", 6);
+        /*data.append("pos", 6);
         data.append("manuscript", [1,2,3,4,5]);
         data.append("wordform_id", 9);
-        data.append("tag", "A---------");
+        data.append("tag", "A---------");*/
         //data.append("finished", "false");
         // data.append("tag_pos", "V");
         // data.append("tag_verb_aspect", "P");
diff --git a/application/view/modals/removeModal.html b/application/view/modals/removeModal.html
index fabf30b..9a50ac2 100644
--- a/application/view/modals/removeModal.html
+++ b/application/view/modals/removeModal.html
@@ -8,26 +8,28 @@
 			 <div class="modal-body">
 				<div class="container">
 					<div class="row">
-                        <p>Opravdu chcete odstranit zvolený záznam?</p>
+                        <p id="mesBody"></p>
                     </div>
 				</div>
 			 </div>
 			 <div class="modal-footer">
-                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeSelectedItem()">Ano</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeSelectedItem(document.getElementById('idToRemoveInput').value)">Ano</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal">Ne</button>
-            </div>
+				<input type="hidden" id="idToRemoveInput" />
+			</div>
 		</div>
 	</div>
 </div>
 
 <script>
-    $('#remove-modal').on('show.bs.modal', function (event){
+    $('#remove-modal').on('show.bs.modal', function (event){ //wait for modal to show 
         const button = $(event.relatedTarget);
         const pseudo_id = button.data('pseudo-id');//Extract info from data-* attributes
 
         const data_obj = data[pseudo_id];
         let modal = $(this);
 
-        alert("id: " + data_obj.id);
+		modal.find('#mesBody').text("Opravdu chcete odstranit záznam týkající se slova \"" + data_obj.word + "\"?");
+		modal.find('#idToRemoveInput').val(data_obj.id); //assign id to delete to hidden input
     });
 </script>
\ No newline at end of file
diff --git a/application/view/searchContent.php b/application/view/searchContent.php
index 79da02e..d085dd1 100644
--- a/application/view/searchContent.php
+++ b/application/view/searchContent.php
@@ -562,18 +562,14 @@
     <h3 id="no-data-label" class="mx-auto text-center font-italic">Žádná data nebyla nalezena</h3>
 
     <script>
-        function removeSelectedItem(){
+        function removeSelectedItem(idToDelete){
             const data = new FormData(); //to pass ids, which we want to delete from DB
-            data.append("id", ""+4); //id to delete from table dd_wordform
-            data.append("wordform_id", ""+4); //id to delete from M:N table dd_manuscript (prolly the same as above...)
+            data.append("id", ""+idToDelete); //id to delete from table dd_wordform
             
             let xhr = new XMLHttpRequest();
             xhr.open("POST", "./controller/RemoveController.php");
-            xhr.onload = function(){
-                        alert("loaded");
-                    };
             xhr.send(data);
-            alert("removing item: 4");
+            fetchData(true); //reload data after item delete
         }
 
         function checkValidItemsPerPage(){
