import { CompareType } from '../enum/compare-type.enum'; import { ValueType } from '../enum/value-type.enum'; import { RelationType } from '../enum/relation-type.enum'; export class FlexibleDateHandler{ convert(qc) { const arr = []; const nrv = (qc.value); if(qc.control.single){ return Object.keys(nrv).length > 0 && nrv.value ? [{ 'FilterField' : qc.labelCode, 'Compare' : CompareType.Equal, 'Value' : nrv.value, 'Relation' : RelationType.And, 'Expresstype':ValueType.Value }] : []; } else{ if(Object.keys(nrv).length === 0) return arr; (nrv.startValue != null && nrv.startValue) && arr.push({ 'FilterField' : qc.labelCode, 'Compare' : CompareType.GreaterThanOrEqual, 'Value' : nrv.startValue, 'Relation' : RelationType.And, 'Expresstype': ValueType.Value }); (nrv.endValue != null && nrv.endValue) && arr.push({ 'FilterField' : qc.labelCode, 'Compare' : CompareType.LessThanOrEqual, 'Value' : nrv.endValue, 'Relation' : RelationType.And, 'Expresstype': ValueType.Value }); return arr; } } }