diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
index 5d708ab4e..bef11401e 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
@@ -44,7 +44,7 @@
-
+
Enter Valid Mobile Number.
@@ -54,11 +54,11 @@
-->
-
+
Enter Valid STD Code Number.
-
-
+
Enter Valid LandLine Number.
@@ -207,17 +207,17 @@
-
+
Mobile No is Required .
Enter Valid Mobile Number.
-
+
Enter Valid STD Code Number.
-
-
+
Enter Valid LandLine Number.
@@ -251,16 +251,16 @@
-->
-
+
Enter Valid Mobile Number.
-
+
Enter Valid STD Code.
-
-
+
Enter Valid Landline Number.
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html
index 4dc179819..6934d3d07 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html
@@ -35,16 +35,16 @@
-
+
Enter Valid Mobile Number.
-
+
Enter Valid STD Code.
-
-
+
Enter Valid Landline Number.
@@ -71,7 +71,7 @@
-
+
Enter Valid Mobile Number.
@@ -80,12 +80,12 @@
Enter Valid Phone Number.
-->
-
+
Enter Valid STD Number.
-
-
+
Enter Valid Landline Number.
Enter
Valid STD Code.
-
+ type="text" maxlength="8" ForMobileNumbers>
Enter
Valid Landline Number.
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
index 4e711b7d8..768642715 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
@@ -782,7 +782,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
} else {
- return;
+
var answerFormValues = this._businessAssetsQuesFrom.value;
let dataOwner_name = [];
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
index 2e98a7d55..ec9bcade3 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
@@ -23,7 +23,8 @@ import {
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import { ActivatedRoute, Router } from "@angular/router";
import { DatePipe } from '@angular/common';
-
+/**sweet alert */
+import Swal from 'sweetalert2';
@Component({
selector: 'app-business-info',
templateUrl: './business-info.component.html',
@@ -1487,7 +1488,6 @@ export class BusinessInfoComponent implements OnInit {
// let shareHoldValidationFlag : number = 0;
-
if (records.partners.length > 0) {
let total = records.partners.map(shares => shares.shareholding).reduce((a, b) => a + +b, 0);
if (total > 100) {
@@ -1503,13 +1503,24 @@ export class BusinessInfoComponent implements OnInit {
if (records.manufacturing_activity_details.length > 0) {
records.manufacturing_activity_details.forEach((val, index) => {
+
+ let product = val.main_products;
+
if (val.area_of_sale != "Within India") {
+
let ManufacturingArray = Object.keys(val.countries_where_export_done).map(function (key) {
return val.countries_where_export_done[key];
});
+
let total = ManufacturingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+
if (total > 100 || total < 100) {
validationFlag++;
+ Swal({ title: 'Error...',
+ type: 'error',
+ text: "Approximate sales doesn't add upto 100% for " + product + " in Manufacturing "
+ });
+ return;
}
}
});
@@ -1521,13 +1532,19 @@ export class BusinessInfoComponent implements OnInit {
if (records.wholesale_trading_activity_details.length > 0) {
records.wholesale_trading_activity_details.forEach((val, index) => {
+ let product = val.main_products;
if (val.area_of_sale != "Within India") {
let WholesaleTradingArray = Object.keys(val.countries_where_export_done).map(function (key) {
return val.countries_where_export_done[key];
});
- let total = WholesaleTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+ let total = WholesaleTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
if (total > 100 || total < 100) {
validationFlag++;
+ Swal({ title: 'Error...',
+ type: 'error',
+ text: "Approximate sales doesn't add upto 100% for " + product + " in Wholesale Trade"
+ });
+ return;
}
}
});
@@ -1538,13 +1555,20 @@ export class BusinessInfoComponent implements OnInit {
if (records.retail_trading_activity_details.length > 0) {
records.retail_trading_activity_details.forEach((val, index) => {
+ let product = val.main_products;
if (val.area_of_sale != "Within India") {
let RetailTradingArray = Object.keys(val.countries_where_export_done).map(function (key) {
return val.countries_where_export_done[key];
});
let total = RetailTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+
if (total > 100 || total < 100) {
validationFlag++;
+ Swal({ title: 'Error...',
+ type: 'error',
+ text: "Approximate sales doesn't add upto 100% for " + product + " in Retail Trading "
+ });
+ return;
}
}
});
@@ -1556,14 +1580,21 @@ export class BusinessInfoComponent implements OnInit {
if (records.service_provider_activity_details.length > 0) {
records.service_provider_activity_details.forEach((val, index) => {
+ let product = val.main_products;
if (val.area_of_sale != "Within India") {
let ServiceProviderArray = Object.keys(val.countries_where_export_done).map(function (key) {
return val.countries_where_export_done[key];
});
let total = ServiceProviderArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+
if (total > 100 || total < 100) {
validationFlag++;
+ Swal({ title: 'Error...',
+ type: 'error',
+ text: "Approximate sales doesn't add upto 100% for " + product + " in Service Provider "
+ });
+ return;
}
}
});
@@ -1572,11 +1603,13 @@ export class BusinessInfoComponent implements OnInit {
//validationFlag is greater then 0 means its display the notifer as warning
if (validationFlag > 0) {
- this.notifier.notify('warning', "Approximate sales doesn't add upto 100%");
+ // this.notifier.notify('warning', "Approximate sales doesn't add upto 100%");
+ console.log('validationFlag',validationFlag);
return;
}
-
+
records.select_business_activity_type = records.select_business_activity_type.filter(value => value.exist_status == 1);
+
this._pd.saveForm(records).subscribe(data => {
this.notifier.notify('success', 'Saved Successfully.');
setTimeout(() => {
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts
index e7fe89693..c08b81f43 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts
@@ -359,9 +359,11 @@ export class CurrentLoanComponent implements OnInit {
});
// this.currentLoanForm.controls['existing_loan'].setValue(arr);
}
+ else{
+ this.currentLoanForm.controls['existing_loan'].setValue('No');
+ }
}
else {
-
control.push(this.createLoanDetail(null));
}
@@ -410,6 +412,22 @@ export class CurrentLoanComponent implements OnInit {
if (e == 'Yes') {
const control = this.currentLoanForm.controls['loan_details'];
+ // let objs = {
+ // 'label': null,
+ // 'loan_amount': null,
+ // 'frequency': null,
+ // 'other_frequency': null,
+ // 'emi': null,
+ // 'loan_type': null,
+ // 'others_loan_type': null,
+ // 'loan_taken_by': null,
+ // 'others_loan_taken': null,
+ // 'lender': null,
+ // 'others_lender': null,
+ // 'original_tenure': null,
+ // 'current_balance_tenure': null,
+ // 'elapsed_tenure': null
+ // }
control.push(this.createLoanDetail(null));
} else if (e == 'No') {
@@ -444,19 +462,19 @@ export class CurrentLoanComponent implements OnInit {
createLoanDetail(data) {
return this.fb.group({
label: data == null ? [''] : [data.label],
- loan_amount: null ? [''] : [data.loan_amount],
- frequency: null ? [''] : [data.frequency],
- other_frequency: null ? [''] : [data.other_frequency],
- emi: null ? [''] : [data.emi],
- loan_type: null ? [''] : [data.loan_type],
- others_loan_type: null ? [''] : [data.others_loan_type],
- loan_taken_by: null ? [''] : [data.loan_taken_by],
- others_loan_taken: null ? [''] : [data.others_loan_taken],
- lender: null ? [''] : [data.lender],
- others_lender: null ? [''] : [data.others_lender],
- original_tenure: null ? [''] : [data.original_tenure],
- current_balance_tenure: null ? [''] : [data.current_balance_tenure],
- elapsed_tenure: null ? [''] : [data.elapsed_tenure]
+ loan_amount: data == null ? [''] : [data.loan_amount],
+ frequency: data == null ? [''] : [data.frequency],
+ other_frequency: data == null ? [''] : [data.other_frequency],
+ emi: data == null ? [''] : [data.emi],
+ loan_type: data == null ? [''] : [data.loan_type],
+ others_loan_type: data == null ? [''] : [data.others_loan_type],
+ loan_taken_by: data == null ? [''] : [data.loan_taken_by],
+ others_loan_taken: data == null ? [''] : [data.others_loan_taken],
+ lender: data == null ? [''] : [data.lender],
+ others_lender: data == null ? [''] : [data.others_lender],
+ original_tenure: data == null ? [''] : [data.original_tenure],
+ current_balance_tenure: data == null ? [''] : [data.current_balance_tenure],
+ elapsed_tenure: data == null ? [''] : [data.elapsed_tenure]
});
}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts
index 399840dfa..69ef3c7ab 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts
@@ -85,7 +85,7 @@ export class LoanDetailsComponent implements OnInit {
private _pd: PdTrigerService,
private dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
-console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapplicants_detials);
+// console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapplicants_detials);
this.applicants = this.pd_all_details.pdapplicants_detials;
// this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
this.applicants = this.applicants.filter(appt => appt.applicant_type != 2)
@@ -496,7 +496,7 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
/** Source Changes with Validation */
sourceChange(evt) {
-
+// console.log('sourceChange');
this.isOtherSource = evt.some(e => e == 1) // this return true or false Only;
if (this.isOtherSource) {
@@ -531,7 +531,7 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
/**For Setting Validations */
selectedBalancesTransferChanges(event: any) {
-
+// console.log('selectedBalancesTransferChanges',event);
if (event.value == 'no') {
this.loanDetailsForm.controls['source'].setValidators([Validators.required]);
this.loanDetailsForm.controls['source'].updateValueAndValidity();
@@ -548,6 +548,9 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
}
else if (event.value == 'yes') {
+
+ // console.log(event.value,'yes');
+
this.loanDetailsForm.controls['source'].setValue('');
this.loanDetailsForm.controls['source'].clearValidators();
this.loanDetailsForm.controls['source'].updateValueAndValidity();
@@ -612,8 +615,8 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
mortage_type(mortage_value)
{
- console.log('mortage_value',mortage_value);
- console.log('this.m_mortageTypeProperty',this.m_mortageTypeProperty);
+ // console.log('mortage_value',mortage_value);
+ // console.log('this.m_mortageTypeProperty',this.m_mortageTypeProperty);
let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0];
let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase();
if(property_name=='others')
@@ -654,34 +657,82 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
}
/** Validation */
- validateAllFormFields(formGroup: FormGroup) {
+ validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
+ } else if (control instanceof FormArray) {
+ this.validateAllFormFields(control);
}
});
}
/** To save Loan FOrm Details */
submitLoanDetails() {
+ // console.log('submitLoanDetails');
+ if(this.isOtherSource == false){
+ this.loanDetailsForm.controls['other_source'].setValue('');
+ this.loanDetailsForm.controls['other_source'].clearValidators();
+ this.loanDetailsForm.controls['other_source'].updateValueAndValidity();
+ }
+ else{
+ this.loanDetailsForm.controls['other_source'].setValidators([Validators.required]);
+ this.loanDetailsForm.controls['other_source'].updateValueAndValidity();
+ }
- if ((this.isContribution == true)) {
+ if(this.isContribution == true) {
+ // console.log('if this.isContribution',this.isContribution);
if (this.loanDetailsForm.controls['is_transfer'].value != 'yes') {
this.loanDetailsForm.controls['own_contribution'].setValue('');
this.loanDetailsForm.controls['own_contribution'].clearValidators();
this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
- this.loanDetailsForm.controls['other_source'].setValue('');
- this.loanDetailsForm.controls['other_source'].clearValidators();
- this.loanDetailsForm.controls['other_source'].updateValueAndValidity();
this.loanDetailsForm.controls['source'].setValue('');
this.loanDetailsForm.controls['source'].clearValidators();
this.loanDetailsForm.controls['source'].updateValueAndValidity();
}
else if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
+ if (this.loanDetailsForm.controls['end_use_topup'].value == 1) {
+ this.loanDetailsForm.controls['other_end_use_topup'].setValidators([Validators.required]);
+ this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity();
+ }
+ else {
+ this.loanDetailsForm.controls['other_end_use_topup'].setValue('');
+ this.loanDetailsForm.controls['other_end_use_topup'].clearValidators();
+ this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity();
+ }
+ if (this.loanDetailsForm.controls['lender'].value == 1) {
+ this.loanDetailsForm.controls['other_bt_lender'].setValidators([Validators.required]);
+ this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity();
+ }
+ else {
+ this.loanDetailsForm.controls['other_bt_lender'].setValue('');
+ this.loanDetailsForm.controls['other_bt_lender'].clearValidators();
+ this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity();
+ }
+ }
+ }
+ else if(this.isContribution == false) {
+
+ if (this.loanDetailsForm.controls['is_transfer'].value != 'yes') {
+
+ this.loanDetailsForm.controls['own_contribution'].setValidators([Validators.required]);
+ this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
+
+ this.loanDetailsForm.controls['source'].setValidators([Validators.required]);
+ this.loanDetailsForm.controls['source'].updateValueAndValidity();
+ }
+ else if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
+ this.loanDetailsForm.controls['own_contribution'].setValue('');
+ this.loanDetailsForm.controls['own_contribution'].clearValidators();
+ this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
+ this.loanDetailsForm.controls['source'].setValue('');
+ this.loanDetailsForm.controls['source'].clearValidators();
+ this.loanDetailsForm.controls['source'].updateValueAndValidity();
+
if (this.loanDetailsForm.controls['end_use_topup'].value == 1) {
this.loanDetailsForm.controls['other_end_use_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity();
@@ -705,6 +756,7 @@ console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapp
}
if (!this.loanDetailsForm.valid) {
+ this.validateAllFormFields(this.loanDetailsForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return;
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts
index 98781b424..99452a226 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts
@@ -108,9 +108,11 @@ export class RentalVerificationComponent implements OnInit {
let tempArray: any = [];
let amt: any = [];
this.existing_rental_count_id = rentalVal.length;
-
+ //RIV = Rental Income Verification
rentalVal.forEach((RIV, inx) => {
- let annualRentAmt: any;
+ console.log('RIV.rental_count_id',RIV.rental_count_id);
+ console.log('RIV',RIV,inx);
+ let annualRentAmt: any = 0;
// get property unit details
if (RIV.property_unit_details) {
let selectedUnitDetails = Object.keys(RIV.property_unit_details).map(function (key) {
@@ -127,6 +129,7 @@ export class RentalVerificationComponent implements OnInit {
annualRentAmt = 0;
}
amt[inx] = annualRentAmt;
+ tempArray = [];
}
this._pd.getStateCityNamesAndPincode({ "state_id": RIV.state, "city_id": RIV.city, "pincode_id": RIV.pincode }).subscribe(data => {
if (data.dataStatus) {
diff --git a/ng6-seed/src/app/shared/for-mobile-numbers/for-mobile-numbers.directive.ts b/ng6-seed/src/app/shared/for-mobile-numbers/for-mobile-numbers.directive.ts
new file mode 100644
index 000000000..d84a97445
--- /dev/null
+++ b/ng6-seed/src/app/shared/for-mobile-numbers/for-mobile-numbers.directive.ts
@@ -0,0 +1,19 @@
+import { Directive, ElementRef, HostListener, Input } from '@angular/core';
+// import { NgControl } from '@angular/forms';
+
+@Directive({
+ selector: '[ForMobileNumbers]'
+})
+export class ForMobileNumbersDirective {
+
+ constructor(private _el: ElementRef) { }
+
+ @HostListener('input', ['$event']) onInputChange(event) {
+ const initalValue = this._el.nativeElement.value;
+ this._el.nativeElement.value = initalValue.replace(/[^0-9]*/g, '');
+ if ( initalValue !== this._el.nativeElement.value) {
+ event.stopPropagation();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ng6-seed/src/app/shared/shared.module.ts b/ng6-seed/src/app/shared/shared.module.ts
index 7ec2767bd..cfb4c28cf 100755
--- a/ng6-seed/src/app/shared/shared.module.ts
+++ b/ng6-seed/src/app/shared/shared.module.ts
@@ -6,6 +6,7 @@ import { AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective }
import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.directive';
import { RatingComponent} from './rating/rating.component';
import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive';
+import { ForMobileNumbersDirective } from './for-mobile-numbers/for-mobile-numbers.directive';
@NgModule({
declarations: [
@@ -14,7 +15,8 @@ import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive';
AccordionDirective,
ToggleFullscreenDirective,
RatingComponent,
- NumbersOnlyDirective
+ NumbersOnlyDirective,
+ ForMobileNumbersDirective
],
exports: [
AccordionAnchorDirective,
@@ -22,7 +24,8 @@ import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive';
AccordionDirective,
ToggleFullscreenDirective,
RatingComponent,
- NumbersOnlyDirective
+ NumbersOnlyDirective,
+ ForMobileNumbersDirective
],
providers: [ MenuItems, HorizontalMenuItems ]
})