other family and other income : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-24 16:48:19 +05:30
parent e6ed8918f5
commit f198627a9b
6 changed files with 199 additions and 57 deletions

View File

@ -87,6 +87,11 @@ 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.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
console.log(data);
});
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){ if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true); this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true);

View File

@ -281,12 +281,12 @@
<div> <div>
<mat-form-field> <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"> <mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of selectPerson">
{{person.applicant_name}} {{person.applicant_name}}
</mat-option> </mat-option>
</mat-select> --> </mat-select>
<input matInput placeholder="person" formControlName="selected_person" required> <!-- <input matInput placeholder="person" formControlName="selected_person" required> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
@ -346,16 +346,16 @@
<input matInput placeholder="Rent Amount" formControlName="rent"> <input matInput placeholder="Rent Amount" formControlName="rent">
</mat-form-field> </mat-form-field>
</div> </div>
<div> <!-- <div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Number of Family Members" formControlName="total_number_of_family_members" (focusout)="getNumberOfFamilyMemberDetails(ix)" <input matInput placeholder="Number of Family Members" formControlName="total_number_of_family_members" (focusout)="getNumberOfFamilyMemberDetails(ix)"
type="number" max='20' min='1'> type="number" max='20' min='1'>
</mat-form-field> </mat-form-field>
</div> </div> -->
<div> <div>
<div formArrayName="family_members_details"> <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> <mat-card>
<div> <div>
<mat-form-field> <mat-form-field>
@ -419,6 +419,20 @@
<input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" required> <input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" required>
</mat-form-field> </mat-form-field>
</div> </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> </mat-card>
</div> </div>
</div> </div>

View File

@ -303,6 +303,7 @@ export class FamilyDetailsComponent implements OnInit {
private notifier: NotifierService; private notifier: NotifierService;
public familyForm: FormGroup; public familyForm: FormGroup;
public selectPerson; public selectPerson;
public apiFamilyMembers : any = [];
// selectPerson = [{ // selectPerson = [{
// name : 'person 1', // name : 'person 1',
// id : 111 // id : 111
@ -353,10 +354,60 @@ export class FamilyDetailsComponent implements OnInit {
this.getMasterDetails('STATE', 6); this.getMasterDetails('STATE', 6);
// this.getMasterDetails('CITY', 7); // this.getMasterDetails('CITY', 7);
// this.getMasterDetails('PINCODE', 8); // 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(); this.initFamilyFormDetails();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '6'; params.pd_form_id = '6';
// - { "pd_id":"104"}
this._pd.retriveForm(params).subscribe(data => { this._pd.retriveForm(params).subscribe(data => {
const control = <FormArray>this.familyForm.controls['nonEarningMembers']; const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
const value = <FormArray>this.familyForm.controls['earningMembers']; 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.familyForm.controls.family_details_form_remark.setValue(data.records.family_details_form_remark);
// this.generateFamilyMembersDetailsGetData(data.records.family_members_details); // this.generateFamilyMembersDetailsGetData(data.records.family_members_details);
} else { } else {
this.initFamilyForm(null);
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);
} }
}); });
} }
@ -525,7 +554,7 @@ export class FamilyDetailsComponent implements OnInit {
residence_ownership: ['', Validators.compose([])], residence_ownership: ['', Validators.compose([])],
ownershipOther: [''], ownershipOther: [''],
rent: [''], 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([]), family_members_details: this.fb.array([]),
}); });
const control = <FormArray>this.familyForm.controls['family_details']; const control = <FormArray>this.familyForm.controls['family_details'];
@ -544,7 +573,7 @@ export class FamilyDetailsComponent implements OnInit {
residence_ownership: [val.residence_ownership, Validators.compose([])], residence_ownership: [val.residence_ownership, Validators.compose([])],
ownershipOther: [val.ownershipOther || null], ownershipOther: [val.ownershipOther || null],
rent: [val.rent || 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([]), family_members_details: this.fb.array([]),
}); });
const control = <FormArray>this.familyForm.controls['family_details']; const control = <FormArray>this.familyForm.controls['family_details'];
@ -587,31 +616,80 @@ export class FamilyDetailsComponent implements OnInit {
e.stopPropagation(); e.stopPropagation();
this.initFamilyForm('chck'); this.initFamilyForm('chck');
} }
selectedPerson(e,inx){
// console.log(e);
// console.log(this.apiFamilyMembers);
// return;
getNumberOfFamilyMemberDetails(inx) { const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
// alert(inx);
let formData = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls; if(this.apiFamilyMembers.length>0){
// alert(formData['total_number_of_family_members'].value); let arraydata : any;
// alert(this.familyForm.controls.total_number_of_family_members.valid); let data = this.apiFamilyMembers.filter(item => item.relation_to == e);
if (formData['total_number_of_family_members'].valid) { if(data.length > 0){
let totalMem = formData['total_number_of_family_members'].value; data.forEach(val => {
const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; arraydata = {
if (totalMem > control.length) { 'family_member_name' : val.name,
let len = totalMem - control.length; 'family_member_relationship' : val.relationship,
for (let i = 0; i < len; i++) { 'family_member_age' : '',
control.push(this.generateFamilyMembersDetailsGet()); 'family_member_earning_status': '',
} 'earning_segment': '',
} else if (totalMem < control.length) { 'earning_gross_income_per_month': '',
// control.controls.slice(0, totalMem); 'earning_name_of_the_employer_or_business': '',
control.controls = []; 'earning_number_of_years_in_employment_or_business': '',
for (let i = 0; i < totalMem; i++) { 'non_earning_occupation': '',
control.push(this.generateFamilyMembersDetailsGet()); '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 { generateFamilyMembersDetailsGet(): FormGroup {
return this.fb.group({ return this.fb.group({

View File

@ -56,11 +56,16 @@
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-select placeholder="Income earned by" <mat-select placeholder="Income earned by"
formControlName="income_earned_by"> formControlName="income_earned_by">
<mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of applicants"> <mat-option value="{{person}}" *ngFor="let person of incomeEarnedBy">
{{person.applicant_name}} {{person}}
</mat-option> </mat-option>
<mat-option value="others">Others</mat-option>
</mat-select> </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%"> <mat-form-field style="width:45%">
<input matInput autocomplete="off" placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i)"> <input matInput autocomplete="off" placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i)">

View File

@ -46,6 +46,8 @@ export class OtherIncomeComponent implements OnInit {
sourceData : any = []; sourceData : any = [];
amtInwords : any = []; amtInwords : any = [];
applicants : any = []; applicants : any = [];
incomeEarnedBy : any = [];
// stringArr = [];
constructor(notifier: NotifierService, constructor(notifier: NotifierService,
private fb: FormBuilder, private fb: FormBuilder,
@ -59,7 +61,8 @@ export class OtherIncomeComponent implements OnInit {
this.applicants = this.pd_all_details.pdapplicants_detials; this.applicants = this.pd_all_details.pdapplicants_detials;
this.form_id = 9; this.form_id = 9;
this.notifier = notifier; this.notifier = notifier;
} }
public viewerOptions: any = { public viewerOptions: any = {
navbar: false, navbar: false,
toolbar: { toolbar: {
@ -84,6 +87,14 @@ public viewerOptions: any = {
this.getFrequency(); this.getFrequency();
this.getSourceOtherIncome(); this.getSourceOtherIncome();
this.initOtherincomeForm(); 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 = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = this.form_id; params.pd_form_id = this.form_id;
@ -136,6 +147,7 @@ public viewerOptions: any = {
source: [''], source: [''],
others_source : [''], others_source : [''],
income_earned_by:[''], income_earned_by:[''],
others_income_earned_by:[''],
amount: [''], amount: [''],
frequency: [''], frequency: [''],
others_frequency : [''] others_frequency : ['']

View File

@ -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> { getEndUseForLoan(pdid: any): Observable<any> {
return this._http.post<any>(this.apiUrl + "getEndUseOfLoan",{ "records":{ "pd_id" : pdid}}) return this._http.post<any>(this.apiUrl + "getEndUseOfLoan",{ "records":{ "pd_id" : pdid}})
.pipe( .pipe(