From 373d0850a3abf88788c453cfb8bb145af70c8f3d Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 20 Jul 2026 01:20:24 +0200 Subject: [PATCH] added 2 DFG projects selectors (will be reworked later) --- ...earchable-dfg-author-select.component.html | 12 +++++ ...earchable-dfg-author-select.component.scss | 0 .../searchable-dfg-author-select.component.ts | 44 +++++++++++++++++++ ...able-dfg-institution-select.component.html | 12 +++++ ...able-dfg-institution-select.component.scss | 0 ...chable-dfg-institution-select.component.ts | 43 ++++++++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.html create mode 100644 webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.scss create mode 100644 webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.ts create mode 100644 webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.html create mode 100644 webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.scss create mode 100644 webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.ts diff --git a/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.html b/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.html new file mode 100644 index 00000000..c52cb15c --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.html @@ -0,0 +1,12 @@ + diff --git a/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.scss b/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.ts b/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.ts new file mode 100644 index 00000000..146d37f5 --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-dfg-author-select/searchable-dfg-author-select.component.ts @@ -0,0 +1,44 @@ +import { Component, inject, input, output } from '@angular/core'; +import { DFGPersonsService } from '../../../api'; +import { DfgPersonSummaryPage } from '../../../api/model/dfgPersonSummaryPage'; +import { DfgPersonSummary } from '../../../api/model/dfgPersonSummary'; +import { Observable } from 'rxjs'; +import { SearchableSelectComponent } from '../searchable-select/searchable-select.component'; + +@Component({ + selector: 'app-searchable-dfg-author-select', + imports: [SearchableSelectComponent], + templateUrl: './searchable-dfg-author-select.component.html', + styleUrl: './searchable-dfg-author-select.component.scss', +}) +export class SearchableDfgAuthorSelectComponent { + private readonly dfgPersonsService = inject(DFGPersonsService); + + label = input('Authoren'); + selectedAuthors = input.required(); + + handleAuthorSelectChange = output(); + + fetchAuthors = (searchTerm: string): Observable => { + return this.dfgPersonsService.getDfgPersonAutocompleteForSelector( + searchTerm, + ); + }; + + getAuthorLabel = (author: DfgPersonSummary): string => { + return author.full_name!; + }; + + getAuthorValue = (author: DfgPersonSummary): string => { + return String(author.person_id!); + }; + + getAuthorDescription = (author: DfgPersonSummary): string => { + const orcidId = author.orcid_id ?? 'Unbekannt'; + const roleLabel = + (author.role_label_de || author.role_label_en) ?? 'Unbekannt'; + const rootInstitution = author.institution?.root_name_de ?? 'Unbekannt'; + const institution = author.institution?.institute_name_de ?? 'Unbekannt'; + return `ORCID: ${orcidId} - Rolle: ${roleLabel} - Wurzelinstitution: ${rootInstitution} - Institution: ${institution}`; + }; +} diff --git a/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.html b/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.html new file mode 100644 index 00000000..ea0f7c1f --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.html @@ -0,0 +1,12 @@ + diff --git a/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.scss b/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.ts b/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.ts new file mode 100644 index 00000000..33e4ff6f --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-dfg-institution-select/searchable-dfg-institution-select.component.ts @@ -0,0 +1,43 @@ +import { Component, inject, input, output } from '@angular/core'; +import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage'; +import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary'; +import { DFGInstitutionsService } from '../../../api'; +import { Observable } from 'rxjs'; +import { SearchableSelectComponent } from '../searchable-select/searchable-select.component'; + +@Component({ + selector: 'app-searchable-dfg-institution-select', + imports: [SearchableSelectComponent], + templateUrl: './searchable-dfg-institution-select.component.html', + styleUrl: './searchable-dfg-institution-select.component.scss', +}) +export class SearchableDfgInstitutionSelectComponent { + private readonly dfgInstitutionService = inject(DFGInstitutionsService); + + label = input('Institutionen'); + selectedInstitutions = input.required(); + + handleInstitutionSelectChange = output(); + + fetchInstitutions = ( + searchTerm: string, + ): Observable => { + return this.dfgInstitutionService.getDfgInstitutionAutocompleteForSelector( + searchTerm, + ); + }; + + getInstitutionLabel = (institution: DfgInstitutionSummary): string => { + return institution.institute_name_de! || institution.institute_name_en!; + }; + + getInstitutionValue = (institution: DfgInstitutionSummary): string => { + return Number(institution.id!).toString(); + }; + + getInstitutionDescription = (institution: DfgInstitutionSummary): string => { + return ( + institution.root_name_de! + ' (' + institution.address_country_de! + ')' + ); + }; +}