1 |
50169
|
argiro.kok
|
import {Component, Input, ViewChild} from '@angular/core';
|
2 |
|
|
import { ActivatedRoute} from '@angular/router';
|
3 |
|
|
import {Location} from '@angular/common';
|
4 |
|
|
|
5 |
|
|
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
|
6 |
|
|
|
7 |
|
|
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
8 |
50761
|
argiro.kok
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
9 |
50169
|
argiro.kok
|
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
|
10 |
|
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
11 |
|
|
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
12 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
13 |
50586
|
argiro.kok
|
import{EnvProperties} from '../../utils/properties/env-properties';
|
14 |
|
|
|
15 |
50169
|
argiro.kok
|
@Component({
|
16 |
|
|
selector: 'browse-statistic',
|
17 |
|
|
templateUrl: 'browseStatistic.component.html'
|
18 |
|
|
|
19 |
|
|
})
|
20 |
|
|
export class BrowseStatisticComponent {
|
21 |
|
|
|
22 |
|
|
@Input() public baseUrl:string = "";
|
23 |
|
|
@Input() public filter:any = "";
|
24 |
|
|
private _maxCharacters = 30;
|
25 |
|
|
public viewAll = false;
|
26 |
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
27 |
53278
|
argiro.kok
|
keyword = "";
|
28 |
|
|
sortBy = "num";
|
29 |
50169
|
argiro.kok
|
constructor () {
|
30 |
|
|
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
public ngOnInit() {
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
quote(str:string){
|
39 |
|
|
return '"'+str+'"';
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
private _formatName(value){
|
43 |
|
|
return value.name+" ";//(((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name)
|
44 |
|
|
}
|
45 |
53278
|
argiro.kok
|
filterKeywords(value){
|
46 |
|
|
if(this.keyword.length > 0){
|
47 |
|
|
if(value.toLowerCase().indexOf(this.keyword.toLowerCase()) ==-1){
|
48 |
|
|
return false;
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
return true;
|
52 |
|
|
}
|
53 |
50169
|
argiro.kok
|
|
54 |
53278
|
argiro.kok
|
getValues(filter, sortBy:string = "num"):any{
|
55 |
|
|
|
56 |
|
|
if(sortBy == "name"){
|
57 |
|
|
var array = filter.values.slice();
|
58 |
|
|
array.sort((n1,n2)=> {
|
59 |
|
|
if (n1.name > n2.name) {
|
60 |
|
|
return 1;
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
if (n1.name < n2.name) {
|
64 |
|
|
return -1;
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
return 0;
|
68 |
|
|
});
|
69 |
|
|
return array;
|
70 |
|
|
}else{
|
71 |
|
|
return filter.values;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
}
|
76 |
50169
|
argiro.kok
|
}
|