@@ -96,8 +96,23 @@
+
+
+ Number of Years for which rental income is being received
+
+
+ Please Enter Correct Year
+
+
+
+
+
+
+
-
+ Company/Firm
@@ -118,20 +133,19 @@
-
+
Number of Years For Which The Business Has Been Running
-
+
Please Enter Correct Year
+ autocomplete="off" OnlyNumber type="text" (change)="ConvertMonthintoYearforBusiness($event.target.value,c,1)">
-
+ Relationship of Individuals to Company / Firm
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts
index 3ed3dc937..f901f5362 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts
@@ -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));
+ }
}