1 |
61381
|
k.triantaf
|
import {Dates} from '../../utils/string-utils.class';
|
2 |
|
|
export class Filter{
|
3 |
|
|
public title: string; // eg Type
|
4 |
|
|
public filterId: string; // type (name in url parameter)
|
5 |
|
|
public originalFilterId: string; // (in index)
|
6 |
|
|
public countSelectedValues: number = 0;
|
7 |
|
|
public values: Value[] = [];
|
8 |
|
|
public filterOperator: string ='or';
|
9 |
|
|
public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry
|
10 |
|
|
public filterType: string = "checkbox";
|
11 |
|
|
public radioValue?: string = "";
|
12 |
|
|
// public uniqueValueIdSelected: string;
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
export class Value{
|
16 |
|
|
public name: string; //eg Article, Journal
|
17 |
|
|
public id: string; //0001
|
18 |
|
|
public selected: boolean = false;
|
19 |
|
|
public number: number = 0;
|
20 |
|
|
|
21 |
|
|
}
|
22 |
|
|
export class AdvancedField{
|
23 |
|
|
public id: string; //
|
24 |
|
|
public param:string;
|
25 |
|
|
public name: string; //
|
26 |
|
|
public type: string = "keyword"; //keyword, static or dynamic
|
27 |
|
|
public value: string = '';
|
28 |
|
|
public valueLabel: string = '';
|
29 |
|
|
public operatorId: string;
|
30 |
|
|
public operatorName: string ="";
|
31 |
|
|
public valid: boolean = true;
|
32 |
|
|
public dateValue:DateValue = new DateValue("any");
|
33 |
|
|
|
34 |
|
|
constructor(id:string,param:string,name:string, type:string, value:string,operator:string){
|
35 |
|
|
this.id = id;
|
36 |
|
|
this.param = param;
|
37 |
|
|
this.name = name;
|
38 |
|
|
this.type = type;
|
39 |
|
|
this.value = value;
|
40 |
|
|
this.operatorId = operator;
|
41 |
|
|
// this.operatorName = "AND";
|
42 |
|
|
|
43 |
|
|
}
|
44 |
|
|
}
|
45 |
|
|
export class DateValue{
|
46 |
|
|
public types = ["1mon","2mon","3mon","6mon","12mon","2year","5year","10year","range"];
|
47 |
|
|
public typesTitle = ["Last month","Last 2 months","Last 3 months","Last 6 months","Last year","Last 2 years","Last 5 years","Last 10 years", "Specify date range..."];
|
48 |
|
|
public type: string ;
|
49 |
|
|
public from:Date = new Date();
|
50 |
|
|
public to:Date = new Date();
|
51 |
|
|
constructor(type:string = "any"){
|
52 |
|
|
this.setDatesByType(type);
|
53 |
|
|
}
|
54 |
|
|
public setDatesByType(type:string){
|
55 |
|
|
if(this.types.indexOf(type) == -1){
|
56 |
|
|
type=this.types[0];
|
57 |
|
|
}
|
58 |
|
|
this.type = type;
|
59 |
|
|
this.to = Dates.getDateToday();
|
60 |
|
|
if(this.type == "range" || this.type == "any"){ // for type "any" just to initiate with values
|
61 |
|
|
this.from = Dates.getDateXMonthsAgo(1);
|
62 |
|
|
}else if(this.type == "1mon"){
|
63 |
|
|
this.from = Dates.getDateXMonthsAgo(1);
|
64 |
|
|
}else if(this.type == "2mon"){
|
65 |
|
|
this.from = Dates.getDateXMonthsAgo(2);
|
66 |
|
|
}else if(this.type == "3mon"){
|
67 |
|
|
this.from = Dates.getDateXMonthsAgo(3);
|
68 |
|
|
}else if(this.type == "6mon"){
|
69 |
|
|
this.from = Dates.getDateXMonthsAgo(6);
|
70 |
|
|
}else if(this.type == "12mon"){
|
71 |
|
|
this.from = Dates.getDateXMonthsAgo(12);
|
72 |
|
|
}else if(this.type == "2year"){
|
73 |
|
|
this.from = Dates.getDateXYearsAgo(2);
|
74 |
|
|
}else if(this.type == "5year"){
|
75 |
|
|
this.from = Dates.getDateXYearsAgo(5);
|
76 |
|
|
}else if(this.type == "10year"){
|
77 |
|
|
this.from = Dates.getDateXYearsAgo(10);
|
78 |
|
|
}
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
}
|
82 |
|
|
export class OPERATOR{
|
83 |
|
|
public static AND: string ="and";
|
84 |
|
|
public static OR: string ="or";
|
85 |
|
|
public static NOT: string ="not";
|
86 |
|
|
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
export class AutoCompleteValue{
|
90 |
|
|
public id: string;
|
91 |
|
|
public label: string;
|
92 |
|
|
}
|