delete backup file
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43061 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4fcfae8acb
commit
aaadb79301
|
@ -1,154 +0,0 @@
|
||||||
import {Component, Input,Output, ElementRef, EventEmitter} from '@angular/core';
|
|
||||||
import {JSONP_PROVIDERS} from '@angular/http';
|
|
||||||
import {Observable} from 'rxjs/Observable';
|
|
||||||
import { RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
|
||||||
import {OpenaireProjectsService} from '../../services/openaireProjects.service';
|
|
||||||
// import { MD_INPUT_DIRECTIVES } from '@angular2-material/input';
|
|
||||||
/*
|
|
||||||
<div class="container" >
|
|
||||||
<div class="input-field col s12">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
*/
|
|
||||||
@Component({
|
|
||||||
selector: 'claim-projects',
|
|
||||||
template: `
|
|
||||||
<div class="container" >
|
|
||||||
<div class="funder col s12">
|
|
||||||
|
|
||||||
<h3>Select Funder:</h3>
|
|
||||||
<!-- <select [(ngModel)]="selectedFunderId" (ngModelChange)="funderChanged()" >
|
|
||||||
<option [ngValue]="'0'">Funder:</option>
|
|
||||||
<option *ngFor="let funder of funders" [ngValue]="funder.field.field[1]['@value_original']">{{funder.field.field[1]['@value']}}</option>
|
|
||||||
</select> -->
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
||||||
{{selectedFunderName}}
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
|
||||||
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
|
|
||||||
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="projects col s12" *ngIf="this.selectedFunderId == '0'" >
|
|
||||||
Tessst
|
|
||||||
<h4>Select projects:</h4>
|
|
||||||
<input id="community" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
|
|
||||||
|
|
||||||
<!--<md-input class="demo-full-width" placeholder="Search for Project" ></md-input> -->
|
|
||||||
<div class="suggestions" *ngIf="filteredList.length > 0">
|
|
||||||
<ul class="list-group" >
|
|
||||||
<li *ngFor=" let item of filteredList" class="list-group-item" >
|
|
||||||
<a (click)="select(item)"> {{item.field[1]['@value']}}- {{item.field[3]['@value']}}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="selections" *ngIf="selectedProjects.length > 0">
|
|
||||||
<label for="selecteditems">Selected: </label>
|
|
||||||
<ul id ="selecteditems" class="nav nav-pills" >
|
|
||||||
<li *ngFor="let item of selectedProjects" role="presentation" (click)="remove(item)">{{item.projectAcronym}} - {{item.projectName}} <span class="badge">X</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
providers:[ OpenaireProjectsService ],
|
|
||||||
// directives: [MD_INPUT_DIRECTIVES]
|
|
||||||
|
|
||||||
})
|
|
||||||
export class ClaimProjectsComponent {
|
|
||||||
ngOnInit() {
|
|
||||||
console.info("Claim projects - init ....");
|
|
||||||
this.getFunders();
|
|
||||||
|
|
||||||
}
|
|
||||||
public query = '';
|
|
||||||
public filteredList = [];
|
|
||||||
@Input() public selectedProjects=[] ;
|
|
||||||
public elementRef;
|
|
||||||
@Output() projectsChange = new EventEmitter();
|
|
||||||
|
|
||||||
public funders:string[];
|
|
||||||
@Input() public selectedFunderId:string ="0";
|
|
||||||
selectedFunderName:string ="Select funder:";
|
|
||||||
|
|
||||||
public projects:string[];
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private _projectService: OpenaireProjectsService,myElement: ElementRef) {
|
|
||||||
this.elementRef = myElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter() {
|
|
||||||
if(this.selectedFunderId != '0' && this.query !== "" && this.query.length >= 3 ){
|
|
||||||
this._projectService.searchForProjects(this.query, this.selectedFunderId).subscribe(
|
|
||||||
data => {
|
|
||||||
this.filteredList = data;
|
|
||||||
},
|
|
||||||
err => console.error(err)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
select(item){
|
|
||||||
this.query = "";
|
|
||||||
this.filteredList = [];
|
|
||||||
var index:number =this.selectedProjects.indexOf(item);
|
|
||||||
if (index == -1) {
|
|
||||||
var project= { funderId: this.selectedFunderId, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] };
|
|
||||||
this.selectedProjects.push(project);
|
|
||||||
this.projectsChange.emit({
|
|
||||||
value: this.selectedProjects
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
remove(item){
|
|
||||||
var index:number =this.selectedProjects.indexOf(item);
|
|
||||||
if (index > -1) {
|
|
||||||
this.selectedProjects.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.projectsChange.emit({
|
|
||||||
value: this.selectedProjects
|
|
||||||
});
|
|
||||||
}
|
|
||||||
handleClick(event){
|
|
||||||
var clickedComponent = event.target;
|
|
||||||
var inside = false;
|
|
||||||
do {
|
|
||||||
if (clickedComponent === this.elementRef.nativeElement) {
|
|
||||||
inside = true;
|
|
||||||
}
|
|
||||||
clickedComponent = clickedComponent.parentNode;
|
|
||||||
} while (clickedComponent);
|
|
||||||
if(!inside){
|
|
||||||
this.filteredList = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getFunders () {
|
|
||||||
console.info("Getting Funders....");
|
|
||||||
this._projectService.getFunders().subscribe(
|
|
||||||
data => {
|
|
||||||
this.funders = data;
|
|
||||||
},
|
|
||||||
err => console.error(err)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
getProjects () {
|
|
||||||
if(this.selectedFunderId != '0'){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
funderChanged(funderId:string, funderName:string){
|
|
||||||
this.selectedFunderId = funderId;
|
|
||||||
this.selectedFunderName = funderName;
|
|
||||||
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
|
|
||||||
this.selectedProjects = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue