added 2 DFG projects selectors (will be reworked later)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Autoren suchen..."
|
||||
icon="person"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Autoren"
|
||||
fetchedLabel="Gefundene Autoren"
|
||||
[fetchElements]="fetchAuthors"
|
||||
[selectedElements]="selectedAuthors()"
|
||||
[getSelectLabel]="getAuthorLabel"
|
||||
[getSelectValue]="getAuthorValue"
|
||||
[getSelectDescription]="getAuthorDescription"
|
||||
(handleSelectChange)="handleAuthorSelectChange.emit($event)" />
|
||||
+44
@@ -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<string>('Authoren');
|
||||
selectedAuthors = input.required<DfgPersonSummary[]>();
|
||||
|
||||
handleAuthorSelectChange = output<DfgPersonSummary>();
|
||||
|
||||
fetchAuthors = (searchTerm: string): Observable<DfgPersonSummaryPage> => {
|
||||
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}`;
|
||||
};
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Institution suchen..."
|
||||
icon="apartment"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Institutionen"
|
||||
fetchedLabel="Gefundene Institutionen"
|
||||
[fetchElements]="fetchInstitutions"
|
||||
[selectedElements]="selectedInstitutions()"
|
||||
[getSelectLabel]="getInstitutionLabel"
|
||||
[getSelectValue]="getInstitutionValue"
|
||||
[getSelectDescription]="getInstitutionDescription"
|
||||
(handleSelectChange)="handleInstitutionSelectChange.emit($event)" />
|
||||
+43
@@ -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<string>('Institutionen');
|
||||
selectedInstitutions = input.required<DfgInstitutionSummary[]>();
|
||||
|
||||
handleInstitutionSelectChange = output<DfgInstitutionSummary>();
|
||||
|
||||
fetchInstitutions = (
|
||||
searchTerm: string,
|
||||
): Observable<DfgInstitutionSummaryPage> => {
|
||||
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! + ')'
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user