import {Component, EventEmitter, Input, Output} from '@angular/core'; import {Project} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; @Component({ selector: 'fundedBy', template: `
{{title}} {{title}} View less View all
{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}} [no funder available] | {{ item['acronym'] ? item['acronym'] : item['title']}}
Project
{{item['acronym'] ? item['acronym'] : item['title']}} {{item['acronym'] ? item['acronym'] : item['title']}}
{{item.title}}
  • Funder: {{item.funderName ? item.funderName : item.funderShortname}} ({{item.funderShortname}})
  • Project Code: {{item.code}}
  • Funding stream: {{item.funding}}
Validated by funder | {{item.provenanceAction}}
,
` }) export class FundedByComponent { @Input() fundedByProjects: Project[]; @Input() viewAll: boolean = false; @Output() viewAllClicked = new EventEmitter(); public lessBtn: boolean = false; public threshold: number = 4; public url = properties.searchLinkToProject.split('?')[0]; public title: string = "Funded by"; public viewAllClick() { if(this.fundedByProjects.length <= this.threshold*2) { this.viewAll = true; this.lessBtn = true; } else { this.viewAll = true; this.viewAllClicked.emit('fundedBy'); } } public viewLessClick() { this.viewAll = false; this.viewAllClicked.emit(""); } }