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

View File

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

View File

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