This commit is contained in:
venbatechnologies@gmail.com 2018-12-13 10:53:14 +05:30
commit 915e59d6ca
13 changed files with 771 additions and 353 deletions

View File

@ -2,7 +2,7 @@
<mat-dialog-content class="mat-typography"> <mat-dialog-content class="mat-typography">
<!--<h3>Develop across all platforms</h3>--> <!--<h3>Develop across all platforms</h3>-->
<div style="margin: 12px;"> <div style="margin: 12px;">
<form role="form" [formGroup]="ngForm" accept-charset="UTF-8" novalidate> <form role="form" *ngIf="showEditor" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<ckeditor formControlName="content" name="myckeditor" required [config]="ckeConfig" debounce="500" (change)="onChange($event)"> <ckeditor formControlName="content" name="myckeditor" required [config]="ckeConfig" debounce="500" (change)="onChange($event)">
</ckeditor> </ckeditor>

View File

@ -47,24 +47,14 @@ export class ModelEditPdReportComponent implements OnInit {
ngOnInit() { ngOnInit() {
// alert(JSON.stringify(this.data)); // alert(JSON.stringify(this.data));
// this.ngForm.controls['content'].setValue('<h1>Home<h1>'); // this.ngForm.controls['content'].setValue('<h1>Home<h1>');
this.pdTrigerService.getActualPDReportModelTemplate(this.data.startId).subscribe(data => { this.pdTrigerService.getActualPDReportModelTemplate(this.data).subscribe(data => {
if(data.dataStatus){ if(data['dataStatus']){
this.recordData = data.records[0]; this.recordData = data.records[0];
this.ngForm = this._formBuilder.group({ this.ngForm = this._formBuilder.group({
content: [this.recordData.pd_report_latest_version_blob, Validators.compose([Validators.required])], content: [this.recordData.pd_report_latest_version_blob, Validators.compose([Validators.required])],
isactive:[this.recordData.isactive] isactive:[this.recordData.isactive]
}) });
this.showEditor = true; this.showEditor = true;
} else {
this.recordData = data.records;
this.ngForm = this._formBuilder.group({
report_template_id: [null],
fk_template_id: [this.questionId],
content: [null, Validators.compose([Validators.required])],
isactive:[1]
})
this.showEditor = true;
} }
},err => { },err => {

View File

@ -7,7 +7,7 @@
<mat-card style="min-height:540px;"> <mat-card style="min-height:540px;">
<mat-card-content> <mat-card-content>
<mat-tab-group> <mat-tab-group>
<mat-tab label="PD Report"> <mat-tab label="PD Data">
<div> <div>
<div> <div>
<label>Billing Name : </label> {{pdReportRecords?.billing_name}} <label>Billing Name : </label> {{pdReportRecords?.billing_name}}
@ -42,18 +42,36 @@
</div> </div>
</div> </div>
</mat-tab> </mat-tab>
<mat-tab label="PD Report With Template"> <mat-tab label="PD Report">
<div> <div>
<div style="text-align: right;" class="mb-1"> <div style="text-align: left; margin: 12px;" class="mb-1">
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Edit" matTooltipPosition="above" <button mat-raised-button color="primary" *ngIf="generateBtn" (click)="generateNewPDReport()">Generate Report</button>
(click)="addNewQuestion()"><mat-icon>edit</mat-icon></button> <button mat-raised-button color="accent" *ngIf="reGenerateBtn" (click)="reGeneratePFReport()">Re-generate Report</button>
</div>
<div *ngIf="reGenerateBtn">
<div style="text-align: right;">
<mat-select style="width: 50%;" placeholder="Select PD Version" >
<mat-option>--</mat-option>
<mat-option *ngFor="let pd of pdReportVersionList" (click)="changeVersion(pd)" >
{{ pd.doc_name }} <span *ngIf="pd.is_latest == 1" [style.color]="'green'">( Current Version )</span>
</mat-option>
</mat-select>
</div>
<div *ngIf="latestPDDetails">
<div style="margin: 12px;
background: #ddd;
padding: 8px;">
<div style="text-align: right;" class="mb-1">
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Edit" matTooltipPosition="above"
*ngIf="latestPDDetails.is_latest == 1" (click)="addNewQuestion()"><mat-icon>edit</mat-icon></button>
<button mat-stroked-button *ngIf="latestPDDetails.is_latest == 0" (click)="changeDocumentEdit()">Enable Editable</button>
</div>
<div>
<pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
</pdf-viewer>
</div>
</div>
</div> </div>
<hr>
<div style="margin: 12px;
background: #ddd;
padding: 8px;">
<pdf-viewer [src]="src" [original-size]="false">
</pdf-viewer>
</div> </div>
</div> </div>
</mat-tab> </mat-tab>

View File

@ -1,14 +1,19 @@
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser'; import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import {Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy} from '@angular/core'; import {Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy, Inject} from '@angular/core';
import {FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl} from '@angular/forms'; import {FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl} from '@angular/forms';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {NotifierService} from 'angular-notifier'; import {NotifierService} from 'angular-notifier';
import {ListPdComponent} from './../list-pd.component'; import {ListPdComponent} from './../list-pd.component';
import {PdTrigerService} from '../../../pd-service/pd-triger.service'; import {PdTrigerService} from '../../../pd-service/pd-triger.service';
import { MatDialog } from "@angular/material"; import { MatDialog,
MatDialogRef,
MAT_DIALOG_DATA } from "@angular/material";
import { ModelEditPdReportComponent} from './model-edit-pd-report/model-edit-pd-report.component'; import { ModelEditPdReportComponent} from './model-edit-pd-report/model-edit-pd-report.component';
/**sweet alert */
// import Swal from 'sweetalert2';
@Component({ @Component({
selector: 'app-pd-report', selector: 'app-pd-report',
templateUrl: './pd-report.component.html', templateUrl: './pd-report.component.html',
@ -21,10 +26,12 @@ export class PdReportComponent implements OnInit {
// public src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b'; // public src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b';
public src; public src;
public document; public document;
public generateBtn: Boolean = false;
public reGenerateBtn: Boolean = false;
public pdReportVersionList = [];
// public src; // public src;
pdReportRecords:any; pdReportRecords:any;
latestPDDetails: any;
private notifier: NotifierService; private notifier: NotifierService;
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
@ -39,13 +46,61 @@ export class PdReportComponent implements OnInit {
// description: 'An amazing Angular 2 pdf', // description: 'An amazing Angular 2 pdf',
// url: { url: 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b', withCredentials: true } }; // url: { url: 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b', withCredentials: true } };
// this.Url = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822"); // this.Url = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822");
} }
ngOnInit() { ngOnInit() {
this.listPDComponent.showListView(false); this.listPDComponent.showListView(false);
this.getPdReportDetails(); this.getPdReportDetails();
this.getPdReportFinalTemplateDetails(); this.getPdReportVersionList();
}
reGeneratePFReport(){
let data = {
"pd_id": this.startPD,
"regenerate":"1"
};
this.pdTrigerService.getPDReportFinalDocument(data).subscribe(data=>{
if(data.dataStatus){
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
generateNewPDReport() {
let data = {
"pd_id": this.startPD
};
this.pdTrigerService.getPDReportFinalDocument(data).subscribe(data=>{
if(data.dataStatus){
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
getPdReportVersionList(){
this.pdTrigerService.getPdDocVersionList(this.startPD).subscribe(data => {
if(data.status == 200 && data.dataStatus){
this.pdReportVersionList = [...data.records].reverse();
let datas = this.pdReportVersionList.filter((a)=>{return a.is_latest == 1;})
this.latestPDDetails = datas[0];
// alert(JSON.stringify(this.latestPDDetails));
this.reGenerateBtn = true;
} else {
// this.reGenerateBtn = true;
this.generateBtn = true;
}
}, err=> {
})
} }
getPdReportDetails() { getPdReportDetails() {
@ -60,18 +115,6 @@ export class PdReportComponent implements OnInit {
}) })
} }
getPdReportFinalTemplateDetails(){
this.pdTrigerService.getPDReportFinalDocument(this.startPD).subscribe(data => {
if (data.status == 200) {
// this.pdReportRecords = data.records.question_answers;
this.src = data.records.pd_report_uri;
// alert(this.src);
// this.pdReportRecords = data.records.qu;
}
}, err=> {
})
}
// load pd view component // load pd view component
@ -82,232 +125,122 @@ export class PdReportComponent implements OnInit {
// add questions popup model call // add questions popup model call
addNewQuestion() { addNewQuestion() {
const dialogRef = this.dialog.open(ModelEditPdReportComponent, { const dialogRef = this.dialog.open(ModelEditPdReportComponent, {
data: { startId : this.startPD}, data: { startId : this.startPD, version_id: this.latestPDDetails.doc_name},
disableClose: true disableClose: true
}); });
dialogRef.afterClosed() dialogRef.afterClosed()
.subscribe(dataresult => { .subscribe(dataresult => {
this.getPdReportFinalTemplateDetails(); // this.getPdReportFinalTemplateDetails();
// this.getQuestionsMasters(); // this.getQuestionsMasters();
// this.getBranch(); // this.getBranch();
// this.isPopupOpened = false; // this.isPopupOpened = false;
}); });
} }
changeVersion(pd : any): void {
this.latestPDDetails = pd;
}
changeDocumentEdit() : void{
const dialogRef = this.dialog.open(DialogChangeCurrentVenrsion, {
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult) {
let data = {
"pd_id": this.startPD,
"doc_name": this.latestPDDetails.doc_name
};
this.pdTrigerService.swapOlderPDReportToLatest(data).subscribe(data => {
if (data.status == 200) {
this.notifier.notify('success', 'Your Changes Updated.!');
this.getPdReportVersionList();
} else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err=> {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
} else {
}
});
// Swal('User Created');
// swal({
// title: 'Error!',
// text: 'Do you want to continue',
// type: 'error',
// confirmButtonText: 'Cool'
// });
// Swal({
// title: 'Are you sure?',
// type: 'warning',
// showCancelButton: true,
// confirmButtonColor: '#3085d6',
// cancelButtonColor: '#d33',
// confirmButtonText: SwalButtonText
// }).then((result) => {
// if (result.value) {
// // this._mastersService.editMasterDetails(ActiveDatas,'CITY')
// // .subscribe(dataresult=>{
// // if (dataresult.dataStatus == true){
// // Swal(this.SwalMessage,'success');
// // this.getCity();
// // }
// // else{
// // Swal("Sorry Try Again !");
// // }
// // });
// }
// else{
// // this.getCity();
// }s
// })
}
} }
// let Records = {
// "dataStatus": true, @Component({
// "status": 200, selector: 'dialog-overview-example-dialog',
// "records": { styles: [`
// "pd_id": "1", .listHover: hover {
// "fk_lender_id": "7", background: yellow;
// "lender_full_name": "check", }`
// "lender_short_name": "check", ],
// "fk_entity_billing_id": "1", template: `
// "billing_name": "ICICI- CHENNAI", <div style="width: 220px;">
// "lender_applicant_id": "Le123", <h3 style="text-align: center">Document is marked as final</h3>
// "pd_date_of_initiation": "06\/10\/2018", <p style="text-align: center"> Because you've marked the document as final, you can edit this document.</p>
// "fk_product_id": "8", <div style="text-align: center; margin: 12px;" class="mb-1">
// "product_name": "Land Loan", <button mat-raised-button color="primary" (click)="getConfirmation(false)">Cancel</button>
// "product_abbr": "LL", <button mat-raised-button color="accent" (click)="getConfirmation(true)">ok</button>
// "fk_subproduct_id": "1", </div>
// "subproduct_name": "Purchase (Resale) Loan. ", </div>
// "subproduct_abbr": "HL PUR-RESALE", `
// "fk_pd_type": "1", })
// "pd_type_name": "Full PD ", export class DialogChangeCurrentVenrsion implements OnInit {
// "pd_status": "COMPLETED",
// "pd_status_name": null, public m_questions: any;
// "pd_specific_clarification": null,
// "createdon": "06\/10\/2018 05:43:58", public m_question_forms: any;
// "fk_createdby": "1", constructor(
// "updatedon": "16\/11\/2018 11:11:00", public dialogRef: MatDialogRef<DialogChangeCurrentVenrsion>,
// "fk_updatedby": "1", @Inject(MAT_DIALOG_DATA) public data) {
// "createdby": "Krishna kumar", }
// "updatedby": "Krishna kumar",
// "fk_pd_allocation_type": "1", ngOnInit(): void {
// "pd_allocation_type_name": "AUTO", }
// "fk_pd_allocated_to": "128",
// "pd_allocated_to": "VinothKumar S", getConfirmation(confim : Boolean) {
// "executive_id": null, this.dialogRef.close(confim);
// "executive_name": null, }
// "central_pd_officer_id": null,
// "centralofficer": null, }
// "fk_pd_template_id": "11",
// "template_name": "TMB",
// "fk_customer_segment": "2",
// "customer_segment_name": "Salary Cheque",
// "customer_segment_abbr": "SAL-CHQ",
// "pd_officier_final_judgement": null,
// "pd_agency_id": null,
// "agency_name": null,
// "loan_amount": "60000",
// "addressline1": "MGR Street,Vengaivasal Main Road",
// "addressline2": "Santhoshpuram",
// "addressline3": "chennai",
// "fk_city": "2",
// "city_name": "Chennai",
// "fk_state": "2",
// "state_name": "Tamil Nadu",
// "pincode": "600100",
// "pd_contact_person": "Ram",
// "pd_contact_mobileno": "32131233",
// "scheduled_on": "31\/12\/2018 12:59 PM",
// "completed_on": null,
// "remarks": null,
// "pd_applicant_details": [
// {
// "pd_co_applicant_id": "1",
// "fk_pd_id": "1",
// "applicant_name": "Karthi Raj",
// "applicant_type": "1",
// "mobile_no": "4234234155",
// "email": "sivak@gmail.com",
// "addressline1": null,
// "addressline2": null,
// "addressline3": null,
// "fk_city": null,
// "fk_state": null,
// "pincode": null,
// "relation": "brother",
// "relation_name": null,
// "landline": null
// },
// {
// "pd_co_applicant_id": "2",
// "fk_pd_id": "1",
// "applicant_name": "ramesh",
// "applicant_type": "0",
// "mobile_no": "3123123213",
// "email": "",
// "addressline1": null,
// "addressline2": null,
// "addressline3": null,
// "fk_city": null,
// "fk_state": null,
// "pincode": null,
// "relation": "brother",
// "relation_name": null,
// "landline": null
// }
// ],
// "question_answers": {
// "form_details": [
// {
// "Name": "Supplied Details",
// "Details": [
// {
// "question": "What are the main raw materials?(MEG Only)",
// "answer": "check checkcheck"
// },
// {
// "question": "Supplier Name",
// "answer": "Resico"
// },
// {
// "question": "Contact Person Name",
// "answer": "Karthick"
// },
// {
// "question": "Contact Mobile Number",
// "answer": "9874115221"
// },
// {
// "question": "Payment Mode",
// "answer": "Immediate Or Advanced Payment"
// },
// {
// "question": "% of immediate \/ Advance Payment Purchase to Total Purchase?",
// "answer": "212"
// },
// {
// "question": "Credit Period",
// "answer": ""
// },
// {
// "question": "Frequency of Purchase",
// "answer": "Monthly"
// },
// {
// "question": "Others Details",
// "answer": ""
// }
// ]},
// {
// "Name": "Client Details",
// "Details": [
// {
// "question": "Client Name",
// "answer": "Venba"
// },
// {
// "question": "Contact Person Name",
// "answer": "test"
// },
// {
// "question": "Contact Mobile Number",
// "answer": "9685471122"
// },
// {
// "question": "Payment Mode",
// "answer": "Combination of Both"
// },
// {
// "question": "% of immediate \/ Advance Payment Purchase to Total Purchase?",
// "answer": "12"
// },
// {
// "question": "Credit Period",
// "answer": "10"
// },
// {
// "question": "Frequency of Purchase",
// "answer": "Weekly"
// },
// {
// "question": "Others Details",
// "answer": ""
// }
// ]},
// { "Name": "Personal Details",
// "Details": [
// {
// "question": "Name",
// "answer": "Karthi Raj"
// },
// {
// "question": "Age",
// "answer": "50"
// },
// {
// "question": "Entity",
// "answer": "Individual"
// },
// {
// "question": "Name",
// "answer": "ramesh"
// },
// {
// "question": "Age",
// "answer": "45"
// },
// {
// "question": "Entity",
// "answer": "Individual"
// },
// {
// "question": "Relationship With Main Applicant",
// "answer": "Brother"
// },
// {
// "question": "Remarks",
// "answer": "good"
// }
// ]}
// ],
// "general_questions": [
// ]
// }
// }
// }

View File

@ -51,7 +51,7 @@
formControlName="locality_others"> formControlName="locality_others">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field style="width: 30%">
<mat-select placeholder="Approach to PD Location" formControlName="pd_location" required> <mat-select placeholder="Approach to PD Location" formControlName="pd_location" required>
<mat-option value="{{data.pd_location_approach_id}}" <mat-option value="{{data.pd_location_approach_id}}"
*ngFor="let data of locationdata">{{data.description}} *ngFor="let data of locationdata">{{data.description}}
@ -59,7 +59,7 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field style="width: 30%">
<mat-select placeholder="Comment on Locality" formControlName="comment_locality" required> <mat-select placeholder="Comment on Locality" formControlName="comment_locality" required>
<mat-option value="{{data.comments_on_locality_id}}" <mat-option value="{{data.comments_on_locality_id}}"
*ngFor="let data of commentData">{{data.rating}} *ngFor="let data of commentData">{{data.rating}}
@ -86,11 +86,15 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 4 "> <mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 4 " style="width: 38%">
<input matInput placeholder="Specify Other Ownership" formControlName="other_ownership"> <input matInput placeholder="Specify Other Ownership" formControlName="other_ownership">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 3 " style="width: 38%">
<input matInput placeholder="What is the monthly rent paid?" formControlName="rent_amt">
</mat-form-field>
<mat-form-field style="width: 42%">
<mat-select placeholder="Is there any business activity is being run?" <mat-select placeholder="Is there any business activity is being run?"
formControlName="bussiness_activity" required> formControlName="bussiness_activity" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
@ -98,18 +102,64 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['bussiness_activity'].value == 'yes'"> <mat-form-field *ngIf="addressForm.controls['bussiness_activity'].value == 'yes'" style="width: 100%">
<mat-select placeholder="Bussiness Type" formControlName="bussiness_address_type"> <!-- <mat-select placeholder="Bussiness Type" formControlName="bussiness_address_type">
<mat-option value="{{m_addressType.address_type_id}}" <mat-option value="{{m_addressType.address_type_id}}"
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}} *ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
</mat-option> </mat-option>
</mat-select> -->
<mat-select placeholder="Type of Premises" formControlName="bussiness_address_type" multiple>
<mat-option *ngFor="let m_addressType of addressData" [value]="m_addressType.address_type_id" (onSelectionChange)="SelectedPremises($event)" > {{m_addressType.address_type}} </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['bussiness_address_type'].value == 12"> <mat-form-field *ngIf="PremisesOtherFlag == true" style="width: 40%">
<input matInput placeholder="Bussiness Address Type Others" formControlName="bussiness_address_type_others"> <input matInput placeholder="Specify Other Premises Type" formControlName="bussiness_address_type_others">
</mat-form-field> </mat-form-field>
<mat-card formArrayName="premises">
<div
*ngFor="let item of addressForm.controls.premises['controls']; let i = index;" [formGroupName]="i">
<mat-card-header>
<mat-card-title>{{i+1}} . {{PremisesLabel[i]}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 40%;">
<input matInput placeholder="Number Of Additional Units"
formControlName="no_of_additional_units">
</mat-form-field>
<mat-form-field *ngIf="item.get('no_of_additional_units').value > 2" style="width: 40%;">
<mat-select placeholder="City" formControlName="premises_city"> <!--multiple (selectionChange)="relationChanged($event)"> -->
<mat-option *ngFor="let CL of cityData" [value]="CL.city_id">
{{CL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="item.get('no_of_additional_units').value <= 2 && item.get('no_of_additional_units').value != '' " style="width: 40%;">
<mat-select placeholder="Ownership" formControlName="premises_ownership">
<mat-option value="{{ownerShip.id}}" *ngFor="let ownerShip of ownerShipData">
{{ownerShip.name}}
</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field *ngIf="addressForm.controls['premises_ownership'].value == 4 "> -->
<mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 40%;">
<input matInput placeholder="Specify Other Ownership" formControlName="premises_ownership_others">
</mat-form-field>
<mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 40%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Remarks"
formControlName="premises_remarks" style="width: 65%;">
</mat-form-field>
</mat-card-content>
</div>
</mat-card>
<!--- Don't Remove To replace atlast of the PD Completion and creating new form (Neighbourhood check) -- <!--- Don't Remove To replace atlast of the PD Completion and creating new form (Neighbourhood check) --
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>

View File

@ -39,13 +39,23 @@ export class AddressComponent implements OnInit {
loadDataStatus: boolean=true; loadDataStatus: boolean=true;
PremisesOtherFlag:boolean;
PremisesLabel : any = [];
locationdata: any = []; locationdata: any = [];
commentData: any = []; commentData: any = [];
//customerData: any = []; 221118 review doc s.no 3.e //customerData: any = []; 221118 review doc s.no 3.e
addressData:any = []; addressData:any = [];
localityData:any = []; localityData:any = [];
ownerShipData:any = []; ownerShipData:any = [];
cityData:any = [];
z = 0;
formPremisesArray: any = [];
relativeNames2: any = [];
//neighbourStatusData:any=["Yes","No"]; //neighbourStatusData:any=["Yes","No"];
//applicantOwnerData:any=["Yes","No","Dont Know"]; //applicantOwnerData:any=["Yes","No","Dont Know"];
@ -60,6 +70,7 @@ export class AddressComponent implements OnInit {
public customerBehaviour: AbstractControl; public customerBehaviour: AbstractControl;
public ownership: AbstractControl; public ownership: AbstractControl;
public other_ownership: AbstractControl; public other_ownership: AbstractControl;
public rent_amt : AbstractControl;
public bussinessActivity: AbstractControl; public bussinessActivity: AbstractControl;
//constructor(notifier: NotifierService,private _fb: FormBuilder,private _pd: PdTrigerService , ) { //constructor(notifier: NotifierService,private _fb: FormBuilder,private _pd: PdTrigerService , ) {
constructor(private el: ElementRef, notifier: NotifierService, constructor(private el: ElementRef, notifier: NotifierService,
@ -83,6 +94,7 @@ export class AddressComponent implements OnInit {
this.getMasterDetails('LOCALITY',4); this.getMasterDetails('LOCALITY',4);
this.getMasterDetails('ADDRESSTYPE',5); this.getMasterDetails('ADDRESSTYPE',5);
this.getMasterDetails('RESIDENCEOWNERSHIP',6); this.getMasterDetails('RESIDENCEOWNERSHIP',6);
this.getMasterDetails('CITY',7);
this.initAddressForm(); this.initAddressForm();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
@ -90,10 +102,12 @@ export class AddressComponent implements OnInit {
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'];
const control = <FormArray>this.addressForm.controls['premises'];
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);
@ -106,9 +120,39 @@ export class AddressComponent implements OnInit {
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);
this.addressForm.controls.other_ownership.setValue(data.records.other_ownership); this.addressForm.controls.other_ownership.setValue(data.records.other_ownership);
this.addressForm.controls.rent_amt.setValue(data.records.rent_amt);
this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity); this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity);
if(data.records.bussiness_activity == 'yes') { if(data.records.bussiness_activity == 'yes') {
this.addressForm.controls.bussiness_address_type.setValue(data.records.bussiness_address_type); let selectedMembers = Object.keys(data.records.bussiness_address_type).map(function (key) {
return data.records.bussiness_address_type[key];
});
let enduse: any = [];
let existPremises: any =[];
selectedMembers.forEach(val => {
enduse.push(val.premises);
existPremises.push(val);
});
this.formPremisesArray = existPremises;
this.addressForm.controls.bussiness_address_type.setValue(enduse);
var result = Object.keys(data.records.premises).map(function (key) {
return data.records.premises[key];
});
if (result.length == 0) {
control.push(this.createPremises());
} else {
result.forEach(datas => {
control.push(this.createPremises());
});
}
this.addressForm.controls['premises'].setValue(result);
if(data.records.bussiness_address_type == 12) { if(data.records.bussiness_address_type == 12) {
this.addressForm.controls.bussiness_address_type_others.setValue(data.records.bussiness_address_type_others); this.addressForm.controls.bussiness_address_type_others.setValue(data.records.bussiness_address_type_others);
} }
@ -143,9 +187,11 @@ export class AddressComponent implements OnInit {
address_form_remark:[''], address_form_remark:[''],
address_ownership:[''], address_ownership:[''],
other_ownership:[''], other_ownership:[''],
rent_amt:[''],
bussiness_activity:[''], bussiness_activity:[''],
bussiness_address_type:[''], bussiness_address_type:[''],
bussiness_address_type_others: [''] bussiness_address_type_others: [''],
premises: this.fb.array([])
}); });
this.address = this.addressForm.controls['address']; this.address = this.addressForm.controls['address'];
this.addressType = this.addressForm.controls['address_type']; this.addressType = this.addressForm.controls['address_type'];
@ -155,6 +201,7 @@ export class AddressComponent implements OnInit {
//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.other_ownership = this.addressForm.controls['other_ownership']; this.other_ownership = this.addressForm.controls['other_ownership'];
this.rent_amt = this.addressForm.controls['rent_amt'];
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'];
} }
@ -167,6 +214,16 @@ export class AddressComponent implements OnInit {
// is_owner: ['', Validators.compose([Validators.required])], // is_owner: ['', Validators.compose([Validators.required])],
// }); // });
// } // }
createPremises(): FormGroup {
return this.fb.group({
no_of_additional_units: [''],
premises_city: [''],
premises_remarks: [''],
premises_ownership: [''],
premises_ownership_others: [''],
premises_rent_amt:[''],
});
}
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 => {
@ -188,6 +245,9 @@ export class AddressComponent implements OnInit {
else if(type==6 && val.isactive == 1){ else if(type==6 && val.isactive == 1){
this.ownerShipData.push(val); this.ownerShipData.push(val);
} }
else if(type==7 && val.isactive == 1){
this.cityData.push(val);
}
}) })
}); });
} }
@ -225,13 +285,23 @@ export class AddressComponent implements OnInit {
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.other_ownership = this.other_ownership.value; records.other_ownership = this.other_ownership.value;
records.rent_amt = this.rent_amt.value;
records.bussiness_activity = this.bussinessActivity.value; records.bussiness_activity = this.bussinessActivity.value;
if (this.bussinessActivity.value == 'yes') { if (this.bussinessActivity.value == 'yes') {
records.bussiness_address_type = this.addressForm.controls.bussiness_address_type.value;
// records.bussiness_address_type = this.addressForm.controls.bussiness_address_type.value;
records.bussiness_address_type = this.formPremisesArray;
if (records.bussiness_address_type == 12) { if (records.bussiness_address_type == 12) {
records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value; records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value;
} }
} }
records.premises = this.addressForm.controls.premises.value;
console.log(this.addressForm.controls.premises.value);
records.pdid = this.pdid; records.pdid = this.pdid;
records.formid = '5'; records.formid = '5';
// records.fk_createdby = '250'; // records.fk_createdby = '250';
@ -244,6 +314,67 @@ export class AddressComponent implements OnInit {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}); });
} }
relationChanged(event) {
this.relativeNames2 = [];
event.value.forEach(option => {
this.relativeNames2.push({city: option});
});
}
SelectedPremises($event){
let premisesData = $event.source.value;
if($event.source._selected === true ){
//this.formPremisesArray.push({member: $event.source.value});
//this.selectedSegmentDatas.push(CustomerSegmentName.name);
//console.log('true',premisesData);
//console.log(this.formPremisesArray);
this.formPremisesArray.push({premises: $event.source.value});
//console.log(this.formPremisesArray);
let array = this.addressData.filter(data => data.address_type_id == premisesData);
if(premisesData == 12){
this.PremisesOtherFlag = true;
this.PremisesLabel[this.z] = this.addressForm.get('bussiness_address_type_others').value;
}
else{
this.PremisesLabel[this.z] = array[0].address_type;
}
this.z++;
const control = <FormArray>this.addressForm.controls['premises'];
control.push(this.createPremises());
}
else if($event.source._selected === false ){
console.log('false',premisesData);
if(premisesData == 12){
this.PremisesOtherFlag = false;
}
const control = <FormArray>this.addressForm.controls['neighbourhood'];
control.removeAt(this.z);
this.z--;
//let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
//this.selectedSegmentDatas.splice(index,1);
}
}
validateAllFormFields(formGroup: FormGroup) { validateAllFormFields(formGroup: FormGroup) {
Object.keys(formGroup.controls).forEach(field => { Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field); const control = formGroup.get(field);

View File

@ -23,33 +23,62 @@
<mat-card-header> <mat-card-header>
<p>Data as Per Financial Statements<p> <p>Data as Per Financial Statements<p>
</mat-card-header> </mat-card-header>
<div formArrayName="date_per_financial"> <mat-form-field>
<input matInput placeholder="Starting Financial Year" formControlName="staring_financial_year" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Total Financial Year" formControlName="total_financial_year" required (change)="dynamicalFinYear($event)">
</mat-form-field>
<div *ngIf="total_financial_year != ''" formArrayName="date_per_financial">
<!-- <div formArrayName="date_per_financial"> -->
<div *ngFor="let details of financialForm.controls.date_per_financial['controls']; let i=index" <div *ngFor="let details of financialForm.controls.date_per_financial['controls']; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year" required> <!-- <input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year" required> -->
<input matInput placeholder="Latest Financial Year" formControlName="financial_year" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number" required> <!-- <input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number" required> -->
<input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" required> <!-- <input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" required> -->
<mat-select placeholder="Is there Net Profit or Net Loss?" formControlName="finanical_profit_or_loss" required>
<mat-option value="1" >Net Profit</mat-option>
<mat-option value="2" >Net Loss</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="details.get('finanical_profit_or_loss').value == 1 ">
<mat-form-field>
<!-- <input matInput placeholder="Net Profit to Sales %" formControlName="financial_margin" (keypress)="keyPress($event)" required> -->
<input matInput placeholder="Net Profit Amount" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit to Sales %" formControlName="financial_margin" (keypress)="keyPress($event)" required> <input matInput placeholder="Net Profit to Sales %" formControlName="financial_margin_of_profit" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
</span>
<span *ngIf="details.get('finanical_profit_or_loss').value == 2 ">
<mat-form-field>
<input matInput placeholder="Net Loss Amount" formControlName="financial_net_loss" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Net Loss to Sales %" formControlName="financial_margin_of_loss" (keypress)="keyPress($event)" required>
</mat-form-field>
</span>
<mat-form-field *ngIf="i != 0"> <mat-form-field *ngIf="i != 0">
<input matInput [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation" (keypress)="keyPress($event)"> <input matInput [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Reason For Major Difference" formControlName="financial_reason" required> <!-- <input matInput placeholder="Reason For Major Difference" formControlName="financial_reason" required> -->
<input matInput placeholder="Customer Comments on variances in Financials" formControlName="financial_reason" required>
</mat-form-field> </mat-form-field>
<button type="button" mat-raised-button mat-icon-button (click)="addDate()" <!-- <button type="button" mat-raised-button mat-icon-button (click)="addDate()"
matTooltip="Add More Financial Statements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0"> matTooltip="Add More Financial Statements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
</button> </button> -->
<button type="button" mat-raised-button mat-icon-button (click)="deleteDate(i)" <button type="button" mat-raised-button mat-icon-button (click)="deleteDate(i)"
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0"> matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
@ -72,7 +101,8 @@
[formGroupName]="i"> [formGroupName]="i">
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year" required> <!-- <input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year" required> -->
<input matInput placeholder="Year (format: 2015-2016)" formControlName="estimate_year" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" type="number" required> <input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" type="number" required>

View File

@ -35,12 +35,14 @@ export class FinancialInfoComponent implements OnInit {
public financialForm: FormGroup; public financialForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
marginVal: any = [] ; marginVal: any = [] ;
placeholderName : any = [];
setmargin: AbstractControl; setmargin: AbstractControl;
constructor(notifier: NotifierService, constructor(notifier: NotifierService,
private fb: FormBuilder, private fb: FormBuilder,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private _pd: PdTrigerService, private _pd: PdTrigerService,
private dialogRef: MatDialogRef<FinancialInfoComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 14; this.form_id = 14;
@ -65,11 +67,13 @@ export class FinancialInfoComponent implements OnInit {
}); });
if (result.length > 0) { if (result.length > 0) {
result.forEach(val => { result.forEach(val => {
financial_date.push(this.createDate()); //financial_date.push(this.createDate());
financial_date.push(this.createDate(''));
}); });
retriveData.date_per_financial = result; retriveData.date_per_financial = result;
} else { } else {
financial_date.push(this.createDate()); //financial_date.push(this.createDate());
financial_date.push(this.createDate(''));
} }
if (result_val.length > 0) { if (result_val.length > 0) {
result_val.forEach(val => { result_val.forEach(val => {
@ -84,7 +88,7 @@ export class FinancialInfoComponent implements OnInit {
retriveData.fk_createdby = this.pdid; retriveData.fk_createdby = this.pdid;
this.financialForm.setValue(retriveData); this.financialForm.setValue(retriveData);
} else { } else {
financial_date.push(this.createDate()); //financial_date.push(this.createDate());
estimated_val.push(this.createValue()); estimated_val.push(this.createValue());
} }
}) })
@ -95,16 +99,31 @@ export class FinancialInfoComponent implements OnInit {
formid: this.form_id, formid: this.form_id,
fk_createdby: this.pdid, fk_createdby: this.pdid,
financial_remarks: ['', Validators.compose([Validators.required])], financial_remarks: ['', Validators.compose([Validators.required])],
staring_financial_year : ['', Validators.compose([Validators.required])],
total_financial_year : ['', Validators.compose([Validators.required])],
date_per_financial: this.fb.array([]), date_per_financial: this.fb.array([]),
estimated_value: this.fb.array([]) estimated_value: this.fb.array([])
}); });
} }
createDate() { // createDate() {
// return this.fb.group({
// financial_year: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
// financial_annual_sale: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9\(\)]+$/)])],
// financial_net_profit: ['', Validators.compose([Validators.required, Validators.pattern(/^-?[1-9]\d*|0$/)])],
// financial_margin: ['', Validators.compose([Validators.required])],
// financial_variation: [''],
// financial_reason: ['', Validators.compose([Validators.required])],
// });
// }
createDate(date) {
return this.fb.group({ return this.fb.group({
financial_year: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])], financial_year: [date, Validators.compose([Validators.required, Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
financial_annual_sale: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9\(\)]+$/)])], financial_annual_sale: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9\(\)]+$/)])],
financial_net_profit: ['', Validators.compose([Validators.required, Validators.pattern(/^-?[1-9]\d*|0$/)])], finanical_profit_or_loss:['', Validators.compose([Validators.required])],
financial_margin: ['', Validators.compose([Validators.required])], financial_net_profit: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
financial_net_loss: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
financial_margin_of_profit: [''],
financial_margin_of_loss: [''],
financial_variation: [''], financial_variation: [''],
financial_reason: ['', Validators.compose([Validators.required])], financial_reason: ['', Validators.compose([Validators.required])],
}); });
@ -121,7 +140,7 @@ export class FinancialInfoComponent implements OnInit {
} }
addDate() { addDate() {
const control = <FormArray>this.financialForm.controls['date_per_financial']; const control = <FormArray>this.financialForm.controls['date_per_financial'];
control.push(this.createDate()); //control.push(this.createDate());
} }
deleteDate(index) { deleteDate(index) {
const control = <FormArray>this.financialForm.controls['date_per_financial']; const control = <FormArray>this.financialForm.controls['date_per_financial'];
@ -135,26 +154,116 @@ export class FinancialInfoComponent implements OnInit {
const control = <FormArray>this.financialForm.controls['estimated_value']; const control = <FormArray>this.financialForm.controls['estimated_value'];
control.removeAt(index); control.removeAt(index);
} }
calYearVariation(index, detail) { dynamicalFinYear($event){
let profit = detail.value.financial_net_profit;
if ( profit != '' && index != 0) { //console.log(this.financialForm.controls['total_financial_year'].value);
console.log('value') //console.log('data',$event.target.value);
let array = <FormArray>this.financialForm.controls['date_per_financial'] let e = $event.target.value;
let prev_profit = array.value[index - 1].financial_net_profit; let startingYear = this.financialForm.controls['staring_financial_year'].value;
let variation = ((profit - prev_profit)/ prev_profit) * 100;
detail.controls.financial_variation.setValue(variation.toFixed(2)) const control = <FormArray>this.financialForm.controls['date_per_financial'];
// detail.controls.financial_variation.disable()
while (control.length !== 0) {
control.removeAt(0);
}
if(e > 0 ){
for(let i = 1 ; i<= e ; i++ ){
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
control.push(this.createDate(Year));
//console.log(this.financialForm.controls['staring_financial_year'].value);
}
} }
} }
// calYearVariation(index, detail) {
// let profit = detail.value.financial_net_profit;
// if ( profit != '' && index != 0) {
// console.log('value')
// let array = <FormArray>this.financialForm.controls['date_per_financial']
// let prev_profit = array.value[index - 1].financial_net_profit;
// let variation = ((profit - prev_profit)/ prev_profit) * 100;
// detail.controls.financial_variation.setValue(variation.toFixed(2))
// // detail.controls.financial_variation.disable()
// }
// }
calYearVariation(index, detail) {
let profit = detail.value.financial_net_profit;
let loss = detail.value.financial_net_loss;
if ( profit != '' || loss != '' && index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial']
let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0;
let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100;
detail.controls.financial_variation.setValue(variation.toFixed(2));
}
// if(detail.value.finanical_profit_or_loss == 1){
// let profit = detail.value.financial_net_profit;
// if ( profit != '' && index != 0) {
// let array = <FormArray>this.financialForm.controls['date_per_financial']
// let prev_profit = array.value[index - 1].financial_net_profit;
// let variation = ((profit - prev_profit)/ prev_profit) * 100;
// detail.controls.financial_variation.setValue(variation.toFixed(2))
// }
// }else if (detail.value.finanical_profit_or_loss == 2){
// let loss = detail.value.financial_net_loss;
// if ( loss != '' && index != 0) {
// let array = <FormArray>this.financialForm.controls['date_per_financial']
// let prev_loss = array.value[index - 1].financial_net_loss;
// let variation = ((loss - prev_loss)/ prev_loss) * 100;
// detail.controls.financial_variation.setValue(variation.toFixed(2))
// }
// }
}
// calMargin(index, detail) {
// console.log('detail', detail);
// let salary = detail.value.financial_annual_sale;
// let profit = detail.value.financial_net_profit;
// if (salary != '' && profit != '') {
// let margin = (profit / salary) * 100;
// detail.controls.financial_margin.setValue(margin.toFixed(2))
// // detail.controls.financial_margin.disable()
// }
// }
calMargin(index, detail) { calMargin(index, detail) {
console.log('detail', detail); console.log('detail', detail);
let salary = detail.value.financial_annual_sale; let salary = detail.value.financial_annual_sale;
let profit = detail.value.financial_net_profit;
if (salary != '' && profit != '') { if(detail.value.finanical_profit_or_loss == 1){
let margin = (profit / salary) * 100;
detail.controls.financial_margin.setValue(margin.toFixed(2)) let profit = detail.value.financial_net_profit;
// detail.controls.financial_margin.disable()
} if (salary != '' && profit != '') {
let margin = (profit / salary) * 100;
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2))
// detail.controls.financial_margin.disable()
}
}
else if (detail.value.finanical_profit_or_loss == 2){
let loss = detail.value.financial_net_loss;
if (salary != '' && loss != '') {
let margin = (loss / salary) * 100;
detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2))
// detail.controls.financial_margin.disable()
}
}
} }
calVariation(index, detail) { calVariation(index, detail) {
let profit = detail.value.estimate_net_profit; let profit = detail.value.estimate_net_profit;
@ -176,6 +285,35 @@ export class FinancialInfoComponent implements OnInit {
} }
} }
submitDetails() { submitDetails() {
console.log(this.financialForm.value.date_per_financial['financial_variation']);
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]);
this.financialForm.value.date_per_financial['financial_net_profit'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_net_loss'].clearValidators();
this.financialForm.value.date_per_financial['financial_net_loss'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_margin_of_profit'].setValidators([Validators.required]);
this.financialForm.value.date_per_financial['financial_margin_of_profit'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_margin_of_loss'].clearValidators();
this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity();
}else if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 2) {
this.financialForm.value.date_per_financial['financial_net_profit'].clearValidators();
this.financialForm.value.date_per_financial['financial_net_profit'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_net_loss'].setValidators([Validators.required]);
this.financialForm.value.date_per_financial['financial_net_loss'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_margin_of_profit'].clearValidators();
this.financialForm.value.date_per_financial['financial_margin_of_profit'].updateValueAndValidity();
this.financialForm.value.date_per_financial['financial_margin_of_loss'].setValidators([Validators.required]);
this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity();
}
if (!this.financialForm.valid) { if (!this.financialForm.valid) {
return; return;
} }
@ -184,6 +322,7 @@ export class FinancialInfoComponent implements OnInit {
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {
console.log('data', data); console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.'); this.notifier.notify('success', 'Saved Successfully.');
//this.dialogRef.close();
}, error => { }, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}) })

View File

@ -54,7 +54,7 @@
</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"
formControlName="is_topup" required> formControlName="is_topup" 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>
@ -73,12 +73,13 @@
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)"> <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-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 *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)"> <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-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 *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
<mat-select placeholder="Source" formControlName="source" required> <mat-select placeholder="Source" formControlName="source" required>
<mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option> <mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option>
</mat-select> </mat-select>
@ -97,17 +98,14 @@
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required> <input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required>
</mat-form-field> </mat-form-field>
<!-- <div *ngIf="productAbbr === 'HL' || productAbbr === 'LL' || productAbbr === 'LAP' "> --> <!-- <div *ngIf="productAbbr === 'HL' || productAbbr === 'LL' || productAbbr === 'LAP' "> -->
<mat-card> <mat-card *ngIf="mortageCardAccess">
<mat-card-header *ngIf="loanDetailsForm.controls['source'].value =='other'" > <mat-card-header><p>Mortgage</p></mat-card-header>
<p>Mortgage
<p>
<!-- {{m_mortageTypeProperty | json}} -->
</mat-card-header>
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Type of Property" formControlName="property_type" required> <mat-select placeholder="Type of Property" formControlName="property_type" (selectionChange)="mortage_type($event.value)" required>
<mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.mortage_property_id">{{ typeprop.property_name }}</mat-option> <mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.mortage_property_id">{{ typeprop.property_name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field>
<!--<mat-select placeholder="Type of property" formControlName="property_type"> <!--<mat-select placeholder="Type of property" formControlName="property_type">
<mat-option value="bungalow">Bungalow</mat-option> <mat-option value="bungalow">Bungalow</mat-option>
@ -125,25 +123,27 @@
<mat-option value="vacant_land">Vacant Land</mat-option> <mat-option value="vacant_land">Vacant Land</mat-option>
<mat-option value="others">Others</mat-option> <mat-option value="others">Others</mat-option>
</mat-select>--> </mat-select>-->
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['property_type'].value == 'others'"> <mat-form-field *ngIf="mortageAccess">
<input matInput placeholder="Specify Type of Property" formControlName="ownershipOther"> <input matInput placeholder="Specify Type of Property" formControlName="property_type_others">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<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-option value="Others">Others (Please Specify)</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="OtherOwnerFlag">
<input matInput placeholder="Specify Other Owner Name" formControlName="other_owners_name">
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Status of Construction" formControlName="construction_status" required>
<mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }} {{status.id}}</mat-option>
<mat-select placeholder="Status of Construction" formControlName="construction_status" required> </mat-select>
<mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }} {{status.id}}</mat-option> </mat-form-field>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['construction_status'].value == 4"> <mat-form-field *ngIf="loanDetailsForm.controls['construction_status'].value == 4">
<input matInput placeholder="What is the approximate stage of construction (%)?" <input matInput placeholder="What is the approximate stage of construction (%)?"
@ -166,10 +166,6 @@
formControlName="value_per_agreement" (keypress)="keyPress($event)" required (keyup)="inWords($event,3)"> formControlName="value_per_agreement" (keypress)="keyPress($event)" required (keyup)="inWords($event,3)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{valAsPerAgmtInWords}} Only</mat-hint> <mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{valAsPerAgmtInWords}} Only</mat-hint>
</mat-form-field> --> </mat-form-field> -->
<mat-form-field>
<input matInput placeholder="Estimate Market Value as Per Customer"
formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
</mat-form-field>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</mat-card> </mat-card>

View File

@ -31,15 +31,20 @@ import {ActivatedRoute, Router} from '@angular/router';
export class LoanDetailsComponent implements OnInit { export class LoanDetailsComponent implements OnInit {
public loanDetailsForm: FormGroup; public loanDetailsForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
pdid: number; pdid: number;
form_id: number; form_id: number;
exist_loan_amt: any; exist_loan_amt: any;
applicants: any; applicants: any;
productAbbr: any; productAbbr: any;
subProductName: any;
isOtherPurpose: boolean = false; isOtherPurpose: boolean = false;
isSource: boolean = false; isSource: boolean = false;
mortageCheck : boolean = true; mortageCheck : boolean = true;
OtherOwnerFlag : boolean;
endUserList: any = []; endUserList: any = [];
ownerNames: any = []; ownerNames: any = [];
m_endUseofLoad = []; m_endUseofLoad = [];
@ -55,6 +60,10 @@ export class LoanDetailsComponent implements OnInit {
topUpAmtInWords: any; topUpAmtInWords: any;
pageTitle: string ="Loan Details"; pageTitle: string ="Loan Details";
mortageCardAccess: boolean;
mortageAccess: boolean = false;
propertyType : any;
constructor(notifier: NotifierService, constructor(notifier: NotifierService,
private fb: FormBuilder, private fb: FormBuilder,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -63,6 +72,7 @@ export class LoanDetailsComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.applicants = this.pd_all_details.pdapplicants_detials; this.applicants = this.pd_all_details.pdapplicants_detials;
this.productAbbr = this.pd_all_details.pdmaster_details.product_abbr; this.productAbbr = this.pd_all_details.pdmaster_details.product_abbr;
this.subProductName = this.pd_all_details.pdmaster_details.subproduct_name;
this.exist_loan_amt = this.pd_all_details.pdmaster_details.loan_amount != '' ? this.pd_all_details.pdmaster_details.loan_amount :''; this.exist_loan_amt = this.pd_all_details.pdmaster_details.loan_amount != '' ? this.pd_all_details.pdmaster_details.loan_amount :'';
this.loanAmtInWords = this._pd.convertNumberToWords(this.exist_loan_amt); this.loanAmtInWords = this._pd.convertNumberToWords(this.exist_loan_amt);
this.form_id = 10; this.form_id = 10;
@ -99,9 +109,15 @@ export class LoanDetailsComponent implements OnInit {
let ownername: any = []; let ownername: any = [];
owner.forEach(val => { owner.forEach(val => {
ownername.push(val.owner_name); ownername.push(val.owner_name);
if(val.owner_name == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
}); });
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); } if(value.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); }
@ -126,18 +142,28 @@ export class LoanDetailsComponent implements OnInit {
if (value.records.other_bt_lender) { if (value.records.other_bt_lender) {
this.loanDetailsForm.controls['other_bt_lender'].setValue(value.records.other_bt_lender); this.loanDetailsForm.controls['other_bt_lender'].setValue(value.records.other_bt_lender);
} }
if(value.records.is_transfer != 'yes'){
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); } 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);
} }
this.loanDetailsForm.controls['emi_level'].setValue(value.records.emi_level); this.loanDetailsForm.controls['emi_level'].setValue(value.records.emi_level);
this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type); this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type);
this.propertyType = value.records.property_type;
//console.log(value.records.property_type);
this.mortage_type(value.records.property_type);
//console.log(this.propertyType);
this.loanDetailsForm.controls['property_type_others'].setValue(value.records.property_type_others);
this.loanDetailsForm.controls['owner_name'].setValue(ownername); this.loanDetailsForm.controls['owner_name'].setValue(ownername);
this.loanDetailsForm.controls['other_owners_name'].setValue(value.records.other_owners_name);
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 ){ if(value.records.construction_status == 4 ){
this.loanDetailsForm.controls['percentage_of_construction'].setValue(value.records.percentage_of_construction); this.loanDetailsForm.controls['percentage_of_construction'].setValue(value.records.percentage_of_construction);
} }
@ -150,6 +176,12 @@ export class LoanDetailsComponent implements OnInit {
this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks); this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks);
} }
}) })
if(this.productAbbr == 'BL' || this.productAbbr == 'PL' || this.productAbbr == 'LL'){
this.mortageCardAccess = false;
}else{
this.mortageCardAccess = true;
}
} }
// ============= // =============
@ -182,9 +214,42 @@ getM_sourceofamount() {
// this._pd.getAllMasterDatas('MORTAGEPROPERTYTYPE').subscribe( // this._pd.getAllMasterDatas('MORTAGEPROPERTYTYPE').subscribe(
this._pd.getAllMasterDatas('MORTAGEPROPERTIES').subscribe( this._pd.getAllMasterDatas('MORTAGEPROPERTIES').subscribe(
data => { data => {
// console.log('sadfdfads',this.productAbbr);
this.m_mortageTypeProperty = data.records.filter(data => data.isactive == 1); // this.m_mortageTypeProperty = data.records.filter(data => data.isactive == 1);
this.m_mortageTypeProperty = data.records.filter(data => data.group_name == this.productAbbr); // this.m_mortageTypeProperty = data.records.filter(data => data.group_name == this.productAbbr);
if(data.dataStatus==true){
let that = this;
this.m_mortageTypeProperty = data.records.filter(
function(data){
if(that.productAbbr != "LAP"){
if(data.group_name == that.productAbbr && data.isactive==1){
console.log('if data');
return data;
}
}
else if(that.productAbbr == "LAP"){
if(data.sub_group_name == that.subProductName && data.isactive==1){
console.log('else data');
return data;
}
}
// if(data.isactive==1 && data.group_name != "LAP"){
// if(data.group_name == that.productAbbr){
// return data;}
// }else if(data.group_name == "LAP" && data.sub_group_name == that.subProductName){
// return data;
// }else{
// return ;
// }
});
// console.log(this.m_mortageTypeProperty);
// console.log(this.propertyType);
// this.mortage_type(this.propertyType);
// if(this.propertyType != ''){
// this.mortage_type(this.propertyType);
// }
}
}, },
error => { error => {
// this.notifier.notify('warning', 'No Category Records Found.!'); // this.notifier.notify('warning', 'No Category Records Found.!');
@ -227,12 +292,14 @@ getM_sourceofamount() {
topup_amount: [''], topup_amount: [''],
lender: [''], lender: [''],
other_bt_lender : [''], other_bt_lender : [''],
own_contribution: ['', Validators.compose([Validators.required])], own_contribution: [''],
source: ['', Validators.compose([Validators.required])], source: [''],
lender_name_type: [''], lender_name_type: [''],
emi_level: ['', Validators.compose([Validators.required])], emi_level: ['', Validators.compose([Validators.required])],
property_type: ['', Validators.compose([Validators.required])], property_type: ['', Validators.compose([Validators.required])],
property_type_others:[''],
owner_name: ['', Validators.compose([Validators.required])], owner_name: ['', Validators.compose([Validators.required])],
other_owners_name :[''],
construction_status: ['', Validators.compose([Validators.required])], construction_status: ['', Validators.compose([Validators.required])],
percentage_of_construction : [''], percentage_of_construction : [''],
emv_per_customer: ['', Validators.compose([Validators.required])], emv_per_customer: ['', Validators.compose([Validators.required])],
@ -250,6 +317,18 @@ getM_sourceofamount() {
}); });
} }
ownerNameChange(event) { ownerNameChange(event) {
let EventValue;
event.value.forEach(option => {
EventValue = option;
if(EventValue == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
});
// this.ownerNames = []; // this.ownerNames = [];
// event.value.forEach(option => { // event.value.forEach(option => {
// this.ownerNames.push({owner_name: option}); // this.ownerNames.push({owner_name: option});
@ -282,6 +361,13 @@ getM_sourceofamount() {
if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') { if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value; records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value;
} }
else if(this.loanDetailsForm.controls['is_transfer'].value == 'no') {
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
records.source = this.loanDetailsForm.controls['source'].value;
if (this.loanDetailsForm.controls['source'].value == 'other') {
records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value;
}
}
if (this.loanDetailsForm.controls['is_topup'].value == 'yes') { if (this.loanDetailsForm.controls['is_topup'].value == 'yes') {
records.topup_amount = this.loanDetailsForm.controls['topup_amount'].value; records.topup_amount = this.loanDetailsForm.controls['topup_amount'].value;
} }
@ -292,13 +378,9 @@ getM_sourceofamount() {
records.other_bt_lender = this.loanDetailsForm.controls['other_bt_lender'].value; records.other_bt_lender = this.loanDetailsForm.controls['other_bt_lender'].value;
} }
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
records.source = this.loanDetailsForm.controls['source'].value;
if (this.loanDetailsForm.controls['source'].value == 'other') {
records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value;
}
records.emi_level = this.loanDetailsForm.controls['emi_level'].value; records.emi_level = this.loanDetailsForm.controls['emi_level'].value;
records.property_type = this.loanDetailsForm.controls['property_type'].value; records.property_type = this.loanDetailsForm.controls['property_type'].value;
records.property_type_others = this.loanDetailsForm.controls['property_type_others'].value;
// records.owner_name_group = this.ownerNames; // records.owner_name_group = this.ownerNames;
// console.log(this.loanDetailsForm.controls['owner_name'].value); // console.log(this.loanDetailsForm.controls['owner_name'].value);
let dataOwner_name = []; let dataOwner_name = [];
@ -306,6 +388,7 @@ getM_sourceofamount() {
dataOwner_name.push({owner_name: element}) dataOwner_name.push({owner_name: element})
}); });
records.owner_name_group = dataOwner_name; records.owner_name_group = dataOwner_name;
records.other_owners_name = this.loanDetailsForm.controls['other_owners_name'].value;
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.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;
@ -337,10 +420,21 @@ getM_sourceofamount() {
this.loanDetailsForm.controls['is_topup'].clearValidators(); this.loanDetailsForm.controls['is_topup'].clearValidators();
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity(); this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('no',event.value); // console.log('no',event.value);
this.loanDetailsForm.controls['source'].setValidators([Validators.required]);
this.loanDetailsForm.controls['source'].updateValueAndValidity();
this.loanDetailsForm.controls['own_contribution'].setValidators([Validators.required]);
this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
} }
else if(event.value == 'yes'){ else if(event.value == 'yes'){
this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]); this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity(); this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
this.loanDetailsForm.controls['source'].clearValidators();
this.loanDetailsForm.controls['source'].updateValueAndValidity();
this.loanDetailsForm.controls['own_contribution'].clearValidators();
this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
// console.log('yes',event.value); // console.log('yes',event.value);
} }
@ -379,4 +473,22 @@ getM_sourceofamount() {
} }
} }
/**
* mortage_type
*/
mortage_type(mortage_value)
{
//console.log(mortage_value);
//let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0];
let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id == mortage_value)[0];
// console.log(mortagetypes);
if(mortagetypes.property_name=='Others (Please Specify)'){
this.mortageAccess = true;
}else{
this.mortageAccess = false;
}
}
} }

View File

@ -70,7 +70,7 @@ import { LenderRepresentativeComponent } from './list-pd/start-pd/forms/lender-r
import { AssessedIncomeComponent } from './list-pd/start-pd/forms/assessed-income/assessed-income.component'; import { AssessedIncomeComponent } from './list-pd/start-pd/forms/assessed-income/assessed-income.component';
import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component'; import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component';
import { PdReportComponent } from './list-pd/pd-report/pd-report.component'; import { PdReportComponent, DialogChangeCurrentVenrsion } from './list-pd/pd-report/pd-report.component';
import {RentalInfoComponent} from "./list-pd/start-pd/forms/rental-info/rental-info.component"; import {RentalInfoComponent} from "./list-pd/start-pd/forms/rental-info/rental-info.component";
import { AllocationViewMoreComponent } from './list-pd/allocation-view-more/allocation-view-more.component'; import { AllocationViewMoreComponent } from './list-pd/allocation-view-more/allocation-view-more.component';
@ -257,7 +257,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
// OwlNativeDateTimeModule, // OwlNativeDateTimeModule,
// ], // ],
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent], declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion],
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
// providers: [PdTrigerService, GetGeometricLocationService], // providers: [PdTrigerService, GetGeometricLocationService],
@ -295,7 +295,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
providers: [PdTrigerService, GetGeometricLocationService], providers: [PdTrigerService, GetGeometricLocationService],
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent, entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent], ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion],
}) })
export class ManagePdModule { export class ManagePdModule {

View File

@ -289,14 +289,15 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
) )
} }
getPDReportFinalDocument(pdId: number){ getPDReportFinalDocument(pdId: any){
return this._http.post<any>(this.apiUrl+"generatePDReport ",{"records":{"pd_id":pdId}}) pdId.fk_createdby = this._aws.getlocale();
return this._http.post<any>(this.apiUrl+"generatePDReport",{"records": pdId})
.pipe( .pipe(
catchError(this.handleError('operation', [])) catchError(this.handleError('operation', []))
) )
} }
getActualPDReportModelTemplate(pdId: number) { getActualPDReportModelTemplate(pdId: any) {
return this._http.post<any>(this.apiUrl+"getLatestPDReportBlob ",{"records":{"pd_id":pdId}}) return this._http.post<any>(this.apiUrl+"getLatestPDReportBlob ",{"records":{"pd_id":pdId}})
.pipe( .pipe(
catchError(this.handleError('operation', [])) catchError(this.handleError('operation', []))
@ -310,6 +311,24 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
) )
} }
getPdDocVersionList(pdId: number){
return this._http.post<any>(this.apiUrl+"getListOfPDReportVersions",{"records":{"pd_id":pdId}})
.pipe(
catchError(this.handleError('operation', []))
)
}
swapOlderPDReportToLatest(pdId: any){
pdId.fk_createdby = this._aws.getlocale();
alert(JSON.stringify(pdId));
return this._http.post<any>(this.apiUrl+"swapOlderPDReportToLatest",{"records": pdId})
.pipe(
catchError(this.handleError('operation', []))
)
}
// inWords(num) { // 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 a : any = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];

View File

@ -3,7 +3,7 @@
<mat-card style="width: 580px; min-height: 120px; padding: 6px;"> <mat-card style="width: 580px; min-height: 120px; padding: 6px;">
<mat-form-field> <mat-form-field>
<mat-select placeholder="Forms List *" (selectionChange)="selectedFormTypes($event)"> <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-option *ngFor="let forms of m_question_forms" [value]="forms.pd_form_id">{{ forms.pd_form_name }}</mat-option>
</mat-select> </mat-select>
<!--<mat-error *ngIf="submitted && answ['controls'].fk_lender_id.hasError('required')" class="mat-text-warn">Lender Type Required.!</mat-error>--> <!--<mat-error *ngIf="submitted && answ['controls'].fk_lender_id.hasError('required')" class="mat-text-warn">Lender Type Required.!</mat-error>-->
</mat-form-field> </mat-form-field>