1
|
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
2
|
import {ClaimContext} from '../../claim-utils/claimEntities.class';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'claim-selected-contexts',
|
6
|
template: `
|
7
|
|
8
|
<!-- Contexts -->
|
9
|
|
10
|
<div class="uk-placeholder uk-margin-top" >
|
11
|
|
12
|
<!--div class="uk-width-1-2 ">
|
13
|
|
14
|
<div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button uk-button-default uk-animation uk-float-right">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>
|
15
|
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form>
|
16
|
</div-->
|
17
|
<div *ngIf="contexts.length > 0 " class=" ">
|
18
|
<h5 class=" uk-margin uk-h5 uk-text-primary">Selected Communities ({{contexts.length}}) </h5>
|
19
|
|
20
|
<ul class="uk-list uk-list-divider">
|
21
|
<li class="list-group-item" *ngFor="let context of contexts" >
|
22
|
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span>
|
23
|
<span (click)="removeContext(context)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
|
24
|
<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>
|
25
|
</span></span>
|
26
|
|
27
|
</li>
|
28
|
</ul>
|
29
|
</div>
|
30
|
<div *ngIf="contexts.length == 0 " class="uk-text-center">There are no selected communities</div>
|
31
|
</div>
|
32
|
|
33
|
|
34
|
|
35
|
`
|
36
|
})
|
37
|
export class ClaimSelectedContextsComponent {
|
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
|
//2015-05-01
|
43
|
// if(this.linkType == "context"){
|
44
|
this.showsearch = true
|
45
|
// }else{
|
46
|
// this.showsearch = false;
|
47
|
// }
|
48
|
}
|
49
|
|
50
|
|
51
|
@Input() contexts:ClaimContext[];
|
52
|
//The following need to be kept in case we have to save the current state
|
53
|
@Input() public projects;
|
54
|
@Input() public results;
|
55
|
@Input() public inlineEntity;
|
56
|
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
|
57
|
@Input() show='home';
|
58
|
@Input() title='Communities';
|
59
|
@Input() linkType:string = "project";
|
60
|
|
61
|
@Input() hideType;
|
62
|
@Input() bulkMode:boolean = false;
|
63
|
@Output() showChange = new EventEmitter();
|
64
|
|
65
|
showsearch:boolean = false;
|
66
|
|
67
|
todayDate = '';
|
68
|
nextDate = '';
|
69
|
|
70
|
showType(type){
|
71
|
if(type != this.show){
|
72
|
this.show = type;
|
73
|
this.showChange.emit({
|
74
|
value: this.show
|
75
|
});
|
76
|
}
|
77
|
}
|
78
|
|
79
|
|
80
|
removeContext(item:any){
|
81
|
var index:number =this.contexts.indexOf(item);
|
82
|
if (index > -1) {
|
83
|
this.contexts.splice(index, 1);
|
84
|
}
|
85
|
|
86
|
}
|
87
|
contextSelected($event) {
|
88
|
// this.showsearch = false;
|
89
|
}
|
90
|
|
91
|
}
|