From 88774f6363c0fbfece29cc7d665dc60868583803 Mon Sep 17 00:00:00 2001
From: Sebastian Pongratz <s.pongratz@adito.de>
Date: Tue, 2 Feb 2021 16:10:23 +0000
Subject: [PATCH] #1072355-ProduktPreisMultiEditAnpassungen

---
 .../Productprice_entity.aod                   |  1 +
 .../entityfields/image/valueProcess.js        |  2 +-
 .../entityfields/pricelist/colorProcess.js    | 25 +++++++++++++++++++
 .../ProductpriceFilter_view.aod               | 10 +++++++-
 process/KeywordRegistry_basic/process.js      |  3 +++
 5 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 entity/Productprice_entity/entityfields/pricelist/colorProcess.js

diff --git a/entity/Productprice_entity/Productprice_entity.aod b/entity/Productprice_entity/Productprice_entity.aod
index b28ece7b96..20e53fc299 100644
--- a/entity/Productprice_entity/Productprice_entity.aod
+++ b/entity/Productprice_entity/Productprice_entity.aod
@@ -102,6 +102,7 @@
       <name>PRICELIST</name>
       <documentation>%aditoprj%/entity/Productprice_entity/entityfields/pricelist/documentation.adoc</documentation>
       <title>Price list</title>
+      <colorProcess>%aditoprj%/entity/Productprice_entity/entityfields/pricelist/colorProcess.js</colorProcess>
       <consumer>KeywordPricelists</consumer>
       <state>AUTO</state>
       <stateProcess>%aditoprj%/entity/Productprice_entity/entityfields/pricelist/stateProcess.js</stateProcess>
diff --git a/entity/Productprice_entity/entityfields/image/valueProcess.js b/entity/Productprice_entity/entityfields/image/valueProcess.js
index 8ba121f73f..adbcde4fe3 100644
--- a/entity/Productprice_entity/entityfields/image/valueProcess.js
+++ b/entity/Productprice_entity/entityfields/image/valueProcess.js
@@ -1,4 +1,4 @@
 import("system.vars");
 import("system.result");
 
-result.string("TEXT:" + vars.getString("$field.PRICELIST.displayValue"));
\ No newline at end of file
+result.string("TEXT:" + vars.getString("$field.PRODUCT_ID.displayValue"));
\ No newline at end of file
diff --git a/entity/Productprice_entity/entityfields/pricelist/colorProcess.js b/entity/Productprice_entity/entityfields/pricelist/colorProcess.js
new file mode 100644
index 0000000000..df4926b101
--- /dev/null
+++ b/entity/Productprice_entity/entityfields/pricelist/colorProcess.js
@@ -0,0 +1,25 @@
+import("system.result");
+import("KeywordRegistry_basic");
+import("system.vars");
+import("system.neon");
+
+let color; 
+
+switch (vars.get("$field.PRICELIST"))
+{
+    case $KeywordRegistry.productPricelist$keyList():
+        color = neon.PRIORITY_LOW_COLOR;
+        break;
+    case $KeywordRegistry.productPricelist$specialList():
+        color = neon.PRIORITY_HIGH_COLOR;
+        break;
+    case $KeywordRegistry.productPricelist$serviceList():
+        color = neon.PRIORITY_NONE_COLOR
+        break;
+    case $KeywordRegistry.productPricelist$standardList():
+    default:
+        color = neon.BRAND_COLOR;
+        break;
+}
+
+result.string(color);
\ No newline at end of file
diff --git a/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod b/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod
index 896078f318..9680051e73 100644
--- a/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod
+++ b/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod
@@ -107,6 +107,7 @@
         <element>PRICE</element>
         <element>VALID_FROM</element>
         <element>VALID_TO</element>
+        <element>PRODUCT_ID</element>
       </editableColumns>
       <columns>
         <neonTableColumn>
@@ -140,11 +141,18 @@
       </columns>
       <editRendererMapping>
         <rendererMappingEntry>
-          <name>cef3f0d1-1976-4c69-add7-49a37893c56b</name>
+          <name>6bd04999-36b5-4278-a975-a24414058b8e</name>
           <fieldName>PRICE</fieldName>
           <renderer>numberInput</renderer>
         </rendererMappingEntry>
       </editRendererMapping>
+      <viewRendererMapping>
+        <rendererMappingEntry>
+          <name>cece5a67-394e-4fd2-8b2d-f39660290cee</name>
+          <fieldName>PRICELIST</fieldName>
+          <renderer>badge</renderer>
+        </rendererMappingEntry>
+      </viewRendererMapping>
     </multiEditTableViewTemplate>
   </children>
 </neonView>
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index fcb12948f2..e9326c6bf1 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -82,6 +82,9 @@ $KeywordRegistry.ticketType$supportTicket = function(){return "SUPPORTTICKET";};
 
 $KeywordRegistry.productPricelist = function(){return "ProductPricelist";};
 $KeywordRegistry.productPricelist$standardList = function(){return "PRICELISTDEFAULT";};
+$KeywordRegistry.productPricelist$keyList = function(){return "PRICELISTKEY";};
+$KeywordRegistry.productPricelist$specialList = function(){return "PRICELISTSPECIAL";};
+$KeywordRegistry.productPricelist$serviceList = function(){return "PRICELISTSERVICE";};
 
 $KeywordRegistry.quantityUnit = function(){return "QuantityUnit";};
 $KeywordRegistry.quantityUnit$pieces = function(){return "QUANTITYPIECES";};
-- 
GitLab