1 |
50169
|
argiro.kok
|
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
2 |
56714
|
argiro.kok
|
import {ClaimProject} from '../../claim-utils/claimHelper.class';
|
3 |
50169
|
argiro.kok
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
4 |
|
|
|
5 |
|
|
@Component({
|
6 |
|
|
selector: 'claim-selected-projects',
|
7 |
|
|
template: `
|
8 |
|
|
|
9 |
|
|
|
10 |
56714
|
argiro.kok
|
<div class="" >
|
11 |
52096
|
konstantin
|
|
12 |
50169
|
argiro.kok
|
<div>
|
13 |
56714
|
argiro.kok
|
<!--h5 class=" uk-margin uk-h5 uk-text-primary" *ngIf="projects.length > 0 "> Selected Projects ({{projects.length | number}}) </h5-->
|
14 |
50169
|
argiro.kok
|
<ul class="uk-list uk-list-divider">
|
15 |
|
|
<li class="list-group-item" *ngFor="let project of projects">
|
16 |
|
|
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)" routerLinkActive="router-link-active" routerLink="/search/project" >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></a>
|
17 |
52820
|
argiro.kok
|
<span (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button icon-button-small ">
|
18 |
|
|
<span class="uk-icon">
|
19 |
|
|
<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>
|
20 |
|
|
</span>
|
21 |
|
|
</span>
|
22 |
50169
|
argiro.kok
|
</li>
|
23 |
|
|
</ul>
|
24 |
|
|
</div>
|
25 |
56714
|
argiro.kok
|
<!--div *ngIf="projects.length == 0 " class="uk-alert no-selected-message uk-text-center">You have not selected any projects</div-->
|
26 |
50169
|
argiro.kok
|
</div>
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
`
|
31 |
|
|
})
|
32 |
|
|
export class ClaimSelectedProjectsComponent {
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
ngOnInit() {
|
36 |
|
|
var myDate = new Date();
|
37 |
|
|
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
38 |
|
|
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
39 |
|
|
// if(this.linkType == "project"){
|
40 |
|
|
this.showsearch = true
|
41 |
|
|
// }else{
|
42 |
|
|
// this.showsearch = false;
|
43 |
|
|
// }
|
44 |
|
|
//2015-05-01
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
@Input() projects: ClaimProject[];
|
49 |
|
|
@Input() show='home';
|
50 |
|
|
@Input() title='Projects';
|
51 |
|
|
@Input() linkType:string = "project";
|
52 |
|
|
@Input() hideType;
|
53 |
|
|
@Input() bulkMode:boolean = false;
|
54 |
|
|
@Input() linkToResults:boolean = true;
|
55 |
|
|
@Output() projectsChange = new EventEmitter();
|
56 |
|
|
@Output() showChange = new EventEmitter();
|
57 |
|
|
showsearch:boolean = false;
|
58 |
52820
|
argiro.kok
|
@Input() localStoragePrefix:string = "";
|
59 |
50169
|
argiro.kok
|
todayDate = '';
|
60 |
|
|
nextDate = '';
|
61 |
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
62 |
|
|
|
63 |
|
|
removeProject(item:any){
|
64 |
|
|
var index:number =this.projects.indexOf(item);
|
65 |
|
|
if (index > -1) {
|
66 |
|
|
this.projects.splice(index, 1);
|
67 |
52820
|
argiro.kok
|
if(this.projects != null){
|
68 |
|
|
localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.projects));
|
69 |
|
|
}
|
70 |
50169
|
argiro.kok
|
}
|
71 |
|
|
this.projectsChange.emit({
|
72 |
|
|
value: this.projects
|
73 |
|
|
});
|
74 |
|
|
}
|
75 |
|
|
showType(type){
|
76 |
|
|
if(type != this.show){
|
77 |
|
|
this.show = type;
|
78 |
|
|
this.showChange.emit({
|
79 |
|
|
value: this.show
|
80 |
|
|
});
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
projectSelected($event) {
|
84 |
|
|
// this.showsearch = false;
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
}
|