add and edit pd mandatory removed

This commit is contained in:
sriram-at-840620226347 2020-03-21 17:54:30 +05:30
parent 2ec973dddc
commit 04d521b0aa
5 changed files with 48 additions and 3 deletions

View File

@ -50,7 +50,7 @@
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" (change)="checkExistPd($event.target.value,1)" required>
<input matInput autocomplete="off" placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" (change)="checkExistPd($event.target.value,1)">
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->

View File

@ -69,6 +69,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
stateData: any=[];
pincodeData: any=[];
billingtolist: any;
removedControl: 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) {
@ -106,9 +107,29 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.productAllList=Response['records'].products
this.productList=this.productAllList
this.finInstitutionList=Response['records'].financial_institutions
if(flag == true){
this.loadFormData();
}
let lender_other_config = Response['records'].lender_other_config
lender_other_config = JSON.parse(lender_other_config)
if(lender_other_config != null){
this.removedControl = lender_other_config.non_mandatory_fields
lender_other_config.non_mandatory_fields.forEach(lender_config=>{
console.log('lendercofig',lender_config)
this._PDtriggerForm.controls[lender_config].clearValidators();
this._PDtriggerForm.controls[lender_config].updateValueAndValidity()
})
}
else{
if(this.removedControl.length > 0) {
this.removedControl.forEach(lender_set_config=>{
console.log('lendercofig',lender_set_config)
this._PDtriggerForm.controls[lender_set_config].setValidators(Validators.compose([Validators.required]));
this._PDtriggerForm.controls[lender_set_config].updateValueAndValidity()
})
}
}
this.getSubproductList(Response['records'].default_product)
this._PDtriggerForm.controls['fk_product_id'].setValue(Response['records'].default_product);
this._PDtriggerForm.controls['fk_subproduct_id'].setValue(Response['records'].default_sub_product);

View File

@ -62,7 +62,7 @@
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text" required>
type="text">
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
<mat-form-field style="width: 28%" *ngIf="userDetails.short_name != 'IIB'">

View File

@ -73,6 +73,8 @@ export class EditPdMasterComponent implements OnInit {
cityData: any=[];
pincodeData: any=[];
billingtolist: any;
removedControl: any = [];
lender_other_config: 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) {
@ -128,6 +130,7 @@ export class EditPdMasterComponent implements OnInit {
this.getSubproductList(this.data.records.fk_product_id,1);
}
}
this.finInstitutionList=Response['records'].financial_institutions
if(flag == true){
this._EditPDtriggerForm.controls['fk_product_id'].setValue(Response['records'].default_product);
@ -138,6 +141,9 @@ export class EditPdMasterComponent implements OnInit {
this.getLenderList();
}
this.lender_other_config = Response['records'].lender_other_config
this.lender_other_config = JSON.parse(this.lender_other_config)
}
// this.loadFormData();
@ -165,6 +171,24 @@ export class EditPdMasterComponent implements OnInit {
}
}
this.loadFormData();
if(this.lender_other_config != null){
this.removedControl = this.lender_other_config.non_mandatory_fields
this.lender_other_config.non_mandatory_fields.forEach(lender_config=>{
console.log('lendercofig',lender_config)
this._EditPDtriggerForm.controls[lender_config].clearValidators();
this._EditPDtriggerForm.controls[lender_config].updateValueAndValidity()
})
}
else{
if(this.removedControl.length > 0) {
this.removedControl.forEach(lender_set_config=>{
console.log('lendercofig',lender_set_config)
this._EditPDtriggerForm.controls[lender_set_config].setValidators(Validators.compose([Validators.required]));
this._EditPDtriggerForm.controls[lender_set_config].updateValueAndValidity()
})
}
}
}

View File

@ -9,7 +9,7 @@ export const environment = {
environmentName: 'Development Environment',//Localhost Environment.
// apiEndpoint: 'https://apitest.pdgenie.com/sparqtest/api/',
apiEndpoint: ' https://apitest.pdgenie.com/sparqapi/api/',
apiEndpoint: ' https://apitest.pdgenie.com/sparqtest/api/',
authorization: 'sparqvenba2018',