Other Validation : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-04-16 20:12:48 +05:30
parent 312cc2379e
commit 77376c5822
22 changed files with 462 additions and 190 deletions

View File

@ -48,7 +48,7 @@
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<mat-select placeholder="Property Type" formControlName="property_type"
(selectionChange)="setRequiredValidation($event.value,i,s,1)">
(selectionChange)="setRequired($event.value,i,s,1)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{
prop.name }}</mat-option>
@ -57,6 +57,7 @@
<mat-form-field *ngIf="detail.get('property_type').value == 1" style="width:45%">
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_property_type'].hasError('required')">Property Type Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -76,7 +77,7 @@
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select placeholder="Unit of Measurement" formControlName="uom_of_the_property"
(selectionChange)="setRequiredValidation($event.value,detail,6)">
(selectionChange)="setRequired($event.value,i,s,6)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let uom of m_uom_type" [value]="uom.uom_id">{{ uom.name
}}</mat-option>
@ -85,6 +86,7 @@
<mat-form-field *ngIf="detail.get('uom_of_the_property').value == 1" style="width:45%">
<input matInput placeholder="Specify Unit of Measurement" formControlName="other_uom"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_uom'].hasError('required')">Unit of Measurement Required</mat-error>
</mat-form-field>
</div>
</div>
@ -97,7 +99,9 @@
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<mat-select placeholder="Type of Vehicle" formControlName="vehicle_type"
(selectionChange)="setRequiredValidation($event.value,detail,5)">
(selectionChange)="setRequired($event.value,i,s,5)">
<!-- (selectionChange)="setRequiredValidation($event.value,detail,5)" -->
<mat-option>Select</mat-option>
<mat-option *ngFor="let vehicle of m_vehicle_type" [value]="vehicle.vehicle_type_id">{{
vehicle.vehicle_type_name }}</mat-option>
@ -106,6 +110,7 @@
<mat-form-field style="width:45%" *ngIf="detail.get('vehicle_type').value == 1">
<input matInput placeholder=" Specify Vehicle" formControlName="other_vehicle_type"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_vehicle_type'].hasError('required')"> Vehicle Required</mat-error>
</mat-form-field>
<!-- <mat-form-field style="width:40%"> -->
<!--<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" autocomplete="off">
@ -178,7 +183,7 @@
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select placeholder="Frequency" formControlName="frequency_mode"
(selectionChange)="setRequiredValidation($event.value,detail,2)">
(selectionChange)="setRequired($event.value,i,s,2)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{
freqn.name }}</mat-option>
@ -187,6 +192,7 @@
<mat-form-field style="width:45%" *ngIf="detail.get('frequency_mode').value == 1 ">
<input matInput placeholder="Specify Frequency" formControlName="other_frequency_mode"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_frequency_mode'].hasError('required')">Frequency Required</mat-error>
</mat-form-field>
</div>
@ -215,7 +221,7 @@
<mat-form-field style="width:45%">
<mat-select placeholder="Type" formControlName="investments_type"
(selectionChange)="setRequiredValidation($event.value,detail,3)">
(selectionChange)="setRequired($event.value,i,s,3)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{
ins_type.name }}</mat-option>
@ -225,6 +231,7 @@
<mat-form-field style="width:45%" *ngIf="detail.get('investments_type').value == 1">
<input matInput placeholder="Specify Type" formControlName="other_investments_type"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_investments_type'].hasError('required')">Type Required</mat-error>
</mat-form-field>
<mat-form-field style="width:54%" *ngIf="detail.get('investments_type').value == 6 || detail.get('investments_type').value == 5 || detail.get('investments_type').value == 4">
@ -314,7 +321,7 @@
</mat-optgroup>
</mat-select> -->
<mat-select multiple placeholder="Name of the Owner" formControlName="name_of_the_owner"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,i,'',4)">
[compareWith]="compareObjects" (selectionChange)="setOtherOwner($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -326,6 +333,7 @@
<mat-form-field *ngIf="isOtherOwner[i]" style="width:45%">
<input matInput placeholder="Specify Owner Name" formControlName="other_owner"
autocomplete="off">
<mat-error *ngIf="sup.controls['other_owner'].hasError('required')">Owner Name Required</mat-error>
</mat-form-field>
<!-- check -->
<!-- <mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:40%">

View File

@ -9,6 +9,7 @@ import {
import {
FormBuilder,
FormGroup,
FormControl,
Validators,
FormArray,
} from '@angular/forms';
@ -620,7 +621,7 @@ export class AssetsInfoComponent implements OnInit {
// }
// this.isOtherOwner[index] = Avaliablity == 0 ? true : false;
this.setRequiredValidation(datas.name_of_the_owner, index, '', 4);
this.setOtherOwner(datas.name_of_the_owner, index);
});
}
this.loadDetails = true;
@ -801,11 +802,12 @@ export class AssetsInfoComponent implements OnInit {
this.submitted = true;
// stop here if form is invalid
if (this._assetsQuesFrom.invalid) {
if (!this._assetsQuesFrom.valid) {
this.validateAllFormFields(this._assetsQuesFrom);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return;
} else {
} else {
this.disableAfterSubmit = true;
var answerFormValues = this._assetsQuesFrom.value;
@ -862,56 +864,85 @@ export class AssetsInfoComponent implements OnInit {
// }
}
setRequiredValidation(value, ParInx, ChdInx, flag) {
setRequired(value, ParInx, ChdInx, flag) {
let ParCtrls = <FormArray>this._assetsQuesFrom.controls.assets_details;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
let a: any = <FormArray>ChdCtrls.controls.details;
let b: any = <FormArray>a.controls[ChdInx];
if (flag == 1) {
if(value == 1){
b.controls.other_property_type.setValidators([Validators.required]);}
else{
b.controls.other_property_type.clearValidators();
b.controls.other_property_type.setValue('');
}
b.controls.other_property_type.updateValueAndValidity();
}
if(flag == 2){
if(value==1){
b.controls.other_frequency_mode.setValidators([Validators.required]);}
else { b.controls.other_frequency_mode.clearValidators(); b.controls.other_frequency_mode.clearValidators(); }
b.controls.other_frequency_mode.updateValueAndValidity();
}
if(flag == 3){
if(value==1){
b.controls.other_investments_type.setValidators([Validators.required]);
}else{
b.controls.other_investments_type.clearValidators();
b.controls.other_investments_type.setValue('');}
b.controls.other_investments_type.updateValueAndValidity();
}
if(flag == 5){
if(value==1){
b.controls.other_vehicle_type.setValidators([Validators.required]);}
else{ b.controls.other_vehicle_type.clearValidators(); b.controls.other_vehicle_type.setValue(''); }
b.controls.other_vehicle_type.updateValueAndValidity();
}
if(flag == 6){
if(value==1){
b.controls.other_uom.setValidators([Validators.required]);
}else{
b.controls.other_uom.clearValidators();
b.controls.other_uom.setValue('');
}
b.controls.other_uom.updateValueAndValidity();
}
}
setOtherOwner(value, ParInx) {
let ParCtrls = <FormArray>this._assetsQuesFrom.controls.assets_details;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
if (flag == 1) {
value == 1
// ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required])
// : item.controls.other_property_type.clearValidators();
// item.controls.other_property_type.updateValueAndValidity();
}
// if(flag == 2){
// value==1
// ? item.controls.other_frequency_mode.setValidators([Validators.required])
// : item.controls.other_frequency_mode.clearValidators();
// item.controls.other_frequency_mode.updateValueAndValidity();
// }
// if(flag == 3){
// value==1
// ? item.controls.other_investments_type.setValidators([Validators.required])
// : item.controls.other_investments_type.clearValidators();
// item.controls.other_investments_type.updateValueAndValidity();
// }
// if(flag == 4){
// value==0
// ? item.controls.other_owner.setValidators([Validators.required])
// : item.controls.other_owner.clearValidators();
// item.controls.other_owner.updateValueAndValidity();
// }
if (flag == 4) {
let Avaliablity = 1;
if (value.length > 0) {
value.forEach(option => {
if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id;
}
});
}
if (Avaliablity == 0) {
ChdCtrls.controls.other_owner.setValidators([Validators.required]);
this.isOtherOwner[ParInx] = true;
console.log(ChdCtrls.controls.other_owner);
} else if (Avaliablity == 1) {
ChdCtrls.controls.other_owner.setValue('');
ChdCtrls.controls.other_owner.clearValidators();
this.isOtherOwner[ParInx] = false;
@ -920,22 +951,23 @@ export class AssetsInfoComponent implements OnInit {
ChdCtrls.controls.other_owner.updateValueAndValidity();
}
// if(flag == 5){
// value==1
// ? item.controls.other_vehicle_type.setValidators([Validators.required])
// : item.controls.other_vehicle_type.clearValidators();
// item.controls.other_vehicle_type.updateValueAndValidity();
// }
// if(flag == 6){
// value==1
// ? item.controls.other_uom.setValidators([Validators.required])
// : item.controls.other_uom.clearValidators();
// item.controls.other_uom.updateValueAndValidity();
// }
}
/** To validate All Form Fields */
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);
}
});
}
}

View File

@ -99,7 +99,7 @@
</mat-expansion-panel-header>
<mat-form-field>
<mat-select placeholder="Account Name" formControlName="applicant_name"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.values.id,itemrow,1)">
[compareWith]="compareObjects">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -111,11 +111,11 @@
style="width:45%">
<input matInput placeholder="Specify Applicant Name" formControlName="other_applicant"
autocomplete="off">
<mat-error *ngIf="itemrow.controls['other_applicant'].hasError('required')">Applicant Name Required</mat-error>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name"
(selectionChange)="setRequiredValidation($event.value,itemrow,2)">
<mat-select placeholder="Bank Name" formControlName="bank_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{
btLen.lender_name }}</mat-option>
@ -124,6 +124,7 @@
<mat-form-field *ngIf="itemrow.get('bank_name').value == 1">
<input matInput placeholder="Specify Bank Name" formControlName="other_bank"
autocomplete="off">
<mat-error *ngIf="itemrow.controls['other_bank'].hasError('required')">Bank Name Required</mat-error>
</mat-form-field>

View File

@ -152,7 +152,6 @@ export class BankingDetailsComponent implements OnInit {
result.forEach((datas, index) => {
// this.selectedBorrower(datas.applicant_name,index);
this.selectedAccTypeChanges(+datas.account_type, index)
// this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createBankarray());
});
@ -229,28 +228,57 @@ export class BankingDetailsComponent implements OnInit {
const control = <FormArray>this.bankingForm.controls['itemRows'];
control.removeAt(index);
}
setRequiredValidation(value, item, flag) {
if (flag == 1) {
value == 0
? item.controls.other_applicant.setValidators([Validators.required])
: item.controls.other_applicant.clearValidators();
item.controls.other_applicant.updateValueAndValidity();
}
if (flag == 2) {
value == 1
? item.controls.other_bank.setValidators([Validators.required])
: item.controls.other_bank.clearValidators();
item.controls.other_bank.updateValueAndValidity();
}
}
setStep(index: number) {
this.step = index;
}
bankSubmit() {
const control = <FormArray>this.bankingForm.controls.itemRows;
let CtrlLength = control.controls.length;
if (CtrlLength > 0) {
let cnt = 0;
while(cnt < CtrlLength){
let ChildCtrl : any = control.controls[cnt];
let Avaliablity = ChildCtrl.controls.applicant_name.value != ''
? ChildCtrl.controls.applicant_name.value.id == 0 && ChildCtrl.controls.applicant_name.value.group_id == 2
? ChildCtrl.controls.applicant_name.value.id : 1
: 1 ;
if (Avaliablity == 0) {
ChildCtrl.controls.other_applicant.setValidators([Validators.required]);
} else if (Avaliablity == 1) {
ChildCtrl.controls.other_applicant.setValue('');
ChildCtrl.controls.other_applicant.clearValidators();
}
ChildCtrl.controls.other_applicant.updateValueAndValidity();
if(ChildCtrl.controls.bank_name.value == 1){
ChildCtrl.controls.other_bank.setValidators([Validators.required]);}
else{ ChildCtrl.controls.other_bank.clearValidators();
ChildCtrl.controls.other_bank.setValue('');
}
ChildCtrl.controls.other_bank.updateValueAndValidity();
cnt++;
}
}
if (!this.bankingForm.valid) {
this.validateAllFormFields(this.bankingForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
let records: any = {};
records.parent_pdid = this.parent_pdid;
records.pdid = this.pdid;
@ -275,13 +303,15 @@ export class BankingDetailsComponent implements OnInit {
});
}
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);
}
});
}

View File

@ -31,12 +31,13 @@
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width: 95%;">
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);"
<mat-select placeholder="Is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);"
formControlName="business_address_availability" required>
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="itemrow.controls['business_address_availability'].hasError('required')">Business address Required</mat-error>
</mat-form-field>
</div>
@ -47,6 +48,7 @@
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"
(change)="checkWithExistBusinessYear($event.target.value,i)" OnlyNumber type="text">
<mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
<mat-error *ngIf="itemrow.controls['business_years'].hasError('required')">Year Required</mat-error>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
Required</mat-error> -->
</mat-form-field>
@ -66,15 +68,15 @@
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
Required</mat-error> -->
<mat-error *ngIf="itemrow.controls['business_is_pd_visited'].hasError('required')">Business Activity
Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;">
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark">
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
Required</mat-error> -->
<mat-error *ngIf="itemrow.controls['business_pd_visited_remark'].hasError('required')">Remarks
Required</mat-error>
</mat-form-field>
</div>
@ -88,6 +90,8 @@
<mat-option value="owned">Owned</mat-option>
<mat-option value="rented">Rented</mat-option>
</mat-select>
<mat-error *ngIf="itemrow.controls['business_address_availability'].hasError('required')">Ownership Type
Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="(itemrow.get('business_ownership_type').value == 'rented')">
@ -107,19 +111,20 @@
<mat-form-field style="width:45%">
<mat-select multiple placeholder="Asset Owned by" formControlName="business_name_of_the_owner"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,itemrow,8)">
[compareWith]="compareObjects" (selectionChange)="setOtherOwnerOfAddress($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
<mat-error>Asset Owned by Required</mat-error>
<mat-error *ngIf="itemrow.controls['business_name_of_the_owner'].hasError('required')">Asset Owned by Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress[i]">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off">
<mat-error *ngIf="itemrow.controls['business_name_of_the_other_owner'].hasError('required')">Asset Owned by Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%">
@ -202,10 +207,12 @@
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value == 1">
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_property_type'].hasError('required')">Property Type Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value != ''">
<input matInput placeholder="Address of the Property" formControlName="address_of_the_property"
autocomplete="off">
<mat-error *ngIf="detail.controls['address_of_the_property'].hasError('required')">Address of the Property Required</mat-error>
</mat-form-field>
</div>
</div>
@ -230,6 +237,7 @@
<mat-form-field style="width:45%" *ngIf="detail.get('vehicle_type').value == 1">
<input matInput placeholder=" Specify Vehicle" formControlName="other_vehicle_type"
autocomplete="off">
<mat-error *ngIf="detail.controls['other_vehicle_type'].hasError('required')">Vehicle Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%">
@ -289,7 +297,7 @@
<input matInput placeholder="Monthly Rent Amount" formControlName="business_monthly_rented_amt"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}} {{sup.get('business_monthly_rented_amt').value | numberToWords}} Only</mat-hint>
<mat-error>Monthly Rent Amount Required</mat-error>
<mat-error *ngIf="sup.controls['business_monthly_rented_amt'].hasError('required')">Monthly Rent Amount Required</mat-error>
</mat-form-field>
</div>
@ -302,19 +310,20 @@
<mat-form-field style="width:45%">
<mat-select multiple placeholder="Asset Owned by" formControlName="business_name_of_the_owner"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,sup,4)">
[compareWith]="compareObjects" (selectionChange)="setOtherOwnerOfAsset($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
<mat-error>Asset Owned by Required</mat-error>
<mat-error *ngIf="sup.controls['business_name_of_the_owner'].hasError('required')">Asset Owned by is Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isOtherOwner[i]" style="width:45%">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off">
<mat-error *ngIf="sup.controls['business_name_of_the_other_owner'].hasError('required')">Asset Owned by is Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%">

View File

@ -89,7 +89,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
/** init Function */
ngOnInit() {
console.clear();
console.clear();
// this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => {
// this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ;
// });
@ -219,20 +219,15 @@ console.clear();
this.addressLabel[inx] = '';
this.pdTrigerService.getStateWiseCities(dataValue.state).subscribe(data => {
if (data.status == 200) {
// console.log(data.records);
this.cityArr = data.records.cities;
this.pinArr = data.records.pincode;
// console.log('cityArr',this.cityArr);
// console.log('pinArr',this.pinArr);
// console.log('flag',flag);
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0];
let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.state)[0];
let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.city)[0];
let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.pincode)[0];
// console.log(selectedCity);
// console.log(selectedPincode);
// console.log(selectedCity[0].city_name);
// console.log(selectedPincode[0].pincode);
let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
let address = dataValue.address + ' , ' + selectedCity.city_name + ','+selectedState.name +'-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode);
@ -601,8 +596,6 @@ console.clear();
result.forEach((val, index) => {
var splitted_label = val.address_label.split("/", 2);
// console.log(splitted_label)
// console.log(splitted_label[0],splitted_label[1]);
let addressType = splitted_label[1] != '' ? splitted_label[1] : 'Address Type';
this.placeholderName[index] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
let vals = {
@ -789,6 +782,7 @@ console.clear();
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
} else {
return;
var answerFormValues = this._businessAssetsQuesFrom.value;
let dataOwner_name = [];
@ -870,23 +864,34 @@ console.clear();
this.yearErrorMessage[i] = '';
}
}
setRequiredValidation2(value, ParInx, ChdInx, flag) {
if (flag == 4) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.assets_details;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
setOtherOwnerOfAsset(value, ParInx) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_details;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1;
value.forEach(option => {
if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id;
}
});
if (Avaliablity == 0) {
if (value.length > 0) {
value.forEach(option => {
if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id;
}
});
}
if (Avaliablity == 0) {
ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwner[ParInx] = true;
} else {
} else if (Avaliablity == 1) {
ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwner[ParInx] = false;
@ -894,33 +899,44 @@ console.clear();
ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
if (flag == 8) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_for_address;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1;
value.forEach(option => {
if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id;
}
});
}
setOtherOwnerOfAddress(value, ParInx) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_for_address;
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1;
if (value.length > 0) {
value.forEach(option => {
if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id;
}
});
}
if (Avaliablity == 0) {
ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwnerForAddress[ParInx] = true;
} else {
this.isOtherOwnerForAddress[ParInx] = true;
} else if (Avaliablity == 1) {
ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwnerForAddress[ParInx] = false;
}
}
ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
}
setRequiredValidation(value, item, flag) {
if (flag == 1) {

View File

@ -32,7 +32,7 @@
</mat-expansion-panel-header>
<mat-form-field>
<mat-select placeholder="Account Name" formControlName="applicant_name"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,itemrow,1)">
[compareWith]="compareObjects">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -44,11 +44,11 @@
style="width:45%">
<input matInput placeholder="Specify Applicant Name" formControlName="other_applicant"
autocomplete="off">
<mat-error *ngIf="itemrow.controls['other_applicant'].hasError('required')">Applicant Name Required</mat-error>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name"
(selectionChange)="setRequiredValidation($event.values,itemrow,2)">
<mat-select placeholder="Bank Name" formControlName="bank_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{
btLen.lender_name }}</mat-option>
@ -57,6 +57,7 @@
<mat-form-field *ngIf="itemrow.get('bank_name').value == 1">
<input matInput placeholder="Specify Bank Name" formControlName="other_bank"
autocomplete="off">
<mat-error *ngIf="itemrow.controls['other_bank'].hasError('required')">Bank Name Required</mat-error>
</mat-form-field>

View File

@ -232,6 +232,48 @@ export class BusinessBankingDetailsComponent implements OnInit {
}
bankSubmit() {
const control = <FormArray>this.bankingForm.controls.itemRows;
let CtrlLength = control.controls.length;
if (CtrlLength > 0) {
let cnt = 0;
while(cnt < CtrlLength){
let ChildCtrl : any = control.controls[cnt];
let Avaliablity = ChildCtrl.controls.applicant_name.value != ''
? ChildCtrl.controls.applicant_name.value.id == 0 && ChildCtrl.controls.applicant_name.value.group_id == 2
? ChildCtrl.controls.applicant_name.value.id : 1
: 1 ;
if (Avaliablity == 0) {
ChildCtrl.controls.other_applicant.setValidators([Validators.required]);
} else if (Avaliablity == 1) {
ChildCtrl.controls.other_applicant.setValue('');
ChildCtrl.controls.other_applicant.clearValidators();
}
ChildCtrl.controls.other_applicant.updateValueAndValidity();
if(ChildCtrl.controls.bank_name.value == 1){
ChildCtrl.controls.other_bank.setValidators([Validators.required]);}
else{ ChildCtrl.controls.other_bank.clearValidators();
ChildCtrl.controls.other_bank.setValue('');
}
ChildCtrl.controls.other_bank.updateValueAndValidity();
cnt++;
}
}
if (!this.bankingForm.valid) {
this.validateAllFormFields(this.bankingForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
let records: any = {};
records.parent_pdid = this.parent_pdid;
records.pdid = this.pdid;
@ -256,13 +298,15 @@ export class BusinessBankingDetailsComponent implements OnInit {
});
}
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);
}
});
}
@ -360,15 +404,16 @@ export class BusinessBankingDetailsComponent implements OnInit {
setRequiredValidation(value, item, flag) {
if (flag == 1) {
value == 0
? item.controls.other_applicant.setValidators([Validators.required])
: item.controls.other_applicant.clearValidators();
item.controls.other_applicant.updateValueAndValidity();
if(value == 0){
item.controls.other_applicant.setValidators([Validators.required]); }
else{ item.controls.other_applicant.clearValidators();
item.controls.other_applicant.setValue(''); }
item.controls.other_applicant.updateValueAndValidity();
}
if (flag == 2) {
value == 1
? item.controls.other_bank.setValidators([Validators.required])
: item.controls.other_bank.clearValidators();
if(value == 1){
item.controls.other_bank.setValidators([Validators.required]);}
else{ item.controls.other_bank.clearValidators(); item.controls.other_bank.setValue('') }
item.controls.other_bank.updateValueAndValidity();
}

View File

@ -63,6 +63,7 @@
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="itemrow.controls['other_person_designation'].hasError('required')">Person Designatione Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -195,6 +196,7 @@
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="items.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -330,6 +332,7 @@
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="itemrow.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">

View File

@ -9,6 +9,7 @@ import {
import {
FormBuilder,
FormGroup,
FormControl,
Validators,
FormArray,
} from '@angular/forms';
@ -684,18 +685,18 @@ export class ClientInfoComponent implements OnInit {
selectedPersonDesignation(items, e, flag) {
if (flag == 1) {
e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required])
: items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
else if (flag == 2) {
e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required])
: items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]);}
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
else if (flag == 3) {
e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required])
: items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
}
@ -748,5 +749,16 @@ export class ClientInfoComponent implements OnInit {
// }
// ]
// }
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);
}
});
}
}

View File

@ -59,6 +59,7 @@
<mat-form-field *ngIf="details.get('loan_type').value == 1 " style="width:45%;">
<input matInput autocomplete="off" placeholder="Specify Loan Type"
formControlName="others_loan_type">
<mat-error *ngIf="details.controls['others_loan_type'].hasError('required')">Loan Type Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%; height:105px;">
<input matInput autocomplete="off" placeholder="Loan Amount"
@ -76,6 +77,7 @@
<mat-form-field *ngIf="details.get('lender').value == 1" style="width:45%;">
<input matInput autocomplete="off" placeholder="Specify Lender"
formControlName="others_lender">
<mat-error *ngIf="details.controls['others_lender'].hasError('required')">Lender Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%;">
<!-- <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)">
@ -98,6 +100,7 @@
<mat-form-field style="width:45%;" *ngIf="checkOthers(details.get('loan_taken_by').value)===true">
<input matInput autocomplete="off" placeholder="Specify Borrower"
formControlName="others_loan_taken">
<mat-error *ngIf="details.controls['others_loan_taken'].hasError('required')">Borrower Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%;">
@ -111,6 +114,7 @@
<mat-form-field *ngIf="details.get('frequency').value == 1" style="width:45%">
<input matInput autocomplete="off" placeholder="Specify Frequency"
formControlName="other_frequency">
<mat-error *ngIf="details.controls['other_frequency'].hasError('required')">Frequency" Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value != ''" style="width:45%">

View File

@ -563,33 +563,34 @@ export class CurrentLoanComponent implements OnInit {
}
setRequiredValidation(value, item, flag) {
console.log('value, item, flag',value, item, flag);
if (flag == 1) {
value == 1
? item.controls.others_loan_type.setValidators([Validators.required])
: item.controls.others_loan_type.clearValidators();
item.controls.others_loan_type.updateValueAndValidity();
if(value == 1){
item.controls.others_loan_type.setValidators([Validators.required]);}
else{ item.controls.others_loan_type.clearValidators();
item.controls.others_loan_type.setValue('');}
item.controls.others_loan_type.updateValueAndValidity();
}
if (flag == 2) {
// value==1
// ? item.controls.others_lender.setValidators([Validators.required])
// : item.controls.others_lender.clearValidators();
// item.controls.others_lender.updateValueAndValidity();
else if(flag == 2) {
if(value==1){
item.controls.others_lender.setValidators([Validators.required]);}
else{item.controls.others_lender.clearValidators();
item.controls.others_lender.setValue('');}
item.controls.others_lender.updateValueAndValidity();
}
if (flag == 3) {
value == 0
? item.controls.others_loan_taken.setValidators([Validators.required])
: item.controls.others_loan_taken.clearValidators();
item.controls.others_loan_taken.updateValueAndValidity();
else if(flag == 3) {
if(value == 0){
item.controls.others_loan_taken.setValidators([Validators.required]);}
else{ item.controls.others_loan_taken.clearValidators();
item.controls.others_loan_taken.setvalue(''); }
item.controls.others_loan_taken.updateValueAndValidity();
}
if (flag == 4) {
value == 1
? item.controls.other_frequency.setValidators([Validators.required])
: item.controls.other_frequency.clearValidators();
item.controls.other_frequency.updateValueAndValidity();
else if(flag == 4) {
if(value == 1){
item.controls.other_frequency.setValidators([Validators.required]);}
else{ item.controls.other_frequency.clearValidators();
item.controls.other_frequency.setValue(''); }
item.controls.other_frequency.updateValueAndValidity();
}
}
}

View File

@ -27,10 +27,12 @@
<mat-option *ngFor="let cl of company_list" [value]="cl.company_order_id+'-'+cl.company_name">{{
cl.company_name }}</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['employer_name'].invalid">Name of Employer Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 90%" *ngIf="employmentForm.controls['employer_name'].value != ''" required>
<textarea matInput placeholder="Company Profile in brief" formControlName="employer_in_brief"></textarea>
<mat-error *ngIf="employmentForm.controls['employer_in_brief'].hasError('required')">Company Profile in brief Required</mat-error>
</mat-form-field>
<div>
@ -41,6 +43,7 @@
<input matInput OnlyNumber type="number" autocomplete="off" placeholder="Year"
formControlName="how_long_year" required min='0'>
<mat-error *ngIf="employmentForm.controls.how_long_year.hasError('max')">Higer than business vintage</mat-error>
<mat-error *ngIf="employmentForm.controls['how_long_year'].hasError('required')">Year Required</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput OnlyNumber type="number" autocomplete="off" placeholder="Month"
@ -67,6 +70,7 @@
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['was_met'].hasError('required')">Was the employer met Required</mat-error>
</mat-form-field>
<div fxLayout="row" fxLayoutAlign="start none" *ngIf="employmentForm.controls['was_met'].value == 'yes'">
<mat-form-field style="width: 45%">
@ -78,10 +82,12 @@
{{person.applicant_name | titlecase}}
</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['name_person_met'].hasError('required')">Name of Person Met Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Designation of Person Met" formControlName="designation_person_met"
required>
<mat-error *ngIf="employmentForm.controls['designation_person_met'].hasError('required')">Designation of Person Met Required</mat-error>
<!-- <mat-select placeholder="Designation of Person Met" formControlName="designation_person_met" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
@ -98,6 +104,7 @@
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['confirm_salary'].hasError('required')">Salary amount confirmed Required</mat-error>
</mat-form-field>
<div fxLayout="row" fxLayoutAlign="start none" *ngIf="employmentForm.controls['confirm_salary'].value == 'yes'">
<mat-form-field style="width: 45%">
@ -117,6 +124,7 @@
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['attendance_seen'].hasError('required')">Attendance register seen Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'" style="width: 45%">
<mat-select placeholder="Salary register seen ?" formControlName="sal_reg_seen"
@ -125,6 +133,7 @@
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="employmentForm.controls['sal_reg_seen'].hasError('required')">Salary register seen Required</mat-error>
</mat-form-field>
<mat-card>
<mat-card-header>
@ -178,12 +187,14 @@
<input matInput placeholder="Gross Monthly Salary" formControlName="gross_monthly_salary"
OnlyNumber type="text" autocomplete="off" required>
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['gross_monthly_salary'].value != ''">{{"&#8377;"}} {{employmentForm.controls['gross_monthly_salary'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls['gross_monthly_salary'].hasError('required')">Gross Monthly Salary Required</mat-error>
</mat-form-field>
<mat-form-field style="width:33%">
<input matInput placeholder="Net Monthly Salary" formControlName="net_monthly_salary"
OnlyNumber type="text" autocomplete="off" required>
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['net_monthly_salary'].value != ''">{{"&#8377;"}} {{employmentForm.controls['net_monthly_salary'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls['net_monthly_salary'].hasError('required')">Net Monthly Salary Required</mat-error>
<!-- <input matInput placeholder="Net Take Home"
formControlName="net_take_home"> -->
</mat-form-field>
@ -230,6 +241,7 @@
<input matInput placeholder="Bonus or Incentive" formControlName="bonus_incentive"
OnlyNumber type="text" autocomplete="off" required>
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['bonus_incentive'].value != ''">{{"&#8377;"}} {{employmentForm.controls['bonus_incentive'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls['bonus_incentive'].hasError('required')">Bonus or Incentive Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 33%" *ngIf="employmentForm.controls['bonus_incentive'].value != '' && employmentForm.controls['bonus_incentive'].value != '0' ">
@ -252,6 +264,7 @@
<mat-form-field style="width: 33%" *ngIf="employmentForm.controls['bonus_type'].value == 'others'">
<input matInput placeholder="Bonus Type Others" formControlName="bonus_type_other">
<mat-error *ngIf="employmentForm.controls['bonus_type_other'].hasError('required')">Bonus Type Others Required</mat-error>
</mat-form-field>
</div>

View File

@ -427,6 +427,7 @@ export class EmploymentInfoComponent implements OnInit {
if (!this.employmentForm.valid) {
this.validateAllFormFields(this.employmentForm);
this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!');
return;
}
@ -511,6 +512,19 @@ export class EmploymentInfoComponent implements OnInit {
// }
// }
validateAllFormFields(formGroup: any) {
console.log('validateAllFormFields');
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);
}
});
}
checkWorkingExperiences(){
// this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false;
// this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true;

View File

@ -22,6 +22,7 @@
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['final_custormer_remark_type'].value == 1">
<input matInput autocomplete="off" placeholder="Specify Customer Behaviour" formControlName="final_other_customer_behaviour">
<mat-error *ngIf="_finalRemarkForm.controls['final_other_customer_behaviour'].hasError('required')">Customer Behaviour Required</mat-error>
</mat-form-field>
<mat-card>
<mat-card-content>
@ -35,6 +36,7 @@
<mat-option value="not_suited">Not Suited</mat-option>
</mat-select>
</mat-form-field>
<mat-error *ngIf="_finalRemarkForm.controls['is_service_provided'].hasError('required')">Service Provided Required</mat-error>
</mat-card-content>
</mat-card>
<br>
@ -48,6 +50,7 @@
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 1">
<input matInput autocomplete="off" placeholder="Specify PD Officers Recommendation" formControlName="others_pd_officers_recommendation">
<mat-error *ngIf="_finalRemarkForm.controls['others_pd_officers_recommendation'].hasError('required')">PD Officers Recommendation Required</mat-error>
</mat-form-field>
<span *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 2">
@ -57,6 +60,7 @@
<mat-form-field style="width:85%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Positive"
formControlName="reason_for_positive">
<mat-error *ngIf="details.controls['reason_for_positive'].hasError('required')">Reasons Required</mat-error>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button
matTooltip="Delete" matTooltipPosition="above" (click)="deleteRecommendationPositive(i)"
@ -78,6 +82,7 @@
<mat-form-field style="width:85%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Negative"
formControlName="reason_for_negative">
<mat-error *ngIf="details.controls['reason_for_negative'].hasError('required')">Reasons Required</mat-error>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button
matTooltip="Delete" matTooltipPosition="above" (click)="deleteRecommendationNegative(i)"
@ -99,6 +104,7 @@
<mat-form-field style="width:85%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Refer to Credit"
formControlName="reason_for_refer_to_credit">
<mat-error *ngIf="details.controls['reason_for_refer_to_credit'].hasError('required')">Reasons Required</mat-error>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button
matTooltip="Delete" matTooltipPosition="above" (click)="deleteaddRecommendationReferToCredit(i)"

View File

@ -113,6 +113,7 @@
<mat-option value="Negative">Negative</mat-option>
<mat-option value="Could not verify">Could not verify</mat-option>
</mat-select>
<mat-error *ngIf="_neighbourhoodForm.controls['neighbourhood_status'].hasError('required')">Status Required</mat-error>
</mat-form-field>
</div>
<div *ngIf="types.id==1">
@ -238,6 +239,7 @@
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput autocomplete="off" placeholder="Remarks" formControlName="neighbour_reference_remark"></textarea>
<mat-error *ngIf="_neighbourhoodForm.controls['neighbour_reference_remark'].hasError('required')">Remarks Required</mat-error>
</mat-form-field>
</div>
<div fxFlex="40" align="end">

View File

@ -61,6 +61,7 @@
<mat-form-field style="width:45%" *ngIf="details.get('source').value == 1">
<input matInput autocomplete="off" placeholder="Specify Source"
formControlName="others_source">
<mat-error *ngIf="details.controls['others_source'].hasError('required')">Source Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="details.get('source').value == 5">
@ -92,6 +93,7 @@
<mat-form-field style="width:45%" *ngIf="isIncomeEarnedBy[i]">
<input matInput autocomplete="off" placeholder="Specify Income earned by"
formControlName="others_income_earned_by">
<mat-error *ngIf="details.controls['others_income_earned_by'].hasError('required')">Income earned by is Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%">
@ -112,6 +114,7 @@
<mat-form-field style="width:45%" *ngIf="details.get('frequency').value == 1">
<input matInput autocomplete="off" placeholder="Specify Frequency"
formControlName="others_frequency">
<mat-error *ngIf="details.controls['others_frequency'].hasError('required')">Frequency Required</mat-error>
</mat-form-field>
<!-- <button type="button" matTooltip="Delete" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="deleteIncomeDetails(i)"
*ngIf="i>0">

View File

@ -238,10 +238,47 @@ export class OtherIncomeComponent implements OnInit {
control.removeAt(index);
}
submitCurrentDetails() {
if (this.otherIncomeForm.controls['other_income'].value == 'Yes') {
const control = <FormArray>this.otherIncomeForm.controls['income_details'];
let CtrlLength = control.controls.length;
if (CtrlLength > 0) {
let cnt = 0;
while(cnt < CtrlLength){
let ChildCtrl : any = control.controls[cnt]
console.log(ChildCtrl.controls.source.value);
if(ChildCtrl.controls.source.value == 1){
console.log('ChildCtrl.controls.source.value');
ChildCtrl.controls['others_source'].setValidators([Validators.required]);}
else{
ChildCtrl.controls['others_source'].clearValidators();
ChildCtrl.controls['others_source'].setValue('');
}
ChildCtrl.controls['others_source'].updateValueAndValidity();
if(ChildCtrl.controls.frequency.value == 1){
ChildCtrl.controls['others_frequency'].setValidators([Validators.required]);}
else{ ChildCtrl.controls['others_frequency'].clearValidators();
ChildCtrl.controls['others_frequency'].setValue('');
}
ChildCtrl.controls['others_frequency'].updateValueAndValidity();
cnt++;
}
}
// else{}
}
if (!this.otherIncomeForm.valid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.validateAllFormFields(this.otherIncomeForm);
this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!');
return;
}
let records: any = {};
records.parent_pdid = this.parent_pdid;
records.pdid = this.pdid;
@ -268,13 +305,16 @@ export class OtherIncomeComponent implements OnInit {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
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);
}
});
}
@ -337,7 +377,6 @@ export class OtherIncomeComponent implements OnInit {
this.isIncomeEarnedBy[i] = false;
}
ChdCtrls.controls.others_income_earned_by.updateValueAndValidity();
}
}

View File

@ -50,7 +50,7 @@
formControlName="raw_quantity" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Unit of Measurement"
<mat-select placeholder="Unit of Measurement" (selectionChange)="selectedUOM(mrm,$event.value,1)"
formControlName="raw_uom">
<mat-option>Select</mat-option>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
@ -58,8 +58,9 @@
</mat-form-field>
<mat-form-field *ngIf="mrm.get('raw_uom').value == 1"
style="width:28%">
<input matInput autocomplete="off" placeholder="Specify UOM"
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="other_uom">
<mat-error *ngIf="mrm.controls['other_uom'].hasError('required')">UOM Required</mat-error>
</mat-form-field>
<mat-form-field style="width:90%">
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"
@ -141,7 +142,7 @@
type="text">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Unit of Measurement"
<mat-select placeholder="Unit of Measurement" (selectionChange)="selectedUOM(mfg,$event.value,2)"
formControlName="goods_uom">
<mat-option>Select</mat-option>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
@ -151,6 +152,7 @@
style="width:28%">
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="goods_other_uom">
<mat-error *ngIf="mfg.controls['goods_other_uom'].hasError('required')">UOM Required</mat-error>
</mat-form-field>
<mat-form-field style="width:90%">
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"
@ -217,7 +219,7 @@
OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Unit of Measurement"
<mat-select placeholder="Unit of Measurement" (selectionChange)="selectedUOM(item,$event.value,3)"
formControlName="traded_goods_uom">
<mat-option>Select</mat-option>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
@ -227,6 +229,7 @@
style="width:28%">
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="traded_goods_other_uom">
<mat-error *ngIf="item.controls['traded_goods_other_uom'].hasError('required')">UOM Required</mat-error>
</mat-form-field>
<mat-form-field style="width:90%">
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"
@ -296,7 +299,7 @@
OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Unit of Measurement"
<mat-select placeholder="Unit of Measurement" (selectionChange)="selectedUOM(tradetg,$event.value,4)"
formControlName="traded_goods_uom">
<mat-option>Select</mat-option>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
@ -304,8 +307,9 @@
</mat-form-field>
<mat-form-field *ngIf="tradetg.get('traded_goods_uom').value == 1"
style="width:28%">
<input matInput autocomplete="off" placeholder="Specify UOM"
<input matInput autocomplete="off" placeholder="Specify UOM"
formControlName="traded_goods_other_uom">
<mat-error *ngIf="tradetg.controls['traded_goods_other_uom'].hasError('required')">UOM Required</mat-error>
</mat-form-field>
<mat-form-field style="width:90%">
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed"

View File

@ -690,7 +690,8 @@ export class StockComponent implements OnInit {
submitDetails(e) {
this.submitted = true;
// stop here if form is invalid
if (this.stockForms.invalid) {
if (!this.stockForms.valid) {
this.validateAllFormFields(this.stockForms);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
} else {
@ -719,16 +720,42 @@ export class StockComponent implements OnInit {
}
}
// validateAllFormFields(formGroup: FormGroup) {
// 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);
// }
// });
// }
/** To validate All Form Fields */
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);
}
});
}
selectedUOM(items,e,flag) {
if (flag == 1) {
if(e == 1){ items.controls['other_uom'].setValidators([Validators.required]); }
else { items.controls['other_uom'].clearValidators(); items.controls['other_uom'].setValue('');}
items.controls['other_uom'].updateValueAndValidity();
}
else if (flag == 2) {
if(e == 1){ items.controls['goods_other_uom'].setValidators([Validators.required]); }
else{ items.controls['goods_other_uom'].clearValidators(); items.controls['goods_other_uom'].setValue('');}
items.controls['goods_other_uom'].updateValueAndValidity();
}
else if (flag == 3) {
if(e == 1){ items.controls['traded_goods_other_uom'].setValidators([Validators.required]); }
else { items.controls['traded_goods_other_uom'].clearValidators(); items.controls['traded_goods_other_uom'].setValue('');}
items.controls['traded_goods_other_uom'].updateValueAndValidity();
}
else if (flag == 4) {
if(e == 1){ items.controls['traded_goods_other_uom'].setValidators([Validators.required]); }
else{ items.controls['traded_goods_other_uom'].clearValidators(); items.controls['traded_goods_other_uom'].setValue('');}
items.controls['traded_goods_other_uom'].updateValueAndValidity();
}
}
getUOM() {
this._pd.getAllMasterDatas('UOM').subscribe(data => {

View File

@ -56,6 +56,7 @@
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="itemrow.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -192,6 +193,7 @@
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="items.get('person_designation').value == 1">
<input matInput placeholder="Specify Person Designation" formControlName="other_person_designation">
<mat-error *ngIf="itemrow.controls['other_person_designation'].hasError('required')">Person Designation Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">

View File

@ -512,13 +512,13 @@ export class SupplierInfoComponent implements OnInit {
selectedPersonDesignation(items, e, flag) {
if (flag == 1) {
e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required])
: items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); }
else { items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
else if (flag == 2) {
e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required])
: items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue('');
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');}
items.controls['other_person_designation'].updateValueAndValidity();
}
}