merge : kms

This commit is contained in:
gandhimathi 2018-11-30 18:58:20 +05:30
parent e223ae4acf
commit 0997fc3e6a
21 changed files with 820 additions and 258 deletions

View File

@ -15,19 +15,18 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['address_type'].value == 12"> <mat-form-field *ngIf="addressForm.controls['address_type'].value == 12">
<input matInput placeholder="Address Type Others" formControlName="address_type_others"> <input matInput placeholder="Address Type Others" formControlName="address_type_others">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Locality" formControlName="locality" required> <mat-select placeholder="Locality" formControlName="locality" required>
<mat-option value="{{m_locality.locality_id}}" <mat-option value="{{m_locality.locality_id}}"
*ngFor="let m_locality of localityData">{{m_locality.locality_name}} *ngFor="let m_locality of localityData">{{m_locality.locality_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'"> <mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'">
<input matInput placeholder="Specify Locality" <input matInput placeholder="Specify Locality"
formControlName="locality_others"> formControlName="locality_others">
@ -46,14 +45,15 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <!-- Don't Remove To replace atlast of the PD Completion and creating new form (Customer Behaviour 221118 review doc : s.no 3.e )
<mat-form-field>
<mat-select placeholder="Customer Behaviour" <mat-select placeholder="Customer Behaviour"
formControlName="customer_behaviour" required> formControlName="customer_behaviour" required>
<mat-option value="{{data.customer_behaviour_id}}" <mat-option value="{{data.customer_behaviour_id}}"
*ngFor="let data of customerData">{{data.description}} *ngFor="let data of customerData">{{data.description}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>--(Customer Behaviour)-->
<mat-form-field> <mat-form-field>
<mat-select placeholder="Ownership" formControlName="address_ownership"> <mat-select placeholder="Ownership" formControlName="address_ownership">
<mat-option value="{{ownerShip.id}}" <mat-option value="{{ownerShip.id}}"
@ -83,7 +83,8 @@
<input matInput placeholder="Bussiness Address Type Others" formControlName="bussiness_address_type_others"> <input matInput placeholder="Bussiness Address Type Others" formControlName="bussiness_address_type_others">
</mat-form-field> </mat-form-field>
<mat-card> <!--- Don't Remove To replace atlast of the PD Completion and creating new form (Neighbourhood check) --
<mat-card>
<mat-card-header> <mat-card-header>
<p>Neighbourhood</p> <p>Neighbourhood</p>
</mat-card-header> </mat-card-header>
@ -119,7 +120,7 @@
<!-- <mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="How long do you know the applicant" <input matInput placeholder="How long do you know the applicant"
formControlName="how_long"> formControlName="how_long">
</mat-form-field> --> </mat-form-field> ->-
<div> <div>
<label>How long do you know the applicant?</label> <label>How long do you know the applicant?</label>
<br> <br>
@ -148,6 +149,7 @@
</div> </div>
</div> </div>
</mat-card> </mat-card>
End of Neighbourhood Check-->
<div fxLayout="row"> <div fxLayout="row">
<div fxFlex="60" class="pb-0 text-sm-left"> <div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">

View File

@ -33,13 +33,13 @@ export class AddressComponent implements OnInit {
locationdata: any = []; locationdata: any = [];
commentData: any = []; commentData: any = [];
customerData: any = []; //customerData: any = []; 221118 review doc s.no 3.e
addressData:any = []; addressData:any = [];
localityData:any = []; localityData:any = [];
ownerShipData:any = []; ownerShipData:any = [];
neighbourStatusData:any=["Yes","No"]; //neighbourStatusData:any=["Yes","No"];
applicantOwnerData:any=["Yes","No","Dont Know"]; //applicantOwnerData:any=["Yes","No","Dont Know"];
public currentLoanForm: FormGroup; public currentLoanForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
@ -65,7 +65,7 @@ export class AddressComponent implements OnInit {
console.clear(); console.clear();
this.getMasterDetails('PDLOCATIONAPPROACH',1); this.getMasterDetails('PDLOCATIONAPPROACH',1);
this.getMasterDetails('COMMENTSONLOCALITY',2); this.getMasterDetails('COMMENTSONLOCALITY',2);
this.getMasterDetails('CUSTOMERBEHAVIOUR',3); //this.getMasterDetails('CUSTOMERBEHAVIOUR',3);review doc s.no 3.e
this.getMasterDetails('LOCALITY',4); this.getMasterDetails('LOCALITY',4);
this.getMasterDetails('ADDRESSTYPE',5); this.getMasterDetails('ADDRESSTYPE',5);
this.getMasterDetails('RESIDENCEOWNERSHIP',6); this.getMasterDetails('RESIDENCEOWNERSHIP',6);
@ -75,11 +75,11 @@ export class AddressComponent implements OnInit {
params.pd_form_id = '5'; params.pd_form_id = '5';
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']; //const control = <FormArray>this.addressForm.controls['neighbourhood'];
if(data.status == 200) { 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];
}); // });
this.addressForm.controls.address.setValue(data.records.address); this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.pd_location.setValue(data.records.pd_location); this.addressForm.controls.pd_location.setValue(data.records.pd_location);
this.addressForm.controls.address_type.setValue(data.records.address_type); this.addressForm.controls.address_type.setValue(data.records.address_type);
@ -87,7 +87,7 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.address_type_others.setValue(data.records.address_type_others); this.addressForm.controls.address_type_others.setValue(data.records.address_type_others);
} }
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);
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark); this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
this.addressForm.controls.address_ownership.setValue(data.records.address_ownership); this.addressForm.controls.address_ownership.setValue(data.records.address_ownership);
@ -101,16 +101,16 @@ export class AddressComponent implements OnInit {
if (data.records.locality_others) { if (data.records.locality_others) {
this.addressForm.controls.locality_others.setValue(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 {
result.forEach(datas => { // result.forEach(datas => {
control.push(this.createNeighbour()); // control.push(this.createNeighbour());
}); // });
this.addressForm.controls.neighbourhood.setValue(result); // this.addressForm.controls.neighbourhood.setValue(result);
} // }
} else { } else {
control.push(this.createNeighbour()); //control.push(this.createNeighbour());
} }
}); });
} }
@ -123,8 +123,8 @@ export class AddressComponent implements OnInit {
locality_others: [''], 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])],
neighbourhood: this.fb.array([]), //neighbourhood: this.fb.array([]),
address_form_remark:[''], address_form_remark:[''],
address_ownership:[''], address_ownership:[''],
bussiness_activity:[''], bussiness_activity:[''],
@ -136,20 +136,20 @@ export class AddressComponent implements OnInit {
this.locality = this.addressForm.controls['locality']; this.locality = this.addressForm.controls['locality'];
this.pdLocation = this.addressForm.controls['pd_location']; this.pdLocation = this.addressForm.controls['pd_location'];
this.commentlocality = this.addressForm.controls['comment_locality']; this.commentlocality = this.addressForm.controls['comment_locality'];
this.customerBehaviour = this.addressForm.controls['customer_behaviour']; //this.customerBehaviour = this.addressForm.controls['customer_behaviour'];
this.ownership = this.addressForm.controls['address_ownership']; this.ownership = this.addressForm.controls['address_ownership'];
this.bussinessActivity = this.addressForm.controls['bussiness_activity']; this.bussinessActivity = this.addressForm.controls['bussiness_activity'];
// this.bussiessAddressType = this.addressForm.controls['bussiness_address_type']; // this.bussiessAddressType = this.addressForm.controls['bussiness_address_type'];
} }
createNeighbour(): FormGroup { // createNeighbour(): FormGroup {
return this.fb.group({ // return this.fb.group({
name: ['', Validators.compose([Validators.required])], // name: ['', Validators.compose([Validators.required])],
do_you_know: ['', Validators.compose([Validators.required])], // do_you_know: ['', Validators.compose([Validators.required])],
how_long_year: ['', Validators.compose([Validators.required])], // how_long_year: ['', Validators.compose([Validators.required])],
how_long_month: ['', Validators.compose([Validators.required])], // how_long_month: ['', Validators.compose([Validators.required])],
is_owner: ['', Validators.compose([Validators.required])], // is_owner: ['', Validators.compose([Validators.required])],
}); // });
} // }
getMasterDetails(table:string,type:number){ getMasterDetails(table:string,type:number){
this._pd.getAllMasterDatas(table).subscribe(data => { this._pd.getAllMasterDatas(table).subscribe(data => {
data.records.forEach(val => { data.records.forEach(val => {
@ -159,9 +159,9 @@ export class AddressComponent implements OnInit {
else if(type==2 && val.isactive == 1){ else if(type==2 && val.isactive == 1){
this.commentData.push(val); this.commentData.push(val);
} }
else if(type==3 && val.isactive == 1){ /* else if(type==3 && val.isactive == 1){
this.customerData.push(val); this.customerData.push(val);
} } //221118 review doc s.no 3.e */
else if(type==4 && val.isactive == 1){ else if(type==4 && val.isactive == 1){
this.localityData.push(val); this.localityData.push(val);
} }
@ -174,6 +174,7 @@ export class AddressComponent implements OnInit {
}) })
}); });
} }
/*221118 review doc s.no 3.f
addNeighbour() { addNeighbour() {
const control = <FormArray>this.addressForm.controls['neighbourhood']; const control = <FormArray>this.addressForm.controls['neighbourhood'];
if (control.length <= 1) { if (control.length <= 1) {
@ -183,12 +184,13 @@ export class AddressComponent implements OnInit {
removeNeighbour(index) { removeNeighbour(index) {
const control = <FormArray>this.addressForm.controls['neighbourhood']; const control = <FormArray>this.addressForm.controls['neighbourhood'];
control.removeAt(index); control.removeAt(index);
} }*/
onSubmit() { onSubmit() {
console.log('form data', this.addressForm.value);
if (!this.addressForm.valid) { if (!this.addressForm.valid) {
return; return;
} }
console.log('form', this.addressForm.value);
let records: any = {}; let records: any = {};
records.address = this.address.value; records.address = this.address.value;
records.address_type = this.addressType.value; records.address_type = this.addressType.value;
@ -201,8 +203,8 @@ export class AddressComponent implements OnInit {
} }
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.controls.neighbourhood.value; //records.neighbourhood = this.addressForm.controls.neighbourhood.value;
records.address_form_remark = this.addressForm.controls.address_form_remark.value; records.address_form_remark = this.addressForm.controls.address_form_remark.value;
records.address_ownership = this.ownership.value; records.address_ownership = this.ownership.value;
records.bussiness_activity = this.bussinessActivity.value; records.bussiness_activity = this.bussinessActivity.value;

View File

@ -71,7 +71,7 @@
<mat-card-content> <mat-card-content>
<p>Banking Information</p> <p>Banking Information</p>
<form [formGroup]="bankingForm" class="bankForm"> <form [formGroup]="bankingForm" class="bankForm">
<div formArrayName="itemRows"> <div formArrayName="itemRows" autocomplete="off">
<mat-accordion <mat-accordion
*ngFor="let itemrow of bankingForm.controls.itemRows['controls']; let i=index" *ngFor="let itemrow of bankingForm.controls.itemRows['controls']; let i=index"
[formGroupName]="i"> [formGroupName]="i">
@ -84,15 +84,39 @@
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Applicant Name"
formControlName="applicant_name" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="itemrow.get('applicant_name').value == 'Others'">
<input matInput placeholder="Specify Other Applicant"
formControlName="other_applicant">
</mat-form-field>
<!-- <mat-form-field>
<input matInput placeholder="Applicant Name" <input matInput placeholder="Applicant Name"
formControlName="applicant_name" required> formControlName="applicant_name" required>
</mat-form-field> </mat-form-field> -->
<mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Bank Name" formControlName="bank_name" required> <input matInput placeholder="Bank Name" formControlName="bank_name" required>
</mat-form-field> -->
<mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name" required>
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="itemrow.get('bank_name').value == 3">
<input matInput placeholder="Specify Other Bank Name"
formControlName="other_bank">
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Account Type" formControlName="account_type" required> <mat-select (selectionChange)="selectedAccTypeChanges($event)" placeholder="Account Type" formControlName="account_type" required >
<mat-option *ngFor="let prop of m_accountType" [value]="prop.id">{{ prop.name }}</mat-option> <mat-option *ngFor="let prop of m_accountType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select> </mat-select>
<!--<mat-select placeholder="Account Type" <!--<mat-select placeholder="Account Type"
@ -113,7 +137,8 @@
<mat-option value="NA">NA</mat-option> <mat-option value="NA">NA</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="itemrow.get('account_type').value != 2">
<input matInput placeholder="Limit in case of OD / CC account" <input matInput placeholder="Limit in case of OD / CC account"
formControlName="limit" (keypress)="keyPress($event)" required> formControlName="limit" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>

View File

@ -34,7 +34,9 @@ export class BankingDetailsComponent implements OnInit {
step: number; step: number;
private notifier: NotifierService; private notifier: NotifierService;
public pd_cus_segment:string; public pd_cus_segment:string;
public applicants: any;
m_accountType= []; m_accountType= [];
m_btLenderList = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -43,15 +45,17 @@ export class BankingDetailsComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.step = 0; this.step = 0;
this.initBankingForm(); this.initBankingForm();
this.getM_AccountType(); this.getM_AccountType();
this.getM_BTLenderList();
this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase();
// console.log("(0,3): " + this.pd_cus_segment.substring(0,3)); // console.log("(0,3): " + this.pd_cus_segment.substring(0,3));
// console.log(this.pd_all_details.pdmaster_details); // console.log(this.pd_all_details.pdmaster_details);
// console.log(this.pd_cus_segment); // console.log(this.pd_cus_segment);
this.pd_cus_segment = this.pd_cus_segment.substring(0,3); this.pd_cus_segment = this.pd_cus_segment.substring(0,3);
this.applicants = this.pd_all_details.pdapplicants_detials;
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '7'; params.pd_form_id = '7';
@ -91,6 +95,13 @@ export class BankingDetailsComponent implements OnInit {
) )
} }
getM_BTLenderList(){
this._pd.getAllMasterDatas('BTLENDERLIST').subscribe(
data => {
this.m_btLenderList = data.records.filter(data => data.isactive == 1);
})
}
public initBankingForm(): void { public initBankingForm(): void {
this.bankingForm = this.fb.group({ this.bankingForm = this.fb.group({
banking_form_remark: [''], banking_form_remark: [''],
@ -101,7 +112,9 @@ export class BankingDetailsComponent implements OnInit {
createBankarray() { createBankarray() {
return this.fb.group({ return this.fb.group({
applicant_name: ['', Validators.compose([Validators.required])], applicant_name: ['', Validators.compose([Validators.required])],
other_applicant : [''],
bank_name: ['', Validators.compose([Validators.required])], bank_name: ['', Validators.compose([Validators.required])],
other_bank: [''],
account_type: ['', Validators.compose([Validators.required])], account_type: ['', Validators.compose([Validators.required])],
salary: ['', Validators.compose([Validators.required])], salary: ['', Validators.compose([Validators.required])],
limit: ['', Validators.compose([Validators.required])], limit: ['', Validators.compose([Validators.required])],
@ -166,6 +179,33 @@ export class BankingDetailsComponent implements OnInit {
} }
}); });
} }
selectedAccTypeChanges(event: any){
console.log('First Time',event);
console.log('First Time Value',event.value);
if(event.value == 2) {
const control = <FormArray>this.bankingForm.controls['itemRows'];
console.log('Inside If Condition');
console.log(control);
console.log(control.controls);
control.controls[0].get('limit').clearValidators();
control.controls[0].get('limit').updateValueAndValidity();
//this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
// this.bankingForm.controls['itemRows'].
// this.bankingForm.controls.get('limit').clearValidators();
// this.bankingForm.controls.itemRows['controls'].get('limit').updateValueAndValidity();
// const control = <FormArray>this.bankingForm.controls['itemRows'];
// console.log(control.controls['limit'].value);
}
else{
alert('sd');
}
}
/** On Key Press Event For Numbers */ /** On Key Press Event For Numbers */
keyPress(event: any) { keyPress(event: any) {
const pattern = /[0-9]/; const pattern = /[0-9]/;

View File

@ -4,9 +4,16 @@
<mat-form-field> <mat-form-field>
<input matInput placeholder="Name of Business / Profession" formControlName="profession_name" required> <input matInput placeholder="Name of Business / Profession" formControlName="profession_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field>
<input matInput placeholder="How many years in business" formControlName="business_years" required> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
</mat-form-field> <mat-form-field>
<input matInput type="number" placeholder="Business Experience in Year" formControlName="business_years" required min='0'>
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Business Experience in Month" formControlName="business_month" required min='0' max='12'>
</mat-form-field>
</div>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Industry" <mat-select placeholder="Industry"
formControlName="industry" required> formControlName="industry" required>
@ -19,10 +26,43 @@
<mat-option value="{{type.type_of_activity_id}}" *ngFor="let type of activityData">{{type.name}}</mat-option> <mat-option value="{{type.type_of_activity_id}}" *ngFor="let type of activityData">{{type.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field *ngIf="businessForm.controls['type_of_activity'].value == 5">
<input matInput placeholder="Seasonality" formControlName="seasonality" required> <input matInput placeholder="Specify Other Activity"
formControlName="other_activity_type">
</mat-form-field> </mat-form-field>
<mat-card> <mat-form-field>
<!-- <input matInput placeholder="Seasonality" formControlName="seasonality" required> -->
<mat-select placeholder="Is the business Seasonal?"
formControlName="seasonality" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="businessForm.controls['seasonality'].value == 'yes'">
<input matInput placeholder="How many months in a year does the business run?" formControlName="month_of_business_run">
</mat-form-field>
<mat-form-field *ngIf="businessForm.controls['seasonality'].value == 'yes'">
<mat-select multiple placeholder="What is the peak period of business ? "
formControlName="peak_period_of_business" required>
<mat-option value="1">January</mat-option>
<mat-option value="2">February</mat-option>
<mat-option value="3">March</mat-option>
<mat-option value="4">April</mat-option>
<mat-option value="5">May</mat-option>
<mat-option value="6">June</mat-option>
<mat-option value="7">July</mat-option>
<mat-option value="8">August</mat-option>
<mat-option value="9">September</mat-option>
<mat-option value="10">October</mat-option>
<mat-option value="11">November</mat-option>
<mat-option value="12">December</mat-option>
</mat-select>
</mat-form-field>
<!--<mat-card>
<mat-card-header> <mat-card-header>
<p>Designation <p>Designation
</p> </p>
@ -48,18 +88,24 @@
</mat-card-content> </mat-card-content>
</div> </div>
</div> </div>
</mat-card> </mat-card>-->
<mat-form-field> <mat-form-field>
<mat-select placeholder="Who started the business / professions" <mat-select placeholder="Who started the business / professions"
formControlName="who_started" required> formControlName="who_started" required>
<mat-option value="applicant">Started by Applicant</mat-option> <mat-option value="applicant">Started by Applicants</mat-option>
<mat-option value="family_business">Family Business</mat-option> <mat-option value="family_business">Family Business</mat-option>
<mat-option value="others">Others</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="businessForm.controls['who_started'].value == 'others'">
<input matInput placeholder="Specify Other Bussiness Started"
formControlName="other_bussiness_who_started">
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Main person running the businesss" <mat-select placeholder="Main person running the businesss"
formControlName="main_person" required> formControlName="main_person" required>
<mat-option value="applicants">One of the applicants</mat-option> <!-- <mat-option value="applicants">One of the applicants</mat-option> -->
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<mat-option value="Relative">Relative of an applicant</mat-option> <mat-option value="Relative">Relative of an applicant</mat-option>
<mat-option value="Others">Others</mat-option> <mat-option value="Others">Others</mat-option>
</mat-select> </mat-select>
@ -75,9 +121,18 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Any other business before" <!-- <input matInput placeholder="Any other business before"
formControlName="before_business" required> -->
<mat-select placeholder="Were the loan applicants involved in any other business before starting this business?"
formControlName="before_business" required> formControlName="before_business" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="businessForm.controls['before_business'].value == 'yes'">
<input matInput placeholder="Description for before starting this business"
formControlName="before_business_description">
</mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Any delays" <input matInput placeholder="Any delays"
formControlName="any_delays" required> formControlName="any_delays" required>
@ -96,13 +151,21 @@
formControlName="partner_name" required> formControlName="partner_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Share of Profit / Shareholding" <input matInput placeholder="Share of Profit / Shareholding (%)" (keypress)="keyPress($event)"
formControlName="shareholding" required> formControlName="shareholding" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <div>
<input matInput placeholder="No. of yrs in this business" <label>How many years and month in this business</label>
formControlName="current_business_experiance" required> <br>
</mat-form-field> <div fxLayout="col" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="current_business_experiance_year" required min='0'>
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="current_business_experiance_month" required min='0' max='12'>
</mat-form-field>
</div>
</div>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Total Business Experience" <input matInput placeholder="Total Business Experience"
formControlName="total_business_experiance" required> formControlName="total_business_experiance" required>
@ -141,7 +204,7 @@
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<p>As per PD Officer <p>No of Employees sighted by PD officer during his visit
</p> </p>
</mat-card-header> </mat-card-header>
<mat-card-content class="matcard"> <mat-card-content class="matcard">
@ -149,19 +212,19 @@
<input matInput placeholder="Total" <input matInput placeholder="Total"
formControlName="officer_total" required> formControlName="officer_total" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Permanent" <input matInput placeholder="Permanent"
formControlName="officer_permanent" required> formControlName="officer_permanent" required>
</mat-form-field> </mat-form-field> -->
<mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Temporary" <input matInput placeholder="Temporary"
formControlName="officer_temporary" required> formControlName="officer_temporary" required>
</mat-form-field> </mat-form-field> -->
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<p>Investments <p>Investment in business by Applicants
</p> </p>
</mat-card-header> </mat-card-header>
<mat-card-content class="matcard"> <mat-card-content class="matcard">
@ -169,10 +232,10 @@
<input matInput placeholder="Amount Invested by Applicant" <input matInput placeholder="Amount Invested by Applicant"
formControlName="invested_amount" required> formControlName="invested_amount" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Monthly Working Capital Needed" <input matInput placeholder="Monthly Working Capital Needed"
formControlName="working_capital" required> formControlName="working_capital" required>
</mat-form-field> </mat-form-field> -->
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<mat-card> <mat-card>
@ -192,7 +255,7 @@
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<mat-card> <!-- <mat-card>
<mat-card-header> <mat-card-header>
<p>Business Setup <p>Business Setup
</p> </p>
@ -216,10 +279,10 @@
formControlName="rent_paid" (keypress)="keyPress($event)"> formControlName="rent_paid" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card> -->
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<p>Is the below documents seen and photo captured ? <p>Documents Sighted
</p> </p>
</mat-card-header> </mat-card-header>
<mat-card-content class="matcard"> <mat-card-content class="matcard">
@ -277,6 +340,7 @@
formControlName="other_documents" required> formControlName="other_documents" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
<mat-option value="not applicable">Not Applicable</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'"> <div formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'">

View File

@ -31,10 +31,12 @@ import {ActivatedRoute, Router} from "@angular/router";
export class BusinessInfoComponent implements OnInit { export class BusinessInfoComponent implements OnInit {
@Input() pdid: number; @Input() pdid: number;
@Input() form_id: number; @Input() form_id: number;
@Input() applicant_details: any;
relationData: any = []; relationData: any = [];
industryData: any = []; industryData: any = [];
activityData: any = []; activityData: any = [];
relativeNames: any; relativeNames: any;
applicants: any;
public businessForm: FormGroup; public businessForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
@ -44,6 +46,7 @@ export class BusinessInfoComponent implements OnInit {
this.notifier = notifier; this.notifier = notifier;
} }
ngOnInit() { ngOnInit() {
this.applicants = this.applicant_details.pdapplicants_detials;
this.getRelation(); this.getRelation();
this.getIndustry(); this.getIndustry();
this.getActivity(); this.getActivity();
@ -58,15 +61,14 @@ export class BusinessInfoComponent implements OnInit {
let businessVal = data.records; let businessVal = data.records;
console.log('data', businessVal); console.log('data', businessVal);
let constVal: any; let constVal: any;
const Desgn = <FormArray>this.businessForm.controls['designation']; //const Desgn = <FormArray>this.businessForm.controls['designation'];
const Partnr = <FormArray>this.businessForm.controls['partners']; const Partnr = <FormArray>this.businessForm.controls['partners'];
const otherDoc = <FormArray>this.businessForm.controls['documents']; const otherDoc = <FormArray>this.businessForm.controls['documents'];
if (data.status == 200) { if (data.status == 200) {
let DocArray: any; let DocArray: any;
let DesgnArray = Object.keys(data.records.designation).map(function (key) { // let DesgnArray = Object.keys(data.records.designation).map(function (key) {
return data.records.designation[key]; // return data.records.designation[key];
}); // });
let PartnrArray = Object.keys(data.records.partners).map(function (key) { let PartnrArray = Object.keys(data.records.partners).map(function (key) {
return data.records.partners[key]; return data.records.partners[key];
}); });
@ -81,14 +83,14 @@ export class BusinessInfoComponent implements OnInit {
existRelative.push(val); existRelative.push(val);
}); });
this.relativeNames = existRelative; this.relativeNames = existRelative;
if (DesgnArray.length == 0) { // if (DesgnArray.length == 0) {
Desgn.push(this.createDesignation()); // Desgn.push(this.createDesignation());
} else { // } else {
DesgnArray.forEach(datas => { // DesgnArray.forEach(datas => {
Desgn.push(this.createDesignation()); // Desgn.push(this.createDesignation());
}); // });
} // }
if (PartnrArray.length == 0) { if (PartnrArray.length == 0) {
Partnr.push(this.createPartners()); Partnr.push(this.createPartners());
} else { } else {
@ -107,23 +109,23 @@ export class BusinessInfoComponent implements OnInit {
DocArray = [{document: ''}]; DocArray = [{document: ''}];
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
} }
if (data.records.ownership_setup != 'others') { // if (data.records.ownership_setup != 'others') {
businessVal.ownership_others = ''; // businessVal.ownership_others = '';
} // }
if (data.records.ownership_setup != 'rented') { // if (data.records.ownership_setup != 'rented') {
businessVal.rent_paid = ''; // businessVal.rent_paid = '';
} // }
businessVal.family_members_involved = enduse; businessVal.family_members_involved = enduse;
businessVal.pdid = this.pdid; businessVal.pdid = this.pdid;
businessVal.formid = this.form_id; businessVal.formid = this.form_id;
businessVal.fk_createdby = this.pdid; businessVal.fk_createdby = this.pdid;
businessVal.designation = DesgnArray; //businessVal.designation = DesgnArray;
businessVal.partners = PartnrArray; businessVal.partners = PartnrArray;
businessVal.documents = DocArray; businessVal.documents = DocArray;
this.businessForm.setValue(businessVal); this.businessForm.setValue(businessVal);
} else { } else {
Desgn.push(this.createDesignation()); //Desgn.push(this.createDesignation());
Partnr.push(this.createPartners()); Partnr.push(this.createPartners());
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
} }
@ -140,23 +142,27 @@ export class BusinessInfoComponent implements OnInit {
fk_createdby: this.pdid, fk_createdby: this.pdid,
profession_name: ['', Validators.compose([Validators.required])], profession_name: ['', Validators.compose([Validators.required])],
business_years: ['', Validators.compose([Validators.required])], business_years: ['', Validators.compose([Validators.required])],
business_month: ['', Validators.compose([Validators.required])],
industry: ['', Validators.compose([Validators.required])], industry: ['', Validators.compose([Validators.required])],
type_of_activity: ['', Validators.compose([Validators.required])], type_of_activity: ['', Validators.compose([Validators.required])],
other_activity_type : [''],
seasonality: ['', Validators.compose([Validators.required])], seasonality: ['', Validators.compose([Validators.required])],
designation: this.fb.array([]), month_of_business_run : [''],
peak_period_of_business : [''],
//designation: this.fb.array([]),
partners: this.fb.array([]), partners: this.fb.array([]),
employees_total: ['', Validators.compose([Validators.required])], employees_total: ['', Validators.compose([Validators.required])],
employees_permanent: ['', Validators.compose([Validators.required])], employees_permanent: ['', Validators.compose([Validators.required])],
employees_temporary: ['', Validators.compose([Validators.required])], employees_temporary: ['', Validators.compose([Validators.required])],
officer_total: ['', Validators.compose([Validators.required])], officer_total: ['', Validators.compose([Validators.required])],
officer_permanent: ['', Validators.compose([Validators.required])], // officer_permanent: ['', Validators.compose([Validators.required])],
officer_temporary: ['', Validators.compose([Validators.required])], // officer_temporary: ['', Validators.compose([Validators.required])],
invested_amount: ['', Validators.compose([Validators.required])], invested_amount: ['', Validators.compose([Validators.required])],
working_capital: ['', Validators.compose([Validators.required])], //working_capital: ['', Validators.compose([Validators.required])],
is_service_provided: ['', Validators.compose([Validators.required])], is_service_provided: ['', Validators.compose([Validators.required])],
ownership_setup: ['', Validators.compose([Validators.required])], // ownership_setup: ['', Validators.compose([Validators.required])],
ownership_others: [''], // ownership_others: [''],
rent_paid: [''], // rent_paid: [''],
shop_eat_act_cert: ['', Validators.compose([Validators.required])], shop_eat_act_cert: ['', Validators.compose([Validators.required])],
gst_Regn_cert: ['', Validators.compose([Validators.required])], gst_Regn_cert: ['', Validators.compose([Validators.required])],
export_import_cert: ['', Validators.compose([Validators.required])], export_import_cert: ['', Validators.compose([Validators.required])],
@ -168,24 +174,27 @@ export class BusinessInfoComponent implements OnInit {
documents: this.fb.array([]), documents: this.fb.array([]),
business_remarks: ['', Validators.compose([Validators.required])], business_remarks: ['', Validators.compose([Validators.required])],
who_started: ['', Validators.compose([Validators.required])], who_started: ['', Validators.compose([Validators.required])],
other_bussiness_who_started : [''],
main_person: ['', Validators.compose([Validators.required])], main_person: ['', Validators.compose([Validators.required])],
other_main_person: [''], other_main_person: [''],
family_members_involved: ['', Validators.compose([Validators.required])], family_members_involved: ['', Validators.compose([Validators.required])],
before_business: ['', Validators.compose([Validators.required])], before_business: ['', Validators.compose([Validators.required])],
before_business_description: [''],
any_delays: ['', Validators.compose([Validators.required])], any_delays: ['', Validators.compose([Validators.required])],
}); });
} }
createDesignation(): FormGroup { // createDesignation(): FormGroup {
return this.fb.group({ // return this.fb.group({
sec_name: ['', Validators.compose([Validators.required])], // sec_name: ['', Validators.compose([Validators.required])],
sec_designation: ['', Validators.compose([Validators.required])], // sec_designation: ['', Validators.compose([Validators.required])],
}); // });
} // }
createPartners(): FormGroup { createPartners(): FormGroup {
return this.fb.group({ return this.fb.group({
partner_name: ['', Validators.compose([Validators.required])], partner_name: ['', Validators.compose([Validators.required])],
shareholding: ['', Validators.compose([Validators.required])], shareholding: ['', Validators.compose([Validators.required])],
current_business_experiance: ['', Validators.compose([Validators.required])], current_business_experiance_year: ['', Validators.compose([Validators.required])],
current_business_experiance_month: ['', Validators.compose([Validators.required])],
total_business_experiance: ['', Validators.compose([Validators.required])], total_business_experiance: ['', Validators.compose([Validators.required])],
}); });
} }
@ -194,14 +203,14 @@ export class BusinessInfoComponent implements OnInit {
document: [''] document: ['']
}); });
} }
addDesignation() { // addDesignation() {
const control = <FormArray>this.businessForm.controls['designation']; // const control = <FormArray>this.businessForm.controls['designation'];
control.push(this.createDesignation()); // control.push(this.createDesignation());
} // }
deleteDesignation(index) { // deleteDesignation(index) {
const control = <FormArray>this.businessForm.controls['designation']; // const control = <FormArray>this.businessForm.controls['designation'];
control.removeAt(index); // control.removeAt(index);
} // }
addPartnerDetails() { addPartnerDetails() {
const control = <FormArray>this.businessForm.controls['partners']; const control = <FormArray>this.businessForm.controls['partners'];
control.push(this.createPartners()); control.push(this.createPartners());

View File

@ -1,14 +1,20 @@
<mat-card style="min-height: 550px;"> <mat-card style="min-height: 550px;">
<mat-card-content> <mat-card-content>
<p>Current Loan Details</p> <p>Existing Loan Obligations</p>
<form [formGroup]="currentLoanForm" class="address"> <form [formGroup]="currentLoanForm" class="address">
<mat-form-field> <!-- <div fxLayout="row">
<div fxFlex="60" class="pb-0 text-sm-left"> -->
<mat-form-field style="width:60% !important;">
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Do you have any other existing loan" <mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Do you have any other existing loan"
formControlName="existing_loan" required> formControlName="existing_loan" required>
<mat-option value="Yes">Yes</mat-option> <mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option> <mat-option value="No">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<!-- </div>
</div> -->
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'"> <mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'">
<mat-card-header> <mat-card-header>
<p>Loan Details<p> <p>Loan Details<p>
@ -16,19 +22,43 @@
<div formArrayName="loan_details"> <div formArrayName="loan_details">
<div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index" <div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<!-- {{frequencyData | json}} -->
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" required> <input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="EMI" formControlName="emi" (keypress)="keyPress($event)" required> <mat-select (selectionChange)="selectedfrequency($event,i)" placeholder="Frequency"
formControlName="frequency" required>
<mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput [placeholder]="placeholderName != '' && IDXval == i ? placeholderName :'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Loan Type" formControlName="loan_type" required> <input matInput placeholder="Loan Type" formControlName="loan_type" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Lender" formControlName="lender" required> <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('loan_taken_by').value == 'Others'">
<input matInput placeholder="Specify Others Loan Taken" formControlName="others_loan_taken">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Lender" formControlName="lender" required>
<mat-option *ngFor="let btLen of lenderData" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="details.get('lender').value == 3">
<input matInput placeholder="Specify Others Loan Taken" formControlName="others_loan_taken">
</mat-form-field>
<!-- <mat-form-field>
<input matInput placeholder="Lender" formControlName="lender" required>
</mat-form-field> -->
<mat-form-field> <mat-form-field>
<input matInput placeholder="Original Tenure in Months" formControlName="original_tenure" required> <input matInput placeholder="Original Tenure in Months" formControlName="original_tenure" required>
</mat-form-field> </mat-form-field>

View File

@ -33,6 +33,13 @@ export class CurrentLoanComponent implements OnInit {
private notifier: NotifierService; private notifier: NotifierService;
@Input() pdid: number; @Input() pdid: number;
@Input() form_id: number; @Input() form_id: number;
@Input() applicant_details: any;
lenderData: any = [];
frequencyData: any = [];
applicants: any;
placeholderName : any;
holder: any = 'amount';
IDXval : 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,
@ -41,10 +48,13 @@ export class CurrentLoanComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getMasterDetails('BTLENDERLIST',1);
this.getMasterDetails('FREQUENCY',2);
this.initCurrentloanForm(); this.initCurrentloanForm();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = this.form_id; params.pd_form_id = this.form_id;
this.applicants = this.applicant_details.pdapplicants_detials;
this._pd.retriveForm(params).subscribe(value => { this._pd.retriveForm(params).subscribe(value => {
console.log('value', value); console.log('value', value);
const control = <FormArray>this.currentLoanForm.controls['loan_details']; const control = <FormArray>this.currentLoanForm.controls['loan_details'];
@ -88,12 +98,36 @@ export class CurrentLoanComponent implements OnInit {
arr.removeAt(0); arr.removeAt(0);
} }
} }
selectedfrequency(e,i){
// console.log(+e.value);
// console.log(i);
this.IDXval = i;
switch(+e.value){
case 1: this.placeholderName = 'Weekly Installment Amount'; break;
case 2: this.placeholderName = 'Daily Installment Amount'; break;
case 3: this.placeholderName = 'Annual Installment Amount'; break;
case 4: this.placeholderName = 'Hourly Installment Amount'; break;
case 5: this.placeholderName = 'EMI Amount'; break;
case 6: this.placeholderName = 'Quarterly Installment Amount'; break;
case 7: this.placeholderName = 'HalfYearly Installment Amount'; break;
default : this.placeholderName = ''; break;
}
}
createLoanDetail() { createLoanDetail() {
return this.fb.group({ return this.fb.group({
loan_amount: ['', Validators.compose([Validators.required])], loan_amount: ['', Validators.compose([Validators.required])],
frequency:['', Validators.compose([Validators.required])],
emi: ['', Validators.compose([Validators.required])], emi: ['', Validators.compose([Validators.required])],
loan_type: ['', Validators.compose([Validators.required])], loan_type: ['', Validators.compose([Validators.required])],
loan_taken_by:[''],
others_loan_taken:[''],
lender: ['', Validators.compose([Validators.required])], lender: ['', Validators.compose([Validators.required])],
others_lender:[''],
original_tenure: ['', Validators.compose([Validators.required])], original_tenure: ['', Validators.compose([Validators.required])],
current_balance_tenure: ['', Validators.compose([Validators.required])], current_balance_tenure: ['', Validators.compose([Validators.required])],
}); });
@ -138,6 +172,18 @@ export class CurrentLoanComponent implements OnInit {
} }
}); });
} }
getMasterDetails(table:string,type:number){
this._pd.getAllMasterDatas(table).subscribe(data => {
data.records.forEach(val => {
if (type==1 && val.isactive == 1) {
this.lenderData.push(val);
}
else if(type==2 && val.isactive == 1){
this.frequencyData.push(val);
}
})
});
}
/** On Key Press Event For Amount */ /** On Key Press Event For Amount */
keyPress(event: any) { keyPress(event: any) {
const pattern = /[0-9]/; const pattern = /[0-9]/;

View File

@ -3,7 +3,7 @@
<mat-card-content> <mat-card-content>
<p>Family Details</p> <p>Family Details</p>
<form class="address" [formGroup]="familyForm"> <form class="address" [formGroup]="familyForm">
<mat-form-field> <!-- <mat-form-field>
<mat-select placeholder="Person Met" formControlName="person" required> <mat-select placeholder="Person Met" formControlName="person" required>
<mat-option *ngFor="let personMet of personMetData" [value]="personMet.person_met_id"> <mat-option *ngFor="let personMet of personMetData" [value]="personMet.person_met_id">
{{personMet.person_met_name}} {{personMet.person_met_name}}
@ -12,9 +12,9 @@
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="person.value ==8"> <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>
<input matInput placeholder="No. Of Family Members" formControlName="members" required> <input matInput placeholder="Number Of Family Members" formControlName="members" required>
</mat-form-field> </mat-form-field>
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -25,8 +25,16 @@
<div *ngFor="let item of familyForm.controls.earningMembers['controls']; let i=index" <div *ngFor="let item of familyForm.controls.earningMembers['controls']; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcards"> <mat-card-content class="matcards">
<mat-form-field>
<input matInput placeholder="Name"
formControlName="earning_member_name" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Age" (keypress)="keyPress($event)"
formControlName="earning_member_age" required>
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Relation" formControlName="relation"> <mat-select placeholder="Relation" formControlName="relation" required>
<mat-option value="{{relations.relationship_id}}" <mat-option value="{{relations.relationship_id}}"
*ngFor="let relations of relationData"> *ngFor="let relations of relationData">
{{relations.name}} {{relations.name}}
@ -34,7 +42,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Segment" formControlName="segment"> <mat-select placeholder="Segment" formControlName="segment" required>
<mat-option value="{{cusSeg.customer_segment_id}}" <mat-option value="{{cusSeg.customer_segment_id}}"
*ngFor="let cusSeg of customerSegData"> *ngFor="let cusSeg of customerSegData">
{{cusSeg.name}} {{cusSeg.name}}
@ -44,11 +52,11 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Income / Revenue" <input matInput placeholder="Income / Revenue"
formControlName="income"> formControlName="income" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Name of Employer / Business" <input matInput placeholder="Name of Employer / Business"
formControlName="employer_name"> formControlName="employer_name" required>
</mat-form-field> </mat-form-field>
<button type="button" mat-raised-button mat-icon-button *ngIf="i==0" color="primary" <button type="button" mat-raised-button mat-icon-button *ngIf="i==0" color="primary"
matTooltip="Add More Earning Members" matTooltipPosition="above" (click)="addearningMembers()"> matTooltip="Add More Earning Members" matTooltipPosition="above" (click)="addearningMembers()">
@ -71,27 +79,39 @@
<div *ngFor="let members of familyForm.controls.nonEarningMembers['controls']; let i=index" <div *ngFor="let members of familyForm.controls.nonEarningMembers['controls']; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Relation" <input matInput placeholder="Name"
formControlName="relationship"> formControlName="non_earning_member_name" required>
<mat-option value="{{relation.relationship_id}}" </mat-form-field>
<mat-form-field>
<input matInput placeholder="Age" (keypress)="keyPress($event)"
formControlName="non_earning_member_age" required>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Relation"
formControlName="relationship" required>
<mat-option value="{{relation.relationship_id}}"
*ngFor="let relation of relationData"> *ngFor="let relation of relationData">
{{relation.name}} {{relation.name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Occupation" <mat-select placeholder="Occupation"
formControlName="occupation"> formControlName="occupation" required>
<mat-option value="{{occupation.occupation_non_earning_member_id}}" <mat-option value="{{occupation.occupation_non_earning_member_id}}"
*ngFor="let occupation of occupationData">{{occupation.name}} *ngFor="let occupation of occupationData">{{occupation.name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="members['controls'].occupation.value==3"> <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>
<mat-form-field *ngIf="members['controls'].occupation.value==9">
<input matInput placeholder="Specify Others Occupation"
formControlName="others_occupation">
</mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addMembers()" color="primary" <button type="button" mat-raised-button mat-icon-button (click)="addMembers()" color="primary"
matTooltip="Add More Non Earning Members" matTooltipPosition="above" *ngIf="i==0"> matTooltip="Add More Non Earning Members" matTooltipPosition="above" *ngIf="i==0">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
@ -113,8 +133,8 @@
<input matInput placeholder="Residence Address" <input matInput placeholder="Residence Address"
formControlName="residence" required> formControlName="residence" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="No.of yrs" formControlName="years" required> <input matInput placeholder="Number of yrs" formControlName="years" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Ownership" formControlName="ownership" required> <mat-select placeholder="Ownership" formControlName="ownership" required>

View File

@ -35,8 +35,8 @@ export class FamilyDetailsComponent implements OnInit {
private notifier: NotifierService; private notifier: NotifierService;
public familyForm: FormGroup; public familyForm: FormGroup;
public person: AbstractControl; // public person: AbstractControl;
public personOther: AbstractControl; // public personOther: AbstractControl;
public members: AbstractControl; public members: AbstractControl;
public residence: AbstractControl; public residence: AbstractControl;
public years: AbstractControl; public years: AbstractControl;
@ -46,9 +46,11 @@ export class FamilyDetailsComponent implements OnInit {
relationData: any = []; relationData: any = [];
occupationData: any = []; occupationData: any = [];
personMetData: any = []; //personMetData: any = [];
ownerShipData: any = []; ownerShipData: any = [];
customerSegData: any = []; customerSegData: any = [];
// earnMemberArrCount :any ;
// nonEarnMemberArrCount :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) {
@ -57,7 +59,7 @@ export class FamilyDetailsComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.getMasterDetails('RELATIONSHIPS',1); this.getMasterDetails('RELATIONSHIPS',1);
this.getMasterDetails('OCCUPATIONMEMBERS',2); this.getMasterDetails('OCCUPATIONMEMBERS',2);
this.getMasterDetails('PERSONSMET',3); //this.getMasterDetails('PERSONSMET',3);
this.getMasterDetails('RESIDENCEOWNERSHIP',4); this.getMasterDetails('RESIDENCEOWNERSHIP',4);
this.getMasterDetails('CUSTOMERSEGMENT',5) this.getMasterDetails('CUSTOMERSEGMENT',5)
this.initFamilyForm(); this.initFamilyForm();
@ -74,10 +76,10 @@ export class FamilyDetailsComponent implements OnInit {
var earning = Object.keys(data.records.earning_members).map(function (key) { var earning = Object.keys(data.records.earning_members).map(function (key) {
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) { // if (data.records.person_met_other) {
this.familyForm.controls.personOther.setValue(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);
@ -112,8 +114,8 @@ export class FamilyDetailsComponent implements OnInit {
} }
public initFamilyForm(): void { public initFamilyForm(): void {
this.familyForm = this.fb.group({ this.familyForm = this.fb.group({
person: ['', Validators.compose([Validators.required])], // person: ['', Validators.compose([Validators.required])],
personOther: [''], // personOther: [''],
members: ['', Validators.compose([Validators.required])], members: ['', Validators.compose([Validators.required])],
residence: ['', Validators.compose([Validators.required])], residence: ['', Validators.compose([Validators.required])],
years: ['', Validators.compose([Validators.required])], years: ['', Validators.compose([Validators.required])],
@ -124,8 +126,8 @@ export class FamilyDetailsComponent implements OnInit {
nonEarningMembers: this.fb.array([]), nonEarningMembers: this.fb.array([]),
family_details_form_remark: [''] family_details_form_remark: ['']
}); });
this.person = this.familyForm.controls['person']; // this.person = this.familyForm.controls['person'];
this.personOther = this.familyForm.controls['personOther']; // this.personOther = this.familyForm.controls['personOther'];
this.members = this.familyForm.controls['members']; this.members = this.familyForm.controls['members'];
this.residence = this.familyForm.controls['residence']; this.residence = this.familyForm.controls['residence'];
this.years = this.familyForm.controls['years']; this.years = this.familyForm.controls['years'];
@ -135,6 +137,8 @@ export class FamilyDetailsComponent implements OnInit {
} }
createMembers(): FormGroup { createMembers(): FormGroup {
return this.fb.group({ return this.fb.group({
earning_member_name : ['', Validators.compose([Validators.required])],
earning_member_age : ['', Validators.compose([Validators.required])],
relation: ['', Validators.compose([Validators.required])], relation: ['', Validators.compose([Validators.required])],
segment: ['', Validators.compose([Validators.required])], segment: ['', Validators.compose([Validators.required])],
income: ['', Validators.compose([Validators.required])], income: ['', Validators.compose([Validators.required])],
@ -143,19 +147,44 @@ export class FamilyDetailsComponent implements OnInit {
} }
createNonMembers(): FormGroup { createNonMembers(): FormGroup {
return this.fb.group({ return this.fb.group({
non_earning_member_name : ['', Validators.compose([Validators.required])],
non_earning_member_age : ['', Validators.compose([Validators.required])],
relationship: ['', Validators.compose([Validators.required])], relationship: ['', Validators.compose([Validators.required])],
occupation: ['', Validators.compose([Validators.required])], occupation: ['', Validators.compose([Validators.required])],
retired: [''], retired: [''],
others_occupation : ['']
}); });
} }
addearningMembers() { addearningMembers() {
const control = <FormArray>this.familyForm.controls['earningMembers']; const control = <FormArray>this.familyForm.controls['earningMembers'];
//this.earnMemberArrCount = control.length;
if(control.length == this.familyForm.controls['members'].value)
{
}else{
control.push(this.createMembers()); control.push(this.createMembers());
//console.log('Add earn member',this.familyForm.controls['members'].value);
}
// console.log(this.earnMemberArrCount);
// console.log(this.nonEarnMemberArrCount);
} }
addMembers() { addMembers() {
const control = <FormArray>this.familyForm.controls['nonEarningMembers']; const control = <FormArray>this.familyForm.controls['nonEarningMembers'];
control.push(this.createNonMembers()); // this.nonEarnMemberArrCount = control.length;
// console.log(this.earnMemberArrCount);
// console.log(this.nonEarnMemberArrCount);
if(control.length == this.familyForm.controls['members'].value)
{
}else{
control.push(this.createNonMembers());
}
} }
deleteEarningMembers(index) { deleteEarningMembers(index) {
const control = <FormArray>this.familyForm.controls['earningMembers']; const control = <FormArray>this.familyForm.controls['earningMembers'];
@ -176,9 +205,9 @@ export class FamilyDetailsComponent implements OnInit {
else if(type==2){ else if(type==2){
this.occupationData=data.records.filter(item => item.isactive == 1); this.occupationData=data.records.filter(item => item.isactive == 1);
} }
else if(type==3){ // else if(type==3){
this.personMetData=data.records.filter(item => item.isactive == 1); // this.personMetData=data.records.filter(item => item.isactive == 1);
} // }
else if(type==4){ else if(type==4){
this.ownerShipData=data.records.filter(item => item.isactive == 1); this.ownerShipData=data.records.filter(item => item.isactive == 1);
} }
@ -204,14 +233,16 @@ export class FamilyDetailsComponent implements OnInit {
if (this.ownership.value == 3) { if (this.ownership.value == 3) {
records.what_rent = this.rent.value; records.what_rent = this.rent.value;
} }
if (this.person.value == 8) { // 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;
// filter retired conditions // filter re conditions
let non_earning_members_filter = this.familyForm.controls['nonEarningMembers'].value.map(function(obj) { let non_earning_members_filter = this.familyForm.controls['nonEarningMembers'].value.map(function(obj) {
console.log(obj.occupation);
if(obj.occupation==3){ if(obj.occupation==3){
return obj; return obj;
} }
@ -219,6 +250,13 @@ export class FamilyDetailsComponent implements OnInit {
obj.retired=''; obj.retired='';
return obj; return obj;
} }
if(obj.occupation==9){
return obj;
}
else{
obj.others_occupation='';
return obj;
}
}); });
records.non_earning_members = non_earning_members_filter; 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;
@ -241,4 +279,15 @@ export class FamilyDetailsComponent implements OnInit {
} }
}); });
} }
/** On Key Press Event For Age */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
} }

View File

@ -2,7 +2,8 @@
<p>Loan Details</p> <p>Loan Details</p>
<form [formGroup]="loanDetailsForm" class="address"> <form [formGroup]="loanDetailsForm" class="address">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Loan Amount Applied" formControlName="loan_amount" (keypress)="keyPress($event)" required > <input matInput placeholder="Loan Amount Applied for ? " formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required >
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use" required> <mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use" required>
@ -24,7 +25,7 @@
<input matInput placeholder="Specify End Use" formControlName="end_use_other"> <input matInput placeholder="Specify End Use" formControlName="end_use_other">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Is there a balance transfer" (selectionChange)="selectedBalancesTransferChanges($event)" <mat-select placeholder="Is there a balance transfer ? " (selectionChange)="selectedBalancesTransferChanges($event)"
formControlName="is_transfer" required> formControlName="is_transfer" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
@ -32,7 +33,8 @@
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'"> <mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<input matInput placeholder="Balance Transfer Amount" (keypress)="keyPress($event)" formControlName="balance_transfer_amount"> <input matInput placeholder="What is the amount required for Balance Transfer ? " (keypress)="keyPress($event)" formControlName="balance_transfer_amount" (keyup)="inWords($event,2)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{balTxrfAmtInWords}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'"> <mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<mat-select placeholder="Is there a Top Up" <mat-select placeholder="Is there a Top Up"
@ -41,14 +43,23 @@
<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-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_topup'].value == 'yes'">
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount">
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'"> <mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<input matInput placeholder="Lender from where balance transfer done" formControlName="lender"> <mat-select placeholder="Lender from where balance transfer done"
formControlName="lender">
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['lender'].value == 3">
<input matInput placeholder="Specify Others Lender" formControlName="other_bt_lender">
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_topup'].value == 'yes'">
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['topup_amount'].value != ''">{{"&#8377;"}} {{topUpAmtInWords}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required> <input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['own_contribution'].value != ''">{{"&#8377;"}} {{ownContributionInWords}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -104,13 +115,21 @@
<mat-select multiple placeholder="Name of Owner" <mat-select multiple placeholder="Name of Owner"
formControlName="owner_name" (selectionChange)="ownerNameChange($event)" required> formControlName="owner_name" (selectionChange)="ownerNameChange($event)" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Status of Construction" formControlName="construction_status" required> <mat-select placeholder="Status of Construction" formControlName="construction_status" required>
<mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }}</mat-option> <mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }} {{status.id}}</mat-option>
</mat-select> </mat-select>
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['construction_status'].value == 4">
<input matInput placeholder="What is the approximate stage of construction (%)?"
formControlName="percentage_of_construction" (keypress)="keyPress($event)" required>
</mat-form-field>
<!--<mat-select placeholder="Status of construction" <!--<mat-select placeholder="Status of construction"
formControlName="construction_status"> formControlName="construction_status">
@ -118,16 +137,16 @@
<mat-option value="other_purpose">Complete</mat-option> <mat-option value="other_purpose">Complete</mat-option>
<mat-option value="other_purpose">Vacant Land</mat-option> <mat-option value="other_purpose">Vacant Land</mat-option>
</mat-select>--> </mat-select>-->
</mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="EMV as Per Customer" <input matInput placeholder="Estimate Market Value as Per Customer"
formControlName="emv_per_customer" (keypress)="keyPress($event)" required> formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <!-- <mat-form-field>
<input matInput placeholder="Value as Per Agreement" <input matInput placeholder="Value as Per Agreement"
formControlName="value_per_agreement" (keypress)="keyPress($event)" required> formControlName="value_per_agreement" (keypress)="keyPress($event)" required (keyup)="inWords($event,3)">
</mat-form-field> <mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{valAsPerAgmtInWords}} Only</mat-hint>
</mat-form-field> -->
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<div fxLayout="row"> <div fxLayout="row">

View File

@ -43,6 +43,14 @@ export class LoanDetailsComponent implements OnInit {
m_sourceofamount = []; m_sourceofamount = [];
m_mortageTypeProperty = []; m_mortageTypeProperty = [];
m_statusofCunstruction = []; m_statusofCunstruction = [];
m_btLenderList = [];
loanAmtInWords : any;
balTxrfAmtInWords : any;
valAsPerAgmtInWords : any;
ownContributionInWords : any;
topUpAmtInWords: 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) {
@ -50,12 +58,17 @@ export class LoanDetailsComponent implements OnInit {
this.notifier = notifier; this.notifier = notifier;
} }
ngOnInit() { ngOnInit() {
console.log(this.applicant_details.pdapplicants_detials);
console.log(this.applicant_details);
this.applicants = this.applicant_details.pdapplicants_detials; this.applicants = this.applicant_details.pdapplicants_detials;
this.initloanDetailsForm(); this.initloanDetailsForm();
this.getM_EndUseofLoad(); this.getM_EndUseofLoad();
this.getM_sourceofamount(); this.getM_sourceofamount();
this.getM_MortageTypeProperty(); this.getM_MortageTypeProperty();
this.getM_StatusofCunstruction(); this.getM_StatusofCunstruction();
this.getM_BTLenderList();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = this.form_id; params.pd_form_id = this.form_id;
@ -79,7 +92,10 @@ export class LoanDetailsComponent implements OnInit {
}); });
console.log('enduse', enduse); console.log('enduse', enduse);
console.log('ownername', ownername); console.log('ownername', ownername);
this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount); this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount);
if(value.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); }
this.loanDetailsForm.controls['end_use'].setValue(enduse); this.loanDetailsForm.controls['end_use'].setValue(enduse);
if (value.records.end_use_other) { if (value.records.end_use_other) {
this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other); this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other);
@ -88,14 +104,22 @@ export class LoanDetailsComponent implements OnInit {
this.loanDetailsForm.controls['is_topup'].setValue(value.records.is_topup); this.loanDetailsForm.controls['is_topup'].setValue(value.records.is_topup);
if (value.records.balance_transfer_amount) { if (value.records.balance_transfer_amount) {
this.loanDetailsForm.controls['balance_transfer_amount'].setValue(value.records.balance_transfer_amount); this.loanDetailsForm.controls['balance_transfer_amount'].setValue(value.records.balance_transfer_amount);
this.balTxrfAmtInWords = this._pd.convertNumberToWords(value.records.balance_transfer_amount);
} }
if (value.records.topup_amount) { if (value.records.topup_amount) {
this.loanDetailsForm.controls['topup_amount'].setValue(value.records.topup_amount); this.loanDetailsForm.controls['topup_amount'].setValue(value.records.topup_amount);
this.topUpAmtInWords = this._pd.convertNumberToWords(value.records.topup_amount);
} }
if (value.records.lender) { if (value.records.lender) {
this.loanDetailsForm.controls['lender'].setValue(value.records.lender); this.loanDetailsForm.controls['lender'].setValue(value.records.lender);
} }
if (value.records.other_bt_lender) {
this.loanDetailsForm.controls['other_bt_lender'].setValue(value.records.other_bt_lender);
}
this.loanDetailsForm.controls['own_contribution'].setValue(value.records.own_contribution); this.loanDetailsForm.controls['own_contribution'].setValue(value.records.own_contribution);
if(value.records.own_contribution){ this.ownContributionInWords = this._pd.convertNumberToWords(value.records.own_contribution); }
this.loanDetailsForm.controls['source'].setValue(value.records.source); this.loanDetailsForm.controls['source'].setValue(value.records.source);
if (value.records.lender_name_type) { if (value.records.lender_name_type) {
this.loanDetailsForm.controls['lender_name_type'].setValue(value.records.lender_name_type); this.loanDetailsForm.controls['lender_name_type'].setValue(value.records.lender_name_type);
@ -104,8 +128,15 @@ export class LoanDetailsComponent implements OnInit {
this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type); this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type);
this.loanDetailsForm.controls['owner_name'].setValue(ownername); this.loanDetailsForm.controls['owner_name'].setValue(ownername);
this.loanDetailsForm.controls['construction_status'].setValue(value.records.construction_status); this.loanDetailsForm.controls['construction_status'].setValue(value.records.construction_status);
if(value.records.construction_status == 4 ){
this.loanDetailsForm.controls['percentage_of_construction'].setValue(value.records.percentage_of_construction);
}
else{
this.loanDetailsForm.controls['percentage_of_construction'].setValue('');
}
this.loanDetailsForm.controls['emv_per_customer'].setValue(value.records.emv_per_customer); this.loanDetailsForm.controls['emv_per_customer'].setValue(value.records.emv_per_customer);
this.loanDetailsForm.controls['value_per_agreement'].setValue(value.records.value_per_agreement); // this.loanDetailsForm.controls['value_per_agreement'].setValue(value.records.value_per_agreement);
// if(value.records.value_per_agreement){ this.valAsPerAgmtInWords = this._pd.convertNumberToWords(value.records.value_per_agreement); }
this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks); this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks);
} }
}) })
@ -161,6 +192,12 @@ getM_sourceofamount() {
) )
} }
getM_BTLenderList(){
this._pd.getAllMasterDatas('BTLENDERLIST').subscribe(
data => {
this.m_btLenderList = data.records.filter(data => data.isactive == 1);
})
}
// ================== // ==================
@ -175,6 +212,7 @@ getM_sourceofamount() {
balance_transfer_amount: [''], balance_transfer_amount: [''],
topup_amount: [''], topup_amount: [''],
lender: [''], lender: [''],
other_bt_lender : [''],
own_contribution: ['', Validators.compose([Validators.required])], own_contribution: ['', Validators.compose([Validators.required])],
source: ['', Validators.compose([Validators.required])], source: ['', Validators.compose([Validators.required])],
lender_name_type: [''], lender_name_type: [''],
@ -182,8 +220,9 @@ getM_sourceofamount() {
property_type: ['', Validators.compose([Validators.required])], property_type: ['', Validators.compose([Validators.required])],
owner_name: ['', Validators.compose([Validators.required])], owner_name: ['', Validators.compose([Validators.required])],
construction_status: ['', Validators.compose([Validators.required])], construction_status: ['', Validators.compose([Validators.required])],
percentage_of_construction : [''],
emv_per_customer: ['', Validators.compose([Validators.required])], emv_per_customer: ['', Validators.compose([Validators.required])],
value_per_agreement: ['', Validators.compose([Validators.required])], //value_per_agreement: ['', Validators.compose([Validators.required])],
loandetails_remarks: ['', Validators.compose([Validators.required])], loandetails_remarks: ['', Validators.compose([Validators.required])],
}); });
} }
@ -235,6 +274,10 @@ getM_sourceofamount() {
if (this.loanDetailsForm.controls['is_topup'].value == 'yes' || this.loanDetailsForm.controls['is_transfer'].value == 'yes') { if (this.loanDetailsForm.controls['is_topup'].value == 'yes' || this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
records.lender = this.loanDetailsForm.controls['lender'].value; records.lender = this.loanDetailsForm.controls['lender'].value;
} }
if(this.loanDetailsForm.controls['lender'].value == 3){
records.other_bt_lender = this.loanDetailsForm.controls['other_bt_lender'].value;
}
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value; records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
records.source = this.loanDetailsForm.controls['source'].value; records.source = this.loanDetailsForm.controls['source'].value;
if (this.loanDetailsForm.controls['source'].value == 'other') { if (this.loanDetailsForm.controls['source'].value == 'other') {
@ -250,8 +293,9 @@ getM_sourceofamount() {
}); });
records.owner_name_group = dataOwner_name; records.owner_name_group = dataOwner_name;
records.construction_status = this.loanDetailsForm.controls['construction_status'].value; records.construction_status = this.loanDetailsForm.controls['construction_status'].value;
records.percentage_of_construction = this.loanDetailsForm.controls['percentage_of_construction'].value;
records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value; records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value;
records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value; //records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value;
records.loandetails_remarks = this.loanDetailsForm.controls['loandetails_remarks'].value; records.loandetails_remarks = this.loanDetailsForm.controls['loandetails_remarks'].value;
console.log('data', records); console.log('data', records);
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {
@ -297,4 +341,28 @@ getM_sourceofamount() {
event.preventDefault(); event.preventDefault();
} }
} }
/** To Convert Amount into Words */
inWords(e,flag:number){
switch(flag){
case 1 :
this.loanAmtInWords = this._pd.convertNumberToWords(e.target.value);
break;
case 2 :
this.balTxrfAmtInWords = this._pd.convertNumberToWords(e.target.value);
break;
case 3 :
this.valAsPerAgmtInWords = this._pd.convertNumberToWords(e.target.value);
break;
case 4 :
this.ownContributionInWords = this._pd.convertNumberToWords(e.target.value);
break;
case 5 :
this.topUpAmtInWords = this._pd.convertNumberToWords(e.target.value);
break;
default:
break;
}
}
} }

View File

@ -20,7 +20,7 @@
<mat-card-content> <mat-card-content>
<p>Other Income Details</p> <p>Other Income Details</p>
<form [formGroup]="otherIncomeForm" class="address"> <form [formGroup]="otherIncomeForm" class="address">
<mat-form-field> <mat-form-field style="width:25% !important;">
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Other Income" <mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Other Income"
formControlName="other_income"> formControlName="other_income">
<mat-option value="Yes">Yes</mat-option> <mat-option value="Yes">Yes</mat-option>
@ -70,8 +70,14 @@
<mat-option value="interest_income">Interest Income</mat-option> <mat-option value="interest_income">Interest Income</mat-option>
<mat-option value="agricultural_income">Agricultural Income</mat-option> <mat-option value="agricultural_income">Agricultural Income</mat-option>
<mat-option value="dividend_income">Dividend Income</mat-option> <mat-option value="dividend_income">Dividend Income</mat-option>
<mat-option value="others">Others</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('source').value == 'others'">
<input matInput placeholder="Specify Others Source"
formControlName="others_source">
</mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required> <input matInput placeholder="Amount" formControlName="amount" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
@ -80,6 +86,13 @@
<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option> <mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<!-- {{otherIncomeForm.controls.frequency.value}} -->
<mat-form-field *ngIf="details.get('frequency').value == 8">
<input matInput placeholder="Specify Others Frequency"
formControlName="others_frequency">
</mat-form-field>
<button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="addIncomeDetails()" <button type="button" matTooltip="Add More Income Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
color="primary" *ngIf="i==0"> color="primary" *ngIf="i==0">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>

View File

@ -92,10 +92,13 @@ export class OtherIncomeComponent implements OnInit {
createDetail() { createDetail() {
return this.fb.group({ return this.fb.group({
source: ['', Validators.compose([Validators.required])], source: ['', Validators.compose([Validators.required])],
others_source : [''],
amount: ['', Validators.compose([Validators.required])], amount: ['', Validators.compose([Validators.required])],
frequency: ['', Validators.compose([Validators.required])], frequency: ['', Validators.compose([Validators.required])],
others_frequency : ['']
}); });
} }
getFrequency() { getFrequency() {
let master_name = 'FREQUENCY'; let master_name = 'FREQUENCY';
this._pd.getAllMasterDatas(master_name).subscribe(data => { this._pd.getAllMasterDatas(master_name).subscribe(data => {

View File

@ -426,7 +426,7 @@
<app-banking-details [pdid]="startPD" [pd_all_details]="pdFullDetails" ></app-banking-details> <app-banking-details [pdid]="startPD" [pd_all_details]="pdFullDetails" ></app-banking-details>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="8"> <ng-container *ngSwitchCase="8">
<app-current-loan [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-current-loan> <app-current-loan [pdid]="startPD" [form_id]="selectedFormsCategory.form_id" [applicant_details]="pdFullDetails"></app-current-loan>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="9"> <ng-container *ngSwitchCase="9">
<app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income> <app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income>
@ -441,7 +441,7 @@
<app-employment-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id" [pd_all_details]="pdFullDetails"></app-employment-info> <app-employment-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id" [pd_all_details]="pdFullDetails"></app-employment-info>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="13"> <ng-container *ngSwitchCase="13">
<app-business-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-business-info> <app-business-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id" [applicant_details]="pdFullDetails"></app-business-info>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="14"> <ng-container *ngSwitchCase="14">
<app-financial-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-financial-info> <app-financial-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-financial-info>

View File

@ -297,6 +297,7 @@ pdFullDetails:any=[];
this.categoryFormButtons = data.records.template_forms; this.categoryFormButtons = data.records.template_forms;
console.log('formButtons', this.categoryFormButtons); console.log('formButtons', this.categoryFormButtons);
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
console.log(filterApplicantName);
this.mainApplicantName = filterApplicantName[0].applicant_name; this.mainApplicantName = filterApplicantName[0].applicant_name;
this.currentPDStatus = data.records.pdmaster_details.pd_status; this.currentPDStatus = data.records.pdmaster_details.pd_status;

View File

@ -289,6 +289,84 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
) )
} }
// inWords(num) {
// let a : any = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];
// let b : any = ['', '', 'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety'];
// if ((num = num.toString()).length > 9) return 'overflow';
// let n : any = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
// if (!n) return; var str = '';
// str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' + a[n[1][1]]) + 'crore ' : '';
// str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + 'lakh ' : '';
// str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + 'thousand ' : '';
// str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + 'hundred ' : '';
// str += (n[5] != 0) ? ((str != '') ? 'and ' : '') + (a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) + 'only ' : '';
// return str;
// }
convertNumberToWords(amount) {
//let words : any = new Array();
let words :any = ['','One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Eleven','Twelve','Thirteen','Fourteen','Fifteen','Sixteen','Seventeen','Eighteen','Nineteen','Twenty'];
words[30] = 'Thirty';
words[40] = 'Forty';
words[50] = 'Fifty';
words[60] = 'Sixty';
words[70] = 'Seventy';
words[80] = 'Eighty';
words[90] = 'Ninety';
amount = amount.toString();
let atemp = amount.split(".");
let number = atemp[0].split(",").join("");
let n_length = number.length;
let words_string = "";
let value : any;
if (n_length <= 9) {
var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
var received_n_array = new Array();
for (var i = 0; i < n_length; i++) {
received_n_array[i] = number.substr(i, 1);
}
for (var i = 9 - n_length, j = 0; i < 9; i++, j++) {
n_array[i] = received_n_array[j];
}
for (var i = 0, j = 1; i < 9; i++, j++) {
if (i == 0 || i == 2 || i == 4 || i == 7) {
if (n_array[i] == 1) {
n_array[j] = 10 + (+n_array[j]);
n_array[i] = 0;
}
}
}
value = "";
for (var i = 0; i < 9; i++) {
if (i == 0 || i == 2 || i == 4 || i == 7) {
value = n_array[i] * 10;
} else {
value = n_array[i];
}
if (value != 0) {
words_string += words[value] + " ";
}
if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Crores ";
}
if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Lakhs ";
}
if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Thousand ";
}
if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) {
words_string += "Hundred and ";
} else if (i == 6 && value != 0) {
words_string += "Hundred ";
}
}
words_string = words_string.split(" ").join(" ");
}
return words_string;
}
// private handleError<T>(operation = 'operation', result?: T) { // private handleError<T>(operation = 'operation', result?: T) {
// return (error: any): Observable<T> => { // return (error: any): Observable<T> => {
// return of(result as T); // return of(result as T);

View File

@ -87,15 +87,15 @@ export class TemplatesService {
getTemplateIDQuesAnsDetails(temp_id: number): Observable<any>{ getTemplateIDQuesAnsDetails(temp_id: number): Observable<any>{
// Add safe, URL encoded search parameter if there is a search term // Add safe, URL encoded search parameter if there is a search term
return this._http.post<any[]>(this.apiUrl + "getTemplateQuestionAnswers", {'template_id': temp_id }); return this._http.post<any[]>(this.apiUrl + "getScorecardDetails", {'templateid': temp_id });
} }
updateTempateIDQuesAnsDetails(Records: any): Observable<any>{ updateTempateIDQuesAnsDetails(Records: any): Observable<any>{
let records = Records.map(item=>{ let records = Records.map(item=>{
item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record item.fk_updatedby = this._aws.getlocale();//to get user id for who is created the Record
item.updatedon = currentdate; // item.updatedon = currentdate;
item.createdon = item.createdon == null ? currentdate : item.createdon; // item.createdon = item.createdon == null ? currentdate : item.createdon;
item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby; item.fk_createdby = item.fk_createdby == null ? this._aws.getlocale() : item.fk_createdby;
// item.answers = item.answers.map(subItem=>{ // item.answers = item.answers.map(subItem=>{
@ -104,7 +104,7 @@ export class TemplatesService {
// })//to get Current date and Time for when the Record is created // })//to get Current date and Time for when the Record is created
return item; return item;
}); });
return this._http.post<any[]>(this.apiUrl + "saveTemplateQuestionAnswers", {'records': records }); return this._http.post<any[]>(this.apiUrl + "saveScoreCardQuestions", {'records': records });
} }
getRemaningQuestionCategory(data: any): Observable<any>{ getRemaningQuestionCategory(data: any): Observable<any>{
@ -112,12 +112,14 @@ export class TemplatesService {
return this._http.post<any[]>(this.apiUrl + "getQuestionsForTemplateCreation", {"template_id": data.template_id, "category_id": data.category_id}); return this._http.post<any[]>(this.apiUrl + "getQuestionsForTemplateCreation", {"template_id": data.template_id, "category_id": data.category_id});
} }
getFormIdRemainingQuestionsDetails(data: any) : Observable<any> {
let records = {"templateid": data.template_id, "formid": data.form_id, "categoryid": data.category_id};
return this._http.post<any[]>(this.apiUrl + "getFormAndQuestionKeys", { "records" : records} );
}
// get Master Details ============================== // get Master Details ==============================
// get templates master details list
// get templates master details list
getLenderMasterListDetails(): Observable<any> { getLenderMasterListDetails(): Observable<any> {
return this._http.get<any[]>(this.apiUrl + "getListOfLenders"); return this._http.get<any[]>(this.apiUrl + "getListOfLenders");
} }

View File

@ -1,3 +1,6 @@
<form [formGroup]="_editquestionAnswerForm" (submit)="onSubmit()"> <form [formGroup]="_editquestionAnswerForm" (submit)="onSubmit()">
<div formArrayName="temp_questions" class="example-full-width" style="font-size:1.2rem !important;"> <div formArrayName="temp_questions" class="example-full-width" style="font-size:1.2rem !important;">
<table style="width:100%"> <table style="width:100%">
@ -11,12 +14,12 @@
</div> </div>
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%"> <div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%">
<mat-form-field style="width: 35%; text-align: center" appearance="outline"> <mat-form-field style="width: 35%; text-align: center" appearance="outline">
<input matInput formControlName="question_weightage"> <input matInput formControlName="weightage">
</mat-form-field> <span> % </span> </mat-form-field> <span> % </span>
<mat-error *ngIf="submitted && ques['controls'].question_weightage.hasError('required')" class="mat-text-warn">Ques. WT is Required.!</mat-error> <mat-error *ngIf="submitted && ques['controls'].weightage.hasError('required')" class="mat-text-warn">Ques. WT is Required.!</mat-error>
</div> </div>
<div fxFlex="0 1 auto" class="ml-xs" fxFlex="10%"> <div fxFlex="0 1 auto" class="ml-xs" fxFlex="10%">
<button (click)="removeLanguage(i)" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" <button (click)="removeLanguage(i, $event); false;" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"
type="button"><mat-icon>delete</mat-icon></button> type="button"><mat-icon>delete</mat-icon></button>
</div> </div>
</div> </div>
@ -28,7 +31,7 @@
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap="0.5%" fxLayoutAlign="start center"> <div fxLayout="row" fxLayout.xs="column" fxLayoutGap="0.5%" fxLayoutAlign="start center">
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="80%"> <div fxFlex="1 1 auto" class="ml-xs" fxFlex="80%">
<div> <div>
<span> {{i_ans+1}}. </span><span style="color:#f44336">{{answ.get('answer').value}}</span> <span> {{i_ans+1}}. </span><span style="color:#f44336">{{answ.get('name').value}}</span>
</div> </div>
<!--<mat-form-field> <!--<mat-form-field>
<input matInput formControlName="answer"> <input matInput formControlName="answer">
@ -36,12 +39,12 @@
</div> </div>
<div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%"> <div fxFlex="1 1 auto" class="ml-xs" fxFlex="20%">
<mat-form-field style="padding: 0 !important; margin: 0 !important; width: 45px !important; text-align: center;"> <mat-form-field style="padding: 0 !important; margin: 0 !important; width: 45px !important; text-align: center;">
<input matInput formControlName="template_answer_weightage"> <input matInput formControlName="score">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutAlign="end"> <div fxLayout="row" fxLayoutAlign="end">
<mat-error *ngIf="submitted && answ['controls'].template_answer_weightage.hasError('required')" class="mat-text-warn">Score Required.!</mat-error> <mat-error *ngIf="submitted && answ['controls'].score.hasError('required')" class="mat-text-warn">Score Required.!</mat-error>
</div> </div>
</div> </div>
</div> </div>

View File

@ -32,6 +32,7 @@ export class CategoryQuestionAnswerComponent implements OnInit {
countries = ['d', 'd', 'd', 'd', 'd', 'd']; countries = ['d', 'd', 'd', 'd', 'd', 'd'];
regularDistribution = 100 / 3; regularDistribution = 100 / 3;
@Input() CaterogyQuesAns: any; @Input() CaterogyQuesAns: any;
_editquestionAnswerForm: FormGroup; _editquestionAnswerForm: FormGroup;
@ -83,37 +84,65 @@ export class CategoryQuestionAnswerComponent implements OnInit {
} }
setModelFirstFormDate(record) { setModelFirstFormDate(record) {
// let val = record;
// let vals = {
// question_id: val.question_id,
// question: val.question,
// template_question_id: val.template_question_id,
// fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id,
// fk_question_id: val.fk_question_id == null ? val.question_id : val.fk_question_id,
// question_weightage: val.question_weightage,
// fk_template_question_category_id: val.fk_template_question_category_id == null ? this.CaterogyQuesAns.fk_question_category_id : val.fk_template_question_category_id,
// question_answerable_by: val.question_answerable_by,
// isactive: val.isactive == null ? 1 : val.isactive,
// answers: val.answers
// };
let val = record; let val = record;
let vals = { let vals = {
question_id: val.question_id, question_key_mapping_id: val.question_key_mapping_id,
fk_form_id: val.fk_form_id,
question: val.question, question: val.question,
template_question_id: val.template_question_id,
fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id, fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id,
fk_question_id: val.fk_question_id == null ? val.question_id : val.fk_question_id, score_question_id: val.score_question_id == null ? val.question_id : val.score_question_id,
question_weightage: val.question_weightage, fk_key: val.fk_key == null ? val.key : val.fk_key,
fk_template_question_category_id: val.fk_template_question_category_id == null ? this.CaterogyQuesAns.fk_question_category_id : val.fk_template_question_category_id, weightage: val.weightage,
question_answerable_by: val.question_answerable_by, isactive: val.isactive == null ? 1 : val.isactive
isactive: val.isactive == null ? 1 : val.isactive,
answers: val.answers
}; };
if(record.answers !== undefined){
vals['answers'] = val.answers;
}
this.addLanguage(vals, null); this.addLanguage(vals, null);
} }
setFirstFormDate(record) { setFirstFormDate(record) {
if (record.length > 0) { if (record.length > 0) {
for (let val of record) { for (let val of record) {
let vals = { // let vals = {
question_id: val.question_id, // question_id: val.question_id,
question: val.question, // question: val.question,
template_question_id: val.template_question_id, // template_question_id: val.template_question_id,
fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id, // fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id,
fk_question_id: val.fk_question_id == null ? val.question_id : val.fk_question_id, // fk_question_id: val.fk_question_id == null ? val.question_id : val.fk_question_id,
question_weightage: val.question_weightage, // question_weightage: val.question_weightage,
fk_template_question_category_id: val.fk_template_question_category_id == null ? this.CaterogyQuesAns.fk_template_question_category_id : val.fk_template_question_category_id, // fk_template_question_category_id: val.fk_template_question_category_id == null ? this.CaterogyQuesAns.fk_template_question_category_id : val.fk_template_question_category_id,
question_answerable_by: val.question_answerable_by, // question_answerable_by: val.question_answerable_by,
isactive: val.isactive == null ? 1 : val.isactive, // isactive: val.isactive == null ? 1 : val.isactive,
answers: val.answers // answers: val.answers
}; // };
let vals = {
question_key_mapping_id: val.question_key_mapping_id,
fk_form_id: val.fk_form_id,
question: val.question,
fk_template_id: val.fk_template_id == null ? this.CaterogyQuesAns.fk_template_id : val.fk_template_id,
score_question_id: val.score_question_id == null ? val.question_id : val.score_question_id,
fk_key: val.fk_key == null ? val.key : val.fk_key,
weightage: val.weightage,
isactive: val.isactive == null ? 1 : val.isactive
};
if(val.answers !== undefined){
vals['answers'] = val.answers;
}
this.addLanguage(vals, null); this.addLanguage(vals, null);
} }
} }
@ -122,13 +151,12 @@ export class CategoryQuestionAnswerComponent implements OnInit {
setAnswers(record, i) { setAnswers(record, i) {
for (let val of record) { for (let val of record) {
let vals = { let vals = {
question_answer_id: val.question_answer_id, id: val.id,
answer: val.answer, name: val.name,
template_answer_weightage_id: val.template_answer_weightage_id, answer: val.answer == null ? val.id : val.answer,
fk_template_question_id: val.fk_template_question_id, score: val.score,
fk_question_answer_id: val.fk_question_answer_id == null ? val.question_answer_id : val.fk_question_answer_id, fk_score_question_id: val.fk_score_question_id,
template_answer_weightage: val.template_answer_weightage, score_answer_id: val.score_answer_id,
template_answer_remark: val.template_answer_remark,
isactive: val.isactive isactive: val.isactive
}; };
this.addAnswerData(vals, null, i); this.addAnswerData(vals, null, i);
@ -145,12 +173,12 @@ export class CategoryQuestionAnswerComponent implements OnInit {
initAnswerData(data) { initAnswerData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
id: [data.id],
name: [data.name],
answer: [data.answer], answer: [data.answer],
template_answer_weightage_id: [data.template_answer_weightage_id], score: [data.score, Validators.compose([Validators.required])],
fk_template_question_id: [data.fk_template_question_id], fk_score_question_id: [data.fk_score_question_id],
fk_question_answer_id: [data.fk_question_answer_id], score_answer_id: [data.score_answer_id],
template_answer_weightage: [data.template_answer_weightage, Validators.compose([Validators.required])],
template_answer_remark: [data.template_answer_remark],
isactive: [data.isactive] isactive: [data.isactive]
}); });
} }
@ -160,15 +188,14 @@ export class CategoryQuestionAnswerComponent implements OnInit {
// Dynamic Form field creation Functionality : START ===> // Dynamic Form field creation Functionality : START ===>
initAnswers(data) { initAnswers(data) {
return this._formBuilder.group({ return this._formBuilder.group({
question_id: [data.question_id], question_key_mapping_id: [data.question_key_mapping_id],
fk_form_id: [data.fk_form_id],
question: [data.question], question: [data.question],
template_question_id: [data.template_question_id],
fk_template_id: [data.fk_template_id], fk_template_id: [data.fk_template_id],
fk_question_id: [data.fk_question_id], score_question_id: [data.score_question_id],
question_weightage: [data.question_weightage, Validators.compose([Validators.required])], weightage: [data.weightage, Validators.compose([Validators.required])],
fk_template_question_category_id: [data.fk_template_question_category_id], fk_key: [data.fk_key],
isactive: [data.isactive], isactive: [data.isactive],
question_answerable_by: [data.question_answerable_by],
answers: this._formBuilder.array([ answers: this._formBuilder.array([
// this.setAnswers(data.answers) // this.setAnswers(data.answers)
]) ])
@ -189,16 +216,20 @@ export class CategoryQuestionAnswerComponent implements OnInit {
} else { } else {
const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions']; const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'];
control.push(this.initAnswers(data)); control.push(this.initAnswers(data));
this.setAnswers(data.answers, control.length - 1); if(data.answers !== undefined) {
this.setAnswers(data.answers, control.length - 1);
}
} }
} }
// =========== : END // =========== : END
removeLanguage(inx) { removeLanguage(inx, e) {
e.stopPropagation();
// let value = <FormArray>this._editquestionAnswerForm.controls['temp_questions'].indexOf(inx); // let value = <FormArray>this._editquestionAnswerForm.controls['temp_questions'].indexOf(inx);
let value = (<FormArray>this._editquestionAnswerForm.controls['temp_questions']).at(inx).get('template_question_id').value; let value = (<FormArray>this._editquestionAnswerForm.controls['temp_questions']).at(inx).get('question_key_mapping_id').value;
if (value == null) {
if (value !== null) {
const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions']; const control = <FormArray>this._editquestionAnswerForm.controls['temp_questions'];
control.removeAt(inx); control.removeAt(inx);
} else { } else {
@ -219,7 +250,7 @@ export class CategoryQuestionAnswerComponent implements OnInit {
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]); Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
let val = formValues.temp_questions; let val = formValues.temp_questions;
let totalScore = val.map(value => { return Number(value.question_weightage); }).reduce((acc, value) => { return acc + value; }, 0); let totalScore = val.map(value => { return Number(value.weightage); }).reduce((acc, value) => { return acc + value; }, 0);
if (totalScore == 100) { if (totalScore == 100) {
if (!this.checkDuplicateInObject(formValues.temp_questions)) { if (!this.checkDuplicateInObject(formValues.temp_questions)) {
@ -255,7 +286,7 @@ export class CategoryQuestionAnswerComponent implements OnInit {
inputArray.map((item, index) => { inputArray.map((item, index) => {
let currentVal = inputArray[index]; let currentVal = inputArray[index];
for (let i = index + 1; i < inputArray.length; i++) { for (let i = index + 1; i < inputArray.length; i++) {
if (currentVal.question_id === inputArray[i].question_id) { if (currentVal.question_key_mapping_id === inputArray[i].question_key_mapping_id) {
console.log('duplication: ' + i); console.log('duplication: ' + i);
this.dublicateRerdIndex = i; this.dublicateRerdIndex = i;
seenDuplicate = true; seenDuplicate = true;
@ -277,15 +308,37 @@ export class CategoryQuestionAnswerComponent implements OnInit {
], ],
templateUrl: './dialog-category-question-list.html' templateUrl: './dialog-category-question-list.html'
}) })
export class DialogOverviewExampleDialog { export class DialogOverviewExampleDialog implements OnInit {
public m_questions: any; public m_questions: any;
public m_question_forms: any;
constructor( constructor(
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>, public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
@Inject(MAT_DIALOG_DATA) public data: DialogData, @Inject(MAT_DIALOG_DATA) public data: DialogData,
private templatesService: TemplatesService, private templatesService: TemplatesService,
private mastersService: MastersService) { private mastersService: MastersService) {
this.getCategoryRemainingQuesMasters(); // this.getCategoryRemainingQuesMasters();
this.getPdFormListMaster();
}
ngOnInit(): void {
//Called after the constructor, initializing input properties, and the first call to ngOnChanges.
//Add 'implements OnInit' to the class.
// this.m_question_forms = [{
// "form_id" : "1",
// "form_name" : "Form 1"
// },{
// "form_id" : "2",
// "form_name" : "Form 2"
// },{
// "form_id" : "3",
// "form_name" : "Form 3"
// },{
// "form_id" : "4",
// "form_name" : "Form 4"
// }]
} }
onNoClick(ques): void { onNoClick(ques): void {
@ -295,8 +348,11 @@ export class DialogOverviewExampleDialog {
errorRecord: string; errorRecord: string;
noRecordFound: boolean; noRecordFound: boolean;
getCategoryRemainingQuesMasters() { getCategoryRemainingQuesMasters(form_id) {
this.templatesService.getRemaningQuestionCategory(this.data).subscribe( let data = this.data;
data['form_id'] = form_id;
this.m_questions = [];
this.templatesService.getFormIdRemainingQuestionsDetails(data).subscribe(
data => { data => {
if (data.status === 200 && data.dataStatus) { if (data.status === 200 && data.dataStatus) {
this.noRecordFound = true; this.noRecordFound = true;
@ -311,4 +367,24 @@ export class DialogOverviewExampleDialog {
); );
} }
getPdFormListMaster() {
this.mastersService.getAllMasterData('PDFORMS').subscribe(
data => {
if (data.status === 200 && data.dataStatus) {
this.noRecordFound = true;
this.m_question_forms = data.records;
} else {
this.noRecordFound = false;
}
},
error => {
this.noRecordFound = true;
}
);
}
selectedFormTypes(e) {
this.getCategoryRemainingQuesMasters(e.value);
}
} }

View File

@ -1,10 +1,22 @@
<div style="max-height: 480px;"> <mat-dialog-content class="mat-typography">
<div *ngIf="noRecordFound">
<mat-card class="listHover" style="width: 580px; padding: 6px;" *ngFor="let question of m_questions"> <mat-card style="width: 580px; min-height: 120px; padding: 6px;">
<span (click)="onNoClick(question)">{{question.question}}</span> <mat-form-field>
<mat-select placeholder="Forms List *" (selectionChange)="selectedFormTypes($event)">
<mat-option *ngFor="let forms of m_question_forms" [value]="forms.form_id">{{ forms.pd_form_name }}</mat-option>
</mat-select>
<!--<mat-error *ngIf="submitted && answ['controls'].fk_lender_id.hasError('required')" class="mat-text-warn">Lender Type Required.!</mat-error>-->
</mat-form-field>
<div style="max-height: 480px;">
<div *ngIf="noRecordFound">
<mat-card class="listHover" style="width: 480px; padding: 6px;" *ngFor="let question of m_questions">
<span (click)="onNoClick(question)">{{question.question}}</span>
</mat-card>
</div>
<div *ngIf="!noRecordFound" style="width: 320px;">
<h5 style="color: red;">No Records Found.!</h5>
</div>
</div>
</mat-card> </mat-card>
</div> </mat-dialog-content>
<div *ngIf="!noRecordFound" style="width: 320px;">
<h5 style="color: red;">No Records Found.!</h5>
</div>
</div>