2020-07-13 16:42:34 +02:00
|
|
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
2019-07-23 14:23:12 +02:00
|
|
|
import {ClaimProject} from '../../claim-utils/claimHelper.class';
|
2017-12-19 13:53:46 +01:00
|
|
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
2020-07-13 16:42:34 +02:00
|
|
|
import {properties} from "../../../../../environments/environment";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2020-07-13 16:42:34 +02:00
|
|
|
selector: 'claim-selected-projects',
|
|
|
|
template: `
|
|
|
|
<div class="">
|
|
|
|
<div>
|
|
|
|
<ul class="uk-list uk-list-divider">
|
|
|
|
<li class="list-group-item" *ngFor="let project of projects">
|
|
|
|
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)"
|
|
|
|
routerLinkActive="router-link-active"
|
|
|
|
[routerLink]="projectUrl">{{project.funderName}}
|
|
|
|
| {{project.projectName}} {{(project.projectAcronym) ? '(' + project.projectAcronym + ')' : ''}}
|
|
|
|
<!--[{{project.startDate}} - {{project.endDate}}]--></a>
|
|
|
|
<span (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button icon-button-small ">
|
|
|
|
<span class="uk-icon">
|
|
|
|
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close"
|
|
|
|
ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path
|
|
|
|
fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<!--div *ngIf="projects.length == 0 " class="uk-alert no-selected-message uk-text-center">You have not selected any projects</div-->
|
|
|
|
</div>`
|
2017-12-19 13:53:46 +01:00
|
|
|
})
|
|
|
|
export class ClaimSelectedProjectsComponent {
|
2020-07-13 16:42:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
var myDate = new Date();
|
|
|
|
this.todayDate = (myDate.getFullYear() + "-" + myDate.getMonth() + 1) + "-" + myDate.getDate();
|
|
|
|
this.nextDate = ((myDate.getFullYear() + 100) + "-" + myDate.getMonth() + 1) + "-" + myDate.getDate();
|
|
|
|
// if(this.linkType == "project"){
|
2017-12-19 13:53:46 +01:00
|
|
|
this.showsearch = true
|
2020-07-13 16:42:34 +02:00
|
|
|
// }else{
|
|
|
|
// this.showsearch = false;
|
|
|
|
// }
|
|
|
|
//2015-05-01
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Input() projects: ClaimProject[];
|
|
|
|
@Input() show = 'home';
|
|
|
|
@Input() title = 'Projects';
|
|
|
|
@Input() linkType: string = "project";
|
|
|
|
@Input() hideType;
|
|
|
|
@Input() bulkMode: boolean = false;
|
|
|
|
@Input() linkToResults: boolean = true;
|
|
|
|
@Output() projectsChange = new EventEmitter();
|
|
|
|
@Output() showChange = new EventEmitter();
|
|
|
|
showsearch: boolean = false;
|
|
|
|
@Input() localStoragePrefix: string = "";
|
|
|
|
todayDate = '';
|
|
|
|
nextDate = '';
|
|
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
|
|
|
public projectUrl = properties.searchLinkToProject.split('?')[0];
|
|
|
|
|
|
|
|
removeProject(item: any) {
|
|
|
|
var index: number = this.projects.indexOf(item);
|
|
|
|
if (index > -1) {
|
|
|
|
this.projects.splice(index, 1);
|
|
|
|
if (this.projects != null) {
|
|
|
|
localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.projects));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.projectsChange.emit({
|
|
|
|
value: this.projects
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
showType(type) {
|
|
|
|
if (type != this.show) {
|
|
|
|
this.show = type;
|
|
|
|
this.showChange.emit({
|
|
|
|
value: this.show
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
projectSelected($event) {
|
|
|
|
// this.showsearch = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|