79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import {
|
|
Component,
|
|
computed,
|
|
input,
|
|
OnInit,
|
|
TemplateRef,
|
|
viewChild,
|
|
} from '@angular/core';
|
|
import { CordisEuProject, CordisEuProjectPage } from '../../../api';
|
|
import {
|
|
DataTableComponent,
|
|
GenericColumn,
|
|
} from '../data-table/data-table.component';
|
|
import { RouterModule } from '@angular/router';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { CurrencyPipe, DatePipe } from '@angular/common';
|
|
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
|
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
|
|
|
@Component({
|
|
selector: 'app-eu-project-table',
|
|
imports: [
|
|
DataTableComponent,
|
|
RouterModule,
|
|
MatIconModule,
|
|
MatButtonModule,
|
|
DatePipe,
|
|
CurrencyPipe,
|
|
QueryParamPaginatorComponent,
|
|
],
|
|
templateUrl: './eu-project-table.component.html',
|
|
styleUrl: './eu-project-table.component.scss',
|
|
})
|
|
export class EuProjectTableComponent implements OnInit {
|
|
page = input.required<CordisEuProjectPage>();
|
|
queryParamKeys = projectQueryParamKeys;
|
|
|
|
elements = computed(() => this.page().elements ?? []);
|
|
total = computed(() => this.page().total ?? 0);
|
|
|
|
columns: GenericColumn<CordisEuProject>[] = [];
|
|
|
|
fundingStartTmp = viewChild.required<TemplateRef<any>>('fundingStartTmp');
|
|
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
|
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
|
|
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
|
|
|
ngOnInit(): void {
|
|
this.columns = [
|
|
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
|
|
{
|
|
id: 'startDate',
|
|
header: 'Startdatum',
|
|
type: 'display',
|
|
cellTemplate: this.fundingStartTmp(),
|
|
},
|
|
{
|
|
id: 'endDate',
|
|
header: 'Enddatum',
|
|
type: 'display',
|
|
cellTemplate: this.fundingEndTmp(),
|
|
},
|
|
{
|
|
id: 'ecMaxContribution',
|
|
header: 'Förderbetrag (EU)',
|
|
type: 'display',
|
|
cellTemplate: this.fundingAmountTmp(),
|
|
},
|
|
{
|
|
id: 'actions',
|
|
header: '',
|
|
type: 'display',
|
|
cellTemplate: this.actionsTmp(),
|
|
},
|
|
];
|
|
}
|
|
}
|