changes:ps
This commit is contained in:
parent
51e3ed25c1
commit
cc226275b8
@ -231,7 +231,8 @@ export class EditPdMasterComponent implements OnInit {
|
||||
this.customerSegmentList=this.customerSegmentAllList;
|
||||
}
|
||||
else if(productID == '4'){
|
||||
this.customerSegmentList=this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
|
||||
let filtered = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self'));
|
||||
this.customerSegmentList = filtered;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
<span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}} </span><br>
|
||||
<span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} <span *ngIf="subproduct_abbr"> - {{subproduct_abbr}} </span> </span><br>
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
@ -96,8 +96,23 @@
|
||||
</mat-card>
|
||||
<!-- end -->
|
||||
|
||||
<!-- RI month and year start-->
|
||||
<mat-card *ngIf="customer_segment_abbr == 'SE-RI'">
|
||||
<mat-card-title>Number of Years for which rental income is being received</mat-card-title>
|
||||
<mat-form-field style="width: 20%;">
|
||||
<input matInput placeholder="Year" formControlName="rental_income_rcv_in_years"
|
||||
autocomplete="off" OnlyNumber type="text" required>
|
||||
<mat-error>Please Enter Correct Year</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 20%;">
|
||||
<input matInput type="text" placeholder="Month" formControlName="rental_income_rcv_in_month"
|
||||
autocomplete="off" OnlyNumber type="text" (change)="ConvertMonthintoYearforBusiness($event.target.value,'',2)">
|
||||
</mat-form-field>
|
||||
</mat-card>
|
||||
<!-- RI month and year ends-->
|
||||
|
||||
<!-- companies start -->
|
||||
<mat-card>
|
||||
<mat-card *ngIf="customer_segment_abbr != 'SE-RI'">
|
||||
<mat-card-header>
|
||||
<mat-card-title>Company/Firm</mat-card-title>
|
||||
</mat-card-header>
|
||||
@ -118,20 +133,19 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 45%;" *ngIf="com.controls.business_entity_type_other">
|
||||
<input matInput placeholder="Please Specify Others" formControlName="business_entity_type_other"
|
||||
required>
|
||||
<input matInput placeholder="Please Specify Others" formControlName="business_entity_type_other" required>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<p>Number of Years For Which The Business Has Been Running</p>
|
||||
<mat-form-field style="width: 20%;">
|
||||
<input matInput placeholder="Year" formControlName="business_years" required
|
||||
autocomplete="off" OnlyNumber type="text">
|
||||
<input matInput placeholder="Year" formControlName="business_years"
|
||||
autocomplete="off" OnlyNumber type="text" required>
|
||||
<mat-error>Please Enter Correct Year</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 20%;">
|
||||
<input matInput type="text" placeholder="Month" formControlName="business_month"
|
||||
autocomplete="off" OnlyNumber type="text" (change)="ConvertMonthintoYearforBusiness($event.target.value,c)">
|
||||
autocomplete="off" OnlyNumber type="text" (change)="ConvertMonthintoYearforBusiness($event.target.value,c,1)">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 40%;">
|
||||
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="business_date_object"
|
||||
@ -216,7 +230,7 @@
|
||||
<!-- Person Relationship Ends Here -->
|
||||
|
||||
<!-- company Relationship Start Here -->
|
||||
<mat-card>
|
||||
<mat-card *ngIf="customer_segment_abbr != 'SE-RI'">
|
||||
<mat-card-header>
|
||||
|
||||
<mat-card-title> Relationship of Individuals to Company / Firm </mat-card-title>
|
||||
|
||||
@ -125,6 +125,8 @@ export class GeneralInfoComponent implements OnInit {
|
||||
companies: this._fb.array([]),
|
||||
persons_with_relationships: this._fb.array([]),
|
||||
company_with_relationships: this._fb.array([]),
|
||||
rental_income_rcv_in_years: '',
|
||||
rental_income_rcv_in_month: '',
|
||||
general_remark: ''
|
||||
})
|
||||
this.loadFormData();
|
||||
@ -213,42 +215,53 @@ export class GeneralInfoComponent implements OnInit {
|
||||
return data.records.company_with_relationships[key];
|
||||
});
|
||||
|
||||
if(this.customer_segment_abbr != 'SE-RI'){
|
||||
|
||||
if (exist_companyWithRelationships.length > 0) {
|
||||
exist_companyWithRelationships.forEach(element => {
|
||||
//individualsControl.push(this.createIndividulas(element))
|
||||
companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(element));
|
||||
});
|
||||
}
|
||||
else if(exist_companyWithRelationships.length == 0) {
|
||||
companyWithRelationshipsControl.push(this.createCompaniesRelationship());
|
||||
}
|
||||
if (exist_companyWithRelationships.length > 0) {
|
||||
exist_companyWithRelationships.forEach(element => {
|
||||
//individualsControl.push(this.createIndividulas(element))
|
||||
companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(element));
|
||||
});
|
||||
}
|
||||
else if(exist_companyWithRelationships.length == 0) {
|
||||
companyWithRelationshipsControl.push(this.createCompaniesRelationship());
|
||||
}
|
||||
|
||||
// create companies
|
||||
exist_companies = Object.keys(data.records.companies).map(function (key) {
|
||||
return data.records.companies[key];
|
||||
});
|
||||
if (exist_companies.length > 0) {
|
||||
exist_companies.forEach((element, cindex) => {
|
||||
companyControl.push(this.createCompanies(element));
|
||||
let otherControl: any = this._generalForm.get('companies') as FormArray;
|
||||
otherControl = otherControl.controls[cindex];
|
||||
element.business_entity_type == '1' ? otherControl.addControl('business_entity_type_other', new FormControl(element.business_entity_type_other, Validators.required)) : otherControl.removeControl('business_entity_type_other');
|
||||
if (element.is_active == false) {
|
||||
let control: any = this._generalForm.get('companies') as FormArray;
|
||||
control.controls[cindex].controls.company_name.clearValidators();
|
||||
control.controls[cindex].controls.company_name.updateValueAndValidity();
|
||||
control.controls[cindex].controls.business_years.clearValidators();
|
||||
control.controls[cindex].controls.business_years.updateValueAndValidity();
|
||||
control.controls[cindex].controls.business_entity_type.clearValidators();
|
||||
control.controls[cindex].controls.business_entity_type.updateValueAndValidity();
|
||||
element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.clearValidators() : '';
|
||||
element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.updateValueAndValidity() : '';
|
||||
}
|
||||
// create companies
|
||||
exist_companies = Object.keys(data.records.companies).map(function (key) {
|
||||
return data.records.companies[key];
|
||||
});
|
||||
if (exist_companies.length > 0) {
|
||||
exist_companies.forEach((element, cindex) => {
|
||||
companyControl.push(this.createCompanies(element));
|
||||
let otherControl: any = this._generalForm.get('companies') as FormArray;
|
||||
otherControl = otherControl.controls[cindex];
|
||||
element.business_entity_type == '1' ? otherControl.addControl('business_entity_type_other', new FormControl(element.business_entity_type_other, Validators.required)) : otherControl.removeControl('business_entity_type_other');
|
||||
if (element.is_active == false) {
|
||||
let control: any = this._generalForm.get('companies') as FormArray;
|
||||
control.controls[cindex].controls.company_name.clearValidators();
|
||||
control.controls[cindex].controls.company_name.updateValueAndValidity();
|
||||
control.controls[cindex].controls.business_years.clearValidators();
|
||||
control.controls[cindex].controls.business_years.updateValueAndValidity();
|
||||
control.controls[cindex].controls.business_entity_type.clearValidators();
|
||||
control.controls[cindex].controls.business_entity_type.updateValueAndValidity();
|
||||
element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.clearValidators() : '';
|
||||
element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.updateValueAndValidity() : '';
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this._generalForm.controls['rental_income_rcv_in_years'].setValue(null);
|
||||
this._generalForm.controls['rental_income_rcv_in_month'].setValue(null);
|
||||
}
|
||||
else if(this.customer_segment_abbr == 'SE-RI'){
|
||||
// companyWithRelationshipsControl.push(this.createCompaniesRelationship());
|
||||
// companyControl.push(this.createCompanies(''));
|
||||
|
||||
this._generalForm.controls['rental_income_rcv_in_years'].setValue(data.records.rental_income_rcv_in_years ? data.records.rental_income_rcv_in_years : '');
|
||||
this._generalForm.controls['rental_income_rcv_in_month'].setValue(data.records.rental_income_rcv_in_month ? data.records.rental_income_rcv_in_month : '');
|
||||
}
|
||||
// create relations
|
||||
// exist_relation = Object.keys(data.records.applicant_relation).map(function(key) {
|
||||
// return data.records.applicant_relation[key];
|
||||
@ -589,6 +602,27 @@ export class GeneralInfoComponent implements OnInit {
|
||||
|
||||
// submit form details
|
||||
submitGeneralForm(formData: any) {
|
||||
|
||||
if(this.customer_segment_abbr != 'SE-RI'){
|
||||
this._generalForm.controls['rental_income_rcv_in_years'].clearValidators();
|
||||
this._generalForm.controls['rental_income_rcv_in_years'].updateValueAndValidity();
|
||||
}
|
||||
// 0th index of companies formArray only - required removed
|
||||
// greater than zero means not applicable here
|
||||
if(this.customer_segment_abbr == 'SE-RI'){
|
||||
let otherControl: any = this._generalForm.get('companies') as FormArray;
|
||||
otherControl = otherControl.controls[0];
|
||||
// otherControl.controls.business_entity_type_other.clearValidators();
|
||||
// otherControl.controls.business_entity_type_other.updateValueAndValidity();
|
||||
|
||||
otherControl.controls.business_years.clearValidators();
|
||||
otherControl.controls.business_years.updateValueAndValidity();
|
||||
|
||||
otherControl.controls.business_entity_type.clearValidators();
|
||||
otherControl.controls.business_entity_type.updateValueAndValidity();
|
||||
|
||||
}
|
||||
|
||||
if (this._generalForm.invalid) {
|
||||
this.disableAfterSubmit = false;
|
||||
this.validateAllFormFields(this._generalForm);
|
||||
@ -605,12 +639,26 @@ export class GeneralInfoComponent implements OnInit {
|
||||
saveRecords.pdid = formData.pdid;
|
||||
saveRecords.formid = formData.formid;
|
||||
saveRecords.individuals = formData.individuals;
|
||||
saveRecords.companies = formData.companies;
|
||||
saveRecords.persons_with_relationships = formData.persons_with_relationships;
|
||||
saveRecords.company_with_relationships = formData.company_with_relationships;
|
||||
//saveRecords.applicant_relation=formData.applicant_relation;
|
||||
if(this.customer_segment_abbr != 'SE-RI'){
|
||||
saveRecords.companies = formData.companies;
|
||||
saveRecords.company_with_relationships = formData.company_with_relationships;
|
||||
saveRecords.rental_income_rcv_in_years = null;
|
||||
saveRecords.rental_income_rcv_in_month = null;
|
||||
//saveRecords.applicant_relation=formData.applicant_relation;
|
||||
}
|
||||
else if(this.customer_segment_abbr == 'SE-RI'){
|
||||
saveRecords.companies = [];
|
||||
saveRecords.company_with_relationships = [];
|
||||
saveRecords.rental_income_rcv_in_years = formData.rental_income_rcv_in_years;
|
||||
saveRecords.rental_income_rcv_in_month = formData.rental_income_rcv_in_month;
|
||||
//saveRecords.applicant_relation=formData.applicant_relation;
|
||||
}
|
||||
|
||||
saveRecords.general_remark = formData.general_remark;
|
||||
|
||||
// console.log('saveRecords',saveRecords);
|
||||
// return;
|
||||
this._pd.savePDFormDetailsWithID(saveRecords).subscribe(
|
||||
dataresult => {
|
||||
if (dataresult.status == 200) {
|
||||
@ -635,16 +683,24 @@ export class GeneralInfoComponent implements OnInit {
|
||||
/**************************** submit form details Ends Here ***********************/
|
||||
|
||||
// convert month to year business has been running
|
||||
ConvertMonthintoYearforBusiness(e, controlIndex) {
|
||||
let control: any = this._generalForm.get('companies') as FormArray;
|
||||
control = control.controls[controlIndex];
|
||||
let business_year = control.controls.business_years.value;
|
||||
ConvertMonthintoYearforBusiness(e, controlIndex,flag) {
|
||||
|
||||
let converted_month: number = e % 12;
|
||||
let converted_year: number = e / 12;
|
||||
let converted_month: number = e % 12;
|
||||
let converted_year: number = e / 12;
|
||||
|
||||
control.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
|
||||
control.controls.business_month.setValue(Math.floor(converted_month));
|
||||
if(flag == 1){
|
||||
let control: any = this._generalForm.get('companies') as FormArray;
|
||||
control = control.controls[controlIndex];
|
||||
let business_year = control.controls.business_years.value;
|
||||
control.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
|
||||
control.controls.business_month.setValue(Math.floor(converted_month));
|
||||
}
|
||||
|
||||
if(flag == 2){
|
||||
let ri_year = this._generalForm.controls.rental_income_rcv_in_years.value;
|
||||
this._generalForm.controls['rental_income_rcv_in_years'].setValue(+ri_year + +Math.floor(converted_year));
|
||||
this._generalForm.controls['rental_income_rcv_in_month'].setValue(Math.floor(converted_month));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user