diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts index d20883e56..7dacc9dfa 100755 --- a/ng6-seed/src/app/app.module.ts +++ b/ng6-seed/src/app/app.module.ts @@ -29,10 +29,11 @@ import {MatToolbarModule} from '@angular/material/toolbar'; import {MatTabsModule} from '@angular/material/tabs'; import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatProgressBarModule} from '@angular/material/progress-bar'; +// import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import {MatSelectModule} from '@angular/material/select'; import {MatCardModule} from '@angular/material/card'; import {ChangePasswordDialog} from './settings/users/user-profile/user-profile.component'; -import { MatFormFieldModule } from '@angular/material'; +import { MatFormFieldModule,MatProgressSpinnerModule } from '@angular/material'; import { AppRoutes } from './app.routing'; import { AppComponent } from './app.component'; import { AdminLayoutComponent } from './layouts/admin/admin-layout.component'; @@ -77,7 +78,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { MatToolbarModule, MatTabsModule, MatCheckboxModule, - MatProgressBarModule, + MatProgressBarModule,MatProgressSpinnerModule, MatSelectModule, MatCardModule, DemoMaterialModule, diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html index 071a6d738..04656a116 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html @@ -84,8 +84,8 @@ {{owner.applicant_name}} - + - + Borrower Required diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts index 12b66421f..7c61a8032 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts @@ -42,6 +42,7 @@ export class CurrentLoanComponent implements OnInit { dataFromAssets: any = []; existCompanyList: any = []; mergeCompanyApplicant: any = []; + isOtherLoanTakenBy:any = []; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, @@ -140,6 +141,8 @@ export class CurrentLoanComponent implements OnInit { if (result.length > 0) { result.forEach((val, index) => { this.selectedfrequency(val.frequency, index); + + //this.selectedLoanTakenBy(val.loan_taken_by,index); let objs = { @@ -150,7 +153,7 @@ export class CurrentLoanComponent implements OnInit { 'emi': val.emi, 'loan_type': val.loan_type, 'others_loan_type': val.others_loan_type, - 'loan_taken_by': val.loan_taken_by, + 'loan_taken_by': val.loan_taken_by || null, 'others_loan_taken': val.others_loan_taken, 'lender': val.lender, 'others_lender': val.others_lender, @@ -159,7 +162,7 @@ export class CurrentLoanComponent implements OnInit { 'elapsed_tenure': val.elapsed_tenure } control.push(this.createLoanDetail(objs)); - + this.setOtherLoanTakenBy(val.loan_taken_by,index); }); // this.currentLoanForm.controls['loan_details'].setValue(result_data); @@ -603,6 +606,43 @@ export class CurrentLoanComponent implements OnInit { }); } + setOtherLoanTakenBy(value, ParInx) { + + let ParCtrls = this.currentLoanForm.controls['loan_details']; + + let ChdCtrls: any = ParCtrls.controls[ParInx]; + + let Avaliablity = 1; + + if (value !== null ) { + if (value.length > 0) { + + value.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; + } + }); + + } + } + if (Avaliablity == 0) { + + ChdCtrls.controls.others_loan_taken.setValidators([Validators.required]); + this.isOtherLoanTakenBy[ParInx] = true; + + } else if (Avaliablity == 1) { + + ChdCtrls.controls.others_loan_taken.setValue(''); + ChdCtrls.controls.others_loan_taken.clearValidators(); + this.isOtherLoanTakenBy[ParInx] = false; + + } + + ChdCtrls.controls.others_loan_taken.updateValueAndValidity(); + + } + + setRequiredValidation(value, item, flag) { if (flag == 1) { @@ -619,13 +659,13 @@ export class CurrentLoanComponent implements OnInit { item.controls.others_lender.setValue('');} item.controls.others_lender.updateValueAndValidity(); } - else if(flag == 3) { - if(value == 0){ - item.controls.others_loan_taken.setValidators([Validators.required]);} - else{ item.controls.others_loan_taken.clearValidators(); - item.controls.others_loan_taken.setvalue(''); } - item.controls.others_loan_taken.updateValueAndValidity(); - } + // else if(flag == 3) { + // if(value == 0){ + // item.controls.others_loan_taken.setValidators([Validators.required]);} + // else{ item.controls.others_loan_taken.clearValidators(); + // item.controls.others_loan_taken.setvalue(''); } + // item.controls.others_loan_taken.updateValueAndValidity(); + // } else if(flag == 4) { if(value == 1){ item.controls.other_frequency.setValidators([Validators.required]);} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html index 2500e32b8..327dc3395 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html @@ -26,7 +26,7 @@ - Select Yes diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts index 88b0dab1f..0c07f37a6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts @@ -37,7 +37,7 @@ export class OtherIncomeComponent implements OnInit { subproduct_abbr: any; lender_applicant_id: any; main_applicant: any; - pageTitle: string = "Other Income of Loan Applicants"; + pageTitle: string = "Other Income Details"; loadDataStatus: boolean = true; diff --git a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.html b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.html index 36d958ef5..0f540fb09 100644 --- a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.html +++ b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.html @@ -3,16 +3,17 @@
PD MIS Report - + +
-
- +
+
-
+
@@ -27,18 +28,15 @@ - - From Date - - - + + + + - - - To Date - - - + + + + @@ -60,11 +58,10 @@
-
- -
- +
+
+
@@ -206,8 +203,16 @@
Sl
+
+
- + +
+
+
+ +
+
diff --git a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.scss b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.scss index 445d2270e..f1b9fb714 100644 --- a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.scss +++ b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.scss @@ -3,57 +3,60 @@ font-size: 25px !important; } -/** Table CSS -nocontent */ +/** CSS for "No record Found Text " and "Loading Text" */ .nocontent { color: red; font-size: 16px; text-align: center; + width: 100%; } -.filter-container { - display: flex; - flex-direction: column; - min-width: 300px; -} - +/** Filter Header Css (Overall) */ .filter-header { min-height: 64px; padding: 8px 24px 0; } -.date1{ - width: 30%; -} -.date2{ - width: 30%; -} +/** Export Button CSS */ .btn_export { float: right; } -.example-container { +/** Report Card Common Css (Overall) */ +.report-card-container { + display: flex; + flex-direction: column; + min-width: 300px; +} + +/** Report Table Common Css (Overall)*/ +.report-table-container { max-height: 600px; width: 100%; overflow: auto; margin-top: 2%; } +/** Table Header Cell Css*/ .mat-header-cell { padding: 0 10px 0 10px; white-space: pre-wrap; font-size: 1rem !important; } +/** Table Body Cell Css*/ .mat-cell { padding: 0 10px 0 10px; white-space: nowrap; } +/** Table Static Columns Css*/ .mat-table-sticky { border-right: 1px solid #e0e0e0; } +/** Table Footer Cell Css - not In use*/ .mat-footer-cell { font-weight: bold; font-size: 1.2rem !important; diff --git a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.ts b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.ts index a1295d2cd..388e9dd44 100644 --- a/ng6-seed/src/app/reports/pd-mis/pd-mis.component.ts +++ b/ng6-seed/src/app/reports/pd-mis/pd-mis.component.ts @@ -5,7 +5,6 @@ import { DatePipe } from '@angular/common'; import { FormGroup, FormControl,FormBuilder } from '@angular/forms'; import * as XLSX from 'xlsx'; import { MatSort,MatPaginator, MatTableDataSource } from '@angular/material'; -import Swal from 'sweetalert2'; @Component({ selector: 'app-pd-mis', @@ -15,16 +14,18 @@ import Swal from 'sweetalert2'; export class PdMisComponent implements OnInit { pipe = new DatePipe('en-US'); - color = 'primary'; - pageSize = 10; - userData = null; - noRecordFound: boolean = false; maxDate: any; minDate: any; - array_value:any=[]; + + api_data:any=[]; + filtered_data:any=[]; + + public Loading: boolean = true; public reportform: FormGroup; + public dataLength: number; + public pageSize : number; public dataSource = new MatTableDataSource(); displayedColumns = ['serialno', @@ -46,9 +47,7 @@ export class PdMisComponent implements OnInit { 'officer_name', 'pd_status']; - @ViewChild(MatPaginator) paginator: MatPaginator; - @ViewChild(MatSort) sort: MatSort; - @ViewChild('TABLE') table: ElementRef; + constructor(private reportsService:ReportsService,private route:ActivatedRoute,private router:Router,private form_builder:FormBuilder) { this.reportform = this.form_builder.group({ from_date:[null],to_date:[null],city:[null],branch:[null],applicant_id:[null] }); @@ -56,42 +55,46 @@ export class PdMisComponent implements OnInit { ngOnInit(){ this.maxDate = new Date(); - this.getPDMISDailyReportContent(); + this.getMISDailyReport(); } - getPDMISDailyReportContent() { + getMISDailyReport() { - this.reportsService.getPDMISDailyReport().subscribe( + this.reportsService.retirveDataForMISDailyReport().subscribe( data => { if(data.dataStatus == true){ - - this.noRecordFound = false; - this.userData = data.records; + this.api_data = data.records; this.dataLength = data.records.length; + this.pageSize = data.records.length; if(data.records.length >= 1){ - this.userData = this.userData.map((val, i)=>{ + this.api_data = this.api_data.map((val, i)=>{ val['serialno'] = i + 1; return val; }) } - this.dataSource.data = this.userData; + this.dataSource.data = this.api_data; + this.Loading = false; }else{ - this.noRecordFound = true; - this.dataLength = 0 + this.dataLength = 0; + // this.Loading = true; } }) } - ExportTOExcel() - { + @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatSort) sort: MatSort; + // @ViewChild('TABLE') table: ElementRef; + @ViewChild('TABLE',{ read: ElementRef }) table: ElementRef; + + exportAsExcel():void { + const ws: XLSX.WorkSheet=XLSX.utils.table_to_sheet(this.table.nativeElement); const wb: XLSX.WorkBook = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); /* save to file */ XLSX.writeFile(wb, 'Daily MIS Report.xlsx'); - } ngAfterViewInit() { @@ -109,23 +112,23 @@ export class PdMisComponent implements OnInit { searchform(value:any){ - this.reportsService.getPDMISDailyReport().subscribe( + this.reportsService.retirveDataForMISDailyReport().subscribe( data => { if(data['dataStatus']==true) { - this.array_value = data.records; + this.filtered_data = data.records; if(value.applicant_id !== null && value.applicant_id != ''){ - this.array_value = this.filterForApplicantID(this.array_value,value.applicant_id); + this.filtered_data = this.filterForApplicantID(this.filtered_data,value.applicant_id); } if(value.city !== null && value.city != ''){ - this.array_value = this.filterForCity(this.array_value,value.city); + this.filtered_data = this.filterForCity(this.filtered_data,value.city); } if(value.branch !== null && value.branch != ''){ - // this.array_value = this.array_value.filter(val => val.branch == value.branch ); - // this.array_value = this.array_value.filter(val => this.customFilter(val,value.brach,3)); - this.array_value = this.filterForBranch(this.array_value,value.branch); + // this.filtered_data = this.filtered_data.filter(val => val.branch == value.branch ); + // this.filtered_data = this.filtered_data.filter(val => this.customFilter(val,value.brach,3)); + this.filtered_data = this.filterForBranch(this.filtered_data,value.branch); } if(value.from_date !== null && value.to_date !== null){ @@ -133,24 +136,23 @@ export class PdMisComponent implements OnInit { // console.log('value',value.to_date); let from_Date = this.pipe.transform(value.from_date,'yyyy-MM-dd HH:mm:ss'); let to_Date = this.pipe.transform(value.to_date,'yyyy-MM-dd HH:mm:ss'); - this.array_value = this.array_value.filter(val => val.created_on >= from_Date && val.created_on <= to_Date ); - // console.log('this.array_value',this.array_value); + this.filtered_data = this.filtered_data.filter(val => val.created_on >= from_Date && val.created_on <= to_Date ); + // console.log('this.filtered_data',this.filtered_data); } - - console.log(this.array_value); - - this.noRecordFound = false; - this.dataLength = this.array_value.length; - if(this.array_value.length >= 1){ - this.userData = this.array_value.map((val, i)=>{ + this.Loading = false; + this.dataLength = this.filtered_data.length; + this.pageSize = this.filtered_data.length; + if(this.filtered_data.length >= 1){ + this.api_data = this.filtered_data.map((val, i)=>{ val['serialno'] = i + 1; return val; }) } - this.dataSource.data = this.array_value; + this.dataSource.data = this.filtered_data; } else{ - this.dataSource.data = this.array_value; + this.dataSource.data = this.filtered_data; + this.dataLength = this.filtered_data.length; } }) } diff --git a/ng6-seed/src/app/reports/reports.module.ts b/ng6-seed/src/app/reports/reports.module.ts index 9dbb9acb1..92dcd0156 100644 --- a/ng6-seed/src/app/reports/reports.module.ts +++ b/ng6-seed/src/app/reports/reports.module.ts @@ -1,71 +1,31 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; + +import { FlexLayoutModule } from '@angular/flex-layout'; + import { MatInputModule } from '@angular/material'; +import { MatCardModule, + MatIconModule,MatButtonModule,MatSelectModule, + MatProgressBarModule,MatProgressSpinnerModule, + MatTableModule,MatPaginatorModule,MatSortModule } from '@angular/material'; + +import { MatListModule } from '@angular/material/list'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatFormFieldModule } from '@angular/material/form-field' +import { MatTooltipModule } from '@angular/material/tooltip'; +import { MatExpansionModule } from '@angular/material/expansion'; + +import { MatDatepickerModule} from '@angular/material/datepicker'; +import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; +import { MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter'; + +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NgxDatatableModule } from '@swimlane/ngx-datatable'; + +import { ReportsService } from '../reports/reports.service'; import { ReportsRoutingModule } from './reports-routing.module'; import { PdMisComponent } from './pd-mis/pd-mis.component'; -import {MatDatepickerModule} from '@angular/material/datepicker'; -import { - MatCardModule, - MatIconModule, - MatRadioModule, - MatButtonModule, - MatSelectModule, - MatDialogModule, - MatProgressBarModule,MatToolbarModule,MatCheckboxModule, - MatTableModule,MatPaginatorModule,MatSortModule} from '@angular/material'; - import {MatSlideToggleModule} from '@angular/material/slide-toggle'; -import {MatFormFieldModule} from '@angular/material/form-field' -import { MatTooltipModule } from '@angular/material/tooltip'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NgxMatSelectSearchModule } from 'ngx-mat-select-search'; -import { NgxDatatableModule } from '@swimlane/ngx-datatable'; -import { NotifierModule, NotifierOptions } from 'angular-notifier'; -import { DragulaModule } from 'ng2-dragula'; -import {MatListModule} from '@angular/material/list'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { ReportsService } from '../reports/reports.service'; -import {MatExpansionModule} from '@angular/material/expansion'; -const customNotifierOptions: NotifierOptions = { - position: { - horizontal: { - position: 'right', - distance: 12 - }, - vertical: { - position: 'top', - distance: 32, - gap: 10 - } - }, - theme: 'material', - behaviour: { - autoHide: 5000, - onClick: 'hide', - onMouseover: 'pauseAutoHide', - showDismissButton: true, - stacking: 4 - }, - animations: { - enabled: true, - show: { - preset: 'slide', - speed: 300, - easing: 'ease' - }, - hide: { - preset: 'fade', - speed: 300, - easing: 'ease', - offset: 50 - }, - shift: { - speed: 300, - easing: 'ease' - }, - overlap: 150 - } -}; @NgModule({ imports: [ @@ -78,25 +38,23 @@ const customNotifierOptions: NotifierOptions = { MatCardModule, MatIconModule, MatInputModule, - MatRadioModule, MatButtonModule, MatTableModule, MatPaginatorModule, - MatProgressBarModule, - MatDialogModule, + MatProgressBarModule,MatProgressSpinnerModule, MatSortModule, MatSelectModule, FlexLayoutModule, - NgxMatSelectSearchModule, NgxDatatableModule, MatSlideToggleModule, MatTooltipModule, - MatListModule,DragulaModule, + MatListModule, MatDatepickerModule, - NotifierModule.withConfig(customNotifierOptions), ], exports: [MatExpansionModule], declarations: [PdMisComponent], - providers:[ReportsService] + providers:[ReportsService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, + {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},] }) + export class ReportsModule { } diff --git a/ng6-seed/src/app/reports/reports.service.ts b/ng6-seed/src/app/reports/reports.service.ts index a9992f9a4..d673c6ffb 100644 --- a/ng6-seed/src/app/reports/reports.service.ts +++ b/ng6-seed/src/app/reports/reports.service.ts @@ -22,7 +22,7 @@ export class ReportsService { // } // get Details - getPDMISDailyReport(): Observable { + retirveDataForMISDailyReport(): Observable { return this._http.get(this.apiUrl + 'PD_MIS_report'); }