applicant title name,company name start pd status changes in general/applicant and start pd

This commit is contained in:
gandhimathi 2019-01-08 13:19:13 +05:30
parent d3ce0ea3c9
commit 742b938f75
10 changed files with 104 additions and 30 deletions

View File

@ -171,11 +171,17 @@
<mat-card-title>Applicant Details</mat-card-title> <mat-card-title>Applicant Details</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 46%"> <mat-form-field style="width: 46%">
<input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name"> <input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name">
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 46%"> <mat-form-field style="width: 46%">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text"> <input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">

View File

@ -34,6 +34,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
relationShipList: any; relationShipList: any;
errorMessage: any; errorMessage: any;
loanAmtInWords : any; loanAmtInWords : any;
titleList: any;
// Dynamic co applicant // Dynamic co applicant
createWithLongContent = false; createWithLongContent = false;
dynamicCoApplicant = []; dynamicCoApplicant = [];
@ -56,6 +57,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.getStateCityList(); this.getStateCityList();
this.getPDTypeList(); this.getPDTypeList();
this.getRelationMaster(); this.getRelationMaster();
this.getTitleMaster();
this.loadFormData(); this.loadFormData();
} }
@ -74,6 +76,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
fk_pd_type: [null], fk_pd_type: [null],
fk_customer_segment: [null], fk_customer_segment: [null],
loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])], loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
applicant_name: [null], applicant_name: [null],
mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], // landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
@ -81,7 +84,6 @@ export class AddPdComponent implements OnInit, OnDestroy {
stdcode:[null, Validators.compose([Validators.minLength(2),Validators.maxLength(4),Validators.pattern('^[0-9]*$')])], stdcode:[null, Validators.compose([Validators.minLength(2),Validators.maxLength(4),Validators.pattern('^[0-9]*$')])],
landline : [null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])], landline : [null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
company_name: [null], company_name: [null],
  addressline1: [null],   addressline1: [null],
fk_city: [null], fk_city: [null],
fk_state: [null], fk_state: [null],
@ -169,6 +171,18 @@ export class AddPdComponent implements OnInit, OnDestroy {
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
// get title master
getTitleMaster() {
let relation ="TITLES";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.titleList=data.records.filter(val=>val.isactive==1);
}
}, error => this.errorMessage = <any> error);
}
createItem(): FormGroup { createItem(): FormGroup {
return this._fb.group({ return this._fb.group({
label: ['Co Applicant'], label: ['Co Applicant'],
@ -298,7 +312,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]); this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity(); this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]); this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity(); this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
@ -341,7 +357,10 @@ export class AddPdComponent implements OnInit, OnDestroy {
this._PDtriggerForm.controls['applicant_name'].clearValidators(); this._PDtriggerForm.controls['applicant_name'].clearValidators();
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity(); this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
this._PDtriggerForm.controls['mobile_no'].clearValidators(); this._PDtriggerForm.controls['mobile_no'].clearValidators();
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity(); this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
@ -393,6 +412,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
if(formValue.applicant_name){ if(formValue.applicant_name){
pd_applicant_details.push({ pd_applicant_details.push({
"applicant_name":formValue.applicant_name, "applicant_name":formValue.applicant_name,
"applicant_title_name":formValue.applicant_title_name,
"company_name":formValue.company_name, "company_name":formValue.company_name,
"mobile_no":formValue.mobile_no, "mobile_no":formValue.mobile_no,
"landline":formValue.stdcode +'-'+formValue.landline, "landline":formValue.stdcode +'-'+formValue.landline,
@ -401,7 +421,6 @@ export class AddPdComponent implements OnInit, OnDestroy {
}); });
} }
console.log(pd_applicant_details);
// formValue.items.forEach((itemElement, itemIndex) => { // formValue.items.forEach((itemElement, itemIndex) => {
// let obj1 = { // let obj1 = {

View File

@ -18,7 +18,14 @@
<mat-card-title>Main Applicant</mat-card-title> <mat-card-title>Main Applicant</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 40%"> <mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 65%">
<input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required> <input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required>
</mat-form-field> </mat-form-field>
@ -36,7 +43,7 @@
<span matPrefix>+91</span> <span matPrefix>+91</span>
<mat-error *ngIf="pdMainApplicant.stdcode.hasError('maxlength') || pdMainApplicant.stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error> <mat-error *ngIf="pdMainApplicant.stdcode.hasError('maxlength') || pdMainApplicant.stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp; </mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 25%"> <mat-form-field style="width: 60%">
<input matInput placeholder="LandLine Number" formControlName="landline" type="text" (keypress)="keyPress($event)"> <input matInput placeholder="LandLine Number" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMainApplicant.landline.hasError('maxlength') || pdMainApplicant.landline.hasError('minlength')">Enter Valid Landline Number. </mat-error> <mat-error *ngIf="pdMainApplicant.landline.hasError('maxlength') || pdMainApplicant.landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field> </mat-form-field>
@ -48,7 +55,14 @@
<mat-card-title>Co Applicant</mat-card-title> <mat-card-title>Co Applicant</mat-card-title>
</mat-card-header> --> </mat-card-header> -->
<mat-card-content [formGroupName]="i"> <mat-card-content [formGroupName]="i">
<mat-form-field style="width: 40%"> <mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 65%">
<input matInput placeholder="Name of Individual Applicant" formControlName="coapplicantName" type="text" required> <input matInput placeholder="Name of Individual Applicant" formControlName="coapplicantName" type="text" required>
</mat-form-field> </mat-form-field>
@ -70,7 +84,7 @@
<span matPrefix>+91</span> <span matPrefix>+91</span>
<mat-error *ngIf="coDetails['controls'].coapplicant_stdcode.hasError('maxlength') || coDetails['controls'].coapplicant_stdcode.hasError('minlength')">Enter Valid STD Number. </mat-error> <mat-error *ngIf="coDetails['controls'].coapplicant_stdcode.hasError('maxlength') || coDetails['controls'].coapplicant_stdcode.hasError('minlength')">Enter Valid STD Number. </mat-error>
</mat-form-field> &nbsp;-&nbsp; </mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 25%"> <mat-form-field style="width: 60%">
<input matInput placeholder="LandLine Number" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)"> <input matInput placeholder="LandLine Number" 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 Landline Number. </mat-error> <mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field> </mat-form-field>

View File

@ -20,6 +20,7 @@ export class EditPdApplicantComponent implements OnInit {
coApplicantItems:FormArray; coApplicantItems:FormArray;
emptyData:any; emptyData:any;
relationShipList:any; relationShipList:any;
titleList: any;
constructor(private _fb: FormBuilder, constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>, private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { @Inject(MAT_DIALOG_DATA) public data: any) {
@ -36,6 +37,7 @@ export class EditPdApplicantComponent implements OnInit {
this.loadEmptyFormData() this.loadEmptyFormData()
} }
this.getRelationMaster(); this.getRelationMaster();
this.getTitleMaster();
} }
loadEmptyFormData() { loadEmptyFormData() {
@ -64,6 +66,8 @@ export class EditPdApplicantComponent implements OnInit {
landline: [landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8)])], landline: [landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
company_name: [this.mainApplicantData[0].company_name], company_name: [this.mainApplicantData[0].company_name],
applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])], applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])],
applicant_title_name: [this.mainApplicantData[0].applicant_title_name, Validators.compose([Validators.required])],
coApplicantItems: this._fb.array([]), coApplicantItems: this._fb.array([]),
}); });
// bind dynamic co applicant data // bind dynamic co applicant data
@ -76,7 +80,6 @@ export class EditPdApplicantComponent implements OnInit {
} }
createItem(listData): FormGroup { createItem(listData): FormGroup {
if(listData){ if(listData){
console.log(listData.landline);
let stdcode; let stdcode;
let landline; let landline;
if(listData.landline != null){ if(listData.landline != null){
@ -88,10 +91,10 @@ export class EditPdApplicantComponent implements OnInit {
stdcode = null; stdcode = null;
landline = null; landline = null;
} }
console.log(landline);
return this._fb.group({ return this._fb.group({
label: ['Co Applicant'], label: ['Co Applicant'],
fk_applicant_primary_id: [listData.pd_co_applicant_id], fk_applicant_primary_id: [listData.pd_co_applicant_id],
applicant_title_name: [listData.applicant_title_name, Validators.compose([Validators.required])],
coapplicantName: [listData.applicant_name, Validators.compose([Validators.required])], 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_mobile_no: [listData.mobile_no,Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
coapplicant_stdcode: [stdcode, Validators.compose([Validators.minLength(2),Validators.maxLength(4)])], coapplicant_stdcode: [stdcode, Validators.compose([Validators.minLength(2),Validators.maxLength(4)])],
@ -106,6 +109,7 @@ export class EditPdApplicantComponent implements OnInit {
return this._fb.group({ return this._fb.group({
label: ['Co Applicant'], label: ['Co Applicant'],
fk_applicant_primary_id: [null], fk_applicant_primary_id: [null],
applicant_title_name: [null, Validators.compose([Validators.required])],
coapplicantName: [null, Validators.compose([Validators.required])], 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(12),Validators.pattern('^[0-9]*$')])],
coapplicant_stdcode: [null, Validators.compose([Validators.minLength(2),Validators.maxLength(4)])], coapplicant_stdcode: [null, Validators.compose([Validators.minLength(2),Validators.maxLength(4)])],
@ -114,6 +118,7 @@ export class EditPdApplicantComponent implements OnInit {
relationship: [null], relationship: [null],
applicant_type: [0], applicant_type: [0],
company_name: [null], company_name: [null],
}); });
} }
@ -143,6 +148,8 @@ export class EditPdApplicantComponent implements OnInit {
"landline":formValue.stdcode+'-'+formValue.landline, "landline":formValue.stdcode+'-'+formValue.landline,
"applicant_type":formValue.applicant_type, "applicant_type":formValue.applicant_type,
"relation":formValue.relationship, "relation":formValue.relationship,
"applicant_title_name": formValue.applicant_title_name,
"isactive":1 "isactive":1
}]; }];
formValue.coApplicantItems.forEach((itemElement, itemIndex) => { formValue.coApplicantItems.forEach((itemElement, itemIndex) => {
@ -163,11 +170,10 @@ export class EditPdApplicantComponent implements OnInit {
concat_landline = null; concat_landline = null;
} }
console.log(concat_landline);
let obj1 = { let obj1 = {
"fk_pd_id": this.data.pdID, "fk_pd_id": this.data.pdID,
"pd_co_applicant_id": itemElement.fk_applicant_primary_id, "pd_co_applicant_id": itemElement.fk_applicant_primary_id,
"applicant_title_name":itemElement.applicant_title_name,
"applicant_name":itemElement.coapplicantName, "applicant_name":itemElement.coapplicantName,
"relation":itemElement.relationship, "relation":itemElement.relationship,
"mobile_no":itemElement.coapplicant_mobile_no, "mobile_no":itemElement.coapplicant_mobile_no,
@ -204,6 +210,18 @@ export class EditPdApplicantComponent implements OnInit {
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
// get title master
getTitleMaster() {
let relation ="TITLES";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.titleList=data.records.filter(val=>val.isactive==1);
}
}, error => this.errorMessage = <any> error);
}
/** To Reset Popup Data */ /** To Reset Popup Data */
onReset() { onReset() {
if(this.data.records.length>0){ if(this.data.records.length>0){

View File

@ -11,7 +11,14 @@
<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: 75%"> <mat-form-field style="width: 30%">
<mat-select placeholder="Title" formControlName="applicant_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 62%">
<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" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeApplicant(r)" *ngIf="r>0"

View File

@ -1,6 +1,7 @@
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 , DialogPosition} from '@angular/material';
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
@Component({ @Component({
selector: 'app-other-applicant-details', selector: 'app-other-applicant-details',
@ -10,13 +11,25 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angul
export class OtherApplicantDetailsComponent implements OnInit { export class OtherApplicantDetailsComponent implements OnInit {
pageTitle: string ="Add Individual Details"; pageTitle: string ="Add Individual Details";
public _OtherForm: FormGroup; public _OtherForm: FormGroup;
applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','is_applicant':false,'is_person_met':false}; applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','is_applicant':false,'is_person_met':false, applicant_title_name:''};
titleList: any=[];
constructor(private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<OtherApplicantDetailsComponent>) { } constructor(private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<OtherApplicantDetailsComponent>) { }
ngOnInit() { ngOnInit() {
this.initFormDetails(); this.initFormDetails();
this.getTitleMaster();
} }
// get title master
getTitleMaster() {
let relation ="TITLES";
this._pd.getAllMasterDatas(relation).subscribe(
data => {
if (data.status == 200) {
this.titleList=data.records.filter(val=>val.isactive==1);
}
});
}
// init form // init form
initFormDetails() { initFormDetails() {
@ -29,7 +42,8 @@ export class OtherApplicantDetailsComponent implements OnInit {
createApplicant(elementValue:any){ 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_title_name: [elementValue.applicant_title_name, Validators.required],
applicant_name:[''],
is_applicant:[false], is_applicant:[false],
is_person_met:[false], is_person_met:[false],
}); });

View File

@ -81,7 +81,7 @@
<!-- Person Relationship Starts Here --> <!-- Person Relationship Starts Here -->
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title> Person Relationship </mat-card-title> <mat-card-title> Personal Relationships </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-table [dataSource]="relationSource" *ngIf="_generalForm.controls.persons_with_relationships['controls'].length>0" formArrayName="persons_with_relationships"> <mat-table [dataSource]="relationSource" *ngIf="_generalForm.controls.persons_with_relationships['controls'].length>0" formArrayName="persons_with_relationships">

View File

@ -233,6 +233,7 @@ export class GeneralInfoComponent implements OnInit {
createIndividulas(elementValue:any) { createIndividulas(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_title_name: [elementValue.applicant_title_name],
applicant_name: [elementValue.applicant_name], applicant_name: [elementValue.applicant_name],
is_applicant:[elementValue.is_applicant], is_applicant:[elementValue.is_applicant],
is_person_met:[elementValue.is_person_met], is_person_met:[elementValue.is_person_met],
@ -386,7 +387,6 @@ export class GeneralInfoComponent implements OnInit {
// add more individuals details // add more individuals details
addMoreIndividuals() { addMoreIndividuals() {
console.log('Initial Count',this.count);
const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, { const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, {
data: '', data: '',
width:'40%', width:'40%',
@ -396,16 +396,12 @@ export class GeneralInfoComponent implements OnInit {
.subscribe(dataresult => { .subscribe(dataresult => {
if(dataresult.data.length>0){ if(dataresult.data.length>0){
dataresult.data.forEach((element,index) => { dataresult.data.forEach((element,index) => {
console.log('Foreach Entry Count',this.count);
let individualsControl = <FormArray>this._generalForm.controls['individuals']; let individualsControl = <FormArray>this._generalForm.controls['individuals'];
element.pd_co_applicant_id = this.count; element.pd_co_applicant_id = this.count;
this.count = this.count+1; this.count = this.count+1;
element.individuals_order_id = individualsControl.controls.length+1; element.individuals_order_id = individualsControl.controls.length+1;
element.is_new=true; element.is_new=true;
individualsControl.push(this.createIndividulas(element)); individualsControl.push(this.createIndividulas(element));
console.log('Foreach Entry Count with Incremented',this.count);
console.log('Final Count',this.count);
let relationControl = <FormArray>this._generalForm.controls['persons_with_relationships']; let relationControl = <FormArray>this._generalForm.controls['persons_with_relationships'];
let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'relationship':'','relation_to':'','individuals_order_id':element.individuals_order_id}; let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'relationship':'','relation_to':'','individuals_order_id':element.individuals_order_id};
relationControl.push(this.createPersonsWithRelationships(applicant_details)); relationControl.push(this.createPersonsWithRelationships(applicant_details));

View File

@ -30,6 +30,6 @@
</div> </div>
</mat-card-content> </mat-card-content>
<mat-card-actions align="end"> <mat-card-actions align="end">
<button matTooltip="Complete Question" matTooltipPosition="above" [disabled]="actualQuestions==0 || actualQuestions!=answeredQuestions || currentPDStatus!=pdStatusCheck.INPROGRESS" mat-raised-button color="primary" (click)="changePDStatus(pdStatusCheck.COMPLETED);"><span>{{currentPDStatus==pdStatusCheck.INPROGRESS ? 'COMPLETE':(currentPDStatus==pdStatusCheck.QC_COMPLETED ? 'QC COMPLETED' : currentPDStatus ) }}</span></button> <button matTooltip="Complete Question" matTooltipPosition="above" [disabled]="actualQuestions==0 || actualQuestions!=answeredQuestions || currentPDStatus===false" mat-raised-button color="primary" (click)="changePDStatus(pdStatusCheck.COMPLETED);"><span>{{currentPDStatus === true ? 'COMPLETE':'COMPLETED' }}</span></button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>

View File

@ -57,7 +57,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
"COMPLETED": 'COMPLETED', "COMPLETED": 'COMPLETED',
"QC_COMPLETED": 'QC_COMPLETED', "QC_COMPLETED": 'QC_COMPLETED',
}; };
currentPDStatus: string; currentPDStatus: boolean;
actualQuestions: number; actualQuestions: number;
answeredQuestions: number; answeredQuestions: number;
private notifier: NotifierService; private notifier: NotifierService;
@ -110,7 +110,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
// this.categoryList=data.records.question_answers; // this.categoryList=data.records.question_answers;
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
this.mainApplicantName = filterApplicantName[0].applicant_name; this.mainApplicantName = filterApplicantName[0].applicant_name;
this.currentPDStatus = data.records.pdmaster_details.pd_status; this.currentPDStatus = data.records.pdmaster_details.pd_status=='INPROGRESS' ? true : data.records.pdmaster_details.pd_status=='SCHEDULED' ? true :data.records.pdmaster_details.pd_status=='ALLOCATED' ? true : false;
this.categoryFormButtons = Object.keys(data.records.template_forms).map((item)=>data.records.template_forms[item]); this.categoryFormButtons = Object.keys(data.records.template_forms).map((item)=>data.records.template_forms[item]);
this.actualQuestions = this.categoryFormButtons.length; this.actualQuestions = this.categoryFormButtons.length;
let getAnsweredFormsCount = this.categoryFormButtons.filter(item=>item.isAnswered==true); let getAnsweredFormsCount = this.categoryFormButtons.filter(item=>item.isAnswered==true);
@ -123,7 +123,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
this.pdMasterList = ""; this.pdMasterList = "";
this.mainApplicantName = ""; this.mainApplicantName = "";
this.categoryList = []; this.categoryList = [];
this.currentPDStatus = ""; this.currentPDStatus = false;
} }
// this.getAnswers(serachQuestions); // this.getAnswers(serachQuestions);
@ -140,7 +140,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
} }
this._pd.editPdMasterDetails(update_array, status).subscribe(result => { this._pd.editPdMasterDetails(update_array, status).subscribe(result => {
if (result.status == 200) { if (result.status == 200) {
this.currentPDStatus = this.pdStatusCheck.COMPLETED; this.currentPDStatus = false;
this.notifier.notify('success', 'PD Completed.'); this.notifier.notify('success', 'PD Completed.');
} }
else { else {