Skip to content
Snippets Groups Projects
Commit 3598f7c3 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Port from organization-select to resource-select

parent 387d8f86
No related branches found
No related tags found
No related merge requests found
Pipeline #99098 failed
......@@ -15,7 +15,6 @@ import {TextSwitch} from './textswitch.js';
import {FileSink} from '@dbp-toolkit/file-handling';
import {name as pkgName} from './../package.json';
import {send as notify} from '@dbp-toolkit/common/notification';
import {OrganizationSelect} from '@dbp-toolkit/organization-select';
import metadata from './dbp-official-signature-pdf-upload.metadata.json';
import {Activity} from './activity.js';
import {PdfAnnotationView} from './dbp-pdf-annotation-view';
......@@ -72,7 +71,6 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
'dbp-mini-spinner': MiniSpinner,
'dbp-button': Button,
'dbp-textswitch': TextSwitch,
'dbp-organization-select': OrganizationSelect,
'dbp-pdf-annotation-view': PdfAnnotationView,
};
}
......
......@@ -4,7 +4,7 @@ import {classMap} from 'lit/directives/class-map.js';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element';
import {MiniSpinner, Icon} from '@dbp-toolkit/common';
import {OrganizationSelect} from '@dbp-toolkit/organization-select';
import {ResourceSelect} from '@dbp-toolkit/resource-select';
import {send} from '@dbp-toolkit/common/notification';
import * as commonStyles from '@dbp-toolkit/common/styles';
import * as utils from './utils';
......@@ -28,7 +28,7 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) {
return {
'dbp-mini-spinner': MiniSpinner,
'dbp-icon': Icon,
'dbp-organization-select': OrganizationSelect,
'dbp-resource-select': ResourceSelect,
};
}
......@@ -360,6 +360,17 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) {
const ids = Object.keys(annotations);
let results = [];
let buildUrl = (select, url) => {
url += '/' + encodeURIComponent(select.auth['person-id']);
url += '/organizations';
url += '?' + new URLSearchParams({lang: select.lang}).toString();
return url;
};
let formatResource = (select, resource) => {
return `${resource['name']}`;
};
ids.forEach((id) => {
const data = this.annotationRows[id] || [];
const annotationTypeData = utils.getAnnotationTypes(data.annotationType);
......@@ -383,18 +394,21 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) {
</button>
</div>
<dbp-organization-select
<dbp-resource-select
subscribe="lang:lang,entry-point-url:entry-point-url,auth:auth"
class="${classMap({hidden: !annotationTypeData.hasOrganization})}"
resource-path="base/people"
.buildUrl="${buildUrl}"
.formatResource="${formatResource}"
value="${data.organizationValue}"
@change=${(e) => {
this.updateAnnotation(id, 'organizationValue', e.target.value);
this.updateAnnotation(
id,
'organizationNumber',
JSON.parse(e.target.getAttribute('data-object')).alternateName
e.target.valueObject.identifier
);
}}></dbp-organization-select>
}}></dbp-resource-select>
<input
type="text"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment