commit 6f8c9e0576dcab2cf2c4404965013777e8ec1040
Author: Ondrej Drtina <drtinao@students.zcu.cz>
Date:   Sun Apr 11 19:11:02 2021 +0200

    commit před mergem s Milan. větví.

diff --git a/application/controller/RemoveController.php b/application/controller/RemoveController.php
index 2e05f34..c95db65 100644
--- a/application/controller/RemoveController.php
+++ b/application/controller/RemoveController.php
@@ -1,5 +1,4 @@
 <?php
 require "../model/DB.php";
-
 $DB = new DB();
-$DB->remove();
+$DB->remove();
\ No newline at end of file
diff --git a/application/model/DB.php b/application/model/DB.php
index 5191da0..cbffd95 100644
--- a/application/model/DB.php
+++ b/application/model/DB.php
@@ -702,7 +702,7 @@ function remove(){
 
 // (D) DATABASE SETTINGS - CHANGE TO YOUR OWN!
 define('DB_HOST', 'localhost');
-define('DB_NAME', 'dalimil1');
+define('DB_NAME', 'dalimil2');
 define('DB_CHARSET', 'utf8');
 define('DB_USER', 'postgres');
-define('DB_PASSWORD', 'a');
\ No newline at end of file
+define('DB_PASSWORD', 'ahavole');
\ No newline at end of file
diff --git a/application/search.php b/application/search.php
index bbaa224..a6d4247 100644
--- a/application/search.php
+++ b/application/search.php
@@ -35,5 +35,6 @@
 <?php include "./view/modals/loginModal.html" ?>
 <?php include "./view/modals/detailModal.html" ?>
 <?php include "./view/modals/settingsModal.html" ?>
+<?php include "./view/modals/removeModal.html" ?>
 </body>
 </html>
diff --git a/application/view/modals/removeModal.html b/application/view/modals/removeModal.html
new file mode 100644
index 0000000..fabf30b
--- /dev/null
+++ b/application/view/modals/removeModal.html
@@ -0,0 +1,33 @@
+<div id="remove-modal" class="modal fade" role="dialog">
+	<div class="modal-dialog modal-dialog-centered" role="document">
+		<div class="modal-content">
+			 <div class="modal-header">
+					<h4 class="modal-title">Potvrdit odstranění</h4>
+					<button type="button" class="close" data-dismiss="modal">&times;</button>
+			 </div>
+			 <div class="modal-body">
+				<div class="container">
+					<div class="row">
+                        <p>Opravdu chcete odstranit zvolený záznam?</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">Ne</button>
+            </div>
+		</div>
+	</div>
+</div>
+
+<script>
+    $('#remove-modal').on('show.bs.modal', function (event){
+        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);
+    });
+</script>
\ No newline at end of file
diff --git a/application/view/searchContent.php b/application/view/searchContent.php
index ee6d946..79da02e 100644
--- a/application/view/searchContent.php
+++ b/application/view/searchContent.php
@@ -548,6 +548,9 @@
                         result += "<td class=\"action-td\">" +
                             "<button class=\"btn\" title=\"Detail\"  data-toggle=\"modal\" data-target=\"#detail-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-search\"></i></button>" +
                             "</td>";
+                        result += "<td class=\"action-td\">" +
+                            "<button class=\"btn\" title=\"Odstranit\"  data-toggle=\"modal\" data-target=\"#remove-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-trash\"></i></button>" +
+                            "</td>"; //added button for removing entry
                         result += "</tr>";
                     });
                     document.getElementById("search-table").innerHTML = result;
@@ -559,6 +562,20 @@
     <h3 id="no-data-label" class="mx-auto text-center font-italic">Žádná data nebyla nalezena</h3>
 
     <script>
+        function removeSelectedItem(){
+            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...)
+            
+            let xhr = new XMLHttpRequest();
+            xhr.open("POST", "./controller/RemoveController.php");
+            xhr.onload = function(){
+                        alert("loaded");
+                    };
+            xhr.send(data);
+            alert("removing item: 4");
+        }
+
         function checkValidItemsPerPage(){
             var visibleItemCount = document.getElementById("itemsPerPage");
             if(!isNaN(visibleItemCount.value) && visibleItemCount.value % 1 === 0 && parseInt(visibleItemCount.value) >= 1 && parseInt(visibleItemCount.value) <= 500){
