From 16de91704a4ffdf01c57205f94087d27668a941e Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Wed, 24 Mar 2021 13:16:03 +0100
Subject: [PATCH] Add human readable signature annotation user text (#37)

---
 src/dbp-signature-lit-element.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/dbp-signature-lit-element.js b/src/dbp-signature-lit-element.js
index d324aae..65af583 100644
--- a/src/dbp-signature-lit-element.js
+++ b/src/dbp-signature-lit-element.js
@@ -282,12 +282,17 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement {
             file = await this.addAnnotationsToFile(file, annotations, i18n)
             console.log("uploadFile file", file);
 
-            // Also send to the server so it gets included in the signature block
+            // Also send annotations to the server so they get included in the signature block
             let userText = [];
-            for (let ann of annotations) {
-                userText.push({"description": ann["annotationType"], "value": `${ann["value"]} (${ann["organizationNumber"]})`});
+            for (let annotation of annotations) {
+                const annotationTypeNames = utils.getAnnotationTypes(annotation['annotationType']);
+
+                userText.push({
+                    'description': `${annotationTypeNames.de || ''} / ${annotationTypeNames.en || ''}`,
+                    'value': `${annotation['value']} (${annotation['organizationNumber']})`
+                });
             }
-            formData.append("user_text", JSON.stringify(userText));
+            formData.append('user_text', JSON.stringify(userText));
         }
 
         let url = new URL(this.fileSourceUrl);
-- 
GitLab