personal info changes
This commit is contained in:
parent
c826296f63
commit
719477d9d4
@ -1,3 +1,125 @@
|
|||||||
<p>
|
<form [formGroup]="_personalForm">
|
||||||
personal-info works!
|
|
||||||
</p>
|
<!-- start main applicant details -->
|
||||||
|
|
||||||
|
<div fxLayout="row wrap">
|
||||||
|
|
||||||
|
<div fxFlex="50" class="text-xs-left">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
<mat-card-title>Main Applicant</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
|
<div [formArrayName]="'mainItem'" *ngFor="let mainDetails of pdMainapplicant.controls; let i = index;">
|
||||||
|
<div [formGroup]="mainDetails">
|
||||||
|
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==0">
|
||||||
|
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==1">
|
||||||
|
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==2">
|
||||||
|
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==3">
|
||||||
|
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
||||||
|
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
||||||
|
{{education}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==4">
|
||||||
|
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
||||||
|
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
||||||
|
{{earning}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- end main applicant details -->
|
||||||
|
|
||||||
|
<!-- start co applicant form details -->
|
||||||
|
<div fxFlex="50" class="text-xs-left">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
<mat-card-title>Co Applicant</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
|
<div [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
|
||||||
|
<div [formGroup]="coDetails">
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==0">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==1">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==2">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==3">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
|
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
||||||
|
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
||||||
|
{{education}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==4">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
||||||
|
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
||||||
|
{{earning}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==5">
|
||||||
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
||||||
|
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
|
||||||
|
{{rel.name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
<mat-card-actions align="end">
|
||||||
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above" [disabled]="!_personalForm.valid "><mat-icon>save</mat-icon></button>
|
||||||
|
|
||||||
|
</mat-card-actions>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- end co applicant form details -->
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
.mat-card-content {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.mat-card-actions {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
@ -1,4 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit , Input, Output } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||||
|
import { NotifierService } from 'angular-notifier';
|
||||||
|
import { PdTrigerService } from './../../../../../pd-service/pd-triger.service';
|
||||||
|
import { Key } from 'protractor';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-personal-info',
|
selector: 'app-personal-info',
|
||||||
@ -7,9 +11,96 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class PersonalInfoComponent implements OnInit {
|
export class PersonalInfoComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
qualifications:any=["Graduate","Under Graduate","Post Graduate","Professional"];
|
||||||
|
earningStatus:any=["Earning Member","House Wife","Student","Retired","Pensioner","Other Non earning member"];
|
||||||
|
relationShipList:any=[];
|
||||||
|
@Input() pdid : string;
|
||||||
|
form_id:number;
|
||||||
|
private notifier: NotifierService;
|
||||||
|
public _personalForm: FormGroup;
|
||||||
|
|
||||||
|
public mainApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status"];
|
||||||
|
public coApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status","Relationship"];
|
||||||
|
errorMessage:any;
|
||||||
|
//coItem:any;
|
||||||
|
//mainItem:any;
|
||||||
|
|
||||||
|
repeat:number=3;
|
||||||
|
|
||||||
|
constructor(notifier: NotifierService,private _fb: FormBuilder,private _pd: PdTrigerService) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
this.form_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
|
this.loadPDDetails(this.pdid,this.form_id);
|
||||||
|
this.loadFormData();
|
||||||
|
this.getRelationMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load form pd details
|
||||||
|
loadPDDetails(pd:string,form:number){
|
||||||
|
|
||||||
|
// this._pd.getAllMasterDatas(pdid,form_id).subscribe(
|
||||||
|
// data => {
|
||||||
|
// if (data.status == 200) {
|
||||||
|
// this.relationShipList=data.records;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }, error => this.errorMessage = <any> error);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadFormData(){
|
||||||
|
// main applicant
|
||||||
|
let mainApplicantGroup = new FormArray(this.mainApplicantQuestions.map((item,key) => new FormGroup({
|
||||||
|
fk_pd_id:new FormControl(null),
|
||||||
|
pd_question:new FormControl(this.mainApplicantQuestions[key]),
|
||||||
|
pd_question_type:new FormControl(key),
|
||||||
|
pd_detail_answer_id: new FormControl(null),
|
||||||
|
pd_answer_id: new FormControl(null,),
|
||||||
|
pd_answer: new FormControl(null,Validators.required),
|
||||||
|
pd_answer_weightage:new FormControl(null),
|
||||||
|
})));
|
||||||
|
// co applicant
|
||||||
|
let coApplicantGroup = new FormArray(this.coApplicantQuestions.map((item,key) => new FormGroup({
|
||||||
|
fk_pd_id:new FormControl(null),
|
||||||
|
pd_question:new FormControl(this.coApplicantQuestions[key]),
|
||||||
|
pd_question_type:new FormControl(key),
|
||||||
|
pd_detail_answer_id: new FormControl(null),
|
||||||
|
pd_answer_id: new FormControl(null),
|
||||||
|
pd_answer: new FormControl(null, Validators.required),
|
||||||
|
pd_answer_weightage:new FormControl(null),
|
||||||
|
})));
|
||||||
|
|
||||||
|
|
||||||
|
this._personalForm = this._fb.group({
|
||||||
|
pdid:null,
|
||||||
|
form_id:null,
|
||||||
|
mainItem: mainApplicantGroup,
|
||||||
|
coItem: coApplicantGroup,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(this._personalForm.controls.coItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
//get pd main applicant array values
|
||||||
|
get pdMainapplicant() { return this._personalForm.get('mainItem') as FormArray; }
|
||||||
|
|
||||||
|
// get pd co applicant array values
|
||||||
|
get pdCoapplicant() {return this._personalForm.get('coItem') as FormArray;}
|
||||||
|
|
||||||
|
// get relation master details
|
||||||
|
getRelationMaster(){
|
||||||
|
let relation ="RELATIONSHIPS";
|
||||||
|
this._pd.getAllMasterDatas(relation).subscribe(
|
||||||
|
data => {
|
||||||
|
if (data.status == 200) {
|
||||||
|
this.relationShipList=data.records;
|
||||||
|
|
||||||
|
}
|
||||||
|
}, error => this.errorMessage = <any> error);
|
||||||
|
}
|
||||||
|
//<app-personal-info [pdid]="startPD"></app-personal-info>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user