Skip to content

Commit

Permalink
Negative and Zero input value
Browse files Browse the repository at this point in the history
  • Loading branch information
5Amogh committed Oct 18, 2022
1 parent 0714e9f commit 9fca742
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as moment from 'moment';
import html2canvas from 'html2canvas';
import * as jspdf from 'jspdf';
const PRE_DEFINED_PARAMETERS = ['$slug', 'hawk-eye'];
export interface configFilter{
export interface ConfigFilter{
label: string,
controlType: string,
reference: string,
Expand Down Expand Up @@ -100,7 +100,7 @@ export class DatasetsComponent implements OnInit, OnDestroy {
maxStartDate: any; //Start date - has to be one day less than end date
displayFilters:any = {};
loadash = _;
pdFilters:configFilter[] = [];
pdFilters:ConfigFilter[] = [];
configuredFilters:any = {}
constructor(
activatedRoute: ActivatedRoute,
Expand Down Expand Up @@ -571,7 +571,11 @@ export class DatasetsComponent implements OnInit, OnDestroy {

pdFilterChanged($event){
const [reference, value]= [Object.keys($event),Object.values($event)] ;
this.configuredFilters[reference[0]] = [0,null].includes(value[0] as number) ? 0 : value[0] as number -1;
if([0,null].includes(value[0] as number) || value[0] < 0){
this.configuredFilters[reference[0]] = undefined;
}else{
this.configuredFilters[reference[0]] = value[0] as number -1;
}
}

addFilters() {
Expand Down

0 comments on commit 9fca742

Please sign in to comment.