changes:ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-28 10:45:20 +05:30
parent f9dcea67f3
commit 780845b532

View File

@ -89,7 +89,61 @@ export class CurrentLoanComponent implements OnInit {
this.getMasterDetails('FREQUENCY',2); this.getMasterDetails('FREQUENCY',2);
this.getMasterDetails('EXISTINGLOANTYPES',3); this.getMasterDetails('EXISTINGLOANTYPES',3);
this.initCurrentloanForm(); this.initCurrentloanForm();
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active===true);
}
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
})
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(value => {
// console.log('value', value);
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
if (value.status == 200) {
// console.log(value.status);
this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan);
this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks);
if (value.records.existing_loan == 'Yes') {
var result = Object.keys(value.records.loan_details).map(function (key) {
return value.records.loan_details[key];
});
if (result.length > 0) {
result.forEach((val,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount);
this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createLoanDetail(null));
this.selectedfrequency(val.frequency,index);
//this.selectedLoanTakenBy(val.loan_taken_by,index);
});
this.currentLoanForm.controls['loan_details'].setValue(result);
} else {
// control.push(this.createLoanDetail());
}
}
} else {
console.log('else part',value.status);
this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{ this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
// console.log(data); // console.log(data);
@ -161,64 +215,6 @@ export class CurrentLoanComponent implements OnInit {
} }
} }
}); });
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active===true);
}
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
})
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(value => {
// console.log('value', value);
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
if (value.status == 200) {
this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan);
this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks);
if (value.records.existing_loan == 'Yes') {
var result = Object.keys(value.records.loan_details).map(function (key) {
return value.records.loan_details[key];
});
if (result.length > 0) {
result.forEach((val,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount);
this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createLoanDetail(null));
this.selectedfrequency(val.frequency,index);
//this.selectedLoanTakenBy(val.loan_taken_by,index);
});
this.currentLoanForm.controls['loan_details'].setValue(result);
} else {
// control.push(this.createLoanDetail());
}
}
} else {
// console.log('overall else');
// control.push(this.createLoanDetail());
} }
}) })
} }