OLD FORMS MODIFIED NEW FORMS ADDED

This commit is contained in:
Akisha 2018-11-08 20:59:56 +05:30
parent deeadef1ea
commit d616ce6f86
14 changed files with 206 additions and 105 deletions

View File

@ -29,6 +29,10 @@
<mat-option value="Others">Others (Please specify)</mat-option>
</mat-select>
</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-select placeholder="Approach to PD location" formControlName="pd_location">
<mat-option value="{{data.pd_location_approach_id}}"
@ -99,4 +103,5 @@
</mat-card>
<button mat-raised-button type="submit" class="button" (click)="onSubmit()">Submit
</button>
</form>
</form>
<notifier-container></notifier-container>

View File

@ -28,6 +28,8 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./address.component.scss']
})
export class AddressComponent implements OnInit {
@Input() pdid: number;
locationdata: any = [];
commentData: any = [];
customerData: any = [];
@ -46,6 +48,7 @@ export class AddressComponent implements OnInit {
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
@ -58,25 +61,32 @@ export class AddressComponent implements OnInit {
params.pd_form_id = '250';
this._pd.retriveForm(params).subscribe(data => {
console.log('data', data);
var result = Object.keys(data.records.neighbourhood).map(function(key) {
return data.records.neighbourhood[key];
});
this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.pd_location.setValue(data.records.pd_location);
this.addressForm.controls.address_type.setValue(data.records.address_type);
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
this.addressForm.controls.locality.setValue(data.records.locality);
const control = <FormArray>this.addressForm.controls['neighbourhood'];
if(result.length == 0) {
control.push(this.createNeighbour());
} else {
result.forEach(datas => {
control.push(this.createNeighbour());
});
this.addressForm.controls.neighbourhood.setValue(result);
}
console.log('result', result);
if(data.status == 200) {
var result = Object.keys(data.records.neighbourhood).map(function (key) {
return data.records.neighbourhood[key];
});
this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.pd_location.setValue(data.records.pd_location);
this.addressForm.controls.address_type.setValue(data.records.address_type);
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
this.addressForm.controls.locality.setValue(data.records.locality);
if (data.records.locality_others) {
this.addressForm.controls.locality_others.setValue(data.records.locality_others);
}
if (result.length == 0) {
control.push(this.createNeighbour());
} else {
result.forEach(datas => {
control.push(this.createNeighbour());
});
this.addressForm.controls.neighbourhood.setValue(result);
}
console.log('result', result);
} else {
control.push(this.createNeighbour());
}
});
}
public initAddressForm(): void {
@ -84,6 +94,7 @@ export class AddressComponent implements OnInit {
address: ['', Validators.compose([Validators.required])],
address_type: ['', Validators.compose([Validators.required])],
locality: ['', Validators.compose([Validators.required])],
locality_others: [''],
pd_location: ['', Validators.compose([Validators.required])],
comment_locality: ['', 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_type = this.addressType.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.comment_locality = 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.formid = '250';
records.fk_createdby = '250';
@ -169,7 +183,9 @@ export class AddressComponent implements OnInit {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
});
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
validateAllFormFields(formGroup: FormGroup) {
Object.keys(formGroup.controls).forEach(field => {

View File

@ -62,4 +62,5 @@
</div>
<button mat-raised-button class="button" (click)="bankSubmit()">Submit
</button>
</form>
</form>
<notifier-container></notifier-container>

View File

@ -28,6 +28,7 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./banking-details.component.scss']
})
export class BankingDetailsComponent implements OnInit {
@Input() pdid: number;
public bankingForm: FormGroup;
step: any;
private notifier: NotifierService;
@ -35,6 +36,7 @@ export class BankingDetailsComponent implements OnInit {
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
@ -45,18 +47,22 @@ export class BankingDetailsComponent implements OnInit {
params.pd_form_id = '252';
this._pd.retriveForm(params).subscribe(data => {
console.log('data', data);
var result = Object.keys(data.records.banking_details).map(function(key) {
return data.records.banking_details[key];
});
const control = <FormArray>this.bankingForm.controls['itemRows'];
if(result.length == 0) {
control.push(this.createBankarray());
} else {
result.forEach(datas => {
control.push(this.createBankarray());
});
this.bankingForm.controls.itemRows.setValue(result);
}
if( data.status == 200) {
var result = Object.keys(data.records.banking_details).map(function (key) {
return data.records.banking_details[key];
});
if (result.length == 0) {
control.push(this.createBankarray());
} else {
result.forEach(datas => {
control.push(this.createBankarray());
});
this.bankingForm.controls.itemRows.setValue(result);
}
} else {
control.push(this.createBankarray());
}
});
}
public initBankingForm(): void {
@ -99,7 +105,9 @@ export class BankingDetailsComponent implements OnInit {
this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
})
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
validateAllFormFields(formGroup: FormGroup) {
Object.keys(formGroup.controls).forEach(field => {

View File

@ -1,3 +1,4 @@
<p>Current Loan Details</p>
<form [formGroup]="currentLoanForm" class="address">
<mat-form-field>
<mat-select placeholder="Do you have any other existing Loan"

View File

@ -12,6 +12,7 @@
}
.address .button {
float: right;
height: 10px;
width: 10px;
background: #62B013;
color: white;

View File

@ -30,19 +30,45 @@ import {ActivatedRoute, Router} from "@angular/router";
export class CurrentLoanComponent implements OnInit {
public currentLoanForm: FormGroup;
private notifier: NotifierService;
@Input() pdid: number;
@Input() form_id: number;
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
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 {
this.currentLoanForm = this.fb.group({
existing_loan: ['', Validators.compose([Validators.required])],
loan_details: this.fb.array([this.createLoanDetail()])
loan_details: this.fb.array([])
});
}
createLoanDetail() {
@ -69,15 +95,17 @@ export class CurrentLoanComponent implements OnInit {
return;
}
let records: any = {};
records.pdid = '253';
records.formid = '253';
records.fk_createdby = '253';
records.pdid = this.pdid;
records.formid = this.form_id;
records.fk_createdby = this.pdid;
records.existing_loan = this.currentLoanForm.controls['existing_loan'].value;
records.loan_details = this.currentLoanForm.controls['loan_details'].value;
console.log('data', records);
this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
validateAllFormFields(formGroup: FormGroup) {

View File

@ -24,9 +24,9 @@
<mat-card-content class="matcard">
<mat-form-field>
<mat-select placeholder="Relation" formControlName="relation">
<mat-option value="{{relation.relationship_id}}"
*ngFor="let relation of relationData">
{{relation.name}}
<mat-option value="{{relations.relationship_id}}"
*ngFor="let relations of relationData">
{{relations.name}}
</mat-option>
</mat-select>
</mat-form-field>
@ -131,4 +131,5 @@
</mat-card-content>
</mat-card>
<button mat-raised-button class="button" (click)="submitFamily()">Submit</button>
</form>
</form>
<notifier-container></notifier-container>

View File

@ -28,6 +28,8 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./family-details.component.scss']
})
export class FamilyDetailsComponent implements OnInit {
@Input() pdid: number;
public currentLoanForm: FormGroup;
private notifier: NotifierService;
public familyForm: FormGroup;
@ -40,13 +42,21 @@ export class FamilyDetailsComponent implements OnInit {
public ownership: AbstractControl;
public ownershipOther: 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 = [];
occupationData: any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
this.getRelation();
@ -54,41 +64,50 @@ export class FamilyDetailsComponent implements OnInit {
this.initFamilyForm();
let params: any = {};
params.pd_id = '251';
params.pd_form_id = '251';
params.pd_form_id = '555';
this._pd.retriveForm(params).subscribe(data => {
console.log('data', data);
var result = Object.keys(data.records.non_earning_members).map(function(key) {
return data.records.non_earning_members[key];
});
var earning = Object.keys(data.records.earning_members).map(function(key) {
return data.records.earning_members[key];
});
this.familyForm.controls.person.setValue(data.records.person_met);
this.familyForm.controls.members.setValue(data.records.family_members);
this.familyForm.controls.years.setValue(data.records.no_of_years);
this.familyForm.controls.ownership.setValue(data.records.ownership);
this.familyForm.controls.rent.setValue(data.records.what_rent);
const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
if (result.length == 0) {
control.push(this.createNonMembers());
} else {
result.forEach(datas => {
control.push(this.createNonMembers());
});
this.familyForm.controls.nonEarningMembers.setValue(result);
}
const value = <FormArray>this.familyForm.controls['earningMembers'];
if(earning.length == 0) {
value.push(this.createMembers());
} else {
earning.forEach(datas => {
value.push(this.createMembers());
if (data.status == 200) {
var result = Object.keys(data.records.non_earning_members).map(function (key) {
return data.records.non_earning_members[key];
});
this.familyForm.controls.earningMembers.setValue(earning);
var earning = Object.keys(data.records.earning_members).map(function (key) {
return data.records.earning_members[key];
});
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.years.setValue(data.records.no_of_years);
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);
if (result.length == 0) {
control.push(this.createNonMembers());
} else {
result.forEach(datas => {
control.push(this.createNonMembers());
});
this.familyForm.controls.nonEarningMembers.setValue(result);
}
if (earning.length == 0) {
value.push(this.createMembers());
} else {
earning.forEach(datas => {
value.push(this.createMembers());
});
this.familyForm.controls.earningMembers.setValue(earning);
}
this.familyForm.controls.residence.setValue(data.records.residence);
} else {
value.push(this.createMembers());
control.push(this.createNonMembers());
}
this.familyForm.controls.residence.setValue(data.records.residence);
});
}
public initFamilyForm(): void {
@ -178,30 +197,30 @@ export class FamilyDetailsComponent implements OnInit {
let records: any = {};
records.no_of_years = this.years.value;
if (this.ownership.value == 'Others') {
records.ownership = this.ownershipOther.value;
} else {
records.ownership = this.ownership.value;
records.ownership_others = this.ownershipOther.value;
}
records.ownership = this.ownership.value;
records.residence = this.residence.value;
if (this.ownership.value == 'Rented') {
records.what_rent = this.rent.value;
}
if (this.person.value == 'Other') {
records.person_met = this.personOther.value;
} else {
records.person_met = this.person.value;
records.person_met_other = this.personOther.value;
}
records.person_met = this.person.value;
records.family_members = this.members.value;
records.earning_members = this.familyForm.controls['earningMembers'].value;
records.non_earning_members = this.familyForm.controls['nonEarningMembers'].value;
records.pdid = '251';
records.formid = '251';
records.formid = '555';
records.fk_createdby = '251';
console.log('params', records);
this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
})
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
validateAllFormFields(formGroup: FormGroup) {
Object.keys(formGroup.controls).forEach(field => {

View File

@ -6,7 +6,7 @@
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'">
<mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">
<mat-card-header>
<p>Loan Details<p>
</mat-card-header>
@ -27,7 +27,9 @@
<input matInput placeholder="Amount" formControlName="amount">
</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>
<button type="button" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
*ngIf="i==0">
@ -41,5 +43,5 @@
</div>
</div>
</mat-card>
<button type="submit" (click)="submitCurrentDetails()"></button>
<button mat-raised-button type="submit" class="button" (click)="submitCurrentDetails()"></button>
</form>

View File

@ -13,6 +13,7 @@
.address .button {
float: right;
width: 10px;
height: 10px;
background: #62B013;
color: white;
}

View File

@ -28,23 +28,48 @@ import {ActivatedRoute, Router} from '@angular/router';
styleUrls: ['./other-income.component.scss']
})
export class OtherIncomeComponent implements OnInit {
@Input() pdid: number;
@Input() form_id: number;
public otherIncomeForm: FormGroup;
private notifier: NotifierService;
frequencyData: any;
frequencyData: any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
this.initOtherincomeForm();
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 {
this.otherIncomeForm = this.fb.group({
other_income: ['', Validators.compose([Validators.required])],
income_details: this.fb.array([this.createDetail()])
income_details: this.fb.array([])
});
}
createDetail() {
@ -79,15 +104,17 @@ export class OtherIncomeComponent implements OnInit {
return;
}
let records: any = {};
records.pdid = '254';
records.formid = '254';
records.fk_createdby = '254';
records.pdid = this.pdid;
records.formid = this.form_id;
records.fk_createdby = this.pdid;
records.other_income = this.otherIncomeForm.controls['other_income'].value;
records.income_details = this.otherIncomeForm.controls['income_details'].value;
console.log('data', records);
this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
validateAllFormFields(formGroup: FormGroup) {

View File

@ -394,21 +394,21 @@
<app-assets-info [pdid]="startPD"></app-assets-info>
</ng-container>
<ng-container *ngSwitchCase="5">
<app-address></app-address>
<app-address [pdid]="startPD"></app-address>
<!-- end personal type questions -->
</ng-container>
<ng-container *ngSwitchCase="6">
<app-family-details></app-family-details>
<app-family-details [pdid]="startPD"></app-family-details>
</ng-container>
<ng-container *ngSwitchCase="7">
<!--<p>Banking details</p>-->
<app-banking-details></app-banking-details>
<app-banking-details [pdid]="startPD" ></app-banking-details>
</ng-container>
<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 *ngSwitchCase="9">
<app-other-income></app-other-income>
<app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income>
</ng-container>
<!-- end personal type questions
-->

View File

@ -28,15 +28,6 @@ export class StartPdComponent implements OnInit, OnDestroy {
getQuestionsLength: number;
answerList: 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];
// errorMessage:any;
// selectedCategory:any=[];