dashboard issues fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-11-22 13:30:44 +05:30
parent b489fd4c37
commit 203fcaa72f
2 changed files with 40 additions and 60 deletions

View File

@ -119,12 +119,12 @@ export class DashboardComponent {
const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0); const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0);
const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1); const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1);
console.log('FromDateMin:',fromMin); // console.log('FromDateMin:',fromMin);
console.log('FromDateMax:',fromMax); // console.log('FromDateMax:',fromMax);
console.log('ToDateMin',toMin); // console.log('ToDateMin',toMin);
console.log('ToDateMax',toMax); // console.log('ToDateMax',toMax);
console.log('LastDateForPreMonth',LastDateForPreMonth); // console.log('LastDateForPreMonth',LastDateForPreMonth);
console.log('FirstDateForPreMonth',FirstDateForPreMonth); // console.log('FirstDateForPreMonth',FirstDateForPreMonth);
// const resetRange = {fromDate: today, toDate: today}; // const resetRange = {fromDate: today, toDate: today};
// this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged // this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged
@ -134,7 +134,7 @@ export class DashboardComponent {
this.options = { this.options = {
presets: this.presets, presets: this.presets,
format: 'mediumDate', format: 'mediumDate',
range: {fromDate:FirstDateForPreMonth, toDate: LastDateForPreMonth}, range: {fromDate:FirstDateForPreMonth, toDate: fromMax},
applyLabel: "Submit", applyLabel: "Submit",
calendarOverlayConfig: { calendarOverlayConfig: {
shouldCloseOnBackdropClick: false, shouldCloseOnBackdropClick: false,
@ -191,10 +191,7 @@ getDoughnutChartData(){
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => { this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => {
this.flag = 1; this.flag = 1;
console.log(' ***** Doughnut Chart Data *****'); console.log(' ***** Doughnut Chart Data *****',data);
console.log('Whole Data',data);
console.log('Monthly Status',data.records.current_month);
let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft');
let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered'); let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered');
@ -475,8 +472,11 @@ getDoughnutChartData(){
} }
else{ 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.doughnutChartDataForFullPD = this.tempDataFullPD;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
@ -484,16 +484,9 @@ getDoughnutChartData(){
this.total2 = this.tempDataSmartPD.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.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0);
console.log('Final full Data Completed',this.doughnutChartDataForFullPD); console.log('Final Full Data '+ this.doughnutChartDataForFullPD+'Temp Data'+this.tempDataFullPD+'Full Total '+this.total1);
console.log('temp full Data',this.tempDataFullPD); console.log('Final Smart Data '+ this.doughnutChartDataForSmartPD+' Temp Data '+this.tempDataSmartPD+'Smart Total '+this.total2);
console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD); console.log('Final Tele Data '+ this.doughnutChartDataForTelePD+' Temp Data'+this.tempDataTelePD+'Tele Total '+this.total3);
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);
}) })
} }
@ -518,7 +511,7 @@ onChange(e :any,flag: any) {
let fromdate; let fromdate;
let todate; let todate;
console.log('flag',flag);
if(flag == 1){ if(flag == 1){
fromdate = new Date(e.fromDate); 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 => { this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedCity,this.selectedLender).subscribe(data => {
console.log(' *****Updated Date Doughnut Chart Data *****'); console.log(' *****Updated Date Doughnut Chart Data *****',data);
console.log('Whole Data',data);
if(data.records.current_month.length != 0){ if(data.records.current_month.length != 0){
this.total1 = 0; this.total1 = 0;
this.total2 = 0; this.total2 = 0;
@ -848,34 +837,26 @@ onChange(e :any,flag: any) {
} }
else{ 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.doughnutChartDataForFullPD= this.tempDataFullPD;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
this.doughnutChartLabels = this.doughnutChartLabels; this.doughnutChartLabels = this.doughnutChartLabels;
this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0); this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0);
this.total2 = this.tempDataSmartPD.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.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.FullCanvas.chart.update(); this.FullCanvas.chart.update();
this.SmartCanvas.chart.update(); this.SmartCanvas.chart.update();
this.TeleCanvas.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);
}) })

View File

@ -21,7 +21,6 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
export class DashboardService { export class DashboardService {
private apiUrl = environment.apiEndpoint; private apiUrl = environment.apiEndpoint;
//private apiUrl = 'http://localhost/sparqapi/api/';
constructor(private _http: HttpClient, constructor(private _http: HttpClient,
private _aws:AwsService) { } private _aws:AwsService) { }
@ -53,17 +52,17 @@ export class DashboardService {
// } // }
getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable<any> { getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable<any> {
console.log(')))))');
console.log(fromdate); console.log('From',fromdate);
console.log(todate); console.log('To',todate);
console.log(cityarr); console.log('Lender Arr',lenderarr);
console.log(lenderarr); console.log('City Arr',cityarr);
console.log('(((');
return this._http.post(this.apiUrl+'getDashBoardMaster', { return this._http.post(this.apiUrl+'getDashBoardMaster', {
"fromdate":fromdate, "fromdate":fromdate != '' && fromdate != null && fromdate != undefined ? fromdate : '',
"todate": todate, "todate": todate != '' && todate != null && todate != undefined ? todate : '',
"cityarr":cityarr, "lenderarr": lenderarr,"cityarr":cityarr})
"lenderarr": lenderarr})
.pipe(catchError(this.handleError('role', [])) .pipe(catchError(this.handleError('role', []))
) )