diff --git a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts index 17a030b7..003ae7c2 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/eu-details.component.ts @@ -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'; diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.html b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.html new file mode 100644 index 00000000..5cbd973b --- /dev/null +++ b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.html @@ -0,0 +1,109 @@ +
+ + @if (showHeader) { +
+ business +

{{ headerTitle }} ({{ getOrgsCount() }})

+
+ } + +
+ + +
+ + {{ org.name || org.shortName || 'Unbekannte Organisation' }} + +
+
+ + + @if (org.role) { + {{ org.role }} + } @else { + — + } + + + + @if (org.city) { + + {{ org.city }} + + @if (org.country) { + + } + + } @else { + — + } + + + + @if ( + org.ecContribution !== undefined && org.ecContribution !== null + ) { + + {{ + org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' + }} + + } @else { + — + } + + + + @if (org.activityType) { + {{ org.activityType }} + } @else { + — + } + + + + @if (org.sme) { + SME + } @else { + — + } + + + + + +
+ + +
+
+
diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.scss b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.scss similarity index 99% rename from webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.scss rename to webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.scss index 5ed07f36..1d824631 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.scss +++ b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.scss @@ -1,10 +1,5 @@ // Organizations - .organizations-tab { - .card { - margin-bottom: 24px; - } - .section-header { display: flex; align-items: center; diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.ts new file mode 100644 index 00000000..ea6adba6 --- /dev/null +++ b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table.component.ts @@ -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>('nameTemplate'); + roleTemplate = viewChild>('roleTemplate'); + cityTemplate = viewChild>('cityTemplate'); + ecContributionTemplate = viewChild>( + 'ecContributionTemplate', + ); + activityTypeTemplate = viewChild>('activityTypeTemplate'); + smeTemplate = viewChild>('smeTemplate'); + organizationUrlTemplate = viewChild>( + 'organizationUrlTemplate', + ); + + columns = computed[]>(() => [ + { + 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; + } +} diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html deleted file mode 100644 index 532fbe00..00000000 --- a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.html +++ /dev/null @@ -1,121 +0,0 @@ -
- -
- business -

Organisationen ({{ orgs.length || 0 }})

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name -
- {{ - org.name || org.shortName || 'Unbekannte Organisation' - }} -
-
Rolle - @if (org.role) { - {{ org.role }} - } @else { - — - } - Stadt - @if (org.city) { - - {{ org.city }} - - - - } @else { - — - } - EU-Beitrag - @if (org.ecContribution) { - {{ - org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' - }} - } @else { - — - } - Aktivitätstyp - @if (org.activityType) { - {{ org.activityType }} - } @else { - — - } - SME - @if (org.sme) { - SME - } @else { - — - } - URL - -
-
-
-
diff --git a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts deleted file mode 100644 index de322d8a..00000000 --- a/webapp/src/app/modules/projects/eu-cordis-details/organizations-table/organizations-table/organizations-table.component.ts +++ /dev/null @@ -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; - } -} diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html index aef82ab3..63b92cb8 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.html @@ -6,138 +6,121 @@

{{ headerTitle }} ({{ getPublicationCount() }})

} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } @else { + — + } + } @else { + — + } + - - -
Titel -
- - {{ pub.title || 'Kein Titel' }} - -
-
Autoren - @if (pub.authors) { - @let authorList = parseAuthors(pub.authors); - @if (authorList.length > 0) { -
- @for (author of authorList; track author; let last = $last) { - - - {{ author }} - - @if (!last) { - , - } - + + +
+ + {{ pub.title || 'Kein Titel' }} + +
+
+ + + @if (pub.authors) { + @let authorList = parseAuthors(pub.authors); + + @if (authorList.length > 0) { +
+ @for (author of authorList; track author; let last = $last) { + + + {{ author }} + + + @if (!last) { + , } -
- } @else { - — - } - } @else { - — - } -
Zeitschrift - @if (pub.journalNumber) { - {{ - pub.journalNumber - }} - } @else { - — - } - Jahr - @if (pub.publishedYear) { - {{ pub.publishedYear }} - } @else { - — - } - Verlag - @if (pub.publisher) { - {{ pub.publisher }} - } @else { - — - } - Links - -
-
+ + @if (pub.journalNumber) { + + {{ pub.journalNumber }} + + } @else { + — + } + + + + @if (pub.publishedYear) { + {{ pub.publishedYear }} + } @else { + — + } + + + + @if (pub.publisher) { + {{ pub.publisher }} + } @else { + — + } + + + + + + + + diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss index cc50153b..c99c070b 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.scss @@ -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; -} diff --git a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts index 44f5af5e..5489f7e0 100644 --- a/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts +++ b/webapp/src/app/modules/projects/eu-cordis-details/publications-table/publications-table.component.ts @@ -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>('titleTemplate'); + authorsTemplate = viewChild>('authorsTemplate'); + journalTemplate = viewChild>('journalTemplate'); + yearTemplate = viewChild>('yearTemplate'); + publisherTemplate = viewChild>('publisherTemplate'); + linksTemplate = viewChild>('linksTemplate'); + // Displayed columns for the publications table - publicationDisplayedColumns: string[] = [ - 'title', - 'authors', - 'journal', - 'year', - 'publisher', - 'links', - ]; - author_names = computed(() => 'keka'); + columns = computed[]>(() => [ + { + 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 {