diff --git a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts index 638545d98..053d1a266 100644 --- a/dmp-frontend/src/app/core/services/description-template/description-template.service.ts +++ b/dmp-frontend/src/app/core/services/description-template/description-template.service.ts @@ -170,6 +170,20 @@ export class DescriptionTemplateService { popupItemActionIcon: 'visibility' }; + public buildDescriptionTempalteGroupMultipleAutocompleteConfiguration(preview: boolean = false): MultipleAutoCompleteConfiguration { + + return { + initialItems: (excludedItems: any[], data?: any) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], searchQuery, excludedItems)).pipe(map(x => x.items)), + getSelectedItems: (selectedItems: any[]) => this.query(this.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, selectedItems)).pipe(map(x => x.items)), + displayFn: (item: DescriptionTemplate) => item.label, + titleFn: (item: DescriptionTemplate) => item.label, + subtitleFn: (item: DescriptionTemplate) => item.description, + valueAssign: (item: DescriptionTemplate) => item.groupId, + popupItemActionIcon: preview ? 'visibility' : null, + }; + } + public buildDescriptionTempalteGroupAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], groupIds?: Guid[], excludedGroupIds?: Guid[]): DescriptionTemplateLookup { const lookup: DescriptionTemplateLookup = new DescriptionTemplateLookup(); lookup.page = { size: 100, offset: 0 }; diff --git a/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts b/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts index 127d075e4..29214b12d 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/filtering/dmp-filter.component.ts @@ -65,7 +65,7 @@ export class DmpFilterComponent extends BaseCriteriaComponent implements OnInit, ngOnChanges(changes: SimpleChanges): void { if (changes['filterFormGroup']) { - this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.descriptionTempalteGroupMultipleAutocompleteConfiguration; + this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.buildDescriptionTempalteGroupMultipleAutocompleteConfiguration(); this.dmpBlueprintAutoCompleteConfiguration = this.dmpBlueprintService.multipleAutocompleteConfiguration; this.referenceTypeAutocompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); this.referenceAutocompleteConfiguration = new Map();