diff --git a/webapp/src/app/modules/person-projects/person-projects.component.html b/webapp/src/app/modules/person-projects/person-projects.component.html
index e5d5bad9..5372cfb4 100644
--- a/webapp/src/app/modules/person-projects/person-projects.component.html
+++ b/webapp/src/app/modules/person-projects/person-projects.component.html
@@ -11,11 +11,17 @@
diff --git a/webapp/src/app/modules/person-projects/person-projects.component.ts b/webapp/src/app/modules/person-projects/person-projects.component.ts
index 2328bff5..91dda724 100644
--- a/webapp/src/app/modules/person-projects/person-projects.component.ts
+++ b/webapp/src/app/modules/person-projects/person-projects.component.ts
@@ -5,10 +5,10 @@ import { DfgInstitutionSummaryPage } from '../../api/model/dfgInstitutionSummary
import {
CordisEuProjectPage,
DfgProjectPage,
- Author,
- Institution,
AuthorPage,
InstitutionPageV2,
+ TopicPageV2,
+ DfgPersonSummaryPage,
} from '../../api';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
@@ -37,9 +37,10 @@ export class PersonProjectsComponent {
personCordisEuProjectPage = input.required();
selectedDfgInstitutionsPage = input.required();
- selectedDfgAuthorsPage = input.required();
+ selectedDfgAuthorsPage = input.required();
selectedEuInstitutionsPage = input.required();
selectedEuAuthorsPage = input.required();
+ selectedTopicsPage = input.required();
readonly dfgQueryParamKeys = projectQueryParamKeys;
readonly euQueryParamKeys = euProjectQueryParamKeys;
diff --git a/webapp/src/app/shared/ui/project-filters/project-filters.component.ts b/webapp/src/app/shared/ui/project-filters/project-filters.component.ts
index 999a30dd..22f41f3b 100644
--- a/webapp/src/app/shared/ui/project-filters/project-filters.component.ts
+++ b/webapp/src/app/shared/ui/project-filters/project-filters.component.ts
@@ -6,12 +6,10 @@ import { MatIconModule } from '@angular/material/icon';
import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage';
import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary';
import {
- Author,
- AuthorPage,
DfgPersonSummary,
DfgPersonSummaryPage,
- Institution,
- InstitutionPageV2,
+ Topic,
+ TopicPageV2,
} from '../../../api';
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
import { SearchableDfgInstitutionSelectComponent } from '../searchable-dfg-institution-select/searchable-dfg-institution-select.component';
@@ -24,6 +22,7 @@ import {
} from '../selected-filters/selected-filters.component';
import { map } from 'rxjs/internal/operators/map';
import { SearchableDfgAuthorSelectComponent } from '../searchable-dfg-author-select/searchable-dfg-author-select.component';
+import { SearchableTopicSelectComponent } from '../searchable-topic-select/searchable-topic-select.component';
@Component({
selector: 'app-project-filters',
@@ -35,6 +34,7 @@ import { SearchableDfgAuthorSelectComponent } from '../searchable-dfg-author-sel
SearchableDfgAuthorSelectComponent,
SearchableYearSelectComponent,
SelectedFiltersComponent,
+ SearchableTopicSelectComponent,
],
templateUrl: './project-filters.component.html',
styleUrl: './project-filters.component.scss',
@@ -45,8 +45,6 @@ export class ProjectFilterComponent {
// Each tab (DFG / EU) passes its OWN key set so they never collide.
queryParamKeys = projectQueryParamKeys;
- selectedTopics = input([]);
-
// selectedAuthorsPage = input();
// selectedAuthors = computed(
// () => this.selectedAuthorsPage()?.elements || [],
@@ -59,12 +57,17 @@ export class ProjectFilterComponent {
selectedInstitutions = computed(
() => this.selectedInstitutionsPage()?.elements || [],
);
+ selectedTopicsPage = input();
+ selectedTopics = computed(
+ () => this.selectedTopicsPage()?.elements || [],
+ );
showTitleFilter = input(true);
showInstitutionFilter = input(true);
showAuthorFilter = input(true);
- showYearFilter = input(true);
-
+ showFundingStartFilter = input(true);
+ showFundingEndFilter = input(false);
+ showTopicFilter = input(true);
queryParamMap = toSignal(this.router.routerState.root.queryParamMap, {
initialValue: this.router.routerState.snapshot.root.queryParamMap,
});
@@ -77,17 +80,31 @@ export class ProjectFilterComponent {
this.queryParamMap().getAll(this.queryParamKeys.authorId),
);
- selectedYears = computed(() =>
- this.queryParamMap().getAll(this.queryParamKeys.years).map(Number),
+ selectedFundingStartYears = computed(() =>
+ this.queryParamMap().getAll(this.queryParamKeys.funding_start).map(Number),
);
- yearLabel = computed(() => {
- const selectedYears = this.selectedYears();
+ selectedFundingEndYears = computed(() =>
+ this.queryParamMap().getAll(this.queryParamKeys.funding_end).map(Number),
+ );
+ fundingStartYearLabel = computed(() => {
+ const selectedYears = this.selectedFundingStartYears();
if (selectedYears.length === 0) {
- return 'Jahr';
+ return 'Förderbeginn';
} else if (selectedYears.length === 1) {
return selectedYears[0].toString();
} else {
- return `${selectedYears.length} Jahre`;
+ return `${selectedYears.join(', ')} Jahre`;
+ }
+ });
+
+ fundingEndYearLabel = computed(() => {
+ const selectedYears = this.selectedFundingEndYears();
+ if (selectedYears.length === 0) {
+ return 'Förderende';
+ } else if (selectedYears.length === 1) {
+ return selectedYears[0].toString();
+ } else {
+ return `${selectedYears.join(', ')} Jahre`;
}
});
@@ -115,9 +132,16 @@ export class ProjectFilterComponent {
return [
{ id: 'search', queryParamKey: keys.title, icon: 'search' },
{
- id: 'years',
- queryParamKey: projectQueryParamKeys.years,
+ id: 'fundingStart',
+ queryParamKey: projectQueryParamKeys.funding_start,
icon: 'calendar_today',
+ valueFormatter: (value: string) => `Förderbeginn ${value}`,
+ },
+ {
+ id: 'fundingEnd',
+ queryParamKey: projectQueryParamKeys.funding_end,
+ icon: 'event_busy',
+ valueFormatter: (value: string) => `Förderende ${value}`,
},
{
id: 'institutions',
@@ -135,24 +159,57 @@ export class ProjectFilterComponent {
this.selectedAuthors().find((a) => String(a.person_id) === value)
?.full_name ?? value,
},
+ {
+ id: 'topics',
+ queryParamKey: keys.topicId,
+ icon: 'topic',
+ valueFormatter: (value: string) => {
+ const topic = this.selectedTopics().find((t) => t.id === value);
+ return topic ? topic.display_name : value;
+ },
+ },
];
});
- handleYearSelectChange = (selectedYear: number): void => {
- if (this.selectedYears().includes(selectedYear)) {
+ handleFundingStartSelectChange = (selectedYear: number): void => {
+ if (this.selectedFundingStartYears().includes(selectedYear)) {
this.router.navigate([], {
queryParams: {
- [projectQueryParamKeys.years]: this.selectedYears().filter(
- (year) => year !== selectedYear,
- ),
+ [projectQueryParamKeys.funding_start]:
+ this.selectedFundingStartYears().filter(
+ (year) => year !== selectedYear,
+ ),
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
- [projectQueryParamKeys.years]: [
- ...this.selectedYears(),
+ [projectQueryParamKeys.funding_start]: [
+ ...this.selectedFundingStartYears(),
+ selectedYear,
+ ],
+ },
+ queryParamsHandling: 'merge',
+ });
+ }
+ };
+ handleFundingEndSelectChange = (selectedYear: number): void => {
+ if (this.selectedFundingEndYears().includes(selectedYear)) {
+ this.router.navigate([], {
+ queryParams: {
+ [projectQueryParamKeys.funding_end]:
+ this.selectedFundingEndYears().filter(
+ (year) => year !== selectedYear,
+ ),
+ },
+ queryParamsHandling: 'merge',
+ });
+ } else {
+ this.router.navigate([], {
+ queryParams: {
+ [projectQueryParamKeys.funding_end]: [
+ ...this.selectedFundingEndYears(),
selectedYear,
],
},
@@ -190,6 +247,41 @@ export class ProjectFilterComponent {
});
};
+ topicLabel = computed(() => {
+ const selectedTopicIds = this.selectedTopics().map((t) => t.id);
+ if (selectedTopicIds.length === 0) {
+ return 'Thema';
+ } else if (selectedTopicIds.length === 1) {
+ const topic = this.selectedTopics()[0];
+ return topic.display_name || 'Thema';
+ } else {
+ return `${selectedTopicIds.length} Themen`;
+ }
+ });
+
+ handleTopicSelectChange = (selectedTopic: Topic): void => {
+ if (this.selectedTopics().some((t) => t.id === selectedTopic.id)) {
+ this.router.navigate([], {
+ queryParams: {
+ [this.queryParamKeys.topicId]: this.selectedTopics()
+ .filter((t) => t.id !== selectedTopic.id)
+ .map((t) => t.id),
+ },
+ queryParamsHandling: 'merge',
+ });
+ } else {
+ this.router.navigate([], {
+ queryParams: {
+ [this.queryParamKeys.topicId]: [
+ ...this.selectedTopics().map((t) => t.id!),
+ selectedTopic.id,
+ ],
+ },
+ queryParamsHandling: 'merge',
+ });
+ }
+ };
+
resetFilters = (): void => {
const keys = this.queryParamKeys;
this.router.navigate([], {
@@ -197,7 +289,8 @@ export class ProjectFilterComponent {
[keys.title]: null,
[keys.institutionId]: null,
[keys.authorId]: null,
- [keys.years]: null,
+ [keys.funding_start]: null,
+ [keys.funding_end]: null,
[keys.page]: 0,
},
queryParamsHandling: 'merge',