import {Component, Input,Output, EventEmitter} from '@angular/core'; import {ClaimProject} from '../../claim-utils/claimHelper.class'; import {RouterHelper} from '../../../utils/routerHelper.class'; @Component({ selector: 'claim-selected-projects', template: `
` }) export class ClaimSelectedProjectsComponent { ngOnInit() { var myDate = new Date(); this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ; this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ; // if(this.linkType == "project"){ this.showsearch = true // }else{ // this.showsearch = false; // } //2015-05-01 } @Input() projects: ClaimProject[]; @Input() show='home'; @Input() title='Projects'; @Input() linkType:string = "project"; @Input() hideType; @Input() bulkMode:boolean = false; @Input() linkToResults:boolean = true; @Output() projectsChange = new EventEmitter(); @Output() showChange = new EventEmitter(); showsearch:boolean = false; @Input() localStoragePrefix:string = ""; todayDate = ''; nextDate = ''; public routerHelper:RouterHelper = new RouterHelper(); removeProject(item:any){ var index:number =this.projects.indexOf(item); if (index > -1) { this.projects.splice(index, 1); if(this.projects != null){ localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.projects)); } } this.projectsChange.emit({ value: this.projects }); } showType(type){ if(type != this.show){ this.show = type; this.showChange.emit({ value: this.show }); } } projectSelected($event) { // this.showsearch = false; } }