This commit is contained in:
saravanakumarkandasami 2018-11-15 14:53:39 +05:30
commit 5c030410fe
2 changed files with 16 additions and 9 deletions

View File

@ -88,7 +88,7 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field *ngIf="members['controls'].occupation.value==3">
<input matInput placeholder="Retired From" <input matInput placeholder="Retired From"
formControlName="retired"> formControlName="retired">
</mat-form-field> </mat-form-field>

View File

@ -145,7 +145,7 @@ export class FamilyDetailsComponent implements OnInit {
return this.fb.group({ return this.fb.group({
relationship: ['', Validators.compose([Validators.required])], relationship: ['', Validators.compose([Validators.required])],
occupation: ['', Validators.compose([Validators.required])], occupation: ['', Validators.compose([Validators.required])],
retired: ['', Validators.compose([Validators.required])], retired: [''],
}); });
} }
@ -194,31 +194,38 @@ export class FamilyDetailsComponent implements OnInit {
if (!this.familyForm.valid) { if (!this.familyForm.valid) {
return; return;
} }
console.log('data', this.familyForm.value);
let records: any = {}; let records: any = {};
records.no_of_years = this.years.value; records.no_of_years = this.years.value;
if (this.ownership.value == 'Others') { if (this.ownership.value == 4) {
records.ownership_others = this.ownershipOther.value; records.ownership_others = this.ownershipOther.value;
} }
records.ownership = this.ownership.value; records.ownership = this.ownership.value;
records.residence = this.residence.value; records.residence = this.residence.value;
if (this.ownership.value == 'Rented') { if (this.ownership.value == 3) {
records.what_rent = this.rent.value; records.what_rent = this.rent.value;
} }
if (this.person.value == 'Other') { if (this.person.value == 8) {
records.person_met_other = this.personOther.value; records.person_met_other = this.personOther.value;
} }
records.person_met = this.person.value; records.person_met = this.person.value;
records.family_members = this.members.value; records.family_members = this.members.value;
records.earning_members = this.familyForm.controls['earningMembers'].value; records.earning_members = this.familyForm.controls['earningMembers'].value;
records.non_earning_members = this.familyForm.controls['nonEarningMembers'].value; // filter retired conditions
let non_earning_members_filter = this.familyForm.controls['nonEarningMembers'].value.map(function(obj) {
if(obj.occupation==3){
return obj;
}
else{
obj.retired='';
return obj;
}
});
records.non_earning_members = non_earning_members_filter;
records.family_details_form_remark = this.familyForm.controls['family_details_form_remark'].value; records.family_details_form_remark = this.familyForm.controls['family_details_form_remark'].value;
records.pdid = this.pdid; records.pdid = this.pdid;
records.formid = '6'; records.formid = '6';
// records.fk_createdby = '251'; // records.fk_createdby = '251';
console.log('params', records);
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.'); this.notifier.notify('success', 'Saved Successfully.');
}, error => { }, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');