1
|
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
2
|
|
3
|
@Component({
|
4
|
selector: 'claim-selected-contexts',
|
5
|
template: `
|
6
|
<div [class]="componentClass" >
|
7
|
<!-- Contexts -->
|
8
|
<!--div *ngIf=" !(inline && hideType == 'context') && contexts" class="concepts" -->
|
9
|
<div>
|
10
|
<ul class="list-group">
|
11
|
<li class="list-group-item list-group-item-success">Selected Concepts ({{(contexts.length)}})
|
12
|
<span *ngIf=" !inline" title="Add More Concepts" (click)="showType('context')" aria-hidden="true" class="glyphicon glyphicon-plus " style="float:right;cursor: pointer;"></span>
|
13
|
</li>
|
14
|
<li class="list-group-item" *ngFor="let context of contexts" >
|
15
|
<span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
|
16
|
<span (click)="removeContext(context)" aria-hidden="true" class="btn glyphicon glyphicon-remove"></span>
|
17
|
|
18
|
</li>
|
19
|
<li *ngIf="contexts.length == 0 " class="list-group-item">There are no contexts</li>
|
20
|
</ul>
|
21
|
</div>
|
22
|
</div>
|
23
|
`
|
24
|
})
|
25
|
export class ClaimSelectedContextsComponent {
|
26
|
ngOnInit() {
|
27
|
var myDate = new Date();
|
28
|
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
29
|
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
30
|
//2015-05-01
|
31
|
}
|
32
|
|
33
|
|
34
|
@Input() contexts;
|
35
|
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
|
36
|
@Input() show='home';
|
37
|
@Input() inline:boolean = false;
|
38
|
@Input() hideType;
|
39
|
@Input() bulkMode:boolean = false;
|
40
|
@Output() showChange = new EventEmitter();
|
41
|
|
42
|
todayDate = '';
|
43
|
nextDate = '';
|
44
|
|
45
|
showType(type){
|
46
|
if(type != this.show){
|
47
|
this.show = type;
|
48
|
this.showChange.emit({
|
49
|
value: this.show
|
50
|
});
|
51
|
}
|
52
|
}
|
53
|
|
54
|
|
55
|
removeContext(item:any){
|
56
|
var index:number =this.contexts.indexOf(item);
|
57
|
if (index > -1) {
|
58
|
this.contexts.splice(index, 1);
|
59
|
}
|
60
|
|
61
|
}
|
62
|
|
63
|
}
|