OLD FORMS MODIFIED NEW FORMS ADDED
This commit is contained in:
parent
deeadef1ea
commit
d616ce6f86
@ -29,6 +29,10 @@
|
|||||||
<mat-option value="Others">Others (Please specify)</mat-option>
|
<mat-option value="Others">Others (Please specify)</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'">
|
||||||
|
<input matInput placeholder="Specify Locality"
|
||||||
|
formControlName="locality_others">
|
||||||
|
</mat-form-field>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Approach to PD location" formControlName="pd_location">
|
<mat-select placeholder="Approach to PD location" formControlName="pd_location">
|
||||||
<mat-option value="{{data.pd_location_approach_id}}"
|
<mat-option value="{{data.pd_location_approach_id}}"
|
||||||
@ -100,3 +104,4 @@
|
|||||||
<button mat-raised-button type="submit" class="button" (click)="onSubmit()">Submit
|
<button mat-raised-button type="submit" class="button" (click)="onSubmit()">Submit
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
<notifier-container></notifier-container>
|
||||||
|
|||||||
@ -28,6 +28,8 @@ import {ActivatedRoute, Router} from "@angular/router";
|
|||||||
styleUrls: ['./address.component.scss']
|
styleUrls: ['./address.component.scss']
|
||||||
})
|
})
|
||||||
export class AddressComponent implements OnInit {
|
export class AddressComponent implements OnInit {
|
||||||
|
@Input() pdid: number;
|
||||||
|
|
||||||
locationdata: any = [];
|
locationdata: any = [];
|
||||||
commentData: any = [];
|
commentData: any = [];
|
||||||
customerData: any = [];
|
customerData: any = [];
|
||||||
@ -46,6 +48,7 @@ export class AddressComponent implements OnInit {
|
|||||||
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -58,6 +61,8 @@ export class AddressComponent implements OnInit {
|
|||||||
params.pd_form_id = '250';
|
params.pd_form_id = '250';
|
||||||
this._pd.retriveForm(params).subscribe(data => {
|
this._pd.retriveForm(params).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
|
const control = <FormArray>this.addressForm.controls['neighbourhood'];
|
||||||
|
if(data.status == 200) {
|
||||||
var result = Object.keys(data.records.neighbourhood).map(function (key) {
|
var result = Object.keys(data.records.neighbourhood).map(function (key) {
|
||||||
return data.records.neighbourhood[key];
|
return data.records.neighbourhood[key];
|
||||||
});
|
});
|
||||||
@ -67,7 +72,9 @@ export class AddressComponent implements OnInit {
|
|||||||
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
|
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
|
||||||
this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
|
this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
|
||||||
this.addressForm.controls.locality.setValue(data.records.locality);
|
this.addressForm.controls.locality.setValue(data.records.locality);
|
||||||
const control = <FormArray>this.addressForm.controls['neighbourhood'];
|
if (data.records.locality_others) {
|
||||||
|
this.addressForm.controls.locality_others.setValue(data.records.locality_others);
|
||||||
|
}
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
control.push(this.createNeighbour());
|
control.push(this.createNeighbour());
|
||||||
} else {
|
} else {
|
||||||
@ -77,6 +84,9 @@ export class AddressComponent implements OnInit {
|
|||||||
this.addressForm.controls.neighbourhood.setValue(result);
|
this.addressForm.controls.neighbourhood.setValue(result);
|
||||||
}
|
}
|
||||||
console.log('result', result);
|
console.log('result', result);
|
||||||
|
} else {
|
||||||
|
control.push(this.createNeighbour());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public initAddressForm(): void {
|
public initAddressForm(): void {
|
||||||
@ -84,6 +94,7 @@ export class AddressComponent implements OnInit {
|
|||||||
address: ['', Validators.compose([Validators.required])],
|
address: ['', Validators.compose([Validators.required])],
|
||||||
address_type: ['', Validators.compose([Validators.required])],
|
address_type: ['', Validators.compose([Validators.required])],
|
||||||
locality: ['', Validators.compose([Validators.required])],
|
locality: ['', Validators.compose([Validators.required])],
|
||||||
|
locality_others: [''],
|
||||||
pd_location: ['', Validators.compose([Validators.required])],
|
pd_location: ['', Validators.compose([Validators.required])],
|
||||||
comment_locality: ['', Validators.compose([Validators.required])],
|
comment_locality: ['', Validators.compose([Validators.required])],
|
||||||
customer_behaviour: ['', Validators.compose([Validators.required])],
|
customer_behaviour: ['', Validators.compose([Validators.required])],
|
||||||
@ -157,10 +168,13 @@ export class AddressComponent implements OnInit {
|
|||||||
records.address = this.address.value;
|
records.address = this.address.value;
|
||||||
records.address_type = this.addressType.value;
|
records.address_type = this.addressType.value;
|
||||||
records.locality = this.locality.value;
|
records.locality = this.locality.value;
|
||||||
|
if (this.locality.value == 'Others') {
|
||||||
|
records.locality_others = this.addressForm.controls.locality_others.value;
|
||||||
|
}
|
||||||
records.pd_location = this.pdLocation.value;
|
records.pd_location = this.pdLocation.value;
|
||||||
records.comment_locality = this.commentlocality.value;
|
records.comment_locality = this.commentlocality.value;
|
||||||
records.customer_behaviour = this.commentlocality.value;
|
records.customer_behaviour = this.commentlocality.value;
|
||||||
records.neighbourhood = this.addressForm.value.items;
|
records.neighbourhood = this.addressForm.controls.neighbourhood.value;
|
||||||
records.pdid = '250';
|
records.pdid = '250';
|
||||||
records.formid = '250';
|
records.formid = '250';
|
||||||
records.fk_createdby = '250';
|
records.fk_createdby = '250';
|
||||||
@ -169,6 +183,8 @@ export class AddressComponent implements OnInit {
|
|||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
|
|||||||
@ -63,3 +63,4 @@
|
|||||||
<button mat-raised-button class="button" (click)="bankSubmit()">Submit
|
<button mat-raised-button class="button" (click)="bankSubmit()">Submit
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
<notifier-container></notifier-container>
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import {ActivatedRoute, Router} from "@angular/router";
|
|||||||
styleUrls: ['./banking-details.component.scss']
|
styleUrls: ['./banking-details.component.scss']
|
||||||
})
|
})
|
||||||
export class BankingDetailsComponent implements OnInit {
|
export class BankingDetailsComponent implements OnInit {
|
||||||
|
@Input() pdid: number;
|
||||||
public bankingForm: FormGroup;
|
public bankingForm: FormGroup;
|
||||||
step: any;
|
step: any;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
@ -35,6 +36,7 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -45,10 +47,11 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
params.pd_form_id = '252';
|
params.pd_form_id = '252';
|
||||||
this._pd.retriveForm(params).subscribe(data => {
|
this._pd.retriveForm(params).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
|
const control = <FormArray>this.bankingForm.controls['itemRows'];
|
||||||
|
if( data.status == 200) {
|
||||||
var result = Object.keys(data.records.banking_details).map(function (key) {
|
var result = Object.keys(data.records.banking_details).map(function (key) {
|
||||||
return data.records.banking_details[key];
|
return data.records.banking_details[key];
|
||||||
});
|
});
|
||||||
const control = <FormArray>this.bankingForm.controls['itemRows'];
|
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
control.push(this.createBankarray());
|
control.push(this.createBankarray());
|
||||||
} else {
|
} else {
|
||||||
@ -57,6 +60,9 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.bankingForm.controls.itemRows.setValue(result);
|
this.bankingForm.controls.itemRows.setValue(result);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
control.push(this.createBankarray());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public initBankingForm(): void {
|
public initBankingForm(): void {
|
||||||
@ -99,7 +105,9 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
})
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
Object.keys(formGroup.controls).forEach(field => {
|
Object.keys(formGroup.controls).forEach(field => {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
<p>Current Loan Details</p>
|
||||||
<form [formGroup]="currentLoanForm" class="address">
|
<form [formGroup]="currentLoanForm" class="address">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Do you have any other existing Loan"
|
<mat-select placeholder="Do you have any other existing Loan"
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
}
|
}
|
||||||
.address .button {
|
.address .button {
|
||||||
float: right;
|
float: right;
|
||||||
|
height: 10px;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
background: #62B013;
|
background: #62B013;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
@ -30,19 +30,45 @@ import {ActivatedRoute, Router} from "@angular/router";
|
|||||||
export class CurrentLoanComponent implements OnInit {
|
export class CurrentLoanComponent implements OnInit {
|
||||||
public currentLoanForm: FormGroup;
|
public currentLoanForm: FormGroup;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
|
@Input() pdid: number;
|
||||||
|
@Input() form_id: number;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.initCurrentloanForm();
|
this.initCurrentloanForm();
|
||||||
|
let params: any = {};
|
||||||
|
params.pd_id = this.pdid;
|
||||||
|
params.pd_form_id = this.form_id;
|
||||||
|
this._pd.retriveForm(params).subscribe(value => {
|
||||||
|
console.log('value', value);
|
||||||
|
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
|
||||||
|
if (value.status == 200) {
|
||||||
|
var result = Object.keys(value.records.loan_details).map(function(key) {
|
||||||
|
return value.records.loan_details[key];
|
||||||
|
});
|
||||||
|
this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan);
|
||||||
|
if (result.length > 0) {
|
||||||
|
result.forEach(val => {
|
||||||
|
control.push(this.createLoanDetail());
|
||||||
|
});
|
||||||
|
this.currentLoanForm.controls['loan_details'].setValue(result);
|
||||||
|
} else {
|
||||||
|
control.push(this.createLoanDetail());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
control.push(this.createLoanDetail());
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
public initCurrentloanForm(): void {
|
public initCurrentloanForm(): void {
|
||||||
this.currentLoanForm = this.fb.group({
|
this.currentLoanForm = this.fb.group({
|
||||||
existing_loan: ['', Validators.compose([Validators.required])],
|
existing_loan: ['', Validators.compose([Validators.required])],
|
||||||
loan_details: this.fb.array([this.createLoanDetail()])
|
loan_details: this.fb.array([])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
createLoanDetail() {
|
createLoanDetail() {
|
||||||
@ -69,15 +95,17 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let records: any = {};
|
let records: any = {};
|
||||||
records.pdid = '253';
|
records.pdid = this.pdid;
|
||||||
records.formid = '253';
|
records.formid = this.form_id;
|
||||||
records.fk_createdby = '253';
|
records.fk_createdby = this.pdid;
|
||||||
records.existing_loan = this.currentLoanForm.controls['existing_loan'].value;
|
records.existing_loan = this.currentLoanForm.controls['existing_loan'].value;
|
||||||
records.loan_details = this.currentLoanForm.controls['loan_details'].value;
|
records.loan_details = this.currentLoanForm.controls['loan_details'].value;
|
||||||
console.log('data', records);
|
console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
|
|||||||
@ -24,9 +24,9 @@
|
|||||||
<mat-card-content class="matcard">
|
<mat-card-content class="matcard">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Relation" formControlName="relation">
|
<mat-select placeholder="Relation" formControlName="relation">
|
||||||
<mat-option value="{{relation.relationship_id}}"
|
<mat-option value="{{relations.relationship_id}}"
|
||||||
*ngFor="let relation of relationData">
|
*ngFor="let relations of relationData">
|
||||||
{{relation.name}}
|
{{relations.name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@ -132,3 +132,4 @@
|
|||||||
</mat-card>
|
</mat-card>
|
||||||
<button mat-raised-button class="button" (click)="submitFamily()">Submit</button>
|
<button mat-raised-button class="button" (click)="submitFamily()">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
<notifier-container></notifier-container>
|
||||||
|
|||||||
@ -28,6 +28,8 @@ import {ActivatedRoute, Router} from "@angular/router";
|
|||||||
styleUrls: ['./family-details.component.scss']
|
styleUrls: ['./family-details.component.scss']
|
||||||
})
|
})
|
||||||
export class FamilyDetailsComponent implements OnInit {
|
export class FamilyDetailsComponent implements OnInit {
|
||||||
|
@Input() pdid: number;
|
||||||
|
|
||||||
public currentLoanForm: FormGroup;
|
public currentLoanForm: FormGroup;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
public familyForm: FormGroup;
|
public familyForm: FormGroup;
|
||||||
@ -40,13 +42,21 @@ 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 = [
|
||||||
|
'Co-Applicant 1 to x',
|
||||||
|
'Accountant',
|
||||||
|
'Manager',
|
||||||
|
'Relative of the applicant',
|
||||||
|
'Friend of the Applicant',
|
||||||
|
'DSA',
|
||||||
|
'Other'
|
||||||
|
];
|
||||||
relationData: any = [];
|
relationData: any = [];
|
||||||
occupationData: any = [];
|
occupationData: 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;
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getRelation();
|
this.getRelation();
|
||||||
@ -54,9 +64,12 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
this.initFamilyForm();
|
this.initFamilyForm();
|
||||||
let params: any = {};
|
let params: any = {};
|
||||||
params.pd_id = '251';
|
params.pd_id = '251';
|
||||||
params.pd_form_id = '251';
|
params.pd_form_id = '555';
|
||||||
this._pd.retriveForm(params).subscribe(data => {
|
this._pd.retriveForm(params).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
|
const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
|
||||||
|
const value = <FormArray>this.familyForm.controls['earningMembers'];
|
||||||
|
if (data.status == 200) {
|
||||||
var result = Object.keys(data.records.non_earning_members).map(function (key) {
|
var result = Object.keys(data.records.non_earning_members).map(function (key) {
|
||||||
return data.records.non_earning_members[key];
|
return data.records.non_earning_members[key];
|
||||||
});
|
});
|
||||||
@ -64,11 +77,16 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
return data.records.earning_members[key];
|
return data.records.earning_members[key];
|
||||||
});
|
});
|
||||||
this.familyForm.controls.person.setValue(data.records.person_met);
|
this.familyForm.controls.person.setValue(data.records.person_met);
|
||||||
|
if (data.records.person_met_other) {
|
||||||
|
this.familyForm.controls.personOther.setValue(data.records.person_met_other);
|
||||||
|
}
|
||||||
this.familyForm.controls.members.setValue(data.records.family_members);
|
this.familyForm.controls.members.setValue(data.records.family_members);
|
||||||
this.familyForm.controls.years.setValue(data.records.no_of_years);
|
this.familyForm.controls.years.setValue(data.records.no_of_years);
|
||||||
this.familyForm.controls.ownership.setValue(data.records.ownership);
|
this.familyForm.controls.ownership.setValue(data.records.ownership);
|
||||||
|
if (data.records.ownership_others) {
|
||||||
|
this.familyForm.controls.ownershipOther.setValue(data.records.ownership_others);
|
||||||
|
}
|
||||||
this.familyForm.controls.rent.setValue(data.records.what_rent);
|
this.familyForm.controls.rent.setValue(data.records.what_rent);
|
||||||
const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
|
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
control.push(this.createNonMembers());
|
control.push(this.createNonMembers());
|
||||||
} else {
|
} else {
|
||||||
@ -77,7 +95,6 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.familyForm.controls.nonEarningMembers.setValue(result);
|
this.familyForm.controls.nonEarningMembers.setValue(result);
|
||||||
}
|
}
|
||||||
const value = <FormArray>this.familyForm.controls['earningMembers'];
|
|
||||||
if (earning.length == 0) {
|
if (earning.length == 0) {
|
||||||
value.push(this.createMembers());
|
value.push(this.createMembers());
|
||||||
} else {
|
} else {
|
||||||
@ -85,10 +102,12 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
value.push(this.createMembers());
|
value.push(this.createMembers());
|
||||||
});
|
});
|
||||||
this.familyForm.controls.earningMembers.setValue(earning);
|
this.familyForm.controls.earningMembers.setValue(earning);
|
||||||
|
|
||||||
}
|
}
|
||||||
this.familyForm.controls.residence.setValue(data.records.residence);
|
this.familyForm.controls.residence.setValue(data.records.residence);
|
||||||
|
} else {
|
||||||
|
value.push(this.createMembers());
|
||||||
|
control.push(this.createNonMembers());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public initFamilyForm(): void {
|
public initFamilyForm(): void {
|
||||||
@ -178,30 +197,30 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
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 == 'Others') {
|
||||||
records.ownership = this.ownershipOther.value;
|
records.ownership_others = this.ownershipOther.value;
|
||||||
} else {
|
|
||||||
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 == 'Rented') {
|
||||||
records.what_rent = this.rent.value;
|
records.what_rent = this.rent.value;
|
||||||
}
|
}
|
||||||
if (this.person.value == 'Other') {
|
if (this.person.value == 'Other') {
|
||||||
records.person_met = this.personOther.value;
|
records.person_met_other = this.personOther.value;
|
||||||
} else {
|
|
||||||
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;
|
records.non_earning_members = this.familyForm.controls['nonEarningMembers'].value;
|
||||||
records.pdid = '251';
|
records.pdid = '251';
|
||||||
records.formid = '251';
|
records.formid = '555';
|
||||||
records.fk_createdby = '251';
|
records.fk_createdby = '251';
|
||||||
console.log('params', records);
|
console.log('params', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
})
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
Object.keys(formGroup.controls).forEach(field => {
|
Object.keys(formGroup.controls).forEach(field => {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<mat-option value="No">No</mat-option>
|
<mat-option value="No">No</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'">
|
<mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<p>Loan Details<p>
|
<p>Loan Details<p>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
@ -27,7 +27,9 @@
|
|||||||
<input matInput placeholder="Amount" formControlName="amount">
|
<input matInput placeholder="Amount" formControlName="amount">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Frequency" formControlName="frequency">
|
<mat-select placeholder="Frequency" formControlName="frequency">
|
||||||
|
<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button type="button" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
|
<button type="button" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
|
||||||
*ngIf="i==0">
|
*ngIf="i==0">
|
||||||
@ -41,5 +43,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<button type="submit" (click)="submitCurrentDetails()"></button>
|
<button mat-raised-button type="submit" class="button" (click)="submitCurrentDetails()"></button>
|
||||||
</form>
|
</form>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
.address .button {
|
.address .button {
|
||||||
float: right;
|
float: right;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
background: #62B013;
|
background: #62B013;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
@ -28,23 +28,48 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||||||
styleUrls: ['./other-income.component.scss']
|
styleUrls: ['./other-income.component.scss']
|
||||||
})
|
})
|
||||||
export class OtherIncomeComponent implements OnInit {
|
export class OtherIncomeComponent implements OnInit {
|
||||||
|
@Input() pdid: number;
|
||||||
|
@Input() form_id: number;
|
||||||
public otherIncomeForm: FormGroup;
|
public otherIncomeForm: FormGroup;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
frequencyData: any;
|
frequencyData: 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;
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.initOtherincomeForm();
|
|
||||||
this.getFrequency();
|
this.getFrequency();
|
||||||
|
this.initOtherincomeForm();
|
||||||
|
let params: any = {};
|
||||||
|
params.pd_id = this.pdid;
|
||||||
|
params.pd_form_id = this.form_id;
|
||||||
|
this._pd.retriveForm(params).subscribe(value => {
|
||||||
|
console.log('value', value);
|
||||||
|
const control = <FormArray>this.otherIncomeForm.controls['income_details'];
|
||||||
|
if (value.status == 200) {
|
||||||
|
var result = Object.keys(value.records.income_details).map(function(key) {
|
||||||
|
return value.records.income_details[key];
|
||||||
|
});
|
||||||
|
this.otherIncomeForm.controls['other_income'].setValue(value.records.other_income);
|
||||||
|
if (result.length > 0) {
|
||||||
|
result.forEach(val => {
|
||||||
|
control.push(this.createDetail());
|
||||||
|
});
|
||||||
|
this.otherIncomeForm.controls['income_details'].setValue(result);
|
||||||
|
} else {
|
||||||
|
control.push(this.createDetail());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
control.push(this.createDetail());
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
public initOtherincomeForm(): void {
|
public initOtherincomeForm(): void {
|
||||||
this.otherIncomeForm = this.fb.group({
|
this.otherIncomeForm = this.fb.group({
|
||||||
other_income: ['', Validators.compose([Validators.required])],
|
other_income: ['', Validators.compose([Validators.required])],
|
||||||
income_details: this.fb.array([this.createDetail()])
|
income_details: this.fb.array([])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
createDetail() {
|
createDetail() {
|
||||||
@ -79,15 +104,17 @@ export class OtherIncomeComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let records: any = {};
|
let records: any = {};
|
||||||
records.pdid = '254';
|
records.pdid = this.pdid;
|
||||||
records.formid = '254';
|
records.formid = this.form_id;
|
||||||
records.fk_createdby = '254';
|
records.fk_createdby = this.pdid;
|
||||||
records.other_income = this.otherIncomeForm.controls['other_income'].value;
|
records.other_income = this.otherIncomeForm.controls['other_income'].value;
|
||||||
records.income_details = this.otherIncomeForm.controls['income_details'].value;
|
records.income_details = this.otherIncomeForm.controls['income_details'].value;
|
||||||
console.log('data', records);
|
console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
|
|||||||
@ -394,21 +394,21 @@
|
|||||||
<app-assets-info [pdid]="startPD"></app-assets-info>
|
<app-assets-info [pdid]="startPD"></app-assets-info>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngSwitchCase="5">
|
<ng-container *ngSwitchCase="5">
|
||||||
<app-address></app-address>
|
<app-address [pdid]="startPD"></app-address>
|
||||||
<!-- end personal type questions -->
|
<!-- end personal type questions -->
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngSwitchCase="6">
|
<ng-container *ngSwitchCase="6">
|
||||||
<app-family-details></app-family-details>
|
<app-family-details [pdid]="startPD"></app-family-details>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngSwitchCase="7">
|
<ng-container *ngSwitchCase="7">
|
||||||
<!--<p>Banking details</p>-->
|
<!--<p>Banking details</p>-->
|
||||||
<app-banking-details></app-banking-details>
|
<app-banking-details [pdid]="startPD" ></app-banking-details>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngSwitchCase="8">
|
<ng-container *ngSwitchCase="8">
|
||||||
<app-current-loan></app-current-loan>
|
<app-current-loan [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-current-loan>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngSwitchCase="9">
|
<ng-container *ngSwitchCase="9">
|
||||||
<app-other-income></app-other-income>
|
<app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<!-- end personal type questions
|
<!-- end personal type questions
|
||||||
-->
|
-->
|
||||||
|
|||||||
@ -28,15 +28,6 @@ export class StartPdComponent implements OnInit, OnDestroy {
|
|||||||
getQuestionsLength: number;
|
getQuestionsLength: number;
|
||||||
answerList: any = [];
|
answerList: any = [];
|
||||||
ansPDList: any = [];
|
ansPDList: any = [];
|
||||||
filteredStates: any = [
|
|
||||||
'Co-Applicant 1 to x',
|
|
||||||
'Accountant',
|
|
||||||
'Manager',
|
|
||||||
'Relative of the applicant',
|
|
||||||
'Friend of the Applicant',
|
|
||||||
'DSA',
|
|
||||||
'Other'
|
|
||||||
];
|
|
||||||
relationDetails: any = [1];
|
relationDetails: any = [1];
|
||||||
// errorMessage:any;
|
// errorMessage:any;
|
||||||
// selectedCategory:any=[];
|
// selectedCategory:any=[];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user