Skip to content
Snippets Groups Projects
Unverified Commit 8d2a1486 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add annotation updating and fix value setting

parent 22fd5baa
Branches
No related tags found
No related merge requests found
Pipeline #18005 passed
...@@ -777,28 +777,14 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem ...@@ -777,28 +777,14 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
return results; return results;
} }
// /**
// * Returns the list of files of annotations of a queued file
// */
// getAnnotationsHtml(key) {
// const annotations = this.queuedFilesAnnotations[key] || [];
// return annotations.length > 0 ?
// html`
// <button class="button"
// title="Add annotation"
// @click="${() => { this.addAnnotation(key); }}">
// <dbp-icon name="plus"></dbp-icon></button>
// ${this.getAnnotationLinesHtml(key)}
// ` :
// html``;
// }
/** /**
* Returns the list of files of annotations of a queued file * Returns the list of files of annotations of a queued file
* *
* @returns {*[]} Array of html templates * @returns {*[]} Array of html templates
*/ */
getAnnotationsHtml(key) { getAnnotationsHtml(key) {
// console.log("getAnnotationsHtml(key)", key);
const annotations = this.queuedFilesAnnotations[key] || []; const annotations = this.queuedFilesAnnotations[key] || [];
const ids = Object.keys(annotations); const ids = Object.keys(annotations);
let results = []; let results = [];
...@@ -807,10 +793,10 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem ...@@ -807,10 +793,10 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
const data = this.queuedFilesAnnotations[key][id] || []; const data = this.queuedFilesAnnotations[key][id] || [];
results.push(html` results.push(html`
<div class="annotation-block"> <div class="annotation-block" class="annotation-block-${key}-${id}">
<input type="text" value="${data.key1}" placeholder="key1" /> <input type="text" .value="${data.key1}" @change=${e => { this.updateAnnotation(key, id, 'key1', e.target.value); }} placeholder="key1" />
<input type="text" value="${data.key2}" placeholder="key2" /> <input type="text" .value="${data.key2}" @change=${e => { this.updateAnnotation(key, id, 'key2', e.target.value); }} placeholder="key2" />
<input type="text" value="${data.value}" placeholder="value" /> <input type="text" .value="${data.value}" @change=${e => { this.updateAnnotation(key, id, 'value', e.target.value); }} placeholder="value" />
<button class="button" <button class="button"
title="Remove annotation" title="Remove annotation"
@click="${() => { this.removeAnnotation(key, id); }}"> @click="${() => { this.removeAnnotation(key, id); }}">
......
...@@ -128,8 +128,6 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement { ...@@ -128,8 +128,6 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement {
// we just need this so the UI will update // we just need this so the UI will update
this.queuedFilesAnnotationsCount++; this.queuedFilesAnnotationsCount++;
console.log("this.queuedFilesAnnotations", this.queuedFilesAnnotations);
} }
/** /**
...@@ -146,6 +144,20 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement { ...@@ -146,6 +144,20 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement {
} }
} }
/**
* Update an annotation of a file on the queue
*
* @param key
* @param id
* @param annotationKey
* @param value
*/
async updateAnnotation(key, id, annotationKey, value) {
if (this.queuedFilesAnnotations[key] && this.queuedFilesAnnotations[key][id]) {
this.queuedFilesAnnotations[key][id][annotationKey] = value;
}
}
/** /**
* Add an annotation to a file on the queue * Add an annotation to a file on the queue
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment