added grant id to displayfn

This commit is contained in:
Diamantis Tziotzios 2019-12-13 17:05:19 +02:00
parent e51f855737
commit 3bab68265b
4 changed files with 23 additions and 6 deletions

View File

@ -241,8 +241,8 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
onContainerClick(event: MouseEvent) {
event.stopPropagation();
this._onInputFocus();
if (this.disabled) { return; }
this._onInputFocus();
if (!this.autocomplete.isOpen) {
this.autocompleteTrigger.openPanel();
}

View File

@ -262,8 +262,8 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
onContainerClick(event: MouseEvent) {
event.stopPropagation();
this._onInputFocus();
if (this.disabled) { return; }
this._onInputFocus();
if (!this.autocomplete.isOpen) {
this.autocompleteTrigger.openPanel();
}

View File

@ -45,6 +45,14 @@ export class GrantTabComponent extends BaseComponent implements OnInit {
super();
}
getGrantIdText(item) {
if (item.reference != null && typeof item.reference == 'string') {
const parts = (item.reference as String).split('::');
return parts.length > 1 ? ' (' + parts[parts.length - 1] + ')' : '';
}
return '';
}
ngOnInit() {
const grantRequestItem: RequestItem<GrantCriteria> = new RequestItem();
@ -61,8 +69,8 @@ export class GrantTabComponent extends BaseComponent implements OnInit {
this.grantAutoCompleteConfiguration = {
filterFn: this.searchGrant.bind(this),
initialItems: () => this.searchGrant(''),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
displayFn: (item) => item['label'] + this.getGrantIdText(item),
titleFn: (item) => item['label'] + this.getGrantIdText(item),
subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};

View File

@ -17,6 +17,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
import { TranslateService } from '@ngx-translate/core';
import { Observable, of as observableOf } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { strict } from 'assert';
@Component({
selector: 'app-quick-wizard-grant-editor-component',
@ -44,6 +45,14 @@ export class GrantEditorWizardComponent extends BaseComponent implements OnInit,
super();
}
getGrantIdText(item) {
if (item.reference != null && typeof item.reference == 'string') {
const parts = (item.reference as String).split('::');
return parts.length > 1 ? ' (' + parts[parts.length - 1] + ')' : '';
}
return '';
}
ngOnInit() {
this.breadCrumbs = observableOf([{
parentComponentName: 'QuickCreate',
@ -57,8 +66,8 @@ export class GrantEditorWizardComponent extends BaseComponent implements OnInit,
this.grantAutoCompleteConfiguration = {
filterFn: this.searchGrant.bind(this),
initialItems: (extraData) => this.searchGrant(''),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
displayFn: (item) => item['label'] + this.getGrantIdText(item),
titleFn: (item) => item['label'] + this.getGrantIdText(item),
subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
};