1
|
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
2
|
import {ClaimProject} from '../../../utils/entities/claimEntities.class';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'claim-selected-projects',
|
6
|
template: `
|
7
|
<div> <!-- [class]="componentClass" >
|
8
|
Projects -->
|
9
|
<div *ngIf=" !(inline && hideType == 'project') && projects.length > 0 " class="projects" >
|
10
|
<ul class="uk-list">
|
11
|
<li class="list-group-item list-group-item-info">Selected Projects ({{(projects.length)}})
|
12
|
<span *ngIf=" !inline " title="Add More Projects" (click)="showType('project')" aria-hidden="true" style="float:right;cursor: pointer;"><i class="uk-icon-plus"></i></span>
|
13
|
</li>
|
14
|
<li class="list-group-item" *ngFor="let project of projects">
|
15
|
|
16
|
<span >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></span>
|
17
|
<span (click)="removeProject(project)" aria-hidden="true" class="btn "><i class="uk-icon-remove"></i></span>
|
18
|
</li>
|
19
|
<li *ngIf="projects.length == 0 " class="list-group-item">There are no projects</li>
|
20
|
</ul>
|
21
|
</div>
|
22
|
</div>
|
23
|
|
24
|
`
|
25
|
})
|
26
|
export class ClaimSelectedProjectsComponent {
|
27
|
|
28
|
|
29
|
ngOnInit() {
|
30
|
var myDate = new Date();
|
31
|
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
32
|
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
33
|
//2015-05-01
|
34
|
}
|
35
|
|
36
|
|
37
|
@Input() projects: ClaimProject[];
|
38
|
@Input() show='home';
|
39
|
@Input() inline:boolean = false;
|
40
|
@Input() hideType;
|
41
|
@Input() bulkMode:boolean = false;
|
42
|
@Input() linkToResults:boolean = true;
|
43
|
@Output() projectsChange = new EventEmitter();
|
44
|
|
45
|
@Output() showChange = new EventEmitter();
|
46
|
|
47
|
todayDate = '';
|
48
|
nextDate = '';
|
49
|
|
50
|
removeProject(item:any){
|
51
|
var index:number =this.projects.indexOf(item);
|
52
|
if (index > -1) {
|
53
|
this.projects.splice(index, 1);
|
54
|
}
|
55
|
this.projectsChange.emit({
|
56
|
value: this.projects
|
57
|
});
|
58
|
}
|
59
|
showType(type){
|
60
|
if(type != this.show){
|
61
|
this.show = type;
|
62
|
this.showChange.emit({
|
63
|
value: this.show
|
64
|
});
|
65
|
}
|
66
|
}
|
67
|
|
68
|
}
|