issues fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-04-27 14:02:56 +05:30
parent dd1cb76487
commit bf52ff64b1
10 changed files with 169 additions and 160 deletions

View File

@ -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,

View File

@ -84,8 +84,8 @@
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<!-- <mat-option value= 0 >Others</mat-option> ->
</mat-select> -->
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value.id,details,3)">
<mat-select multiple placeholder="Loan Taken By" formControlName="loan_taken_by"
[compareWith]="compareObjects" (selectionChange)="setOtherLoanTakenBy($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant"
[label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues"
@ -97,7 +97,7 @@
</mat-form-field>
<!-- {{details.get('loan_taken_by').value}} -->
<!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> -->
<mat-form-field style="width:45%;" *ngIf="checkOthers(details.get('loan_taken_by').value)===true">
<mat-form-field *ngIf="isOtherLoanTakenBy[i]">
<input matInput autocomplete="off" placeholder="Specify Borrower"
formControlName="others_loan_taken">
<mat-error *ngIf="details.controls['others_loan_taken'].hasError('required')">Borrower Required</mat-error>

View File

@ -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 = <FormArray>this.currentLoanForm.controls['loan_details'];
let ChdCtrls: any = <FormArray>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]);}

View File

@ -26,7 +26,7 @@
<!-- <mat-card-title></mat-card-title> -->
<mat-card-content>
<mat-form-field style="width:45% !important;">
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Other Income"
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Other Income of Loan Applicants"
formControlName="other_income">
<mat-option>Select</mat-option>
<mat-option value="Yes">Yes</mat-option>

View File

@ -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;

View File

@ -3,16 +3,17 @@
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
<div class="ml-xs mr-xs" style="width: 100%;">
<mat-card-title><span> PD MIS Report </span>
<button class="btn_export" mat-raised-button color="primary" (click)="ExportTOExcel()" >Export CSV</button>
<button class="btn_export" mat-raised-button color="primary" (click)="exportAsExcel()" [disabled]="dataLength == 0 ? true : false" >Export CSV</button>
<!-- (click)="ExportTOExcel()" -->
</mat-card-title>
</div>
</div>
<mat-card-content>
<div class="filter-container mat-elevation-z8">
<div *ngIf="!Loading" class="report-card-container mat-elevation-z8">
<br/>
<div fxLayout="row" fxLayoutAlign="start center" class="filter-header">
<div *ngIf="!noRecordFound" class="ml-xs mr-xs" style="width: 100%;">
<div class="ml-xs mr-xs" style="width: 100%;">
<form [formGroup]="reportform">
<mat-expansion-panel>
<mat-expansion-panel-header>
@ -27,18 +28,15 @@
<input matInput type="text" placeholder="Application ID" formControlName="applicant_id">
</mat-form-field>
<mat-form-field color="accent" class="date1 ml-xs mr-xs" style="width: 30%;">
<mat-label>From Date</mat-label>
<input matInput [max]="maxDate" [matDatepicker]="picker1" formControlName="from_date" (dateChange)="getDateObjects($event.target.value)">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1 color="primary"></mat-datepicker>
<mat-form-field class="ml-xs mr-xs" style="width:30%">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="from_date" placeholder="From Date" (dateChange)="getDateObjects($event.target.value)">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field color="accent" class="date2 ml-xs mr-xs" style="width: 30%;">
<mat-label>To Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="picker2" formControlName="to_date" >
<mat-datepicker-toggle matSuffix [for]="picker2"></mat-datepicker-toggle>
<mat-datepicker #picker2 color="primary"></mat-datepicker>
<mat-form-field class="ml-xs mr-xs" style="width:30%">
<input matInput [matDatepicker]="picker1" [min]="minDate" [max]="maxDate" formControlName="to_date" placeholder="To Date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
@ -60,11 +58,10 @@
</form>
<br/>
</div>
<div *ngIf="noRecordFound" class="nocontent ml-xs mr-xs" style="width: 80%;">No records found</div>
</div>
<div class="example-container mat-elevation-z8 " #TABLE>
<table mat-table #table *ngIf="!noRecordFound" [dataSource]="dataSource" matSort>
<div class="report-table-container mat-elevation-z8 " #TABLE>
<div *ngIf="dataLength != 0">
<table mat-table #table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="serialno" sticky>
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sl </th>
@ -207,7 +204,15 @@
</tr>
</table>
</div>
<mat-paginator *ngIf="!noRecordFound" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
<div *ngIf="dataLength == 0" class="nocontent ml-xs mr-xs" style="padding: 1rem !important;">No records found</div>
</div>
<mat-paginator [length]="pageSize" [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100,dataLength]" showFirstLastButtons></mat-paginator>
</div>
<div *ngIf="Loading">
<div fxLayoutAlign="center">
<mat-progress-spinner mode="indeterminate" class="primary"></mat-progress-spinner>
</div>
<p class="nocontent">Loading....</p>
</div>
</mat-card-content>
</mat-card>

View File

@ -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;

View File

@ -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;
}
})
}

View File

@ -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 { }

View File

@ -22,7 +22,7 @@ export class ReportsService {
// }
// get Details
getPDMISDailyReport(): Observable<any> {
retirveDataForMISDailyReport(): Observable<any> {
return this._http.get(this.apiUrl + 'PD_MIS_report');
}