diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json index d5ea70c..6ad57c9 100755 --- a/ng6-seed/package-lock.json +++ b/ng6-seed/package-lock.json @@ -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" } diff --git a/ng6-seed/package.json b/ng6-seed/package.json index a626f22..c5bd085 100755 --- a/ng6-seed/package.json +++ b/ng6-seed/package.json @@ -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", diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index 102d053..5d93739 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -45,7 +45,7 @@ - + Select {{person.user_name}} @@ -126,7 +126,7 @@ - + + - + --> {{"₹"}} {{pdMain.loan_amount.value | numberToWords}} Only @@ -163,7 +163,11 @@ - Select + + + {{SL.name}} @@ -174,7 +178,11 @@ - Select + + + {{CL.city_name}} @@ -184,7 +192,11 @@ - Select + + + {{PL.pincode}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 1af63f6..5824147 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -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(); + protected _onDestroy = new Subject(); 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) + // ) + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html index 84b64dd..8c2138c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html @@ -51,7 +51,7 @@ type="text" required> - + Select {{person.user_name}} @@ -144,7 +144,7 @@ - + + - + --> + + + Select {{SL.name}} @@ -195,6 +200,11 @@ + + + Select {{CL.city_name}} @@ -206,6 +216,12 @@ + + + + Select {{PL.pincode}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index ae2d01b..1d2a5a6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -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(); 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, @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) + // ) + } }