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; + }; +}