From c15afed0aa6ba22f741c9d61109f12e52e35ad44 Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 28 Jul 2026 00:18:24 +0200 Subject: [PATCH] added funding type selector for BUND projects --- ...le-bund-funding-type-select.component.html | 11 ++++ ...le-bund-funding-type-select.component.scss | 0 ...able-bund-funding-type-select.component.ts | 64 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.html create mode 100644 webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.scss create mode 100644 webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.ts diff --git a/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.html b/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.html new file mode 100644 index 00000000..cbf83cbd --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.html @@ -0,0 +1,11 @@ + diff --git a/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.scss b/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.ts b/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.ts new file mode 100644 index 00000000..385367a5 --- /dev/null +++ b/webapp/src/app/shared/ui/searchable-bund-funding-type-select/searchable-bund-funding-type-select.component.ts @@ -0,0 +1,64 @@ +import { Component, input, output } from '@angular/core'; +import { SearchableSelectComponent } from '../searchable-select/searchable-select.component'; +import { Observable } from 'rxjs'; + +export type FundingType = { + id: string; + name: string; +}; + +export const projectTypes: FundingType[] = [ + { id: 'Direkte Projektförderung', name: 'Direkte Projektförderung' }, + { id: 'Indirekte Projektförderung', name: 'Indirekte Projektförderung' }, + { + id: 'Übrige indirekte Projektförderung', + name: 'Übrige indirekte Projektförderung', + }, + { + id: 'Sonstige internationale Leistungen', + name: 'Sonstige internationale Leistungen', + }, +]; + +export const findFundingTypeById = (id: string): FundingType | undefined => { + return projectTypes.find((fundingType) => fundingType.id === id); +}; + +type FundingTypePage = { + elements?: FundingType[]; + page?: number; + size?: number; + total?: number; +}; + +@Component({ + selector: 'app-searchable-bund-funding-type-select', + imports: [SearchableSelectComponent], + templateUrl: './searchable-bund-funding-type-select.component.html', + styleUrl: './searchable-bund-funding-type-select.component.scss', +}) +export class SearchableBundFundingTypeSelectComponent { + label = input('Typen'); + selectedBundFundingTypes = input.required(); + + handleBundFundingTypeSelectChange = output(); + + fetchFundingTypes = (searchTerm: string): Observable => { + return new Observable((observer) => { + observer.next({ + elements: projectTypes.filter((fundingType) => + fundingType.name.toLowerCase().includes(searchTerm.toLowerCase()), + ), + }); + observer.complete(); + }); + }; + + getFundingTypeLabel = (fundingType: FundingType): string => { + return fundingType.name; + }; + + getFundingTypeValue = (fundingType: FundingType): string => { + return fundingType.id; + }; +}