clix validation : ps

This commit is contained in:
saravanakumarkandasami 2019-06-14 16:01:41 +05:30
parent 96a1bbc177
commit 7b83255da7

View File

@ -60,7 +60,7 @@ btnaccess:boolean = false;
stateVal: any=[]; stateVal: any=[];
cityListVal: any=[]; cityListVal: any=[];
pincodeListVal: any=[]; pincodeListVal: any=[];
lenderID:any; lenderName: any ;
productabbr:any; productabbr:any;
isSubproductShown: boolean = true; isSubproductShown: boolean = true;
@ -68,11 +68,11 @@ btnaccess:boolean = false;
this.shared.refresh(); this.shared.refresh();
this.pddrops(); this.pddrops();
console.log(this.productabbr,this.lenderName);
this.pdforms = this.fb.group({ this.pdforms = this.fb.group({
pd_branch_id:['',Validators.compose([Validators.required])], pd_branch_id:['',Validators.compose([Validators.required])],
lenAppID:['',Validators.compose([Validators.required])], lenAppID:['',Validators.compose([Validators.required])],
proName:[this.lenderID != 12 ? '' : Validators.compose([Validators.required])], proName:[this.productabbr != 'BL' && this.productabbr != 'LAEP' ? '' : '',Validators.compose([Validators.required])],
subProName:[''], subProName:[''],
customeSeg:[''], customeSeg:[''],
pdType:[''], pdType:[''],
@ -87,7 +87,7 @@ btnaccess:boolean = false;
//Applicant Info //Applicant Info
applicant_title_name:[''], applicant_title_name:[''],
mainappname:[''], mainappname:[''],
mainappcompany:[''], mainappcompany:[this.lenderName == 'CLIX' ? '' : '',Validators.compose([Validators.required])],
mainappphone:[''], mainappphone:[''],
mainapplandline:[''], mainapplandline:[''],
applicant_stdcode:[''], applicant_stdcode:[''],
@ -116,7 +116,7 @@ btnaccess:boolean = false;
} }
initAddress(){ initAddress(){
return this.fb.group({ return this.fb.group({
add1:[this.lenderID != 12 ? '' : Validators.compose([Validators.required])], add1:[this.lenderName != 'CLIX' ? '' : '',Validators.compose([Validators.required])],
state:[''], state:[''],
city:[''], city:[''],
pincode:[''], pincode:[''],
@ -144,9 +144,9 @@ btnaccess:boolean = false;
} }
initPersonCoApplicant(){ initPersonCoApplicant(){
return this.fb.group({ return this.fb.group({
applicant_title_name:[''], applicant_title_name:[''],
mainappname:[this.lenderID != 12 ? '' : Validators.compose([Validators.required])], mainappname:[''],
mainappcompany:[this.lenderID != 12 ? '' : Validators.compose([Validators.required])], mainappcompany:[''],
mainappphone:[''], mainappphone:[''],
mainapplandline:[''], mainapplandline:[''],
applicant_stdcode:[''], applicant_stdcode:[''],
@ -192,7 +192,8 @@ inWords(event){
{ {
this.users = this.users.records[0]; this.users = this.users.records[0];
} }
this.lenderID = this.users.fk_entity_id; this.lenderName = this.users.full_name.split(" ")[0].toUpperCase();
//console.log("Entity branch",this.users.fk_entity_id[]) //console.log("Entity branch",this.users.fk_entity_id[])
this.qustCat.getLenderDetailsById(this.users.fk_entity_id).subscribe(res=>{ this.qustCat.getLenderDetailsById(this.users.fk_entity_id).subscribe(res=>{
@ -219,7 +220,7 @@ inWords(event){
this.proname = res; this.proname = res;
if(this.proname.dataStatus == true) if(this.proname.dataStatus == true)
{ {
if(this.lenderID == 12){ if(this.lenderName == 'CLIX'){
let getProductAbbr = this.proname.records.map(dval => dval.product_abbr); let getProductAbbr = this.proname.records.map(dval => dval.product_abbr);
let ClixProductAbbr = ['BL','LAEP']; let ClixProductAbbr = ['BL','LAEP'];
let FilteredAbbr: any = []; let FilteredAbbr: any = [];
@ -242,7 +243,7 @@ inWords(event){
this.customeSeg = res; this.customeSeg = res;
if(this.customeSeg.dataStatus == true) if(this.customeSeg.dataStatus == true)
{ {
if(this.lenderID == 12){ if(this.lenderName == 'CLIX'){
// let filtered = this.customeSeg.filter(s => (s.customer_segment).includes('Self')); // let filtered = this.customeSeg.filter(s => (s.customer_segment).includes('Self'));
// this.customeSeg = filtered; // this.customeSeg = filtered;
this.customeSeg = this.customeSeg.records; this.customeSeg = this.customeSeg.records;
@ -327,7 +328,7 @@ inWords(event){
break; break;
} }
if(this.lenderID == 12 && this.productabbr != ''){ if(this.lenderName == 'CLIX' && this.productabbr != ''){
this.pdforms.controls['pdType'].setValue('1'); this.pdforms.controls['pdType'].setValue('1');
this.pdforms.controls['customeSeg'].setValue('5'); this.pdforms.controls['customeSeg'].setValue('5');
this.pdforms.controls['loanAmt'].setValue(0); this.pdforms.controls['loanAmt'].setValue(0);
@ -417,9 +418,7 @@ inWords(event){
{ {
console.log(pddata); console.log(pddata);
this.btnaccess = true; this.btnaccess = true;
if(this.pdforms.invalid) {
this.toast.lenderappmessage("Please Fill all the Fields marked with '*' ")
}
this.pddocdata.forEach((items,index) => { this.pddocdata.forEach((items,index) => {
if(items.Name !='' && items.Name != null && items.Name !== undefined){} if(items.Name !='' && items.Name != null && items.Name !== undefined){}
else{ else{
@ -538,7 +537,7 @@ inWords(event){
} }
let values={ let values={
'applicant_title_name':datas.applicant_title_name, 'applicant_title_name':datas.applicant_title_name,
'company_name': datas.mainappcompany, 'company_name': datas.mainappcompany,
'applicant_name':datas.mainappname, 'applicant_name':datas.mainappname,
'mobile_no':datas.mainappphone, 'mobile_no':datas.mainappphone,
'landline':coapplicant_landline_no, 'landline':coapplicant_landline_no,
@ -585,6 +584,8 @@ inWords(event){
this.toast.lenderappmessage('something went wrong Try Again'); this.toast.lenderappmessage('something went wrong Try Again');
} }
}); });
} }
searchFun(control,index,option){ searchFun(control,index,option){
console.log(control,option); console.log(control,option);