general form path changes

This commit is contained in:
gandhimathi 2018-12-26 12:20:05 +05:30
parent 24f0e417f8
commit 6365d43aa2
7 changed files with 33 additions and 33 deletions

View File

@ -20,7 +20,7 @@
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="addMoreApplicant()"><mat-icon>add</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="saveApplicant(_OtherForm.value)"><mat-icon>save</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More" matTooltipPosition="above" (click)="addMoreApplicant()"><mat-icon>add</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add List" matTooltipPosition="above" (click)="saveApplicant(_OtherForm.value)"><mat-icon>save</mat-icon></button>
</mat-dialog-actions>

View File

@ -15,12 +15,14 @@
</mat-card-header>
<mat-card-content>
<div fxLayout="row wrap" class="example-section" formArrayName="applicant_list">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25" *ngFor="let applicant of _generalForm.controls.applicant_list['controls']; let c = index;" [formGroupName]="c">
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25" *ngFor="let applicant of _generalForm.controls.applicant_list['controls']; let c = index;" [formGroupName]="c">
<mat-checkbox class="example-margin" color="primary" formControlName="exist_status" (change)="checkboxChange($event, c, applicant.controls)">{{applicant.controls.applicant_name.value}}</mat-checkbox>
</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="button" matTooltip="Add Other Applicant" matTooltipPosition="above" color="primary" (click)="addOtherApplicant()"><mat-icon>add</mat-icon></button>
</mat-card-actions>
</mat-card>
<mat-card>

View File

@ -3,7 +3,7 @@ import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@ang
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from './../../../../../pd-service/pd-triger.service';
import {OtherApplicantDetailsComponent} from './../other-applicant-details/other-applicant-details.component';
import {OtherApplicantDetailsComponent} from './../dialogue/other-applicant-details/other-applicant-details.component';
@Component({
selector: 'app-general-info',
templateUrl: './general-info.component.html',
@ -27,7 +27,7 @@ export class GeneralInfoComponent implements OnInit {
this.form_id = 18;
this.pd_applicants_details = this.pd_all_details.pdapplicants_detials;
// push Other options to applicant details
this.pd_applicants_details.push({'pd_co_applicant_id':"0",'applicant_name':'Others', });
// this.pd_applicants_details.push({'pd_co_applicant_id':"0",'applicant_name':'Others', });
}
ngOnInit() {
@ -147,37 +147,11 @@ export class GeneralInfoComponent implements OnInit {
// checkand un check function
checkboxChange(event, index, item) {
if(item.exist_status.value){
if(item.pd_co_applicant_id.value==0){
const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, {
data: '',
width:'40%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.data.length>0){
let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
dataresult.data.forEach(element => {
let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','company_name':element.company_name,'company_relation':''};
relationControl.push(this.createApplicantRelation(applicant_details));
// push related to details
this.fetch_related_details.push(element.applicant_name);
});
}
// exist_status
});
}
else{
let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
let applicant_details: any= {'pd_co_applicant_id':item.pd_co_applicant_id.value,'applicant_name':item.applicant_name.value,'applicant_relation_to':'','relation':'','company_name':item.company_name.value,'company_relation':''};
relationControl.push(this.createApplicantRelation(applicant_details));
// push related to details
this.fetch_related_details.push(item.applicant_name.value);
}
}
else {
@ -192,6 +166,30 @@ export class GeneralInfoComponent implements OnInit {
}
}
// add more applicant details
addOtherApplicant() {
const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, {
data: '',
width:'40%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.data.length>0){
let relationControl = <FormArray>this._generalForm.controls['applicant_relation'];
dataresult.data.forEach(element => {
let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','company_name':element.company_name,'company_relation':''};
relationControl.push(this.createApplicantRelation(applicant_details));
// push related to details
this.fetch_related_details.push(element.applicant_name);
});
}
});
}
// remove other details
removeOthers(index, item: any){
console.log(item)

View File

@ -79,7 +79,7 @@ import { AllocationViewMoreComponent } from './list-pd/allocation-view-more/allo
import { PdRequirementComponent } from './list-pd/pd-requirement/pd-requirement.component';
import { GeneralInfoComponent } from './list-pd/start-pd/forms/general-info/general-info.component';
import { ModelEditPdReportComponent } from './list-pd/pd-report/model-edit-pd-report/model-edit-pd-report.component';
import { OtherApplicantDetailsComponent } from './list-pd/start-pd/forms/other-applicant-details/other-applicant-details.component';
import { OtherApplicantDetailsComponent } from './list-pd/start-pd/forms/dialogue/other-applicant-details/other-applicant-details.component';
import { NeighbourHoodComponent } from './list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component';
// import ngx-viewer module