changes:ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-08 14:53:12 +05:30
parent 51e3ed25c1
commit cc226275b8
3 changed files with 122 additions and 51 deletions

View File

@ -231,7 +231,8 @@ export class EditPdMasterComponent implements OnInit {
this.customerSegmentList=this.customerSegmentAllList; this.customerSegmentList=this.customerSegmentAllList;
} }
else if(productID == '4'){ 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;
} }
} }

View File

@ -2,7 +2,7 @@
<h2 mat-dialog-title class="paragraph_change"> <h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;"> <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}} {{pageTitle}}
</div> </div>
<div fxFlex="30" align="end" style="padding: 10px !important;"> <div fxFlex="30" align="end" style="padding: 10px !important;">
@ -96,8 +96,23 @@
</mat-card> </mat-card>
<!-- end --> <!-- 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 --> <!-- companies start -->
<mat-card> <mat-card *ngIf="customer_segment_abbr != 'SE-RI'">
<mat-card-header> <mat-card-header>
<mat-card-title>Company/Firm</mat-card-title> <mat-card-title>Company/Firm</mat-card-title>
</mat-card-header> </mat-card-header>
@ -118,20 +133,19 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 45%;" *ngIf="com.controls.business_entity_type_other"> <mat-form-field style="width: 45%;" *ngIf="com.controls.business_entity_type_other">
<input matInput placeholder="Please Specify Others" formControlName="business_entity_type_other" <input matInput placeholder="Please Specify Others" formControlName="business_entity_type_other" required>
required>
</mat-form-field> </mat-form-field>
<p>Number of Years For Which The Business Has Been Running</p> <p>Number of Years For Which The Business Has Been Running</p>
<mat-form-field style="width: 20%;"> <mat-form-field style="width: 20%;">
<input matInput placeholder="Year" formControlName="business_years" required <input matInput placeholder="Year" formControlName="business_years"
autocomplete="off" OnlyNumber type="text"> autocomplete="off" OnlyNumber type="text" required>
<mat-error>Please Enter Correct Year</mat-error> <mat-error>Please Enter Correct Year</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 20%;"> <mat-form-field style="width: 20%;">
<input matInput type="text" placeholder="Month" formControlName="business_month" <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>
<mat-form-field style="width: 40%;"> <mat-form-field style="width: 40%;">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="business_date_object" <input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="business_date_object"
@ -216,7 +230,7 @@
<!-- Person Relationship Ends Here --> <!-- Person Relationship Ends Here -->
<!-- company Relationship Start Here --> <!-- company Relationship Start Here -->
<mat-card> <mat-card *ngIf="customer_segment_abbr != 'SE-RI'">
<mat-card-header> <mat-card-header>
<mat-card-title> Relationship of Individuals to Company / Firm </mat-card-title> <mat-card-title> Relationship of Individuals to Company / Firm </mat-card-title>

View File

@ -125,6 +125,8 @@ export class GeneralInfoComponent implements OnInit {
companies: this._fb.array([]), companies: this._fb.array([]),
persons_with_relationships: this._fb.array([]), persons_with_relationships: this._fb.array([]),
company_with_relationships: this._fb.array([]), company_with_relationships: this._fb.array([]),
rental_income_rcv_in_years: '',
rental_income_rcv_in_month: '',
general_remark: '' general_remark: ''
}) })
this.loadFormData(); this.loadFormData();
@ -213,42 +215,53 @@ export class GeneralInfoComponent implements OnInit {
return data.records.company_with_relationships[key]; return data.records.company_with_relationships[key];
}); });
if(this.customer_segment_abbr != 'SE-RI'){
if (exist_companyWithRelationships.length > 0) { if (exist_companyWithRelationships.length > 0) {
exist_companyWithRelationships.forEach(element => { exist_companyWithRelationships.forEach(element => {
//individualsControl.push(this.createIndividulas(element)) //individualsControl.push(this.createIndividulas(element))
companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(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() : '';
}
});
}
this._generalForm.controls['rental_income_rcv_in_years'].setValue(null);
this._generalForm.controls['rental_income_rcv_in_month'].setValue(null);
} }
else if(exist_companyWithRelationships.length == 0) { else if(this.customer_segment_abbr == 'SE-RI'){
companyWithRelationshipsControl.push(this.createCompaniesRelationship()); // 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 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 relations // create relations
// exist_relation = Object.keys(data.records.applicant_relation).map(function(key) { // exist_relation = Object.keys(data.records.applicant_relation).map(function(key) {
// return data.records.applicant_relation[key]; // return data.records.applicant_relation[key];
@ -589,6 +602,27 @@ export class GeneralInfoComponent implements OnInit {
// submit form details // submit form details
submitGeneralForm(formData: any) { 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) { if (this._generalForm.invalid) {
this.disableAfterSubmit = false; this.disableAfterSubmit = false;
this.validateAllFormFields(this._generalForm); this.validateAllFormFields(this._generalForm);
@ -605,12 +639,26 @@ export class GeneralInfoComponent implements OnInit {
saveRecords.pdid = formData.pdid; saveRecords.pdid = formData.pdid;
saveRecords.formid = formData.formid; saveRecords.formid = formData.formid;
saveRecords.individuals = formData.individuals; saveRecords.individuals = formData.individuals;
saveRecords.companies = formData.companies;
saveRecords.persons_with_relationships = formData.persons_with_relationships; saveRecords.persons_with_relationships = formData.persons_with_relationships;
saveRecords.company_with_relationships = formData.company_with_relationships; if(this.customer_segment_abbr != 'SE-RI'){
//saveRecords.applicant_relation=formData.applicant_relation; 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; saveRecords.general_remark = formData.general_remark;
// console.log('saveRecords',saveRecords);
// return;
this._pd.savePDFormDetailsWithID(saveRecords).subscribe( this._pd.savePDFormDetailsWithID(saveRecords).subscribe(
dataresult => { dataresult => {
if (dataresult.status == 200) { if (dataresult.status == 200) {
@ -635,16 +683,24 @@ export class GeneralInfoComponent implements OnInit {
/**************************** submit form details Ends Here ***********************/ /**************************** submit form details Ends Here ***********************/
// convert month to year business has been running // convert month to year business has been running
ConvertMonthintoYearforBusiness(e, controlIndex) { ConvertMonthintoYearforBusiness(e, controlIndex,flag) {
let control: any = this._generalForm.get('companies') as FormArray;
control = control.controls[controlIndex];
let business_year = control.controls.business_years.value;
let converted_month: number = e % 12; let converted_month: number = e % 12;
let converted_year: number = e / 12; let converted_year: number = e / 12;
control.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); if(flag == 1){
control.controls.business_month.setValue(Math.floor(converted_month)); 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));
}
} }