personal discussion changes
This commit is contained in:
parent
5425dc72de
commit
bf2ed84d30
@ -1,4 +1,4 @@
|
|||||||
<form [formGroup]="_personalForm">
|
<form [formGroup]="_personalForm" (submit)="submitPersonalForm(_personalForm.value)">
|
||||||
|
|
||||||
<!-- start main applicant details -->
|
<!-- start main applicant details -->
|
||||||
|
|
||||||
@ -12,38 +12,33 @@
|
|||||||
<div [formArrayName]="'mainItem'" *ngFor="let mainDetails of pdMainapplicant.controls; let i = index;">
|
<div [formArrayName]="'mainItem'" *ngFor="let mainDetails of pdMainapplicant.controls; let i = index;">
|
||||||
<div [formGroup]="mainDetails">
|
<div [formGroup]="mainDetails">
|
||||||
|
|
||||||
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==0">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
<input matInput [placeholder]="mainDetails.controls.name_ques.value" formControlName="name_ans" type="text" required>
|
||||||
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
</mat-form-field>
|
||||||
</mat-form-field>
|
<mat-form-field style="width: 100%">
|
||||||
<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.age_ques.value" formControlName="age_ans" type="text" required>
|
||||||
|
</mat-form-field>
|
||||||
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
<mat-form-field style="width: 100%">
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==2">
|
<input matInput [placeholder]="mainDetails.controls.entity_ques.value" formControlName="entity_ans" type="text" required>
|
||||||
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
|
||||||
</mat-form-field>
|
<mat-select [placeholder]="mainDetails.controls.qualification_ques.value" formControlName="qualification_ans" required>
|
||||||
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==3">
|
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
||||||
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
{{education}}
|
||||||
|
</mat-option>
|
||||||
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
</mat-select>
|
||||||
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
|
||||||
{{education}}
|
</mat-form-field>
|
||||||
</mat-option>
|
<mat-form-field style="width: 100%">
|
||||||
</mat-select>
|
<mat-select [placeholder]="mainDetails.controls.earningStatus_ques.value" formControlName="earning_ans" required>
|
||||||
|
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
||||||
</mat-form-field>
|
{{earning}}
|
||||||
<mat-form-field style="width: 100%" *ngIf="mainDetails.controls.pd_question_type.value==4">
|
</mat-option>
|
||||||
<!-- <mat-label>{{mainDetails.controls.pd_question.value}}</mat-label> -->
|
</mat-select>
|
||||||
<mat-select [placeholder]="mainDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
</mat-form-field>
|
||||||
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
|
||||||
{{earning}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -57,48 +52,48 @@
|
|||||||
<!-- end main applicant details -->
|
<!-- end main applicant details -->
|
||||||
|
|
||||||
<!-- start co applicant form details -->
|
<!-- start co applicant form details -->
|
||||||
<div fxFlex="50" class="text-xs-left">
|
<div fxFlex="50" class="text-xs-left" [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
|
||||||
|
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-title>Co Applicant</mat-card-title>
|
<mat-card-title>Co Applicant</mat-card-title>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
|
<div >
|
||||||
<div [formGroup]="coDetails">
|
<div [formGroup]="coDetails">
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==0">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
<input matInput [placeholder]="coDetails.controls.name_ques.value" formControlName="name_ans" type="text" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==1">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
<input matInput [placeholder]="coDetails.controls.age_ques.value" formControlName="age_ans" type="text" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==2">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
<input matInput [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" type="text" required>
|
<input matInput [placeholder]="coDetails.controls.entity_ques.value" formControlName="entity_ans" type="text" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==3">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
|
|
||||||
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
<mat-select [placeholder]="coDetails.controls.qualification_ques.value" formControlName="qualification_ans" required>
|
||||||
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
<mat-option *ngFor="let education of qualifications" [value]="education" >
|
||||||
{{education}}
|
{{education}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==4">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
<mat-select [placeholder]="coDetails.controls.earningStatus_ques.value" formControlName="earning_ans" required>
|
||||||
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
<mat-option *ngFor="let earning of earningStatus" [value]="earning" >
|
||||||
{{earning}}
|
{{earning}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%" *ngIf="coDetails.controls.pd_question_type.value==5">
|
<mat-form-field style="width: 100%">
|
||||||
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
|
||||||
<mat-select [placeholder]="coDetails.controls.pd_question.value" formControlName="pd_answer" required>
|
<mat-select [placeholder]="coDetails.controls.relationShip_ques.value" formControlName="relation_ans" required>
|
||||||
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
|
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
|
||||||
{{rel.name}}
|
{{rel.name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
@ -109,17 +104,17 @@
|
|||||||
|
|
||||||
|
|
||||||
</mat-card-content>
|
</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>
|
</mat-card>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- end co applicant form details -->
|
<!-- end co applicant form details -->
|
||||||
|
<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>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -15,12 +15,17 @@ export class PersonalInfoComponent implements OnInit {
|
|||||||
earningStatus:any=["Earning Member","House Wife","Student","Retired","Pensioner","Other Non earning member"];
|
earningStatus:any=["Earning Member","House Wife","Student","Retired","Pensioner","Other Non earning member"];
|
||||||
relationShipList:any=[];
|
relationShipList:any=[];
|
||||||
@Input() pdid : string;
|
@Input() pdid : string;
|
||||||
|
@Input() pd_all_details:any;
|
||||||
form_id:number;
|
form_id:number;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
public _personalForm: FormGroup;
|
public _personalForm: FormGroup;
|
||||||
|
|
||||||
public mainApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status"];
|
public mainApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status"];
|
||||||
public coApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status","Relationship"];
|
public coApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status","Relationship"];
|
||||||
|
|
||||||
|
public mainApplicantDetails :any=[];
|
||||||
|
public coApplicantDetails :any=[];
|
||||||
|
|
||||||
errorMessage:any;
|
errorMessage:any;
|
||||||
//coItem:any;
|
//coItem:any;
|
||||||
//mainItem:any;
|
//mainItem:any;
|
||||||
@ -35,53 +40,106 @@ export class PersonalInfoComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.loadPDDetails(this.pdid,this.form_id);
|
this.loadPDDetails(this.pdid,this.form_id);
|
||||||
this.loadFormData();
|
|
||||||
this.getRelationMaster();
|
this.getRelationMaster();
|
||||||
}
|
this.mainApplicantDetails = this.pd_all_details.pdapplicants_detials.filter(item => item.applicant_type == 1);
|
||||||
|
// console.log(this.mainApplicantDetails)
|
||||||
|
this.coApplicantDetails = this.pd_all_details.pdapplicants_detials.filter(item => item.applicant_type == 0);
|
||||||
|
}
|
||||||
|
|
||||||
// load form pd details
|
// load form pd details
|
||||||
loadPDDetails(pd:string,form:number){
|
loadPDDetails(pd:string,form:number){
|
||||||
|
|
||||||
// this._pd.getAllMasterDatas(pdid,form_id).subscribe(
|
this._pd.getPDFormDetailsWithID(this.pdid,this.form_id).subscribe(
|
||||||
// data => {
|
data => {
|
||||||
// if (data.status == 200) {
|
if (data.status == 200) {
|
||||||
// this.relationShipList=data.records;
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// }, error => this.errorMessage = <any> error);
|
else if(data.status == 204){
|
||||||
|
let defaultMainApp=[];
|
||||||
|
let defaultCoApp=[];
|
||||||
|
// generate default main applicant form details
|
||||||
|
if(this.mainApplicantDetails.length>0){
|
||||||
|
for(let j=0;j<this.mainApplicantQuestions.length; j++)
|
||||||
|
{
|
||||||
|
if(j==0){
|
||||||
|
let generateRow = {
|
||||||
|
"pd_question":"",
|
||||||
|
"pd_answer": this.mainApplicantDetails[0].applicant_name,
|
||||||
|
}
|
||||||
|
defaultMainApp.push(generateRow);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
let generateRow = {
|
||||||
|
"pd_question":"",
|
||||||
|
"pd_answer": "",
|
||||||
|
}
|
||||||
|
defaultMainApp.push(generateRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.loadFormData(defaultMainApp,this.coApplicantDetails);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}, error => this.errorMessage = <any> error);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFormData(){
|
loadFormData(mainApp,coApp){
|
||||||
// main applicant
|
// main applicant
|
||||||
let mainApplicantGroup = new FormArray(this.mainApplicantQuestions.map((item,key) => new FormGroup({
|
let mainApplicantGroup = new FormArray(this.mainApplicantDetails.map((item,key) => new FormGroup({
|
||||||
fk_pd_id:new FormControl(null),
|
name_ques:new FormControl(this.mainApplicantQuestions[0]),
|
||||||
pd_question:new FormControl(this.mainApplicantQuestions[key]),
|
name_ans:new FormControl(item.applicant_name, Validators.required),
|
||||||
pd_question_type:new FormControl(key),
|
name_id:new FormControl(0),
|
||||||
pd_detail_answer_id: new FormControl(null),
|
age_ques:new FormControl(this.mainApplicantQuestions[1]),
|
||||||
pd_answer_id: new FormControl(null,),
|
age_id:new FormControl(1),
|
||||||
pd_answer: new FormControl(null,Validators.required),
|
age_ans:new FormControl(null, Validators.required),
|
||||||
pd_answer_weightage:new FormControl(null),
|
entity_ques: new FormControl(this.mainApplicantQuestions[2]),
|
||||||
|
entity_id: new FormControl(2),
|
||||||
|
entity_ans:new FormControl(null, Validators.required),
|
||||||
|
qualification_ques: new FormControl(this.mainApplicantQuestions[3]),
|
||||||
|
qualification_id: new FormControl(3),
|
||||||
|
qualification_ans:new FormControl(null, Validators.required),
|
||||||
|
earningStatus_ques:new FormControl(this.mainApplicantQuestions[4]),
|
||||||
|
earning_id: new FormControl(4),
|
||||||
|
earning_ans:new FormControl(null, Validators.required),
|
||||||
|
|
||||||
})));
|
})));
|
||||||
// co applicant
|
// co applicant
|
||||||
let coApplicantGroup = new FormArray(this.coApplicantQuestions.map((item,key) => new FormGroup({
|
let iterateCoApp=[];
|
||||||
fk_pd_id:new FormControl(null),
|
|
||||||
pd_question:new FormControl(this.coApplicantQuestions[key]),
|
let coApplicantGroup = new FormArray(this.coApplicantDetails.map((item,key) => new FormGroup({
|
||||||
pd_question_type:new FormControl(key),
|
name_ques:new FormControl(this.coApplicantQuestions[0]),
|
||||||
pd_detail_answer_id: new FormControl(null),
|
name_ans:new FormControl(item.applicant_name, Validators.required),
|
||||||
pd_answer_id: new FormControl(null),
|
name_id:new FormControl(0),
|
||||||
pd_answer: new FormControl(null, Validators.required),
|
age_ques:new FormControl(this.coApplicantQuestions[1]),
|
||||||
pd_answer_weightage:new FormControl(null),
|
age_id:new FormControl(1),
|
||||||
})));
|
age_ans:new FormControl(null, Validators.required),
|
||||||
|
entity_ques: new FormControl(this.coApplicantQuestions[2]),
|
||||||
|
entity_id: new FormControl(2),
|
||||||
|
entity_ans:new FormControl(null, Validators.required),
|
||||||
|
qualification_ques: new FormControl(this.coApplicantQuestions[3]),
|
||||||
|
qualification_id: new FormControl(3),
|
||||||
|
qualification_ans:new FormControl(null, Validators.required),
|
||||||
|
earningStatus_ques:new FormControl(this.coApplicantQuestions[4]),
|
||||||
|
earning_id: new FormControl(4),
|
||||||
|
earning_ans:new FormControl(null, Validators.required),
|
||||||
|
relationShip_ques:new FormControl(this.coApplicantQuestions[5]),
|
||||||
|
relation_id:new FormControl(5),
|
||||||
|
relation_ans:new FormControl(null, Validators.required),
|
||||||
|
|
||||||
|
})));
|
||||||
|
|
||||||
this._personalForm = this._fb.group({
|
this._personalForm = this._fb.group({
|
||||||
pdid:null,
|
pdid:null,
|
||||||
form_id:null,
|
form_id:null,
|
||||||
mainItem: mainApplicantGroup,
|
mainItem: mainApplicantGroup,
|
||||||
coItem: coApplicantGroup,
|
coItem: coApplicantGroup,
|
||||||
});
|
});
|
||||||
|
//console.log(this._personalForm);
|
||||||
|
|
||||||
console.log(this._personalForm.controls.coItem)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//get pd main applicant array values
|
//get pd main applicant array values
|
||||||
@ -102,5 +160,41 @@ export class PersonalInfoComponent implements OnInit {
|
|||||||
}, error => this.errorMessage = <any> error);
|
}, error => this.errorMessage = <any> error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// submit forms details
|
||||||
|
submitPersonalForm(formData:any) {
|
||||||
|
if(this._personalForm.valid){
|
||||||
|
let applicantDetails:any=[];
|
||||||
|
|
||||||
|
formData.mainItem.forEach((element,key) => {
|
||||||
|
if(key==0){
|
||||||
|
applicantDetails.push(element)
|
||||||
|
}
|
||||||
|
console.log(element);
|
||||||
|
console.log(key);
|
||||||
|
|
||||||
|
});
|
||||||
|
formData.coItem.forEach((Coelement,Cokey) => {
|
||||||
|
applicantDetails.push(Coelement)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
let save_details:any={
|
||||||
|
"pdid": this.pdid,
|
||||||
|
"formid": this.form_id,
|
||||||
|
"applicant_details":applicantDetails
|
||||||
|
};
|
||||||
|
this._pd.savePDQuestions(save_details).subscribe(result => {
|
||||||
|
if (result.status == 200) {
|
||||||
|
this.notifier.notify('success', 'Success.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -389,7 +389,7 @@
|
|||||||
|
|
||||||
<!-- start personal type questions -->
|
<!-- start personal type questions -->
|
||||||
<ng-container *ngSwitchCase="3">
|
<ng-container *ngSwitchCase="3">
|
||||||
<app-personal-info [pdid]="startPD"></app-personal-info>
|
<app-personal-info [pdid]="startPD" [pd_all_details]="pdFullDetails"></app-personal-info>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<!-- end personal type questions -->
|
<!-- end personal type questions -->
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@ -29,6 +29,7 @@ selectedQuestionIndex:number;
|
|||||||
getQuestionsLength:number;
|
getQuestionsLength:number;
|
||||||
answerList:any=[];
|
answerList:any=[];
|
||||||
ansPDList:any=[];
|
ansPDList:any=[];
|
||||||
|
pdFullDetails:any=[];
|
||||||
|
|
||||||
// category static form buttons
|
// category static form buttons
|
||||||
categoryFormButtons : any=[
|
categoryFormButtons : any=[
|
||||||
@ -107,6 +108,8 @@ loadTemplates(startID:string){
|
|||||||
this.actualQuestions = data.records.counts.overall_question_count;
|
this.actualQuestions = data.records.counts.overall_question_count;
|
||||||
this.answeredQuestions = data.records.counts.overall_answered_count;
|
this.answeredQuestions = data.records.counts.overall_answered_count;
|
||||||
|
|
||||||
|
this.pdFullDetails = data.records
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.pdMasterList="";
|
this.pdMasterList="";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user