Project

General

Profile

1
import {Component, Input,Output, EventEmitter} from '@angular/core';
2
import {ClaimProject} from '../../claim-utils/claimHelper.class';
3
import {RouterHelper} from '../../../utils/routerHelper.class';
4

    
5
@Component({
6
    selector: 'claim-selected-projects',
7
    template: `
8

    
9

    
10
                <div class="" >
11

    
12
                  <div>
13
                    <!--h5 class=" uk-margin uk-h5 uk-text-primary" *ngIf="projects.length > 0 "> Selected Projects ({{projects.length | number}}) </h5-->
14
                    <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
                        <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
                      </li>
23
                    </ul>
24
                  </div>
25
                <!--div *ngIf="projects.length == 0 " class="uk-alert no-selected-message uk-text-center">You have not selected any projects</div-->
26
              </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
@Input()  localStoragePrefix:string = "";
59
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
     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
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
}
(10-10/14)