embedded the app-table component inplace of old tables
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
2026-07-14 19:56:25 +02:00
parent 912023aa8c
commit a20759903e
9 changed files with 458 additions and 342 deletions
@@ -11,7 +11,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { Subscription } from 'rxjs';
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 { OrganizationsTableComponent } from './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';
@@ -0,0 +1,109 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
@if (showHeader) {
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>{{ headerTitle }} ({{ getOrgsCount() }})</h2>
</div>
}
<div class="organizations-table-wrapper">
<app-data-table [data]="orgsToDisplay()" [columns]="columns()">
<ng-template #nameTemplate let-org>
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || org.shortName || '')">
<span class="org-name-text">
{{ org.name || org.shortName || 'Unbekannte Organisation' }}
</span>
</div>
</ng-template>
<ng-template #roleTemplate let-org>
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #cityTemplate let-org>
@if (org.city) {
<span class="country-chip">
{{ org.city }}
@if (org.country) {
<img
alt=""
class="country-flag"
[src]="
'https://flagcdn.io/' +
getSvgByCountryCode(org.country) +
'.svg'
"
height="10" />
}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #ecContributionTemplate let-org>
@if (
org.ecContribution !== undefined && org.ecContribution !== null
) {
<span class="currency-value">
{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #activityTypeTemplate let-org>
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #smeTemplate let-org>
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #organizationUrlTemplate let-org>
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
rel="noopener noreferrer"
class="link-button"
matTooltip="Website öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="orgs.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</div>
</mat-card>
</div>
@@ -1,10 +1,5 @@
// Organizations
.organizations-tab {
.card {
margin-bottom: 24px;
}
.section-header {
display: flex;
align-items: center;
@@ -0,0 +1,148 @@
import {
Component,
computed,
inject,
Input,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { Router } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { HEUOrganization } from '../../../../api';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-organizations-table',
imports: [
MatIcon,
MatCard,
MatTooltipModule,
CurrencyPipe,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
public paginationService = inject(PaginationService);
@Input() orgs: HEUOrganization[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organisationen';
pageIndex = signal(0);
pageSize = signal(10);
orgsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.orgs.slice(startIndex, startIndex + this.pageSize());
});
nameTemplate = viewChild<TemplateRef<any>>('nameTemplate');
roleTemplate = viewChild<TemplateRef<any>>('roleTemplate');
cityTemplate = viewChild<TemplateRef<any>>('cityTemplate');
ecContributionTemplate = viewChild<TemplateRef<any>>(
'ecContributionTemplate',
);
activityTypeTemplate = viewChild<TemplateRef<any>>('activityTypeTemplate');
smeTemplate = viewChild<TemplateRef<any>>('smeTemplate');
organizationUrlTemplate = viewChild<TemplateRef<any>>(
'organizationUrlTemplate',
);
columns = computed<GenericColumn<HEUOrganization>[]>(() => [
{
id: 'name',
header: 'Name',
type: 'accessor',
accessorKey: 'name',
cellTemplate: this.nameTemplate(),
},
{
id: 'role',
header: 'Rolle',
type: 'accessor',
accessorKey: 'role',
cellTemplate: this.roleTemplate(),
},
{
id: 'city',
header: 'Stadt',
type: 'accessor',
accessorKey: 'city',
cellTemplate: this.cityTemplate(),
},
{
id: 'ecContribution',
header: 'EU-Beitrag',
type: 'accessor',
accessorKey: 'ecContribution',
cellTemplate: this.ecContributionTemplate(),
},
{
id: 'activityType',
header: 'Aktivitätstyp',
type: 'accessor',
accessorKey: 'activityType',
cellTemplate: this.activityTypeTemplate(),
},
{
id: 'sme',
header: 'SME',
type: 'accessor',
accessorKey: 'SME',
cellTemplate: this.smeTemplate(),
},
{
id: 'organizationURL',
header: 'URL',
type: 'accessor',
accessorKey: 'organizationURL',
cellTemplate: this.organizationUrlTemplate(),
},
]);
searchForInstitutionName(institutionName: string): void {
if (!institutionName) {
return;
}
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
getSvgByCountryCode(code: string | undefined | null): string {
if (!code) {
return '';
}
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -1,121 +0,0 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>Organisationen ({{ orgs.length || 0 }})</h2>
</div>
<div class="organizations-table-wrapper">
<table mat-table [dataSource]="orgs" class="mat-elevation-z2">
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let org">
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || '')">
<span class="org-name-text">{{
org.name || org.shortName || 'Unbekannte Organisation'
}}</span>
</div>
</td>
</ng-container>
<!-- Role Column -->
<ng-container matColumnDef="role">
<th mat-header-cell *matHeaderCellDef>Rolle</th>
<td mat-cell *matCellDef="let org">
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Country Column -->
<ng-container matColumnDef="country">
<th mat-header-cell *matHeaderCellDef>Stadt</th>
<td mat-cell *matCellDef="let org">
@if (org.city) {
<span class="country-chip">
{{ org.city }}
<img
alt=""
class="country-flag"
[src]="`https://flagcdn.io/${getSvgByCountryCode(org.country)}.svg`"
height="10" />
</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- EU Contribution Column -->
<ng-container matColumnDef="ecContribution">
<th mat-header-cell *matHeaderCellDef>EU-Beitrag</th>
<td mat-cell *matCellDef="let org">
@if (org.ecContribution) {
<span class="currency-value">{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Activity Type Column -->
<ng-container matColumnDef="activityType">
<th mat-header-cell *matHeaderCellDef>Aktivitätstyp</th>
<td mat-cell *matCellDef="let org">
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- SME Badge Column -->
<ng-container matColumnDef="sme">
<th mat-header-cell *matHeaderCellDef>SME</th>
<td mat-cell *matCellDef="let org">
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- URL Badge Column -->
<ng-container matColumnDef="organizationURL">
<th mat-header-cell *matHeaderCellDef>URL</th>
<td mat-cell *matCellDef="let org">
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
class="link-button"
matTooltip="Website öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="organizationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: organizationDisplayedColumns"></tr>
</table>
</div>
</mat-card>
</div>
@@ -1,49 +0,0 @@
import { Component, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
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, CurrencyPipe],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
@Input() orgs!: HEUOrganization[];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organizationen';
// Displayed columns for the organizations table
organizationDisplayedColumns: string[] = [
'name',
'role',
'country',
'ecContribution',
'activityType',
'sme',
'organizationURL',
];
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
getSvgByCountryCode(code: string) {
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -6,138 +6,121 @@
<h2>{{ headerTitle }} ({{ getPublicationCount() }})</h2>
</div>
}
<div>
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
<!-- Title Column -->
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let pub">
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</td>
</ng-container>
<!-- Authors Column -->
<ng-container matColumnDef="authors">
<th mat-header-cell *matHeaderCellDef>Autoren</th>
<td mat-cell *matCellDef="let pub">
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</span>
<app-data-table [data]="publicationsToDisplay()" [columns]="columns()">
<ng-template #titleTemplate let-pub>
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</ng-template>
<ng-template #authorsTemplate let-pub>
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</div>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Journal Column -->
<ng-container matColumnDef="journal">
<th mat-header-cell *matHeaderCellDef>Zeitschrift</th>
<td mat-cell *matCellDef="let pub">
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">{{
pub.journalNumber
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Year Column -->
<ng-container matColumnDef="year">
<th mat-header-cell *matHeaderCellDef>Jahr</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Publisher Column -->
<ng-container matColumnDef="publisher">
<th mat-header-cell *matHeaderCellDef>Verlag</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Links Column -->
<ng-container matColumnDef="links">
<th mat-header-cell *matHeaderCellDef>Links</th>
<td mat-cell *matCellDef="let pub">
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button"
matTooltip="DOI öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
</span>
}
</div>
</td>
</ng-container>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<tr mat-header-row *matHeaderRowDef="publicationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: publicationDisplayedColumns"
class="publication-row"></tr>
</table>
</div>
<ng-template #journalTemplate let-pub>
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">
{{ pub.journalNumber }}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #yearTemplate let-pub>
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #publisherTemplate let-pub>
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #linksTemplate let-pub>
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button doi-link"
matTooltip="DOI öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">link</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="publications.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</mat-card>
</div>
@@ -77,12 +77,6 @@
text-decoration: underline;
}
.authors-text {
color: #4a5a6a;
font-size: 13px;
color: #1a1a1a;
line-height: 1.4;
}
.author-name:hover {
color: #005a9c;
text-decoration: underline;
@@ -172,13 +166,6 @@
font-size: 12px;
}
.publicationDisplayedColumns {
// Hide less important columns on mobile
.mat-column-publisher {
display: none;
}
}
.journal-chip {
max-width: 120px;
font-size: 11px;
@@ -212,15 +199,6 @@
font-size: 11px;
}
.authors-text {
font-size: 11px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.links-container {
gap: 4px;
}
@@ -231,6 +209,3 @@
}
}
}
.deliverable-item {
flex-wrap: wrap;
}
@@ -1,36 +1,112 @@
import { Component, computed, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
import {
Component,
computed,
inject,
Input,
viewChild,
signal,
} from '@angular/core';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CommonModule } from '@angular/common';
import { HEUPublication } from '../../../../api';
import { Router } from '@angular/router';
import { TemplateRef } from '@angular/core';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-publications-table',
imports: [CommonModule, MatTableModule, MatIcon, MatCard, MatTooltipModule],
imports: [
CommonModule,
MatIcon,
MatCard,
MatTooltipModule,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './publications-table.component.html',
styleUrl: './publications-table.component.scss',
})
export class PublicationsTableComponent {
private router = inject(Router);
public paginationService = inject(PaginationService);
@Input() publications: HEUPublication[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Publikationen';
pageIndex = signal(0);
pageSize = signal(10);
publicationsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.publications.slice(startIndex, startIndex + this.pageSize());
});
// Templates for custom cell rendering
titleTemplate = viewChild<TemplateRef<any>>('titleTemplate');
authorsTemplate = viewChild<TemplateRef<any>>('authorsTemplate');
journalTemplate = viewChild<TemplateRef<any>>('journalTemplate');
yearTemplate = viewChild<TemplateRef<any>>('yearTemplate');
publisherTemplate = viewChild<TemplateRef<any>>('publisherTemplate');
linksTemplate = viewChild<TemplateRef<any>>('linksTemplate');
// Displayed columns for the publications table
publicationDisplayedColumns: string[] = [
'title',
'authors',
'journal',
'year',
'publisher',
'links',
];
author_names = computed(() => 'keka');
columns = computed<GenericColumn<HEUPublication>[]>(() => [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
cellTemplate: this.titleTemplate(),
},
{
id: 'authors',
header: 'Autoren',
type: 'display',
cellTemplate: this.authorsTemplate(),
},
{
id: 'journalNumber',
header: 'Zeitschrift',
type: 'accessor',
accessorKey: 'journalNumber',
cellTemplate: this.journalTemplate(),
},
{
id: 'publishedYear',
header: 'Jahr',
type: 'accessor',
accessorKey: 'publishedYear',
cellTemplate: this.yearTemplate(),
},
{
id: 'publisher',
header: 'Verlag',
type: 'accessor',
accessorKey: 'publisher',
cellTemplate: this.publisherTemplate(),
},
{
id: 'links',
header: 'Links',
type: 'display',
cellTemplate: this.linksTemplate(),
},
]);
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
/**
* Navigate to publication details
*/
searchForPublication(pub: HEUPublication): void {