Form validation

This commit is contained in:
saravanakumarkandasami 2018-11-19 17:52:57 +05:30
parent f99edf725b
commit 98d18945e9
12 changed files with 119 additions and 64 deletions

View File

@ -85,14 +85,14 @@
</mat-expansion-panel-header>
<mat-form-field>
<input matInput placeholder="Applicant Name"
formControlName="applicant_name">
formControlName="applicant_name" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Bank Name" formControlName="bank_name">
<input matInput placeholder="Bank Name" formControlName="bank_name" required>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Account Type" formControlName="account_type">
<mat-select placeholder="Account Type" formControlName="account_type" required>
<mat-option *ngFor="let prop of m_accountType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
<!--<mat-select placeholder="Account Type"
@ -107,7 +107,7 @@
<mat-form-field>
<mat-select placeholder="Salary Credited in this account"
formControlName="salary">
formControlName="salary" required>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
<mat-option value="NA">NA</mat-option>
@ -115,18 +115,18 @@
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Limit in case of OD / CC account"
formControlName="limit">
formControlName="limit" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Is this the main business account"
formControlName="is_main">
formControlName="is_main" required>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Approximate Vintage"
formControlName="vintage">
formControlName="vintage" required>
</mat-form-field>
<button *ngIf="i > 0" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteBankdetails(i)">
<mat-icon >delete</mat-icon>
@ -142,7 +142,7 @@
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="banking_form_remark"></textarea>
<textarea matInput placeholder="Remarks" formControlName="banking_form_remark" required></textarea>
</mat-form-field>
</div>
</div>

View File

@ -150,4 +150,13 @@ export class BankingDetailsComponent implements OnInit {
}
});
}
/** 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

@ -4,7 +4,7 @@
<form [formGroup]="currentLoanForm" class="address">
<mat-form-field>
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Do you have any other existing loan"
formControlName="existing_loan">
formControlName="existing_loan" required>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
@ -18,22 +18,22 @@
[formGroupName]="i">
<mat-card-content class="matcard">
<mat-form-field>
<input matInput placeholder="Loan Amount" formControlName="loan_amount">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="EMI" formControlName="emi">
<input matInput placeholder="EMI" formControlName="emi" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Loan Type" formControlName="loan_type">
<input matInput placeholder="Loan Type" formControlName="loan_type" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Lender" formControlName="lender">
<input matInput placeholder="Lender" formControlName="lender" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Original Tenure in Months" formControlName="original_tenure">
<input matInput placeholder="Original Tenure in Months" formControlName="original_tenure" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure">
<input matInput placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure" required>
</mat-form-field>
<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">
@ -51,7 +51,7 @@
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="currentloan_remarks"></textarea>
<textarea matInput placeholder="Remarks" formControlName="currentloan_remarks" required></textarea>
</mat-form-field>
</div>
</div>

View File

@ -138,4 +138,13 @@ export class CurrentLoanComponent implements OnInit {
}
});
}
/** On Key Press Event For Amount */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -2,55 +2,55 @@
<p>Employement Information</p>
<form [formGroup]="employmentForm" class="address">
<mat-form-field>
<input matInput placeholder="Name of Employer" formControlName="employer_name">
<input matInput placeholder="Name of Employer" formControlName="employer_name" required>
</mat-form-field>
<div>
<label>Since how long working with this employer?</label>
<br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="how_long_year">
<input matInput type="number" placeholder="Year" formControlName="how_long_year" required>
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="how_long_month">
<input matInput type="number" placeholder="Month" formControlName="how_long_month" required>
</mat-form-field>
</div>
</div>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'">
<mat-select placeholder="Was the employer met?"
formControlName="was_met">
formControlName="was_met" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="employmentForm.controls['was_met'].value == 'yes'">
<mat-form-field>
<input matInput placeholder="Name of person met" formControlName="name_person_met">
<mat-form-field fxFlex="50">
<input matInput placeholder="Name of Person Met" formControlName="name_person_met" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Designation of person met" formControlName="designation_person_met">
<mat-form-field fxFlex="50">
<input matInput placeholder="Designation of Person Met" formControlName="designation_person_met" required>
</mat-form-field>
</div>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'">
<mat-select placeholder="Salary amount confirmed ?"
formControlName="confirm_salary">
formControlName="confirm_salary" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="employmentForm.controls['confirm_salary'].value == 'yes'">
<input matInput placeholder="What is the salary amount confirmed?" formControlName="confirm_salary_amount">
<input matInput placeholder="What is the salary amount confirmed?" formControlName="confirm_salary_amount" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'">
<mat-select placeholder="Attendance register seen ?"
formControlName="attendance_seen">
formControlName="attendance_seen" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'">
<mat-select placeholder="Salary register seen ?"
formControlName="sal_reg_seen">
formControlName="sal_reg_seen" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
@ -61,18 +61,18 @@
</mat-card-header>
<mat-card-content class="matcard">
<mat-form-field>
<input matInput placeholder="Gross Monthly Salary" formControlName="gross_monthly_salary">
<input matInput placeholder="Gross Monthly Salary" formControlName="gross_monthly_salary" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Net Monthly Salary"
formControlName="net_monthly_salary">
formControlName="net_monthly_salary" (keypress)="keyPress($event)" required>
<!-- <input matInput placeholder="Net Take Home"
formControlName="net_take_home"> -->
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Bonus or Incentive"
formControlName="bonus_incentive">
formControlName="bonus_incentive" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Any Delays"
@ -84,7 +84,7 @@
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="employment_remarks"></textarea>
<textarea matInput placeholder="Remarks" formControlName="employment_remarks" required></textarea>
</mat-form-field>
</div>
</div>

View File

@ -128,5 +128,14 @@ export class EmploymentInfoComponent implements OnInit {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
/** 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

@ -2,10 +2,10 @@
<p>Loan Details</p>
<form [formGroup]="loanDetailsForm" class="address">
<mat-form-field>
<input matInput placeholder="Loan Amount Applied" formControlName="loan_amount">
<input matInput placeholder="Loan Amount Applied" formControlName="loan_amount" (keypress)="keyPress($event)" required >
</mat-form-field>
<mat-form-field>
<mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use">
<mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use" required>
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.id">{{ enduse.name }}</mat-option>
</mat-select>
<!--<mat-select multiple placeholder="What is the end use"
@ -25,34 +25,34 @@
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Is there a balance transfer"
formControlName="is_transfer">
formControlName="is_transfer" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<input matInput placeholder="Balance Transfer Amount" formControlName="balance_transfer_amount">
<input matInput placeholder="Balance Transfer Amount" (keypress)="keyPress($event)" formControlName="balance_transfer_amount">
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<mat-select placeholder="Is there a Top Up"
formControlName="is_topup">
formControlName="is_topup" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_topup'].value == 'yes'">
<input matInput placeholder="Top Up Amt" formControlName="topup_amount">
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount">
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<input matInput placeholder="Lender from where balance transfer done" formControlName="lender">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution">
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Source" formControlName="source">
<mat-select placeholder="Source" formControlName="source" required>
<mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option>
</mat-select>
@ -67,7 +67,7 @@
<input matInput placeholder="Specify Lender Name and Type" formControlName="lender_name_type">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level">
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-card>
<mat-card-header>
@ -76,7 +76,7 @@
</mat-card-header>
<mat-card-content class="matcard">
<mat-form-field>
<mat-select placeholder="Type of Property" formControlName="property_type">
<mat-select placeholder="Type of Property" formControlName="property_type" required>
<mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.id">{{ typeprop.name }}</mat-option>
</mat-select>
@ -102,13 +102,13 @@
</mat-form-field>
<mat-form-field>
<mat-select multiple placeholder="Name of Owner"
formControlName="owner_name" (selectionChange)="ownerNameChange($event)">
formControlName="owner_name" (selectionChange)="ownerNameChange($event)" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Status of Construction" formControlName="construction_status">
<mat-select placeholder="Status of Construction" formControlName="construction_status" required>
<mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }}</mat-option>
</mat-select>
@ -122,11 +122,11 @@
<mat-form-field>
<input matInput placeholder="EMV as Per Customer"
formControlName="emv_per_customer">
formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Value as Per Agreement"
formControlName="value_per_agreement">
formControlName="value_per_agreement" (keypress)="keyPress($event)" required>
</mat-form-field>
</mat-card-content>
</mat-card>
@ -134,7 +134,7 @@
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="loandetails_remarks"></textarea>
<textarea matInput placeholder="Remarks" formControlName="loandetails_remarks" required></textarea>
</mat-form-field>
</div>
</div>

View File

@ -269,4 +269,13 @@ getM_sourceofamount() {
}
});
}
/** On Key Press Event For Amount */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -65,7 +65,7 @@
<mat-card-content class="matcard">
<mat-form-field>
<mat-select placeholder="Source"
formControlName="source">
formControlName="source" required>
<mat-option value="rental_income">Rental Income</mat-option>
<mat-option value="interest_income">Interest Income</mat-option>
<mat-option value="agricultural_income">Agricultural Income</mat-option>
@ -73,10 +73,10 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Amount" formControlName="amount">
<input matInput placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Frequency" formControlName="frequency">
<mat-select placeholder="Frequency" formControlName="frequency" required>
<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
@ -96,7 +96,7 @@
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="otherincome_remarks"></textarea>
<textarea matInput placeholder="Remarks" formControlName="otherincome_remarks" required></textarea>
</mat-form-field>
</div>
</div>

View File

@ -148,4 +148,14 @@ export class OtherIncomeComponent implements OnInit {
}
});
}
/** On Key Press Event For Amount */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -11,19 +11,19 @@
[formGroupName]="i">
<mat-card-content class="matcard">
<mat-form-field>
<input matInput placeholder="Name" formControlName="raw_name">
<input matInput placeholder="Name" formControlName="raw_name" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Quantity" formControlName="raw_quantity">
<input matInput placeholder="Quantity" formControlName="raw_quantity" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Value" formControlName="raw_value">
<input matInput placeholder="Value" formControlName="raw_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:76%">
<input matInput placeholder="Value of raw materials as per financial Statements" formControlName="rawmaterial_value">
<input matInput placeholder="Value of raw materials as per financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:76%">
<input matInput placeholder="Is the stock of raw materials sufficient ?" formControlName="is_sufficiant_raw">
<input matInput placeholder="Is the stock of raw materials sufficient ?" formControlName="is_sufficiant_raw" required>
</mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addRawMaterials()"
@ -47,19 +47,19 @@
[formGroupName]="i">
<mat-card-content class="matcard">
<mat-form-field>
<input matInput placeholder="Name" formControlName="goods_name">
<input matInput placeholder="Name" formControlName="goods_name" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Quantity" formControlName="goods_quantity">
<input matInput placeholder="Quantity" formControlName="goods_quantity" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Value" formControlName="goods_value">
<input matInput placeholder="Value" formControlName="goods_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:76%">
<input matInput placeholder="Value of finished goods as per financial statements" formControlName="finished_goods_value">
<input matInput placeholder="Value of finished goods as per financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:76%">
<input matInput placeholder="Is the stock of finished goods sufficient ?" formControlName="is_sufficiant_goods">
<input matInput placeholder="Is the stock of finished goods sufficient ?" formControlName="is_sufficiant_goods" required>
</mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addGoods()"

View File

@ -148,4 +148,13 @@ export class StockComponent implements OnInit {
}
});
}
/** 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();
}
}
}