commit 258305769343913bd212874b9eee42b33afb71cd
Author: cagy <ml.cagy@seznam.cz>
Date:   Tue May 26 20:25:07 2020 +0200

    re #8114 - added flag for delete (enum values)

diff --git a/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java b/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
index d7ecb820..d556e56b 100644
--- a/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
+++ b/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
@@ -33,6 +33,9 @@ public class ParameterValue extends EntityParent {
         this.setValue(value);
     }
 
+    @Transient
+    public int isDeleted = 0;
+
     /**
      * Equal method for comparing two objects.
      * @param obj - Comparing object.
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
index 38f33b35..53cbe45b 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
@@ -369,6 +369,15 @@ public class ParameterManagerImpl implements ParameterManager {
         Parameter parameter = this.parameterRepository.getById(parameterId);
         List<ParameterValue> currentParameterValues = parameter.getParameterValues();
 
+        // remove marked elements
+        for (int i = newParameterValues.size() - 1 ; i >= 0 ; i--)
+        {
+            if (newParameterValues.get(i).isDeleted == 1)
+            {
+                newParameterValues.remove(i);
+            }
+        }
+
         // Get new parameter values.
         List<ParameterValue> currentParameterValuesNew = new LinkedList<>(currentParameterValues);
         List<ParameterValue> newParameterValuesNew = new LinkedList<>(newParameterValues);
diff --git a/src/main/webapp/WEB-INF/templates/assembly_manage.html b/src/main/webapp/WEB-INF/templates/assembly_manage.html
index f771cde8..0011807e 100644
--- a/src/main/webapp/WEB-INF/templates/assembly_manage.html
+++ b/src/main/webapp/WEB-INF/templates/assembly_manage.html
@@ -111,6 +111,7 @@
                           <input type="hidden" class="enum-index" th:value="${i.index}">
                           <div th:each="parameterValue, j : *{parameters[__${i.index}__].parameterValues}" class="input-action-box input-border-bottom enum-row">
                             <input type="hidden" class="enum-parameter-index" th:value="${j.index}">
+                            <input type="hidden" class="is-deleted" th:field="*{parameters[__${i.index}__].parameterValues[__${j.index}__].isDeleted}" th:value="*{parameters[__${i.index}__].parameterValues[__${j.index}__].isDeleted}">
                             <input type="text" readonly class="form-control-plaintext" th:field="*{parameters[__${i.index}__].parameterValues[__${j.index}__].value}" th:value="*{parameters[__${i.index}__].parameterValues[__${j.index}__].value}">
 
                             <span class="action-padding input-action-margin sort-icon">
diff --git a/src/main/webapp/js/assemblyManageScripts.js b/src/main/webapp/js/assemblyManageScripts.js
index 92de6046..d1862965 100644
--- a/src/main/webapp/js/assemblyManageScripts.js
+++ b/src/main/webapp/js/assemblyManageScripts.js
@@ -152,13 +152,21 @@ function addEnumRow(context, value)
     input.setAttribute('id', `parameters${enumIndex}.parameterValues${countIndex}.value`);
     input.setAttribute('name', `parameters[${enumIndex}].parameterValues[${countIndex}].value`);
 
+
     let inputIndex = document.createElement('input');
     inputIndex.type = 'hidden';
     inputIndex.classList.add('enum-parameter-index');
     inputIndex.setAttribute('value', countIndex);
 
+    let isDeleted = document.createElement('input');
+    isDeleted.type = 'hidden';
+    isDeleted.classList.add('is-deleted');
+    isDeleted.setAttribute('value', '0');
+    isDeleted.setAttribute('name', `parameters[${enumIndex}].parameterValues[${countIndex}].isDeleted`);
+
     row.appendChild(input);
     row.appendChild(inputIndex);
+    row.appendChild(isDeleted);
 
     let sortSpan = document.createElement('span');
     sortSpan.classList.add('action-padding', 'input-action-margin', 'sort-icon');
@@ -212,7 +220,9 @@ function hideEnum(select) {
  * @param select
  */
 function removeEnum(select) {
-    $(select).closest(".enum-row").remove();
+    var enumRow = $(select).closest(".enum-row");
+    enumRow.addClass("hidden");
+    enumRow.find('.is-deleted').val('1');
 }
 
 /**
