diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html index 05038c8b3..9bc3985e8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html @@ -34,6 +34,7 @@ + Address Required @@ -63,8 +64,8 @@ - + Pincode Required + @@ -78,13 +79,14 @@ *ngFor="let m_addressType of addressData">{{m_addressType.address_type}} + Address Type Required - + Address Type Required @@ -97,19 +99,21 @@ {{m_locality.locality_name}} + Locality Required - + + Locality Required @@ -124,6 +128,7 @@ {{data.description}} + Approach to PD Location Required @@ -133,6 +138,7 @@ {{data.rating}} + Comment on Locality Required @@ -153,7 +159,8 @@ - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 47d9c9068..3842dfc2f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -389,61 +389,54 @@ export class AddressComponent implements OnInit { getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; } /** TO Save Address Forms Details*/ onSubmit() { - // let addressesArrayValues = this.addressForm.controls.addresses.value; - // console.log(this.addressForm.controls.addresses); - // return; - // addressesArrayValues.forEach(data => { - // data.address_type.value == 1 - // ? this.addressForm.controls['address_type_others'].setValidators([Validators.required]) - // : this.addressForm.controls['address_type_others'].clearValidators(); - // this.addressForm.controls['address_type_others'].updateValueAndValidity(); + + const control = this.addressForm.controls['addresses']; + let CtrlLength = control.controls.length; + if (CtrlLength > 0) { + let cnt = 0; + while(cnt < CtrlLength){ - // data.controls.locality.value == 1 - // ? this.addressForm.controls['locality_others'].setValidators([Validators.required]) - // : this.addressForm.controls['locality_others'].clearValidators(); - // this.addressForm.controls['locality_others'].updateValueAndValidity(); + let ChildCtrl : any = control.controls[cnt] + if(ChildCtrl.controls.address_type.value == 1){ + ChildCtrl.controls['address_type_others'].setValidators([Validators.required]);} + else{ + ChildCtrl.controls['address_type_others'].clearValidators(); + ChildCtrl.controls['address_type_others'].setValue(''); + } + ChildCtrl.controls['address_type_others'].updateValueAndValidity(); - // data.controls.pincode.value == 1 - // ? this.addressForm.controls['pincode_others'].setValidators([Validators.required]) - // : this.addressForm.controls['pincode_others'].clearValidators(); - // this.addressForm.controls['pincode_others'].updateValueAndValidity(); + if(ChildCtrl.controls.locality.value == 1){ + ChildCtrl.controls['locality_others'].setValidators([Validators.required]);} + else{ ChildCtrl.controls['locality_others'].clearValidators(); + ChildCtrl.controls['locality_others'].setValue(''); + } + ChildCtrl.controls['locality_others'].updateValueAndValidity(); + + if(ChildCtrl.controls.pincode.value == 1){ + ChildCtrl.controls['pincode_others'].setValidators([Validators.required]);} + else{ ChildCtrl.controls['pincode_others'].clearValidators(); + ChildCtrl.controls['pincode_others'].setValue(''); + } + ChildCtrl.controls['pincode_others'].updateValueAndValidity(); // data.controls.locality.value == 5 // ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required]) // : this.addressForm.controls['locality_mixuse'].clearValidators(); // this.addressForm.controls['locality_mixuse'].updateValueAndValidity(); - // data.controls.uom.value == 1 - // ? this.addressForm.controls['uom_others'].setValidators([Validators.required]) - // : this.addressForm.controls['uom_others'].clearValidators(); - // this.addressForm.controls['uom_others'].updateValueAndValidity(); - // }); - // this.addressForm.controls.address_type.value == 1 - // ? this.addressForm.controls['address_type_others'].setValidators([Validators.required]) - // : this.addressForm.controls['address_type_others'].clearValidators(); - // this.addressForm.controls['address_type_others'].updateValueAndValidity(); - - // this.addressForm.controls.locality.value == 1 - // ? this.addressForm.controls['locality_others'].setValidators([Validators.required]) - // : this.addressForm.controls['locality_others'].clearValidators(); - // this.addressForm.controls['locality_others'].updateValueAndValidity(); - - // this.addressForm.controls.pincode.value == 1 - // ? this.addressForm.controls['pincode_others'].setValidators([Validators.required]) - // : this.addressForm.controls['pincode_others'].clearValidators(); - // this.addressForm.controls['pincode_others'].updateValueAndValidity(); - - // this.addressForm.controls.locality.value == 5 - // ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required]) - // : this.addressForm.controls['locality_mixuse'].clearValidators(); - // this.addressForm.controls['locality_mixuse'].updateValueAndValidity(); - - // this.addressForm.controls.uom.value == 1 - // ? this.addressForm.controls['uom_others'].setValidators([Validators.required]) - // : this.addressForm.controls['uom_others'].clearValidators(); - // this.addressForm.controls['uom_others'].updateValueAndValidity(); + if(ChildCtrl.controls.uom.value == 1){ + ChildCtrl.controls['uom_others'].setValidators([Validators.required]);} + else{ + ChildCtrl.controls['uom_others'].clearValidators(); + ChildCtrl.controls['uom_others'].setValue(''); + } + ChildCtrl.controls['uom_others'].updateValueAndValidity(); + cnt++; + } + } if (!this.addressForm.valid) { + this.validateAllFormFields(this.addressForm); this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); this.disableAfterSubmit = false; return; @@ -456,44 +449,16 @@ export class AddressComponent implements OnInit { } this.disableAfterSubmit = true; let records: any = {}; + records.addresses = this.addressForm.controls.addresses.value; - // records.address = this.address.value; - // records.state = this.state.value; - // records.city = this.city.value; - // records.address_type = this.addressType.value; - - // records.address_type_others = this.addressType.value == 1 ? - // this.addressForm.controls.address_type_others.value : ''; - - // records.locality = this.locality.value; - // records.locality_others = this.locality.value == 1 ? - // this.addressForm.controls.locality_others.value : ''; - - // records.locality_mixuse = this.locality.value == 5 ? - // this.addressForm.controls.locality_mixuse.value : ''; - - // records.pincode = this.pincode.value; - // records.pincode_others = this.pincode.value == 1 ? - // this.addressForm.controls.pincode_others.value : ''; - - // records.pd_location = this.pdLocation.value; - // records.comment_locality = this.commentLocality.value; - records.address_form_remark = this.addressForm.controls.address_form_remark.value; - // records.estimated_area = this.estArea.value; - - // records.uom = this.uom.value; - // records.uom_others = records.uom == 1 ? - // this.addressForm.controls.uom_others.value : ''; - records.pdid = this.pdid; records.parent_pdid= this.parent_pdid; records.formid = '5'; + // records.fk_createdby = '250'; - // console.log(JSON.stringify(records)); - this._pd.saveForm(records).subscribe(data => { if (data.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); @@ -521,16 +486,18 @@ export class AddressComponent implements OnInit { /** To validate All Form Fields */ - validateAllFormFields(formGroup: FormGroup) { + validateAllFormFields(formGroup: any) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { control.markAsTouched({ onlySelf: true }); - } else if (control instanceof FormGroup) { + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { this.validateAllFormFields(control); } }); - } + } /** For DOCS Tab */ public viewerOptions: any = { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index 62c9dfd13..b662b2995 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -604,13 +604,10 @@ export class GeneralInfoComponent implements OnInit { temp: number = 0; submitGeneralForm(formData: any) { // console.log('formData',formData); - if (formData.individuals.length > 0) { - formData.individuals.forEach((val, index) => { if (val.is_person_met == false) { - this.temp++; } @@ -618,11 +615,12 @@ export class GeneralInfoComponent implements OnInit { if (this.temp == formData.individuals.length) { this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); - this.temp = 0; - return; } + else if(this.temp <= formData.individuals.length){ + this.temp = 0; + } let individualCtrl: any = this._generalForm.get('individuals') as FormArray; let individualCtrlLength: any = individualCtrl.controls.length; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html index 0bb69ef2d..97fbe3fa9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html @@ -40,11 +40,13 @@ + Lender Name Required + Did the lender representative carry the loan file during PD? Required diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts index 7e8e045af..830e70cdd 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts @@ -145,7 +145,7 @@ export class LenderRepresentativeComponent implements OnInit { if (!this.representativeForm.valid) { this.validateAllFormFields(this.representativeForm); this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!'); return; } this.disableAfterSubmit = true; @@ -176,13 +176,15 @@ export class LenderRepresentativeComponent implements OnInit { this.disableAfterSubmit = false; }) } - validateAllFormFields(formGroup: FormGroup) { + validateAllFormFields(formGroup: any) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { control.markAsTouched({ onlySelf: true }); } else if (control instanceof FormGroup) { this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); } }); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index eaea8c469..df9040d81 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -55,6 +55,7 @@ + End Use Required + Lender Required @@ -109,6 +111,7 @@ style="width: 28%"> + End Use of Top Up Required @@ -136,6 +139,7 @@ + Sources Required @@ -166,6 +170,7 @@ + Type of Property Required @@ -177,6 +182,7 @@ + Owner Required +
+
+
+ + {{pageTitle}} +
+ +
+ +
+
+ + +
+ + + + + + Property Details + + + +
+ +
+ + Address of the Property + + +
+
+ + + State + + + {{stVal.name}} + + + + + City + + + {{ctVal.city_name}} + + + + + + Pincode + + + {{pinVal.pincode}} + + + +
+ Is This the Address Visited ? ( {{_rentalForm.value.validate_visited_address===true ? 'Yes' : 'No'}} ) +
+ + Actual Address Visited + + +
+ +
+
+ + + 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}} + + + + + + + Who is {{_rentalForm.controls['other_person_met'].value}} ? + + + + + + + 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.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} + + + + + + + + Ownership Proof Documents Sighted + + Yes + No + + + + Type of Document Sighted + + {{prDocs.name | titlecase}} + + + + Other Type of Document + + + + + + + + + Nature of Let Out Property as per Loan Applicant + + + {{property.name}} + + + + + Other Property + + + + + + Type of Units as per Loan Applicants + + + + {{unit.name}} + + + + + + Specify Other Unit Type + + + + Tot No of Units + + + + No of Floors + + + + + Total Area Given on Rent + + + + + + + Unit of Measurement + + + {{unitM.name}} + + + + + + Other Unit of Measurement + + + + + +
+
+
+ + + + + + + Floor Level Name + + + + + + No of Units + + + + Is Rent Same for All Units + + Yes + No + + + + + +
+ + +
+
+ + Rent per Unit + + {{"₹"}} {{fUnits.value.rent_per_unit | numberToWords}} Only + + + + Total Rent Amount + + {{"₹"}} {{fUnits.value.amount | numberToWords}} Only + +
+
+
+ + +
+
+ + Rent Unit {{fu+1}} + + {{"₹"}} {{fUnits.value.rent_per_unit | numberToWords}} Only + +
+
+
+
+ + + +
+ +
+ + Total Rent Amount + + {{"₹"}} {{floor.value.floor_rent_amount | numberToWords}} Only + +
+ +
+
+
+ + + + + + + + + Unit {{u+1}} + + + +
+ + + Is Name of the Tenant(s)/Lessees(s) of the Let out Property Provided ? + + Yes + Name(s) not provided + + + + Name of Tenant(s)/Lessees(s) + + + + Why Tenant(s)/Lessees(s) Name not Provided + + + + + + + Monthly Rent Amount as per Loan Applicant + + + {{"₹"}} {{units.value.monthly_rent_amount | numberToWords}} Only + + + Mode of Payment of Rent as per Loan Applicant + + + {{payment.name}} + + + + + + Amount Received in Bank + + {{"₹"}} {{units.value.amount_received_bank | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + + + + Amount Received in Cash + + {{"₹"}} {{units.value.amount_received_cash | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + + + + + Reason for Receiving Multiple Payment Mode + + + + Securtity Deposit amount as per Loan Applicant + + {{"₹"}} {{units.value.securtity_deposit_amount | numberToWords}} Only + + + + + Area Covered by the Unit + + + + + + + Unit of Measurement + + + {{unitM.name}} + + + + + + Other Unit of Measurement + + + + + + Is Rent Agreement executed for the Property let out + + Yes + No + + + + + + + Rent Agreement Seen + + Yes + No + + + + + + Is the Rent Agreement Registered at Sub-Registrar Office + + Yes + No + + + + + + Date of Agreement + + + + + + + No of Months for Which Property has been let out as per Agreement + + + + + Date on which Agreement is Expiring + + + + No of Rental Months Remaining as per Agreement + + + + + + Monthly Rent Amount as per Agreement + + {{"₹"}} {{units.value.agreement_monthly_rent_amount | numberToWords}} Only + + + + + + Security Deposit Amount as per Agreement + + {{"₹"}} {{units.value.agreement_security_deposit_amount | numberToWords}} Only + + + + + + There is a Difference of Rs.{{validateAgreementAmt(units.value.monthly_rent_amount,units.value.agreement_monthly_rent_amount)}} in the rent amount as per agreement and actual rent received. Why? + + + + + + + Name of Owner / Owners of Rented Property as per Rent Agreement + + + + {{val.name}} + + + + + + Specify Other Owner/Owners + + + + Relation of Owner to Loan Applicant + + + + {{relation.name | titlecase}} + + + + + Relation To + + + {{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} + + + + + + + + Name of Tenants / Lessees as per Rent Agreement + + + + + + + + Tenant(s) / Lessee(s) Met During Visit of the Rented Property + + Yes + No + + + + Name of the Tenant / Lessee Met + + + + + Why Tenant / Lessee not Met ? + + + + + + + Name of Owner as per Tenant / Lessee Met + + + + {{val.name}} + + + + + + Specify Other Owner/Owners + + + + Relation of Owner to Loan Applicant + + + + {{relation.name | titlecase}} + + + + + Relation To + + + {{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} + + + + + + + + Monthly Rent Amount Paid as per Tenant / Lessee Met + + {{"₹"}} {{units.value.paid_monthly_rent_per_met | numberToWords}} Only + + + + Period (Months) of Stay as per Tenant / Lessee Met + + + + + Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit + + + {{payment.name}} + + + + + Amount Paid in Bank + + {{"₹"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + + + Amount Paid in Cash + + {{"₹"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + + + + + Reason for Paid Multiple Payment Mode + + + + + + + What is the Reason for Difference in Rent Amount + + + + + + +
+ +
+ + + +
+
+
+
+ +
+
+ + + + + + + Third Party Check + + + +
+ + + Third party check done on prevailing rent in the area + + Yes + No + + + + + Name of person with whom Third Party Check on going rentals in the area done + + + + Description of the person with whom the Third Party Check is done + + + + Rental rates in the area as per the person with whom Third Party Check is done + + + + Why Third party check not done + + + + + + + +
+
+
+ + +
+ + +
+ + Remarks + + +
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.scss new file mode 100644 index 000000000..13b8a16c4 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.scss @@ -0,0 +1,21 @@ +.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: 2%; + margin-right: 2%; +} +.rent-unit { + margin-left: 2%; + margin-top: 1%; +} +.total-rent-amt{ + margin-left: 1%; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.spec.ts new file mode 100644 index 000000000..50fc30f90 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageRentalVerificationComponent } from './manage-rental-verification.component'; + +describe('ManageRentalVerificationComponent', () => { + let component: ManageRentalVerificationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageRentalVerificationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageRentalVerificationComponent); + 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/manage-rental-verification/manage-rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.ts new file mode 100644 index 000000000..1bc93efca --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component.ts @@ -0,0 +1,1039 @@ +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 { DatePipe } from '@angular/common' +import { Pipe, PipeTransform } from '@angular/core'; +import { NotifierService } from 'angular-notifier'; +import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service'; +/**sweet alert */ +import Swal from 'sweetalert2'; + +@Component({ + selector: 'app-manage-rental-verification', + templateUrl: './manage-rental-verification.component.html', + styleUrls: ['./manage-rental-verification.component.scss'] +}) +export class ManageRentalVerificationComponent implements OnInit { + + pipe = new DatePipe('en-US'); + // customer_segment_abbr: any; + // subproduct_abbr: any; + // lender_applicant_id: any; + // main_applicant: any; + pageTitle: string = "Rental Information"; + parent_pdid: string; + pdid : string; + form_id:number; + rental_count_id : any; + private notifier: NotifierService; + public _rentalForm: FormGroup; + existCompanyList: any =[]; + mergeCompanyApplicant: any=[]; + mergeCompanyApplicant2: 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"}]; + paymentPaidOptions: any=[{id:1,name:"Paid in Cash"},{id:2,name:"Paid through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}]; + 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=[]; + cityList:any=[]; + pincodeList:any=[]; + documentList: any=[{id:2,name:"Property Title Document"},{id:3,name:"Electricity Bill with name of owner mentioned therein"},{id:4,name:"Property tax Receipts"},{id:1,name:"Others (Please Specify)"}]; + //floorList: any=[{id:1,name:"Ground Floor"},{id:1,name:"First Floor"},{id:1,name:"Second Floor"},{id:1,name:"Third Floor"}] + //unitMeasurementList: any=[{id:2,name:"Square Feet"},{id:3,name:"Square Yards"},{id:4,name:"Square Meters"},{id:5,name:"Acres"},{id:6,name:"Hectares"},{id:1,name:"Others (Please Specify)"}]; + unitMeasurementList: any=[]; + SwalButtonText: string; + SwalMessage: string; + + constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef) { + + this.pageTitle = this.data.manage_status==1 ? 'Add RI Details' : 'Update RI Details'; + this.parent_pdid = this.data.parentData.pdmaster_details.parent_pd_id; + this.pdid = this.data.parentData.pdmaster_details.pd_id; + this.notifier = notifier; + this.form_id = 17; + this.rental_count_id = this.data.existing_rental_count_id; + this.mergeCompanyApplicant = this.data.masterData.mergeCompanyApplicant; + this.unitTypeList = this.data.masterData.unitTypeList; + this.stateList = this.data.masterData.stateList; + this.unitMeasurementList = this.data.masterData.unitMeasurementList; + console.log(this.mergeCompanyApplicant); + console.log(this.data.masterData.mergeCompanyApplicant); + + } + + ngOnInit() { + this.initRentalForm(); + this.getMasterDetails('RELATIONSHIPS', 1); + this.getMasterDetails('COMPANYRELATIONSHIPS', 2); + console.log(this.mergeCompanyApplicant); + console.log(this.data.masterData.mergeCompanyApplicant); + + + //load form details with data + // let that = this; + // setTimeout(function(){ + // // that.loadFormData(that.data.editData); + // },3000); + + + // this.loadFormData(this.data.editData); + // 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'); + otherPersonMetCheck.length>0 ? '' : this._rentalForm.removeControl('other_name_person_type'); + + + } + 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'); + } + }); + // 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==6 ? this._rentalForm.removeControl('no_units') : val.group_id==2 && val.id==7 ? this._rentalForm.removeControl('no_units') : this._rentalForm.addControl('no_units', new FormControl('')); + val.group_id==1 && val.id==6 ? 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==6 ? this._rentalForm.addControl('multistoried_total_area', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('multistoried_total_area', new FormControl('',Validators.required)) : this._rentalForm.removeControl('multistoried_total_area'); + val.group_id==1 && val.id==6 ? this._rentalForm.addControl('multistoried_uom', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('multistoried_uom', new FormControl('',Validators.required)) : this._rentalForm.removeControl('multistoried_uom'); + val.group_id==1 && val.id==6 ? '' : val.group_id==2 && val.id==7 ? '' : this._rentalForm.setControl('multistoried_building_details', this._fb.array([])); + }); + + // observe visit address + this._rentalForm.controls['validate_visited_address'].valueChanges.subscribe(val => { + if(val===false){ + this._rentalForm.addControl('other_visited_address', new FormControl('', Validators.required)); + } + else { + this._rentalForm.removeControl('other_visited_address'); + } + }); + + // get city list based on state changes + this._rentalForm.controls['state'].valueChanges.subscribe(val => { + this._pd.getStateWiseCities(val).subscribe(data => { + if (data.status == 200) { + this.cityList = data.records.cities; + this.pincodeList = data.records.pincode; + } + }); + }); + + // ownership property documents during the visit + this._rentalForm.controls['property_ownership_proof_documents'].valueChanges.subscribe(val => { + val=="1" ? this._rentalForm.addControl('sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('sighted_documents'); + val=="1" ? '' : this._rentalForm.removeControl('other_sighted_documents'); + }); + + // listen third party check + this._rentalForm.controls['done_third_party_check'].valueChanges.subscribe(val => { + val=="1" ? this._rentalForm.addControl('whom_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('whom_third_party_check_done'); + val=="1" ? this._rentalForm.addControl('description_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('description_third_party_check_done'); + val=="1" ? this._rentalForm.addControl('rental_rates_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('rental_rates_third_party_check_done'); + val=="0" ? this._rentalForm.addControl('why_third_party_check_not_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('why_third_party_check_not_done'); + }); + this.loadFormData(this.data.editData); + } + + initRentalForm() { + return this._rentalForm = this._fb.group({ + parent_pdid: this.parent_pdid, + pdid: this.pdid, + formid: this.form_id, + address_property:['',Validators.required], + state:['',Validators.required], + city:['',Validators.required], + pincode:['',Validators.required], + validate_visited_address:[true], + person_met: ['',Validators.required], + property_owner: ['',Validators.required], + property_ownership_proof_documents: ['',Validators.required], + nature_property: ['',Validators.required], + unit_type:['',Validators.required], + no_units:[''], + multistoried_building_details: this._fb.array([]), + property_unit_details : this._fb.array([]), + done_third_party_check :['',Validators.required], + rental_remark: [''], + }); + } + // 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'); + } + } + + // dynamic form control generate for other documents sighted + getSightedDocs(value): void{ + value.id==1 ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); + } + + /*** 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}):''; + } + else 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}):''; + } + + + } + }); + } + + closeDialogue(){ + this.dialogRef.close({update_status:false}); + } + + // load form data + loadFormData(data){ + console.log('data',data); + if(data){ + console.log('data.dataStatus',data); + // let rentalValue = data.records.filter(data=>data.rental_count_id==id); + let rentalVal = data; + console.log('rentalVal',rentalVal); + rentalVal.pdid = this.pdid; + rentalVal.formid = this.form_id; + + rentalVal.other_name_person_type ? this._rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)): this._rentalForm.removeControl('other_name_person_type'); + rentalVal.other_sighted_documents ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); + + //get Multistoried Building Details + if(rentalVal.multistoried_building_details){ + let selectedMultistoriedBuilding = Object.keys(rentalVal.multistoried_building_details).map(function (key) { + return rentalVal.multistoried_building_details[key]; + }); + if(selectedMultistoriedBuilding.length>0){ + let control: any = this._rentalForm.controls['multistoried_building_details']; + selectedMultistoriedBuilding.forEach((floorElement,floorIndex)=>{ + control.push(this.createFloorDetails('')); + let unitControl = control.controls[floorIndex]; + unitControl= unitControl.controls['floor_unit_details']; + floorElement.floor_unit_details.forEach((unitElement,unitIndex) => { + floorElement.unit_rent_difference_options=="0" ? unitControl.push(this.createFloorUnitDetails(2)) : unitControl.push(this.createFloorUnitDetails(1)); + }); + }); + } + } + // get property unit details + if(rentalVal.property_unit_details){ + let selectedUnitDetails = Object.keys(rentalVal.property_unit_details).map(function (key) { + return rentalVal.property_unit_details[key]; + }); + if(selectedUnitDetails.length>0){ + selectedUnitDetails.forEach((element,index) => { + let control: any = this._rentalForm.controls['property_unit_details']; + control.push(this.createUnitDetails('')); + (element.name_tenant_lessees && element.tenant_lessees_options=="1") ? control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees'); + (element.name_tenant_lessees_reason && element.tenant_lessees_options=="0") ? control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason'); + // for payment options + element.amount_received_cash ? control.controls[index].addControl('amount_received_cash', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash'); + element.amount_received_bank ? control.controls[index].addControl('amount_received_bank', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank'); + element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); + + if(element.payment_mode){ + let ChildCtrl : any = control.controls[index]; + + if(element.payment_mode.id == 1 && element.amount_received_cash){ + + ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]); + ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); + } + else if(element.payment_mode.id == 2 && element.amount_received_bank){ + + ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]); + ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); + } + else if(element.payment_mode.id == 3 && element.amount_received_bank && element.amount_received_cash){ + + this.ValidatedRentAmount(element,index,1); + } + } + + + // unit of other measurement + element.other_unit_measurement ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); + // rent agreement seen + element.rent_agreement_seen ? control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_seen'); + element.rent_agreement_registered ? control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_registered'); + element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date'); + element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months'); + element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date'); + (element.rental_remaining_months=='' || element.rental_remaining_months>=0) ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months'); + element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount'); + element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount'); + element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement'); + + //agreement owners + element.agreement_property_owners_name ? control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owners_name'); + element.agreement_property_owner_other ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); + element.agreement_property_owner_other_relationship ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); + element.agreement_property_owner_other_relation_to ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + + // name of tenant/lessess as agreement + element.agreement_tenant_lessees_name ? control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_tenant_lessees_name'); + + //met tenant details + element.name_tenant_lessees_per_met ? control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_per_met'); + element.name_tenant_lessees_reason_per_met ? control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); + element.property_owner_per_met ? control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_per_met'); + element.property_owner_other_per_met ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); + element.property_owner_other_relationship_per_met ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); + element.property_owner_other_relation_to_per_met ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); + + // tennat payment + element.paid_monthly_rent_per_met ? control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('paid_monthly_rent_per_met'); + element.period_of_stay_per_met ? control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('period_of_stay_per_met'); + element.payment_mode_per_met ? control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_mode_per_met'); + element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); + element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_cash_per_met'); + element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_bank_per_met'); + element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met'); + (element.met_tenant_lessees_options=="1") ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met'); + + if(element.payment_mode_per_met){ + + let ChildCtrl : any = control.controls[index]; + if(element.payment_mode_per_met.id == 1){ + + ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]); + ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); + } + else if(element.payment_mode_per_met.id == 2){ + + ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]); + ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); + } + else if(element.payment_mode_per_met.id == 3){ + + this.ValidatedRentAmount(element,index,2); + } + } + }); + } + } + + this._rentalForm.patchValue(rentalVal); + + } + else{ + let control: any = this._rentalForm.controls['property_unit_details']; + control.push(this.createUnitDetails('')); + + } + + + + } + + // add more unit details + addMoreUnitDetails(){ + let control: any = this._rentalForm.controls['property_unit_details']; + //control.push(this.createUnitDetails('')); + control.push(this.createUnitDetails('')); + } + + // create unit details + createUnitDetails(details){ + return this._fb.group({ + tenant_lessees_options:['1',Validators.required], + name_tenant_lessees:['',Validators.required], + monthly_rent_amount: ['',Validators.required], + payment_mode: ['',Validators.required], + securtity_deposit_amount: ['',Validators.required], + property_cover_area: ['',Validators.required], + unit_measurement: ['',Validators.required], + is_rent_agreement_executed: ['',Validators.required], + met_tenant_lessees_options: ['',Validators.required], + }); + } + + // remove unit + removeUnit(index) { + let control: any = this._rentalForm.controls['property_unit_details']; + control.removeAt(index); + } + + // generate payment dynamic fields + generatePaymentOptions(value:any,index:number,type: number){ + // console.log('generatePaymentOptions',value,index,type); + if(type==1){ + let control: any = this._rentalForm.controls['property_unit_details']; + let monthlyrentamt : number = value.monthly_rent_amount ; + + if(value && value.payment_mode.id==1){ + control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)])); + control.controls[index].removeControl('amount_received_bank'); + control.controls[index].removeControl('payment_received_reason'); + } + else if(value && value.payment_mode.id==2){ + control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)])); + control.controls[index].removeControl('amount_received_cash'); + control.controls[index].removeControl('payment_received_reason'); + } + else if(value && value.payment_mode.id==3){ + control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', Validators.required)); + control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', Validators.required)); + control.controls[index].addControl('payment_received_reason', new FormControl(value.payment_received_reason ? value.payment_received_reason : '', Validators.required)); + } + else { + control.controls[index].removeControl('amount_received_cash'); + control.controls[index].removeControl('amount_received_bank'); + control.controls[index].removeControl('payment_received_reason'); + } + } + else if(type==2){ + let control: any = this._rentalForm.controls['property_unit_details']; + let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met ; + if(value && value.payment_mode_per_met.id==1){ + control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)])); + control.controls[index].removeControl('amount_received_bank_per_met'); + control.controls[index].removeControl('payment_received_reason_per_met'); + } + else if(value && value.payment_mode_per_met.id==2){ + control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)])); + control.controls[index].removeControl('amount_received_cash_per_met'); + control.controls[index].removeControl('payment_received_reason_per_met'); + } + else if(value && value.payment_mode_per_met.id==3){ + control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', Validators.required)); + control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', Validators.required)); + control.controls[index].addControl('payment_received_reason_per_met', new FormControl(value.payment_received_reason_per_met ? value.payment_received_reason_per_met : '', Validators.required)); + } + else { + control.controls[index].removeControl('amount_received_cash_per_met'); + control.controls[index].removeControl('amount_received_bank_per_met'); + control.controls[index].removeControl('payment_received_reason_per_met'); + } + let child = control.controls[index] as FormGroup; + + if(child.controls.payment_difference_per_met){ + child.controls.payment_difference_per_met.setValue(''); + child.controls.payment_difference_per_met.updateValueAndValidity(); + } + else{ + console.log('There is NO Control'); + } + + } + + + } + + ValidatedRentAmount(value:any,index:number,type: number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(type==1){ + let monthlyrentamt : any = value.monthly_rent_amount ; + if(value && value.payment_mode.id==3){ + let ChildCtrl : any = control.controls[index]; + ChildCtrl.controls['amount_received_bank'].clearValidators(); + ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); + ChildCtrl.controls['amount_received_cash'].clearValidators();; + ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); + + if(monthlyrentamt != ''){ + + let bank_amount = value.amount_received_bank; + + ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(monthlyrentamt),Validators.min(0)]); + ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); + let remainingAmt = monthlyrentamt-bank_amount + if(remainingAmt >= 0 ){ + ChildCtrl.controls['amount_received_cash'].setValue(remainingAmt); + ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(monthlyrentamt-bank_amount),Validators.min(monthlyrentamt-bank_amount)]); + } + else{ + ChildCtrl.controls['amount_received_cash'].setValue(0); + ChildCtrl.controls['amount_received_cash'].setValidators([Validators.max(0),Validators.min(0)]); + } + ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); + + } + } + } + if(type==2 && value.payment_mode_per_met != ''){ + + if(value && value.payment_mode_per_met.id==3){ + + let ChildCtrl : any = control.controls[index]; + ChildCtrl.controls['amount_received_bank_per_met'].clearValidators(); + ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); + ChildCtrl.controls['amount_received_cash_per_met'].clearValidators();; + ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); + let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met; + + if(paidmonthlyrentamt != ''){ + + let bank_amount = value.amount_received_bank_per_met; + ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(0)]); + ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); + let remainingAmt = paidmonthlyrentamt-bank_amount + if(remainingAmt >= 0 ){ + ChildCtrl.controls['amount_received_cash_per_met'].setValue(remainingAmt); + ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt-bank_amount),Validators.min(paidmonthlyrentamt-bank_amount)]); + } + else{ + ChildCtrl.controls['amount_received_cash_per_met'].setValue(0); + ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.max(0),Validators.min(0)]); + } + ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); + } + } + + } + } + // tenant/lessees options + generateTenantOptions(value:any,index:number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(value.tenant_lessees_options=="1"){ + control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)); + control.controls[index].removeControl('name_tenant_lessees_reason'); + } + else if(value.tenant_lessees_options=="0"){ + control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)); + control.controls[index].removeControl('name_tenant_lessees'); + } + else { + control.controls[index].removeControl('name_tenant_lessees'); + control.controls[index].removeControl('name_tenant_lessees_reason'); + } + } + + // unit of measurement generate other field + generateOtherunitMeasurement(value: any,index:number){ + let control: any = this._rentalForm.controls['property_unit_details']; + value.unit_measurement.id=="1" ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); + + } + // generate multistoried other uom + generateMultistoriedOtherUOM(value: any){ + value.multistoried_uom.id=="1" ? this._rentalForm.addControl('multistoried_other_uom', new FormControl('', Validators.required)) : this._rentalForm.removeControl('multistoried_other_uom'); + } + // generate Rent AgreementSeen + generateRentAgreementSeen(value: any,index:number){ + let control: any = this._rentalForm.controls['property_unit_details']; + + if(value.is_rent_agreement_executed=="1"){ + control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) + } + else{ + control.controls[index].removeControl('rent_agreement_seen'); + // after no + control.controls[index].removeControl('rent_agreement_registered'); + // after No + control.controls[index].removeControl('agreement_date'); + control.controls[index].removeControl('agreement_no_months'); + control.controls[index].removeControl('agreement_expiring_date'); + control.controls[index].removeControl('rental_remaining_months'); + control.controls[index].removeControl('agreement_monthly_rent_amount'); + control.controls[index].removeControl('agreement_security_deposit_amount'); + control.controls[index].removeControl('agreement_property_owners_name'); + control.controls[index].removeControl('agreement_tenant_lessees_name'); + control.controls[index].removeControl('differences_loanapplicant_rentagreement'); + // remove agrement other ownres + control.controls[index].removeControl('agreement_property_owner_other'); + control.controls[index].removeControl('agreement_property_owner_other_relationship'); + control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + } + + } + //genearate rent agreement registered options + generateRegisterOptions(value: any,index:number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(value.rent_agreement_seen=="1"){ + control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)); + } + else{ + control.controls[index].removeControl('rent_agreement_registered'); + // after No + control.controls[index].removeControl('agreement_date'); + control.controls[index].removeControl('agreement_no_months'); + control.controls[index].removeControl('agreement_expiring_date'); + control.controls[index].removeControl('rental_remaining_months'); + control.controls[index].removeControl('agreement_monthly_rent_amount'); + control.controls[index].removeControl('agreement_security_deposit_amount'); + control.controls[index].removeControl('agreement_property_owners_name'); + control.controls[index].removeControl('agreement_tenant_lessees_name'); + control.controls[index].removeControl('differences_loanapplicant_rentagreement'); + // remove agrement other ownres + control.controls[index].removeControl('agreement_property_owner_other'); + control.controls[index].removeControl('agreement_property_owner_other_relationship'); + control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + } + + } + //genearate if rent agreement yes registered details + generateRegisterDetails(value: any,index:number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(value.rent_agreement_registered=="1"){ + control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_expiring_date', new FormControl('')); + control.controls[index].addControl('rental_remaining_months', new FormControl('')); + control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)); + control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('')); + + } + else if(value.rent_agreement_registered=="0"){ + control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_expiring_date', new FormControl('')); + control.controls[index].addControl('rental_remaining_months', new FormControl('')); + control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)); + control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)); + control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('')); + } + else{ + control.controls[index].removeControl('agreement_date'); + control.controls[index].removeControl('agreement_no_months'); + control.controls[index].removeControl('agreement_expiring_date'); + control.controls[index].removeControl('rental_remaining_months'); + control.controls[index].removeControl('agreement_monthly_rent_amount'); + control.controls[index].removeControl('agreement_security_deposit_amount'); + control.controls[index].removeControl('agreement_property_owners_name'); + control.controls[index].removeControl('agreement_tenant_lessees_name'); + control.controls[index].removeControl('differences_loanapplicant_rentagreement'); + // remove agrement other ownres + control.controls[index].removeControl('agreement_property_owner_other'); + control.controls[index].removeControl('agreement_property_owner_other_relationship'); + control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + + } + + } + + // calculate expiry date + calculateExpiryDate(e: any,index){ + let control: any = this._rentalForm.controls['property_unit_details']; + let getSeletedDate: any=control.value[index].agreement_date ? this.pipe.transform(control.value[index].agreement_date, 'yyyy/MM/dd'): ''; + let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0'; + if(getSeletedDate && getEnteredMonth>0){ + let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth))); + modifySeletedDate.setDate(modifySeletedDate.getDate() - 1); + let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy'); + control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate); + // calculate remaining month + if(modifySeletedDate >= new Date()){ + let currentDate:any = new Date(); + currentDate = this.pipe.transform(currentDate, 'yyyy/MM/dd'); + let remaingMonths; + remaingMonths = (modifySeletedDate.getFullYear() - new Date().getFullYear()) * 12; + remaingMonths += modifySeletedDate.getMonth() - new Date().getMonth(); + control.controls[index].controls['rental_remaining_months'].setValue(remaingMonths); + } + else{ + control.controls[index].controls['rental_remaining_months'].setValue(0); + } + } + else { + control.controls[index].controls['agreement_expiring_date'].setValue(''); + control.controls[index].controls['rental_remaining_months'].setValue(''); + + } + + } + + // generate other owners as per rent agreement + generateAgreementOtherOwners(value:any,index:number) { + let control: any = this._rentalForm.controls['property_unit_details']; + if(value && value.length>0){ + let otherOwnerCheck = value.filter(fVal=>fVal.id==0); + otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); + otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); + otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + + } + else { + control.controls[index].removeControl('agreement_property_owner_other'); + control.controls[index].removeControl('agreement_property_owner_other_relationship'); + control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + } + } + + // validate agreement amount + validateAgreementAmt(actualRent:number,agreementRent:number){ + if(actualRent>0 && agreementRent>0){ + let calculatedValue = (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent) + return Math.abs(calculatedValue); + } + else{ + return "0"; + } + + } + + // generate tenant met details + generateTenantMetDetails(value: any, index: number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(value.met_tenant_lessees_options=="1"){ + // remove reason + control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); + + control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)); + control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)); + control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)); + control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)); + control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)); + control.controls[index].addControl('payment_difference_per_met', new FormControl('')); + + } + else{ + control.controls[index].removeControl('name_tenant_lessees_per_met'); + control.controls[index].removeControl('property_owner_per_met'); + control.controls[index].removeControl('paid_monthly_rent_per_met'); + control.controls[index].removeControl('period_of_stay_per_met'); + control.controls[index].removeControl('payment_mode_per_met'); + control.controls[index].removeControl('payment_difference_per_met'); + + + // remove other owner details + control.controls[index].removeControl('property_owner_other_per_met'); + control.controls[index].removeControl('property_owner_other_relationship_per_met'); + control.controls[index].removeControl('property_owner_other_relation_to_per_met'); + // remove paymnet options + control.controls[index].removeControl('amount_received_cash_per_met'); + control.controls[index].removeControl('amount_received_bank_per_met'); + control.controls[index].removeControl('payment_received_reason_per_met'); + // add reason + control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)); + + + } + } + + // generate met others owner + generateMetOtherOwners(value: any, index: number){ + let control: any = this._rentalForm.controls['property_unit_details']; + if(value.property_owner_per_met.length>0){ + let otherCheck: any = value.property_owner_per_met.filter(fVal=>fVal.id==0); + otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); + otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); + otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); + + } + else { + control.controls[index].removeControl('property_owner_other_per_met'); + control.controls[index].removeControl('property_owner_other_relationship_per_met'); + control.controls[index].removeControl('property_owner_other_relation_to_per_met'); + + } + + } + + // generate floor rows + generateFloor(e:any): void{ + let control = this._rentalForm.controls['multistoried_building_details']; + if(e.target.value && Math.round(e.target.value)!=0){ + + if(Math.round(e.target.value) > this._rentalForm.value.multistoried_building_details.length){ + let rowValue = Math.round(e.target.value)-this._rentalForm.value.multistoried_building_details.length; + for(let i=rowValue;i>0;i--){ + control.push(this.createFloorDetails('')); + } + } + else if(Math.round(e.target.value) < this._rentalForm.value.multistoried_building_details.length){ + let rowValue = this._rentalForm.value.multistoried_building_details.length-Math.round(e.target.value); + for(let i=rowValue;i>0;i--){ + control.removeAt(this._rentalForm.value.multistoried_building_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.multistoried_building_details.length==0 ? 'Ground Floor' : this._rentalForm.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])], + no_units_in_floor: ['', Validators.compose([Validators.required])], + unit_rent_difference_options : ['', Validators.compose([Validators.required])], + floor_unit_details : this._fb.array([]), + floor_rent_amount: [''], + }); + } + else{ + return this._fb.group({ + floor_level: [this._rentalForm.value.multistoried_building_details.length==0 ? 'Ground Floor' : this._rentalForm.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])], + no_units_in_floor: ['', Validators.compose([Validators.required])], + unit_rent_difference_options : ['', Validators.compose([Validators.required])], + floor_unit_details : this._fb.array([]), + floor_rent_amount: [''], + }); + } + + } + + // generate floor unit details + generateFloorUnit(values:any, index:number){ + let control: any = this._rentalForm.controls['multistoried_building_details']; + control = control.controls[index]; + control= control.controls['floor_unit_details']; + if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="0"){ + if(Math.round(values.no_units_in_floor) > control.value.length){ + let rowValue = Math.round(values.no_units_in_floor)-control.value.length; + for(let i=rowValue;i>0;i--){ + control.push(this.createFloorUnitDetails(2)); + } + } + else if(Math.round(values.no_units_in_floor) < control.value.length){ + let rowValue = control.value.length-Math.round(values.no_units_in_floor); + for(let i=rowValue;i>0;i--){ + control.removeAt(control.value.length-1); + } + } + else if(Math.round(values.no_units_in_floor)==0){ + control.controls = []; + control.setValue([]); + } + else{ + control.controls = []; + control.setValue([]); + } + this.calculateFloorRentAmt(values,index); + + } + else if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="1") { + control.controls = []; + control.setValue([]); + control.push(this.createFloorUnitDetails(1)); + this.calculateFloorRentAmt(values,index); + } + else { + control.controls = []; + control.setValue([]); + } + + } + + // create floor unit details + createFloorUnitDetails(type:number){ + if(type==1){ + return this._fb.group({ + rent_per_unit: ['', Validators.compose([Validators.required])], + amount: [''], + }); + } + else if(type==2){ + return this._fb.group({ + rent_per_unit: ['', Validators.compose([Validators.required])], + }); + } + + } + // calculate same rent amount + calculateFloorRentAmt(values: any, index: number){ + if(values.unit_rent_difference_options=="1"){ + let control: any = this._rentalForm.controls['multistoried_building_details']; + let unitcontrol = control.controls[index]; + unitcontrol= unitcontrol.controls['floor_unit_details']; + if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){ + unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor); + control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor); + } + else{ + unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(''); + control.controls[index].controls['floor_rent_amount'].setValue(''); + + } + } + else if(values.unit_rent_difference_options=="0"){ + let control: any = this._rentalForm.controls['multistoried_building_details']; + let unitcontrol = control.controls[index]; + unitcontrol= unitcontrol.controls['floor_unit_details']; + // console.log(unitcontrol) + let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!=''); + if(getunitValues.length>0){ + control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0)); + } + else{ + control.controls[index].controls['floor_rent_amount'].setValue(''); + + } + } + + } + + // 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 + } + compareSingleObjects(o1: any, o2: any) { + if(o1.id == o2.id) + return true; + else return false + } + + // save rental form + saveRental(formData: any) { + + formData.rental_count_id = this.rental_count_id; + + let ApplicantRentAmt : any =0; + let TenantRentAmt : any =0; + let TempArray1 : any = []; + let TempArray2 : any = []; + let textMessage : any; + + if(formData.property_unit_details.length > 0){ + + formData.property_unit_details.forEach((data,index) => { + + TempArray1[index] = data.hasOwnProperty('monthly_rent_amount') ? data.monthly_rent_amount : 0 ; + ApplicantRentAmt = TempArray1.reduce((sum, val) => sum + +val, 0); + TempArray2[index] = data.hasOwnProperty('paid_monthly_rent_per_met') ? data.paid_monthly_rent_per_met : 0 ; + TenantRentAmt = TempArray2.reduce((sum, val) => sum + +val, 0); + }) + textMessage = 'Monthly Rent as Per Loan Applicant = '+ApplicantRentAmt+'
'; + } + + + let FloorsTotalRentAmt : any = 0; + let Array : any = []; + if(formData.multistoried_building_details.length > 0){ + formData.multistoried_building_details.forEach((val,index) => { + + Array[index] = val.hasOwnProperty('floor_rent_amount')?val.floor_rent_amount:0; + FloorsTotalRentAmt = Array.reduce((sum, val) => sum + +val, 0); + }); + textMessage = textMessage +'Rent amount calculated = '+FloorsTotalRentAmt; + } + else{ + textMessage = textMessage +'Monthly Rent amount as Per Tenant met = '+TenantRentAmt; + } + + if (this._rentalForm.invalid) { + this.validateAllFormFields(this._rentalForm); + this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!'); + return; + } + else { + /** html: 'Rent as Per Tenant = '+TenantRentAmt+ '
'+'Rent as Per Applicant =' + ApplicantRentAmt , */ + Swal({ + title: 'Confirm The Rent Amount', + type: 'info', + html: textMessage, + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Confirm', + // cancelButtonText:'Cancel And Correct', + }).then((result) => { + if (result.value) { + // Swal(result.value); + // return; + this._pd.savePDFormDetailsWithID(formData).subscribe( + dataresult => { + if (dataresult.status == 200) { + this.notifier.notify('success', 'Saved Successfully.'); + setTimeout(() =>{ + this.dialogRef.close({update_status:true}); + },3000); + + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + return; + // this.errorMessage = "Some Thing Wents Wrong Try Again !"; + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + return; + // this.errorMessage = "Something Wents Wrong Try Again !"; + }); + } + else{ + // Swal('Sorry Try Again !'); + return; + } + }) + } + } + + // validate all form group and form array fields + validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); + } + + ngOnDestroy() { + // console.log('Component Destoryed'); + const index = this.data.parentData.pdapplicants_detials.findIndex(name => name.applicant_name === 'Others'); + this.data.parentData.pdapplicants_detials.splice(index, 1); + } + + } + + + \ 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 index 14f46964a..c9de3dba4 100644 --- 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 @@ -1,15 +1,12 @@ -
-

- + +

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} +
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}}
- -
- +
@@ -17,691 +14,35 @@

- - - Property Details - - - -
- -
- - Address of the Property - - -
-
- - - State - - - {{stVal.name}} - - - - - City - - - {{ctVal.city_name}} - - - - - - Pincode - - - {{pinVal.pincode}} - - - -
- Is This the Address Visited ? ( {{_rentalForm.value.validate_visited_address===true ? 'Yes' : 'No'}} ) -
- - Actual Address Visited - - -
- -
-
- - - 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}} - - - - - - - Who is {{_rentalForm.controls['other_person_met'].value}} ? - - - - - - - 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.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} - - - - - - - - Ownership Proof Documents Sighted - - Yes - No - - - - Type of Document Sighted - - {{prDocs.name | titlecase}} - - - - Other Type of Document - - - - - - - - - Nature of Let Out Property as per Loan Applicant - - - {{property.name}} - - - - - Other Property - - - - - - Type of Units as per Loan Applicants - - - - {{unit.name}} - - - - - - Specify Other Unit Type - - - - Tot No of Units - - - - No of Floors - - - - - Total Area Given on Rent - - - - - - - Unit of Measurement - - - {{unitM.name}} - - - - - - Other Unit of Measurement - - - - - -
-
-
- - - - - - - Floor Level Name - - - - - - No of Units - - - - Is Rent Same for All Units - - Yes - No - - - - - -
- - -
-
- - Rent per Unit - - {{"₹"}} {{fUnits.value.rent_per_unit | numberToWords}} Only - - - - Total Rent Amount - - {{"₹"}} {{fUnits.value.amount | numberToWords}} Only - -
-
-
- - -
-
- - Rent Unit {{fu+1}} - - {{"₹"}} {{fUnits.value.rent_per_unit | numberToWords}} Only - -
-
-
-
- - - -
- -
- - Total Rent Amount - - {{"₹"}} {{floor.value.floor_rent_amount | numberToWords}} Only - -
- -
-
-
- - - - - - - - - Unit {{u+1}} - - -
- - - Is Name of the Tenant(s)/Lessees(s) of the Let out Property Provided ? - - Yes - Name(s) not provided - - - - Name of Tenant(s)/Lessees(s) - - - - Why Tenant(s)/Lessees(s) Name not Provided - - - - - - - Monthly Rent Amount as per Loan Applicant - - - {{"₹"}} {{units.value.monthly_rent_amount | numberToWords}} Only - - - Mode of Payment of Rent as per Loan Applicant - - - {{payment.name}} - - - - - - Amount Received in Bank - - {{"₹"}} {{units.value.amount_received_bank | numberToWords}} Only - Given Value Is More Than Rent Amount - Given Value Is Less Than Rent Amount - - - - Amount Received in Cash - - {{"₹"}} {{units.value.amount_received_cash | numberToWords}} Only - Given Value Is More Than Rent Amount - Given Value Is Less Than Rent Amount - - - - - Reason for Receiving Multiple Payment Mode - - - - Securtity Deposit amount as per Loan Applicant - - {{"₹"}} {{units.value.securtity_deposit_amount | numberToWords}} Only - - - - - Area Covered by the Unit - - - - - - - Unit of Measurement - - - {{unitM.name}} - - - - - - Other Unit of Measurement - - - - - - Is Rent Agreement executed for the Property let out - - Yes - No - - - - - - - Rent Agreement Seen - - Yes - No - - - - - - Is the Rent Agreement Registered at Sub-Registrar Office - - Yes - No - - - - - - Date of Agreement - - - - - - - No of Months for Which Property has been let out as per Agreement - - - - - Date on which Agreement is Expiring - - - - No of Rental Months Remaining as per Agreement - - - - - - Monthly Rent Amount as per Agreement - - {{"₹"}} {{units.value.agreement_monthly_rent_amount | numberToWords}} Only - - - - - - Security Deposit Amount as per Agreement - - {{"₹"}} {{units.value.agreement_security_deposit_amount | numberToWords}} Only - - - - - - There is a Difference of Rs.{{validateAgreementAmt(units.value.monthly_rent_amount,units.value.agreement_monthly_rent_amount)}} in the rent amount as per agreement and actual rent received. Why? - - - - - - - Name of Owner / Owners of Rented Property as per Rent Agreement - - - - {{val.name}} - - - - - - Specify Other Owner/Owners - - - - Relation of Owner to Loan Applicant - - - - {{relation.name | titlecase}} - - - - - Relation To - - - {{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} - - - - - - - - Name of Tenants / Lessees as per Rent Agreement - - - - - - - - Tenant(s) / Lessee(s) Met During Visit of the Rented Property - - Yes - No - - - - Name of the Tenant / Lessee Met - - - - - Why Tenant / Lessee not Met ? - - - - - - - Name of Owner as per Tenant / Lessee Met - - - - {{val.name}} - - - - - - Specify Other Owner/Owners - - - - Relation of Owner to Loan Applicant - - - - {{relation.name | titlecase}} - - - - - Relation To - - - {{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}} - - - - - - - - Monthly Rent Amount Paid as per Tenant / Lessee Met - - {{"₹"}} {{units.value.paid_monthly_rent_per_met | numberToWords}} Only - - - - Period (Months) of Stay as per Tenant / Lessee Met - - - - - Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit - - - {{payment.name}} - - - - - Amount Paid in Bank - - {{"₹"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only - Given Value Is More Than Rent Amount - Given Value Is Less Than Rent Amount - - - Amount Paid in Cash - - {{"₹"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only - Given Value Is More Than Rent Amount - Given Value Is Less Than Rent Amount - - - - - Reason for Paid Multiple Payment Mode - - - - -
- - What is the Reason for Difference in Rent Amount - - -
- - - -
- -
- - - -
-
-
-
- -
-
- - - - - - - Third Party Check - - - -
- - - Third party check done on prevailing rent in the area - - Yes - No - - - - - Name of person with whom Third Party Check on going rentals in the area done - - - - Description of the person with whom the Third Party Check is done - - - - Rental rates in the area as per the person with whom Third Party Check is done - - - - Why Third party check not done - - - - - - - +
+ +
+
+
Property {{i+1}}
+
+
+
+
{{ad.address}}
+
+
{{ad.city}} - {{ad.state}} - {{ad.pincode}}
+ +
+
Annual Rent Amount as per Applicant : {{ad.applicants_rent}}
+
+ +
+
+
+
+ +
+
+
Add Property
+
+
+
+
-
-
- -
- - -
- - Remarks - - -
-
- -
- -
-
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 index 13b8a16c4..7f0c3ecf5 100644 --- 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 @@ -1,21 +1,52 @@ -.paragraph_change { +.dialog_title { color: #fff !important; - background-color: #e00201 !important; - } - mat-form-field { - margin: 0 2%; - } - ::ng-deep .cdk-global-overlay-wrapper{ - justify-content: center !important; + background-color: #e00201 !important; + } +.card-property { + height: 250px; + color: black; } -.align-margin { - margin-left: 2%; - margin-right: 2%; + +.card-property{ + padding: 2rem; + line-height: 1.3rem; } -.rent-unit { - margin-left: 2%; - margin-top: 1%; + +.addfont{ + font-size: 1.2rem !important; + font: 500 20px/32px Roboto, "Helvetica Neue", sans-serif !important; } -.total-rent-amt{ - margin-left: 1%; + +.fa:hover{ + color: #e00201 !important; +} + +.title { + font-size: 1.2rem !important; + line-height: 40px; +} + +.address { + font-size: 1.2rem !important; + line-height: 1.2rem; +} + +.desc { + font-size: 1.2rem !important; + line-height: 1.2rem; +} + +.amts { + height: 80px; +} + +.grad { + background: whitesmoke; + color:black; +} + +.temp { + font-size: 1.2rem !important; + color : #e00201 !important; + display: inline-block; } 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 index d08af73f8..98781b424 100644 --- 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 @@ -1,1077 +1,209 @@ -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 { DatePipe } from '@angular/common'; -import { Pipe, PipeTransform } from '@angular/core'; -import { NotifierService } from 'angular-notifier'; +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialog, MAT_DIALOG_DATA } from '@angular/material'; import { PdTrigerService } from './../../../../../pd-service/pd-triger.service'; -/**sweet alert */ -import Swal from 'sweetalert2'; +import { ManageRentalVerificationComponent } from './manage-rental-verification/manage-rental-verification.component'; + @Component({ selector: 'app-rental-verification', templateUrl: './rental-verification.component.html', styleUrls: ['./rental-verification.component.scss'], }) + export class RentalVerificationComponent implements OnInit { - - pipe = new DatePipe('en-US'); + + pageTitle: string = "Rental Information"; + parentData: any = []; + masterData: any = []; + + parent_pdid: string; + pdid: string; + form_id: number; + customer_segment_abbr: any; subproduct_abbr: any; lender_applicant_id: any; main_applicant: any; - pageTitle: string = "Rental Information"; - public _neighbourhoodForm: FormGroup; - parent_pdid: string; - 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"}]; - paymentPaidOptions: any=[{id:1,name:"Paid in Cash"},{id:2,name:"Paid through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}]; - 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=[]; - cityList:any=[]; - pincodeList:any=[]; - documentList: any=[{id:2,name:"Property Title Document"},{id:3,name:"Electricity Bill with name of owner mentioned therein"},{id:4,name:"Property tax Receipts"},{id:1,name:"Others (Please Specify)"}]; - //floorList: any=[{id:1,name:"Ground Floor"},{id:1,name:"First Floor"},{id:1,name:"Second Floor"},{id:1,name:"Third Floor"}] - //unitMeasurementList: any=[{id:2,name:"Square Feet"},{id:3,name:"Square Yards"},{id:4,name:"Square Meters"},{id:5,name:"Acres"},{id:6,name:"Hectares"},{id:1,name:"Others (Please Specify)"}]; - unitMeasurementList: any=[]; - SwalButtonText: string; - SwalMessage: string; - 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) { + + existCompanyList: any = []; + mergeCompanyApplicant: any = []; + relationToList: any = []; + unitTypeList: any = []; + stateList: any = []; + unitMeasurementList: any = []; + + existing_rental_list: any = []; + existing_rental_count_id: any; + + + constructor(private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialog: MatDialog) { + this.parentData = this.data; this.parent_pdid = this.data.pdmaster_details.parent_pd_id; 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 Floor',group_id:1}, - {id:4,name:'Independent House',group_id:1},{id:5,name:'Independent Row House',group_id:1},{id:6,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}]; + 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; + + 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 }) + this.masterData.mergeCompanyApplicant = this.mergeCompanyApplicant; + } + // set unit type list details + let resiDentialProperty = [{ id: 2, name: 'Independent Flat', group_id: 1 }, { id: 3, name: 'Independent Floor', group_id: 1 }, + { id: 4, name: 'Independent House', group_id: 1 }, { id: 5, name: 'Independent Row House', group_id: 1 }, { id: 6, 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({ groupID: 2, groupName: 'Residential Property', groupValues: resiDentialProperty }); + this.unitTypeList.push({ groupID: 3, groupName: 'Commercial Property', groupValues: commercialProperty }); + this.unitTypeList.push({ groupID: 4, groupName: 'Industrial Property', groupValues: industrialProperty }); + this.masterData.unitTypeList = this.unitTypeList; - 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({groupID:2,groupName:'Residential Property',groupValues:resiDentialProperty}); - this.unitTypeList.push({groupID:3,groupName:'Commercial Property',groupValues:commercialProperty}); - this.unitTypeList.push({groupID:4,groupName:'Industrial Property',groupValues:industrialProperty}); - } ngOnInit() { - this.initRentalForm(); - this.getMasterDetails('RELATIONSHIPS', 1); - this.getMasterDetails('COMPANYRELATIONSHIPS', 2); - this.getMasterDetails('STATE',3); - this.getMasterDetails('UOM',4); - 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}) - } - } - }); - //load form details with data - this.loadFormData(); - // 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'); - otherPersonMetCheck.length>0 ? '' : this._rentalForm.removeControl('other_name_person_type'); + this.getMasterDetails('STATE', 1); + this.getMasterDetails('UOM', 2); + this.loadFormData(); + } - - } - 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'); + /*** get all master details **/ + getMasterDetails(table: string, type: number) { + this._pd.getAllMasterDatas(table).subscribe( + data => { + if (data.status == 200) { + if (type == 1) { + this.stateList = data.records.filter(item => item.isactive == 1); + this.masterData.stateList = this.stateList; + } + else if (type == 2) { + this.unitMeasurementList = data.records.filter(item => item.isactive == 1 && item.is_land_uom == 1 || item.is_land_uom == 2).map(mval => ({ id: mval.uom_id, name: mval.name })) + this.masterData.unitMeasurementList = this.unitMeasurementList; + } + } + }); + } - } - 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'); - } - }); - // 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'); - }); + loadFormData() { + let params: any = {}; + params.parent_pdid = this.parent_pdid; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; - // 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==6 ? this._rentalForm.removeControl('no_units') : val.group_id==2 && val.id==7 ? this._rentalForm.removeControl('no_units') : this._rentalForm.addControl('no_units', new FormControl('')); - val.group_id==1 && val.id==6 ? 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==6 ? this._rentalForm.addControl('multistoried_total_area', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('multistoried_total_area', new FormControl('',Validators.required)) : this._rentalForm.removeControl('multistoried_total_area'); - val.group_id==1 && val.id==6 ? this._rentalForm.addControl('multistoried_uom', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('multistoried_uom', new FormControl('',Validators.required)) : this._rentalForm.removeControl('multistoried_uom'); - val.group_id==1 && val.id==6 ? '' : val.group_id==2 && val.id==7 ? '' : this._rentalForm.setControl('multistoried_building_details', this._fb.array([])); - }); + this._pd.retriveForm(params).subscribe(data => { - // observe visit address - this._rentalForm.controls['validate_visited_address'].valueChanges.subscribe(val => { - if(val===false){ - this._rentalForm.addControl('other_visited_address', new FormControl('', Validators.required)); - } - else { - this._rentalForm.removeControl('other_visited_address'); - } - }); - // get city list based on state changes - this._rentalForm.controls['state'].valueChanges.subscribe(val => { - this._pd.getStateWiseCities(val).subscribe(data => { - if (data.status == 200) { - this.cityList = data.records.cities; - this.pincodeList = data.records.pincode; - } + if (data.dataStatus) { + + let rentalVal = data.records; + let tempArray: any = []; + let amt: any = []; + this.existing_rental_count_id = rentalVal.length; + + rentalVal.forEach((RIV, inx) => { + let annualRentAmt: any; + // get property unit details + if (RIV.property_unit_details) { + let selectedUnitDetails = Object.keys(RIV.property_unit_details).map(function (key) { + return RIV.property_unit_details[key]; }); - }); - - // ownership property documents during the visit - this._rentalForm.controls['property_ownership_proof_documents'].valueChanges.subscribe(val => { - val=="1" ? this._rentalForm.addControl('sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('sighted_documents'); - val=="1" ? '' : this._rentalForm.removeControl('other_sighted_documents'); - }); - - // listen third party check - this._rentalForm.controls['done_third_party_check'].valueChanges.subscribe(val => { - val=="1" ? this._rentalForm.addControl('whom_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('whom_third_party_check_done'); - val=="1" ? this._rentalForm.addControl('description_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('description_third_party_check_done'); - val=="1" ? this._rentalForm.addControl('rental_rates_third_party_check_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('rental_rates_third_party_check_done'); - val=="0" ? this._rentalForm.addControl('why_third_party_check_not_done', new FormControl('', Validators.required)) : this._rentalForm.removeControl('why_third_party_check_not_done'); - }); - } - - initRentalForm() { - return this._rentalForm = this._fb.group({ - parent_pdid: this.parent_pdid, - pdid: this.pdid, - formid: this.form_id, - address_property:['',Validators.required], - state:['',Validators.required], - city:['',Validators.required], - pincode:['',Validators.required], - validate_visited_address:[true], - person_met: ['',Validators.required], - property_owner: ['',Validators.required], - property_ownership_proof_documents: ['',Validators.required], - nature_property: ['',Validators.required], - unit_type:['',Validators.required], - no_units:[''], - multistoried_building_details: this._fb.array([]), - property_unit_details : this._fb.array([]), - done_third_party_check :['',Validators.required], - rental_remark: [''], - }); -} - // 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'); -} -} - -// dynamic form control generate for other documents sighted -getSightedDocs(value): void{ - value.id==1 ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); -} - -/*** 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}):''; - } - else 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}):''; - } - else if(type==3) { - this.stateList = data.records.filter(item => item.isactive == 1); - } - else if(type==4){ - this.unitMeasurementList = data.records.filter(item => item.isactive == 1 && item.is_land_uom == 1 || item.is_land_uom == 2).map(mval=>({id : mval.uom_id , name:mval.name})) - - } - - } - }); -} -// load form data -loadFormData(){ - let params: any = {}; - params.parent_pdid =this.parent_pdid; - params.pd_id = this.pdid; - params.pd_form_id = this.form_id; - this._pd.retriveForm(params).subscribe(data => { - if(data.dataStatus){ - let rentalVal = data.records; - rentalVal.pdid = this.pdid; - rentalVal.formid = this.form_id; - rentalVal.other_name_person_type ? this._rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)): this._rentalForm.removeControl('other_name_person_type'); - rentalVal.other_sighted_documents ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); - - //get Multistoried Building Details - if(data.records.multistoried_building_details){ - let selectedMultistoriedBuilding = Object.keys(data.records.multistoried_building_details).map(function (key) { - return data.records.multistoried_building_details[key]; - }); - if(selectedMultistoriedBuilding.length>0){ - let control: any = this._rentalForm.controls['multistoried_building_details']; - selectedMultistoriedBuilding.forEach((floorElement,floorIndex)=>{ - control.push(this.createFloorDetails('')); - let unitControl = control.controls[floorIndex]; - unitControl= unitControl.controls['floor_unit_details']; - floorElement.floor_unit_details.forEach((unitElement,unitIndex) => { - floorElement.unit_rent_difference_options=="0" ? unitControl.push(this.createFloorUnitDetails(2)) : unitControl.push(this.createFloorUnitDetails(1)); - }); - }); - } - } - // get property unit details - if(data.records.property_unit_details){ - let selectedUnitDetails = Object.keys(data.records.property_unit_details).map(function (key) { - return data.records.property_unit_details[key]; - }); - if(selectedUnitDetails.length>0){ - selectedUnitDetails.forEach((element,index) => { - let control: any = this._rentalForm.controls['property_unit_details']; - control.push(this.createUnitDetails('')); - (element.name_tenant_lessees && element.tenant_lessees_options=="1") ? control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees'); - (element.name_tenant_lessees_reason && element.tenant_lessees_options=="0") ? control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason'); - // for payment options - element.amount_received_cash ? control.controls[index].addControl('amount_received_cash', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash'); - element.amount_received_bank ? control.controls[index].addControl('amount_received_bank', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank'); - element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); - - if(element.payment_mode){ - let ChildCtrl : any = control.controls[index]; - - if(element.payment_mode.id == 1 && element.amount_received_cash){ - - ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]); - ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); - } - else if(element.payment_mode.id == 2 && element.amount_received_bank){ - - ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]); - ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); - } - else if(element.payment_mode.id == 3 && element.amount_received_bank && element.amount_received_cash){ - - this.ValidatedRentAmount(element,index,1); - } - } - - - // unit of other measurement - element.other_unit_measurement ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); - // rent agreement seen - element.rent_agreement_seen ? control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_seen'); - element.rent_agreement_registered ? control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_registered'); - element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date'); - element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months'); - element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date'); - (element.rental_remaining_months=='' || element.rental_remaining_months>=0) ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months'); - element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount'); - element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount'); - element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement'); - - //agreement owners - element.agreement_property_owners_name ? control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owners_name'); - element.agreement_property_owner_other ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); - element.agreement_property_owner_other_relationship ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); - element.agreement_property_owner_other_relation_to ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - - // name of tenant/lessess as agreement - element.agreement_tenant_lessees_name ? control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_tenant_lessees_name'); - - //met tenant details - element.name_tenant_lessees_per_met ? control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_per_met'); - element.name_tenant_lessees_reason_per_met ? control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); - element.property_owner_per_met ? control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_per_met'); - element.property_owner_other_per_met ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); - element.property_owner_other_relationship_per_met ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); - element.property_owner_other_relation_to_per_met ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); - - // tennat payment - element.paid_monthly_rent_per_met ? control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('paid_monthly_rent_per_met'); - element.period_of_stay_per_met ? control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('period_of_stay_per_met'); - element.payment_mode_per_met ? control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_mode_per_met'); - element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); - element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_cash_per_met'); - element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_bank_per_met'); - element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met'); - (element.met_tenant_lessees_options=="1") ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met'); - - if(element.payment_mode_per_met){ - - let ChildCtrl : any = control.controls[index]; - if(element.payment_mode_per_met.id == 1){ - - ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]); - ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); - } - else if(element.payment_mode_per_met.id == 2){ - - ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]); - ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); - } - else if(element.payment_mode_per_met.id == 3){ - - this.ValidatedRentAmount(element,index,2); - } - } - }); - } - } - - this._rentalForm.patchValue(rentalVal); - - } - else{ - let control: any = this._rentalForm.controls['property_unit_details']; - control.push(this.createUnitDetails('')); - - } - - - }); -} - -// add more unit details -addMoreUnitDetails(){ - let control: any = this._rentalForm.controls['property_unit_details']; - //control.push(this.createUnitDetails('')); - control.push(this.createUnitDetails('')); -} - - // create unit details - createUnitDetails(details){ - return this._fb.group({ - tenant_lessees_options:['1',Validators.required], - name_tenant_lessees:['',Validators.required], - monthly_rent_amount: ['',Validators.required], - payment_mode: ['',Validators.required], - securtity_deposit_amount: ['',Validators.required], - property_cover_area: ['',Validators.required], - unit_measurement: ['',Validators.required], - is_rent_agreement_executed: ['',Validators.required], - met_tenant_lessees_options: ['',Validators.required], - }); - } - - // remove unit - removeUnit(index) { - let control: any = this._rentalForm.controls['property_unit_details']; - control.removeAt(index); - } - - // generate payment dynamic fields - generatePaymentOptions(value:any,index:number,type: number){ - // console.log('generatePaymentOptions',value,index,type); - if(type==1){ - let control: any = this._rentalForm.controls['property_unit_details']; - let monthlyrentamt : number = value.monthly_rent_amount ; - - if(value && value.payment_mode.id==1){ - control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)])); - control.controls[index].removeControl('amount_received_bank'); - control.controls[index].removeControl('payment_received_reason'); - } - else if(value && value.payment_mode.id==2){ - control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)])); - control.controls[index].removeControl('amount_received_cash'); - control.controls[index].removeControl('payment_received_reason'); - } - else if(value && value.payment_mode.id==3){ - control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', Validators.required)); - control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', Validators.required)); - control.controls[index].addControl('payment_received_reason', new FormControl(value.payment_received_reason ? value.payment_received_reason : '', Validators.required)); - } - else { - control.controls[index].removeControl('amount_received_cash'); - control.controls[index].removeControl('amount_received_bank'); - control.controls[index].removeControl('payment_received_reason'); - } - } - else if(type==2){ - let control: any = this._rentalForm.controls['property_unit_details']; - let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met ; - if(value && value.payment_mode_per_met.id==1){ - control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)])); - control.controls[index].removeControl('amount_received_bank_per_met'); - control.controls[index].removeControl('payment_received_reason_per_met'); - } - else if(value && value.payment_mode_per_met.id==2){ - control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)])); - control.controls[index].removeControl('amount_received_cash_per_met'); - control.controls[index].removeControl('payment_received_reason_per_met'); - } - else if(value && value.payment_mode_per_met.id==3){ - control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', Validators.required)); - control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', Validators.required)); - control.controls[index].addControl('payment_received_reason_per_met', new FormControl(value.payment_received_reason_per_met ? value.payment_received_reason_per_met : '', Validators.required)); - } - else { - control.controls[index].removeControl('amount_received_cash_per_met'); - control.controls[index].removeControl('amount_received_bank_per_met'); - control.controls[index].removeControl('payment_received_reason_per_met'); - } - let child = control.controls[index] as FormGroup; - - if(child.controls.payment_difference_per_met){ - child.controls.payment_difference_per_met.setValue(''); - child.controls.payment_difference_per_met.updateValueAndValidity(); - } - else{ - console.log('There is NO Control'); - } - - } - - - } - - ValidatedRentAmount(value:any,index:number,type: number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(type==1){ - let monthlyrentamt : any = value.monthly_rent_amount ; - if(value && value.payment_mode.id==3){ - let ChildCtrl : any = control.controls[index]; - ChildCtrl.controls['amount_received_bank'].clearValidators(); - ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); - ChildCtrl.controls['amount_received_cash'].clearValidators();; - ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); - - if(monthlyrentamt != ''){ - - let bank_amount = value.amount_received_bank; - - ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(monthlyrentamt),Validators.min(0)]); - ChildCtrl.controls['amount_received_bank'].updateValueAndValidity(); - let remainingAmt = monthlyrentamt-bank_amount - if(remainingAmt >= 0 ){ - ChildCtrl.controls['amount_received_cash'].setValue(remainingAmt); - ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(monthlyrentamt-bank_amount),Validators.min(monthlyrentamt-bank_amount)]); - } - else{ - ChildCtrl.controls['amount_received_cash'].setValue(0); - ChildCtrl.controls['amount_received_cash'].setValidators([Validators.max(0),Validators.min(0)]); - } - ChildCtrl.controls['amount_received_cash'].updateValueAndValidity(); - - } - } - } - if(type==2 && value.payment_mode_per_met != ''){ - - if(value && value.payment_mode_per_met.id==3){ - - let ChildCtrl : any = control.controls[index]; - ChildCtrl.controls['amount_received_bank_per_met'].clearValidators(); - ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); - ChildCtrl.controls['amount_received_cash_per_met'].clearValidators();; - ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); - let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met; - - if(paidmonthlyrentamt != ''){ - - let bank_amount = value.amount_received_bank_per_met; - ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(0)]); - ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity(); - let remainingAmt = paidmonthlyrentamt-bank_amount - if(remainingAmt >= 0 ){ - ChildCtrl.controls['amount_received_cash_per_met'].setValue(remainingAmt); - ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt-bank_amount),Validators.min(paidmonthlyrentamt-bank_amount)]); + if (selectedUnitDetails.length > 0) { + selectedUnitDetails.forEach((element, index) => { + tempArray[index] = element.monthly_rent_amount; + annualRentAmt = tempArray.reduce((sum, val) => sum + +val, 0); + annualRentAmt = annualRentAmt * 12; + }); + } + else { + annualRentAmt = 0; + } + amt[inx] = annualRentAmt; } - else{ - ChildCtrl.controls['amount_received_cash_per_met'].setValue(0); - ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.max(0),Validators.min(0)]); - } - ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity(); - } + this._pd.getStateCityNamesAndPincode({ "state_id": RIV.state, "city_id": RIV.city, "pincode_id": RIV.pincode }).subscribe(data => { + if (data.dataStatus) { + let objs = { + 'address': RIV.address_property, + 'applicants_rent': amt[inx], + 'state': data.records.state_name, + 'city': data.records.city_name, + 'pincode': data.records.pincode, + 'rental_count_id': RIV.rental_count_id, + 'rental_existing_data': RIV + } + this.existing_rental_list.push(objs); + + } + }); + + }) } - - } - } -// tenant/lessees options -generateTenantOptions(value:any,index:number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(value.tenant_lessees_options=="1"){ - control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)); - control.controls[index].removeControl('name_tenant_lessees_reason'); - } - else if(value.tenant_lessees_options=="0"){ - control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)); - control.controls[index].removeControl('name_tenant_lessees'); - } - else { - control.controls[index].removeControl('name_tenant_lessees'); - control.controls[index].removeControl('name_tenant_lessees_reason'); - } - } - - // unit of measurement generate other field - generateOtherunitMeasurement(value: any,index:number){ - let control: any = this._rentalForm.controls['property_unit_details']; - value.unit_measurement.id=="1" ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); - -} -// generate multistoried other uom -generateMultistoriedOtherUOM(value: any){ - value.multistoried_uom.id=="1" ? this._rentalForm.addControl('multistoried_other_uom', new FormControl('', Validators.required)) : this._rentalForm.removeControl('multistoried_other_uom'); -} -// generate Rent AgreementSeen -generateRentAgreementSeen(value: any,index:number){ - let control: any = this._rentalForm.controls['property_unit_details']; - - if(value.is_rent_agreement_executed=="1"){ - control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) - } - else{ - control.controls[index].removeControl('rent_agreement_seen'); - // after no - control.controls[index].removeControl('rent_agreement_registered'); - // after No - control.controls[index].removeControl('agreement_date'); - control.controls[index].removeControl('agreement_no_months'); - control.controls[index].removeControl('agreement_expiring_date'); - control.controls[index].removeControl('rental_remaining_months'); - control.controls[index].removeControl('agreement_monthly_rent_amount'); - control.controls[index].removeControl('agreement_security_deposit_amount'); - control.controls[index].removeControl('agreement_property_owners_name'); - control.controls[index].removeControl('agreement_tenant_lessees_name'); - control.controls[index].removeControl('differences_loanapplicant_rentagreement'); - // remove agrement other ownres - control.controls[index].removeControl('agreement_property_owner_other'); - control.controls[index].removeControl('agreement_property_owner_other_relationship'); - control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - } - -} -//genearate rent agreement registered options -generateRegisterOptions(value: any,index:number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(value.rent_agreement_seen=="1"){ - control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)); - } - else{ - control.controls[index].removeControl('rent_agreement_registered'); - // after No - control.controls[index].removeControl('agreement_date'); - control.controls[index].removeControl('agreement_no_months'); - control.controls[index].removeControl('agreement_expiring_date'); - control.controls[index].removeControl('rental_remaining_months'); - control.controls[index].removeControl('agreement_monthly_rent_amount'); - control.controls[index].removeControl('agreement_security_deposit_amount'); - control.controls[index].removeControl('agreement_property_owners_name'); - control.controls[index].removeControl('agreement_tenant_lessees_name'); - control.controls[index].removeControl('differences_loanapplicant_rentagreement'); - // remove agrement other ownres - control.controls[index].removeControl('agreement_property_owner_other'); - control.controls[index].removeControl('agreement_property_owner_other_relationship'); - control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - } - -} -//genearate if rent agreement yes registered details -generateRegisterDetails(value: any,index:number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(value.rent_agreement_registered=="1"){ - control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_expiring_date', new FormControl('')); - control.controls[index].addControl('rental_remaining_months', new FormControl('')); - control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)); - control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('')); - - } - else if(value.rent_agreement_registered=="0"){ - control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_expiring_date', new FormControl('')); - control.controls[index].addControl('rental_remaining_months', new FormControl('')); - control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)); - control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)); - control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('')); - } - else{ - control.controls[index].removeControl('agreement_date'); - control.controls[index].removeControl('agreement_no_months'); - control.controls[index].removeControl('agreement_expiring_date'); - control.controls[index].removeControl('rental_remaining_months'); - control.controls[index].removeControl('agreement_monthly_rent_amount'); - control.controls[index].removeControl('agreement_security_deposit_amount'); - control.controls[index].removeControl('agreement_property_owners_name'); - control.controls[index].removeControl('agreement_tenant_lessees_name'); - control.controls[index].removeControl('differences_loanapplicant_rentagreement'); - // remove agrement other ownres - control.controls[index].removeControl('agreement_property_owner_other'); - control.controls[index].removeControl('agreement_property_owner_other_relationship'); - control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - - } - -} - -// calculate expiry date -calculateExpiryDate(e: any,index){ - let control: any = this._rentalForm.controls['property_unit_details']; - let getSeletedDate: any=control.value[index].agreement_date ? this.pipe.transform(control.value[index].agreement_date, 'yyyy/MM/dd'): ''; - let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0'; - if(getSeletedDate && getEnteredMonth>0){ - let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth))); - modifySeletedDate.setDate(modifySeletedDate.getDate() - 1); - let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy'); - control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate); - // calculate remaining month - if(modifySeletedDate >= new Date()){ - let currentDate:any = new Date(); - currentDate = this.pipe.transform(currentDate, 'yyyy/MM/dd'); - let remaingMonths; - remaingMonths = (modifySeletedDate.getFullYear() - new Date().getFullYear()) * 12; - remaingMonths += modifySeletedDate.getMonth() - new Date().getMonth(); - control.controls[index].controls['rental_remaining_months'].setValue(remaingMonths); - } - else{ - control.controls[index].controls['rental_remaining_months'].setValue(0); - } - } - else { - control.controls[index].controls['agreement_expiring_date'].setValue(''); - control.controls[index].controls['rental_remaining_months'].setValue(''); - - } - -} - -// generate other owners as per rent agreement -generateAgreementOtherOwners(value:any,index:number) { - let control: any = this._rentalForm.controls['property_unit_details']; - if(value && value.length>0){ - let otherOwnerCheck = value.filter(fVal=>fVal.id==0); - otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); - otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); - otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - - } - else { - control.controls[index].removeControl('agreement_property_owner_other'); - control.controls[index].removeControl('agreement_property_owner_other_relationship'); - control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - } -} - -// validate agreement amount -validateAgreementAmt(actualRent:number,agreementRent:number){ - if(actualRent>0 && agreementRent>0){ - let calculatedValue = (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent) - return Math.abs(calculatedValue); - } - else{ - return "0"; - } - -} - -// generate tenant met details -generateTenantMetDetails(value: any, index: number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(value.met_tenant_lessees_options=="1"){ - // remove reason - control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); - - control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)); - control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)); - control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)); - control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)); - control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)); - control.controls[index].addControl('payment_difference_per_met', new FormControl('')); - - } - else{ - control.controls[index].removeControl('name_tenant_lessees_per_met'); - control.controls[index].removeControl('property_owner_per_met'); - control.controls[index].removeControl('paid_monthly_rent_per_met'); - control.controls[index].removeControl('period_of_stay_per_met'); - control.controls[index].removeControl('payment_mode_per_met'); - control.controls[index].removeControl('payment_difference_per_met'); - - - // remove other owner details - control.controls[index].removeControl('property_owner_other_per_met'); - control.controls[index].removeControl('property_owner_other_relationship_per_met'); - control.controls[index].removeControl('property_owner_other_relation_to_per_met'); - // remove paymnet options - control.controls[index].removeControl('amount_received_cash_per_met'); - control.controls[index].removeControl('amount_received_bank_per_met'); - control.controls[index].removeControl('payment_received_reason_per_met'); - // add reason - control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)); - - - } -} - -// generate met others owner -generateMetOtherOwners(value: any, index: number){ - let control: any = this._rentalForm.controls['property_unit_details']; - if(value.property_owner_per_met.length>0){ - let otherCheck: any = value.property_owner_per_met.filter(fVal=>fVal.id==0); - otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); - otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); - otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); - -} -else { - control.controls[index].removeControl('property_owner_other_per_met'); - control.controls[index].removeControl('property_owner_other_relationship_per_met'); - control.controls[index].removeControl('property_owner_other_relation_to_per_met'); - -} - -} - -// generate floor rows -generateFloor(e:any): void{ - let control = this._rentalForm.controls['multistoried_building_details']; - if(e.target.value && Math.round(e.target.value)!=0){ - - if(Math.round(e.target.value) > this._rentalForm.value.multistoried_building_details.length){ - let rowValue = Math.round(e.target.value)-this._rentalForm.value.multistoried_building_details.length; - for(let i=rowValue;i>0;i--){ - control.push(this.createFloorDetails('')); + else { + this.existing_rental_count_id = 0; } - } - else if(Math.round(e.target.value) < this._rentalForm.value.multistoried_building_details.length){ - let rowValue = this._rentalForm.value.multistoried_building_details.length-Math.round(e.target.value); - for(let i=rowValue;i>0;i--){ - control.removeAt(this._rentalForm.value.multistoried_building_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.multistoried_building_details.length==0 ? 'Ground Floor' : this._rentalForm.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])], - no_units_in_floor: ['', Validators.compose([Validators.required])], - unit_rent_difference_options : ['', Validators.compose([Validators.required])], - floor_unit_details : this._fb.array([]), - floor_rent_amount: [''], - }); - } - else{ - return this._fb.group({ - floor_level: [this._rentalForm.value.multistoried_building_details.length==0 ? 'Ground Floor' : this._rentalForm.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])], - no_units_in_floor: ['', Validators.compose([Validators.required])], - unit_rent_difference_options : ['', Validators.compose([Validators.required])], - floor_unit_details : this._fb.array([]), - floor_rent_amount: [''], - }); - } - -} - -// generate floor unit details -generateFloorUnit(values:any, index:number){ - let control: any = this._rentalForm.controls['multistoried_building_details']; - control = control.controls[index]; - control= control.controls['floor_unit_details']; - if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="0"){ - if(Math.round(values.no_units_in_floor) > control.value.length){ - let rowValue = Math.round(values.no_units_in_floor)-control.value.length; - for(let i=rowValue;i>0;i--){ - control.push(this.createFloorUnitDetails(2)); - } - } - else if(Math.round(values.no_units_in_floor) < control.value.length){ - let rowValue = control.value.length-Math.round(values.no_units_in_floor); - for(let i=rowValue;i>0;i--){ - control.removeAt(control.value.length-1); - } - } - else if(Math.round(values.no_units_in_floor)==0){ - control.controls = []; - control.setValue([]); - } - else{ - control.controls = []; - control.setValue([]); - } - this.calculateFloorRentAmt(values,index); - - } - else if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="1") { - control.controls = []; - control.setValue([]); - control.push(this.createFloorUnitDetails(1)); - this.calculateFloorRentAmt(values,index); - } - else { - control.controls = []; - control.setValue([]); - } - -} - -// create floor unit details -createFloorUnitDetails(type:number){ - if(type==1){ - return this._fb.group({ - rent_per_unit: ['', Validators.compose([Validators.required])], - amount: [''], - }); - } - else if(type==2){ - return this._fb.group({ - rent_per_unit: ['', Validators.compose([Validators.required])], - }); - } - -} -// calculate same rent amount -calculateFloorRentAmt(values: any, index: number){ - if(values.unit_rent_difference_options=="1"){ - let control: any = this._rentalForm.controls['multistoried_building_details']; - let unitcontrol = control.controls[index]; - unitcontrol= unitcontrol.controls['floor_unit_details']; - if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){ - unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor); - control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor); - } - else{ - unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(''); - control.controls[index].controls['floor_rent_amount'].setValue(''); - - } - } - else if(values.unit_rent_difference_options=="0"){ - let control: any = this._rentalForm.controls['multistoried_building_details']; - let unitcontrol = control.controls[index]; - unitcontrol= unitcontrol.controls['floor_unit_details']; - // console.log(unitcontrol) - let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!=''); - if(getunitValues.length>0){ - control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0)); - } - else{ - control.controls[index].controls['floor_rent_amount'].setValue(''); - - } - } - -} - - // 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 - } - compareSingleObjects(o1: any, o2: any) { - if(o1.id == o2.id) - return true; - else return false - } - -// save rental form -saveRental(formData: any) { - - - - let ApplicantRentAmt : any ; - let TenantRentAmt : any ; - let TempArray1 : any = []; - let TempArray2 : any = []; - let textMessage : any; - - if(formData.property_unit_details.length > 0){ - - formData.property_unit_details.forEach((data,index) => { - TempArray1[index] = data.monthly_rent_amount; - ApplicantRentAmt = TempArray1.reduce((sum, val) => sum + +val, 0); - TempArray2[index] = data.paid_monthly_rent_per_met; - TenantRentAmt = TempArray2.reduce((sum, val) => sum + +val, 0); - }) - textMessage = 'Monthly Rent as Per Loan Applicant = '+ApplicantRentAmt+'
'; - } - - - let FloorsTotalRentAmt : any ; - let Array : any = []; - if(formData.multistoried_building_details.length > 0){ - formData.multistoried_building_details.forEach((val,index) => { - - Array[index] = val.floor_rent_amount; - FloorsTotalRentAmt = Array.reduce((sum, val) => sum + +val, 0); }); - textMessage = textMessage +'Rent amount calculated = '+FloorsTotalRentAmt; } - else{ - textMessage = textMessage +'Monthly Rent amount as Per Tenant met = '+TenantRentAmt; - } - - - - - if (this._rentalForm.invalid) { - this.validateAllFormFields(this._rentalForm); - this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!'); - return; - } - else { - /** html: 'Rent as Per Tenant = '+TenantRentAmt+ '
'+'Rent as Per Applicant =' + ApplicantRentAmt , */ - Swal({ - title: 'Confirm The Rent Amount', - type: 'info', - html: textMessage, - showCancelButton: true, - confirmButtonColor: '#3085d6', - cancelButtonColor: '#d33', - confirmButtonText: 'Confirm', - // cancelButtonText:'Cancel And Correct', - }).then((result) => { - if (result.value) { - // Swal(result.value); - // return; - this._pd.savePDFormDetailsWithID(formData).subscribe( - dataresult => { - if (dataresult.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() => { - this.dialogRef.close(); - }, 3000); - } - else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - return; - // this.errorMessage = "Some Thing Wents Wrong Try Again !"; - } - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - return; - // this.errorMessage = "Something Wents Wrong Try Again !"; - }); + // add more RI Details + addMoreRIDetails(): void { + let passValues: any = { + manage_status: 1, + parentData: this.parentData, + masterData: this.masterData, + existing_rental_count_id: this.existing_rental_count_id + 1, } - else{ - // Swal('Sorry Try Again !'); - return; - } - }) + const dialogRef = this.dialog.open(ManageRentalVerificationComponent, { + data: passValues, + maxWidth: '100vw', + maxHeight: '100vh', + height: '100%', + width: '100%', + disableClose: true + }); + dialogRef.afterClosed().subscribe(dataresult => { + if (dataresult.update_status == true) { + this.existing_rental_list = []; + this.loadFormData(); + } + }); + } -} + editRIDetails(RentalDatas: any) { -// validate all form group and form array fields -validateAllFormFields(formGroup: any) { - Object.keys(formGroup.controls).forEach(field => { - const control = formGroup.get(field); - - if (control instanceof FormControl) { - control.markAsTouched({ onlySelf: true }); - } else if (control instanceof FormGroup) { - this.validateAllFormFields(control); - } else if (control instanceof FormArray) { - this.validateAllFormFields(control); + let passValues: any = { + manage_status: 2, + parentData: this.parentData, + masterData: this.masterData, + existing_rental_count_id: RentalDatas.rental_count_id, + editData: RentalDatas } - }); -} - -ngOnDestroy() { - // console.log('Component Destoryed'); - const index = this.data.pdapplicants_detials.findIndex(name => name.applicant_name === 'Others'); - this.data.pdapplicants_detials.splice(index, 1); -} - -} + const dialogRef = this.dialog.open(ManageRentalVerificationComponent, { + data: passValues, + maxWidth: '100vw', + maxHeight: '100vh', + height: '100%', + width: '100%', + disableClose: true + }); + dialogRef.afterClosed().subscribe(dataresult => { + if (dataresult.update_status == true) { + this.existing_rental_list = []; + this.loadFormData(); + } + }); + } + ngOnDestroy() { + const index = this.data.pdapplicants_detials.findIndex(name => name.applicant_name === 'Others'); + this.data.pdapplicants_detials.splice(index, 1); + } +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index f4ed49068..4d357c1e1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -4,51 +4,92 @@
- - - - {{master.lender_short_name}} - - - {{master.branch_name}} - - - {{master.lender_applicant_id}} - - - {{master.pd_date_of_initiation}} - - - - {{master.product_name}} - - - {{master.subproduct_name}} - - - {{master.loan_amount}} - - - + + + +
+
+
{{master.pd_type_name}} - +
+
+
+
+ +
+
+
+ {{master.lender_short_name}} +
+
+ {{master.branch_name}} +
+
+
+
+
+ + +
+
+
+ {{master.lender_applicant_id}} +
+
+ {{master.pd_date_of_initiation}} +
+
+
+
+
+ +
+
+
+ {{master.product_name}}
+ {{master.subproduct_name}} +
+ +
+
+
+
+ +
+
+ +
+ {{master.loan_amount}} +
+
+
+
+ +
+ Lender Contact Details + + + {{master.pd_contact_person}} + + + {{master.pd_contact_mobileno}} + + +
- - - - - - -
-
+
+ + + +
@@ -57,7 +98,93 @@
- + + + +
+
+ +
+
+
+ {{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.pd_status | titlecase}} +
+
+ + + + +
+
+
+
+
+
+
+ {{master.pd_allocated_to | titlecase}} +
+
+ {{master.executive_name | titlecase}} +
+
+ {{master.centralofficer | titlecase}} +
+
+
+ {{master.scheduled_on}} +
+
+
+
+
+
+
+ + + + + + + +
+
+
+ {{addresses.addtional_pd_data[0].pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : addresses.addtional_pd_data[0].pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : addresses.addtional_pd_data[0].pd_status | titlecase}} +
+
+ + + +
+
+
+
+
+ {{addresses.addtional_pd_data[0].pd_allocated_to | titlecase}} +
+
+ {{addresses.addtional_pd_data[0].executive_name | titlecase}} +
+
+ {{addresses.addtional_pd_data[0].centralofficer | titlecase}} +
+
+
+ {{addresses.addtional_pd_data[0].scheduled_on}} +
+
+
+
+
+
+ +
+
+
@@ -71,114 +198,20 @@
- -
-
- - -
-
- {{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.pd_status | titlecase}} -
-
- - - - -
-
-
-
-
- {{master.pd_allocated_to | titlecase}} -
-
- {{master.executive_name | titlecase}} -
-
- {{master.centralofficer | titlecase}} -
-
-
- {{master.scheduled_on}} -
-
- -
-
-
- - - - - - - - -
-
- {{addresses.addtional_pd_data[0].pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : addresses.addtional_pd_data[0].pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : addresses.addtional_pd_data[0].pd_status | titlecase}} -
-
- - - -
-
-
-
-
- {{addresses.addtional_pd_data[0].pd_allocated_to | titlecase}} -
-
- {{addresses.addtional_pd_data[0].executive_name | titlecase}} -
-
- {{addresses.addtional_pd_data[0].centralofficer | titlecase}} -
-
-
- {{addresses.addtional_pd_data[0].scheduled_on}} -
-
-
-
- -
+
-
- - - Lender Contact Details - - - - - {{master.pd_contact_person}} - - - {{master.pd_contact_mobileno}} - - - - -
+
- - - Remarks + + + Remarks

{{master.remarks}}

-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss index ca365439f..dc3c39ef2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss @@ -1,3 +1,4 @@ + .cardEdit { float:right; padding-top:3%; @@ -12,7 +13,12 @@ .metaDataStyle{ height:89px !important; } - +.headerdesign{ + border-radius: 5px !important; + // border-bottom-left-radius: 5px !important; + // border-bottom-right-radius: 5px !important; + box-shadow: 0 5px 11px 0 rgba(0,0,0,.18), 0 4px 15px 0 rgba(0,0,0,.15) !important; +} :host { margin-left: -5px; @@ -35,12 +41,12 @@ } } -.mat-list .mat-list-item.center .mat-list-item-content{ - justify-content: center; -// color: #fff -} -.mat-list .mat-list-item.center .mat-list-text>*{ -margin: 0 auto 0 0; -} +// .mat-list .mat-list-item.center .mat-list-item-content{ +// justify-content: center; +// // color: #fff +// } +// .mat-list .mat-list-item.center .mat-list-text>*{ +// margin: 0 auto 0 0; +// } 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 988b09b1e..7c6266f33 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 @@ -118,6 +118,7 @@ import { RentalVerificationComponent } from './list-pd/start-pd/forms/rental-ver import { InitiateAdditionalPdComponent } from './list-pd/initiate-additional-pd/initiate-additional-pd.component'; import { ManageDailyPurchaseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component'; import { DailyPurchaseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component'; +import { ManageRentalVerificationComponent } from './list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component'; /** * Custom angular notifier options @@ -164,7 +165,7 @@ const pdCustomNotifierOptions: NotifierOptions = { }; @NgModule({ - declarations: [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, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent], + declarations: [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, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent], imports: [ CommonModule, ManagePdRoutingModule, @@ -197,13 +198,13 @@ const pdCustomNotifierOptions: NotifierOptions = { AgmCoreModule.forRoot({apiKey: 'AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg'}),OwlDateTimeModule, OwlNativeDateTimeModule, ], - exports: [PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, 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, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent], + exports: [PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, 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, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent], 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, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent], + ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent], }) export class ManagePdModule { } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 520c7650f..42b76087b 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -63,7 +63,6 @@ export class PdTrigerService { catchError(this.handleError('role', [])) ) } - /* To get addresses From T_PD_ADDRESS table., * Used In 1) edit pd trigger component * 2) Address Form @@ -678,5 +677,14 @@ export class PdTrigerService { } + //To Get State City Name Pincode + //From Name : Rental Information + getStateCityNamesAndPincode(values): Observable { + return this._http.post(this.apiUrl + 'getStateCityNamesAndPincode', { "records":values }) + .pipe( + catchError(this.handleError('role', [])) + ) + } + }