This commit is contained in:
venbatechnologies@gmail.com 2019-03-06 10:19:59 +05:30
commit 509eea8b68
6 changed files with 1091 additions and 193 deletions

View File

@ -18,11 +18,63 @@
<mat-dialog-content>
<mat-card>
<mat-card-header>
<mat-card-title>Property Details</mat-card-title>
</mat-card-header>
<mat-card-content>
<div fxLayout="row wrap" style="margin-left: 1%;">
<!-- start address -->
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="30" fxFlex.xl="30">
<mat-form-field style="width:90%" appearance="outline">
<mat-label>Address of the Property</mat-label>
<textarea matInput rows="4" placeholder="" formControlName="address_property" required></textarea>
</mat-form-field>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="60" fxFlex.lg="70" fxFlex.xl="70">
<!--start name of the who showing property to officer -->
<mat-form-field style="width:32%" appearance="outline">
<mat-label>State</mat-label>
<mat-select placeholder=""
formControlName="state" required>
<mat-option *ngFor="let stVal of stateList" [value]="stVal.state_id">
{{stVal.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:30%" appearance="outline">
<mat-label>City</mat-label>
<mat-select placeholder=""
formControlName="city" required>
<mat-option *ngFor="let ctVal of cityList" [value]="ctVal.city_id">
{{ctVal.city_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:20%" appearance="outline">
<mat-label>Pincode</mat-label>
<mat-select placeholder=""
formControlName="pincode" required>
<mat-option *ngFor="let pinVal of pincodeList" [value]="pinVal.pincode_id">
{{pinVal.pincode}}
</mat-option>
</mat-select>
</mat-form-field>
<div align="left" style="margin-left: 2%;">
<mat-checkbox color="primary" formControlName="validate_visited_address">Is Address Validated During Visit ? <strong>( {{_rentalForm.value.validate_visited_address===true ? 'Yes' : 'No'}} )</strong></mat-checkbox>
</div>
<mat-form-field style="width:90%;margin-top: 2%;" appearance="outline" *ngIf="_rentalForm.controls['other_visited_address']">
<mat-label>Actual Address Visited</mat-label>
<textarea matInput rows="2" placeholder="" formControlName="other_visited_address" required></textarea>
</mat-form-field>
</div>
<!-- end -->
</div>
<div fxLayout="row wrap">
<!--start name of the who showing property to officer -->
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Name of the Person who is showing the Property to Sineedge Officer</mat-label>
<mat-label>Name of the Person Who is Showing the Property to Sineedge Officer</mat-label>
<mat-select placeholder="Name"
formControlName="person_met" [compareWith]="compareObjects" multiple required>
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
@ -36,10 +88,10 @@
<mat-label>Specify Other Person</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_person_met" required>
</mat-form-field>
<mat-form-field style="width:35%" appearance="outline" *ngIf="_rentalForm.controls['other_name_person_showing_property']">
<mat-label>Who is {{_rentalForm.controls['other_person_met'].value}}</mat-label>
<mat-form-field style="width:35%" appearance="outline" *ngIf="_rentalForm.controls['other_name_person_showing_property'] && _rentalForm.value.other_person_met!=''">
<mat-label>Who is {{_rentalForm.controls['other_person_met'].value}} ?</mat-label>
<mat-select placeholder=""
formControlName="other_name_person_showing_property" (selectionChange)="personShowingChanges(_rentalForm.controls['other_name_person_showing_property'].value)" multiple required>
formControlName="other_name_person_showing_property" [compareWith]="compareSingleObjects" (selectionChange)="personShowingChanges(_rentalForm.controls['other_name_person_showing_property'].value)" multiple required>
<mat-option *ngFor="let pType of personType" [value]="pType">
{{pType.name}}
</mat-option>
@ -47,8 +99,8 @@
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_name_person_type']">
<mat-label>Specify Other</mat-label>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_name_person_type'] && _rentalForm.value.other_person_met!=''">
<mat-label>Who is {{_rentalForm.controls['other_person_met'].value}} ?</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_name_person_type" required>
</mat-form-field>
<!-- end -->
@ -82,119 +134,445 @@
<mat-label>Relation To</mat-label>
<mat-select placeholder="" formControlName="property_owner_other_relation_to" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let rtGroup of mergeCompanyApplicant" [label]="rtGroup.groupName">
<mat-option [value]="relationto" *ngFor="let relationto of rtGroup.groupValues" [disabled]="relationto.id ==0">{{relationto.name | titlecase}}</mat-option>
<mat-option [value]="relationto" *ngFor="let relationto of rtGroup.groupValues">{{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}}</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<!-- end -->
<!-- start proof documents -->
<mat-form-field style="width:28%" appearance="outline">
<mat-label>Ownership Proof Documents Sighted</mat-label>
<mat-select placeholder="" formControlName="property_ownership_proof_documents" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:35%" appearance="outline" *ngIf="_rentalForm.controls['sighted_documents']">
<mat-label>Type of Document Sighted</mat-label>
<mat-select placeholder="" formControlName="sighted_documents" [compareWith]="compareSingleObjects" (selectionChange)="getSightedDocs(_rentalForm.controls['sighted_documents'].value)" required>
<mat-option [value]="prDocs" *ngFor="let prDocs of documentList">{{prDocs.name | titlecase}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_sighted_documents']">
<mat-label>Other Type of Document</mat-label>
<input matInput placeholder="" formControlName="other_sighted_documents" required>
</mat-form-field>
<!-- end -->
<!-- start nature of ther property -->
<mat-form-field style="width:67%" appearance="outline">
<mat-label>Nature of Let Out Property as per Loan Applicant</mat-label>
<mat-select placeholder=""
formControlName="nature_property" [compareWith]="compareSingleObjects" required>
<mat-option *ngFor="let property of propertyNature" [value]="property">
{{property.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_nature_property']">
<mat-label>Other Property</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_nature_property" required>
</mat-form-field>
<!-- end -->
<!-- start type of units -->
<mat-form-field style="width:48%" appearance="outline">
<mat-label>Type of Units as per Loan Applicants</mat-label>
<mat-select placeholder=""
formControlName="unit_type" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let ugroup of unitTypeList" [label]="ugroup.groupName">
<mat-option *ngFor="let unit of ugroup.groupValues" [value]="unit">
{{unit.name}}
</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_unit_type']">
<mat-label>Specify Other Unit Type</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_unit_type" required>
</mat-form-field>
<mat-form-field style="width:15%" appearance="outline" *ngIf="_rentalForm.controls['no_floor']">
<mat-label>No of Floors</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="no_floor" maxlength="2">
</mat-form-field>
<mat-form-field style="width:15%;" appearance="outline" *ngIf="_rentalForm.controls['no_units']">
<mat-label>Tot No of Units</mat-label>
<input OnlyNumber matInput autocomplete="off" placeholder="" formControlName="no_units" maxlength="3">
</mat-form-field>
<!-- end -->
</div>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-content>
<div fxLayout="row wrap">
<!--start payment -->
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Monthly Rent Amount as per Loan Applicant</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="monthly_rent_amount" (keyup)="inWords($event,1)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="_rentalForm.controls['monthly_rent_amount'].value != ''">{{"&#8377;"}} {{rentAmtInwords}} Only</mat-hint>
<!-- this is for property unit details-->
<ng-container formArrayName="property_unit_details" *ngIf="_rentalForm.value.property_unit_details.length>0">
<mat-card *ngFor="let units of _rentalForm.controls.property_unit_details['controls']; let u=index;let ulast = last" [formGroupName]="u">
<mat-card-header>
<mat-card-title>
Unit {{u+1}}
</mat-card-title>
</mat-card-header>
<mat-card-content>
<div fxLayout="row wrap">
<!-- start tenant/lessees -->
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Name of the Tenant(s)/Lessees(s) of the Let out Property</mat-label>
<mat-select placeholder="" formControlName="tenant_lessees_options" (selectionChange)="generateTenantOptions(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">Name(s) not provided</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['name_tenant_lessees']">
<mat-label>Name of Tenant(s)/Lessees(s)</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="name_tenant_lessees" required>
</mat-form-field>
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['name_tenant_lessees_reason']">
<mat-label>Why Tenant(s)/Lessees(s) Name not Provided</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="name_tenant_lessees_reason" required>
</mat-form-field>
<!-- end tenant/lessees-->
<!--start payment -->
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Monthly Rent Amount as per Loan Applicant</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="monthly_rent_amount" required>
<!-- (keyup)="inWords($event,1)" -->
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.monthly_rent_amount != ''">{{"&#8377;"}} {{units.value.monthly_rent_amount | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Mode of Payment of Rent as per Loan Applicant</mat-label>
<mat-select placeholder=""
formControlName="payment_mode" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,1)" required>
<mat-option *ngFor="let payment of paymentOptions" [value]="payment">
{{payment.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_cash']">
<mat-label>Amount Received in Cash</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_cash" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_cash != ''">{{"&#8377;"}} {{units.value.amount_received_cash | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank']">
<mat-label>Amount Received in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank != ''">{{"&#8377;"}} {{units.value.amount_received_bank | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:30%;" appearance="outline" *ngIf="units.controls['payment_received_reason']">
<mat-label>Reason for Receiving Multiple Payment Mode</mat-label>
<textarea matInput placeholder="" formControlName="payment_received_reason" required></textarea>
</mat-form-field>
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Securtity Deposit amount as per Loan Applicant</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="securtity_deposit_amount" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.securtity_deposit_amount != ''">{{"&#8377;"}} {{units.value.securtity_deposit_amount | numberToWords}} Only</mat-hint>
</mat-form-field>
<!-- end -->
<!-- start area covered by the property -->
<mat-form-field style="width:35%;" appearance="outline">
<mat-label>Area Covered by the Property</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" maxlength="3" formControlName="property_cover_area" required>
</mat-form-field>
<!-- end area covered -->
<!-- start unit of measurement -->
<mat-form-field style="width:28%" appearance="outline">
<mat-label>Unit of Measurement</mat-label>
<mat-select placeholder=""
formControlName="unit_measurement" [compareWith]="compareSingleObjects" (selectionChange)="generateOtherunitMeasurement(units.value,u)" required>
<mat-option *ngFor="let unitM of unitMeasurementList" [value]="unitM">
{{unitM.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="units.controls['other_unit_measurement']">
<mat-label>Other Unit of Measurement</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_unit_measurement" required>
</mat-form-field>
<!-- end -->
<!-- start Rent Agreement executed -->
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Is Rent Agreement executed for the Property let out</mat-label>
<mat-select placeholder="" formControlName="is_rent_agreement_executed" (selectionChange)="generateRentAgreementSeen(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<!-- end -->
<!-- start rent agreement -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['rent_agreement_seen']">
<mat-label>Rent Agreement Seen</mat-label>
<mat-select placeholder="" formControlName="rent_agreement_seen" (selectionChange)="generateRegisterOptions(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<!-- end -->
<!-- start Rent Agreement Registered -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['rent_agreement_registered']">
<mat-label>Is the Rent Agreement Registered at Sub-Registrar Office</mat-label>
<mat-select placeholder="" formControlName="rent_agreement_registered" (selectionChange)="generateRegisterDetails(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Mode of Payment of Rent as per Loan Applicant</mat-label>
<!-- end -->
<!-- start rent agreement date details -->
<mat-form-field style="width:30%" appearance="outline" *ngIf="units.controls['agreement_date']">
<mat-label>Date of Agreement</mat-label>
<input matInput [max]="maxDate" [matDatepicker]="agreementpicker" formControlName="agreement_date"
placeholder="" (dateChange)="calculateExpiryDate($event,u)" readonly>
<mat-datepicker-toggle matSuffix [for]="agreementpicker" disabled="false"></mat-datepicker-toggle>
<mat-datepicker #agreementpicker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width:62%" appearance="outline" *ngIf="units.controls['agreement_no_months']">
<mat-label>No of Months for Which Property has been let out as per Agreement</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" maxlength="4" formControlName="agreement_no_months" (keyup)="calculateExpiryDate($event,u)" required>
</mat-form-field>
<mat-form-field style="width:30%" appearance="outline" *ngIf="units.controls['agreement_expiring_date']">
<mat-label>Date on which Agreement is Expiring</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="agreement_expiring_date" readonly>
</mat-form-field>
<mat-form-field style="width:62%" appearance="outline" *ngIf="units.controls['rental_remaining_months']">
<mat-label>No of Rental Months Remaining as per Agreement</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="rental_remaining_months" readonly>
</mat-form-field>
<!-- end -->
<!-- start agreement rent amount -->
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['agreement_monthly_rent_amount']">
<mat-label>Monthly Rent Amount as per Agreement</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="agreement_monthly_rent_amount" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.agreement_monthly_rent_amount != ''">{{"&#8377;"}} {{units.value.agreement_monthly_rent_amount | numberToWords}} Only</mat-hint>
</mat-form-field>
<!-- end -->
<!-- start Security Deposit amount as per agreement -->
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['agreement_security_deposit_amount']">
<mat-label>Security Deposit Amount as per Agreement</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="agreement_security_deposit_amount" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.agreement_security_deposit_amount != ''">{{"&#8377;"}} {{units.value.agreement_security_deposit_amount | numberToWords}} Only</mat-hint>
</mat-form-field>
<!-- end -->
<!-- start validate agreement amount -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['monthly_rent_amount'] && units.controls['agreement_monthly_rent_amount'] && validateAgreementAmt(units.controls['monthly_rent_amount'] ? units.value.monthly_rent_amount :'',units.controls['agreement_monthly_rent_amount'] ? units.value.agreement_monthly_rent_amount:'') !=0">
<mat-label>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?</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="differences_loanapplicant_rentagreement">
</mat-form-field>
<!-- end -->
<!-- start name of owners as per agreement -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['agreement_property_owners_name']">
<mat-label>Name of Owner / Owners of Rented Property as per Rent Agreement</mat-label>
<mat-select placeholder="Name"
formControlName="agreement_property_owners_name" [compareWith]="compareObjects" multiple (selectionChange)="generateAgreementOtherOwners(units.value.agreement_property_owners_name,u)" required>
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:28%" appearance="outline" *ngIf="units.controls['agreement_property_owner_other']">
<mat-label>Specify Other Owner/Owners</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="agreement_property_owner_other" required>
</mat-form-field>
<mat-form-field style="width:35%" appearance="outline" *ngIf="units.controls['agreement_property_owner_other_relationship']">
<mat-label>Relation of Owner to Rent Agreement</mat-label>
<mat-select placeholder="" formControlName="agreement_property_owner_other_relationship" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let rGroup of relationShipList" [label]="rGroup.groupName">
<!-- <mat-option>Select</mat-option> -->
<mat-option [value]="relation" *ngFor="let relation of rGroup.groupValues">{{relation.name | titlecase}}</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="units.controls['agreement_property_owner_other_relation_to']">
<mat-label>Relation To</mat-label>
<mat-select placeholder="" formControlName="agreement_property_owner_other_relation_to" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let rtGroup of mergeCompanyApplicant" [label]="rtGroup.groupName">
<mat-option [value]="relationto" *ngFor="let relationto of rtGroup.groupValues">{{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}}</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<!-- end -->
<!-- start tenant agreeent name -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['agreement_tenant_lessees_name']">
<mat-label>Name of Tenants / Lessees as per Rent Agreement</mat-label>
<textarea matInput rows="4" placeholder="" formControlName="agreement_tenant_lessees_name" required></textarea>
</mat-form-field>
<!-- end -->
<!-- end -->
<!-- start met tenant/lessees-->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['met_tenant_lessees_options']">
<mat-label>Tenant(s) / Lessee(s) Met During Visit of the Rented Property</mat-label>
<mat-select placeholder="" formControlName="met_tenant_lessees_options" (selectionChange)="generateTenantMetDetails(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['name_tenant_lessees_per_met']">
<mat-label>Name of the Tenant / Lessee Met</mat-label>
<!-- <mat-select placeholder="" formControlName="name_tenant_lessees_per_met" required>
<mat-option [value]="metTenant" *ngFor="let metTenant of units.value.name_tenant_lessees">{{metTenant.name}}</mat-option>
</mat-select> -->
<input matInput autocomplete="off" placeholder="" formControlName="name_tenant_lessees_per_met" required>
</mat-form-field>
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['name_tenant_lessees_reason_per_met']">
<mat-label>Why Tenant / Lessee not Met ?</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="name_tenant_lessees_reason_per_met" required>
</mat-form-field>
<!-- end -->
<!--start tenant met owners-->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['property_owner_per_met']">
<mat-label>Name of Owner as per Tenant / Lessee Met</mat-label>
<mat-select placeholder="Name"
formControlName="property_owner_per_met" [compareWith]="compareObjects" multiple (selectionChange)="generateMetOtherOwners(units.value,u)" required>
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:28%" appearance="outline" *ngIf="units.controls['property_owner_other_per_met']">
<mat-label>Specify Other Owner/Owners</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="property_owner_other_per_met" required>
</mat-form-field>
<mat-form-field style="width:35%" appearance="outline" *ngIf="units.controls['property_owner_other_relationship_per_met']">
<mat-label>Relation of Owner to Loan Applicant</mat-label>
<mat-select placeholder="" formControlName="property_owner_other_relationship_per_met" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let rGroup of relationShipList" [label]="rGroup.groupName">
<!-- <mat-option>Select</mat-option> -->
<mat-option [value]="relation" *ngFor="let relation of rGroup.groupValues">{{relation.name | titlecase}}</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="units.controls['property_owner_other_relation_to_per_met']">
<mat-label>Relation To</mat-label>
<mat-select placeholder="" formControlName="property_owner_other_relation_to_per_met" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let rtGroup of mergeCompanyApplicant" [label]="rtGroup.groupName">
<mat-option [value]="relationto" *ngFor="let relationto of rtGroup.groupValues">{{relationto.id=="0" ? 'Not Applicable' : relationto.name | titlecase}}</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<!-- end -->
<!-- start met payment -->
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['paid_monthly_rent_per_met']">
<mat-label>Monthly Rent Amount Paid as per Tenant / Lessee Met</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="paid_monthly_rent_per_met" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.paid_monthly_rent_per_met != ''">{{"&#8377;"}} {{units.value.paid_monthly_rent_per_met | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:46%" appearance="outline" *ngIf="units.controls['period_of_stay_per_met']">
<mat-label>Period (Months) of Stay as per Tenant / Lessee Met</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="period_of_stay_per_met" maxlength="5" required>
</mat-form-field>
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['payment_mode_per_met']">
<mat-label>Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit</mat-label>
<mat-select placeholder=""
formControlName="payment_mode" required>
formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required>
<mat-option *ngFor="let payment of paymentOptions" [value]="payment">
{{payment.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:26%" appearance="outline" *ngIf="_rentalForm.controls['amount_received_cash']">
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_cash_per_met']">
<mat-label>Amount Received in Cash</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_cash" (keyup)="inWords($event,2)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="_rentalForm.controls['amount_received_cash'].value != ''">{{"&#8377;"}} {{amountReceivedCash}} Only</mat-hint>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_cash_per_met" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_cash_per_met != ''">{{"&#8377;"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:26%" appearance="outline" *ngIf="_rentalForm.controls['amount_received_bank']">
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank_per_met']">
<mat-label>Amount Received in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank" (keyup)="inWords($event,3)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="_rentalForm.controls['amount_received_bank'].value != ''">{{"&#8377;"}} {{amountReceivedBank}} Only</mat-hint>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank_per_met" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank_per_met != ''">{{"&#8377;"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:36%" appearance="outline" *ngIf="_rentalForm.controls['payment_received_reason']">
<mat-label>Payment Received Reason</mat-label>
<textarea matInput placeholder="" formControlName="payment_received_reason"></textarea>
<mat-form-field style="width:30%;" appearance="outline" *ngIf="units.controls['payment_received_reason_per_met']">
<mat-label>Reason for Receiving Multiple Payment Mode</mat-label>
<textarea matInput placeholder="" formControlName="payment_received_reason_per_met" required></textarea>
</mat-form-field>
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Securtity Deposit amount as per Loan Applicant</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="securtity_deposit_amount" (keyup)="inWords($event,4)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="_rentalForm.controls['securtity_deposit_amount'].value != ''">{{"&#8377;"}} {{securtityDepositAmount}} Only</mat-hint>
</mat-form-field>
<!-- end -->
</div>
</mat-card-content>
</mat-card>
<!-- start validate appplicant/agreement payment options -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['payment_difference_per_met'] && (units.value.monthly_rent_amount>0 && units.value.paid_monthly_rent_per_met>0 && units.value.payment_mode!='' && units.value.payment_mode_per_met!='') && (units.value.monthly_rent_amount!=units.value.paid_monthly_rent_per_met || units.value.payment_mode.id!=units.value.payment_mode_per_met.id)">
<mat-label>What is the Reason for Difference in Rent Amount or Mode of Payment</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="payment_difference_per_met">
</mat-form-field>
<!-- end -->
<!-- end met payment -->
</div>
</mat-card-content>
<mat-card-actions align="end">
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeUnit(u)" *ngIf="_rentalForm.value.property_unit_details.length>0"
matTooltip="Remove Unit" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</ng-container>
<div fxLayout="row" style="margin-top: 2%;margin-bottom:2%; ">
<div fxFlex="100" align="center">
<button type="button" mat-flat-button (click)="addMoreUnitDetails()"
matTooltip="Add More Unit" matTooltipPosition="above" color="primary">
<strong>Add More Unit</strong>
</button>
</div>
</div>
<!-- unit end -->
<mat-card>
<mat-card-header>
<mat-card-title>
Third Party Check
</mat-card-title>
</mat-card-header>
<mat-card-content>
<div fxLayout="row wrap">
<!-- start nature of ther property -->
<mat-form-field style="width:67%" appearance="outline">
<mat-label>Nature of Let Out property as per Loan Applicant</mat-label>
<mat-select placeholder=""
formControlName="nature_property" required>
<mat-option *ngFor="let property of propertyNature" [value]="property">
{{property.name}}
</mat-option>
<!-- start third party check -->
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Third party check done on prevailing rent in the area</mat-label>
<mat-select placeholder="" formControlName="done_third_party_check" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_nature_property']">
<mat-label>Other Property</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_nature_property" required>
</mat-form-field>
<!-- end -->
<!-- start type of units -->
<mat-form-field style="width:67%" appearance="outline">
<mat-label>Type of Units as per Loan Applicants</mat-label>
<mat-select placeholder=""
formControlName="unit_type" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let ugroup of unitTypeList" [label]="ugroup.groupName">
<mat-option *ngFor="let unit of ugroup.groupValues" [value]="unit">
{{unit.name}}
</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['other_unit_type']">
<mat-label>Other Units</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="other_unit_type" required>
</mat-form-field>
<mat-form-field style="width:25%" appearance="outline" *ngIf="_rentalForm.controls['no_floor']">
<mat-label>No Floor</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="no_floor" maxlength="2" (keyup)="generateFloor($event)" required>
</mat-form-field>
<div fxFlex="100" *ngIf="_rentalForm.controls['floor_details']">
<div fxFlex="100" formArrayName="floor_details">
<div fxLayout="row nowrap" class="align-margin" *ngFor="let floor of _rentalForm.get('floor_details').controls; let f = index" [formGroupName]="f">
<mat-form-field style="width:40%;" appearance="outline">
<mat-label>Floor Level</mat-label>
<input matInput autocomplete="off" placeholder="" formControlName="floor_level" required>
</mat-form-field>
<mat-form-field style="width:51%;" appearance="outline">
<mat-label>No of Units on the Floor</mat-label>
<input OnlyNumber matInput autocomplete="off" placeholder="" formControlName="no_units_in_floor" maxlength="2" required>
</mat-form-field>
</div>
</div>
</div>
<!-- end -->
</mat-form-field>
<!-- start address as per applicant-->
<mat-form-field style="width:100%;" appearance="outline" *ngIf="_rentalForm.controls['whom_third_party_check_done']">
<mat-label>Name of person with whom Third Party Check on going rentals in the area done</mat-label>
<input matInput placeholder="" formControlName="whom_third_party_check_done" required>
</mat-form-field>
<mat-form-field style="width:100%;" appearance="outline" *ngIf="_rentalForm.controls['description_third_party_check_done']">
<mat-label>Description of the person with whom the Third Party Check is done</mat-label>
<textarea matInput placeholder="" formControlName="description_third_party_check_done" required></textarea>
</mat-form-field>
<mat-form-field style="width:100%;" appearance="outline" *ngIf="_rentalForm.controls['rental_rates_third_party_check_done']">
<mat-label>Rental rates in the area as per the person with whom Third Party Check is done</mat-label>
<textarea matInput placeholder="" formControlName="rental_rates_third_party_check_done" required></textarea>
</mat-form-field>
<mat-form-field style="width:100%;" appearance="outline" *ngIf="_rentalForm.controls['why_third_party_check_not_done']">
<mat-label>Why Third party check not done</mat-label>
<textarea matInput placeholder="" formControlName="why_third_party_check_not_done" required></textarea>
</mat-form-field>
<!-- end -->
<!-- end -->
</div>
</mat-card-content>
</mat-card>

View File

@ -9,5 +9,6 @@
justify-content: center !important;
}
.align-margin {
margin-left: 25%;
margin-left: 4%;
margin-right: 4%;
}

View File

@ -1,15 +1,19 @@
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';
@Component({
selector: 'app-rental-verification',
templateUrl: './rental-verification.component.html',
styleUrls: ['./rental-verification.component.scss']
styleUrls: ['./rental-verification.component.scss'],
})
export class RentalVerificationComponent implements OnInit {
pipe = new DatePipe('en-US');
customer_segment_abbr: any;
subproduct_abbr: any;
lender_applicant_id: any;
@ -27,13 +31,15 @@ export class RentalVerificationComponent implements OnInit {
relationToList: any=[];
rentAmtInwords : String;
paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}];
amountReceivedCash: String;
amountReceivedBank: String;
securtityDepositAmount: String;
propertyNature: any=[{id:2,name:"ResiDential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}];
unitTypeList: any=[];
stateList:any=[];
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=[];
public viewerOptions: any = {
navbar: false,
toolbar: {
@ -91,6 +97,8 @@ export class RentalVerificationComponent implements OnInit {
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;
@ -103,12 +111,16 @@ export class RentalVerificationComponent implements OnInit {
}
}
});
//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');
}
else {
@ -133,58 +145,68 @@ export class RentalVerificationComponent implements OnInit {
this._rentalForm.removeControl('property_owner_other_relation_to');
}
});
// mode of payment is both cash and bank means genereate dynamic fields
this._rentalForm.controls['payment_mode'].valueChanges.subscribe(val => {
val ? this._rentalForm.addControl('payment_received_reason', new FormControl('')) : this._rentalForm.removeControl('payment_received_reason');
if(val && val.id==1){
this._rentalForm.addControl('amount_received_cash', new FormControl('', Validators.required));
this._rentalForm.removeControl('amount_received_bank'); val.id==2 ? this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required)) : this._rentalForm.removeControl('amount_received_bank');
}
else if(val && val.id==2){
this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required));
this._rentalForm.removeControl('amount_received_cash');
}
else if(val && val.id==3){
this._rentalForm.addControl('amount_received_cash', new FormControl('', Validators.required));
this._rentalForm.addControl('amount_received_bank', new FormControl('', Validators.required));
}
else {
this._rentalForm.removeControl('amount_received_cash');
this._rentalForm.removeControl('amount_received_bank');
this._rentalForm.removeControl('payment_received_reason');
}
});
// observe other property type
this._rentalForm.controls['nature_property'].valueChanges.subscribe(val => {
this._rentalForm.controls['nature_property'].valueChanges.subscribe(val => {
val.id==1 ? this._rentalForm.addControl('other_nature_property', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_nature_property');
});
// observe unit type changes
this._rentalForm.controls['unit_type'].valueChanges.subscribe(val => {
val.id==1 ? this._rentalForm.addControl('other_unit_type', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_unit_type');
val.group_id==1 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('', Validators.required)) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('', Validators.required)) : this._rentalForm.removeControl('no_floor');
val.group_id==1 && val.id==7 ? this._rentalForm.addControl('floor_details', this._fb.array([])) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('floor_details', this._fb.array([])) : this._rentalForm.removeControl('floor_details');
val.group_id==1 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('')) : val.group_id==2 && val.id==7 ? this._rentalForm.addControl('no_floor', new FormControl('')) : this._rentalForm.removeControl('no_floor');
});
// 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');
});
}
initRentalForm() {
return this._rentalForm = this._fb.group({
pdid: this.pdid,
formid: this.form_id,
person_met: ['',Validators.required],
property_owner: ['',Validators.required],
monthly_rent_amount: ['',Validators.required],
payment_mode: ['',Validators.required],
securtity_deposit_amount: ['',Validators.required],
nature_property: ['',Validators.required],
unit_type:['',Validators.required],
address:['',Validators.required],
address_property:['',Validators.required],
state:['',Validators.required],
city:['',Validators.required],
pincode:['',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:[''],
property_unit_details : this._fb.array([]),
done_third_party_check :['',Validators.required],
});
}
// other_name_person_showing_property changes
@ -198,6 +220,11 @@ else {
}
}
// 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(
@ -209,91 +236,504 @@ getMasterDetails(table: string, type: number) {
});
relationshipList.length > 0 ? this.relationShipList.push({groupName:'Personal',groupValues:relationshipList}):'';
}
if (type == 2) {
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}))
}
}
});
}
// generate floor rows
generateFloor(e:any): void{
let control = <FormArray>this._rentalForm.controls['floor_details'];
if(e.target.value && Math.round(e.target.value)!=0){
if(Math.round(e.target.value) > this._rentalForm.value.floor_details.length){
let rowValue = Math.round(e.target.value)-this._rentalForm.value.floor_details.length;
for(let i=rowValue;i>0;i--){
control.push(this.createFloorDetails(''));
// load form data
loadFormData(){
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(data => {
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 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 = <FormArray>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');
// 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 ? 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.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('', Validators.required)) : 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('', Validators.required)) : 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.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_difference_per_met');
});
}
}
else if(Math.round(e.target.value) < this._rentalForm.value.floor_details.length){
let rowValue = this._rentalForm.value.floor_details.length-Math.round(e.target.value);
for(let i=rowValue;i>0;i--){
control.removeAt(this._rentalForm.value.floor_details.length-1);
}
}
}
else if(e.target.value && Math.round(e.target.value)==0){
control.controls = [];
control.setValue([]);
}
else{
control.controls = [];
control.setValue([]);
}
e.stopPropagation();
this._rentalForm.patchValue(rentalVal);
});
}
// create floor details
createFloorDetails(details){
if(details){
// add more unit details
addMoreUnitDetails(){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
//control.push(this.createUnitDetails(''));
control.push(this.createUnitDetails(''));
}
// create unit details
createUnitDetails(details){
return this._fb.group({
floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])],
no_units_on_floor: ['', Validators.compose([Validators.required])],
});
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 = <FormArray>this._rentalForm.controls['property_unit_details'];
control.removeAt(index);
}
// generate payment dynamic fields
generatePaymentOptions(value:any,index:number,type: number){
if(type==1){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
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));
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));
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 = <FormArray>this._rentalForm.controls['property_unit_details'];
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));
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));
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');
}
}
}
// tenant/lessees options
generateTenantOptions(value:any,index:number){
let control: any = <FormArray>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 = <FormArray>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 Rent AgreementSeen
generateRentAgreementSeen(value: any,index:number){
let control: any = <FormArray>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{
return this._fb.group({
floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])],
no_units_in_floor: ['', Validators.compose([Validators.required])],
});
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 = <FormArray>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 = <FormArray>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{
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 = <FormArray>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)));
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 = <FormArray>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){
return (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent);
}
else{
return "0";
}
}
// generate tenant met details
generateTenantMetDetails(value: any, index: number){
let control: any = <FormArray>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('', Validators.required));
}
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 = <FormArray>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 = <FormArray>this._rentalForm.controls['floor_details'];
// if(e.target.value && Math.round(e.target.value)!=0){
// if(Math.round(e.target.value) > this._rentalForm.value.floor_details.length){
// let rowValue = Math.round(e.target.value)-this._rentalForm.value.floor_details.length;
// for(let i=rowValue;i>0;i--){
// control.push(this.createFloorDetails(''));
// }
// }
// else if(Math.round(e.target.value) < this._rentalForm.value.floor_details.length){
// let rowValue = this._rentalForm.value.floor_details.length-Math.round(e.target.value);
// for(let i=rowValue;i>0;i--){
// control.removeAt(this._rentalForm.value.floor_details.length-1);
// }
// }
// }
// else if(e.target.value && Math.round(e.target.value)==0){
// control.controls = [];
// control.setValue([]);
// }
// else{
// control.controls = [];
// control.setValue([]);
// }
// e.stopPropagation();
// }
// create floor details
// createFloorDetails(details){
// if(details){
// return this._fb.group({
// floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])],
// no_units_on_floor: ['', Validators.compose([Validators.required])],
// });
// }
// else{
// return this._fb.group({
// floor_level: [this._rentalForm.value.floor_details.length==0 ? 'Ground Floor' : this._rentalForm.value.floor_details.length+' Floor', Validators.compose([Validators.required])],
// no_units_in_floor: ['', Validators.compose([Validators.required])],
// });
// }
// }
// compare objects for merge two master table details
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
return true;
else return false
}
/** Amount InWords */
inWords(e,flag){
switch(flag){
case 1:
this.rentAmtInwords = this._pd.convertNumberToWords(e.target.value);
break;
case 2:
this.amountReceivedCash = this._pd.convertNumberToWords(e.target.value);
break;
case 3:
this.amountReceivedBank = this._pd.convertNumberToWords(e.target.value);
break;
case 4:
this.securtityDepositAmount = this._pd.convertNumberToWords(e.target.value);
break;
default:
break;
compareSingleObjects(o1: any, o2: any) {
if(o1.id == o2.id)
return true;
else return false
}
e.stopPropagation();
}
// save rental form
saveRental(details) {
saveRental(formData: any) {
if (this._rentalForm.invalid) {
this.validateAllFormFields(this._rentalForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
else {
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.!');
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Something Wents Wrong Try Again !";
});
}
}
// 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);
}
});
}
}
}

View File

@ -91,6 +91,7 @@ import { QcReviewComponent } from './list-pd/pd-report/qc-review/qc-review.compo
import { SharedModule } from "app/shared/shared.module";
import { BusinessInfoGroupComponent } from './list-pd/start-pd/forms/business-info-group/business-info-group.component';
import { SearchRelationPipe } from './../pd-pipes/search-relation.pipe';
import { NumberToWordsPipe } from './../pd-pipes/number-to-words.pipe';
import { DeleteRecordsCountPipe } from './../pd-pipes/delete-records-count.pipe';
import { BusinessAssetsInfoComponent } from './list-pd/start-pd/forms/business-assets-info/business-assets-info.component';
import { BusinessBankingDetailsComponent } from './list-pd/start-pd/forms/business-banking-details/business-banking-details.component';
@ -160,7 +161,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
};
@NgModule({
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent],
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent],
imports: [
CommonModule,
ManagePdRoutingModule,

View File

@ -0,0 +1,8 @@
import { NumberToWordsPipe } from './number-to-words.pipe';
describe('NumberToWordsPipe', () => {
it('create an instance', () => {
const pipe = new NumberToWordsPipe();
expect(pipe).toBeTruthy();
});
});

View File

@ -0,0 +1,70 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'numberToWords'
})
export class NumberToWordsPipe implements PipeTransform {
transform(amount: any): any {
let words: any = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen', 'Twenty'];
words[30] = 'Thirty';
words[40] = 'Forty';
words[50] = 'Fifty';
words[60] = 'Sixty';
words[70] = 'Seventy';
words[80] = 'Eighty';
words[90] = 'Ninety';
amount = amount.toString();
let atemp = amount.split(".");
let number = atemp[0].split(",").join("");
let n_length = number.length;
let words_string = "";
let value: any;
if (n_length <= 9) {
var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
var received_n_array = new Array();
for (var i = 0; i < n_length; i++) {
received_n_array[i] = number.substr(i, 1);
}
for (var i = 9 - n_length, j = 0; i < 9; i++ , j++) {
n_array[i] = received_n_array[j];
}
for (var i = 0, j = 1; i < 9; i++ , j++) {
if (i == 0 || i == 2 || i == 4 || i == 7) {
if (n_array[i] == 1) {
n_array[j] = 10 + (+n_array[j]);
n_array[i] = 0;
}
}
}
value = "";
for (var i = 0; i < 9; i++) {
if (i == 0 || i == 2 || i == 4 || i == 7) {
value = n_array[i] * 10;
} else {
value = n_array[i];
}
if (value != 0) {
words_string += words[value] + " ";
}
if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Crores ";
}
if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Lakhs ";
}
if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) {
words_string += "Thousand ";
}
if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) {
words_string += "Hundred and ";
} else if (i == 6 && value != 0) {
words_string += "Hundred ";
}
}
words_string = words_string.split(" ").join(" ");
}
return words_string;
}
}