added funding type selector for BUND projects

This commit is contained in:
2026-07-28 00:18:24 +02:00
parent b133ce80c9
commit c15afed0aa
3 changed files with 75 additions and 0 deletions
@@ -0,0 +1,11 @@
<app-searchable-select
inputPlaceholder="Typ suchen..."
icon="category"
[label]="label()"
selectedLabel="Ausgewählte Typen"
fetchedLabel="Weitere Typen"
[fetchElements]="fetchFundingTypes"
[selectedElements]="selectedBundFundingTypes()"
[getSelectLabel]="getFundingTypeLabel"
[getSelectValue]="getFundingTypeValue"
(handleSelectChange)="handleBundFundingTypeSelectChange.emit($event)" />
@@ -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<string>('Typen');
selectedBundFundingTypes = input.required<FundingType[]>();
handleBundFundingTypeSelectChange = output<FundingType>();
fetchFundingTypes = (searchTerm: string): Observable<FundingTypePage> => {
return new Observable<FundingTypePage>((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;
};
}