diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json index 67231c52a..0b81ab213 100644 --- a/ng6-seed/package-lock.json +++ b/ng6-seed/package-lock.json @@ -7212,6 +7212,11 @@ "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-4.5.3.tgz", "integrity": "sha512-CJca1od05yf2j8OKUm5ar+mIVFB3n01+vbMpLeT+9/drKYCxgmtxxmmsgwWBNNXWYa2GNYB7PGH+mdKQkeypOg==" }, + "ngx-mat-daterange-picker": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ngx-mat-daterange-picker/-/ngx-mat-daterange-picker-1.1.4.tgz", + "integrity": "sha512-bfIYGJicxwg58j6LZjUE5JPXqq7yJfremFhX5S/DnUYwQjgmDWN6PUOFEegEO7ua4QdgGWrhK04ElOw25aWrzQ==" + }, "ngx-mat-select-search": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/ngx-mat-select-search/-/ngx-mat-select-search-1.3.1.tgz", diff --git a/ng6-seed/package.json b/ng6-seed/package.json index e375efb12..c39f55880 100644 --- a/ng6-seed/package.json +++ b/ng6-seed/package.json @@ -52,6 +52,7 @@ "ng2-toastr": "^4.1.2", "ng2-validation": "4.2.0", "ngx-color-picker": "^4.0.3", + "ngx-mat-daterange-picker": "^1.1.4", "ngx-mat-select-search": "^1.3.1", "ngx-perfect-scrollbar": "5.0.0-7", "perfect-scrollbar": "^1.3.0", diff --git a/ng6-seed/src/app/dashboard/dashboard.component.html b/ng6-seed/src/app/dashboard/dashboard.component.html index a0dbdb0f7..1b7358a8d 100644 --- a/ng6-seed/src/app/dashboard/dashboard.component.html +++ b/ng6-seed/src/app/dashboard/dashboard.component.html @@ -1,12 +1,107 @@ + + +
+ -
- - - - {{dashboardTitle}} - + + + + + {{myControl.value ? myControl.value[0].name : ''}} + + (+{{myControl.value.length - 1}} {{myControl.value?.length === 2 ? 'other' : 'others'}}) + + + {{ cd.name }} / {{cd.state_name}} + + + + +
+
+ + + + + {{myControl2.value ? myControl2.value[0].short_name : ''}} + + (+{{myControl2.value.length - 1}} {{myControl2.value?.length === 2 ? 'other' : 'others'}}) + + + + {{ ld.full_name }} ({{ ld.short_name }}) + + + +
+ + -
- - - -
{{total1}}
-
-
- - -
{{total2}}
-
- -
- - -
{{total3}}
-
-
-
    -
  • Draft
  • -
  • Triggered
  • -
  • Allocated
  • -
  • Scheduled
  • -
  • InProgress
  • -
  • Completed
  • -
  • QC Completed
  • +
    +
    + +
    Full - {{total1}}
    +
    +
    +
    +
    + +
    Smart - {{total2}}
    +
    +
    +
    +
    + +
    Tele - {{total3}}
    +
    +
    + +
    +
    +





    + +
      +
    •        Draft
    • +
    •        Triggered
    • +
    •        Allocated
    • +
    •        Scheduled
    • +
    •        InProgress
    • +
    •        Completed
    • +
    •        QC Completed
    -
    +
    +
@@ -106,78 +210,3 @@ --> - -
-
- - Alert warning - - - - - - - -

{{item.applicant_name}}

-

{{item.lender_applicant_id}}

-

{{item.entity_name}} - {{item.pd_status}}

-
-
-
-
-
-
- - -
- - Lenderwise - - - - - - - - -

{{item.full_name}} / {{item.city_name}}

-

{{item.PDTYPE}} -{{item.count}}

- - - -
-
-
-
-
-
- -
- - CityWise - - - - - - -

{{item.city_name}}

- -

{{item.PDTYPE}} -{{item.count}} - - -

-
-
-
-
-
-
-
diff --git a/ng6-seed/src/app/dashboard/dashboard.component.scss b/ng6-seed/src/app/dashboard/dashboard.component.scss index 82b9bed74..103cf1481 100644 --- a/ng6-seed/src/app/dashboard/dashboard.component.scss +++ b/ng6-seed/src/app/dashboard/dashboard.component.scss @@ -5,49 +5,69 @@ $p: 12px; mat-card-title{ background-color:#E00201 !important; color:#fff; - padding-bottom: 1rem; - margin-bottom: 0px; + //padding-bottom: 1rem; + //margin-bottom: 0px; +} +.mat-input-wrapper { + background: #fff; +} +// .example-form { +// min-width: 150px; +// max-width: 500px; +// width: 95%; +// } +li +{ + display:block; + float:left; +} + +::ng-deep { + .mat-form-field-appearance-outline .mat-form-field-outline { + color: white; + } + mat-form-field { + .mat-hint, input, ::placeholder, .mat-form-field-label { + color: white; + } + } + } + +.example-full-width { + width: 95%; } .oval { height: 13px; width: 25px; border-radius: 50%; } -.clas { + +.ngx-mat-drp-date-input[_ngcontent-c17] { + text-overflow: ellipsis; + color: #fff; +} + +.lengend-list { list-style-type: none; margin: 0; padding: 0; overflow: hidden; + text-align:justify; } -.cla { - font-size: 1rem; -} -.cla a { - display: block; - color: white; - text-align: center; - padding: 16px; - text-decoration: none; -} -.cla a:hover { - background-color: #111111; + +.lengend-element { + font-size: 1rem; + padding-right: 3%; } + .donut-inner{ -//c - with chart lender -//c margin-bottom: 154px; -//c margin-top: -187px; -//c margin-left: 145px; - margin-bottom: 154px; - margin-top: -152px; - margin-left: 142px; + margin-top: -171px; + margin-left: 120px; //margin-bottom: 154px; //margin-top: -221px; //margin-left: 145px; - - //margin-bottom: 197px; - //margin-top: -251px; - //margin-left: 188px; } + .donut-inner h5 { margin-bottom: 5px; margin-top: 0; @@ -56,9 +76,6 @@ mat-card-title{ .donut-inner span{ font-size:1rems; } -.chart{ - padding: 0rem !important; -} // .profile { // position: relative; @@ -595,8 +612,10 @@ mat-card-title{ // font-size: 50px; // display: inline-block; // } - - -//.chart{ - // padding: 2rem; -//} \ No newline at end of file +mat-card-content{ +min-height: 400px; +} +.chart{ + + padding: 0.8rem; +} \ No newline at end of file diff --git a/ng6-seed/src/app/dashboard/dashboard.component.ts b/ng6-seed/src/app/dashboard/dashboard.component.ts index d60b96ba4..10c234c5f 100644 --- a/ng6-seed/src/app/dashboard/dashboard.component.ts +++ b/ng6-seed/src/app/dashboard/dashboard.component.ts @@ -1,10 +1,16 @@ //import { Component } from '@angular/core'; -import {Component, NgModule, ElementRef, Inject, ViewChild} from '@angular/core' +import {Component, NgModule, ElementRef, Inject, Injectable, ViewChild} from '@angular/core' +import { FormBuilder, FormGroup, Validators , ValidatorFn, AbstractControl, FormControl} from '@angular/forms' +import { HttpClient } from '@angular/common/http'; import {BrowserModule} from '@angular/platform-browser' import {ChartsModule, Color} from 'ng2-charts'; -//import { MastersService } from './../service/masters/masters.service' +import {Observable} from 'rxjs'; +import {map, startWith, debounceTime, distinctUntilChanged, switchMap} from 'rxjs/operators'; +import { MastersService } from '../settings/service/masters/masters.service'; import { DashboardService } from './dashboard.service'; +import { NgxDrpOptions, PresetItem, Range } from 'ngx-mat-daterange-picker'; import { BaseChartDirective } from 'ng2-charts/ng2-charts'; +//import { DatePipe } from '@angular/common'; @Component({ selector: 'app-dashboard', @@ -13,12 +19,22 @@ import { BaseChartDirective } from 'ng2-charts/ng2-charts'; }) export class DashboardComponent { - - dashboardTitle = 'Monthly Status'; - @ViewChild('mycanvas') - myChart: BaseChartDirective; - canvas:ElementRef; + /** Declaration Part Of DataRange Picker */ + range:Range = {fromDate:new Date(), toDate: new Date()}; + options:NgxDrpOptions; + presets:Array = []; + + @ViewChild('dateRangePicker') dateRangePicker; + /* RefLINK: https://www.npmjs.com/package/ngx-mat-daterange-picker */ + /** End Of Date Range Declaration */ + + dashboardTitle = 'PD Status'; + + /** Declaration Part Of Doughnut Chart */ + @ViewChild('mycanvas') canvas:ElementRef; + //myChart: BaseChartDirective; + doughnutChartType = 'doughnut'; doughnutChartLabels: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed']; @@ -34,106 +50,134 @@ export class DashboardComponent { total1: number = 0; total2: number = 0; total3: number = 0; - - cityWisePD : any[]; - lenderWisePD :any[]; - alertMessage : any[]; - legendArr : any[] = []; - - legendData: any; - + total4: number = 0; + total5: number = 0; + total6: number = 0; + flag : number = 0; // doughnutChartColors: any[] = [{ // backgroundColor: ['#f44336', '#3f51b5', '#ffeb3b', '#4caf50', '#2196f3','#673ab7'] + // backgroundColor: ['#c1c1c1','#f44336','#3f51b5','#ffeb3b','#4caf50','#2196f3','#673ab7'] // }]; doughnutChartColors: any[] = [{ - - //backgroundColor: ['#c1c1c1','#f44336','#3f51b5','#ffeb3b','#4caf50','#2196f3','#673ab7'] backgroundColor: ['#c1c1c1','#f44336','#ffa500','#ffeb3b','#3f51b5','#00ff00','#4caf50'] - }]; - // globalChartOptionsFullPD: any = { - // responsive: false, - // legend: { - // display: false, - // position: 'bottom' - // } - // }; - // globalChartOptionsSmartPD: any = { - // responsive: false, - // legend: { - // display: false, - // position: 'bottom' - // } - // }; + globalChartOptions: any = { + responsive: false, + legend: { + display: true, + position: 'bottom' + } + }; + + /** Declaration Part Of SubCard Section */ + + cityWisePD : any=[]; + lenderWisePD :any=[]; + alertMessage : any=[]; -// title: { -// display: true, -// position: "bottom", -// text: 'Upcoming Meetings' -// }, -// legend: { -// display: false -// }, -// centertext: "123" -globalChartOptions: any = { - responsive: false, - //legendCallback: this.getLegendCallback - //legendCallback: function (chart) { - // console.log(chart); - // return 'a'; - // } - legend: { - display: true, - position: 'bottom' - } -}; -//getColor(color) { - //switch (country) { - //case "#c1c1c1": - //return '#c1c1c1'; - //case "#f44336": - //return "#f44336"; - //case "#ffa500": - //return "#ffa500"; - //case "#ffeb3b": - //return "#ffeb3b"; - //case "#3f51b5": - //return "#3f51b5"; - //case "#00ff00": - //return "#00ff00"; - //case "#4caf50": - //return "#4caf50"; - //} - //} + selectedCity : any=[]; + selectedLender : any=[]; - constructor(private _dashboardService: DashboardService) { + /** Declaration Part Of Title Form Section */ + myControl = new FormControl(); + myControl2 = new FormControl(); + myControl3 = new FormControl(); + + lenderData : any[]; + cityData : any[]; + + + constructor(private _dashboardService: DashboardService, + private _masterService: MastersService) { + /** To Display The City Data For City DropDown */ + this._masterService.getAllCity().subscribe( + dataresult => { + if (dataresult.dataStatus == true) { + this.cityData = dataresult.records; + this.cityData = this.cityData.filter(city=>city.isactive == 1 ); + } + + }); + + /** To Display The Entities Data For Entities DropDown */ + this._masterService.getAllMasterData('ENTITY').subscribe( + dataresult => { + if (dataresult.dataStatus == true) { + this.lenderData = dataresult.records; + this.lenderData = this.lenderData.filter(entity=>entity.isactive == 1 ); + } + }); + } - // Doughnut - //name: "DoughnutTextInside" ngOnInit(){ this.getPDSubCardData(); - this.getDoughnutChartData(); - let arr1 = this.doughnutChartLabels; - let arr2 = this.doughnutChartColors["0"].backgroundColor; -//console.log(arr1.length); -//console.log(arr2.length); -if(arr1.length == arr2.length){ - for(let i=0;i { + const today = new Date(); + return new Date(today.setDate(today.getDate() - numOfDays)); + } + + const today = new Date(); + const yesterday = backDate(1); + const minus7 = backDate(7) + const minus30 = backDate(30); + const currMonthStart = new Date(today.getFullYear(), today.getMonth(), 1); + const currMonthEnd = new Date(today.getFullYear(), today.getMonth()+1, 0); + const lastMonthStart = new Date(today.getFullYear(), today.getMonth()-1, 1); + const lastMonthEnd = new Date(today.getFullYear(), today.getMonth(), 0); + + this.presets = [ + {presetLabel: "Yesterday", range:{ fromDate:yesterday, toDate:today }}, + {presetLabel: "Last 7 Days", range:{ fromDate: minus7, toDate:today }}, + {presetLabel: "Last 30 Days", range:{ fromDate: minus30, toDate:today }}, + {presetLabel: "This Month", range:{ fromDate: currMonthStart, toDate:currMonthEnd }}, + {presetLabel: "Last Month", range:{ fromDate: lastMonthStart, toDate:lastMonthEnd }} + ] +} /** * To Get and Display PD Details As Per @@ -236,11 +280,18 @@ if(arr1.length == arr2.length){ **/ getDoughnutChartData(){ - this._dashboardService.getPDDetailForDoughnut().subscribe(data => { + let fromdate = '' ; + let todate = ''; + let cityarr = ''; + let lenderarr = ''; + 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); + let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered'); let AllocatedIndexvalue = this.doughnutChartLabels.indexOf('Allocated'); @@ -249,23 +300,7 @@ getDoughnutChartData(){ let CompletedIndexvalue = this.doughnutChartLabels.indexOf('Completed'); let QCCompletedIndexvalue = this.doughnutChartLabels.indexOf('QC Completed'); - if(data.records.current_day.length != '0'){ - //console.log('If Condition day'); - console.log('Today Status ',data.records.current_day); - } - else{ - //console.log('Else Condition day'); - } - - if(data.records.current_week.length != '0'){ - //console.log('If Condition week'); - console.log('Weekly Status',data.records.current_week); - } - else{ - //console.log('Else Condition week'); - } - - if(data.records.current_month.length != '0'){ + if(data.records.current_month.length != 0){ //console.log('If Condition monthLY'); console.log('Monthly Status',data.records.current_month); @@ -555,95 +590,6 @@ getDoughnutChartData(){ else{ this.tempDataTelePD[QCCompletedIndexvalue] = 0; } - - // y: number - - //console.log(monthlyFullPDArr.pd_status); - // for(let FPD of monthlyFullPDArr){ - - // if(FPD.pd_status == 'TRIGGERED'){ - // console.log('PD Status'); - // let Indexvalue = this.doughnutChartLabels.indexOf('Triggered'); - // let y = +FPD.count; // y: number - // console.log('Initial',this.tempDataFullPD); - // this.tempDataFullPD[Indexvalue] = y; - // console.log(this.tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('Triggered'); - // this.tempDataFullPD[Indexvalue] = 0; - // } - - // // if(contact.pd_status == 'TRIGGERED' && contact.PDTYPE == 'FULL'){ - // // let Indexvalue = this.doughnutChartLabels.indexOf('Triggered'); - // // var y = +contact.count; // y: number - // // console.log('Initial',this.tempDataFullPD); - // // this.tempDataFullPD[Indexvalue] = y; - // // console.log(this.tempDataFullPD); - // // } - // // else{ - // // let Indexvalue = this.doughnutChartLabels.indexOf('Triggered'); - // // this.tempDataFullPD[Indexvalue] = 0; - - // // } - // if(FPD.pd_status == 'ALLOCATED'){ - // let Indexvalue = this.doughnutChartLabels.indexOf('Allocated'); - // var y = +FPD.count; // y: number - // // console.log(this.tempDataFullPD); - // this.tempDataFullPD[Indexvalue] = y; - // //console.log('allocated b4',tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('Allocated'); - // this.tempDataFullPD[Indexvalue] = 0; - // } - // if(FPD.pd_status == 'INPROGRESS'){ - // let Indexvalue = this.doughnutChartLabels.indexOf('InProgress'); - // var y = +FPD.count; // y: number - // this.tempDataFullPD[Indexvalue] = y; - // //console.log('b4',tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('InProgress'); - // this.tempDataFullPD[Indexvalue] = 0; - // } - // if(FPD.pd_status == 'SCHEDULED'){ - // let Indexvalue = this.doughnutChartLabels.indexOf('Scheduled'); - // var y = +FPD.count; // y: number - // this.tempDataFullPD[Indexvalue] = y; - // //console.log('b4',tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('Scheduled'); - // this.tempDataFullPD[Indexvalue] = 0; - // //console.log('d',tempDataFullPD); - // } - // if(FPD.pd_status == 'COMPLETED'){ - // let Indexvalue = this.doughnutChartLabels.indexOf('Completed'); - // var y = +FPD.count; // y: number - // this.tempDataFullPD[Indexvalue] = y; - // //console.log('allocated',tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('Completed'); - // this.tempDataFullPD[Indexvalue] = 0; - // } - // //return tempDataFullPD; - - // if(FPD.pd_status == 'QC COMPLETED'){ - // let Indexvalue = this.doughnutChartLabels.indexOf('QC Completed'); - // var y = +FPD.count; // y: number - // this.tempDataFullPD[Indexvalue] = y; - // //console.log('allocated',tempDataFullPD); - // } - // else{ - // let Indexvalue = this.doughnutChartLabels.indexOf('QC Completed'); - // this.tempDataFullPD[Indexvalue] = 0; - // //console.log('Final Data',tempDataFullPD); - // } - // //console.log('inside',this.tempDataFullPD); - // } - //this.doughnutChartDataForFullPD = [3,4,5,6,7,8]; } else{ @@ -659,11 +605,12 @@ getDoughnutChartData(){ 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(this.tempDataTelePD.__proto__); //console.log(this.tempDataTelePD._chartjs); - //console.log(this.doughnutChartDataForTelePD['event'].listeners["0"].chart.boxes["0"].legendItems); - //chart.chart.ctx; /*beforeDraw: function (this.doughnutChartDataForTelePD.chart) { @@ -715,124 +662,441 @@ getDoughnutChartData(){ // }]; // }, 100); -doughnutOptionsFullPD: any = Object.assign({ +doughnutOptions: any = Object.assign({ elements: { arc: { - borderWidth: 0.2 + borderWidth: 0 } }, - title: { - display: true, - position: "top", - text: 'Full', - fontSize: 15, - }, + // title: { + // display: true, + // position: "top", + // text: 'Full', + // fontSize: 15, centertext:'One' },this.globalChartOptions); -doughnutOptionsSmartPD: any = Object.assign({ - elements: { - arc: { - borderWidth: 0.2 +onChange(e :any,flag: any) { + let fromdate; + let todate; + console.log('flag',flag); + if(flag == 1){ + + fromdate = new Date(e.fromDate); + todate = new Date(e.toDate); + + } + + if(flag == 2){ + // if(e.source._selected == true ){ + // let data = e.source.value.city_id; + // this.selectedCity.push(data); + // console.log('true'); + // } + // else if(e.source._selected == false){ + // let data = e.source.value.city_id; + // let index = this.selectedCity.indexOf(data); + // this.selectedCity.splice(index,1); + // console.log('false'); + // } + let data = e.source.value.city_id; + e.source._selected == true ? this.selectedCity.push(data) + : this.selectedCity.splice(this.selectedCity.indexOf(data),1); + console.log(this.selectedCity); + } + + if(flag == 3){ + let data = e.source.value.entity_id; + e.source._selected == true ? this.selectedLender.push(data) + : this.selectedLender.splice(this.selectedLender.indexOf(data),1); + + console.log(this.selectedLender); + + + } + + // this._dashboardService.get2(fromdate,todate,this.selectedLender,this.selectedCity).subscribe( + + // dataresult=>{ + + // }); + + this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedLender,this.selectedCity).subscribe(data => { + + console.log(' *****Updated Date Doughnut Chart Data *****'); + console.log('Whole Data',data); + if(data.records.current_month.length != 0){ + this.total1 = 0; + this.total2 = 0; + this.total3 = 0; } - }, - title: { - display: true, - position: "top", - text: 'Smart', - fontSize: 15 - }, - centertext:'Two' -}, -this.globalChartOptions); + this.doughnutChartDataForFullPD = []; + this.doughnutChartDataForSmartPD = []; + this.doughnutChartDataForTelePD = []; + -doughnutOptionsTelePD: any = Object.assign({ - elements: { - arc: { - borderWidth: 0.2 + let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); + let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered'); + let AllocatedIndexvalue = this.doughnutChartLabels.indexOf('Allocated'); + let ScheduledIndexvalue = this.doughnutChartLabels.indexOf('Scheduled'); + let InProgressIndexvalue = this.doughnutChartLabels.indexOf('InProgress'); + let CompletedIndexvalue = this.doughnutChartLabels.indexOf('Completed'); + let QCCompletedIndexvalue = this.doughnutChartLabels.indexOf('QC Completed'); + + if(data.records.current_month.length != 0){ + //console.log('If Condition monthLY'); + console.log('Monthly Status',data.records.current_month); + + let MonthlyFullPDArr = data.records.current_month.filter(arr=>arr.PDTYPE == 'FULL' ); + let MonthlySmartPDArr = data.records.current_month.filter(arr=>arr.PDTYPE == 'SMART' ); + let MonthlyTelePDArr = data.records.current_month.filter(arr=>arr.PDTYPE == 'TELE' ); + + let DraftFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'DRAFT'); + if(DraftFullPDvalue.length != '0'){ + //console.log('console triggered value',TriggerFullPDvalue); + for(let FPD of DraftFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[DraftIndexvalue] = y; + } + } + else{ + this.tempDataFullPD[DraftIndexvalue] = 0; + } + + let TriggerFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'TRIGGERED'); + if(TriggerFullPDvalue.length != '0'){ + //console.log('console triggered value',TriggerFullPDvalue); + for(let FPD of TriggerFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[TriggedIndexvalue] = y; + } + } + else{ + this.tempDataFullPD[TriggedIndexvalue] = 0; + } + + let AllocatedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); + if(AllocatedFullPDvalue.length != '0'){ + for(let FPD of AllocatedFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[AllocatedIndexvalue] = y; + } + } + else{ + this.tempDataFullPD[AllocatedIndexvalue] = 0; + } + + let ScheduledFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); + if(ScheduledFullPDvalue.length != '0'){ + for(let FPD of ScheduledFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[ScheduledIndexvalue] = y; + } + //let y = +ScheduledFullPDvalue.count; + + } + else{ + this.tempDataFullPD[ScheduledIndexvalue] = 0; + } + + let InProgressFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); + if(InProgressFullPDvalue.length != '0'){ + for(let FPD of InProgressFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[InProgressIndexvalue] = y; + } + //let y = +InProgressFullPDvalue.count; + + } + else{ + this.tempDataFullPD[InProgressIndexvalue] = 0; + } + + let CompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); + if(CompletedFullPDvalue.length != '0'){ + for(let FPD of CompletedFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[CompletedIndexvalue] = y; + } + //let y = +CompletedFullPDvalue.count; + + } + else{ + this.tempDataFullPD[CompletedIndexvalue] = 0; + } + + let QCCompletedFullPDvalue = MonthlyFullPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); + if(QCCompletedFullPDvalue.length != '0'){ + for(let FPD of QCCompletedFullPDvalue){ + let y = +FPD.count; + this.total1 = this.total1+y; + this.tempDataFullPD[QCCompletedIndexvalue] = y; + } + //let y = +QCCompletedFullPDvalue.count; + + } + else{ + this.tempDataFullPD[QCCompletedIndexvalue] = 0; + } + + let DraftSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'DRAFT'); + if(DraftSmartPDvalue.length != '0'){ + //console.log('console triggered value',TriggerFullPDvalue); + for(let FPD of DraftSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[DraftIndexvalue] = y; + } + } + else{ + this.tempDataSmartPD[DraftIndexvalue] = 0; + } + + let TriggerSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'TRIGGERED'); + if(TriggerSmartPDvalue.length != '0'){ + + for(let FPD of TriggerSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[TriggedIndexvalue] = y; + } + } + else{ + this.tempDataSmartPD[TriggedIndexvalue] = 0; + } + + let AllocatedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); + if(AllocatedSmartPDvalue.length != '0'){ + for(let FPD of AllocatedSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[AllocatedIndexvalue] = y; + } + } + else{ + this.tempDataSmartPD[AllocatedIndexvalue] = 0; + } + + let ScheduledSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); + if(ScheduledSmartPDvalue.length != '0'){ + for(let FPD of ScheduledSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[ScheduledIndexvalue] = y; + } + //let y = +ScheduledFullPDvalue.count; + + } + else{ + this.tempDataSmartPD[ScheduledIndexvalue] = 0; + } + + let InProgressSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); + if(InProgressSmartPDvalue.length != '0'){ + for(let FPD of InProgressSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[InProgressIndexvalue] = y; + } + //let y = +InProgressFullPDvalue.count; + + } + else{ + this.tempDataSmartPD[InProgressIndexvalue] = 0; + } + + let CompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == 'COMPLETED'); + if(CompletedSmartPDvalue.length != '0'){ + for(let FPD of CompletedSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[CompletedIndexvalue] = y; + } + //let y = +CompletedFullPDvalue.count; + + } + else{ + this.tempDataSmartPD[CompletedIndexvalue] = 0; + } + + let QCCompletedSmartPDvalue = MonthlySmartPDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); + if(QCCompletedSmartPDvalue.length != '0'){ + for(let FPD of QCCompletedSmartPDvalue){ + let y = +FPD.count; + this.total2 = this.total2+y; + this.tempDataSmartPD[QCCompletedIndexvalue] = y; + } + //let y = +QCCompletedFullPDvalue.count; + + } + else{ + this.tempDataSmartPD[QCCompletedIndexvalue] = 0; + } + + + let DraftTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'DRAFT'); + if(DraftTelePDvalue.length != '0'){ + + for(let FPD of DraftTelePDvalue){ + let y = +FPD.count; + this.total1 = this.total3+y; + this.tempDataTelePD[DraftIndexvalue] = y; + } + } + else{ + this.tempDataTelePD[DraftIndexvalue] = 0; + } + + let TriggerTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'TRIGGERED'); + if(TriggerTelePDvalue.length != '0'){ + //console.log('console triggered value',TriggerTelePDvalue); + for(let FPD of TriggerTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[TriggedIndexvalue] = y; + } + } + else{ + this.tempDataTelePD[TriggedIndexvalue] = 0; + } + + let AllocatedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'ALLOCATED'); + if(AllocatedTelePDvalue.length != '0'){ + for(let FPD of AllocatedTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[AllocatedIndexvalue] = y; + } + } + else{ + this.tempDataTelePD[AllocatedIndexvalue] = 0; + } + + let ScheduledTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'SCHEDULED'); + if(ScheduledTelePDvalue.length != '0'){ + for(let FPD of ScheduledTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[ScheduledIndexvalue] = y; + } + //let y = +ScheduledFullPDvalue.count; + + } + else{ + this.tempDataTelePD[ScheduledIndexvalue] = 0; + } + + let InProgressTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'INPROGRESS'); + if(InProgressTelePDvalue.length != '0'){ + for(let FPD of InProgressTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[InProgressIndexvalue] = y; + } + //let y = +InProgressFullPDvalue.count; + + } + else{ + this.tempDataTelePD[InProgressIndexvalue] = 0; + } + + let CompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == 'COMPLETED'); + if(CompletedTelePDvalue.length != '0'){ + for(let FPD of CompletedTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[CompletedIndexvalue] = y; + } + //let y = +CompletedFullPDvalue.count; + + } + else{ + this.tempDataTelePD[CompletedIndexvalue] = 0; + } + + let QCCompletedTelePDvalue = MonthlyTelePDArr.filter(arr=>arr.pd_status == "QC_COMPLETED"); + if(QCCompletedTelePDvalue.length != '0'){ + for(let FPD of QCCompletedTelePDvalue){ + let y = +FPD.count; + this.total3 = this.total3+y; + this.tempDataTelePD[QCCompletedIndexvalue] = y; + } + //let y = +QCCompletedFullPDvalue.count; + + } + else{ + this.tempDataTelePD[QCCompletedIndexvalue] = 0; + } } - }, - title: { - display: true, - position: "top", - text: 'Tele', - fontSize: 15 - }, - centertext:'Three' -}, this.globalChartOptions); - -// Chart.pluginService.register({ -// beforeDraw: function(chart) { -// var width = chart.chart.width, -// height = chart.chart.height, -// ctx = chart.chart.ctx; + else{ + //console.log('Else Condition month'); + } + this.doughnutChartDataForFullPD = this.tempDataFullPD; + this.doughnutChartDataForSmartPD = this.tempDataSmartPD; + this.doughnutChartDataForTelePD = this.tempDataTelePD; -// ctx.restore(); -// var fontSize = (height / 114).toFixed(2); -// ctx.font = fontSize + "em sans-serif"; -// ctx.textBaseline = "middle"; + 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(this.tempDataTelePD.__proto__); +//console.log(this.tempDataTelePD._chartjs); +//console.log(this.doughnutChartDataForTelePD['event'].listeners["0"].chart.boxes["0"].legendItems); +//chart.chart.ctx; -// var text = "75%", -// textX = Math.round((width - ctx.measureText(text).width) / 2), -// textY = height / 2; +/*beforeDraw: function (this.doughnutChartDataForTelePD.chart) { + if (chart.config.options.elements.center) { + //Get ctx from string + var ctx = chart.chart.ctx; -// ctx.fillText(text, textX, textY); -// ctx.save(); -// } -// }); + //Get options from the center object in options + var centerConfig = chart.config.options.elements.center; + var fontStyle = centerConfig.fontStyle || 'Arial'; + var txt = centerConfig.text; + var color = centerConfig.color || '#000'; + var sidePadding = centerConfig.sidePadding || 20; + var sidePaddingCalculated = (sidePadding/100) * (chart.innerRadius * 2) + //Start with a base font of 30px + ctx.font = "30px " + fontStyle; + + //Get the width of the string and also the width of the element minus 10 to give it 5px side padding + var stringWidth = ctx.measureText(txt).width; + var elementWidth = (chart.innerRadius * 2) - sidePaddingCalculated; + + // Find out how much the font can grow in width. + var widthRatio = elementWidth / stringWidth; + var newFontSize = Math.floor(30 * widthRatio); + var elementHeight = (chart.innerRadius * 2); + + // Pick a new font size so it will not be larger than the height of label. + var fontSizeToUse = Math.min(newFontSize, elementHeight); + + //Set font settings to draw it correctly. + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + var centerX = ((chart.chartArea.left + chart.chartArea.right) / 2); + var centerY = ((chart.chartArea.top + chart.chartArea.bottom) / 2); + ctx.font = fontSizeToUse+"px " + fontStyle; + ctx.fillStyle = color; + + //Draw text in center + ctx.fillText(txt, centerX, centerY); + } +}*/ + + }) } - -// import {Component, NgModule, ElementRef, Inject, ViewChild} from '@angular/core' -// import {BrowserModule} from '@angular/platform-browser' -// import {ChartsModule, Color} from 'ng2-charts'; - -// @Component({ -// selector: 'app-dashboard', -// templateUrl: './dashboard.component.html', -// styleUrls: ['./dashboard.component.scss'] -// }) - - -// export class DashboardComponent { - -// @ViewChild('mycanvas') -// canvas:ElementRef; -// doughnutChartDataForTelePD:number[]=[1,2,3,4,5,6]; -// options: { circumference: number; rotation: number; animation: { onComplete: () => void; }; }; - -// ngOnInit(){ -// var ctx = this.canvas.nativeElement.getContext("2d"); - -// let me = this; -// this.options = { - -// circumference: Math.PI, -// rotation : Math.PI, -// animation:{ onComplete: function() { -// me.doit(ctx); -// }} -// } - -// } - -// doit(ctx) { -// // Chart.types.Doughnut.prototype.draw.apply(this, arguments); - -// var width = this.canvas.nativeElement.clientWidth, -// height = this.canvas.nativeElement.clientHeight; - -// var fontSize = (height / 250).toFixed(2); -// ctx.font = fontSize + "em Verdana"; -// ctx.textBaseline = "middle"; -// ctx.fillStyle = "blue"; - -// var text = "Pass Rate 82%", -// textX = Math.round((width - ctx.measureText(text).width) / 2), -// textY = height -10; - -// ctx.fillText(text, textX, textY); -// ctx.restore(); -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/ng6-seed/src/app/dashboard/dashboard.module.ts b/ng6-seed/src/app/dashboard/dashboard.module.ts index 89e784107..ee692ba0a 100644 --- a/ng6-seed/src/app/dashboard/dashboard.module.ts +++ b/ng6-seed/src/app/dashboard/dashboard.module.ts @@ -1,7 +1,23 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { CommonModule } from '@angular/common'; -import { MatIconModule, MatCardModule,MatTabsModule, MatButtonModule, MatListModule, MatProgressBarModule, MatMenuModule } from '@angular/material'; + +import { MatIconModule, + MatCardModule, + MatTabsModule, + MatButtonModule, + MatListModule, + MatProgressBarModule, + MatMenuModule, + MatAutocompleteModule, + MatInputModule, + MatSelectModule} from '@angular/material'; + + // import { + // MatRadioModule, + // MatToolbarModule,MatCheckboxModule, + // MatTableModule,MatPaginatorModule,MatSortModule} from '@angular/material'; + import { FlexLayoutModule } from '@angular/flex-layout'; import { ChartsModule } from 'ng2-charts/ng2-charts'; @@ -13,10 +29,15 @@ import { DashboardRoutes } from './dashboard.routing'; /** Dashboard Service */ import { DashboardService } from './dashboard.service'; +import { MastersService } from '../settings/service/masters/masters.service'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; + +import { NgxMatDrpModule } from 'ngx-mat-daterange-picker'; @NgModule({ imports: [ CommonModule, + FormsModule, ReactiveFormsModule, RouterModule.forChild(DashboardRoutes), MatIconModule, MatCardModule, @@ -25,12 +46,16 @@ import { DashboardService } from './dashboard.service'; MatListModule, MatProgressBarModule, MatMenuModule, + MatInputModule, + MatSelectModule, ChartsModule, NgxChartsModule, NgxDatatableModule, - FlexLayoutModule + MatAutocompleteModule, + NgxMatDrpModule, + FlexLayoutModule, ], - providers: [ DashboardService ], + providers: [ DashboardService,MastersService ], declarations: [ DashboardComponent ] }) diff --git a/ng6-seed/src/app/dashboard/dashboard.service.ts b/ng6-seed/src/app/dashboard/dashboard.service.ts index 0e4384116..bca8717dc 100644 --- a/ng6-seed/src/app/dashboard/dashboard.service.ts +++ b/ng6-seed/src/app/dashboard/dashboard.service.ts @@ -21,9 +21,9 @@ 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, + constructor(private _http: HttpClient, private _aws:AwsService) { } // $route['getDashBoardMaster'] @@ -44,13 +44,26 @@ export class DashboardService { /** * TO get PD Datas For Dashboard Screen */ -getPDDetailForDoughnut(): Observable { - return this._http.get(this.apiUrl+'getDashBoardMaster') - .pipe( - catchError(this.handleError('role', [])) - ) +// getPDDetailForDoughnut(): Observable { +// return this._http.get(this.apiUrl+'getDashBoardMaster') +// .pipe( +// catchError(this.handleError('role', [])) +// ) + +// } + +getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable { + + return this._http.post(this.apiUrl+'getDashBoardMaster', { + "fromdate":fromdate, + "todate": todate, + "cityarr":cityarr, + "lenderarr": lenderarr}) + .pipe(catchError(this.handleError('role', [])) + ) + + } -} getLenderDetail(): Observable { return this._http.get(this.apiUrl+'getDashBoardLenderCity') @@ -76,6 +89,18 @@ getLenderDetail(): Observable { } + get2(fromdate,todate,cityarr,lenderarr): Observable { + + return this._http.post(this.apiUrl+'getDashBoardMaster', { + "fromdate":fromdate, + "todate": todate, + "cityarr":cityarr, + "lenderarr": lenderarr}) + .pipe(catchError(this.handleError('role', [])) + ) + + } + /** * TO Handle The Error */ diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.html b/ng6-seed/src/app/layouts/admin/admin-layout.component.html index 494a2d76b..93218012f 100644 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.html +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.html @@ -254,7 +254,7 @@ --> @@ -15,7 +15,7 @@
- + person{{master.pd_allocated_to | titlecase}} person{{master.executive_name | titlecase}}/{{master.centralofficer | titlecase}} person{{master.centralofficer | titlecase}} @@ -72,13 +72,13 @@ - +

 {{applicant.applicant_name}}     -  {{applicant.mobile_no}}
Main Applicant
-    {{applicant.relation_name}} +  {{applicant.mobile_no}}
Main Applicant + {{applicant.relation_name}}

diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.html b/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.html index 900b3663f..f31e1a45f 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.html +++ b/ng6-seed/src/app/quality-check/qc-list/qc-view/qc-view.component.html @@ -61,34 +61,23 @@ Applicants - - -

- -  {{applicant.applicant_name}}     - -  {{applicant.mobile_no}}
Main Applicant
-    {{applicant.relation_name}} -

- - -
- -
- -
- + +

+ +  {{applicant.applicant_name}}     + +  {{applicant.mobile_no}}
Main Applicant + {{applicant.relation_name}} +

+
+ +

No Applicant

- - - - + - - -
+