changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-11 16:49:09 +05:30
parent dfd912a89e
commit 340ed4728e
5 changed files with 246 additions and 94 deletions

View File

@ -120,7 +120,7 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Age" formControlName="family_member_age" [readonly]="item.get('family_member_earning_status').value != '' ? 'true' : 'false'">
<input matInput placeholder="Age" formControlName="family_member_age">
</mat-form-field>
</div>
<div>
@ -146,7 +146,7 @@
<input matInput placeholder="Specify Others" formControlName="earning_if_others_segment">
</mat-form-field>
<mat-form-field style="width:45%;">
<input matInput placeholder="Income Per Month" formControlName="earning_gross_income_per_month" OnlyNumber type="text" (keyup)="inWords($event,2,i)" required>
<input matInput placeholder="Income Per Month" formControlName="earning_gross_income_per_month" OnlyNumber type="text" (keyup)="inWords($event,2,i)">
<mat-hint align="start" style="font-size:90%" *ngIf="item.get('earning_gross_income_per_month').value != ''">{{"&#8377;"}} {{IncomePerMonth[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:45%;">
@ -180,20 +180,32 @@
<mat-card-actions>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="removeFamilyMembers(ix,i)"
matTooltip="Delete Family Members" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="sup.controls.family_members_details.controls.length>1">
matTooltip="Delete Family Members" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="sup.controls.family_members_details.controls.length>0">
<mat-icon>delete</mat-icon>
</button>
</div>
<div align="center">
<!-- <div align="center">
<button type="button" mat-flat-button (click)="addFamilyMembers(ix,i)"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Family Members Of {{FamilyMemberAsLabel[ix]}} </strong>
</button>
</div>
</div> -->
</mat-card-actions>
</mat-card>
</div>
</div>
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addFamilyMembers(ix)"
matTooltip="Add More" matTooltipPosition="left" color="primary">
<span *ngIf="sup.controls.family_members_details['controls'].length == 0;else another;">
<strong>Add Family Members Of {{FamilyMemberAsLabel[ix]}}</strong>
</span>
<ng-template #another><strong>Add More Family Members Of {{FamilyMemberAsLabel[ix]}}</strong></ng-template>
<!-- <strong> </strong> -->
</button>
</div>
</mat-card-actions>
</div>
</mat-card-content>

View File

@ -35,7 +35,6 @@ export class FamilyDetailsComponent implements OnInit {
public apiFamilyMembers : any = [];
pdid: string;
form_id: number;
isReadOnly:any = [];
count: number;
IncomePerMonth: any = [];
RentAmount: any = [];
@ -361,38 +360,43 @@ export class FamilyDetailsComponent implements OnInit {
control.removeAt(i);
}
prevFamilyMembersCtrlLength: number = 0;
currFamilyMembersCtrlLength: number = 0;
selectedPerson(e,inx){
console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength);
this.FamilyMemberAsLabel[inx] = this.selectPerson.filter(item => item.pd_co_applicant_id == e)[0].applicant_name;
const control = <FormArray>this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details;
// console.log('current control length',control.length);
this.currFamilyMembersCtrlLength = control.length;
let newControlLength: number;
let oldControlLength: number = control.length;
let index: number = 0;
let i : number = 0 ;
for(i ;i < this.prevFamilyMembersCtrlLength;i++){
console.log(i,this.prevFamilyMembersCtrlLength);
control.removeAt(i);
}
// while(index < this.prevFamilyMembersCtrlLength)
// {
// }
this.prevFamilyMembersCtrlLength = this.currFamilyMembersCtrlLength;
console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength);
if(this.apiFamilyMembers.length>0){
let arraydata : any;
let data = this.apiFamilyMembers.filter(item => item.relation_to == e);
if(data.length > 0){
newControlLength = data.length;
while(index < oldControlLength)
{
control.removeAt(index);
index++;
}
oldControlLength = newControlLength
this.prevFamilyMembersCtrlLength = data.length;
console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength);
data.forEach((val,inx) => {
if(val.age){
// this.isReadOnly[inx] = true;
}else{
// this.isReadOnly[inx] = false;
}
// if(val.age){
// // this.isReadOnly[inx] = true;
// }else{
// // this.isReadOnly[inx] = false;
// }
arraydata = {
'family_member_name' : val.name,
'family_member_relationship' : val.relationship,
@ -412,24 +416,19 @@ export class FamilyDetailsComponent implements OnInit {
});
}
else{
newControlLength = 1;
while(index < oldControlLength)
{
control.removeAt(index);
index++;
}
oldControlLength = newControlLength;
this.prevFamilyMembersCtrlLength = 1;
console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength);
control.push(this.generateFamilyMembersDetailsGet());
}
}
else{
this.prevFamilyMembersCtrlLength = 1;
console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength);
control.push(this.generateFamilyMembersDetailsGet());
}
}
addFamilyMembers(inx,i) {
addFamilyMembers(inx) {
let mainControl = this.familyForm.get('family_details') as FormArray;
let control = mainControl.controls[inx].get('family_members_details') as FormArray;
control.push(this.generateFamilyMembersDetailsGet());

View File

@ -37,7 +37,7 @@
</mat-card>
<br>
<mat-form-field style="width:50%;">
<mat-select placeholder="PD Officers Recommendation" formControlName="pd_officers_recommendation" required (selectionChange)="RecommendationChange($event.value)">
<mat-select placeholder="PD Officers Recommendation" formControlName="pd_officers_recommendation" required><!--(selectionChange)="RecommendationChange($event.value)"-->
<mat-option>Select</mat-option>
<mat-option *ngFor="let list of m_recommendationList" [value]="list.pdofficer_recommendation_id">{{ list.pdofficer_recommendation }}</mat-option>
</mat-select>
@ -45,6 +45,89 @@
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 1">
<input matInput autocomplete="off" placeholder="Specify PD Officers Recommendation" formControlName="others_pd_officers_recommendation">
</mat-form-field>
<span *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 2">
<div formArrayName="recommendation_positive">
<div *ngFor="let details of _finalRemarkForm.get('recommendation_positive').controls; let i=index; let last=last"
[formGroupName]="i">
<mat-form-field style="width:40%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Positive" formControlName="reason_for_positive">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteRecommendationPositive(i)"
*ngIf="last">
<mat-icon>delete</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Postive Reasons" matTooltipPosition="above" color="primary" (click)="addRecommendationPositive()"
*ngIf="last">
<mat-icon>add</mat-icon>
</button>
</div>
</div>
</span>
<span *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 3">
<div formArrayName="recommendation_negative">
<div *ngFor="let details of _finalRemarkForm.get('recommendation_negative').controls; let i=index; let last=last"
[formGroupName]="i">
<mat-form-field style="width:40%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Negative" formControlName="reason_for_negative">
</mat-form-field>
<mat-card-actions>
<!-- <div align="right">
<button *ngIf="currentLoanForm.controls.loan_details.controls.length > 1" type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)">
<mat-icon>delete</mat-icon>
</button>
</div>
<div align="center">
<button type="button" mat-flat-button (click)="addLoanDetails()"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Loan Details </strong>
</button>
</div> -->
</mat-card-actions>
</div>
</div>
</span>
<span *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 4">
<div formArrayName="recommendation_refer_to_credit">
<div *ngFor="let details of _finalRemarkForm.get('recommendation_refer_to_credit').controls; let i=index; let last=last"
[formGroupName]="i">
<mat-card-content>
<mat-form-field style="width:45%;">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Refer to Credit" formControlName="reason_for_refer_to_credit">
</mat-form-field>
<!-- <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)"
*ngIf="i>0">
<mat-icon>delete</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()"
*ngIf="last">
s <mat-icon>add</mat-icon>
</button> -->
</mat-card-content>
<mat-card-actions>
<!-- <div align="right">
<button *ngIf="currentLoanForm.controls.loan_details.controls.length > 1" type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)">
<mat-icon>delete</mat-icon>
</button>
</div>
<div align="center">
<button type="button" mat-flat-button (click)="addLoanDetails()"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Loan Details </strong>
</button>
</div> -->
</mat-card-actions>
</div>
</div>
</span>
<!-- <mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 1">
<input matInput autocomplete="off" placeholder="Specify PD Officers Recommendation" formControlName="others_pd_officers_recommendation">
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 2">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Positive" formControlName="reason_for_positive">
</mat-form-field>
@ -53,7 +136,7 @@
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 4">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as 'Refer to Credit" formControlName="reason_for_refer_to_credit">
</mat-form-field>
</mat-form-field> -->
</mat-card>
</mat-dialog-content>
<mat-dialog-actions>

View File

@ -69,14 +69,65 @@ export class FinalRemarksComponent implements OnInit {
is_service_provided: ['', Validators.required],
pd_officers_recommendation:['', Validators.required],
others_pd_officers_recommendation:[''],
reason_for_positive:[''],
reason_for_negative:[''],
reason_for_refer_to_credit:[''],
// reason_for_positive:[''],
// reason_for_negative:[''],
// reason_for_refer_to_credit:[''],
recommendation_positive:this._formBuilder.array([
this.CreateRecommendationPositive(null),
]),
recommendation_negative:this._formBuilder.array([
this.CreateRecommendationNegative(null),
]),
recommendation_refer_to_credit:this._formBuilder.array([
this.CreateRecommendationReferToCredit(null),
]),
final_form_remarks: ['']
});
this.getM_Type();
this.getM_Recommendation();
}
CreateRecommendationPositive(data) {
return this._formBuilder.group({
reason_for_positive: data == null ? [''] : [data.reason_for_positive],
});
}
addRecommendationPositive() {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_positive'];
control.push(this.CreateRecommendationPositive(null));
}
deleteRecommendationPositive(index) {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_positive'];
control.removeAt(index);
}
CreateRecommendationNegative(data) {
return this._formBuilder.group({
reason_for_negative: data == null ? [''] : [data.reason_for_negative],
});
}
addRecommendationNegative() {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_negative'];
control.push(this.CreateRecommendationNegative(null));
}
deleteRecommendationNegative(index) {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_negative'];
control.removeAt(index);
}
CreateRecommendationReferToCredit(data) {
return this._formBuilder.group({
reason_for_refer_to_credit: data == null ? [''] : [data.reason_for_refer_to_credit],
});
}
addRecommendationReferToCredit() {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_refer_to_credit'];
control.push(this.CreateRecommendationReferToCredit(null));
}
deleteRecommendationReferToCredit(index) {
const control = <FormArray>this._finalRemarkForm.controls['recommendation_refer_to_credit'];
control.removeAt(index);
}
public viewerOptions: any = {
navbar: false,
toolbar: {
@ -101,15 +152,15 @@ export class FinalRemarksComponent implements OnInit {
ngOnInit() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '20').subscribe(data=>{
if(data.dataStatus){
this.RecommendationChange(data.records.pd_officers_recommendation);
// this.RecommendationChange(data.records.pd_officers_recommendation);
this._finalRemarkForm.controls.final_custormer_remark_type.setValue(data.records.final_custormer_remark_type);
this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour);
this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation);
this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation);
this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive);
this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative);
this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit);
// this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive);
// this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative);
// this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit);
this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided);
this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks);
@ -204,78 +255,78 @@ export class FinalRemarksComponent implements OnInit {
}
}
RecommendationChange(e){
// if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 1){
// RecommendationChange(e){
// // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 1){
// }
// if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 3){
// // }
// // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 3){
// }
// if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){
// // }
// // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){
// }
// // }
if(e==1){
// if(e==1){
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]);
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]);
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
// this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
// this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
// this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
// this._finalRemarkForm.controls['reason_for_negative'].setValue('');
}
if(e==2){
// }
// if(e==2){
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]);
// this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]);
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
// this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
// this._finalRemarkForm.controls['reason_for_negative'].setValue('');
}
if(e==3){
// }
// if(e==3){
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
// this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
// this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]);
// this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]);
}
if(e==4){
// }
// if(e==4){
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]);
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]);
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
// this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
// this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
// this._finalRemarkForm.controls['reason_for_negative'].setValue('');
// this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
}
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity();
}
// }
// this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
// this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity();
// this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity();
// this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity();
// }
}

View File

@ -612,6 +612,7 @@ export class GeneralInfoComponent implements OnInit {
// greater than zero means not applicable here
if(this.customer_segment_abbr == 'SE-RI'){
let otherControl: any = this._generalForm.get('companies') as FormArray;
if(otherControl.controls.length > 0){
otherControl = otherControl.controls[0];
// otherControl.controls.business_entity_type_other.clearValidators();
// otherControl.controls.business_entity_type_other.updateValueAndValidity();
@ -621,7 +622,8 @@ export class GeneralInfoComponent implements OnInit {
otherControl.controls.business_entity_type.clearValidators();
otherControl.controls.business_entity_type.updateValueAndValidity();
}
}
// console.log(formData.individuals.length);
// console.log(formData.individuals);
@ -637,9 +639,11 @@ export class GeneralInfoComponent implements OnInit {
}
else {
if(formData.individuals.length > 0){
// console.log(this.temp,formData.individuals.length);
formData.individuals.forEach((val,index) => {
if(val.is_person_met == false){
this.temp++;
}
@ -647,6 +651,9 @@ export class GeneralInfoComponent implements OnInit {
if(this.temp == formData.individuals.length){
this.notifier.notify('warning', 'Please Choose Name of Person Met.!');
this.temp = 0;
return;
}
}