famil form changes

This commit is contained in:
gandhimathi 2018-11-14 19:20:16 +05:30
parent d56fdf0712
commit 96ec621aeb
3 changed files with 45 additions and 50 deletions

View File

@ -5,12 +5,12 @@
<form class="address" [formGroup]="familyForm"> <form class="address" [formGroup]="familyForm">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Person Met" formControlName="person"> <mat-select placeholder="Person Met" formControlName="person">
<mat-option *ngFor="let state of filteredStates" [value]="state"> <mat-option *ngFor="let personMet of personMetData" [value]="personMet.person_met_id">
{{state}} {{personMet.person_met_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="person.value =='Other'"> <mat-form-field *ngIf="person.value ==8">
<input matInput placeholder="Enter the relationship" formControlName="personOther"> <input matInput placeholder="Enter the relationship" formControlName="personOther">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -35,9 +35,10 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Segment" formControlName="segment"> <mat-select placeholder="Segment" formControlName="segment">
<mat-option value="Salaried">Salaried</mat-option> <mat-option value="{{cusSeg.customer_segment_id}}"
<mat-option value="SENP">SENP</mat-option> *ngFor="let cusSeg of customerSegData">
<mat-option value="SEP">SEP</mat-option> {{cusSeg.name}}
</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -117,16 +118,16 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Ownership" formControlName="ownership"> <mat-select placeholder="Ownership" formControlName="ownership">
<mat-option value="Self">Self Owned</mat-option> <mat-option value="{{ownerShip.id}}"
<mat-option value="Family">Family Owned</mat-option> *ngFor="let ownerShip of ownerShipData">
<mat-option value="Rented">Rented</mat-option> {{ownerShip.name}}
<mat-option value="Others">Others</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="ownership.value =='Others'"> <mat-form-field *ngIf="ownership.value ==4">
<input matInput placeholder="Please specify" formControlName="ownershipOther"> <input matInput placeholder="Please specify" formControlName="ownershipOther">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="ownership.value =='Rented'"> <mat-form-field *ngIf="ownership.value ==3">
<input matInput placeholder="Rent Amount" <input matInput placeholder="Rent Amount"
formControlName="rent"> formControlName="rent">
</mat-form-field> </mat-form-field>

View File

@ -43,32 +43,28 @@ export class FamilyDetailsComponent implements OnInit {
public ownership: AbstractControl; public ownership: AbstractControl;
public ownershipOther: AbstractControl; public ownershipOther: AbstractControl;
public rent: AbstractControl; public rent: AbstractControl;
filteredStates: any = [
'Main Applicant',
'Co-Applicant ',
'Accountant',
'Manager',
'Relative of the applicant',
'Friend of the Applicant',
'DSA',
'Other'
];
relationData: any = []; relationData: any = [];
occupationData: any = []; occupationData: any = [];
personMetData: any = [];
ownerShipData: any = [];
customerSegData: any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
private _pd: PdTrigerService) { private _pd: PdTrigerService) {
this.notifier = notifier; this.notifier = notifier;
} }
ngOnInit() { ngOnInit() {
this.getRelation(); this.getMasterDetails('RELATIONSHIPS',1);
this.getOccupation(); this.getMasterDetails('OCCUPATIONMEMBERS',2);
this.getMasterDetails('PERSONSMET',3);
this.getMasterDetails('RESIDENCEOWNERSHIP',4);
this.getMasterDetails('CUSTOMERSEGMENT',5)
this.initFamilyForm(); this.initFamilyForm();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '6'; params.pd_form_id = '6';
this._pd.retriveForm(params).subscribe(data => { this._pd.retriveForm(params).subscribe(data => {
console.log('data', data);
const control = <FormArray>this.familyForm.controls['nonEarningMembers']; const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
const value = <FormArray>this.familyForm.controls['earningMembers']; const value = <FormArray>this.familyForm.controls['earningMembers'];
if (data.status == 200) { if (data.status == 200) {
@ -169,30 +165,31 @@ export class FamilyDetailsComponent implements OnInit {
const control = <FormArray>this.familyForm.controls['nonEarningMembers']; const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
control.removeAt(index); control.removeAt(index);
} }
// get all master details
getMasterDetails(table:string,type:number){
getRelation() { this._pd.getAllMasterDatas(table).subscribe(
let master_name = 'RELATIONSHIPS'; data => {
this._pd.getAllMasterDatas(master_name).subscribe(data => { if (data.status == 200) {
console.log('data', data); if(type==1){
data.records.forEach(val => { this.relationData=data.records.filter(item => item.isactive == 1);
if (val.isactive == 1) {
this.relationData.push(val);
} }
}) else if(type==2){
}); this.occupationData=data.records.filter(item => item.isactive == 1);
} }
getOccupation() { else if(type==3){
let master_name = 'OCCUPATIONMEMBERS'; this.personMetData=data.records.filter(item => item.isactive == 1);
this._pd.getAllMasterDatas(master_name).subscribe(data => { }
console.log('data', data); else if(type==4){
data.records.forEach(val => { this.ownerShipData=data.records.filter(item => item.isactive == 1);
if (val.isactive == 1) { }
this.occupationData.push(val); else if(type==5){
this.customerSegData=data.records.filter(item => item.isactive == 1);
}
} }
})
}); });
} }
submitFamily() { submitFamily() {
if (!this.familyForm.valid) { if (!this.familyForm.valid) {
return; return;

View File

@ -198,9 +198,8 @@ this.loadDataStatus = true;
// get pd co applicant array values // get pd co applicant array values
get pdCoapplicant() {return this._personalForm.get('coItem') as FormArray;} get pdCoapplicant() {return this._personalForm.get('coItem') as FormArray;}
// get relation master details // get all master details
getMasterDetails(table:string,type:number){ getMasterDetails(table:string,type:number){
//let relation ="RELATIONSHIPS";
this._pd.getAllMasterDatas(table).subscribe( this._pd.getAllMasterDatas(table).subscribe(
data => { data => {
if (data.status == 200) { if (data.status == 200) {
@ -218,8 +217,6 @@ this.loadDataStatus = true;
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
// get earning master details
// submit forms details // submit forms details
submitPersonalForm(formData:any) { submitPersonalForm(formData:any) {
if (this._personalForm.invalid) { if (this._personalForm.invalid) {