commit 33d18654a616e17fa2c047e8929acfbe0eed6679
Author: cagy <ml.cagy@seznam.cz>
Date:   Fri Apr 24 13:34:39 2020 +0200

    temp

diff --git a/src/main/webapp/WEB-INF/templates/assembly_edit.html b/src/main/webapp/WEB-INF/templates/assembly_edit.html
new file mode 100644
index 00000000..05034b75
--- /dev/null
+++ b/src/main/webapp/WEB-INF/templates/assembly_edit.html
@@ -0,0 +1,608 @@
+<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"><head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta name="description" content="">
+    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
+    <meta name="generator" content="Jekyll v3.8.6">
+    <title>Album example · Bootstrap</title>
+    <link rel="canonical" href="https://getbootstrap.com/docs/4.4/examples/album/">
+
+    <!-- Bootstrap core CSS -->
+    <link href="css/bootstrap.min.css" rel="stylesheet">
+
+    <link href="css/bootstrap-select.min.css" rel="stylesheet">
+    <link href="css/fontawesome.min.css" rel="stylesheet">
+    <link href="css/style.css" rel="stylesheet">
+
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script type="text/javascript" src="js/bootstrap.min.js"></script>
+    <script type="text/javascript" src="js/bootstrap-select.min.js"></script>
+
+    <link href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" rel="stylesheet">
+
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script src="//code.jquery.com/jquery-1.11.1.js"></script>
+    <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
+</head>
+<body>
+<div id="test"></div>
+<main role="main">
+
+  <div class="container">
+    <h1>
+      Editace - Studenti - studijní programy
+    </h1>
+  </div>
+
+<form>
+  <div class="container box">
+    <div class="col-md-12">
+    <div class="form-group row">
+      <label for="name" class="col-sm-2 col-form-label">Název sestavy:</label>
+      <div class="col-sm-10">
+        <input type="text" class="form-control" id="name" th:value="${assembly.name}">
+      </div>
+    </div>
+    <div class="form-group row">
+      <label for="sql_query" class="col-sm-2 col-form-label">SQL dotaz:</label>
+      <div class="col-sm-10">
+        <textarea class="form-control" id="sql_query" rows="6" th:text="${assembly.SQLQuery}"></textarea>
+      </div>
+    </div>
+    <div class="form-group row">
+      <label class="form-check-label col-sm-2" for="defaultCheck1">Veřejný:</label>
+      <div class="col-sm-10">
+        <div class="form-check">
+          <input th:if="${assembly.isPublic == 0}" class="form-check-input" type="checkbox" value="" id="defaultCheck1">
+          <input th:unless="${assembly.isPublic == 0}" class="form-check-input" type="checkbox" value="" id="defaultCheck1" checked="true">
+        </div>
+      </div>
+    </div>
+</div>
+  </div>
+</div>
+
+  <div class="container box">
+    <div class="col-md-12">
+    <div class="box-header">
+      <h3 class="box-title">Parametry</h3>
+      <button type="button" class="btn btn-success"><i class="fas fa-plus"></i> Přidat parametr</button>
+    </div>
+
+    <div class="panel-group sort" id="accordion">
+      <div class="panel panel-default">
+
+        <div class="panel-heading">
+          <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
+            <span class="panel-title">
+                <i class="fas fa-angle-right"></i> Akademický rok
+            </span>
+          </a>
+
+          <span class="align-right collapse-actions">
+            <span class="action-padding input-action-margin-collapse sort-icon">
+              <i class="fas fa-sort"></i>
+            </span>
+            <span class="action-padding action-button input-action-margin-collapse">
+              <a href=# class="action-link far fa-trash-alt"></a>
+            </span>
+          </span>
+
+        </div>
+        <div id="collapse1" class="panel-collapse collapse in">
+          <div class="panel-body">
+            <div class="form-group row">
+              <label for="name" class="col-sm-2 col-form-label">Název:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row">
+              <label for="name" class="col-md-2 col-form-label">V&nbsp;SQL:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row type-row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Typ:</label>
+              <div class="col-sm-10">
+                <select class="form-control type-select">
+                  <option>Text</option>
+                  <option>Datum</option>
+                  <option>Výčet</option>
+                </select>
+              </div>
+            </div>
+            <div class="form-group row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Sloupec:</label>
+              <div class="col-sm-10">
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
+                  <label class="form-check-label" for="inlineCheckbox1">Sloupec</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
+                  <label class="form-check-label" for="inlineCheckbox2">Řádek</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3">
+                  <label class="form-check-label" for="inlineCheckbox3">Hodnota</label>
+                </div>
+              </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Funkce:</label>
+                <div class="col-sm-10">
+                  <select class="selectpicker" multiple data-live-search="true">
+                    <option>SUM</option>
+                    <option>AVG</option>
+                    <option>MAX</option>
+                    <option>MIN</option>
+                  </select>
+                </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Operátory:</label>
+                <div class="col-sm-10">
+                  <select class="selectpicker" multiple data-live-search="true">
+                    <option>LIKE</option>
+                    <option>BETWEEN</option>
+                    <option>EQUAL</option>
+                    <option>LESS</option>
+                  </select>
+                </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <span class="panel-title">
+            <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
+              <i class="fas fa-angle-right"></i> Typ studia
+            </a>
+
+            <span class="align-right collapse-actions">
+              <span class="action-padding input-action-margin-collapse sort-icon">
+                <i class="fas fa-sort"></i>
+              </span>
+              <span class="action-padding action-button input-action-margin-collapse">
+                <a href=# class="action-link far fa-trash-alt"></a>
+              </span>
+            </span>
+          </span>
+        </div>
+        <div id="collapse2" class="panel-collapse collapse">
+          <div class="panel-body">
+            <div class="form-group row">
+              <label for="name" class="col-sm-2 col-form-label">Název:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row">
+              <label for="name" class="col-sm-2 col-form-label">V&nbsp;SQL:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row type-row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Typ:</label>
+              <div class="col-sm-10">
+                <select class="form-control type-select">
+                  <option>Text</option>
+                  <option>Datum</option>
+                  <option>Výčet</option>
+                </select>
+              </div>
+            </div>
+            <div class="form-group row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Sloupec:</label>
+              <div class="col-sm-10">
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
+                  <label class="form-check-label" for="inlineCheckbox1">Sloupec</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
+                  <label class="form-check-label" for="inlineCheckbox2">Řádek</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3">
+                  <label class="form-check-label" for="inlineCheckbox3">Hodnota</label>
+                </div>
+              </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Funkce:</label>
+                <div class="col-sm-10">
+                  <select class="selectpicker" multiple data-live-search="true">
+                    <option>SUM</option>
+                    <option>AVG</option>
+                    <option>MAX</option>
+                    <option>MIN</option>
+                  </select>
+                </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Operátory:</label>
+                <div class="col-sm-10">
+                  <select class="selectpicker" multiple data-live-search="true">
+                    <option>LIKE</option>
+                    <option>BETWEEN</option>
+                    <option>EQUAL</option>
+                    <option>LESS</option>
+                  </select>
+                </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <span class="panel-title">
+            <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
+              <i class="fas fa-angle-right"></i> Fakulta
+            </a>
+            <span class="align-right collapse-actions">
+              <span class="action-padding input-action-margin-collapse sort-icon">
+                <i class="fas fa-sort"></i>
+              </span>
+              <span class="action-padding action-button input-action-margin-collapse">
+                <a href=# class="action-link far fa-trash-alt"></a>
+              </span>
+            </span>
+          </span>
+        </div>
+        <div id="collapse3" class="panel-collapse collapse">
+          <div class="panel-body">
+            <div class="form-group row">
+              <label for="name" class="col-sm-2 col-form-label">Název:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row">
+              <label for="name" class="col-sm-2 col-form-label">V&nbsp;SQL:</label>
+              <div class="col-sm-10">
+                <input type="text" class="form-control" id="name">
+              </div>
+            </div>
+            <div class="form-group row type-row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Typ:</label>
+              <div class="col-sm-10">
+                <select class="form-control type-select">
+                  <option value="1">Text</option>
+                  <option value="2">Datum</option>
+                  <option value="3">Výčet</option>
+                </select>
+              </div>
+            </div>
+
+            <div class="enum_box">
+              Hodnoty:
+              <div class="enum_values col-md-8">
+                  <div id="enum-wrapper">
+                    <div class="input-action-box input-border-bottom">
+                      <input type="text" readonly class="form-control-plaintext" value="Doktorský">
+
+                      <span class="action-padding input-action-margin sort-icon">
+                        <i class="fas fa-sort"></i>
+                      </span>
+                      <span class="action-padding action-button input-action-margin">
+                        <a href=# class="action-link far fa-trash-alt"></a>
+                      </span>
+                    </div>
+                    <div class="input-action-box input-border-bottom">
+                      <input type="text" readonly class="form-control-plaintext" value="Navazující">
+
+                      <span class="action-padding input-action-margin sort-icon">
+                        <i class="fas fa-sort"></i>
+                      </span>
+                      <span class="action-padding action-button input-action-margin">
+                        <a href=# class="action-link far fa-trash-alt"></a>
+                      </span>
+
+                    </div>
+                    <div class="input-action-box input-border-bottom">
+                      <input type="text" readonly class="form-control-plaintext" value="Bakalářský">
+
+                      <span class="action-padding input-action-margin sort-icon">
+                        <i class="fas fa-sort"></i>
+                      </span>
+                      <span class="action-padding action-button input-action-margin">
+                        <a href=# class="action-link far fa-trash-alt"></a>
+                      </span>
+                    </div>
+                </div>
+                <div class="form-group row form-add-item">
+                  <div class="col-md-9">
+                    <input id="enum-input" type="text" class="form-control">
+                  </div>
+                  <span id="enum-button" class="btn btn-primary mb-2">Přidat</span>
+                </div>
+              </div>
+            </div>
+
+            <div class="form-group row">
+              <label for="exampleFormControlSelect1" class="col-sm-2">Sloupec:</label>
+              <div class="col-sm-10">
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
+                  <label class="form-check-label" for="inlineCheckbox1">Sloupec</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
+                  <label class="form-check-label" for="inlineCheckbox2">Řádek</label>
+                </div>
+                <div class="form-check form-check-inline">
+                  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3">
+                  <label class="form-check-label" for="inlineCheckbox3">Hodnota</label>
+                </div>
+              </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Funkce:</label>
+                <div class="col-sm-10">
+                  <select class="mbSelect selectpicker" multiple data-live-search="true">
+                    <option>SUM</option>
+                    <option>AVG</option>
+                    <option>MAX</option>
+                    <option>MIN</option>
+                  </select>
+                </div>
+            </div>
+            <div class="form-group row">
+                <label for="exampleFormControlSelect1" class="col-sm-2">Operátory:</label>
+                <div class="col-sm-10">
+                  <select class="mbSelect selectpicker" multiple data-live-search="true">
+                    <option>LIKE</option>
+                    <option>BETWEEN</option>
+                    <option>EQUAL</option>
+                    <option>LESS</option>
+                  </select>
+                </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+
+  <div class="container box">
+    <div class="col-md-4">
+    <div class="box-header">
+      <h3 class="box-title">Oprávnění</h3>
+    </div>
+    <div id ="permission-wrapper">
+        <div class="input-action-box input-border-bottom input-row">
+            <input type="text" readonly class="form-control-plaintext permission-role" id="1" value="Rektor">
+            <span class="action-padding action-button input-action-margin">
+                <a href=# class="action-link far fa-trash-alt" onclick="removeRole(this);"></a>
+            </span>
+        </div>
+        <div class="input-action-box input-border-bottom input-row">
+            <input type="text" readonly class="form-control-plaintext permission-role" id="2" value="Referentka">
+            <span class="action-padding action-button input-action-margin">
+                <a href=# class="action-link far fa-trash-alt" onclick="removeRole(this);"></a>
+            </span>
+        </div>
+    </div>
+
+    <div class="form-group row form-add-item">
+      <div class="col-md-9">
+        <select class="form-control " id="permission-select" name="permission-select">
+          <option value="1">Rektor</option>
+          <option value="2">Studijní oddělení</option>
+          <option value="3">Strudenti</option>
+        </select>
+      </div>
+      <span class="btn btn-primary mb-2" id="permission-button">Přidat</span>
+    </div>
+  </div>
+</div>
+  <div class="submit_center_button">
+      <button type="submit" class="btn btn-success mb-2">Uložit</button>
+  </div>
+
+</form>
+
+
+</main>
+
+<footer class="text-muted">
+  <div class="container">
+
+  </div>
+</footer>
+
+<script type="text/javascript" src="js/app.js"></script>
+</body>
+</html>
+<script type="text/javascript">
+
+    $(document).ready(function() {
+        $(".sort").sortable().disableSelection();
+        $("#enum-wrapper").sortable().disableSelection();
+
+        $('.type-select').on('change', function () {
+            if (this.value == 3)
+            {
+        console.log('a');
+                addEnum(this);
+            }
+            else
+            {
+                removeEnum(this);
+            }
+        });
+
+
+        $('.fa-trash-alt').click(function(event){
+            event.preventDefault();
+        });
+
+    });
+
+    $('#permission-button').on('click', function () {
+        var selectedRoleId = $('select[name=permission-select] option').filter(':selected').val();
+        var selectedRoleValue = $('select[name=permission-select] option').filter(':selected').text();
+
+        var addedRoles = $('.permission-role');
+
+        var roles = [];
+
+        // get assigned roles
+        addedRoles.each(function () {
+            roles.push($(this).attr('id'))
+        });
+
+        if (roles.includes(selectedRoleId))
+        {
+            return;
+        }
+
+        addPermissionRow(selectedRoleId, selectedRoleValue);
+
+    });
+
+
+    function addPermissionRow(id, value){
+
+        let row = document.createElement('div');
+        row.classList.add('input-action-box', 'input-border-bottom', 'permission-row');
+
+        let input = document.createElement('input');
+        input.type = 'text';
+        input.classList.add('form-control-plaintext', 'permission-role');
+        input.id = id;
+        input.value = value;
+        input.setAttribute('readonly', "true");
+
+        row.appendChild(input);
+
+        let actionButton = document.createElement('span');
+        actionButton.classList.add('action-padding', 'action-button', 'input-action-margin');
+
+        let deleteButton = document.createElement('a');
+        deleteButton.classList.add('action-link', 'far', 'fa-trash-alt');
+        deleteButton.setAttribute('onclick', 'removeRole(this);');
+        deleteButton.setAttribute('role', 'button');
+
+        actionButton.appendChild(deleteButton);
+        row.appendChild(actionButton);
+
+        document.getElementById('permission-wrapper').appendChild(row);
+
+    };
+
+    $('#enum-button').on('click', function () {
+        var value = $('#enum-input').val();
+        console.log('a');
+        addEnumRow(value);
+
+
+
+    });
+
+    function addEnumRow(value)
+    {
+      let row = document.createElement('div');
+      row.classList.add('input-action-box', 'input-border-bottom');
+
+
+      let input = document.createElement('input');
+      input.type = 'text';
+      input.classList.add('form-control-plaintext');
+      input.value = value;
+      input.setAttribute('readonly', "true");
+
+      row.appendChild(input);
+
+      let sortSpan = document.createElement('span');
+      sortSpan.classList.add('action-padding', 'input-action-margin', 'sort-icon');
+      sortSpan.innerHTML = "<i class=\"fas fa-sort\"></i>";
+
+      row.appendChild(sortSpan);
+
+      let deleteSpan = document.createElement('span');
+      deleteSpan.classList.add('action-padding', 'input-action-margin', 'action-button');
+
+      let deleteButton = document.createElement('a');
+      deleteButton.classList.add('action-link', 'far', 'fa-trash-alt');
+      deleteButton.setAttribute('onclick', 'removeEnum(this);');
+
+      deleteSpan.appendChild(deleteButton);
+
+      row.appendChild(deleteSpan);
+
+      document.getElementById('enum-wrapper').appendChild(row);
+
+    }
+
+
+    function removeRole (selectedField) {
+        selectedField.closest('.input-row').remove();
+    }
+
+
+    function addEnum(select)
+    {
+      console.log(select.parent());
+      let row = document.createElement('div');
+      row.classList.add('enum_box');
+      row.innerHTML = "Hodnoty:";
+
+      let values = document.createElement('div');
+      values.classList.add('enum_values', 'col-md-8');
+
+      let valuesWrapper = document.createElement('div');
+      valuesWrapper.id = "enum-wrapper";
+
+      values.appendChild(valuesWrapper);
+
+      let addButtonDiv = document.createElement('div');
+      addButtonDiv.classList.add('form-group', 'row', 'form-add-item');
+
+      let addInnerButton = document.createElement('div');
+      addInnerButton.classList.add('col-md-9');
+
+      let input = document.createElement('input');
+      input.type = 'text';
+      input.id = "enum-input";
+      input.classList.add('form-control');
+
+
+      let addButton = document.createElement('span');
+      addButton.classList.add('btn', 'btn-primary', 'mb-2');
+      addButton.innerHTML = 'Přidat';
+      addButton.id = "enum-button";
+
+      addInnerButton.appendChild(input);
+      addButtonDiv.appendChild(addInnerButton);
+      addButtonDiv.appendChild(addButton);
+
+      values.appendChild(addButtonDiv);
+      row.appendChild(values);
+
+      select.appendChild(row);
+
+      $(row).insertAfter($('.type-row'));
+
+      $('#enum-button').on('click', function () {
+        var value = $('#enum-input').val();
+        console.log('a');
+        addEnumRow(value);
+      });
+    }
+
+  
+    function removeEnum(select) {
+      $('.enum_box').remove();
+
+    }
+
+</script>
+
