general form changes

This commit is contained in:
gandhimathi 2018-12-21 15:04:25 +05:30
parent 74eb2f9237
commit deb9a48b86
2 changed files with 25 additions and 2 deletions

View File

@ -35,8 +35,9 @@
<mat-card-title>{{relation.controls.applicant_name.value | titlecase}}</mat-card-title> <mat-card-title>{{relation.controls.applicant_name.value | titlecase}}</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 50%" *ngIf="relation.controls.company_name.value"> <mat-form-field style="width: 50%" *ngIf="relation.controls.company_name.value">
<input matInput placeholder="Company / Firm" formControlName="company_name" type="text"> <input matInput placeholder="Company / Firm" formControlName="company_name" [attr.disabled]="true" type="text">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%" *ngIf="relation.controls.company_name.value"> <mat-form-field style="width: 40%" *ngIf="relation.controls.company_name.value">
<mat-select placeholder="Relation" formControlName="company_relationship"> <mat-select placeholder="Relation" formControlName="company_relationship">
@ -66,7 +67,17 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div align="end" *ngIf="relation.controls.pd_co_applicant_id.value==0">
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeOthers(r,relation.value)"
matTooltip="Delete" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
</div> </div>

View File

@ -127,7 +127,7 @@ export class GeneralInfoComponent implements OnInit {
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], applicant_name: [elementValue.applicant_name],
company_name: [elementValue.company_name], company_name: [elementValue.company_name,],
exist_status:[elementValue.exist_status==1 && elementValue.pd_co_applicant_id > 0 ? true : false] exist_status:[elementValue.exist_status==1 && elementValue.pd_co_applicant_id > 0 ? true : false]
}); });
} }
@ -192,6 +192,18 @@ export class GeneralInfoComponent implements OnInit {
} }
} }
// remove other details
removeOthers(index, item: any){
console.log(item)
if(item.pd_co_applicant_id==0){
let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
relationControl.removeAt(index);
// remove related to details
let pos_name=this.fetch_related_details.indexOf(item.applicant_name);
this.fetch_related_details.splice(pos_name, 1);
}
}
// submit form details // submit form details
submitGeneralForm(formData:any) { submitGeneralForm(formData:any) {
if (this._generalForm.invalid) { if (this._generalForm.invalid) {