changes by suren
This commit is contained in:
parent
907d235854
commit
0079f760af
@ -52,8 +52,9 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card formArrayName="coApplicantItems" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
|
||||
<mat-card-header>
|
||||
<mat-card-title>Applicant {{i+2}}</mat-card-title>
|
||||
<div *ngIf="coDetails.value.isactive != 0">
|
||||
<mat-card-header>
|
||||
<mat-card-title>Applicant {{coDetails.value.coapplicantindex}}</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content [formGroupName]="i">
|
||||
<mat-form-field style="width: 15%">
|
||||
@ -100,8 +101,17 @@
|
||||
</mat-form-field> -->
|
||||
|
||||
|
||||
|
||||
<div fxLayout="row nowrap" [style.display]="'block'">
|
||||
<div align="right">
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button
|
||||
mat-icon-button matTooltip="Remove" (click)="removecoapplicant(coDetails,i)"
|
||||
matTooltipPosition="above">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
|
||||
|
||||
@ -20,12 +20,13 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
public notifier: NotifierService;
|
||||
mainApplicantData: any[];
|
||||
coApplicantData: any[];
|
||||
coApplicantDataIndex: number=1 ;
|
||||
coApplicantItems:FormArray;
|
||||
emptyData:any;
|
||||
relationShipList:any;
|
||||
titleList: any;
|
||||
CSAbbr:any;
|
||||
disableAfterSubmit: boolean;
|
||||
disableAfterSubmit: boolean;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>,
|
||||
@ -40,6 +41,8 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
if(this.data.records.length>0){
|
||||
this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1);
|
||||
this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0);
|
||||
// this.coApplicantDataIndex= this.data.records.filter(item => item.applicant_type == 0 && item.isactive == 1);
|
||||
// console.log(this.coApplicantDataIndex);
|
||||
this.loadApplicantFormData();
|
||||
}
|
||||
else{
|
||||
@ -85,7 +88,7 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
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
|
||||
if(this.coApplicantData.length > 0){
|
||||
@ -95,8 +98,14 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
createItem(listData): FormGroup {
|
||||
if(listData){
|
||||
createItem(listData): FormGroup {
|
||||
if(listData){
|
||||
if(listData.hasOwnProperty('isactive')){
|
||||
if(listData.isactive == 1 ){
|
||||
this.coApplicantDataIndex+=1
|
||||
}
|
||||
}
|
||||
// console.log(listData);
|
||||
let stdcode;
|
||||
let landline;
|
||||
if(listData.landline != null){
|
||||
@ -119,9 +128,12 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
// relationship: [listData.relation],
|
||||
applicant_type: [listData.applicant_type, Validators.compose([Validators.required])],
|
||||
company_name: [listData.company_name],
|
||||
coapplicantindex:[listData.isactive == 1 ? this.coApplicantDataIndex:''],
|
||||
isactive: [listData.isactive || 1],
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.coApplicantDataIndex+=1
|
||||
return this._fb.group({
|
||||
label: ['Co Applicant'],
|
||||
fk_applicant_primary_id: [null],
|
||||
@ -134,17 +146,44 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
// relationship: [null],
|
||||
applicant_type: [0],
|
||||
company_name: [null],
|
||||
coapplicantindex:[this.coApplicantDataIndex],
|
||||
isactive: [1],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
addCoApplicant(listData) {
|
||||
if(this._EditApplicantForm.valid){
|
||||
this.coApplicantItems = this._EditApplicantForm.get('coApplicantItems') as FormArray;
|
||||
this.coApplicantItems.push(this.createItem(listData));
|
||||
}
|
||||
else{
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
removecoapplicant(codetails,i){
|
||||
console.log(codetails);
|
||||
let control: any = this._EditApplicantForm.get('coApplicantItems') as FormArray;
|
||||
console.log(control);
|
||||
if(codetails.value.fk_applicant_primary_id == null){
|
||||
control.removeAt(i);
|
||||
this.coApplicantDataIndex-=1
|
||||
}
|
||||
else{
|
||||
control.controls[i].controls.isactive.setValue(0);
|
||||
control.controls[i].controls.applicant_title_name.clearValidators();
|
||||
control.controls[i].controls.coapplicantName.clearValidators();
|
||||
control.controls[i].controls.coapplicant_mobile_no.clearValidators();
|
||||
control.controls[i].controls.coapplicant_stdcode.clearValidators();
|
||||
control.controls[i].controls.coapplicant_landline.clearValidators();
|
||||
control.controls[i].controls.company_name.clearValidators();
|
||||
control.controls[i].controls.applicant_type.clearValidators();
|
||||
this.coApplicantDataIndex-=1
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
get pdMainApplicant() { return this._EditApplicantForm.controls; }
|
||||
get pdCoApplicant() { return this._EditApplicantForm.get('coApplicantItems') as FormArray; }
|
||||
@ -248,7 +287,7 @@ export class EditPdApplicantComponent implements OnInit {
|
||||
"landline":concat_landline,
|
||||
"applicant_type":itemElement.applicant_type,
|
||||
"company_name":itemElement.company_name,
|
||||
"isactive":1
|
||||
"isactive": itemElement.isactive,
|
||||
}
|
||||
pd_applicant_details.push(obj1)
|
||||
});
|
||||
|
||||
@ -302,7 +302,8 @@
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content *ngIf="pdApplicantData.length>0; else noApplicant">
|
||||
<mat-list *ngFor="let applicant of pdApplicantData">
|
||||
<mat-list *ngFor="let applicant of pdApplicantData ">
|
||||
<div *ngIf="applicant.isactive != 0">
|
||||
<mat-list-item style="height:68px !important;">
|
||||
<p><span *ngIf="applicant.applicant_name!=null" class="mb-2 text-center hover-icon">
|
||||
<i class="fa-1x fa fa-user-o" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i>
|
||||
@ -320,6 +321,7 @@
|
||||
<ng-template #codetails><span> {{applicant.relation_name}} </span></ng-template>
|
||||
</p>
|
||||
</mat-list-item>
|
||||
</div>
|
||||
</mat-list>
|
||||
</mat-card-content>
|
||||
<ng-template #noApplicant>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div *ngIf="listView">
|
||||
<div [style.display]="listView ? 'block' : 'none'">
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap style="padding-top:1%">
|
||||
|
||||
@ -60,8 +60,7 @@ export class EntityListComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getCategorMaster();
|
||||
this.getEntityListMasters();
|
||||
|
||||
}
|
||||
|
||||
// get question master list details
|
||||
@ -77,6 +76,8 @@ export class EntityListComponent implements OnInit {
|
||||
// this.questionListData = data.records;
|
||||
this.dataLength = data.records.length;
|
||||
this.dataSource.data = this.enityList;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
|
||||
} else {
|
||||
this.enityList = [];
|
||||
this.dataLength = null;
|
||||
@ -104,6 +105,8 @@ export class EntityListComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.getCategorMaster();
|
||||
this.getEntityListMasters();
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div *ngIf="listView">
|
||||
<div [style.display]="listView ? 'block' : 'none'">
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div class="mb-1" fxLayout="row" fxLayout.xs="column" fxLayoutWrap fxLayoutAlign="start center">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user