1 |
61381
|
k.triantaf
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
2 |
|
|
import {ClaimProject} from '../../claim-utils/claimHelper.class';
|
3 |
|
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
4 |
|
|
import {properties} from "../../../../../environments/environment";
|
5 |
|
|
|
6 |
|
|
@Component({
|
7 |
|
|
selector: 'claim-selected-projects',
|
8 |
|
|
template: `
|
9 |
|
|
<div class="">
|
10 |
|
|
<div>
|
11 |
|
|
<ul class="uk-list uk-list-divider">
|
12 |
|
|
<li class="list-group-item" *ngFor="let project of projects">
|
13 |
|
|
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)"
|
14 |
|
|
routerLinkActive="router-link-active"
|
15 |
|
|
[routerLink]="projectUrl">{{project.funderName}}
|
16 |
|
|
| {{project.projectName}} {{(project.projectAcronym) ? '(' + project.projectAcronym + ')' : ''}}
|
17 |
|
|
<!--[{{project.startDate}} - {{project.endDate}}]--></a>
|
18 |
|
|
<span (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button icon-button-small ">
|
19 |
|
|
<span class="uk-icon">
|
20 |
|
|
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close"
|
21 |
|
|
ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path
|
22 |
|
|
fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
23 |
|
|
</span>
|
24 |
|
|
</span>
|
25 |
|
|
</li>
|
26 |
|
|
</ul>
|
27 |
|
|
</div>
|
28 |
|
|
<!--div *ngIf="projects.length == 0 " class="uk-alert no-selected-message uk-text-center">You have not selected any projects</div-->
|
29 |
|
|
</div>`
|
30 |
|
|
})
|
31 |
|
|
export class ClaimSelectedProjectsComponent {
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
ngOnInit() {
|
35 |
|
|
var myDate = new Date();
|
36 |
|
|
this.todayDate = (myDate.getFullYear() + "-" + myDate.getMonth() + 1) + "-" + myDate.getDate();
|
37 |
|
|
this.nextDate = ((myDate.getFullYear() + 100) + "-" + myDate.getMonth() + 1) + "-" + myDate.getDate();
|
38 |
|
|
// if(this.linkType == "project"){
|
39 |
|
|
this.showsearch = true
|
40 |
|
|
// }else{
|
41 |
|
|
// this.showsearch = false;
|
42 |
|
|
// }
|
43 |
|
|
//2015-05-01
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
@Input() projects: ClaimProject[];
|
48 |
|
|
@Input() show = 'home';
|
49 |
|
|
@Input() title = 'Projects';
|
50 |
|
|
@Input() linkType: string = "project";
|
51 |
|
|
@Input() hideType;
|
52 |
|
|
@Input() bulkMode: boolean = false;
|
53 |
|
|
@Input() linkToResults: boolean = true;
|
54 |
|
|
@Output() projectsChange = new EventEmitter();
|
55 |
|
|
@Output() showChange = new EventEmitter();
|
56 |
|
|
showsearch: boolean = false;
|
57 |
|
|
@Input() localStoragePrefix: string = "";
|
58 |
|
|
todayDate = '';
|
59 |
|
|
nextDate = '';
|
60 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
61 |
|
|
public projectUrl = properties.searchLinkToProject.split('?')[0];
|
62 |
|
|
|
63 |
|
|
removeProject(item: any) {
|
64 |
|
|
var index: number = this.projects.indexOf(item);
|
65 |
|
|
if (index > -1) {
|
66 |
|
|
this.projects.splice(index, 1);
|
67 |
|
|
if (this.projects != null) {
|
68 |
|
|
localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.projects));
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
this.projectsChange.emit({
|
72 |
|
|
value: this.projects
|
73 |
|
|
});
|
74 |
|
|
}
|
75 |
|
|
}
|