diff --git a/ng6-seed/src/app/dashboard/dashboard.component.ts b/ng6-seed/src/app/dashboard/dashboard.component.ts index 32233108b..c773c9964 100644 --- a/ng6-seed/src/app/dashboard/dashboard.component.ts +++ b/ng6-seed/src/app/dashboard/dashboard.component.ts @@ -119,12 +119,12 @@ export class DashboardComponent { const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0); const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1); - console.log('FromDateMin:',fromMin); - console.log('FromDateMax:',fromMax); - console.log('ToDateMin',toMin); - console.log('ToDateMax',toMax); - console.log('LastDateForPreMonth',LastDateForPreMonth); - console.log('FirstDateForPreMonth',FirstDateForPreMonth); + // console.log('FromDateMin:',fromMin); + // console.log('FromDateMax:',fromMax); + // console.log('ToDateMin',toMin); + // console.log('ToDateMax',toMax); + // console.log('LastDateForPreMonth',LastDateForPreMonth); + // console.log('FirstDateForPreMonth',FirstDateForPreMonth); // const resetRange = {fromDate: today, toDate: today}; // this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged @@ -134,7 +134,7 @@ export class DashboardComponent { this.options = { presets: this.presets, format: 'mediumDate', - range: {fromDate:FirstDateForPreMonth, toDate: LastDateForPreMonth}, + range: {fromDate:FirstDateForPreMonth, toDate: fromMax}, applyLabel: "Submit", calendarOverlayConfig: { shouldCloseOnBackdropClick: false, @@ -191,10 +191,7 @@ getDoughnutChartData(){ this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => { this.flag = 1; - console.log(' ***** Doughnut Chart Data *****'); - console.log('Whole Data',data); - console.log('Monthly Status',data.records.current_month); - + console.log(' ***** Doughnut Chart Data *****',data); let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered'); @@ -475,8 +472,11 @@ getDoughnutChartData(){ } else{ - //console.log('Else Condition month'); + this.tempDataFullPD = [0,0,0,0,0,0,0]; + this.tempDataSmartPD = [0,0,0,0,0,0,0]; + this.tempDataTelePD = [0,0,0,0,0,0,0]; } + this.doughnutChartDataForFullPD = this.tempDataFullPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForTelePD = this.tempDataTelePD; @@ -484,17 +484,10 @@ getDoughnutChartData(){ this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0); this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0); - console.log('Final full Data Completed',this.doughnutChartDataForFullPD); - console.log('temp full Data',this.tempDataFullPD); - console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD); - console.log('temp Smart Data',this.tempDataSmartPD); - console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD); - console.log('temp Tele Data',this.tempDataTelePD); - console.log('total3',this.total3); - console.log('total2',this.total2); - console.log('total1',this.total1); - - + console.log('Final Full Data '+ this.doughnutChartDataForFullPD+'Temp Data'+this.tempDataFullPD+'Full Total '+this.total1); + console.log('Final Smart Data '+ this.doughnutChartDataForSmartPD+' Temp Data '+this.tempDataSmartPD+'Smart Total '+this.total2); + console.log('Final Tele Data '+ this.doughnutChartDataForTelePD+' Temp Data'+this.tempDataTelePD+'Tele Total '+this.total3); + }) } @@ -518,7 +511,7 @@ onChange(e :any,flag: any) { let fromdate; let todate; - console.log('flag',flag); + if(flag == 1){ fromdate = new Date(e.fromDate); @@ -543,16 +536,12 @@ onChange(e :any,flag: any) { } - // console.log('fromdate',fromdate); - // console.log('todate',todate); - // console.log('lenderarr',this.selectedLender); - // console.log('cityarr',this.selectedCity); this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedCity,this.selectedLender).subscribe(data => { - console.log(' *****Updated Date Doughnut Chart Data *****'); - console.log('Whole Data',data); + console.log(' *****Updated Date Doughnut Chart Data *****',data); + if(data.records.current_month.length != 0){ this.total1 = 0; this.total2 = 0; @@ -848,34 +837,26 @@ onChange(e :any,flag: any) { } else{ - //console.log('Else Condition month'); + this.tempDataFullPD = [0,0,0,0,0,0,0]; + this.tempDataSmartPD = [0,0,0,0,0,0,0]; + this.tempDataTelePD = [0,0,0,0,0,0,0]; } this.doughnutChartDataForFullPD= this.tempDataFullPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartLabels = this.doughnutChartLabels; - this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0); - this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0); - this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0); - console.log('Canvas Full',this.FullCanvas) ; - console.log('Canvas Smart',this.SmartCanvas); - console.log('Canvas Tele',this.TeleCanvas); + this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0); + this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0); + this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0); + this.FullCanvas.chart.update(); this.SmartCanvas.chart.update(); this.TeleCanvas.chart.update(); - //: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed']; - console.log('Final full Data Completed',this.doughnutChartDataForFullPD); - console.log('temp full Data',this.tempDataFullPD); - console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD); - console.log('temp Smart Data',this.tempDataSmartPD); - console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD); - console.log('temp Tele Data',this.tempDataTelePD); - - console.log('total3',this.total3); - console.log('total2',this.total2); - console.log('total1',this.total1); - + + console.log('Final Full Data '+ this.doughnutChartDataForFullPD+'Temp Data'+this.tempDataFullPD+'Full Total '+this.total1); + console.log('Final Smart Data '+ this.doughnutChartDataForSmartPD+' Temp Data '+this.tempDataSmartPD+'Smart Total '+this.total2); + console.log('Final Tele Data '+ this.doughnutChartDataForTelePD+' Temp Data'+this.tempDataTelePD+'Tele Total '+this.total3); }) diff --git a/ng6-seed/src/app/dashboard/dashboard.service.ts b/ng6-seed/src/app/dashboard/dashboard.service.ts index f9c663f5c..545c97924 100644 --- a/ng6-seed/src/app/dashboard/dashboard.service.ts +++ b/ng6-seed/src/app/dashboard/dashboard.service.ts @@ -21,7 +21,6 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' '); export class DashboardService { private apiUrl = environment.apiEndpoint; - //private apiUrl = 'http://localhost/sparqapi/api/'; constructor(private _http: HttpClient, private _aws:AwsService) { } @@ -53,17 +52,17 @@ export class DashboardService { // } getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable { - console.log(')))))'); -console.log(fromdate); -console.log(todate); -console.log(cityarr); -console.log(lenderarr); -console.log('((('); + +console.log('From',fromdate); +console.log('To',todate); +console.log('Lender Arr',lenderarr); +console.log('City Arr',cityarr); + + return this._http.post(this.apiUrl+'getDashBoardMaster', { - "fromdate":fromdate, - "todate": todate, - "cityarr":cityarr, - "lenderarr": lenderarr}) + "fromdate":fromdate != '' && fromdate != null && fromdate != undefined ? fromdate : '', + "todate": todate != '' && todate != null && todate != undefined ? todate : '', + "lenderarr": lenderarr,"cityarr":cityarr}) .pipe(catchError(this.handleError('role', [])) )