From 13d661cff1a71082cc480a851083cb890779afee Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 27 Feb 2019 10:40:52 +0530 Subject: [PATCH] rental verification changes --- .../rental-info/rental-info.component.html | 50 ++- .../rental-info/rental-info.component.scss | 100 +----- .../rental-info/rental-info.component.ts | 214 ++++--------- .../rental-verification.component.html | 212 +++++++++++++ .../rental-verification.component.scss | 13 + .../rental-verification.component.spec.ts | 25 ++ .../rental-verification.component.ts | 294 ++++++++++++++++++ .../list-pd/start-pd/start-pd.component.ts | 5 +- .../manage-pd/manage-pd.module.ts | 7 +- 9 files changed, 658 insertions(+), 262 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html index 80d23bbfc..1477843fd 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html @@ -1,10 +1,10 @@ -
+

-
+
@@ -18,6 +18,48 @@
+
+ + + +
+ + Name of the Person who is showing the Property to Sineedge Officer + + + + {{val.name}} + + + + + +
+
+
+ +
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.scss index 61e420e61..2c0b25f1d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.scss @@ -1,31 +1,4 @@ -// .address { -// display: flex; -// padding: 0 2%; -// flex-direction: column; -// } - -// .address > * { -// width: 100%; -// } -// .matcard mat-form-field { -// margin: 0 2%; -// width:40%; -// } -// .address .button { -// float: right; -// width: 10px; -// background: #62B013; -// color: white; -// } -// mat-form-field { -// width: 27%; -// margin: 0 2%; -// } -// .fields mat-form-field { -// width: 45%; -// margin: 0 2%; -// } - ::ng-deep .cdk-global-overlay-wrapper{ +::ng-deep .cdk-global-overlay-wrapper{ justify-content: center !important; } .paragraph_change { @@ -42,74 +15,5 @@ mat-form-field { margin: 0 2%; } - $base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important; -$product-bg-color-hover: rgba(103, 58, 183, 0.7); -.p-list-main { - background: white; - margin: auto; - position: relative; - overflow: hidden !important; - border-radius: 10px 10px 10px 10px; - box-shadow: $base-card-box-shadow; - transform: scale(0.95); - transition: box-shadow 0.5s, transform 0.5s; - &:hover { - transform: scale(1); - box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2); - } - .p-list { - position: relative; - .top { - height: 100%; - width: 100%; - // background: url(https://s-media-cache-ak0.pinimg.com/736x/49/80/6f/49806f3f1c7483093855ebca1b8ae2c4.jpg) no-repeat center center; - -webkit-background-size: 100%; - -moz-background-size: 100%; - -o-background-size: 100%; - background-size: 100%; - } - .bottom { - width: 200%; - height: 15%; - transition: transform 0.5s; - h1 { - margin: 0; - padding: 0; - } - p { - margin: 0; - padding: 0; - } - .left { - height: 100%; - width: 50%; - background: #f4f4f4; - position: relative; - float: left; - .details { - padding: 5px; - float: left; - // width: calc(70% - 40px); - } - - } - .right { - width: 50%; - background: #A6CDDE; - color: white; - float: right; - height: 200%; - overflow: hidden; - .details { - padding: 20px; - float: right; - width: calc(70% - 40px); - } - - - } - } - } - -} + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.ts index 1e8866ba7..ce316acfe 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.ts @@ -3,8 +3,6 @@ import {FormBuilder, FormGroup, Validators, FormControl, FormArray} from '@angul import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; import {NotifierService} from 'angular-notifier'; import {PdTrigerService} from './../../../../../pd-service/pd-triger.service'; -import {AwsService} from '../../../../../../AwsService/aws.service'; -import {Key} from 'protractor'; @Component({ selector: 'app-rental-info', @@ -12,38 +10,47 @@ import {Key} from 'protractor'; styleUrls: ['./rental-info.component.scss'] }) export class RentalInfoComponent implements OnInit { - customer_segment_abbr: any; - subproduct_abbr: any; - lender_applicant_id: any; - main_applicant: any; - - // @Input() pdid: string; - // @Input() pd_all_details: any; - // form_id: number; pageTitle: string ="Rental Information"; pdid: number; form_id: number; - step: number; - public rentalForm: FormGroup; - tenantsList: FormArray; - propertyList: FormGroup; private notifier: NotifierService; - + existCompanyList: any =[]; + mergeCompanyApplicant: any=[]; + //personType: any=[{id:2,name:"Tenant / Lessee"},{id:3,name:"Owner of the Rented Property"},{id:4,name:"Property Caretaker"},{id:1,name:"Others (Please Specify)"}]; constructor( notifier: NotifierService, private _fb: FormBuilder, private _pd: PdTrigerService, - private _aws:AwsService, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.notifier = notifier; this.form_id = 17; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + // get applicant list + // this.pd_all_details.pdapplicants_detials.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); + // let modifyApplicantList: any=[]; + // if(this.pd_all_details.pdapplicants_detials.length > 0){ + // modifyApplicantList = this.pd_all_details.pdapplicants_detials.map(element => { + // return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; + // }); + // this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) + + // } + // this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ + // if(data.dataStatus){ + // this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true); + // } + + // let modifyCompanyList : any=[]; + // if(this.existCompanyList.length>0){ + // modifyCompanyList = this.existCompanyList.map(element => { + // return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; + // }); + // this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) + // } + + // }); } public viewerOptions: any = { navbar: false, @@ -65,147 +72,44 @@ export class RentalInfoComponent implements OnInit { } }; ngOnInit() { - this.step = 0; this.inintRentalForm(); - this.createpropertyArray(); - let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = this.form_id; - this._pd.retriveForm(params).subscribe(value => { - let subArray: any; - const control = this.rentalForm.controls['rental_home']; - if (value.status == 200) { - let rentalinfo = value.records; - var result = Object.keys(value.records.rental_home).map(function (key) { - return value.records.rental_home[key]; - }); - if (result.length == 0) { - const control = this.rentalForm.controls['rental_home']; - control.push(this.createpropertyArray()); - } else { - result.forEach((datas, index) => { - control.push(this.createpropertyArray()); - const parentControl = this.rentalForm.controls['rental_home']['controls'][index]; - const sub = parentControl.controls['details_tenants']; - // console.log('control', parentControl); - subArray = Object.keys(datas.details_tenants).map(function (key) { - return datas.details_tenants[key]; - }); - if (subArray.length > 0) { - subArray.forEach((val) => { - // console.log('val', val); - sub.push(this.createTenatsArray()); - }) - sub.removeAt(0); - } - datas.details_tenants = subArray; - }); - } - rentalinfo.rental_home = result; - rentalinfo.pdid = this.pdid; - rentalinfo.formid = this.form_id; - rentalinfo.fk_createdby = this._aws.getlocale(); - this.rentalForm.setValue(rentalinfo); - } else { - control.push(this.createpropertyArray()); - } - }); - } + // observe person met controls + // this.rentalForm.controls['person_met'].valueChanges.subscribe(val => { + // if(val && val.length>0){ + // let otherPersonMetCheck = val.filter(fVal=>fVal.id==0); + // otherPersonMetCheck.length>0 ? this.rentalForm.addControl('other_person_met', new FormControl('', Validators.required)) : this.rentalForm.removeControl('other_person_met'); + // otherPersonMetCheck.length>0 ? this.rentalForm.addControl('other_name_person_showing_property', new FormControl('', Validators.required)) : this.rentalForm.removeControl('other_name_person_showing_property'); + // } + // else { + // this.rentalForm.removeControl('other_person_met'); + // this.rentalForm.removeControl('other_name_person_showing_property'); + // this.rentalForm.removeControl('other_name_person_type'); + // } + // }); + // observe other person type + // this.rentalForm.controls['other_name_person_showing_property'].valueChanges.subscribe(val => { + // if(val && val.length>0){ + // let otherCheck = val.filter(fVal=>fVal.id==0); + // otherCheck.length>0 ? this.rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)) : this.rentalForm.removeControl('other_name_person_type'); + // } + // else { + // this.rentalForm.removeControl('other_name_person_type'); + // } + // }); + } + inintRentalForm() { - this.rentalForm = this._fb.group({ + return this.rentalForm = this._fb.group({ pdid: this.pdid, formid: this.form_id, - fk_createdby: this.pdid, person_met: [''], - property_own: [''], - nature_property: [''], - rental_home: this._fb.array([]) }); } - - createpropertyArray() { - this.propertyList = this._fb.group({ - complete_add: [''], - area_of_property: [''], - structure_property: [''], - total_room: [''], - is_rent: [''], - date_agreement: [''], - date_validity: [''], - rent_agreement: [''], - actual_rent: [''], - photo_areegment: [''], - bank: [''], - cash: [''], - rent_each_floor: [''], - total_rent: [''], - related_doc_owner: [''], - property_photographs: [''], - third_party_check: [''], - details_tenants: this._fb.array([this.createTenatsArray()]), - }); - return this.propertyList; - } - - createTenatsArray() { - return this._fb.group({ - name: [''], - mobile_no: [''], - tenants_seen: [''], - tenants_con_owner: [''], - staying_since: [''], - rent_paid: [''], - }); - } - - addProperty(event) { - event.stopPropagation(); - - const control = this.rentalForm.controls['rental_home']; - control.push(this.createpropertyArray()); - let length = control.length; - this.step = length - 1; - } - - deleteProperty(index) { - const control = this.rentalForm.controls['rental_home']; - control.removeAt(index); - } - - addTenant(parentIndex:number) { - const parentControl = this.rentalForm.controls['rental_home']['controls'][parentIndex]; - const control = parentControl.controls['details_tenants']; - // console.log(parentControl); - // console.log(control); - control.push(this.createTenatsArray()); - } - - deleteTenant(idx, parentIndex) { - const parentControl = this.rentalForm.controls['rental_home']['controls'][parentIndex]; - const control = parentControl.controls['details_tenants']; - control.removeAt(idx); - } - - rentalSubmit() { - if (!this.rentalForm.valid) { - this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); - return; - } - // console.log('form', this.rentalForm.value); - let records = this.rentalForm.value; - this._pd.saveForm(records).subscribe(data => { - if (data.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ - this.dialogRef.close(); - },3000); - } - else{ - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - } - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }) - } + // compare objects for merge two master table details + compareObjects(o1: any, o2: any) { + if(o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html new file mode 100644 index 000000000..e8e80f279 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html @@ -0,0 +1,212 @@ + +

+ +
+
+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +
+ +
+ +
+
+ +
+

+ + + + +
+ + + Name of the Person who is showing the Property to Sineedge Officer + + + + {{val.name}} + + + + + + Specify Other Person + + + + Who is {{_rentalForm.controls['other_person_met'].value}} + + + {{pType.name}} + + + + + + + Specify Other + + + + + + + Name of the Owner/Owners of the Let out Property as per Loan Applicants + + + + {{val.name}} + + + + + + Specify Other Owner/Owners + + + + Relation of Owner to Loan Applicant + + + + {{relation.name | titlecase}} + + + + + Relation To + + + {{relationto.name | titlecase}} + + + + + + +
+
+
+ + +
+ + + Monthly Rent Amount as per Loan Applicant + + {{"₹"}} {{rentAmtInwords}} Only + + + Mode of Payment of Rent as per Loan Applicant + + + {{payment.name}} + + + + + Amount Received in Cash + + {{"₹"}} {{amountReceivedCash}} Only + + + + Amount Received in Bank + + {{"₹"}} {{amountReceivedBank}} Only + + + Payment Received Reason + + + + Securtity Deposit amount as per Loan Applicant + + {{"₹"}} {{securtityDepositAmount}} Only + + + +
+
+
+ + +
+ + + Nature of Let Out property as per Loan Applicant + + + {{property.name}} + + + + + Other Property + + + + + + + Type of Units as per Loan Applicants + + + + {{unit.name}} + + + + + + Other Units + + + + No Floor + + +
+
+
+ + Floor Level + + + + + No of Units on the Floor + + +
+
+
+ + + + + + +
+
+
+ + +
+ + +
+ +
+ +
+ + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.scss new file mode 100644 index 000000000..183e27284 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.scss @@ -0,0 +1,13 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + mat-form-field { + margin: 0 2%; + } + ::ng-deep .cdk-global-overlay-wrapper{ + justify-content: center !important; +} +.align-margin { + margin-left: 25%; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.spec.ts new file mode 100644 index 000000000..69bfbb086 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RentalVerificationComponent } from './rental-verification.component'; + +describe('RentalVerificationComponent', () => { + let component: RentalVerificationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RentalVerificationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RentalVerificationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts new file mode 100644 index 000000000..c1350a112 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts @@ -0,0 +1,294 @@ +import { Component, OnInit, Input, Output, Inject } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; +import { NotifierService } from 'angular-notifier'; +import { PdTrigerService } from './../../../../../pd-service/pd-triger.service'; + +@Component({ + selector: 'app-rental-verification', + templateUrl: './rental-verification.component.html', + styleUrls: ['./rental-verification.component.scss'] +}) +export class RentalVerificationComponent implements OnInit { + customer_segment_abbr: any; + subproduct_abbr: any; + lender_applicant_id: any; + main_applicant: any; + pageTitle: string = "Rental Information"; + public _neighbourhoodForm: FormGroup; + pdid : string; + form_id:number; + private notifier: NotifierService; + public _rentalForm: FormGroup; + existCompanyList: any =[]; + mergeCompanyApplicant: any=[]; + personType: any=[{id:2,name:"Tenant / Lessee"},{id:3,name:"Owner of the Rented Property"},{id:4,name:"Property Caretaker"},{id:1,name:"Others (Please Specify)"}]; + relationShipList: any=[]; + relationToList: any=[]; + rentAmtInwords : String; + paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}]; + amountReceivedCash: String; + amountReceivedBank: String; + securtityDepositAmount: String; + propertyNature: any=[{id:2,name:"ResiDential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}]; + unitTypeList: any=[]; + stateList:any=[]; + //floorList: any=[{id:1,name:"Ground Floor"},{id:1,name:"First Floor"},{id:1,name:"Second Floor"},{id:1,name:"Third Floor"}] + public viewerOptions: any = { + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, +} +}; + constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef) { + this.pdid = this.data.pdmaster_details.pd_id; + this.notifier = notifier; + this.form_id = 17; + this.main_applicant = this.data.pdmaster_details.main_applicant; + this.lender_applicant_id = this.data.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.data.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.data.pdmaster_details.customer_segment_abbr; + // get applicant list + this.data.pdapplicants_detials.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); + let modifyApplicantList: any=[]; + if(this.data.pdapplicants_detials.length > 0){ + modifyApplicantList = this.data.pdapplicants_detials.map(element => { + return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; + }); + this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) + + } + // set unit type list details + let resiDentialProperty = [{id:2,name:'Independent Flat',group_id:1},{id:3,name:'Independent Flat',group_id:1},{id:4,name:'Independent Floor',group_id:1}, + {id:5,name:'Independent Bungalow',group_id:1},{id:6,name:'Independent Row House',group_id:1},{id:7,name:'Multi Storey Building',group_id:1},{id:1,name:'Other (Please Specify)',group_id:1}]; + + let commercialProperty = [{id:2,name:'Independent Office',group_id:2},{id:3,name:'Independent Shop',group_id:2},{id:4,name:'Warehouse/Godown',group_id:2}, + {id:5,name:'Workshop',group_id:2},{id:6,name:'Independent Clinic',group_id:2},{id:7,name:'Multi Storey Building',group_id:2},{id:1,name:'Other (Please Specify)',group_id:2}]; + + let industrialProperty = [{id:2,name:'Factory',group_id:3},{id:3,name:'Industrial Shed',group_id:3},{id:1,name:'Other (Please Specify)',group_id:3}]; + + this.unitTypeList.push({groupName:'Residential Property',groupValues:resiDentialProperty}); + this.unitTypeList.push({groupName:'Commercial Property',groupValues:commercialProperty}); + this.unitTypeList.push({groupName:'Industrial Property',groupValues:industrialProperty}); + + + } + + ngOnInit() { + this.initRentalForm(); + this.getMasterDetails('RELATIONSHIPS', 1); + this.getMasterDetails('COMPANYRELATIONSHIPS', 2); + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ + if(data.dataStatus){ + let modifyCompanyList: any; + modifyCompanyList = data.records.filter(val =>val.is_active==true && val.is_company_applicant==true); + if(modifyCompanyList.length>0){ + modifyCompanyList = modifyCompanyList.map(element => { + return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; + }); + this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) + } + } + }); + // observe person met controls + this._rentalForm.controls['person_met'].valueChanges.subscribe(val => { + if(val && val.length>0){ + let otherPersonMetCheck = val.filter(fVal=>fVal.id==0); + otherPersonMetCheck.length>0 ? this._rentalForm.addControl('other_person_met', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_person_met'); + otherPersonMetCheck.length>0 ? this._rentalForm.addControl('other_name_person_showing_property', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_name_person_showing_property'); + + } + else { + this._rentalForm.removeControl('other_person_met'); + this._rentalForm.removeControl('other_name_person_showing_property'); + this._rentalForm.removeControl('other_name_person_type'); + } + }); + // observe owner of the property + this._rentalForm.controls['property_owner'].valueChanges.subscribe(val => { + if(val && val.length>0){ + let otherOwnerCheck = val.filter(fVal=>fVal.id==0); + otherOwnerCheck.length>0 ? this._rentalForm.addControl('property_owner_other', new FormControl('', Validators.required)) : this._rentalForm.removeControl('property_owner_other'); + otherOwnerCheck.length>0 ? this._rentalForm.addControl('property_owner_other_relationship', new FormControl('', Validators.required)) : this._rentalForm.removeControl('property_owner_other_relationship'); + otherOwnerCheck.length>0 ? this._rentalForm.addControl('property_owner_other_relation_to', new FormControl('', Validators.required)) : this._rentalForm.removeControl('property_owner_other_relation_to'); + + } + else { + this._rentalForm.removeControl('property_owner_other'); + this._rentalForm.removeControl('property_owner_other_relationship'); + this._rentalForm.removeControl('other_name_person_type'); + this._rentalForm.removeControl('property_owner_other_relation_to'); + } + }); + + // mode of payment is both cash and bank means genereate dynamic fields + this._rentalForm.controls['payment_mode'].valueChanges.subscribe(val => { + val ? this._rentalForm.addControl('payment_received_reason', new FormControl('')) : this._rentalForm.removeControl('payment_received_reason'); + + if(val && val.id==1){ + this._rentalForm.addControl('amount_received_cash', new FormControl('', Validators.required)); + this._rentalForm.removeControl('amount_received_bank'); val.id==2 ? this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required)) : this._rentalForm.removeControl('amount_received_bank'); + } + else if(val && val.id==2){ + this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required)); + this._rentalForm.removeControl('amount_received_cash'); + } + else if(val && val.id==3){ + this._rentalForm.addControl('amount_received_cash', new FormControl('', Validators.required)); + this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required)); + } + else { + this._rentalForm.removeControl('amount_received_cash'); + this._rentalForm.removeControl('amount_received_bank'); + this._rentalForm.removeControl('payment_received_reason'); + } + }); + + // observe other property type + this._rentalForm.controls['nature_property'].valueChanges.subscribe(val => { + val.id==1 ? this._rentalForm.addControl('other_nature_property', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_nature_property'); + }); + + // observe unit type changes + this._rentalForm.controls['unit_type'].valueChanges.subscribe(val => { + val.id==1 ? this._rentalForm.addControl('other_unit_type', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_unit_type'); + val.group_id==1 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('', Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('', Validators.required)) : this._rentalForm.removeControl('no_floor'); + val.group_id==1 && val.id==7 ? this._rentalForm.addControl('floor_details', this._fb.array([])) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('floor_details', this._fb.array([])) : this._rentalForm.removeControl('floor_details'); + }); + } + + initRentalForm() { + return this._rentalForm = this._fb.group({ + pdid: this.pdid, + formid: this.form_id, + person_met: ['',Validators.required], + property_owner: ['',Validators.required], + monthly_rent_amount: ['',Validators.required], + payment_mode: ['',Validators.required], + securtity_deposit_amount: ['',Validators.required], + nature_property: ['',Validators.required], + unit_type:['',Validators.required], + address:['',Validators.required], + state:['',Validators.required], + city:['',Validators.required], + pincode:['',Validators.required] + }); +} + // other_name_person_showing_property changes + personShowingChanges(value: any): void { + if(value.length>0){ + let otherCheck: any = value.filter(fVal=>fVal.id==1); + otherCheck.length >0 ? this._rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_name_person_type'); +} +else { + this._rentalForm.removeControl('other_name_person_type'); +} +} + +/*** get all master details **/ +getMasterDetails(table: string, type: number) { + this._pd.getAllMasterDatas(table).subscribe( + data => { + if (data.status == 200) { + if (type == 1) { + let relationshipList: any = data.records.filter(item => item.isactive == 1).map(element => { + return {id:element.relationship_id.toString(),name:element.name,group_id:1}; + }); + relationshipList.length > 0 ? this.relationShipList.push({groupName:'Personal',groupValues:relationshipList}):''; + } + if (type == 2) { + let companyRelationShipList:any = data.records.filter(item => item.isactive == 1 && item.name != 'Others').map(element => { + return {id:element.company_relationship_id.toString(),name:element.name,group_id:2}; + }); + companyRelationShipList.length > 0 ? this.relationShipList.push({groupName:'Official',groupValues:companyRelationShipList}):''; + } + + } + }); +} +// generate floor rows +generateFloor(e:any): void{ + let control = this._rentalForm.controls['floor_details']; + if(e.target.value && Math.round(e.target.value)!=0){ + + if(Math.round(e.target.value) > this._rentalForm.value.floor_details.length){ + let rowValue = Math.round(e.target.value)-this._rentalForm.value.floor_details.length; + for(let i=rowValue;i>0;i--){ + control.push(this.createFloorDetails('')); + } + } + else if(Math.round(e.target.value) < this._rentalForm.value.floor_details.length){ + let rowValue = this._rentalForm.value.floor_details.length-Math.round(e.target.value); + for(let i=rowValue;i>0;i--){ + control.removeAt(this._rentalForm.value.floor_details.length-1); + } + } + } + else if(e.target.value && Math.round(e.target.value)==0){ + control.controls = []; + control.setValue([]); + } + else{ + control.controls = []; + control.setValue([]); + } + e.stopPropagation(); +} + +// create floor details +createFloorDetails(details){ + if(details){ + return this._fb.group({ + floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])], + no_units_on_floor: ['', Validators.compose([Validators.required])], + }); + } + else{ + return this._fb.group({ + floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])], + no_units_in_floor: ['', Validators.compose([Validators.required])], + }); + } + +} + // compare objects for merge two master table details + compareObjects(o1: any, o2: any) { + if(o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } + /** Amount InWords */ +inWords(e,flag){ + switch(flag){ + case 1: + this.rentAmtInwords = this._pd.convertNumberToWords(e.target.value); + break; + case 2: + this.amountReceivedCash = this._pd.convertNumberToWords(e.target.value); + break; + case 3: + this.amountReceivedBank = this._pd.convertNumberToWords(e.target.value); + break; + case 4: + this.securtityDepositAmount = this._pd.convertNumberToWords(e.target.value); + break; + default: + break; + } + e.stopPropagation(); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts index 57d57a71b..a2b1532cf 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts @@ -17,7 +17,6 @@ import {StockComponent} from './forms/stock/stock.component'; import {CurrentLoanComponent} from './forms/current-loan/current-loan.component'; import {FinancialInfoComponent} from './forms/financial-info/financial-info.component'; import {AssetsInfoComponent} from './forms/assets-info/assets-info.component'; -import {RentalInfoComponent} from './forms/rental-info/rental-info.component'; import {AssessedIncomeComponent} from './forms/assessed-income/assessed-income.component'; import {BankingDetailsComponent} from './forms/banking-details/banking-details.component'; import {BusinessInfoComponent} from './forms/business-info/business-info.component'; @@ -29,6 +28,8 @@ import {FinalRemarksComponent} from './forms/final-remarks/final-remarks.compone import { BusinessInfoGroupComponent } from './forms/business-info-group/business-info-group.component'; import { BusinessAssetsInfoComponent } from './forms/business-assets-info/business-assets-info.component'; import { PdStatusChangeDialogueComponent } from './../pd-status-change-dialogue/pd-status-change-dialogue.component'; +import {RentalVerificationComponent} from './forms/rental-verification/rental-verification.component'; + @Component({ selector: 'app-start-pd', templateUrl: './start-pd.component.html', @@ -396,7 +397,7 @@ export class StartPdComponent implements OnInit, OnDestroy { } else if(this.selectedFormsCategory.form_id==17){ - const dialogRef = this.dialog.open(RentalInfoComponent, { + const dialogRef = this.dialog.open(RentalVerificationComponent, { data: this.pdFullDetails, // position: { right: '0'}, maxWidth: '100vw', diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index b3e372c8c..17d1d91fb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -113,6 +113,7 @@ import { PdLocatedMapViewDirective } from './../pd-directive/pd-located-map-view import { ViewLocationComponent } from './../pd-directive/view-location/view-location.component'; import { GetAnswerableFormsPipe } from './../pd-pipes/get-answerable-forms.pipe'; import { ConfirmAiDetailsComponent } from './list-pd/start-pd/forms/assessed-income/confirm-ai-details/confirm-ai-details.component'; +import { RentalVerificationComponent } from './list-pd/start-pd/forms/rental-verification/rental-verification.component'; /** * Custom angular notifier options @@ -159,7 +160,7 @@ const pdCustomNotifierOptions: NotifierOptions = { }; @NgModule({ - 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, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent], + 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, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent], imports: [ CommonModule, ManagePdRoutingModule, @@ -192,13 +193,13 @@ const pdCustomNotifierOptions: NotifierOptions = { AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),OwlDateTimeModule, OwlNativeDateTimeModule, ], - exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent], + exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent], providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'}, {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective], entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent, - ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent], + ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent], }) export class ManagePdModule {