This commit is contained in:
sriram-at-840620226347 2019-11-27 17:22:58 +05:30
commit 77b47f4ec1
6 changed files with 243 additions and 17 deletions

View File

@ -7745,9 +7745,9 @@
"integrity": "sha512-bfIYGJicxwg58j6LZjUE5JPXqq7yJfremFhX5S/DnUYwQjgmDWN6PUOFEegEO7ua4QdgGWrhK04ElOw25aWrzQ=="
},
"ngx-mat-select-search": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/ngx-mat-select-search/-/ngx-mat-select-search-1.7.2.tgz",
"integrity": "sha512-gi9HPAaJOoW3El0PElTsgvGAIR6CoTxVeYCYfRqvlVbYSmoPWIM025GamlVYAQKiTOWzqFDr51M1qAmKL8rBQQ==",
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/ngx-mat-select-search/-/ngx-mat-select-search-1.8.0.tgz",
"integrity": "sha512-oCuGWn0GYxqpOZ4mdJvHJ0l/vctVQ9kxMKEUy6HZ5bGx4dCBUsolwnQeUDM+vwGtlXoBzYQ27cxYgbfNSyuabg==",
"requires": {
"tslib": "^1.9.0"
}

View File

@ -61,7 +61,7 @@
"ng2-validation": "4.2.0",
"ngx-color-picker": "^4.0.3",
"ngx-mat-daterange-picker": "^1.1.4",
"ngx-mat-select-search": "^1.7.2",
"ngx-mat-select-search": "^1.8.0",
"ngx-perfect-scrollbar": "5.0.0-7",
"ngx-viewer": "^1.0.1",
"node-sass": "^4.12.0",

View File

@ -45,7 +45,7 @@
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
<mat-form-field style="width: 28%">
<mat-form-field style="width: 28%" *ngIf="userDetails.short_name != 'IIB'">
<mat-select placeholder="Lender Sales Person" formControlName="lender_sales_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.sales_person" [value]="person.userid">{{person.user_name}}</mat-option>
@ -126,7 +126,7 @@
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<!-- {{pdMain.fk_customer_segment.value}} -->
<mat-form-field style="width: 28%">
<!-- <mat-form-field style="width: 28%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>
Select
@ -136,9 +136,9 @@
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
</mat-form-field> -->
<mat-form-field style="width: 60%">
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" OnlyNumber required autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value">{{"&#8377;"}} {{pdMain.loan_amount.value | numberToWords}} Only</mat-hint>
@ -163,7 +163,11 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
@ -174,7 +178,11 @@
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
@ -184,7 +192,11 @@
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode" (selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -11,6 +11,8 @@ import {AdminLayoutComponent} from '../../../../layouts/admin/admin-layout.compo
/**sweet alert */
import Swal from 'sweetalert2';
import { UserService } from 'app/settings/service/user.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
@ -20,6 +22,7 @@ import { UserService } from 'app/settings/service/user.service';
})
export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter<string>();
protected _onDestroy = new Subject<void>();
cancelStatus: boolean;
enablePDButton: boolean;
coapplicantFlag: boolean = false;
@ -62,6 +65,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
loadControl: boolean;
finInstitutionList: any;
cus_abbr_value: any;
cityData: any=[];
stateData: any=[];
pincodeData: any=[];
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent,
private titleCase : TitleCasePipe,private userService:UserService) {
@ -246,6 +252,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
this.stateData=this.stateList
}
});
}
@ -319,6 +326,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
if (data.status == 200) {
this.cityList[index] = data.records.cities;
this.pincodeList[index] = data.records.pincode;
this.cityData[index]=this.cityList[index]
this.pincodeData[index]=this.pincodeList[index]
}
});
}
@ -414,6 +423,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
addressline1: [null],
fk_city: [null],
fk_state: [null],
stateSearch:[null],
citySearch:[null],
pinSearch:[null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
});
@ -965,4 +977,86 @@ checkExistPd(value,option){
}
}
searchFun(control:any,i:number,option){
console.log("control",control)
if (option == 'city') {
// this.cityData[i]=this.filterCity(this.stateList,control.value.state_name)
control.controls['citySearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.SearchCity(control.controls['citySearch'].value, i);
})
}
if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchState(control.controls['stateSearch'].value)
})
}
if (option == 'pin') {
console.log("pin")
control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchPin(control.controls['pinSearch'].value,i)
})
}
}
searchPin(val:any,index:number){
if(!this.pincodeData[index]){
return
}
let searchValue=val
if(!searchValue){
this.pincodeList[index]=this.pincodeData[index].slice()
return
}else{
searchValue=searchValue.toLowerCase()
}
this.pincodeList[index]=this.pincodeData[index].filter(value=>value.pincode.toLowerCase().indexOf(searchValue) > -1)
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData[i])
if (!this.cityData[i]) {
return
}
let searchValue = val
if (!searchValue) {
this.cityList[i]=this.cityData[i].slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
this.cityList[i]=
this.cityData[i].filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.cityList[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
searchState(val: any) {
console.log("statedata")
if (!this.stateData) {
return
}
let searchVal = val
if (!searchVal) {
// this.filteredState.next(this.stateList.slice())
this.stateList=this.stateData.slice()
return
}
else {
searchVal = searchVal.toLowerCase()
}
this.stateList=this.stateData.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
// this.filteredState.next(
// this.stateList.filter(res => res.state_name.toLowerCase().indexOf(searchVal) > -1)
// )
}
}

View File

@ -51,7 +51,7 @@
type="text" required>
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
<mat-form-field style="width: 28%">
<mat-form-field style="width: 28%" *ngIf="userDetails.short_name != 'IIB'">
<mat-select placeholder="Lender Sales Person" formControlName="lender_sales_person">
<mat-option>Select</mat-option>
<mat-option *ngFor="let person of sales_and_credit_person.sales_person" [value]="person.userid">{{person.user_name}}</mat-option>
@ -144,7 +144,7 @@
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<!-- <mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id">
@ -152,9 +152,9 @@
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
</mat-form-field> -->
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount"
@ -185,6 +185,11 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state"
(selectionChange)="getCityList($event.value,i)">
<mat-option>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"
[placeholderLabel]="'Search State...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
@ -195,6 +200,11 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
@ -206,6 +216,12 @@
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"
(selectionChange)="getPincode($event.value,i)">
<mat-option>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"
[placeholderLabel]="'Search Pincode...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>

View File

@ -7,6 +7,8 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { TitleCasePipe } from '@angular/common';
import { getRandomString } from 'selenium-webdriver/safari';
import { UserService } from 'app/settings/service/user.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-edit-pd-master',
@ -16,6 +18,7 @@ import { UserService } from 'app/settings/service/user.service';
encapsulation: ViewEncapsulation.None
})
export class EditPdMasterComponent implements OnInit {
protected _onDestroy = new Subject<void>();
public pageTitle: string = "PD Details";
pdid: any;
errorMessage: any;
@ -66,6 +69,9 @@ export class EditPdMasterComponent implements OnInit {
userDetails: any;
finInstitutionList: any=[];
stateData: any=[];
cityData: any=[];
pincodeData: any=[];
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe,private userService:UserService) {
@ -277,6 +283,7 @@ export class EditPdMasterComponent implements OnInit {
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
this.stateData=this.stateList
}
});
}
@ -327,7 +334,7 @@ export class EditPdMasterComponent implements OnInit {
// lender_landline: [landline,Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
fk_product_id: [this.data.records.fk_product_id],
fk_subproduct_id: [this.data.records.fk_subproduct_id],
fk_pd_type: [this.data.records.fk_pd_type],
fk_pd_type: [this.data.records.fk_pd_type || '1'],
fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
addresses: this._fb.array([]),
@ -436,6 +443,8 @@ export class EditPdMasterComponent implements OnInit {
this.cityList[i] = data.records.cities;
this.pincodeList[i] = data.records.pincode;
this.cityData[i]=this.cityList[i]
this.pincodeData[i]=this.pincodeList[i]
}
});
}
@ -450,6 +459,9 @@ export class EditPdMasterComponent implements OnInit {
fk_city: [null],
fk_state: [null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
stateSearch:[null],
citySearch:[null],
pinSearch:[null],
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
isactive:[1],
});
@ -462,6 +474,9 @@ export class EditPdMasterComponent implements OnInit {
fk_city: [data.fk_city],
fk_state: [data.fk_state],
  pincode : [data.pincode],
stateSearch:[null],
citySearch:[null],
pinSearch:[null],
other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
isactive:[data.isactive],
});
@ -696,7 +711,7 @@ export class EditPdMasterComponent implements OnInit {
// "pd_contact_landline": concat_landline,
"fk_product_id": my_array.fk_product_id,
"fk_subproduct_id": my_array.fk_product_id != '4' ? my_array.fk_subproduct_id : null,
"fk_pd_type": my_array.fk_pd_type,
"fk_pd_type": my_array.fk_pd_type || '1',
"fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount,
  "addressline1": filteredAddressesdata[0].addressline1 != null ? this.titleCase.transform(filteredAddressesdata[0].addressline1) : null,
@ -709,6 +724,13 @@ export class EditPdMasterComponent implements OnInit {
}
this.disableAfterSubmit = true;
if(my_array.addresses.length > 0){
my_array.addresses.forEach(vla=>{
delete vla.stateSearch
delete vla.citySearch
delete vla.pinSearch
})
}
// console.log('this.masterRandomString',this.masterRandomString);
this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => {
if (result.status == 200) {
@ -837,4 +859,86 @@ checkLender(value){
return this.lenderList.filter(val=>val.entity_id == value).map(mapping=>mapping.short_name)[0]
}
}
searchFun(control:any,i:number,option){
console.log("control",control)
if (option == 'city') {
// this.cityData[i]=this.filterCity(this.stateList,control.value.state_name)
control.controls['citySearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.SearchCity(control.controls['citySearch'].value, i);
})
}
if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchState(control.controls['stateSearch'].value)
})
}
if (option == 'pin') {
console.log("pin")
control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchPin(control.controls['pinSearch'].value,i)
})
}
}
searchPin(val:any,index:number){
if(!this.pincodeData[index]){
return
}
let searchValue=val
if(!searchValue){
this.pincodeList[index]=this.pincodeData[index].slice()
return
}else{
searchValue=searchValue.toLowerCase()
}
this.pincodeList[index]=this.pincodeData[index].filter(value=>value.pincode.toLowerCase().indexOf(searchValue) > -1)
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData[i])
if (!this.cityData[i]) {
return
}
let searchValue = val
if (!searchValue) {
this.cityList[i]=this.cityData[i].slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
this.cityList[i]=
this.cityData[i].filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.cityList[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
searchState(val: any) {
console.log("statedata")
if (!this.stateData) {
return
}
let searchVal = val
if (!searchVal) {
// this.filteredState.next(this.stateList.slice())
this.stateList=this.stateData.slice()
return
}
else {
searchVal = searchVal.toLowerCase()
}
this.stateList=this.stateData.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
// this.filteredState.next(
// this.stateList.filter(res => res.state_name.toLowerCase().indexOf(searchVal) > -1)
// )
}
}