import {Dates} from '../../utils/string-utils.class'; export class Filter{ public title: string; // eg Type public filterId: string; // type (name in url parameter) public originalFilterId: string; // (in index) public countSelectedValues: number = 0; public values: Value[] = []; public filterOperator: string ='or'; public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry public valueIsUnique: boolean = false; // public uniqueValueIdSelected: string; } export class Value{ public name: string; //eg Article, Journal public id: string; //0001 public selected: boolean = false; public number: number = 0; } export class AdvancedField{ public id: string; // public param:string; public name: string; // public type: string = "keyword"; //keyword, static or dynamic public value: string = ''; public operatorId: string; public operatorName: string =""; public valid: boolean = true; public dateValue:DateValue = new DateValue("any"); constructor(id:string,param:string,name:string, type:string, value:string,operator:string){ this.id = id; this.param = param; this.name = name; this.type = type; this.value = value; this.operatorId = operator; // this.operatorName = "AND"; } } export class DateValue{ public types = ["any","range","1mon","2mon","3mon","6mon","12mon","2year","5year","10year"]; public typesTitle = ["any","in the specified date range","in the last month","in the last 2 months","in the last 3 months","in the last 6 months","in the last year","in the last 2 years","in the last 5 years","in the last 10 years"]; public type: string ; public from:Date = new Date(); public to:Date = new Date(); constructor(type:string = "any"){ this.setDatesByType(type); } public setDatesByType(type:string){ if(this.types.indexOf(type) == -1){ type=this.types[0]; } this.type = type; this.to = Dates.getDateToday(); if(this.type == "range" || this.type == "any"){ // for type "any" just to initiate with values this.from = Dates.getDateXMonthsAgo(1); }else if(this.type == "1mon"){ this.from = Dates.getDateXMonthsAgo(1); }else if(this.type == "2mon"){ this.from = Dates.getDateXMonthsAgo(2); }else if(this.type == "3mon"){ this.from = Dates.getDateXMonthsAgo(3); }else if(this.type == "6mon"){ this.from = Dates.getDateXMonthsAgo(6); }else if(this.type == "12mon"){ this.from = Dates.getDateXMonthsAgo(12); }else if(this.type == "2year"){ this.from = Dates.getDateXYearsAgo(2); }else if(this.type == "5year"){ this.from = Dates.getDateXYearsAgo(5); }else if(this.type == "10year"){ this.from = Dates.getDateXYearsAgo(10); } } } export class OPERATOR{ public static AND: string ="and"; public static OR: string ="or"; public static NOT: string ="not"; } export class AutoCompleteValue{ public id: string; public label: string; }