Skip to content

Commit

Permalink
add related organizations and original organization to project model …
Browse files Browse the repository at this point in the history
…and single project page
  • Loading branch information
konolak committed Dec 20, 2024
1 parent fe7cd89 commit e8035a8
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,43 @@ <h2 class="col-12 col-sm-4 col-lg-3 th">
</div>

<div *ngIf="row.field === 'participants'">
<div class="row">
<div class="col-6 g-0">
<h3 *ngIf="item['responsibleOrganizations']?.length > 0">{{row.subFields[0].label}}</h3>
<ng-container *ngFor="let org of item['responsibleOrganizations']">
<div class="mb-3"><a [href]="'/results/organization/' + org.orgId" target="_parent">{{ org.orgName }}</a></div>

</ng-container>

<h3 *ngIf="item['responsiblePerson']?.length > 0">{{row.subFields[1].label}}</h3>
</div>
<div class="col-6 g-0" *ngIf="(item['originalOrganizations']?.length > 0 && item['responsibleOrganizations']?.length > 0) && (item['originalOrganizations'][0].orgId !== item['responsibleOrganizations'][0].orgId)">
<h3>{{row.subFields[1].label}}</h3>
<ng-container *ngFor="let origOrg of item['originalOrganizations']">
<div class="mb-3">{{ origOrg.orgName }}</div>
</ng-container>
</div>
</div>
<h3 *ngIf="item['responsiblePerson']?.length > 0">{{row.subFields[2].label}}</h3>
<ng-container *ngFor="let person of item['responsiblePerson']">
<div>
{{ person.fullName }}
</div>
</ng-container>
<div></div>
<br/>
<h3 *ngIf="item['relatedOrganizations']?.length > 0">{{row.subFields[3].label}}</h3>
<ng-container *ngFor="let relOrg of item['relatedOrganizations']">
<!-- disabled since organization id's dont' match -->
<!-- <div *ngIf="relOrg.orgLinkId" class="mb-3"><a [href]="'/results/organization/' + relOrg.orgLinkId" target="_parent">{{ relOrg.orgName }}</a></div> -->
<div>
{{ relOrg.orgName }}
</div>
</ng-container>


<br/>




</div>

<div *ngIf="row.field ==='additionalInfo'">
Expand Down Expand Up @@ -210,20 +235,11 @@ <h2>
<div class="inner">
<mat-card-title><h2 i18n="@@projectSource">Hanketiedon lähde</h2>
</mat-card-title>
<div *ngFor="let source of responseData.fundings">
<p *ngIf="source.funder.name.trim().length > 0">
<ng-container
*ngIf="!item.structuralFund">{{source.funder.name}}</ng-container>

<ng-container *ngIf="item.structuralFund">Rakennerahastotietopalvelu
<!-- Structural fund source link --> (<a
href="https://www.eura2014.fi/rrtiepa/" target="_blank">eura2014.fi
<fa-icon icon="external-link-alt"></fa-icon>
</a>)
</ng-container>
<div *ngFor="let source of responseData.projects">
<p *ngIf="source.dataSource.trim().length > 0">
{{source.dataSource.trim()}}
</p>

<p *ngIf="source.funder.name.trim().length === 0"
<p *ngIf="source.dataSource.trim().length === 0"
i18n="@@noInformationSource">
Tiedon lähde ei saatavilla.
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,21 @@ export class SingleProjectComponent implements OnInit, OnDestroy {
tooltip: $localize`:@@spParticipantsTooltip:Hankkeeseen osallistuvat organisaatiot ja henkilöt`,
showOnlyLabel: true,
subFields: [{
label: $localize`:@@spOrganizations:Organisaatiot`,
label: $localize`:@@spResponsibleOrganization:Vastuuorganisaatio`,
field: 'responsibleOrganizations',
showOnlyLabel: false
},
{
label: $localize`:@@spOriginalOrganizations:Alkuperäinen vastuuorganisaatio`,
field: 'originalResponsibleOrganization',
},
{
label: $localize`:@@spPersons:Henkilöt`,
field: 'responsiblePersons',
},
{
label: $localize`:@@spRelatedOrganizations:Liittyvät organisaatiot`,
field: 'relatedOrganizations',
}]
},
{
Expand Down Expand Up @@ -237,6 +245,7 @@ export class SingleProjectComponent implements OnInit, OnDestroy {
// .pipe(map(responseData => [responseData]))
.subscribe({
next: (responseData) => {
console.log(responseData);
this.responseData = responseData;
const project = this.responseData.projects[0];
if (project) {
Expand Down
40 changes: 38 additions & 2 deletions src/app/portal/models/project/project.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ export class Project {
public projectURL: string,
public responsibleOrganizations: object[],
public responsibleOrganization: string,
public relatedOrganizations: object[],
public relatedOrganization: string,
public originalOrganizations: object[],
public originalOrganization: string,
public responsiblePerson: object[],
public keywords: string,
public completions: object[]
public completions: object[],
public dataSource: string
) {
}
}
Expand All @@ -51,7 +56,33 @@ export class ProjectAdapter implements Adapter<Project> {
});
}

const relOrgList = [];
if (item.relatedOrganizations) {
item.relatedOrganizations.forEach((org) => {
relOrgList.push({
orgName: this.utils.checkTranslation('orgName', org).trim(),
orgId: org.orgid,
orgLinkId: org.businessId ? org.orgid : ''
}
);
});
}

const origOrgList = [];
if (item.originalOrganization) {
item.originalOrganization.forEach((org) => {
origOrgList.push({
orgName: this.utils.checkTranslation('orgName', org).trim(),
orgId: org.orgid
}
);
});
}

const origOrgStr = origOrgList.map(org => org.orgName).join(', ');
const relOrgStr = relOrgList.map(org => org.orgName).join(', ');
const respOrgStr = respOrgList.map(org => org.orgName).join(', ');

const keywords = item?.keywords ? item.keywords.filter((item) => item?.keyword && item.keyword.trim().length > 0).map(kw => kw.keyword.replace(/,$/, '')).join(', ') : '';

return new Project(
Expand All @@ -68,9 +99,14 @@ export class ProjectAdapter implements Adapter<Project> {
item.projectURL,
respOrgList,
respOrgStr,
relOrgList,
relOrgStr,
origOrgList,
origOrgStr,
item.responsiblePerson,
keywords,
item?.completions ? item.completions : []
item?.completions ? item.completions : [],
item.dataSource
);
}
}

0 comments on commit e8035a8

Please sign in to comment.