Red highlighted Changes In PD Forms : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-11-20 16:29:52 +05:30
parent a1ec93cc06
commit 14a2e00e13
9 changed files with 155 additions and 48 deletions

View File

@ -87,7 +87,7 @@
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
@ -126,9 +126,9 @@
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode">
<input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode Required.</mat-error> -->
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
<mat-error *ngIf="pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
@ -158,19 +158,25 @@
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>Main Applicant</h5>
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="applicant_name">
<mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="mobile_no" type="text">
<!-- <mat-error *ngIf="pdMain.mobile_no.hasError('required')">Mobile Required.</mat-error> -->
<mat-error *ngIf="pdMain.mobile_no.hasError('pattern') || pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" required>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.landline.hasError('maxlength') || pdMain.landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
<!-- Phone field to be split into 2 parts. Mobile Number mandatory and optional land line number with std code. -->
<mat-form-field style="width: 100%">
<input matInput placeholder="Email" formControlName="email" type="email">
@ -190,24 +196,31 @@
<h5>{{coDetails.controls.label.value}} {{i+1}}</h5>
<div [formGroupName]="i">
<mat-form-field style="width: 100%">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="coapplicantName" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="coapplicant_mobile_no" type="text">
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('pattern') || coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-form-field style="width: 100%">
<mat-select placeholder="Relationship" formControlName="relationship">
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field>
</mat-select>
</mat-form-field>
<div style="width:20%">
<span (click)="removeCoApplicant(i)">

View File

@ -77,14 +77,15 @@ export class AddPdComponent implements OnInit, OnDestroy {
fk_customer_segment: [null],
loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_name: [null],
mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
email: [null],
  addressline1: [null],
addressline2: [null],
addressline3: [null],
fk_city: [null],
fk_state: [null],
  pincode : [null,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
  pincode : [null,Validators.compose([Validators.minLength(6),Validators.maxLength(6)])],
remarks:[null],
  // allocation_type: [null],
  // sub_allocation_type: [null],
@ -206,7 +207,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
return this._fb.group({
label: ['Co Applicant'],
coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
relationship: [null],
});
};
@ -315,6 +317,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"applicant_name":formValue.applicant_name,
"email":formValue.email,
"mobile_no":formValue.mobile_no,
"landline":formValue.landline,
"applicant_type":1,
"relation":"",
}];
@ -324,6 +327,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"relation":itemElement.relationship,
"email":"",
"mobile_no":itemElement.coapplicant_mobile_no,
"landline":itemElement.coapplicant_landline,
"applicant_type":0,
}
pd_applicant_details.push(obj1)
@ -410,4 +414,13 @@ export class AddPdComponent implements OnInit, OnDestroy {
onReset() {
this.loadFormData();
}
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9/ /./-]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -3,6 +3,7 @@
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="closeEditComponent()"><mat-icon>close</mat-icon></button>
</div>
<form [formGroup]="_EditApplicantForm" (submit)="updatePdApplicant(_EditApplicantForm.value)">
<div fxLayout="row" fxLayoutWrap="wrap">
@ -22,14 +23,19 @@
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="mobile_no" type="text" required>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" required>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('required')">Mobile number is required.</mat-error>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('pattern') || pdMainApplicant.mobile_no.hasError('maxlength') || pdMainApplicant.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('maxlength') || pdMainApplicant.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMainApplicant.landline.hasError('maxlength') || pdMainApplicant.landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
</mat-form-field>
</mat-card>
</div>
</div>
@ -45,11 +51,18 @@
<mat-error *ngIf="coDetails['controls'].coapplicantName.hasError('required')">Name is Required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="coapplicant_mobile_no" type="text">
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('pattern') || coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('pattern') || coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%" >
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf=" coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
<mat-form-field style="width: 100%">
<mat-select placeholder="Relationship With Main Applicant" formControlName="relationship">

View File

@ -42,7 +42,8 @@ export class EditPdApplicantComponent implements OnInit {
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [null],
applicant_name: [null, Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
mobile_no: [null, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])],
landline: [null, Validators.compose([Validators.required,Validators.minLength(12),Validators.maxLength(13)])],
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
applicant_type: [1],
coApplicantItems: this._fb.array([]),
@ -54,7 +55,8 @@ export class EditPdApplicantComponent implements OnInit {
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [this.mainApplicantData[0].pd_co_applicant_id],
applicant_name: [this.mainApplicantData[0].applicant_name, Validators.compose([Validators.required])],
mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])],
landline: [this.mainApplicantData[0].landline, Validators.compose([Validators.required,Validators.minLength(12),Validators.maxLength(13)])],
email: [this.mainApplicantData[0].email, Validators.compose([Validators.required, CustomValidators.email])],
applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])],
coApplicantItems: this._fb.array([]),
@ -74,6 +76,7 @@ export class EditPdApplicantComponent implements OnInit {
fk_applicant_primary_id: [listData.pd_co_applicant_id],
coapplicantName: [listData.applicant_name, Validators.compose([Validators.required])],
coapplicant_mobile_no: [listData.mobile_no,Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_landline: [listData.landline,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
relationship: [listData.relation],
applicant_type: [listData.applicant_type, Validators.compose([Validators.required])],
});
@ -84,6 +87,7 @@ export class EditPdApplicantComponent implements OnInit {
fk_applicant_primary_id: [null],
coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_landline: [null, Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
relationship: [null],
applicant_type: [0],
});
@ -108,6 +112,7 @@ export class EditPdApplicantComponent implements OnInit {
"applicant_name":formValue.applicant_name,
"email":formValue.email,
"mobile_no":formValue.mobile_no,
"landline":formValue.landline,
"applicant_type":formValue.applicant_type,
"relation":formValue.relationship,
"isactive":1
@ -120,6 +125,7 @@ export class EditPdApplicantComponent implements OnInit {
"relation":itemElement.relationship,
"email":"",
"mobile_no":itemElement.coapplicant_mobile_no,
"landline":itemElement.coapplicant_landline,
"applicant_type":itemElement.applicant_type,
"isactive":1
}
@ -164,4 +170,13 @@ export class EditPdApplicantComponent implements OnInit {
closeEditComponent(): void {
this.dialogRef.close();
}
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9/ /./-]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -119,10 +119,8 @@
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode">
<input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>

View File

@ -199,6 +199,15 @@ export class EditPdMasterComponent implements OnInit {
closeEditMasterComponent(): void {
this.dialogRef.close();
}
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9/ /./-]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
}

View File

@ -117,7 +117,7 @@
<input matInput placeholder="Limit in case of OD / CC account"
formControlName="limit" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="pd_cus_segment!='SAL-CHQ'">
<mat-select placeholder="Is this the main business account"
formControlName="is_main" required>
<mat-option value="Yes">Yes</mat-option>

View File

@ -9,10 +9,10 @@
<br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="how_long_year" required>
<input matInput type="number" placeholder="Year" formControlName="how_long_year" required min='0'>
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="how_long_month" required>
<input matInput type="number" placeholder="Month" formControlName="how_long_month" required min='0' max='12'>
</mat-form-field>
</div>
</div>
@ -60,8 +60,11 @@
<p>Salary Details<p>
</mat-card-header>
<mat-card-content class="matcard">
<mat-form-field>
<input matInput placeholder="Date of Salary" formControlName="when_salary_rcv_date" type="number" min='1' max='31'>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Gross Monthly Salary" formControlName="gross_monthly_salary" (keypress)="keyPress($event)" required>
<input matInput placeholder="Gross Monthly Salary" formControlName="gross_monthly_salary" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field>
@ -74,9 +77,32 @@
<input matInput placeholder="Bonus or Incentive"
formControlName="bonus_incentive" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field *ngIf="employmentForm.controls['bonus_incentive'].value != '' && employmentForm.controls['bonus_incentive'].value != '0' ">
<mat-select placeholder="Bonus Frequency" formControlName="bonus_frequency">
<mat-option *ngFor="let fd of frequency_data" [value]="fd.frequency_id">{{ fd.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="employmentForm.controls['bonus_incentive'].value != '' && employmentForm.controls['bonus_incentive'].value != '0' ">
<mat-select placeholder="Type of Bonus"
formControlName="bonus_type">
<mat-option value="fixed">Fixed</mat-option>
<mat-option value="variable depending on performance">Variable depending on performance</mat-option>
<mat-option value="others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="employmentForm.controls['bonus_type'].value == 'others'">
<input matInput placeholder="Bonus Type Others" formControlName="bonus_type_other">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Any Delays"
formControlName="any_delays">
<mat-select placeholder="Any Delays"
formControlName="any_delays">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<!-- <input matInput placeholder="Any Delays"
formControlName="any_delays"> -->
</mat-form-field>
</mat-card-content>
</mat-card>

View File

@ -36,10 +36,13 @@ export class EmploymentInfoComponent implements OnInit {
public employmentForm: FormGroup;
private notifier: NotifierService;
public pd_cus_segment:string;
public frequency_data:any[];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
//getAllMasterDatas();
}
ngOnInit() {
@ -69,10 +72,21 @@ export class EmploymentInfoComponent implements OnInit {
this.employmentForm.controls['gross_monthly_salary'].setValue(value.records.gross_monthly_salary);
this.employmentForm.controls['net_monthly_salary'].setValue(value.records.net_monthly_salary);
this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive);
this.employmentForm.controls['bonus_frequency'].setValue(value.records.bonus_frequency);
this.employmentForm.controls['bonus_type'].setValue(value.records.bonus_type);
this.employmentForm.controls['bonus_type_other'].setValue(value.records.bonus_type_other);
this.employmentForm.controls['any_delays'].setValue(value.records.any_delays);
this.employmentForm.controls['employment_remarks'].setValue(value.records.employment_remarks);
}
})
/** For Bonus Frequency Dropdown */
this._pd.getAllMasterDatas('FREQUENCY').subscribe(
data => {
if (data.status == 200) {
this.frequency_data = data.records;
this.frequency_data = this.frequency_data.filter(freq=>freq.isactive == 1 );
}
});
}
public initemploymentForm(): void {
this.employmentForm = this.fb.group({
@ -89,6 +103,9 @@ export class EmploymentInfoComponent implements OnInit {
gross_monthly_salary: ['', Validators.compose([Validators.required])],
net_monthly_salary: ['', Validators.compose([Validators.required])],
bonus_incentive: ['', Validators.compose([Validators.required])],
bonus_frequency: [''],
bonus_type: [''],
bonus_type_other: [''],
any_delays: ['', Validators.compose([Validators.required])],
employment_remarks: ['', Validators.compose([Validators.required])],
});
@ -118,6 +135,9 @@ export class EmploymentInfoComponent implements OnInit {
records.gross_monthly_salary = this.employmentForm.controls['gross_monthly_salary'].value;
records.net_monthly_salary = this.employmentForm.controls['net_monthly_salary'].value;
records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value;
records.bonus_frequency = this.employmentForm.controls['bonus_frequency'].value;
records.bonus_type = this.employmentForm.controls['bonus_type'].value;
records.bonus_type_other = this.employmentForm.controls['bonus_type_other'].value;
records.any_delays = this.employmentForm.controls['any_delays'].value;
records.employment_remarks = this.employmentForm.controls['employment_remarks'].value;
console.log('data', records);