Project

General

Profile

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

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

    
9

    
10
                <div class="uk-placeholder uk-margin-top" >
11

    
12
                 <!--div  class="uk-width-1-2    ">
13
                  <!--div class="uk-clearfix"><button *ngIf=" !showsearch "  (click)="showsearch = true;" class="uk-button-default uk-float-right uk-animation ">Add more <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span></button></div>
14
                  <claim-projects-search-form   *ngIf=" showsearch "  [selectedProjects]="projects"  (projectSelected)="projectSelected($event)" > </claim-projects-search-form>
15
                </div>
16
                <div  class="uk-width-1-2    "-->
17
                  <div>
18
                    <h5 class=" uk-margin uk-h5 uk-text-primary" *ngIf="projects.length > 0 "> Selected Projects ({{projects.length}}) </h5>
19
                    <ul class="uk-list uk-list-divider">
20
                      <li class="list-group-item" *ngFor="let project of projects">
21
                        <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>
22
                        <span  (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
23
                          <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><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>
24
                          </span></span>
25
                      </li>
26
                    </ul>
27
                  </div>
28
                <div *ngIf="projects.length == 0 " class="uk-text-center">There are no selected  projects</div>
29
              </div>
30

    
31

    
32

    
33
          `
34
})
35
export class ClaimSelectedProjectsComponent {
36

    
37

    
38
ngOnInit() {
39
   var myDate = new Date();
40
  this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
41
  this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
42
  // if(this.linkType == "project"){
43
    this.showsearch = true
44
  // }else{
45
  //   this.showsearch = false;
46
  // }
47
  //2015-05-01
48
}
49

    
50

    
51
@Input() projects: ClaimProject[];
52
@Input() show='home';
53
@Input() title='Projects';
54
@Input() linkType:string = "project";
55
@Input() hideType;
56
@Input() bulkMode:boolean = false;
57
@Input() linkToResults:boolean = true;
58
@Output() projectsChange = new EventEmitter();
59
@Output() showChange = new EventEmitter();
60
showsearch:boolean = false;
61

    
62
todayDate = '';
63
nextDate = '';
64
public routerHelper:RouterHelper = new RouterHelper();
65

    
66
removeProject(item:any){
67
 var index:number =this.projects.indexOf(item);
68
  if (index > -1) {
69
     this.projects.splice(index, 1);
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
}
(3-3/6)