other family and other income : ps
This commit is contained in:
parent
e6ed8918f5
commit
f198627a9b
@ -87,6 +87,11 @@ export class CurrentLoanComponent implements OnInit {
|
||||
this.getMasterDetails('FREQUENCY',2);
|
||||
this.getMasterDetails('EXISTINGLOANTYPES',3);
|
||||
this.initCurrentloanForm();
|
||||
|
||||
this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
|
||||
if(data.dataStatus){
|
||||
this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true);
|
||||
|
||||
@ -281,12 +281,12 @@
|
||||
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<!-- <mat-select placeholder="Select a person" formControlName="selected_person" required>
|
||||
<mat-select placeholder="Select a person" formControlName="selected_person" (selectionChange)="selectedPerson($event.value,ix)" required>
|
||||
<mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of selectPerson">
|
||||
{{person.applicant_name}}
|
||||
</mat-option>
|
||||
</mat-select> -->
|
||||
<input matInput placeholder="person" formControlName="selected_person" required>
|
||||
</mat-select>
|
||||
<!-- <input matInput placeholder="person" formControlName="selected_person" required> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
@ -346,16 +346,16 @@
|
||||
<input matInput placeholder="Rent Amount" formControlName="rent">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<!-- <div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Number of Family Members" formControlName="total_number_of_family_members" (focusout)="getNumberOfFamilyMemberDetails(ix)"
|
||||
type="number" max='20' min='1'>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div>
|
||||
<div formArrayName="family_members_details">
|
||||
<div *ngFor="let item of sup.controls.family_members_details['controls']; let i=index" [formGroupName]="i">
|
||||
<div *ngFor="let item of sup.controls.family_members_details['controls']; let i=index; let last=last " [formGroupName]="i">
|
||||
<mat-card>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
@ -419,6 +419,20 @@
|
||||
<input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" required>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<mat-card-actions>
|
||||
<div align="center">
|
||||
<button type="button" mat-flat-button (click)="addFamilyMembers(i)"
|
||||
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
|
||||
<strong>Add More Family Members </strong>
|
||||
</button>
|
||||
</div>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="removeFamilyMembers(i)"
|
||||
matTooltip="Delete Family Members" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="!last">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -303,6 +303,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
private notifier: NotifierService;
|
||||
public familyForm: FormGroup;
|
||||
public selectPerson;
|
||||
public apiFamilyMembers : any = [];
|
||||
// selectPerson = [{
|
||||
// name : 'person 1',
|
||||
// id : 111
|
||||
@ -353,10 +354,60 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
this.getMasterDetails('STATE', 6);
|
||||
// this.getMasterDetails('CITY', 7);
|
||||
// this.getMasterDetails('PINCODE', 8);
|
||||
|
||||
this._pd.getFamilyDetails(this.pdid).subscribe(data=>{
|
||||
console.clear();
|
||||
console.log('data',data);
|
||||
if(data.dataStatus == true){
|
||||
|
||||
let Temparr : any = [];
|
||||
|
||||
// console.log('from_business_form',data.record.from_business_form);
|
||||
// console.log('from_general_form',data.record.from_general_form);
|
||||
|
||||
if(data.record.from_general_form.length > 0){
|
||||
let familyMembersGeneralForm = Object.keys(data.record.from_general_form).map(function (key) {
|
||||
return data.record.from_general_form[key];
|
||||
});
|
||||
|
||||
let datas = familyMembersGeneralForm.map(element => {
|
||||
return {id:element.pd_co_applicant_id.toString(),
|
||||
name:element.applicant_name,
|
||||
relationship:element.relationship,
|
||||
relation_to:element.relation_to,
|
||||
data_gets_from:'GeneralForm'};
|
||||
});
|
||||
// console.log('familyMembersGeneralForm',familyMembersGeneralForm);
|
||||
Temparr.push(datas);
|
||||
|
||||
}
|
||||
|
||||
if(data.record.from_business_form.length > 0){
|
||||
let familyMembersBusinessForm = Object.keys(data.record.from_business_form).map(function (key) {
|
||||
return data.record.from_business_form[key];
|
||||
});
|
||||
let datas = familyMembersBusinessForm.map(element => {
|
||||
return {id:element.other_family_relationship_id.toString(),
|
||||
name:element.family_member_name,
|
||||
relationship:element.other_family_relationship_id,
|
||||
relation_to:element.relation_to_id,
|
||||
data_gets_from:'BusinessForm'};
|
||||
});
|
||||
// console.log('familyMembersGeneralForm',familyMembersBusinessForm);
|
||||
Temparr.push(datas);
|
||||
}
|
||||
this.apiFamilyMembers = [].concat.apply([],Temparr);
|
||||
console.log(this.apiFamilyMembers);
|
||||
}
|
||||
})
|
||||
|
||||
this.initFamilyFormDetails();
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = '6';
|
||||
|
||||
// - { "pd_id":"104"}
|
||||
|
||||
this._pd.retriveForm(params).subscribe(data => {
|
||||
const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
|
||||
const value = <FormArray>this.familyForm.controls['earningMembers'];
|
||||
@ -375,29 +426,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
this.familyForm.controls.family_details_form_remark.setValue(data.records.family_details_form_remark);
|
||||
// this.generateFamilyMembersDetailsGetData(data.records.family_members_details);
|
||||
} else {
|
||||
|
||||
this.selectPerson.forEach((val,index) => {
|
||||
let formData: FormGroup = this.fb.group({
|
||||
selected_person: [val.applicant_name],
|
||||
residence_place: [null],
|
||||
residence_city: [null],
|
||||
residence_state: [null],
|
||||
residence_pin: [null],
|
||||
residence_No_of_years: [null],
|
||||
residence_ownership: [null],
|
||||
ownershipOther: [null],
|
||||
rent: [null],
|
||||
total_number_of_family_members: [null],
|
||||
family_members_details: this.fb.array([]),
|
||||
});
|
||||
const control = <FormArray>this.familyForm.controls['family_details'];
|
||||
control.push(formData);
|
||||
});
|
||||
|
||||
// this.selectPerson.forEach((val,index) => {
|
||||
// this.initFamilyForm(val.pd_co_applicant_id);
|
||||
// });
|
||||
// this.initFamilyForm(null);
|
||||
this.initFamilyForm(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -525,7 +554,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
residence_ownership: ['', Validators.compose([])],
|
||||
ownershipOther: [''],
|
||||
rent: [''],
|
||||
total_number_of_family_members: ['', Validators.compose([Validators.min(1), Validators.max(20)])],
|
||||
// total_number_of_family_members: ['', Validators.compose([Validators.min(1), Validators.max(20)])],
|
||||
family_members_details: this.fb.array([]),
|
||||
});
|
||||
const control = <FormArray>this.familyForm.controls['family_details'];
|
||||
@ -544,7 +573,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
residence_ownership: [val.residence_ownership, Validators.compose([])],
|
||||
ownershipOther: [val.ownershipOther || null],
|
||||
rent: [val.rent || null],
|
||||
total_number_of_family_members: [val.total_number_of_family_members, Validators.compose([Validators.min(1), Validators.max(20)])],
|
||||
// total_number_of_family_members: [val.total_number_of_family_members, Validators.compose([Validators.min(1), Validators.max(20)])],
|
||||
family_members_details: this.fb.array([]),
|
||||
});
|
||||
const control = <FormArray>this.familyForm.controls['family_details'];
|
||||
@ -587,31 +616,80 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
e.stopPropagation();
|
||||
this.initFamilyForm('chck');
|
||||
}
|
||||
selectedPerson(e,inx){
|
||||
// console.log(e);
|
||||
// console.log(this.apiFamilyMembers);
|
||||
// return;
|
||||
|
||||
getNumberOfFamilyMemberDetails(inx) {
|
||||
// alert(inx);
|
||||
let formData = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls;
|
||||
// alert(formData['total_number_of_family_members'].value);
|
||||
// alert(this.familyForm.controls.total_number_of_family_members.valid);
|
||||
if (formData['total_number_of_family_members'].valid) {
|
||||
let totalMem = formData['total_number_of_family_members'].value;
|
||||
const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
|
||||
if (totalMem > control.length) {
|
||||
let len = totalMem - control.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
control.push(this.generateFamilyMembersDetailsGet());
|
||||
}
|
||||
} else if (totalMem < control.length) {
|
||||
// control.controls.slice(0, totalMem);
|
||||
control.controls = [];
|
||||
for (let i = 0; i < totalMem; i++) {
|
||||
control.push(this.generateFamilyMembersDetailsGet());
|
||||
}
|
||||
const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
|
||||
|
||||
if(this.apiFamilyMembers.length>0){
|
||||
let arraydata : any;
|
||||
let data = this.apiFamilyMembers.filter(item => item.relation_to == e);
|
||||
if(data.length > 0){
|
||||
data.forEach(val => {
|
||||
arraydata = {
|
||||
'family_member_name' : val.name,
|
||||
'family_member_relationship' : val.relationship,
|
||||
'family_member_age' : '',
|
||||
'family_member_earning_status': '',
|
||||
'earning_segment': '',
|
||||
'earning_gross_income_per_month': '',
|
||||
'earning_name_of_the_employer_or_business': '',
|
||||
'earning_number_of_years_in_employment_or_business': '',
|
||||
'non_earning_occupation': '',
|
||||
'non_earning_if_others': '',
|
||||
'non_earning_if_retired_from': '',
|
||||
'non_earning_if_schoolorcollege': ''
|
||||
}
|
||||
|
||||
});
|
||||
control.push(this.initgenerateFamilyMembersDetailsGet(arraydata));
|
||||
}
|
||||
else{
|
||||
control.push(this.generateFamilyMembersDetailsGet());
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
control.push(this.generateFamilyMembersDetailsGet());
|
||||
}
|
||||
}
|
||||
|
||||
addFamilyMembers(inx) {
|
||||
const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
|
||||
control.push(this.generateFamilyMembersDetailsGet());
|
||||
}
|
||||
|
||||
removeFamilyMembers(index) {
|
||||
const control = <FormArray>this.familyForm.controls['family_details']['controls'][index].controls.family_members_details;
|
||||
control.removeAt(index);
|
||||
}
|
||||
|
||||
|
||||
// getNumberOfFamilyMemberDetails(inx) {
|
||||
// // alert(inx);
|
||||
// let formData = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls;
|
||||
// // alert(formData['total_number_of_family_members'].value);
|
||||
// // alert(this.familyForm.controls.total_number_of_family_members.valid);
|
||||
// if (formData['total_number_of_family_members'].valid) {
|
||||
// let totalMem = formData['total_number_of_family_members'].value;
|
||||
// const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
|
||||
// if (totalMem > control.length) {
|
||||
// let len = totalMem - control.length;
|
||||
// for (let i = 0; i < len; i++) {
|
||||
// control.push(this.generateFamilyMembersDetailsGet());
|
||||
// }
|
||||
// } else if (totalMem < control.length) {
|
||||
// // control.controls.slice(0, totalMem);
|
||||
// control.controls = [];
|
||||
// for (let i = 0; i < totalMem; i++) {
|
||||
// control.push(this.generateFamilyMembersDetailsGet());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
generateFamilyMembersDetailsGet(): FormGroup {
|
||||
return this.fb.group({
|
||||
|
||||
@ -56,11 +56,16 @@
|
||||
<mat-form-field style="width:45%">
|
||||
<mat-select placeholder="Income earned by"
|
||||
formControlName="income_earned_by">
|
||||
<mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of applicants">
|
||||
{{person.applicant_name}}
|
||||
<mat-option value="{{person}}" *ngFor="let person of incomeEarnedBy">
|
||||
{{person}}
|
||||
</mat-option>
|
||||
<mat-option value="others">Others</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:45%" *ngIf="details.get('income_earned_by').value == 'others'">
|
||||
<input matInput autocomplete="off" placeholder="Specify Income earned by"
|
||||
formControlName="others_income_earned_by">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width:45%">
|
||||
<input matInput autocomplete="off" placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i)">
|
||||
|
||||
@ -46,6 +46,8 @@ export class OtherIncomeComponent implements OnInit {
|
||||
sourceData : any = [];
|
||||
amtInwords : any = [];
|
||||
applicants : any = [];
|
||||
incomeEarnedBy : any = [];
|
||||
// stringArr = [];
|
||||
|
||||
constructor(notifier: NotifierService,
|
||||
private fb: FormBuilder,
|
||||
@ -59,7 +61,8 @@ export class OtherIncomeComponent implements OnInit {
|
||||
this.applicants = this.pd_all_details.pdapplicants_detials;
|
||||
this.form_id = 9;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
}
|
||||
|
||||
public viewerOptions: any = {
|
||||
navbar: false,
|
||||
toolbar: {
|
||||
@ -84,6 +87,14 @@ public viewerOptions: any = {
|
||||
this.getFrequency();
|
||||
this.getSourceOtherIncome();
|
||||
this.initOtherincomeForm();
|
||||
this._pd.getAllPersonsName(this.pdid).subscribe(data => {
|
||||
// console.log(data);
|
||||
|
||||
if(data.dataStatus == true){
|
||||
this.incomeEarnedBy = data.record;
|
||||
}
|
||||
// console.log(this.incomeEarnedBy);
|
||||
});
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = this.form_id;
|
||||
@ -136,6 +147,7 @@ public viewerOptions: any = {
|
||||
source: [''],
|
||||
others_source : [''],
|
||||
income_earned_by:[''],
|
||||
others_income_earned_by:[''],
|
||||
amount: [''],
|
||||
frequency: [''],
|
||||
others_frequency : ['']
|
||||
|
||||
@ -491,6 +491,34 @@ export class PdTrigerService {
|
||||
)
|
||||
}
|
||||
|
||||
/** To get Family Member Name For
|
||||
* 1) Family Form
|
||||
*/
|
||||
getFamilyDetails(pdid:any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl + "getFamilyDetails", { "pd_id" : pdid})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
|
||||
/** To get Family Member Name For
|
||||
* 1) other income form - (income earned field)
|
||||
*/
|
||||
getAllPersonsName(pdid:any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl + "getAllPersonsName", { "pd_id" : pdid})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
|
||||
/** To get Business Asset For
|
||||
* 1) Current Loan Form(where Business Asset loan Details is 'Yes' means name is displayed)
|
||||
*/
|
||||
getAssetsWithLoanFromBusiness(pdid:any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl + "getAssetsWithLoanFromBusiness",{ "pd_id" : pdid})
|
||||
.pipe(catchError(this.handleError('operation', [])))
|
||||
}
|
||||
|
||||
getEndUseForLoan(pdid: any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl + "getEndUseOfLoan",{ "records":{ "pd_id" : pdid}})
|
||||
.pipe(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user