currentloan : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-25 10:03:34 +05:30
parent 4d75e9b6f0
commit 788203d7be
4 changed files with 131 additions and 13 deletions

View File

@ -288,10 +288,20 @@ export class AddressComponent implements OnInit {
this.localityData.push(val); this.localityData.push(val);
} }
else if(type==5 && val.isactive == 1){ else if(type==5 && val.isactive == 1){
if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){
val.filter(at => at.address_type != 'Residence' && at.address_type != 'Residence cum Office');
}
this.addressData.push(val); this.addressData.push(val);
console.log('b4val',this.addressData);
if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){
console.log(this.CustSegAbbr);
console.log('inside if',this.addressData);
}
// if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){
// this.addressData.splice(this.addressData.indexOf('Residence'), 1);
// this.addressData.splice(this.addressData.indexOf('Residence cum Office'), 1);
// }
console.log('aftrval',this.addressData);
} }
else if(type==6 && val.isactive == 1){ else if(type==6 && val.isactive == 1){
this.ownerShipData.push(val); this.ownerShipData.push(val);

View File

@ -36,9 +36,7 @@
<div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index; let last=last" <div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index; let last=last"
[formGroupName]="i"> [formGroupName]="i">
<!-- {{frequencyData | json}} --> <!-- {{frequencyData | json}} -->
<!-- <!-- Loan type, Loan amount, Lender, Loan Taken By, Instalment Frequency, Instalment Amount, Original Tenure, Balance Tenure -->
Loan type, Loan amount, Lender, Loan Taken By, Instalment Frequency, Instalment Amount, Original Tenure, Balance Tenure
-->
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Loan Type" formControlName="loan_type" > <mat-select placeholder="Loan Type" formControlName="loan_type" >

View File

@ -47,7 +47,7 @@ export class CurrentLoanComponent implements OnInit {
OtherFlag : any = []; OtherFlag : any = [];
amtInwords : any = []; amtInwords : any = [];
emiAmtInwords : any = []; emiAmtInwords : any = [];
dataFromAssets : any = [];
existCompanyList: any =[]; existCompanyList: any =[];
mergeCompanyApplicant: any=[]; mergeCompanyApplicant: any=[];
@ -89,7 +89,96 @@ export class CurrentLoanComponent implements OnInit {
this.initCurrentloanForm(); this.initCurrentloanForm();
this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{ this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
console.log(data); // console.log(data);
if(data.dataStatus == true){
console.log(data.record);
this.dataFromAssets = data.record;
if(this.dataFromAssets.length > 0){
console.log('if condition');
// this.selectedLoanChanges('Yes');
this.currentLoanForm.controls['existing_loan'].setValue('Yes');
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
console.log(this.dataFromAssets);
// "4"
// business_assets_mode_name
// :
// "Equipments and machinaries"
// business_details
// :
// Array(1)
// 0
// :
// {equipment_manufacturing_description: "Clearner Machine"}
// length
// :
// 1
let labelarray : any = [];
this.dataFromAssets.forEach((val,index) => {
if(val.business_assets_mode == 1){
let data;
val.business_details.forEach((v,index) => {
data = v.equipment_manufacturing_description;
});
labelarray[index] = val.business_name_of_the_owner +' - '+ data;
}
if(val.business_assets_mode == 2){
let data;
val.business_details.forEach((v,index) => {
data = v.property_type_name;
});
labelarray[index] = val.business_name_of_the_owner +' - '+ data;
}
if(val.business_assets_mode == 3){
let data;
val.business_details.forEach((v,index) => {
data = v.manufacturer_model_vehicle;
});
labelarray[index] = val.business_name_of_the_owner +' - '+ data;
}
if(val.business_assets_mode == 4){
let data;
val.business_details.forEach((v,index) => {
data = v.any_other_assets;
});
labelarray[index] = val.business_name_of_the_owner +' - '+ data;
}
});
console.log('labelarray',labelarray);
// control.push(this.createLoanDetail(null));
}
}
// api.forEach(val => {
// if (val.type_of_activity_id == 2) {
// this.suppliers_raw_materials = val.products;
// console.log(this.suppliers_raw_materials);
// }
// if (val.type_of_activity_id == 3) {
// this.suppliers_finished_goods = val.products;
// console.log(this.suppliers_finished_goods);
// }
// if (val.type_of_activity_id == 4) {
// this.suppliers_trade_details = val.products;
// console.log(this.suppliers_trade_details);
// }
// if (val.type_of_activity_id == 5) {
// this.suppliers_service_product = val.products;
// console.log(this.suppliers_service_product);
// }
// tempcount++;
// });
}); });
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
@ -136,7 +225,7 @@ export class CurrentLoanComponent implements OnInit {
result.forEach((val,index) => { result.forEach((val,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount); this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount);
this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createLoanDetail()); control.push(this.createLoanDetail(null));
this.selectedfrequency(val.frequency,index); this.selectedfrequency(val.frequency,index);
//this.selectedLoanTakenBy(val.loan_taken_by,index); //this.selectedLoanTakenBy(val.loan_taken_by,index);
}); });
@ -191,7 +280,7 @@ export class CurrentLoanComponent implements OnInit {
if (e.value == 'Yes') { if (e.value == 'Yes') {
// console.log('if()'); // console.log('if()');
const control = <FormArray>this.currentLoanForm.controls['loan_details']; const control = <FormArray>this.currentLoanForm.controls['loan_details'];
control.push(this.createLoanDetail()); control.push(this.createLoanDetail(null));
} else if (e.value == 'No') { } else if (e.value == 'No') {
// console.log('else()'); // console.log('else()');
const arr = <FormArray>this.currentLoanForm.controls.loan_details; const arr = <FormArray>this.currentLoanForm.controls.loan_details;
@ -221,8 +310,10 @@ export class CurrentLoanComponent implements OnInit {
} }
} }
createLoanDetail() { createLoanDetail(data) {
if(data == null){
return this.fb.group({ return this.fb.group({
label:[''],
loan_amount: [''], loan_amount: [''],
frequency:[''], frequency:[''],
other_frequency:[''], other_frequency:[''],
@ -238,6 +329,25 @@ export class CurrentLoanComponent implements OnInit {
elapsed_tenure:[''] elapsed_tenure:['']
}); });
} }
else{
return this.fb.group({
label:[data.label],
loan_amount: [''],
frequency:[''],
other_frequency:[''],
emi: [''],
loan_type: [''],
others_loan_type: [''],
loan_taken_by:[''],
others_loan_taken:[''],
lender: [''],
others_lender:[''],
original_tenure: [''],
current_balance_tenure: [''],
elapsed_tenure:['']
});
}
}
// compare objects for merge two master table details // compare objects for merge two master table details
compareObjects(o1: any, o2: any) { compareObjects(o1: any, o2: any) {
@ -260,7 +370,7 @@ export class CurrentLoanComponent implements OnInit {
addLoanDetails() { addLoanDetails() {
const control = <FormArray>this.currentLoanForm.controls['loan_details']; const control = <FormArray>this.currentLoanForm.controls['loan_details'];
control.push(this.createLoanDetail()); control.push(this.createLoanDetail(null));
} }
deleteLoanDetails(index) { deleteLoanDetails(index) {
const control = <FormArray>this.currentLoanForm.controls['loan_details']; const control = <FormArray>this.currentLoanForm.controls['loan_details'];

View File

@ -99,7 +99,7 @@ export class PdTrigerService {
// get state and city details // get state and city details
getStateCityDetails(): Observable<any> { getStateCityDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl + 'getListOfStatesAndCities') return this._http.post<any>(this.apiUrl + 'getListOfStatesCities','')
.pipe( .pipe(
catchError(this.handleError('role', [])) catchError(this.handleError('role', []))
) )