Merge remote-tracking branch 'origin/dev' into topic-colored-chips
This commit is contained in:
@@ -53,14 +53,18 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>calendar_today</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getStartDate() || 'N/A' }}</strong>
|
||||
<strong>{{
|
||||
bundProject.funding_start_date | date: 'dd.MM.yyyy'
|
||||
}}</strong>
|
||||
<span>Förderbeginn</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metric-item">
|
||||
<mat-icon>event_busy</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getFundingStatus(getEndDate()) }}</strong>
|
||||
<strong>{{
|
||||
getFundingStatus(bundProject.funding_end_date)
|
||||
}}</strong>
|
||||
<span>Förderende</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,7 +81,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>paid</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getFundingAmountDisplay() }}</strong>
|
||||
<strong>{{
|
||||
bundProject.funding_amount
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>Fördersumme</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -351,7 +358,12 @@
|
||||
@if (bundProject.funding_amount) {
|
||||
<div class="detail-row">
|
||||
<dt>Fördersumme</dt>
|
||||
<dd>{{ getFundingAmountDisplay() }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
bundProject.funding_amount
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (bundProject.funding_amount) {
|
||||
@@ -374,12 +386,16 @@
|
||||
<dt>Förderende</dt>
|
||||
<dd>{{ getFundingStatus(getEndDate()) }}</dd>
|
||||
</div> -->
|
||||
@if (getDuration()) {
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>{{ getDuration() }}</dd>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>
|
||||
von
|
||||
{{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} bis
|
||||
{{ bundProject.funding_end_date | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@if (bundProject.joint_project) {
|
||||
<div class="detail-row">
|
||||
<dt>Gemeinschaftsprojekt</dt>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { BundProjectDetails } from '../../../api/model/bundProjectDetails';
|
||||
import { Router } from '@angular/router';
|
||||
import { formatGermanDate } from '../../../shared/utils/formatters';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bund-details',
|
||||
standalone: true,
|
||||
@@ -14,10 +13,10 @@ import { formatGermanDate } from '../../../shared/utils/formatters';
|
||||
styleUrl: './bund-details.component.scss',
|
||||
})
|
||||
export class BundDetailsComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
bundProject: BundProjectDetails | undefined;
|
||||
|
||||
constructor(private router: Router) {}
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.data.subscribe(({ bundSingleProject }) => {
|
||||
@@ -38,25 +37,13 @@ export class BundDetailsComponent implements OnInit {
|
||||
getFundingStatus(fundingEndDate: string | null | undefined): string {
|
||||
if (!fundingEndDate) return 'N/A';
|
||||
if (fundingEndDate === '2999') return 'laufend';
|
||||
const year = parseInt(fundingEndDate, 10);
|
||||
if (isNaN(year)) return fundingEndDate;
|
||||
const year = Number.parseInt(fundingEndDate, 10);
|
||||
if (Number.isNaN(year)) return fundingEndDate;
|
||||
return year >= new Date().getFullYear()
|
||||
? `${fundingEndDate}`
|
||||
: `${fundingEndDate}`;
|
||||
}
|
||||
|
||||
formatCurrency(amount: number | null | undefined): string {
|
||||
if (amount === null || amount === undefined) return 'N/A';
|
||||
|
||||
// Format as Euro with thousands separators
|
||||
return new Intl.NumberFormat('de-DE', {
|
||||
style: 'currency',
|
||||
currency: 'EUR',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
searchForPersonName(personName: string): void {
|
||||
this.router.navigate(['/persons'], {
|
||||
queryParams: {
|
||||
@@ -110,22 +97,7 @@ export class BundDetailsComponent implements OnInit {
|
||||
getAssociatedPersons(): string[] {
|
||||
return this.bundProject?.associated_persons || [];
|
||||
}
|
||||
getStartDate(): string {
|
||||
return formatGermanDate(this.bundProject?.funding_start_date ?? '');
|
||||
}
|
||||
|
||||
getEndDate(): string {
|
||||
return formatGermanDate(this.bundProject?.funding_end_date ?? '');
|
||||
}
|
||||
|
||||
getDuration(): string {
|
||||
const start = this.bundProject?.funding_start_date;
|
||||
const end = this.bundProject?.funding_end_date;
|
||||
|
||||
if (!start || !end) return '';
|
||||
|
||||
return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`;
|
||||
}
|
||||
/**
|
||||
* All institutions as a simple list.
|
||||
*/
|
||||
@@ -140,17 +112,10 @@ export class BundDetailsComponent implements OnInit {
|
||||
return this.bundProject?.is_new === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display name for funding amount
|
||||
*/
|
||||
getFundingAmountDisplay(): string {
|
||||
if (!this.bundProject?.funding_amount) return 'N/A';
|
||||
return this.formatCurrency(this.bundProject.funding_amount);
|
||||
}
|
||||
getStatusDisplay(fundingEndDate: string | null | undefined): string {
|
||||
if (!fundingEndDate) return 'N/A';
|
||||
if (fundingEndDate === '2999') return 'Laufend';
|
||||
const year = parseInt(fundingEndDate, 10);
|
||||
const year = Number.parseInt(fundingEndDate, 10);
|
||||
return year >= new Date().getFullYear() ? `Laufend` : `Abgeschlossen`;
|
||||
}
|
||||
getStatusColor(status: string | null | undefined): string {
|
||||
|
||||
@@ -72,14 +72,14 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>calendar_today</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatDate(euProject.startDate) || 'N/A' }}</strong>
|
||||
<strong>{{ euProject.startDate | date: 'dd.MM.yyyy' }}</strong>
|
||||
<span>Förderbeginn</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metric-item">
|
||||
<mat-icon>event_busy</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatDate(euProject.endDate) || 'N/A' }}</strong>
|
||||
<strong>{{ euProject.endDate | date: 'dd.MM.yyyy' }}</strong>
|
||||
<span>Förderende</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,7 +94,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>euro_symbol</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatCurr(euProject.ecMaxContribution) }}</strong>
|
||||
<strong>{{
|
||||
euProject.ecMaxContribution
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>EU-Beitrag</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,7 +106,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>attach_money</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatCurr(euProject.totalCost) }}</strong>
|
||||
<strong>{{
|
||||
euProject.totalCost
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>Gesamtkosten</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,19 +374,31 @@
|
||||
@if (euProject.ecMaxContribution) {
|
||||
<div class="detail-row">
|
||||
<dt>Max. EU-Beitrag</dt>
|
||||
<dd>{{ formatCurr(euProject.ecMaxContribution) }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
euProject.ecMaxContribution
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.totalCost) {
|
||||
<div class="detail-row">
|
||||
<dt>Gesamtkosten</dt>
|
||||
<dd>{{ formatCurr(euProject.totalCost) }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
euProject.totalCost
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.ecSignatureDate) {
|
||||
<div class="detail-row">
|
||||
<dt>EU-Unterzeichnung</dt>
|
||||
<dd>{{ formatDate(euProject.ecSignatureDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.nature) {
|
||||
@@ -402,22 +420,25 @@
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>
|
||||
{{
|
||||
getDuration(euProject.startDate, euProject.endDate) ||
|
||||
'N/A'
|
||||
}}
|
||||
von
|
||||
{{ euProject.startDate | date: 'dd.MM.yyyy' }}
|
||||
bis {{ euProject.endDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
@if (euProject.ecSignatureDate) {
|
||||
<div class="detail-row">
|
||||
<dt>EU-Unterzeichnung</dt>
|
||||
<dd>{{ formatDate(euProject.ecSignatureDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.contentUpdateDate) {
|
||||
<div class="detail-row">
|
||||
<dt>Letzte Aktualisierung</dt>
|
||||
<dd>{{ formatDate(euProject.contentUpdateDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.contentUpdateDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.grantDoi) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// eu-details.component.ts (refactored)
|
||||
import { Component, OnInit, inject, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, CurrencyPipe } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
@@ -9,16 +9,13 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { Subscription } from 'rxjs';
|
||||
import {
|
||||
formatGermanDate,
|
||||
formatCurrency,
|
||||
} from '../../../shared/utils/formatters';
|
||||
import { EuProjectData } from '../../../api/model/euProjectData';
|
||||
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { OrganizationsTableComponent } from './organizations-table/organizations-table/organizations-table.component';
|
||||
import { PublicationsTableComponent } from './publications-table/publications-table.component';
|
||||
import { PatentsCardsComponent } from './patents-cards/patents-cards.component';
|
||||
import { DeliverablesCardsComponent } from './deliverables-cards/deliverables-cards.component';
|
||||
|
||||
export type TabType =
|
||||
| 'overview'
|
||||
| 'organizations'
|
||||
@@ -42,13 +39,14 @@ export type TabType =
|
||||
PublicationsTableComponent,
|
||||
PatentsCardsComponent,
|
||||
DeliverablesCardsComponent,
|
||||
CurrencyPipe,
|
||||
],
|
||||
templateUrl: './eu-details.component.html',
|
||||
styleUrl: './eu-details.component.scss',
|
||||
})
|
||||
export class EuDetailsComponent implements OnInit, OnDestroy {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
// Data
|
||||
euProject: EuProjectData | undefined;
|
||||
@@ -320,30 +318,11 @@ export class EuDetailsComponent implements OnInit, OnDestroy {
|
||||
const end = new Date(endDate);
|
||||
const now = new Date();
|
||||
|
||||
if (isNaN(end.getTime())) return endDate;
|
||||
if (Number.isNaN(end.getTime())) return endDate;
|
||||
|
||||
return end >= now ? 'Laufend' : 'Abgeschlossen';
|
||||
}
|
||||
|
||||
getDuration(start: string | undefined, end: string | undefined): string {
|
||||
if (!start || !end) return '';
|
||||
return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`;
|
||||
}
|
||||
|
||||
formatDate(date: string | undefined): string | undefined {
|
||||
if (date) {
|
||||
return formatGermanDate(date);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
formatCurr(value: number | undefined | null): string | null | undefined {
|
||||
if (value) {
|
||||
return formatCurrency(value);
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
getStatusColor(status: string | null | undefined): string {
|
||||
if (!status) return '#95a5a6';
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
<td mat-cell *matCellDef="let org">
|
||||
@if (org.ecContribution) {
|
||||
<span class="currency-value">{{
|
||||
formatCurr(org.ecContribution)
|
||||
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</span>
|
||||
} @else {
|
||||
<span class="empty-value">—</span>
|
||||
|
||||
+3
-9
@@ -1,18 +1,18 @@
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { formatCurrency } from '../../../../../shared/utils/formatters';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatCard } from '@angular/material/card';
|
||||
import { HEUOrganization } from '../../../../../api';
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
@Component({
|
||||
selector: 'app-organizations-table',
|
||||
imports: [MatTableModule, MatIcon, MatCard],
|
||||
imports: [MatTableModule, MatIcon, MatCard, CurrencyPipe],
|
||||
templateUrl: './organizations-table.component.html',
|
||||
styleUrl: './organizations-table.component.scss',
|
||||
})
|
||||
export class OrganizationsTableComponent {
|
||||
private router = inject(Router);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@Input() orgs!: HEUOrganization[];
|
||||
@Input() showHeader: boolean = true;
|
||||
@@ -46,10 +46,4 @@ export class OrganizationsTableComponent {
|
||||
getOrgsCount(): number {
|
||||
return this.orgs?.length || 0;
|
||||
}
|
||||
formatCurr(value: number | undefined | null) {
|
||||
if (value) {
|
||||
return formatCurrency(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
<mat-divider />
|
||||
<div class="card-metadata">
|
||||
<span
|
||||
>Von {{ fundingProject.start_date | date }} bis
|
||||
{{ fundingProject.end_date | date }}</span
|
||||
>Von {{ fundingProject.start_date | date: 'dd.MM.yyyy' }} bis
|
||||
{{ fundingProject.end_date | date: 'dd.MM.yyyy' }}</span
|
||||
>
|
||||
</div>
|
||||
<mat-divider />
|
||||
|
||||
Reference in New Issue
Block a user