commit 73f8a3a0390eee10fa0d1a03e3d02faf347a224b
Author: Anděl Ondřej <ondrej.andel@marbes.cz>
Date:   Sun Apr 4 14:49:08 2021 +0200

    Feature #8350: Vytvoření modalů detailu a editu - editform

diff --git a/application/search.php b/application/search.php
index 585f707..4739c8a 100644
--- a/application/search.php
+++ b/application/search.php
@@ -34,5 +34,6 @@
 
 <?php include "./view/modals/loginModal.html" ?>
 <?php include "./view/modals/detailModal.html" ?>
+<?php include "./view/modals/editModal.html" ?>
 </body>
 </html>
diff --git a/application/view/modals/detailModal.html b/application/view/modals/detailModal.html
index 4165e42..d35e906 100644
--- a/application/view/modals/detailModal.html
+++ b/application/view/modals/detailModal.html
@@ -322,6 +322,19 @@
         "T": "Partikule"
     };
 
+    const wordclassToNum = {
+        "N": 0,
+        "A": 1,
+        "P": 2,
+        "C": 3,
+        "V": 4,
+        "D": 5,
+        "R": 6,
+        "J": 7,
+        "I": 8,
+        "T": 9
+    };
+
     const codeToManuscript = {
         "0":  "rukopis Vídeňský",
         "1":  "zlomky Hanušovy",
diff --git a/application/view/modals/editModal.html b/application/view/modals/editModal.html
new file mode 100644
index 0000000..a7e6563
--- /dev/null
+++ b/application/view/modals/editModal.html
@@ -0,0 +1,724 @@
+<div id="edit-modal" class="modal fade" role="dialog">
+    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title"></h4>
+                <button type="button" class="close" data-dismiss="modal">&times;</button>
+            </div>
+            <div class="modal-body">
+                <div class="container">
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="word">Slovo:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <input class="min-wdth" id="word"/>
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="lemma">Lemma:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <input class="min-wdth" id="lemma"/>
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label> <!--for="manuscript"-->Rukopisy:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <!--<select id="manuscript" multiple>
+                                <option value = "0">rukopis Vídeňský</option>
+                                <option value = "1">zlomky Hanušovy</option>
+                                <option value = "2">zlomky Hradecké</option>
+                                <option value = "3">rukopis Cambridžský</option>
+                                <option value = "4">rukopis Františkánský</option>
+                                <option value = "5">zlomek Olomoucký</option>
+                                <option value = "6">fragment Strahovský</option>
+                                <option value = "7">zlomky Klementinsko-Křižovnické</option>
+                                <option value = "8">zlomky Mnichovské</option>
+                                <option value = "9">rukopis Lobkovický</option>
+                                <option value = "10">rukopis Pelclův</option>
+                                <option value = "11">rukopis Cerronský</option>
+                                <option value = "12">rukopis Fürstenberský</option>
+                                <option value = "13">rukopis Zebererův</option>
+                                <option value = "14">vydání Pavla Ješína z Bezdězi, Praha 1620</option>
+                                <option value = "15">básně připsané při Pulkavově kronice v rukopisu Litoměřickém</option>
+                            </select>TODO-->
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="position">Pozice:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <input class="min-wdth" id="position" title="Jedotlivé oddíly zadávejte oddělené lomítkem (bez mezery)" />
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="namedentity">Vlastní jméno:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <input type="checkbox" id="namedentity"/>
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="context">Kontext:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <input class="min-wdth" id="context"/>
+                        </div>
+                    </div>
+                    <div class="row my-1">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="wordclass">Slovní druh:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" onchange="changeWordType()"  id="wordclass">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "N">Substantiva</option>
+                                <option value = "A">Adjektiva</option>
+                                <option value = "P">Pronomina</option>
+                                <option value = "C">Numeralia</option>
+                                <option value = "V">Verba</option>
+                                <option value = "D">Adverbia</option>
+                                <option value = "R">Prepozice</option>
+                                <option value = "J">Konjunkce</option>
+                                <option value = "I">Interjekce</option>
+                                <option value = "T">Partikule</option>
+                            </select>
+                        </div>
+                    </div>
+
+                    <!-- conditional render -->
+                    <div class="row my-1" id="person-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="person">Osoba:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="person">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "1">1.</option>
+                                <option value = "2">2.</option>
+                                <option value = "3">3.</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="case-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="case">Pád:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="case">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "1">Nominativ</option>
+                                <option value = "2">Genitiv</option>
+                                <option value = "3">Dativ</option>
+                                <option value = "4">Akuzativ</option>
+                                <option value = "5">Vokativ</option>
+                                <option value = "6">Lokál</option>
+                                <option value = "7">Instrumentál</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="countability-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="countability">Číslo:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="countability">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "S">Singulár</option>
+                                <option value = "P">Plurál</option>
+                                <option value = "D">Duál</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="gender-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="gender">Rod:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="gender">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "M">Maskulinum</option>
+                                <option value = "F">Femininum</option>
+                                <option value = "N">Neutrum</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="shape-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="shape">Tvar:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="shape">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "C">Složený</option>
+                                <option value = "N">Jmenný</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="grade-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="grade">Stupeň:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="grade">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "1">Pozitiv</option>
+                                <option value = "2">Komparativ</option>
+                                <option value = "3">Superlativ</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="type-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="type">Druh:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="type">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "P">Personalia</option>
+                                <option value = "S">Posesiva</option>
+                                <option value = "D">Demonstrativa</option>
+                                <option value = "Q">Interogativa</option>
+                                <option value = "J">Relativa</option>
+                                <option value = "Z">Indefinita</option>
+                                <option value = "L">Limitativa</option>
+                                <option value = "W">Negativa</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="time-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="time">Čas:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="time">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "P">Prézens</option>
+                                <option value = "A">Aorist</option>
+                                <option value = "R">Préteritum</option>
+                                <option value = "I">Imperfektum</option>
+                                <option value = "H">Plusquamperfektum</option>
+                                <option value = "F">Futurum</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="mood-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="mood">Způsob:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="mood" onchange="moodChange()">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "d">Indikativ</option>
+                                <option value = "i">Imperativ</option>
+                                <option value = "c">Kondicionál</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="irregular-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="irregular">Neurčitý slovesný tvar:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="irregular" onchange="irregularChange()">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "f">Infinitiv</option>
+                                <option value = "S">Supinum</option>
+                                <option value = "e">Přech. přítomný</option>
+                                <option value = "m">Přech. minulý</option>
+                                <option value = "A">Part. perf. akt.</option>
+                                <option value = "P">Part. perf. pas.</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="v-type-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="v-type">Slovesný rod:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="v-type">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "A">Aktivum</option>
+                                <option value = "P">Pasivum</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="vid-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="vid">Slovesný vid:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="vid">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "P">Perfektivum</option>
+                                <option value = "I">Imperfektivum </option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="row my-1" id="k-type-wrapper">
+                        <div class="col-xs-12 col-sm-4">
+                            <label for="k-type">Typ:</label>
+                        </div>
+                        <div class="col-xs-12 col-sm-8">
+                            <select class="min-wdth" id="k-type">
+                                <option selected="selected" value = "">Nevybráno</option>
+                                <option value = "V">Větná</option>
+                                <option value = "C">Členská</option>
+                                <option value = "N">Navazovací</option>
+                                <option value = "P">Spojení s přechodníkem</option>
+                            </select>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" id="submit-but" class="btn btn-default" data-dismiss="modal"></button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    $('#edit-modal').on('show.bs.modal', function (event) {
+        const button = $(event.relatedTarget);
+        const pseudo_id = button.data('pseudo-id');// Extract info from data-* attributes
+        const title = button.data('title');// Extract info from data-* attributes
+        let manuSelect = new vanillaSelectBox("#manuscript");
+
+        let modal = $(this);
+        modal.find('.modal-title').text(title);
+        modal.find('#mood').change(() => moodMChange(modal));
+        modal.find('#irregular').change(() => irregularMChange(modal));
+
+        if(title === "Nový záznam"){
+            prefill(modal);
+            changeWordType();
+            modal.find('#submit-but').text("Založit");
+            modal.find('#submit-but').click(() => createData(modal));
+        } else {
+            const data_obj = data[pseudo_id];
+            modal.find('#submit-but').text("Upravit");
+            modal.find('#submit-but').click(() => editData(data_obj, modal));
+            changeWordType();
+            prefill(modal, data_obj);
+            moodMChange(modal);
+            irregularMChange(modal);
+        }
+    });
+
+    function changeWordType() {
+        let modal = $('#edit-modal');
+        const value = modal.find("#wordclass")[0].value;
+        let movedNode;
+        let beforeNode;
+        switch (value) {
+            case "N":
+                setElementVisibility([
+                    true,
+                    true,
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                movedNode = modal.find("#case-wrapper");
+                beforeNode = modal.find("#countability-wrapper");
+                beforeNode.before(movedNode);
+                break;
+            case "A":
+                setElementVisibility([
+                    true,
+                    true,
+                    true,
+                    true,
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                movedNode = modal.find("#case-wrapper");
+                beforeNode = modal.find("#countability-wrapper");
+                beforeNode.before(movedNode);
+                break;
+            case "P":
+                setElementVisibility([
+                    true,
+                    true,
+                    true,
+                    false,
+                    false,
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                movedNode = modal.find("#case-wrapper");
+                beforeNode = modal.find("#countability-wrapper");
+                beforeNode.before(movedNode);
+                break;
+            case "C":
+                setElementVisibility([
+                    true,
+                    true,
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                movedNode = modal.find("#case-wrapper");
+                beforeNode = modal.find("#countability-wrapper");
+                beforeNode.before(movedNode);
+                break;
+            case "V":
+                setElementVisibility([
+                    true,
+                    true,
+                    true,
+                    false,
+                    false,
+                    false,
+                    true,
+                    true,
+                    true,
+                    true,
+                    true,
+                    true,
+                    false
+                ], modal);
+                movedNode = modal.find("#case-wrapper");
+                beforeNode = modal.find("#vid-wrapper");
+                beforeNode.after(movedNode);
+                break;
+            case "D":
+                setElementVisibility([
+                    false,
+                    false,
+                    false,
+                    false,
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                break;
+            case "R":
+                setElementVisibility([
+                    true,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                break;
+            case "J":
+                setElementVisibility([
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    true
+                ], modal);
+                break;
+            case "I":
+                setElementVisibility([
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                break;
+            case "T":
+                setElementVisibility([
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                break;
+            default:
+                setElementVisibility([
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false,
+                    false
+                ], modal);
+                break;
+        }
+    }
+
+    const dynamicFields = [
+        "#case-wrapper",
+        "#countability-wrapper",
+        "#gender-wrapper",
+        "#shape-wrapper",
+        "#grade-wrapper",
+        "#type-wrapper",
+        "#mood-wrapper",
+        "#irregular-wrapper",
+        "#person-wrapper",
+        "#time-wrapper",
+        "#vid-wrapper",
+        "#v-type-wrapper",
+        "#k-type-wrapper"
+    ];
+
+    const staticFields = [
+        "#word",
+        "#lemma",
+        "#manuscript",
+        "#position",
+        "#namedentity",
+        "#context",
+        "#wordclass"
+    ];
+
+    function setElementVisibility(visibility, modal) {
+        for(let i = 0; i < dynamicFields.length &&  i < visibility.length; i++){
+            if(visibility[i] === true){
+                modal.find(dynamicFields[i]).show();
+            } else {
+                modal.find(dynamicFields[i]).hide();
+            }
+            modal.find(dynamicFields[i].replace("-wrapper", "")).val("");
+        }
+    }
+
+    function prefill(modal, data = null){
+        staticFields.forEach((item) => {
+            modal.find(item).val("");
+        });
+
+        modal.find("#namedentity").prop('checked', false);
+
+        dynamicFields.forEach((item) => {
+            modal.find(item.replace("-wrapper", "")).val("");
+        });
+
+        if(data !== null){
+            modal.find("#context").val(data.context);
+            modal.find("#namedentity").prop('checked', data.namedentity === 1);
+
+            let position = data.position1;
+            position += ((data.position2 !== null && data.position2.length > 0) ? ("/" + data.position2) : "");
+            position += ((data.positiondetail !== null && data.positiondetail.length > 0) ? ("/" + data.positiondetail) : "");
+            modal.find("#position").val(position);
+
+            modal.find("#word").val(data.word);
+            modal.find("#lemma").val(data.lemma.lemma);
+            modal.find("#manuscript").val(data.manuscript);
+
+            //dynamic setting
+            const morphem = data.tag.tag;
+            const wordclass = morphem.charAt(0);
+            modal.find("#wordclass").val(wordclass);
+            modal.find("#case").val((morphem.charAt(1) !== '-') ? morphem.charAt(1) : "");
+            modal.find("#countability").val((morphem.charAt(2) !== '-') ? morphem.charAt(2) : "");
+            modal.find("#gender").val((morphem.charAt(3) !== '-') ? morphem.charAt(3) : "");
+            modal.find("#grade").val((morphem.charAt(4) !== '-') ? morphem.charAt(4) : "");
+            modal.find("#shape").val((morphem.charAt(5) !== '-') ? morphem.charAt(5) : "");
+
+            if(morphem.charAt(7) !== '-'){
+                if(wordclass === 'J'){
+                    modal.find("#k-type").val(morphem.charAt(7));
+                } else if(wordclass === 'P'){
+                    modal.find("#type").val(morphem.charAt(7));
+                } else if(wordclass === 'V'){
+                    if(codeToMood[morphem.charAt(7)] !== undefined) {
+                        modal.find("#mood").val(morphem.charAt(7));
+                    } else {
+                        modal.find("#irregular").val(morphem.charAt(7));
+                    }
+                }
+            }
+
+            modal.find("#person").val((morphem.charAt(8) !== '-') ? morphem.charAt(8) : "");
+            modal.find("#time").val((morphem.charAt(9) !== '-') ? morphem.charAt(9) : "");
+            modal.find("#v-type").val((morphem.charAt(10) !== '-') ? morphem.charAt(10) : "");
+            modal.find("#vid").val((morphem.charAt(11) !== '-') ? morphem.charAt(11) : "");
+        }
+    }
+
+    function editData(data, modal){
+        const formData = prepareFormData(modal);
+        formData.append("id", data.id);
+
+        //TODO the next three WILL be added in prepareFormData in future
+        formData.append("description", data.description);
+        formData.append("description2", data.description2);
+        formData.append("description3", data.description3);
+
+        formData.append("ending", data.ending);
+        formData.append("finished", data.finished);
+        formData.append("prefix", data.prefix);
+        formData.append("suffix", data.suffix);
+
+        var xhr = new XMLHttpRequest();
+        xhr.open("POST", "./controller/UpdateController.php");
+        xhr.send(formData);
+    }
+
+    function prepareFormData(modal) {
+        const formData = new FormData();
+
+        formData.append("namedentity", (modal.find("#namedentity")[0].checked) ? "1" : "0");
+
+        const position = modal.find("#position")[0].value.split("/");
+        formData.append("position1", position[0]);
+        formData.append("position2", (position[1] !== undefined) ? position[1] : "");
+        formData.append("positiondetail", (position[2] !== undefined) ? position[2] : "");
+
+        formData.append("word", modal.find("#word")[0].value);
+        formData.append("lemma", modal.find("#lemma")[0].value);
+        //TODO formData.append("manuscript", modal.find("#manuscript")[0].value);
+        formData.append("context", modal.find("#context")[0].value);
+
+        //morphem creation
+        let morphem = "";
+        const wordClass = modal.find("#wordclass")[0].value;
+        morphem += ((wordClass.length > 0) ? wordClass.value : "-");
+        morphem += ((modal.find("#case")[0].value.length > 0) ? modal.find("#case")[0].value : "-");
+        morphem += ((modal.find("#countability")[0].value.length > 0) ? modal.find("#countability")[0].value : "-");
+        morphem += ((modal.find("#gender")[0].value.length > 0) ? modal.find("#gender")[0].value : "-");
+        morphem += ((modal.find("#grade")[0].value.length > 0) ? modal.find("#grade")[0].value : "-");
+        morphem += ((modal.find("#shape")[0].value.length > 0) ? modal.find("#shape")[0].value : "-");
+        morphem += "-";
+
+        if(wordClass === "J"){
+            morphem += ((modal.find("#k-type")[0].value.length > 0) ? modal.find("#k-type")[0].value : "-");
+        } else if(wordClass === "P") {
+            morphem += ((modal.find("#type")[0].value.length > 0) ? modal.find("#type")[0].value : "-");
+        } else if(wordClass === "V"){
+            const value1 = modal.find("#mood")[0].value;
+            const value2 = modal.find("#irregular")[0].value;
+            if(value1.length > 0){
+                morphem += value1;
+            } else if(value2.length > 0){
+                morphem += value2;
+            } else {
+                morphem += "-";
+            }
+        } else {
+            morphem += "-";
+        }
+
+        morphem += ((modal.find("#person")[0].value.length > 0) ? modal.find("#person")[0].value : "-");
+        morphem += ((modal.find("#time")[0].value.length > 0) ? modal.find("#time")[0].value : "-");
+        morphem += ((modal.find("#v-type")[0].value.length > 0) ? modal.find("#v-type")[0].value : "-");
+        morphem += ((modal.find("#vid")[0].value.length > 0) ? modal.find("#vid")[0].value : "-");
+        formData.append("tag", morphem);
+        formData.append("pos", wordclassToNum[wordClass]);
+
+        return formData;
+    }
+
+    function moodMChange(modal) {
+        if(modal.find("#mood")[0].value !== ""){
+            modal.find("#irregular").prop('disabled', true);
+            modal.find("#irregular").prop('title', "Neurčitý slovesný tvar smí být nastaven pouze není-li nastaven způsob");
+        } else {
+            modal.find("#irregular").prop('disabled', false);
+            modal.find("#irregular").prop('title', "");
+        }
+    }
+
+    function irregularMChange(modal) {
+        if(modal.find("#irregular")[0].value !== ""){
+            modal.find("#mood").prop('disabled', true);
+            modal.find("#mood").prop('title', "Způsob smí být nastaven pouze není-li nastaven neurčitý slovesný tvar");
+        } else {
+            modal.find("#mood").prop('disabled', false);
+            modal.find("#mood").prop('title', "");
+        }
+    }
+
+    function createData(modal){
+        const formData = prepareFormData(modal);
+
+        formData.append("finished", false);
+
+        /* TODO connect to the proper controller
+        var xhr = new XMLHttpRequest();
+        xhr.open("POST", "../controller/UpdateController.php");
+        xhr.send(formData);
+        */
+    }
+</script>
\ No newline at end of file
diff --git a/application/view/searchContent.php b/application/view/searchContent.php
index 9adae7d..f8b35d5 100644
--- a/application/view/searchContent.php
+++ b/application/view/searchContent.php
@@ -176,8 +176,8 @@
                             false
                         ]);
                         movedNode = document.getElementById("filter-case");
-                        beforeNode = document.getElementById("filter-vid");
-                        movedNode.parentNode.insertBefore(movedNode, null);
+                        beforeNode = document.getElementById("filter-but");
+                        movedNode.parentNode.insertBefore(movedNode, beforeNode);
                         break;
                     case "D":
                         setFilerVisibility([
@@ -441,7 +441,7 @@
         </div>
 
         <!-- send button-->
-        <button class="ml-auto btn" onclick="callFilter()">
+        <button class="ml-auto btn" id="filter-but" onclick="callFilter()">
             Filtrovat
         </button>
     </div>
@@ -589,6 +589,7 @@
                         result += "<td>" + renderManuscript(item.manuscript) + "</td>";
                         result += "<td>" + item.position1 + (item.position2 ? ("/" + item.position2 + (item.positiondetail ? "/"  + item.positiondetail :  "")) : "")  + "</td>";
                         result += "<td class=\"action-td\">" +
+                            "<button class=\"btn mr-1\" title=\"Upravit\"  data-toggle=\"modal\" data-target=\"#edit-modal\" data-pseudo-id='" + id + "' data-title=\"Upravit záznam\"><i class=\"fa fa-pencil\"></i></button>" + //TODO ADMIN ONLY
                             "<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 += "</tr>";
diff --git a/application/view/style.css b/application/view/style.css
index 4d5b7f7..2ee2871 100644
--- a/application/view/style.css
+++ b/application/view/style.css
@@ -71,7 +71,7 @@ html, body, .container-fluid {
 }
 
 .app-content .content .search-results .action-td{
-  width: 1%;
+  width: 10%;
 }
 
 input, select {
@@ -82,10 +82,14 @@ input, select {
   padding: 6px 12px;
 }
 
+.min-wdth {
+  min-width: 200px;
+}
+
 select {
   padding: 6px 18px 6px 12px;
   appearance: none;
-  background: url("http://localhost/aswi/application/view/img/select-ico.png") 96% / 15% no-repeat white;
+  background: url("http://localhost/aswi/application/view/img/select-ico.png") 96% / 20px no-repeat white;
 }
 
 /* Remove default arrow in Internet Explorer 10 and 11 */
