This commit is contained in:
dineshkumarkannan 2019-01-02 11:21:10 +05:30
commit 51d6012e37
19 changed files with 935 additions and 794 deletions

View File

@ -113,10 +113,10 @@
<div fxFlex="100"> <div fxFlex="100">
<label>How long has business been operated from this premise?</label> <label>How long has business been operated from this premise?</label>
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"> <input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month" (change)="ConvertMonthintoYear($event.target.value)"> <input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value)">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="100"> <div fxFlex="100">

View File

@ -507,4 +507,13 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.business_month.setValue(Math.floor(converted_month)); this.addressForm.controls.business_month.setValue(Math.floor(converted_month));
} }
/** On Key Press Event For Numbers */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
} }

View File

@ -43,6 +43,10 @@ export class AssetsInfoComponent implements OnInit {
public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"},
{'value': "no",'viewValue': "No"}, {'value': "no",'viewValue': "No"},
{'value': "nan",'viewValue': "NA"}] {'value': "nan",'viewValue': "NA"}]
appxMarketAmtInwords : any = [];
OtherAppxMarketAmtInwords : any = [];
emiAmtInwords : any = [];
OtherEmiAmtInwords : any = [];
// public m_assets_type = [ // public m_assets_type = [
// { // {
// 'id': "1", // 'id': "1",
@ -507,6 +511,7 @@ public m_investmentType = [];
//insurance_type: [''], //insurance_type: [''],
premium_paid: [''], premium_paid: [''],
frequency_mode: [''], frequency_mode: [''],
other_frequency_mode:[''],
sum_assured: [''], sum_assured: [''],
members_coverd: [''] members_coverd: ['']
}); });
@ -582,6 +587,7 @@ public m_investmentType = [];
//insurance_type: [data.insurance_type], //insurance_type: [data.insurance_type],
premium_paid: [data.premium_paid], premium_paid: [data.premium_paid],
frequency_mode: [data.frequency_mode], frequency_mode: [data.frequency_mode],
other_frequency_mode:[data.other_frequency_mode],
sum_assured: [data.sum_assured], sum_assured: [data.sum_assured],
members_coverd: [data.members_coverd] members_coverd: [data.members_coverd]
}); });
@ -958,14 +964,23 @@ public m_investmentType = [];
} }
// { /** Amount InWords */
// 'main_raw_materials': 'sdkjfal', inWords(e,i,flag){
// 'supplier_details' ; [ switch(flag){
// { case 1 :
// 'supplier_name':'ldskjfalks', this.appxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value);
// 'payment_mode': '1', break;
// 'payment_mode_value':'' case 2 :
// } this.OtherAppxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value);
// ] break;
// } case 3 :
this.emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value);
break;
case 4 :
this.OtherEmiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value);
break;
default:
break;
}
}
} }

View File

@ -95,25 +95,22 @@
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Applicant Name" <mat-select placeholder="Applicant Name" formControlName="applicant_name" required (selectionChange)="selectedBorrower($event.value,i)">
formControlName="applicant_name" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="itemrow.get('applicant_name').value == 0"> <!-- <mat-form-field *ngIf="itemrow.get('applicant_name').value == 0"> -->
<input matInput placeholder="Specify Other Applicant" <mat-form-field *ngIf="this.OtherFlag[i]">
formControlName="other_applicant" autocomplete="off"> <input matInput placeholder="Specify Applicant Name" formControlName="other_applicant" autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- <mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Applicant Name" <input matInput placeholder="Applicant Name"
formControlName="applicant_name" required> formControlName="applicant_name" required>
</mat-form-field> --> </mat-form-field> -->
<!-- <mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Bank Name" formControlName="bank_name" required> <input matInput placeholder="Bank Name" formControlName="bank_name" required>
</mat-form-field> --> </mat-form-field> -->
<mat-form-field> <mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name" required> <mat-select placeholder="Bank Name" formControlName="bank_name" required>
@ -121,13 +118,13 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="itemrow.get('bank_name').value == 3"> <mat-form-field *ngIf="itemrow.get('bank_name').value == 3">
<input matInput placeholder="Specify Other Bank Name" <input matInput placeholder="Specify Bank Name"
formControlName="other_bank" autocomplete="off"> formControlName="other_bank" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select (selectionChange)="selectedAccTypeChanges($event)" placeholder="Account Type" formControlName="account_type" required > <mat-select (selectionChange)="selectedAccTypeChanges($event.value,i)" placeholder="Account Type" formControlName="account_type" required >
<mat-option *ngFor="let prop of m_accountType" [value]="prop.id">{{ prop.name }}</mat-option> <mat-option *ngFor="let prop of m_accountType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select> </mat-select>
<!--<mat-select placeholder="Account Type" <!--<mat-select placeholder="Account Type"
@ -140,42 +137,46 @@
</mat-select>--> </mat-select>-->
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="salaryField"> <mat-form-field *ngIf="pd_cus_segment!='SAL'">
<mat-select placeholder="Salary Credited in this account" <mat-select placeholder="Is this the main business account"
formControlName="salary" required> formControlName="is_main" required>
<mat-option value="Yes">Yes</mat-option> <mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option> <mat-option value="No">No</mat-option>
<mat-option value="NA">NA</mat-option> </mat-select>
</mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="itemrow.get('account_type').value != 2"> <div fxLayout="row" fxLayoutAlign="start none">
<input matInput placeholder="Limit in case of OD / CC account" <mat-form-field style="width: 35%;" *ngIf="salaryField">
formControlName="limit" (keypress)="keyPress($event)" required autocomplete="off"> <mat-select placeholder="Salary Credited in this account"
</mat-form-field> formControlName="salary" required>
<mat-form-field *ngIf="pd_cus_segment!='SAL'"> <mat-option value="Yes">Yes</mat-option>
<mat-select placeholder="Is this the main business account" <mat-option value="No">No</mat-option>
formControlName="is_main" required> <mat-option value="NA">NA</mat-option>
<mat-option value="Yes">Yes</mat-option> </mat-select>
<mat-option value="No">No</mat-option> </mat-form-field>
</mat-select>
</mat-form-field> <mat-form-field style="width: 35%;" *ngIf="this.limitCaseFlag[i]"> <!-- *ngIf="itemrow.get('account_type').value != 2"> -->
<input matInput autocomplete="off" placeholder="Limit in case of OD / CC account"
formControlName="limit" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<mat-hint align="start" style="font-size:70%" *ngIf="itemrow.get('limit').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint>
</mat-form-field>
</div>
<!-- <mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Approximate Vintage" <input matInput placeholder="Approximate Vintage"
formControlName="vintage" required> formControlName="vintage" required>
</mat-form-field> --> </mat-form-field>-->
<div> <div>
<label>Number of Years / Months since account was started</label> <label>Number of Years / Months since account was started</label>
<br> <br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field> <mat-form-field>
<input matInput type="number" placeholder="Year(s)" formControlName="vintage_year" required min='0' (keypress)="keyPress($event)" autocomplete="off"> <input matInput autocomplete="off" placeholder="Year(s)" formControlName="vintage_year" required (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput type="number" placeholder="Month(s)" formControlName="vintage_month" required min='0' max='11'(keypress)="keyPress($event)" autocomplete="off"> <input matInput autocomplete="off" placeholder="Month(s)" formControlName="vintage_month" required (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(itemrow,$event.target.value)">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<button *ngIf="i > 0" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteBankdetails(i)"> <button *ngIf="i > 0" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteBankdetails(i)">
<mat-icon >delete</mat-icon> <mat-icon >delete</mat-icon>
</button> </button>

View File

@ -38,6 +38,10 @@ export class BankingDetailsComponent implements OnInit {
m_accountType= []; m_accountType= [];
m_btLenderList = []; m_btLenderList = [];
salaryField : boolean; salaryField : boolean;
OtherFlag : any = [];
limitCaseFlag : any = [];
amtInwords : any = [];
emiAmtInwords : any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -99,7 +103,12 @@ export class BankingDetailsComponent implements OnInit {
if (result.length == 0) { if (result.length == 0) {
control.push(this.createBankarray()); control.push(this.createBankarray());
} else { } else {
result.forEach(datas => { result.forEach((datas,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(datas.limit);
this.selectedBorrower(datas.applicant_name,index);
this.selectedAccTypeChanges(datas.account_type,index)
// this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createBankarray()); control.push(this.createBankarray());
}); });
this.bankingForm.controls.itemRows.setValue(result); this.bankingForm.controls.itemRows.setValue(result);
@ -210,31 +219,58 @@ export class BankingDetailsComponent implements OnInit {
}); });
} }
selectedAccTypeChanges(event: any){ selectedBorrower(e,i){
// console.log('First Time',event); if(e == 0){
// console.log('First Time Value',event.value); this.OtherFlag[i] = true;
if(event.value == 2) { }
else{
this.OtherFlag[i] = false;
}
}
selectedAccTypeChanges(event: any,i){
if(event == 2 || event == 1) {
this.limitCaseFlag[i] = false;
const control = <FormArray>this.bankingForm.controls['itemRows']; const control = <FormArray>this.bankingForm.controls['itemRows'];
// console.log('Inside If Condition');
// console.log(control);
// console.log(control.controls);
control.controls[0].get('limit').clearValidators(); control.controls[0].get('limit').clearValidators();
control.controls[0].get('limit').updateValueAndValidity(); control.controls[0].get('limit').updateValueAndValidity();
//this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
// this.bankingForm.controls['itemRows'].
// this.bankingForm.controls.get('limit').clearValidators();
// this.bankingForm.controls.itemRows['controls'].get('limit').updateValueAndValidity();
// const control = <FormArray>this.bankingForm.controls['itemRows'];
// console.log(control.controls['limit'].value);
} }
else{ else{
//alert('sd'); this.limitCaseFlag[i] = true;
} }
} }
/** To Convert Month into Year */
ConvertMonthintoYear(itemrow,e){
//console.log(itemrow);
let year = itemrow.controls.vintage_year.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.vintage_year.setValue(+year + +Math.floor(converted_year));
itemrow.controls.vintage_month.setValue(Math.floor(converted_month));
}
/** Amount InWords */
inWords(e,i,flag){
switch(flag){
case 1 :
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
case 2 :
this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
default:
break;
}
}
/** On Key Press Event For Numbers */ /** On Key Press Event For Numbers */
keyPress(event: any) { keyPress(event: any) {

View File

@ -30,7 +30,7 @@
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'"> <mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'">
<mat-card-header> <mat-card-header>
<p>Loan Details<p> <mat-card-title><p>Loan Details</p></mat-card-title>
</mat-card-header> </mat-card-header>
<div formArrayName="loan_details"> <div formArrayName="loan_details">
<div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index" <div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index"
@ -38,7 +38,8 @@
<!-- {{frequencyData | json}} --> <!-- {{frequencyData | json}} -->
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" > <input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select (selectionChange)="selectedfrequency($event.value,i)" placeholder="Frequency" <mat-select (selectionChange)="selectedfrequency($event.value,i)" placeholder="Frequency"
@ -46,8 +47,12 @@
<mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option> <mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value != ''" > <mat-form-field *ngIf="details.get('frequency').value == 8">
<input matInput autocomplete="off" [placeholder]="placeholderName[i] != '' ? placeholderName[i] : 'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" > <input matInput autocomplete="off" placeholder="Specify Frequency" formControlName="other_frequency">
</mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value != ''" style="width:35%">
<input matInput autocomplete="off" [placeholder]="placeholderName[i] != '' ? placeholderName[i] : 'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('emi').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Loan Type" formControlName="loan_type" > <mat-select placeholder="Loan Type" formControlName="loan_type" >
@ -56,16 +61,18 @@
<!-- <input matInput autocomplete="off" placeholder="Loan Type" formControlName="loan_type" > --> <!-- <input matInput autocomplete="off" placeholder="Loan Type" formControlName="loan_type" > -->
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('loan_type').value == 9 "> <mat-form-field *ngIf="details.get('loan_type').value == 9 ">
<input matInput autocomplete="off" placeholder="Specify Others Loan Type" formControlName="others_loan_type"> <input matInput autocomplete="off" placeholder="Specify Loan Type" formControlName="others_loan_type">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by"> <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)">
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<!-- <mat-option value= 0 >Others</mat-option> --> <!-- <mat-option value= 0 >Others</mat-option> -->
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> <!-- {{details.get('loan_taken_by').value}} -->
<input matInput autocomplete="off" placeholder="Specify Others Loan Taken" formControlName="others_loan_taken"> <!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> -->
<mat-form-field *ngIf="this.OtherFlag[i]">
<input matInput autocomplete="off" placeholder="Specify Borrower" formControlName="others_loan_taken">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Lender" formControlName="lender" > <mat-select placeholder="Lender" formControlName="lender" >
@ -73,17 +80,19 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('lender').value == 3"> <mat-form-field *ngIf="details.get('lender').value == 3">
<input matInput autocomplete="off" placeholder="Specify Others Lender" formControlName="others_lender" > <input matInput autocomplete="off" placeholder="Specify Lender" formControlName="others_lender" >
</mat-form-field> </mat-form-field>
<!-- <mat-form-field> <!-- <mat-form-field>
<input matInput autocomplete="off" placeholder="Lender" formControlName="lender" > <input matInput autocomplete="off" placeholder="Lender" formControlName="lender" >
</mat-form-field> --> </mat-form-field> -->
<mat-form-field> <div style="width:100%">
<mat-form-field style="width:35%">
<input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" > <input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" >
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field style="width:35%">
<input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure" > <input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure" >
</mat-form-field> </mat-form-field>
</div>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()"
*ngIf="i==0"> *ngIf="i==0">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>

View File

@ -44,7 +44,9 @@ export class CurrentLoanComponent implements OnInit {
applicants: any; applicants: any;
placeholderName : any = []; placeholderName : any = [];
IDXval : any; IDXval : any;
OtherFlag : boolean = false; OtherFlag : any = [];
amtInwords : any = [];
emiAmtInwords : any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -55,6 +57,7 @@ export class CurrentLoanComponent implements OnInit {
this.notifier = notifier; this.notifier = notifier;
this.applicants = 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.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
//this.OtherFlag[0] = false;
} }
public viewerOptions: any = { public viewerOptions: any = {
navbar: false, navbar: false,
@ -98,6 +101,8 @@ export class CurrentLoanComponent implements OnInit {
}); });
if (result.length > 0) { if (result.length > 0) {
result.forEach((val,index) => { result.forEach((val,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount);
this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
control.push(this.createLoanDetail()); control.push(this.createLoanDetail());
this.selectedfrequency(val.frequency,index); this.selectedfrequency(val.frequency,index);
//this.selectedLoanTakenBy(val.loan_taken_by,index); //this.selectedLoanTakenBy(val.loan_taken_by,index);
@ -133,6 +138,14 @@ export class CurrentLoanComponent implements OnInit {
arr.removeAt(0); arr.removeAt(0);
} }
} }
selectedBorrower(e,i){
if(e == 0){
this.OtherFlag[i] = true;
}
else{
this.OtherFlag[i] = false;
}
}
selectedfrequency(e,i){ selectedfrequency(e,i){
@ -152,6 +165,7 @@ export class CurrentLoanComponent implements OnInit {
return this.fb.group({ return this.fb.group({
loan_amount: [''], loan_amount: [''],
frequency:[''], frequency:[''],
other_frequency:[''],
emi: [''], emi: [''],
loan_type: [''], loan_type: [''],
others_loan_type: [''], others_loan_type: [''],
@ -227,4 +241,18 @@ export class CurrentLoanComponent implements OnInit {
event.preventDefault(); event.preventDefault();
} }
} }
/** Amount InWords */
inWords(e,i,flag){
switch(flag){
case 1 :
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
case 2 :
this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
default:
break;
}
}
} }

View File

@ -11,9 +11,21 @@
<mat-dialog-content formArrayName="applicant_list"> <mat-dialog-content formArrayName="applicant_list">
<mat-card *ngFor="let applicant of _OtherForm.controls.applicant_list['controls']; let r = index;" [formGroupName]="r"> <mat-card *ngFor="let applicant of _OtherForm.controls.applicant_list['controls']; let r = index;" [formGroupName]="r">
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 75%">
<input matInput placeholder="Name" formControlName="applicant_name" type="text"> <input matInput placeholder="Name" formControlName="applicant_name" type="text">
</mat-form-field> </mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeApplicant(r)" *ngIf="r>0"
matTooltip="Remove Individuals" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
<div fxLayout="row wrap" class="example-section">
<div fxFlex="100%">
<mat-checkbox class="example-margin" color="primary" formControlName="is_person_met">Is Person Met</mat-checkbox>
</div>
<div fxFlex="100%">
<mat-checkbox class="example-margin" color="primary" formControlName="is_applicant">Is Applicant</mat-checkbox>
</div>
</div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -5,3 +5,10 @@
mat-form-field { mat-form-field {
margin: 0 2%; margin: 0 2%;
} }
.example-section {
height: 120px;
}
.example-margin {
margin: 0 10px;
}

View File

@ -8,9 +8,9 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angul
styleUrls: ['./other-applicant-details.component.scss'] styleUrls: ['./other-applicant-details.component.scss']
}) })
export class OtherApplicantDetailsComponent implements OnInit { export class OtherApplicantDetailsComponent implements OnInit {
pageTitle: string ="Add Other Applicant Details"; pageTitle: string ="Add Individual Details";
public _OtherForm: FormGroup; public _OtherForm: FormGroup;
applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','company_name':''}; applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','is_applicant':false,'is_person_met':false};
constructor(private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<OtherApplicantDetailsComponent>) { } constructor(private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<OtherApplicantDetailsComponent>) { }
@ -30,7 +30,8 @@ createApplicant(elementValue:any){
return this._fb.group({ return this._fb.group({
pd_co_applicant_id: [elementValue.pd_co_applicant_id], pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name, Validators.required], applicant_name: [elementValue.applicant_name, Validators.required],
//company_name:[elementValue.company_name] is_applicant:[false],
is_person_met:[false],
}); });
} }

View File

@ -9,47 +9,96 @@
</div> </div>
</h2> </h2>
<mat-dialog-content> <mat-dialog-content>
<mat-card> <!-- individuals details start-->
<mat-card-header> <mat-card>
<mat-card-title>Name of Person Met</mat-card-title> <mat-card-header>
</mat-card-header> <mat-card-title>Individuals</mat-card-title>
</mat-card-header>
<mat-card-content> <mat-card-content>
<div fxLayout="row wrap" class="example-section" formArrayName="applicant_list"> <mat-table [dataSource]="individualsSource" *ngIf="_generalForm.controls.individuals['controls'].length>0" formArrayName="individuals">
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25" *ngFor="let applicant of _generalForm.controls.applicant_list['controls']; let c = index;" [formGroupName]="c"> <ng-container matColumnDef="applicant_name">
<mat-checkbox class="example-margin" color="primary" formControlName="exist_status" (change)="checkboxChange($event, c, applicant.controls)">{{applicant.controls.applicant_name.value}}</mat-checkbox> <mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
</div> <mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
</div> {{details.value.applicant_name | titlecase}}
</mat-cell>
</ng-container>
<ng-container matColumnDef="is_person_met">
<mat-header-cell *matHeaderCellDef> Is Person Met </mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
<mat-checkbox class="table-checkbox" color="primary" formControlName="is_person_met"></mat-checkbox>
</mat-cell>
</ng-container>
<ng-container matColumnDef="is_applicant">
<mat-header-cell *matHeaderCellDef> Is Applicant </mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
<mat-checkbox class="table-checkbox" color="primary" formControlName="is_applicant"></mat-checkbox>
<!-- <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeIndividuals(i)"
matTooltip="Remove Individuals" matTooltipPosition="below">
<mat-icon>delete</mat-icon>
</button> -->
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
</mat-card-content> </mat-card-content>
<mat-card-actions align="end"> <mat-card-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add Other Applicant" matTooltipPosition="above" color="primary" (click)="addOtherApplicant()"><mat-icon>add</mat-icon></button> <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addMoreIndividuals()"
matTooltip="Add More Individual" matTooltipPosition="left" color="primary">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
<!-- end -->
<mat-card> <!-- companies start -->
<mat-card-header> <mat-card>
<mat-card-title>Applicant Details</mat-card-title> <mat-card-header>
</mat-card-header> <mat-card-title>Companies</mat-card-title>
<mat-card-content formArrayName="applicant_relation"> </mat-card-header>
<div fxLayout="row wrap"> <mat-card-content>
<div fxLayout="row wrap" formArrayName="companies">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" *ngFor="let com of _generalForm.controls.companies['controls']; let c = index;" [formGroupName]="c">
<mat-form-field style="width: 60%">
<input matInput placeholder="Company/Firm" formControlName="company_name" type="text">
</mat-form-field>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More Company/Firm" matTooltipPosition="above" color="primary" (click)="addMoreCompanies()" *ngIf="c==0"><mat-icon>add</mat-icon></button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeCompanies(c)" *ngIf="c>0"
matTooltip="Remove Company/Firm" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</mat-card-content>
</mat-card>
<!-- companies end -->
<div fxLayout="row wrap" formArrayName="applicant_relation">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" *ngFor="let relation of _generalForm.controls.applicant_relation['controls']; let r = index;" [formGroupName]="r"> <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" *ngFor="let relation of _generalForm.controls.applicant_relation['controls']; let r = index;" [formGroupName]="r">
<mat-card > <mat-card >
<mat-card-header> <mat-card-header>
<mat-card-title>{{relation.controls.applicant_name.value | titlecase}}</mat-card-title> <mat-card-title class="p-text">{{relation.controls.applicant_name.value | titlecase}}</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<p>Personal Relationship</p>
<div formArrayName="multiple_relation"> <div formArrayName="multiple_relation">
<div *ngFor="let mulRel of relation.get('multiple_relation').controls; let m = index" [formGroupName]="m"> <div *ngFor="let mulRel of relation.get('multiple_relation').controls; let m = index" [formGroupName]="m">
<div fxLayout="row nowrap"> <div fxLayout="row nowrap">
<mat-form-field style="width: 45%"> <mat-form-field style="width: 40%">
<mat-select placeholder="Relation to" formControlName="applicant_relation_to"> <mat-select placeholder="Relation to" formControlName="applicant_relation_to">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let rel of fetch_related_details" [value]="rel"> <mat-option *ngFor="let rel of individualsList" [value]="rel.individuals_order_id">
<!-- [disabled]="relation.controls.applicant_name.value == rel" --> <!-- [disabled]="relation.controls.applicant_name.value == rel" -->
{{rel | titlecase}} {{rel.applicant_name | titlecase}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%"> <mat-form-field style="width: 30%">
<mat-select placeholder="Relation" formControlName="relationship"> <mat-select placeholder="Relation" formControlName="relationship">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let relShip of relationShipList" [value]="relShip.relationship_id"> <mat-option *ngFor="let relShip of relationShipList" [value]="relShip.relationship_id">
@ -57,50 +106,46 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More Relation" matTooltipPosition="above" color="primary" (click)="addMoreRelation(r,m)" *ngIf="m==0"><mat-icon>add</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More Personal Relationship" matTooltipPosition="above" color="primary" (click)="addMoreRelation(r,m)" *ngIf="m==0"><mat-icon>add</mat-icon></button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeRelation(r,m)" *ngIf="m>0" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeRelation(r,m)" *ngIf="m>0"
matTooltip="Remove Relation" matTooltipPosition="above"> matTooltip="Remove Personal Relationship" matTooltipPosition="above">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
</div> </div>
<div formArrayName="multiple_company_relation">
<div fxLayout="row nowrap" *ngFor="let comRel of mulRel.get('multiple_company_relation').controls; let c = index" [formGroupName]="c">
<mat-form-field style="width: 40%">
<input matInput placeholder="Company / Firm" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 30%">
<mat-select placeholder="Relation" formControlName="company_relationship">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More Company" matTooltipPosition="above" color="primary" (click)="addMoreCompanyRelation(r,m,c)" *ngIf="c==0"><mat-icon>add</mat-icon></button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeCompanyRelation(r,m,c)" *ngIf="c>0"
matTooltip="Remove Company" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</div> </div>
</div> </div>
<p>Company Relationship</p>
<div formArrayName="multiple_company_relation">
<div fxLayout="row nowrap" *ngFor="let comRel of relation.get('multiple_company_relation').controls; let c = index" [formGroupName]="c">
<mat-form-field style="width: 40%">
<mat-select placeholder="Company / Firm" formControlName="company_name">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comp of companyList" [value]="comp.company_order_id">
{{comp.company_name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 30%">
<mat-select placeholder="Relation" formControlName="company_relationship">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More Company Relationship" matTooltipPosition="above" color="primary" (click)="addMoreCompanyRelation(r,c)" *ngIf="c==0"><mat-icon>add</mat-icon></button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeCompanyRelation(r,c)" *ngIf="c>0"
matTooltip="Remove Company Relationship" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</mat-card-content> </mat-card-content>
<mat-card-actions align="end" *ngIf="relation.controls.pd_co_applicant_id.value==0">
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeOthers(r,relation.value)"
matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</mat-card-actions>
</mat-card> </mat-card>
</div> </div>
</div> </div>
</mat-card-content>
</mat-card>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">

View File

@ -12,3 +12,15 @@
mat-form-field { mat-form-field {
margin: 0 2%; margin: 0 2%;
} }
mat-header-cell mat-cell {
display:flex;
justify-content:flex-end;
}
.table-checkbox {
margin-left: 15% !important;
}
.p-text {
color:#e00201 !important;
font-weight: bold;
}

View File

@ -1,6 +1,6 @@
import { Component, OnInit, Input, Output, Inject } from '@angular/core'; import { Component, OnInit, Input, Output, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , MatTableDataSource} from '@angular/material';
import { NotifierService } from 'angular-notifier'; import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from './../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from './../../../../../pd-service/pd-triger.service';
import {OtherApplicantDetailsComponent} from './../dialogue/other-applicant-details/other-applicant-details.component'; import {OtherApplicantDetailsComponent} from './../dialogue/other-applicant-details/other-applicant-details.component';
@ -15,11 +15,15 @@ export class GeneralInfoComponent implements OnInit {
form_id:number; form_id:number;
private notifier: NotifierService; private notifier: NotifierService;
public _generalForm: FormGroup; public _generalForm: FormGroup;
displayedColumns = ['applicant_name','is_person_met','is_applicant'];
public individualsSource= new MatTableDataSource();
public pd_applicants_details: any; public pd_applicants_details: any;
relationShipList:any=[]; relationShipList:any=[];
companyRelationShipList:any=[]; companyRelationShipList:any=[];
errorMessage:any; errorMessage:any;
fetch_related_details:any=[]; individualsList: any=[];
companyList: any=[];
constructor(notifier: NotifierService,private _fb: FormBuilder,private _pd: PdTrigerService , private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public pd_all_details: any,) { constructor(notifier: NotifierService,private _fb: FormBuilder,private _pd: PdTrigerService , private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public pd_all_details: any,) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.pdid = this.pd_all_details.pdmaster_details.pd_id;
@ -34,6 +38,17 @@ export class GeneralInfoComponent implements OnInit {
this.initFormDetails(); this.initFormDetails();
this.getMasterDetails('RELATIONSHIPS',1); this.getMasterDetails('RELATIONSHIPS',1);
this.getMasterDetails('COMPANYRELATIONSHIPS',2); this.getMasterDetails('COMPANYRELATIONSHIPS',2);
// update data source table when change the individuals details
this._generalForm.controls['individuals'].valueChanges.subscribe(val=>{
let control = <FormArray>this._generalForm.controls['individuals'];
this.individualsSource.data =control.controls;
this.individualsList = control.value.filter(element =>element.is_applicant===true);
});
// update company details
this._generalForm.controls['companies'].valueChanges.subscribe(val=>{
let control = <FormArray>this._generalForm.controls['companies'];
this.companyList = control.value.filter(element =>element.company_name);
});
} }
// init form // init form
@ -41,8 +56,9 @@ export class GeneralInfoComponent implements OnInit {
this._generalForm = this._fb.group({ this._generalForm = this._fb.group({
pdid:this.pdid, pdid:this.pdid,
formid:this.form_id, formid:this.form_id,
applicant_list: this._fb.array([]),
applicant_relation: this._fb.array([]), applicant_relation: this._fb.array([]),
individuals: this._fb.array([]),
companies: this._fb.array([]),
general_remark:'' general_remark:''
}); });
this.loadFormData(); this.loadFormData();
@ -68,96 +84,122 @@ export class GeneralInfoComponent implements OnInit {
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '18'; params.pd_form_id = '18';
let applicantControl = <FormArray>this._generalForm.controls['applicant_list']; let individualsControl = <FormArray>this._generalForm.controls['individuals'];
let companyControl = this._generalForm.get('companies') as FormArray;
let relationControl = <FormArray>this._generalForm.controls['applicant_relation']; let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
applicantControl.controls = []; individualsControl.controls = [];
relationControl.controls = []; relationControl.controls = [];
let exist_data:any; companyControl.controls = [];
let exist_applicant_relation:any; let exist_individuals:any;
let exist_companies:any;
let exist_relation:any;
this._pd.retriveForm(params).subscribe(data => { this._pd.retriveForm(params).subscribe(data => {
if(data.dataStatus) { if(data.dataStatus) {
this._generalForm.controls['general_remark'].setValue(data.records.general_remark ? data.records.general_remark : ''); this._generalForm.controls['general_remark'].setValue(data.records.general_remark ? data.records.general_remark : '');
exist_data=Object.keys(data.records.selected_applicant).map(function(key) { // create individuals
return data.records.selected_applicant[key].pd_co_applicant_id; exist_individuals=Object.keys(data.records.individuals).map(function(key) {
}); return data.records.individuals[key];
exist_applicant_relation = Object.keys(data.records.applicant_relation).map(function(key) { });
return data.records.applicant_relation[key];
if(exist_individuals.length>0){
exist_individuals.forEach(element => {
individualsControl.push(this.createIndividulas(element))
}); });
} }
else { // create companies
exist_data=[]; exist_companies = Object.keys(data.records.companies).map(function(key) {
exist_applicant_relation=[]; return data.records.companies[key];
});
if(exist_companies.length>0){
exist_companies.forEach(element => {
companyControl.push(this.createCompanies(element))
});
} }
//find exist and non-exist applicant details
let actual_applicant = this.pd_applicants_details.map(item => item.pd_co_applicant_id);
let checkApplicantExist =actual_applicant.map((id, index) => {
if (exist_data.indexOf(id) < 0) {
this.pd_applicants_details[index].exist_status=0;
return this.pd_applicants_details[index];
}
else{
this.pd_applicants_details[index].exist_status=1;
this.pd_applicants_details[index].applicant_relation_to='';
this.pd_applicants_details[index].relation='';
return this.pd_applicants_details[index];
}
}).filter(item => item != undefined);
if(checkApplicantExist.length > 0) // create relations
{ exist_relation = Object.keys(data.records.applicant_relation).map(function(key) {
checkApplicantExist.forEach(val => { return data.records.applicant_relation[key];
applicantControl.push(this.createApplicant(val)); });
}); if(exist_relation.length>0){
exist_relation.forEach((element,index) => {
} relationControl.push(this.createApplicantRelation(element));
if(exist_applicant_relation.length > 0){ let innerrelControl:any = relationControl.controls[index].get('multiple_relation') as FormArray;
exist_applicant_relation.forEach((val,key) => { element.multiple_relation.forEach((innereElement) => {
let control: any = this._generalForm.get('applicant_relation') as FormArray; innerrelControl.push(this.createMultipleRelation(innereElement));
control.push(this.createApplicantRelation(val)); });
control = control.controls[key].get('multiple_relation') as FormArray; let innercomrelControl:any = relationControl.controls[index].get('multiple_company_relation') as FormArray;
val.multiple_relation.forEach((firstInnerelement,firstInnerKey) => { element.multiple_company_relation.forEach((innerecomElement) => {
control.push(this.createMultipleRelation(firstInnerelement)); innercomrelControl.push(this.createMultipleCompanyRelation(innerecomElement));
let innerControl = this._generalForm.get('applicant_relation') as FormArray; });
innerControl = innerControl.controls[key].get('multiple_relation') as FormArray;
innerControl = innerControl.controls[firstInnerKey].get('multiple_company_relation') as FormArray;
firstInnerelement.multiple_company_relation.forEach((secondInnerValue,secondInnerKey) => {
innerControl.push(this.createMultipleCompanyRelation(secondInnerValue))
}); });
});
//push related to details
this.fetch_related_details.push(val.applicant_name);
});
}
} }
else {
this.pd_applicants_details.forEach((element,key) => {
element.is_applicant=true;
element.is_person_met=false;
element.individuals_order_id = key+1
individualsControl.push(this.createIndividulas(element));
let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name, 'individula_order_id':relationControl.controls.length+1};
relationControl.push(this.createApplicantRelation(applicant_details));
let mulRelationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_relation');
mulRelationControl.push(this.createMultipleRelation(applicant_details))
let mulCmyRelationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation');
mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details))
// create companies
if(element.company_name!='' && element.company_name!=null){
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:element.company_name}
companyControl.push(this.createCompanies(setCompanyValues))
}
});
// check company if null update one row
if(companyControl.controls.length ==0){
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:''}
companyControl.push(this.createCompanies(setCompanyValues))
}
}
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
// create individuals
createIndividulas(elementValue:any) {
return this._fb.group({
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name],
is_applicant:[elementValue.is_applicant],
is_person_met:[elementValue.is_person_met],
individuals_order_id: [elementValue.individuals_order_id],
});
}
// create companies
createCompanies(elementValue:any) {
return this._fb.group({
company_order_id: [elementValue.company_order_id],
company_name: [elementValue.company_name,Validators.required],
});
}
// check and uncheck function // add more companies
checkboxChange(event, index, item) { addMoreCompanies() {
if(item.exist_status.value){ let control: any = this._generalForm.get('companies') as FormArray;
let relationControl: any = <FormArray>this._generalForm.controls['applicant_relation']; let setValues: any = {company_order_id :control.controls.length+1,company_name:''}
let applicant_details: any= {'pd_co_applicant_id':item.pd_co_applicant_id.value,'applicant_name':item.applicant_name.value,'applicant_relation_to':'','relation':'','company_name':item.company_name.value,'company_relation':''}; control.push(this.createCompanies(setValues))
relationControl.push(this.createApplicantRelation(applicant_details)); }
relationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_relation');
relationControl.push(this.createMultipleRelation(applicant_details))
relationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation');
relationControl.push(this.createMultipleCompanyRelation(applicant_details))
// to push selected persons names
this.fetch_related_details.push(item.applicant_name.value);
} // remove companies
else { removeCompanies(indexValues) {
if(item.pd_co_applicant_id.value!=0){ let control: any = this._generalForm.get('companies') as FormArray;
let relationControl = <FormArray>this._generalForm.controls['applicant_relation']; control.removeAt(indexValues);
let pos_id = relationControl.value.map(e=> e.pd_co_applicant_id).indexOf(item.pd_co_applicant_id.value);
relationControl.removeAt(pos_id);
// remove related to details
let pos_name=this.fetch_related_details.indexOf(item.applicant_name.value);
this.fetch_related_details.splice(pos_name, 1);
}
}
} }
// create applicant form array // create applicant form array
@ -176,14 +218,15 @@ export class GeneralInfoComponent implements OnInit {
pd_co_applicant_id: [elementValue.pd_co_applicant_id], pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name], applicant_name: [elementValue.applicant_name],
multiple_relation: this._fb.array([]), multiple_relation: this._fb.array([]),
multiple_company_relation : this._fb.array([]),
individuals_order_id:[elementValue.individuals_order_id]
}); });
} }
// create multiple relation details // create multiple relation details
createMultipleRelation(elementValue: any) { createMultipleRelation(elementValue: any) {
return this._fb.group({ return this._fb.group({
applicant_relation_to: [elementValue.applicant_relation_to, Validators.required], applicant_relation_to: [elementValue.applicant_relation_to],
relationship: [elementValue.relationship], relationship: [elementValue.relationship],
multiple_company_relation : this._fb.array([]),
}); });
} }
@ -193,9 +236,6 @@ export class GeneralInfoComponent implements OnInit {
control = control.controls[rindex].get('multiple_relation') as FormArray; control = control.controls[rindex].get('multiple_relation') as FormArray;
let setValues: any = {applicant_relation_to :'',relationship:''} let setValues: any = {applicant_relation_to :'',relationship:''}
control.push(this.createMultipleRelation(setValues)) control.push(this.createMultipleRelation(setValues))
let setCompanyValue = {company_name :'',company_relationship:''};
control = <FormArray> control.controls[control.controls.length-1].get('multiple_company_relation');
control.push(this.createMultipleCompanyRelation(setCompanyValue))
} }
// remove relation // remove relation
@ -208,29 +248,27 @@ export class GeneralInfoComponent implements OnInit {
// create multiple company relation // create multiple company relation
createMultipleCompanyRelation(elementValue: any) { createMultipleCompanyRelation(elementValue: any) {
return this._fb.group({ return this._fb.group({
company_name: [elementValue.company_name,elementValue.company_name ? Validators.required : Validators.nullValidator], company_name: [elementValue.company_name,Validators.required],
company_relationship: [elementValue.company_relationship], company_relationship: [elementValue.company_relationship],
}); });
} }
// add more company relation // add more company relation
addMoreCompanyRelation(rindex,mindex,cindex) { addMoreCompanyRelation(rindex,cindex) {
let control: any = this._generalForm.get('applicant_relation') as FormArray; let control: any = this._generalForm.get('applicant_relation') as FormArray;
control = control.controls[rindex].get('multiple_relation') as FormArray; control = control.controls[rindex].get('multiple_company_relation') as FormArray;
control = control.controls[mindex].get('multiple_company_relation') as FormArray;
let setValues: any = {company_name :'',company_relationship:''} let setValues: any = {company_name :'',company_relationship:''}
control.push(this.createMultipleCompanyRelation(setValues)) control.push(this.createMultipleCompanyRelation(setValues))
} }
// remove company relation // remove company relation
removeCompanyRelation(rindex,mindex,cindex) { removeCompanyRelation(rindex,cindex) {
let control: any = this._generalForm.get('applicant_relation') as FormArray; let control: any = this._generalForm.get('applicant_relation') as FormArray;
control = control.controls[rindex].get('multiple_relation') as FormArray; control = control.controls[rindex].get('multiple_company_relation') as FormArray;
control = control.controls[mindex].get('multiple_company_relation') as FormArray;
control.removeAt(cindex); control.removeAt(cindex);
} }
// add more applicant details // add more individuals details
addOtherApplicant() { addMoreIndividuals() {
const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, { const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, {
data: '', data: '',
width:'40%', width:'40%',
@ -240,15 +278,16 @@ export class GeneralInfoComponent implements OnInit {
.subscribe(dataresult => { .subscribe(dataresult => {
if(dataresult.data.length>0){ if(dataresult.data.length>0){
dataresult.data.forEach(element => { dataresult.data.forEach(element => {
let individualsControl = <FormArray>this._generalForm.controls['individuals'];
element.individuals_order_id = individualsControl.controls.length+1;
individualsControl.push(this.createIndividulas(element));
let relationControl = <FormArray>this._generalForm.controls['applicant_relation']; let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','company_name':element.company_name,'company_relation':''}; let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','company_name':'','company_relation':'','individuals_order_id':element.individuals_order_id};
relationControl.push(this.createApplicantRelation(applicant_details)); relationControl.push(this.createApplicantRelation(applicant_details));
relationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_relation'); let mulRelationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_relation');
relationControl.push(this.createMultipleRelation(applicant_details)) mulRelationControl.push(this.createMultipleRelation(applicant_details))
relationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation'); let mulCmyRelationControl = <FormArray> relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation');
relationControl.push(this.createMultipleCompanyRelation(applicant_details)) mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details))
// push related to details
this.fetch_related_details.push(element.applicant_name);
}); });
} }
@ -256,17 +295,11 @@ export class GeneralInfoComponent implements OnInit {
} }
// remove individuals
// remove other details removeIndividuals(findex,order_id){
removeOthers(index, item: any){ let control = <FormArray>this._generalForm.controls['individuals'];
if(item.pd_co_applicant_id==0){ control.removeAt(findex);
let relationControl = <FormArray>this._generalForm.controls['applicant_relation']; }
relationControl.removeAt(index);
// remove related to details
let pos_name=this.fetch_related_details.indexOf(item.applicant_name);
this.fetch_related_details.splice(pos_name, 1);
}
}
// submit form details // submit form details
submitGeneralForm(formData:any) { submitGeneralForm(formData:any) {
@ -280,34 +313,12 @@ export class GeneralInfoComponent implements OnInit {
} }
else{ else{
let saveRecords:any = {} let saveRecords:any = {}
let applicantList:any=[];
let applicantRelationList:any=[];
// this for applicant list for selected
formData.applicant_list.forEach((element,key) => {
if(element.exist_status==1){
applicantList.push({
"pd_co_applicant_id":element.pd_co_applicant_id,
"applicant_name":element.applicant_name,
})
}
});
// this is for selected applicant relation
// formData.applicant_relation.forEach((element,key) => {
// applicantRelationList.push({
// "pd_co_applicant_id":element.pd_co_applicant_id,
// "applicant_name":element.applicant_name,
// "company_name":element.company_name,
// "company_relationship":element.company_relationship,
// "applicant_relation_to":element.applicant_relation_to,
// "relationship":element.relationship,
// })
// });
saveRecords.pdid=formData.pdid; saveRecords.pdid=formData.pdid;
saveRecords.formid=formData.formid; saveRecords.formid=formData.formid;
saveRecords.general_remark=formData.general_remark; saveRecords.individuals=formData.individuals;
saveRecords.selected_applicant=applicantList; saveRecords.companies=formData.companies;
saveRecords.applicant_relation=formData.applicant_relation; saveRecords.applicant_relation=formData.applicant_relation;
saveRecords.general_remark=formData.general_remark;
this._pd.savePDFormDetailsWithID(saveRecords).subscribe( this._pd.savePDFormDetailsWithID(saveRecords).subscribe(
dataresult => { dataresult => {
if (dataresult.status == 200) { if (dataresult.status == 200) {
@ -325,6 +336,7 @@ export class GeneralInfoComponent implements OnInit {
} }
} }
// validate all form group and form array fields // validate all form group and form array fields
validateAllFormFields(formGroup: any) { validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => { Object.keys(formGroup.controls).forEach(field => {

View File

@ -1,6 +1,7 @@
<form [formGroup]="_neighbourhoodForm" novalidate> <form [formGroup]="_neighbourhoodForm" novalidate>
<h2 mat-dialog-title class="paragraph_change"> <h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left"> <!-- <div fxFlex="70" align="left"> -->
<div fxFlex="70" align="left" style="padding: 10px !important;">
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100"> <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
{{pageTitle}} {{pageTitle}}
@ -9,7 +10,7 @@
</div> </div>
</div> </div>
<div fxFlex="30" align="end"> <div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
</div> </div>
</h2> </h2>
@ -17,6 +18,7 @@
<mat-dialog-content> <mat-dialog-content>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<br>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100"> <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-radio-group formControlName="check_type" class="example-radio-group"> <mat-radio-group formControlName="check_type" class="example-radio-group">
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button> <mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button>
@ -27,17 +29,17 @@
<mat-card *ngFor="let neighbourhood of _neighbourhoodForm.controls.neighbourhood_list['controls']; let n = index;" [formGroupName]="n"> <mat-card *ngFor="let neighbourhood of _neighbourhoodForm.controls.neighbourhood_list['controls']; let n = index;" [formGroupName]="n">
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 42%"> <mat-form-field style="width: 42%">
<input matInput placeholder="Neighbour Name" formControlName="neighbourhood_name" type="text"> <input matInput autocomplete="off" placeholder="Neighbour Name" formControlName="neighbourhood_name" type="text">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%"> <mat-form-field style="width: 40%">
<mat-select placeholder="Do You Know" formControlName="do_know"> <mat-select placeholder="Do You Know the Applicant" formControlName="do_know">
<mat-option value="Yes">Yes</mat-option> <mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option> <mat-option value="No">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'"> <mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<input matInput placeholder="How Long to Know the Applicant " formControlName="how_long_do_know" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="How Long to Know the Applicant " formControlName="how_long_do_know" type="text" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'"> <mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<mat-select placeholder="Is the Applicant Owner" formControlName="is_applicant_owner"> <mat-select placeholder="Is the Applicant Owner" formControlName="is_applicant_owner">
@ -54,23 +56,24 @@
<mat-card-content formArrayName="referencecheck_list" *ngIf="_neighbourhoodForm.controls.check_type.value==1"> <mat-card-content formArrayName="referencecheck_list" *ngIf="_neighbourhoodForm.controls.check_type.value==1">
<mat-card *ngFor="let reference of _neighbourhoodForm.controls.referencecheck_list['controls']; let r = index;" [formGroupName]="r"> <mat-card *ngFor="let reference of _neighbourhoodForm.controls.referencecheck_list['controls']; let r = index;" [formGroupName]="r">
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 25%">
<input matInput placeholder="Name" formControlName="reference_name" type="text"> <input matInput autocomplete="off" placeholder="Name" formControlName="reference_name" type="text">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%"> <mat-form-field style="width: 24%">
<input matInput placeholder="Mobile Number" formControlName="mobile" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="reference['controls'].mobile.hasError('maxlength') || reference['controls'].mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error> <mat-error *ngIf="reference['controls'].mobile.hasError('maxlength') || reference['controls'].mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 10%"> <mat-form-field style="width: 12%">
<input matInput placeholder="STD" formControlName="std_code" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder=" STD " formControlName="std_code" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="reference['controls'].std_code.hasError('maxlength') || reference['controls'].std_code.hasError('minlength')">Enter Valid STD Code. </mat-error> <span matPrefix>+91</span>
</mat-form-field><span>-</span> <mat-error *ngIf="reference['controls'].std_code.hasError('maxlength') || reference['controls'].std_code.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> <span>-</span>
<mat-form-field style="width: 20%"> <mat-form-field style="width: 20%">
<input matInput placeholder="Landline Number" formControlName="landline" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="Landline Number" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="reference['controls'].landline.hasError('maxlength') || reference['controls'].landline.hasError('minlength')">Enter Valid Landline Number. </mat-error> <mat-error *ngIf="reference['controls'].landline.hasError('maxlength') || reference['controls'].landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<textarea matInput placeholder="Location" formControlName="location"></textarea> <textarea matInput autocomplete="off" placeholder="Location" formControlName="location"></textarea>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
@ -82,17 +85,18 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 30%" *ngIf="reference.controls.relationship_with.value==5"> <mat-form-field style="width: 30%" *ngIf="reference.controls.relationship_with.value==5">
<input matInput placeholder="Others" formControlName="others" type="text"> <input matInput autocomplete="off" placeholder="Specify Business Relation" formControlName="others" type="text">
</mat-form-field> </mat-form-field>
<p #period_paragraph>Period of Relationship</p> <p #period_paragraph>Period of Relationship</p>
<mat-form-field style="width: 12%"> <mat-form-field style="width: 12%">
<input matInput placeholder="Year" formControlName="year_relation_applicant" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="Year(s)" formControlName="year_relation_applicant" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 12%"> <mat-form-field style="width: 12%">
<input matInput placeholder="Month" formControlName="months_relation_applicant" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="Month(s)" formControlName="months_relation_applicant" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(reference,$event.target.value)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<input matInput [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'" formControlName="business_volume_amount" type="text" (keypress)="keyPress($event)"> <input matInput autocomplete="off" [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'" formControlName="business_volume_amount" type="text" (keypress)="keyPress($event)" (keyup)="inWords($event,r)">
<mat-hint align="start" style="font-size:70%" *ngIf="reference.controls.business_volume_amount.value != ''">{{"&#8377;"}} {{amtInwords[r]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 22%"> <mat-form-field style="width: 22%">
<mat-select placeholder="Unit" formControlName="business_volume_unit"> <mat-select placeholder="Unit" formControlName="business_volume_unit">
@ -102,6 +106,23 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 30%" *ngIf="reference.controls.business_volume_unit.value==8">
<input matInput autocomplete="off" placeholder="Specify Unit" formControlName="others_unit" type="text">
</mat-form-field>
<span style="width:100%">
<mat-form-field style="width: 55%">
<mat-select placeholder=" Final remarks of PD officer on Reference Check done" formControlName="reference_final_remarks">
<mat-option>Select</mat-option>
<mat-option *ngFor="let remark of finalRemarksList" [value]="remark.id">
{{remark.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 30%" *ngIf="reference.controls.reference_final_remarks.value != '' ">
<input matInput autocomplete="off" placeholder="Specify Remarks" formControlName="specify_final_remark" type="text">
</mat-form-field>
</span>
<button type="button" mat-raised-button mat-icon-button (click)="removeReferencecheck(r)" <button type="button" mat-raised-button mat-icon-button (click)="removeReferencecheck(r)"
matTooltip="Remove Reference Check" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="r!=0"> matTooltip="Remove Reference Check" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="r!=0">
<mat-icon>delete</mat-icon></button> <mat-icon>delete</mat-icon></button>
@ -122,7 +143,7 @@
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="neighbour_reference_remark" required></textarea> <textarea matInput autocomplete="off" placeholder="Remarks" formControlName="neighbour_reference_remark" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -16,12 +16,16 @@ export class NeighbourHoodComponent implements OnInit {
form_id:number; form_id:number;
private notifier: NotifierService; private notifier: NotifierService;
check_type:any=[{'id':0,'type_name':'Neighbourhood'},{'id':1,'type_name':'Reference Check'}] check_type:any=[{'id':0,'type_name':'Neighbourhood'},{'id':1,'type_name':'Reference Check'}]
default_reference_details: any= {'reference_name':'','mobile':'','landline':'-','location':'','relationship_with':'','year_relation_applicant':'','months_relation_applicant':'','business_volume_amount':'','business_volume_unit':''}; default_reference_details: any= {'reference_name':'','mobile':'','landline':'-','location':'','relationship_with':'','year_relation_applicant':'','months_relation_applicant':'','business_volume_amount':'','business_volume_unit':'','reference_final_remarks':'','positive_remark':'','negative_remark':'','insufficient_info_remark':''};
default_neighbourhood_details: any= {'neighbourhood_name':'','do_know':'','how_long_do_know':'','is_applicant_owner':''}; default_neighbourhood_details: any= {'neighbourhood_name':'','do_know':'','how_long_do_know':'','is_applicant_owner':''};
busineesRelationshipList:any=[]; busineesRelationshipList:any=[];
volumeunitList:any=[]; volumeunitList:any=[];
errorMessage:any; errorMessage:any;
finalRemarksList : any = [{'id': 1,'name': "Positive"},
{'id': 2,'name': "Negative"},
{'id': 3,'name': "Insufficient information provided"}];
amtInwords : any = [];
constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,) { constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,) {
this.pdid = this.data.pdmaster_details.pd_id; this.pdid = this.data.pdmaster_details.pd_id;
this.notifier = notifier; this.notifier = notifier;
@ -90,7 +94,8 @@ export class NeighbourHoodComponent implements OnInit {
}); });
} }
else if(exist_ref_details.length>0 && data.records.check_type==1){ else if(exist_ref_details.length>0 && data.records.check_type==1){
exist_ref_details.forEach(element => { exist_ref_details.forEach((element,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(element.business_volume_amount);
referencecheckControl.push(this.createReerenceCheck(element)); referencecheckControl.push(this.createReerenceCheck(element));
}); });
} }
@ -143,6 +148,12 @@ export class NeighbourHoodComponent implements OnInit {
months_relation_applicant:[elementValue.months_relation_applicant,Validators.required], months_relation_applicant:[elementValue.months_relation_applicant,Validators.required],
business_volume_amount:[elementValue.business_volume_amount,Validators.required], business_volume_amount:[elementValue.business_volume_amount,Validators.required],
business_volume_unit:[elementValue.business_volume_unit, Validators.required], business_volume_unit:[elementValue.business_volume_unit, Validators.required],
others_unit : [elementValue.others_unit],
reference_final_remarks:[elementValue.reference_final_remarks],
specify_final_remark : [elementValue.specify_final_remark],
// positive_remark:[elementValue.positive_remark],
// negative_remark:[elementValue.negative_remark],
// insufficient_info_remark:[elementValue.insufficient_info_remark]
}); });
} }
@ -229,6 +240,12 @@ export class NeighbourHoodComponent implements OnInit {
"months_relation_applicant":element.months_relation_applicant, "months_relation_applicant":element.months_relation_applicant,
"business_volume_amount":element.business_volume_amount, "business_volume_amount":element.business_volume_amount,
"business_volume_unit":element.business_volume_unit, "business_volume_unit":element.business_volume_unit,
"others_unit":element.others_unit,
"reference_final_remarks":element.reference_final_remarks,
"specify_final_remark":element.specify_final_remark
// "positive_remark":element.positive_remark,
// "negative_remark":element.negative_remark,
// "insufficient_info_remark":element.insufficient_info_remark
}) })
}); });
saveRecords.referencecheck_list=referencecheck_list; saveRecords.referencecheck_list=referencecheck_list;
@ -270,5 +287,24 @@ validateAllFormFields(formGroup: any) {
}); });
} }
/** To Convert Month into Year */
ConvertMonthintoYear(itemrow,e){
// console.log(itemrow);
// console.log(e);
let year = itemrow.controls.year_relation_applicant.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.year_relation_applicant.setValue(+year + +Math.floor(converted_year));
itemrow.controls.months_relation_applicant.setValue(Math.floor(converted_month));
}
/** Amount InWords */
inWords(e,i){
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value);
}
} }

View File

@ -31,32 +31,34 @@
</mat-card> </mat-card>
<mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'"> <mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">
<mat-card-header><p>Income Details<p></mat-card-header> <mat-card-header><mat-card-title><p>Income Details</p></mat-card-title></mat-card-header>
<div formArrayName="income_details"> <div formArrayName="income_details">
<div *ngFor="let details of otherIncomeForm.get('income_details').controls; let i=index" <div *ngFor="let details of otherIncomeForm.get('income_details').controls; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field style="width:25%">
<mat-select placeholder="Source" <mat-select placeholder="Source"
formControlName="source" required> formControlName="source" required>
<mat-option value="rental_income">Rental Income</mat-option> <mat-option value="{{src.id}}" *ngFor="let src of sourceData">{{src.name}}</mat-option>
<!-- <mat-option value="rental_income">Rental Income</mat-option>
<mat-option value="interest_income">Interest Income</mat-option> <mat-option value="interest_income">Interest Income</mat-option>
<mat-option value="agricultural_income">Agricultural Income</mat-option> <mat-option value="agricultural_income">Agricultural Income</mat-option>
<mat-option value="dividend_income">Dividend Income</mat-option> <mat-option value="dividend_income">Dividend Income</mat-option>
<mat-option value="others">Others</mat-option> <mat-option value="others">Others</mat-option> -->
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('source').value == 'others'"> <mat-form-field style="width:25%" *ngIf="details.get('source').value == 5">
<input matInput placeholder="Specify Others Source" <input matInput autocomplete="off" placeholder="Specify Source"
formControlName="others_source"> formControlName="others_source">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field style="width:25%">
<input matInput placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required> <input matInput autocomplete="off" placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required (keyup)="inWords($event,i)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field style="width:25%">
<mat-select placeholder="Frequency" formControlName="frequency" required> <mat-select placeholder="Frequency" formControlName="frequency" required>
<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option> <mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>
</mat-select> </mat-select>
@ -64,8 +66,8 @@
<!-- {{otherIncomeForm.controls.frequency.value}} --> <!-- {{otherIncomeForm.controls.frequency.value}} -->
<mat-form-field *ngIf="details.get('frequency').value == 8"> <mat-form-field style="width:25%" *ngIf="details.get('frequency').value == 8">
<input matInput placeholder="Specify Others Frequency" <input matInput autocomplete="off" placeholder="Specify Frequency"
formControlName="others_frequency"> formControlName="others_frequency">
</mat-form-field> </mat-form-field>
@ -196,7 +198,7 @@
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="otherincome_remarks" required></textarea> <textarea matInput autocomplete="off" placeholder="Remarks" formControlName="otherincome_remarks" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">
@ -241,7 +243,7 @@
</mat-form-field>--> </mat-form-field>-->
<!--<mat-form-field>--> <!--<mat-form-field>-->
<!--<input matInput placeholder="Amount" formControlName="amount">--> <!--<input matInput autocomplete="off" placeholder="Amount" formControlName="amount">-->
<!--</mat-form-field>--> <!--</mat-form-field>-->
<!--<mat-form-field>--> <!--<mat-form-field>-->
<!--<mat-select placeholder="Frequency" formControlName="frequency">--> <!--<mat-select placeholder="Frequency" formControlName="frequency">-->
@ -261,7 +263,7 @@
<!--</div>--> <!--</div>-->
<!--</mat-card>--> <!--</mat-card>-->
<!--<mat-form-field>--> <!--<mat-form-field>-->
<!--<input matInput placeholder="Remarks" formControlName="otherincome_remarks">--> <!--<input matInput autocomplete="off" placeholder="Remarks" formControlName="otherincome_remarks">-->
<!--</mat-form-field>--> <!--</mat-form-field>-->
<!--<button mat-raised-button type="submit" class="button" (click)="submitCurrentDetails()">Submit</button>--> <!--<button mat-raised-button type="submit" class="button" (click)="submitCurrentDetails()">Submit</button>-->
<!--</form>--> <!--</form>-->
@ -289,12 +291,12 @@
<!-- </mat-select> <!-- </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('source').value == 5 "> <mat-form-field *ngIf="details.get('source').value == 5 ">
<input matInput placeholder="Specify Others Source" <input matInput autocomplete="off" placeholder="Specify Others Source"
formControlName="others_source"> formControlName="others_source">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required> <input matInput autocomplete="off" placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Frequency" formControlName="frequency" required> <mat-select placeholder="Frequency" formControlName="frequency" required>
@ -305,7 +307,7 @@
<!-- {{otherIncomeForm.controls.frequency.value}} --> <!-- {{otherIncomeForm.controls.frequency.value}} -->
<!-- <mat-form-field *ngIf="details.get('frequency').value == 8"> <!-- <mat-form-field *ngIf="details.get('frequency').value == 8">
<input matInput placeholder="Specify Others Frequency" <input matInput autocomplete="off" placeholder="Specify Others Frequency"
formControlName="others_frequency"> formControlName="others_frequency">
</mat-form-field> </mat-form-field>
<button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="addIncomeDetails()" <button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
@ -324,7 +326,7 @@
<div fxFlex="60" class="pb-0 text-sm-left"> <div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="otherincome_remarks" required></textarea> <textarea matInput autocomplete="off" placeholder="Remarks" formControlName="otherincome_remarks" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>

View File

@ -43,6 +43,7 @@ export class OtherIncomeComponent implements OnInit {
private notifier: NotifierService; private notifier: NotifierService;
frequencyData: any = []; frequencyData: any = [];
sourceData : any = []; sourceData : any = [];
amtInwords : any = [];
constructor(notifier: NotifierService, constructor(notifier: NotifierService,
private fb: FormBuilder, private fb: FormBuilder,
@ -95,7 +96,8 @@ public viewerOptions: any = {
return value.records.income_details[key]; return value.records.income_details[key];
}); });
if (result.length > 0) { if (result.length > 0) {
result.forEach(val => { result.forEach((val,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(val.amount);
control.push(this.createDetail()); control.push(this.createDetail());
}); });
this.otherIncomeForm.controls['income_details'].setValue(result); this.otherIncomeForm.controls['income_details'].setValue(result);
@ -208,4 +210,9 @@ public viewerOptions: any = {
event.preventDefault(); event.preventDefault();
} }
} }
/** Amount InWords */
inWords(e,i){
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value);
}
} }